Skip to content

Commit

Permalink
Dev: detangling token init
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Aug 20, 2018
1 parent e35aecc commit ff1ce15
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions application/controllers/survey/index.php
Expand Up @@ -96,22 +96,16 @@ public function action()


// Token Object
// Get token
if (!isset($token) && isset($clienttoken)) {
$token = $clienttoken;
}

//SEE IF SURVEY USES TOKENS
if ($oSurvey->hasTokensTable) {
$tokensexist = 1;
} else {
$tokensexist = 0;
unset($_POST['token']);
unset($param['token']);
unset($token);
unset($clienttoken);
}

// Get token
if (!isset($token)) {
$token = $clienttoken;
}

if ($tokensexist == 1 && isset($token) && $token != "" && tableExists("{{tokens_".$surveyid."}}") && !$previewmode) {

Expand Down Expand Up @@ -178,6 +172,14 @@ public function action()
$clienttoken = isset($_SESSION['survey_'.$surveyid]['token']) ? $_SESSION['survey_'.$surveyid]['token'] : ""; // Fix for #12003
}

if ($tokensexist != 1){
$tokensexist = 0;
unset($_POST['token']);
unset($param['token']);
unset($token);
unset($clienttoken);
}

// No test for response update
if ($this->_isSurveyFinished($surveyid) && ($thissurvey['alloweditaftercompletion'] != 'Y' || $thissurvey['tokenanswerspersistence'] != 'Y')) {
$aReloadUrlParam = array('lang'=>App()->language, 'newtest'=>'Y');
Expand Down

0 comments on commit ff1ce15

Please sign in to comment.