Skip to content

Commit

Permalink
Fixed issue #07298: Save your unfinished survey - Return to survey hy…
Browse files Browse the repository at this point in the history
…perlink doesn't work.
  • Loading branch information
Shnoulle committed Feb 15, 2013
1 parent 5291dd5 commit 9a0229d
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions application/helpers/replacements_helper.php
Expand Up @@ -510,19 +510,18 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
$_strreview = $clang->gT("If you want to check any of the answers you have made, and/or change them, you can do that now by clicking on the [<< prev] button and browsing through your responses.");
}

if (isset($thissurvey['active']) and $thissurvey['active'] == "N")
{
$_restart= "<a href='" . Yii::app()->getController()->createUrl("survey/index/sid/$surveyid/newtest/Y");
if (isset($s_lang) && $s_lang!='') $_restart.="/lang/".$s_lang;
$_restart.="'>".$clang->gT("Restart this survey")."</a>";
}
else if (isset($surveyid))
{
$restart_token = returnGlobal('token');
if (!empty($restart_token)) $restart_extra = "/token/".urlencode($restart_token);
else $restart_extra = "/newtest/Y";
if (!empty($_GET['lang'])) $restart_extra .= "/lang/".returnGlobal('lang');
$_restart = "<a href='".Yii::app()->getController()->createUrl("survey/index/sid/$surveyid$restart_extra")."'>".$clang->gT("Restart this Survey")."</a>";
if(isset($surveyid))
{
$restartparam=array();
if($_token)
$restartparam['token']=sanitize_token($_token);// urlencode with needed with sanitize_token
if (Yii::app()->request->getQuery('lang'))
$restartparam['lang']=sanitize_languagecode(Yii::app()->request->getQuery('lang'));
elseif($s_lang)
$restartparam['lang']=$s_lang;
$restartparam['newtest']="Y";
$restarturl=Yii::app()->getController()->createUrl("survey/index/sid/$surveyid",$restartparam);
$_restart = "<a href='{$restarturl}'>".$clang->gT("Restart this Survey")."</a>";
}
else
{
Expand All @@ -540,12 +539,15 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de

if (isset($surveyid))
{
$_return_to_survey = "<a href=".Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}");
if (returnGlobal('token'))
if($_token)
{
$returnlink=Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}",array('token'=>sanitize_token($_token)));
}
else
{
$_return_to_survey.= "?amp;token=" . urlencode(trim(sanitize_xss_string(strip_tags(returnGlobal('token')))));
$returnlink=Yii::app()->getController()->createUrl("survey/index/sid/{$surveyid}");
}
$_return_to_survey .= "'>" . $clang->gT("Return to survey") . "</a>";
$_return_to_survey = "<a href='{$returnlink}'>".$clang->gT("Return to survey")."</a>";
}
else
{
Expand Down

0 comments on commit 9a0229d

Please sign in to comment.