Skip to content

Commit

Permalink
Fixed issue #7240: Token not accepted when using 'Exit & clear survey…
Browse files Browse the repository at this point in the history
…' and restarting survey
  • Loading branch information
c-schmitz committed Jan 31, 2013
1 parent 69a3e46 commit 505c647
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions application/helpers/replacements_helper.php
Expand Up @@ -414,13 +414,13 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
}
if (isset($surveyid) && !$iscompleted)
{
$_clearall = "<input type='button' name='clearallbtn' value='" . $clang->gT("Exit and clear survey") . "' class='clearall' "
. "onclick=\"if (confirm('" . $clang->gT("Are you sure you want to clear all your responses?", 'js') . "')) {\nwindow.open('".Yii::app()->getController()->createUrl("survey/index/sid/$surveyid",array('move'=>'clearall','lang'=>$s_lang),'&amp;');

$aURLParams=array('move'=>'clearall','lang'=>$s_lang);
if (returnGlobal('token'))
{
$_clearall .= "?token=" . urlencode(trim(sanitize_token(strip_tags(returnGlobal('token')))));
$aURLParams['token'] = trim(sanitize_token(strip_tags(returnGlobal('token'))));
}
$_clearall = "<input type='button' name='clearallbtn' value='" . $clang->gT("Exit and clear survey") . "' class='clearall' "
. "onclick=\"if (confirm('" . $clang->gT("Are you sure you want to clear all your responses?", 'js') . "')) {\nwindow.open('".Yii::app()->getController()->createUrl("survey/index/sid/$surveyid",$aURLParams,'&amp;');
$_clearall .= "', '_self')}\" />";
}
else
Expand Down Expand Up @@ -518,9 +518,8 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de
}
else if (isset($surveyid))
{
$restart_extra = "";
$restart_token = returnGlobal('token');
if (!empty($restart_token)) $restart_extra .= "/token/".urlencode($restart_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>";
Expand Down

0 comments on commit 505c647

Please sign in to comment.