Skip to content

Commit

Permalink
Fixed issue #08683: Unique custom token values fail to merge in invit…
Browse files Browse the repository at this point in the history
…e/reminder emails

Dev: replace {TOKEN:ATTRIBUTE} by {ATTRIBUTE} else take 'actual' token information from $_SESSION
  • Loading branch information
Shnoulle committed Feb 24, 2014
1 parent 5d6c80e commit 55f8b48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions application/controllers/RegisterController.php
Expand Up @@ -173,8 +173,8 @@ function actionIndex($iSurveyID = null)
$token=$oToken->token;


$message=$thissurvey['email_register'];
$subject=$thissurvey['email_register_subj'];
$message=preg_replace("/{TOKEN:([A-Z0-9_]+)}/","{"."$1"."}",$thissurvey['email_register']);
$subject=preg_replace("/{TOKEN:([A-Z0-9_]+)}/","{"."$1"."}",$thissurvey['email_register_subj']);


$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
Expand Down
9 changes: 6 additions & 3 deletions application/controllers/admin/tokens.php
Expand Up @@ -1343,8 +1343,11 @@ function email($iSurveyId, $tokenids = null)

foreach ($aSurveyLangs as $language)
{
// See #08683 : this allow use of {TOKEN:ANYTHING}, directly replaced by {ANYTHING}
$sSubject[$language]=preg_replace("/{TOKEN:([A-Z0-9_]+)}/","{"."$1"."}",Yii::app()->request->getPost('subject_' . $language));
$sMessage[$language]=preg_replace("/{TOKEN:([A-Z0-9_]+)}/","{"."$1"."}",Yii::app()->request->getPost('message_' . $language));
if ($bHtml)
$_POST['message_' . $language] = html_entity_decode(Yii::app()->request->getPost('message_' . $language), ENT_QUOTES, Yii::app()->getConfig("emailcharset"));
$sMessage[$language] = html_entity_decode($sMessage[$language], ENT_QUOTES, Yii::app()->getConfig("emailcharset"));
}

$attributes = array_keys(getTokenFieldsAndNames($iSurveyId,true));
Expand Down Expand Up @@ -1400,8 +1403,8 @@ function email($iSurveyId, $tokenids = null)
$customheaders = array('1' => "X-surveyid: " . $iSurveyId,
'2' => "X-tokenid: " . $fieldsarray["{TOKEN}"]);
global $maildebug;
$modsubject = Replacefields(Yii::app()->request->getPost('subject_' . $emrow['language']), $fieldsarray);
$modmessage = Replacefields(Yii::app()->request->getPost('message_' . $emrow['language']), $fieldsarray);
$modsubject = Replacefields($sSubject[$emrow['language']], $fieldsarray);
$modmessage = Replacefields($sMessage[$emrow['language']], $fieldsarray);

if (isset($barebone_link))
{
Expand Down

0 comments on commit 55f8b48

Please sign in to comment.