Skip to content

Commit

Permalink
Fixed issue #8157: Pasting tokens with leading whitespace-caracters l…
Browse files Browse the repository at this point in the history
…eads to various problems
  • Loading branch information
c-schmitz committed Sep 26, 2013
1 parent 2f450a1 commit 331518d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application/controllers/survey/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ function sendreq(surveyid)
isset($_SESSION['survey_'.$surveyid]['step']) && $_SESSION['survey_'.$surveyid]['step']>0 && tableExists("tokens_{$surveyid}}}"))
{
//check if tokens actually haven't been already used
$areTokensUsed = usedTokens(trim(strip_tags(returnGlobal('token',true))),$surveyid);
$areTokensUsed = usedTokens(returnGlobal('token',true),$surveyid);
// check if token actually does exist
// check also if it is allowed to change survey after completion
if ($thissurvey['alloweditaftercompletion'] == 'Y' ) {
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/frontend_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1431,9 +1431,9 @@ function buildsurveysession($surveyid,$preview=false)
//check if token actually does exist
// check also if it is allowed to change survey after completion
if ($thissurvey['alloweditaftercompletion'] == 'Y' ) {
$oTokenEntry = Tokens_dynamic::model($surveyid)->find('token=:token', array(':token'=>trim(strip_tags($clienttoken))));
$oTokenEntry = Tokens_dynamic::model($surveyid)->find('token=:token', array(':token'=>$clienttoken));
} else {
$oTokenEntry = Tokens_dynamic::model($surveyid)->find("token=:token AND (completed = 'N' or completed='')", array(':token'=>trim(strip_tags($clienttoken))));
$oTokenEntry = Tokens_dynamic::model($surveyid)->find("token=:token AND (completed = 'N' or completed='')", array(':token'=>$clienttoken));
}

if (is_null($oTokenEntry) || ($areTokensUsed && $thissurvey['alloweditaftercompletion'] != 'Y') )
Expand Down

0 comments on commit 331518d

Please sign in to comment.