Skip to content

Commit

Permalink
Fix potential array index out of bounds in SetSurveyLanguage in commo…
Browse files Browse the repository at this point in the history
…n_helper.php.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11763 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Aaron Schmitz committed Dec 26, 2011
1 parent ac7a362 commit 06f3c8b
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions application/helpers/common_helper.php
Expand Up @@ -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'));
}

/**
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 != '')
Expand Down Expand Up @@ -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');
}

Expand Down

0 comments on commit 06f3c8b

Please sign in to comment.