public function actionDetailsJson($id, $includeFilesInJson = false, $contactId = null) { $contactId = (int) $contactId; $emailTemplate = static::getModelAndCatchNotFoundAndDisplayError('EmailTemplate', intval($id)); ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($emailTemplate); header('Content-type: application/json'); if ($contactId != null) { $contact = Contact::getById($contactId); $textContent = $emailTemplate->textContent; $htmlContent = $emailTemplate->htmlContent; GlobalMarketingFooterUtil::removeFooterMergeTags($textContent); GlobalMarketingFooterUtil::removeFooterMergeTags($htmlContent); // we have already stripped off the merge tags that could introduce problems, // no need to send actual data for personId, modelId, modelType and marketingListId. AutoresponderAndCampaignItemsUtil::resolveContentsForMergeTags($textContent, $htmlContent, $contact, null, null, null, null); $emailTemplate->setTreatCurrentUserAsOwnerForPermissions(true); $emailTemplate->textContent = stripslashes($textContent); $emailTemplate->htmlContent = stripslashes($htmlContent); $emailTemplate->setTreatCurrentUserAsOwnerForPermissions(false); } $emailTemplate = $this->resolveEmailTemplateAsJson($emailTemplate, $includeFilesInJson); echo $emailTemplate; Yii::app()->end(0, false); }
/** * Remove global merge tags from contents * @param $textContent * @param $htmlContent */ public static function removeGlobalFooterMergeTagsFromContents(&$textContent, &$htmlContent) { GlobalMarketingFooterUtil::removeFooterMergeTags($textContent); GlobalMarketingFooterUtil::removeFooterMergeTags($htmlContent); }