Skip to content

Commit

Permalink
Fixed issue #16682: Potential PHP Notice related to lastquestiongroup
Browse files Browse the repository at this point in the history
Dev: check if $qrrow exist before using it.

# Conflicts:
#	application/controllers/admin/surveyadmin.php
  • Loading branch information
Shnoulle committed Sep 21, 2020
1 parent d1cde99 commit 62702e8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -501,30 +501,30 @@ public function view($iSurveyID, $gid = null, $qid = null)

// We get the last question visited by user for this survey
$setting_entry = 'last_question_'.App()->user->getId().'_'.$iSurveyID;
// TODO: getGlobalSetting() DEPRECATED
$lastquestion = getGlobalSetting($setting_entry);
$lastquestion = App()->getConfig($setting_entry);
$setting_entry = 'last_question_'.App()->user->getId().'_'.$iSurveyID.'_gid';

// We get the list of templates

//$setting_entry = 'last_question_gid'.Yii::app()->user->getId().'_'.$iSurveyID;
// TODO: getGlobalSetting() DEPRECATED
$lastquestiongroup = getGlobalSetting($setting_entry);

$lastquestiongroup = App()->getConfig($setting_entry);
$aData['showLastQuestion'] = false;
if ($lastquestion != null && $lastquestiongroup != null) {
$aData['showLastQuestion'] = true;
$iQid = $lastquestion;
$iGid = $lastquestiongroup;
$qrrow = Question::model()->findByAttributes(array('qid' => $iQid, 'gid' => $iGid, 'sid' => $iSurveyID));

$aData['last_question_name'] = $qrrow['title'];
if (!empty($qrrow->questionl10ns[$baselang]['question'])) {
$aData['last_question_name'] .= ' : '.$qrrow->questionl10ns[$baselang]['question'];
if($qrrow) {
$aData['last_question_name'] = $qrrow['title'];
if (!empty($qrrow->questionl10ns[$baselang]['question'])) {
$aData['last_question_name'] .= ' : '.$qrrow->questionl10ns[$baselang]['question'];
}
$aData['last_question_link'] = $this->getController()->createUrl(
"admin/questions",
array(
'sa' => 'view',
'surveyid' => $iSurveyID,
'gid' => $iGid,
'qid' => $iQid,
)
);
}

$aData['last_question_link'] = $this->getController()->createUrl("admin/questions/sa/view/surveyid/$iSurveyID/gid/$iGid/qid/$iQid");
} else {
$aData['showLastQuestion'] = false;
}
$aData['templateapiversion'] = Template::model()->getTemplateConfiguration(null, $iSurveyID)->getApiVersion();

Expand Down

0 comments on commit 62702e8

Please sign in to comment.