Skip to content

Commit

Permalink
Fixed issue: Error on survey creation
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jul 20, 2012
1 parent 9f69785 commit d527478
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
4 changes: 2 additions & 2 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -894,7 +894,7 @@ public function copy()
if ($action == 'importsurvey' && !$aData['bFailed'])
{
$aImportResults=importSurveyFile($sFullFilepath,(isset($_POST['translinksfields'])));
if (is_null($aImportResults)) $importerror = true;
if (is_null($aImportResults)) $importerror = true;
}
elseif ($action == 'copysurvey' && (empty($importerror) || !$importerror))
{
Expand Down Expand Up @@ -1556,7 +1556,7 @@ function insert($iSurveyId=null)
);

$langsettings = new Surveys_languagesettings;
$langsettings->insertNewSurvey($aInsertData, $xssfilter);
$langsettings->insertNewSurvey($aInsertData);

Yii::app()->session['flashmessage'] = $this->getController()->lang->gT("Survey was successfully added.");

Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/import_helper.php
Expand Up @@ -2693,7 +2693,7 @@ function CSVImportSurvey($sFullFilepath,$iDesiredSurveyId=NULL,$bTranslateLinks=
unset($surveylsrowdata['lastpage']);
$surveylsrowdata['surveyls_survey_id']=$iNewSID;

$lsiresult = Surveys_languagesettings::model()->insertNewSurvey($surveylsrowdata, $xssfilter) or safeDie("<br />".$clang->gT("Import of this survey file failed")."<br />");
$lsiresult = Surveys_languagesettings::model()->insertNewSurvey($surveylsrowdata) or safeDie("<br />".$clang->gT("Import of this survey file failed")."<br />");

}

Expand Down
16 changes: 1 addition & 15 deletions application/models/Surveys_languagesettings.php
Expand Up @@ -212,23 +212,9 @@ function getAllData($sid,$lcode)
return $this->db->query($query, array($sid, $sid, $lcode));
}

function insertNewSurvey($data, $xssfiltering = false)
function insertNewSurvey($data)
{
if (isset($data['surveyls_url']) && $data['surveyls_url']== 'http://') {$data['surveyls_url']="";}

if($xssfiltering)
{
$filter = new CHtmlPurifier();
$filter->options = array('URI.AllowedSchemes'=>array(
'http' => true,
'https' => true,
));
$data["description"] = $filter->purify($data["description"]);
$data["title"] = $filter->purify($data["title"]);
$data["welcome"] = $filter->purify($data["welcome"]);
$data["endtext"] = $filter->purify($data["endtext"]);
}

return $this->insertSomeRecords($data);
}

Expand Down

0 comments on commit d527478

Please sign in to comment.