Skip to content

Commit

Permalink
Fixed issue #09862: Invitations substitute wrong token into barebone URL
Browse files Browse the repository at this point in the history
Dev: Replace in modsubject not in $sSubject array (used for each token)
  • Loading branch information
Shnoulle committed Sep 8, 2015
1 parent 68fe7dc commit ec0cb88
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions application/controllers/admin/tokens.php
Expand Up @@ -1420,15 +1420,17 @@ function email($iSurveyId, $tokenids = null)
$customheaders = array('1' => "X-surveyid: " . $iSurveyId,
'2' => "X-tokenid: " . $fieldsarray["{TOKEN}"]);
global $maildebug;
$modsubject = $sSubject[$emrow['language']];
$modmessage = $sMessage[$emrow['language']];
foreach(array('OPTOUT', 'OPTIN', 'SURVEY') as $key)
{
$url = $fieldsarray["{{$key}URL}"];
if ($bHtml) $fieldsarray["{{$key}URL}"] = "<a href='{$url}'>" . htmlspecialchars($url) . '</a>';
$sSubject[$emrow['language']] = str_replace("@@{$key}URL@@", $url, $sSubject[$emrow['language']]);
$sMessage[$emrow['language']] = str_replace("@@{$key}URL@@", $url, $sMessage[$emrow['language']]);
$modsubject = str_replace("@@{$key}URL@@", $url, $modsubject);
$modmessage = str_replace("@@{$key}URL@@", $url, $modmessage);
}
$modsubject = Replacefields($sSubject[$emrow['language']], $fieldsarray);
$modmessage = Replacefields($sMessage[$emrow['language']], $fieldsarray);
$modsubject = Replacefields($modsubject, $fieldsarray);
$modmessage = Replacefields($modmessage, $fieldsarray);
if (trim($emrow['validfrom']) != '' && convertDateTimeFormat($emrow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1)
{
$tokenoutput .= $emrow['tid'] . " " . htmlspecialchars(ReplaceFields(gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.",'unescaped'), $fieldsarray)). "<br />";
Expand Down

1 comment on commit ec0cb88

@apmuthu
Copy link
Contributor

@apmuthu apmuthu commented on ec0cb88 Oct 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary for v2.05+ (v2.051 branch)?

Please sign in to comment.