Skip to content

Commit

Permalink
Fixed issue #12785: Some placeholders in e-mail templates do not take…
Browse files Browse the repository at this point in the history
… 'publicurl' setting into account
  • Loading branch information
c-schmitz committed Oct 13, 2017
1 parent 8142417 commit e148657
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions application/controllers/RegisterController.php
Expand Up @@ -243,9 +243,9 @@ public function sendRegistrationEmail($iSurveyId,$iTokenId){
$useHtmlEmail = (getEmailFormat($iSurveyId) == 'html');
$aMail['subject']=preg_replace("/{TOKEN:([A-Z0-9_]+)}/","{"."$1"."}",$aMail['subject']);
$aMail['message']=preg_replace("/{TOKEN:([A-Z0-9_]+)}/","{"."$1"."}",$aMail['message']);
$aReplacementFields["{SURVEYURL}"] = App()->createAbsoluteUrl("/survey/index/sid/{$iSurveyId}",array('lang'=>$sLanguage,'token'=>$sToken));
$aReplacementFields["{OPTOUTURL}"] = App()->createAbsoluteUrl("/optout/tokens/surveyid/{$iSurveyId}",array('langcode'=>$sLanguage,'token'=>$sToken));
$aReplacementFields["{OPTINURL}"] = App()->createAbsoluteUrl("/optin/tokens/surveyid/{$iSurveyId}",array('langcode'=>$sLanguage,'token'=>$sToken));
$aReplacementFields["{SURVEYURL}"] = Yii::app()->getController()->createAbsoluteUrl("/survey/index/sid/{$iSurveyId}",array('lang'=>$sLanguage,'token'=>$sToken));
$aReplacementFields["{OPTOUTURL}"] = Yii::app()->getController()->createAbsoluteUrl("/optout/tokens/surveyid/{$iSurveyId}",array('langcode'=>$sLanguage,'token'=>$sToken));
$aReplacementFields["{OPTINURL}"] = Yii::app()->getController()->createAbsoluteUrl("/optin/tokens/surveyid/{$iSurveyId}",array('langcode'=>$sLanguage,'token'=>$sToken));
foreach(array('OPTOUT', 'OPTIN', 'SURVEY') as $key)
{
$url = $aReplacementFields["{{$key}URL}"];
Expand Down
11 changes: 6 additions & 5 deletions application/helpers/frontend_helper.php
Expand Up @@ -535,7 +535,7 @@ function submittokens($quotaexit=false)
$aReplacementVars["TOKEN"]=$token->token;
$aReplacementVars["EMAIL"]=$token->email;
// added survey url in replacement vars
$surveylink = Yii::app()->createAbsoluteUrl("/survey/index/sid/{$surveyid}",array('lang'=>$_SESSION['survey_'.$surveyid]['s_lang'],'token'=>$token->token));
$surveylink = Yii::app()->getController()->createAbsoluteUrl("/survey/index/sid/{$surveyid}",array('lang'=>$_SESSION['survey_'.$surveyid]['s_lang'],'token'=>$token->token));
$aReplacementVars['SURVEYURL'] = $surveylink;

$attrfieldnames=getAttributeFieldNames($surveyid);
Expand Down Expand Up @@ -634,7 +634,7 @@ function sendSubmitNotifications($surveyid)
return;
}

$homeurl=Yii::app()->createAbsoluteUrl('/admin');
$homeurl=Yii::app()->getController()->createAbsoluteUrl('/admin');

$sitename = Yii::app()->getConfig("sitename");

Expand Down Expand Up @@ -663,9 +663,10 @@ function sendSubmitNotifications($surveyid)
$srid = $_SESSION['survey_'.$surveyid]['srid'];
$aReplacementVars['ADMINNAME'] = $thissurvey['adminname'];
$aReplacementVars['ADMINEMAIL'] = $thissurvey['adminemail'];
$aReplacementVars['VIEWRESPONSEURL']=Yii::app()->createAbsoluteUrl("/admin/responses/sa/view/surveyid/{$surveyid}/id/{$srid}");
$aReplacementVars['EDITRESPONSEURL']=Yii::app()->createAbsoluteUrl("/admin/dataentry/sa/editdata/subaction/edit/surveyid/{$surveyid}/id/{$srid}");
$aReplacementVars['STATISTICSURL']=Yii::app()->createAbsoluteUrl("/admin/statistics/sa/index/surveyid/{$surveyid}");
debugbreak();
$aReplacementVars['VIEWRESPONSEURL']=Yii::app()->getController()->createAbsoluteUrl("/admin/responses/sa/view/surveyid/{$surveyid}/id/{$srid}");
$aReplacementVars['EDITRESPONSEURL']=Yii::app()->getController()->createAbsoluteUrl("/admin/dataentry/sa/editdata/subaction/edit/surveyid/{$surveyid}/id/{$srid}");
$aReplacementVars['STATISTICSURL']=Yii::app()->getController()->createAbsoluteUrl("/admin/statistics/sa/index/surveyid/{$surveyid}");
if ($bIsHTML)
{
$aReplacementVars['VIEWRESPONSEURL']="<a href='{$aReplacementVars['VIEWRESPONSEURL']}'>{$aReplacementVars['VIEWRESPONSEURL']}</a>";
Expand Down

0 comments on commit e148657

Please sign in to comment.