From 06f3c8b0965ff2575bb0d49939771bf8105d9571 Mon Sep 17 00:00:00 2001 From: Aaron Schmitz Date: Mon, 26 Dec 2011 01:12:36 +0000 Subject: [PATCH] Fix potential array index out of bounds in SetSurveyLanguage in common_helper.php. git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11763 b72ed6b6-b9f8-46b5-92b4-906544132732 --- application/helpers/common_helper.php | 46 +++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php index 5f24d5f6bb5..7c20d66b8d5 100644 --- a/application/helpers/common_helper.php +++ b/application/helpers/common_helper.php @@ -279,26 +279,25 @@ function getqtypelist($SelectedCode = "T", $ReturnType = "selector") } /** - * Returns true if a template is a standard template - * This function does not check if a template actually exists - * - * @param string $sTemplateName template name to look for - * @return bool True if standard template, otherwise false - */ +* isStandardTemplate returns true if a template is a standard template +* This function does not check if a template actually exists +* +* @param mixed $sTemplateName template name to look for +* @return bool True if standard template, otherwise false +*/ function isStandardTemplate($sTemplateName) { - return in_array($sTemplateName, array('basic', - 'bluengrey', - 'business_grey', - 'citronade', - 'clear_logo', - 'default', - 'eirenicon', - 'limespired', - 'mint_idea', - 'sherpa', - 'vallendar' - )); + return in_array($sTemplateName,array('basic', + 'bluengrey', + 'business_grey', + 'citronade', + 'clear_logo', + 'default', + 'eirenicon', + 'limespired', + 'mint_idea', + 'sherpa', + 'vallendar')); } /** @@ -1305,7 +1304,7 @@ function getgrouplistlang($gid, $language,$surveyid) $groupselecter=""; if (!$surveyid) {$surveyid=returnglobal('sid');} - + $gidresult = Groups::model()->findAllByAttributes(array('sid' => $surveyid, 'language' => $language)); //Checked) foreach ($gidresult as $gv) { @@ -3004,7 +3003,7 @@ function SetSurveyLanguage($surveyid, $language) $clang = new Limesurvey_lang(array('langcode' => $defaultlang)); } - $thissurvey=getSurveyInfo($surveyid, $_SESSION['s_lang']); + $thissurvey=getSurveyInfo($surveyid, @$_SESSION['s_lang']); Yii::app()->loadHelper('surveytranslator'); $_SESSION['dateformats'] = getDateFormatData($thissurvey['surveyls_dateformat']); return $clang; @@ -4976,7 +4975,9 @@ function CSVUnquote($field) function incompleteAnsFilterstate() { global $filterout_incomplete_answers; - $letsfilter = CHttpRequest::getParam('filterinc'); //read get/post filterinc + $letsfilter=''; + $letsfilter = returnglobal('filterinc'); //read get/post filterinc + // first let's initialize the incompleteanswers session variable if ($letsfilter != '') @@ -5421,9 +5422,8 @@ function filterforattributes ($fieldname) */ function GetAttributeFieldNames($surveyid) { - if (($table = Yii::app()->db->schema->getTable('{{tokens_'.$surveyid . '}}')) === false) + if (!$table = Yii::app()->db->schema->getTable('{{tokens_'.$surveyid . '}}')) return Array(); - return array_filter(array_values($table->columnNames), 'filterforattributes'); }