diff --git a/application/models/Survey.php b/application/models/Survey.php index 2279030e6d4..7ddc079f1d8 100644 --- a/application/models/Survey.php +++ b/application/models/Survey.php @@ -156,36 +156,37 @@ public function getTokenAttributes() * !!! Shouldn't this be moved to beforeSave? * Creates a new survey - does some basic checks of the suppplied data * - * @param string $data - * @return mixed + * @param array $aData Array with fieldname=>fieldcontents data + * @param boolean $xssfiltering Sets if the data for the new survey should be filtered for XSS + * @return integer The new survey id */ - public function insertNewSurvey($data, $xssfiltering = false) + public function insertNewSurvey($aData, $xssfiltering = false) { do { - if (isset($data['wishSID'])) // if wishSID is set check if it is not taken already + if (isset($aData['wishSID'])) // if wishSID is set check if it is not taken already { - $data['sid'] = $data['wishSID']; - unset($data['wishSID']); + $aData['sid'] = $aData['wishSID']; + unset($aData['wishSID']); } else - $data['sid'] = randomChars(6, '123456789'); + $aData['sid'] = randomChars(6, '123456789'); - $isresult = self::model()->findByPk($data['sid']); + $isresult = self::model()->findByPk($aData['sid']); } while (!is_null($isresult)); - // $data['datecreated'] = date("Y-m-d"); - if (isset($data['startdate']) && trim($data['startdate']) == '') - unset($data['startdate']); + // $aData['datecreated'] = date("Y-m-d"); + if (isset($aData['startdate']) && trim($aData['startdate']) == '') + unset($aData['startdate']); - if (isset($data['expires']) && trim($data['expires']) == '') - unset($data['expires']); + if (isset($aData['expires']) && trim($aData['expires']) == '') + unset($aData['expires']); - if (!isset($insertdata['datecreated'])) + if (!isset($aData['datecreated'])) { - $insertdata['datecreated'] = date("Y-m-d"); + $aData['datecreated'] = date("Y-m-d"); } if($xssfiltering) @@ -195,18 +196,18 @@ public function insertNewSurvey($data, $xssfiltering = false) 'http' => true, 'https' => true, )); - $data["admin"] = $filter->purify($data["admin"]); - $data["adminemail"] = $filter->purify($data["adminemail"]); - $data["bounce_email"] = $filter->purify($data["bounce_email"]); - $data["faxto"] = $filter->purify($data["faxto"]); + $aData["admin"] = $filter->purify($aData["admin"]); + $aData["adminemail"] = $filter->purify($aData["adminemail"]); + $aData["bounce_email"] = $filter->purify($aData["bounce_email"]); + $aData["faxto"] = $filter->purify($aData["faxto"]); } $survey = new self; - foreach ($data as $k => $v) + foreach ($aData as $k => $v) $survey->$k = $v; $survey->save(); - return $data['sid']; + return $aData['sid']; } /** diff --git a/tmp/.gitignore b/tmp/.gitignore index d71c9445c61..c09eefefa1f 100644 --- a/tmp/.gitignore +++ b/tmp/.gitignore @@ -1,2 +1,3 @@ -*.html \ No newline at end of file +*.html +/*.lss