37 $content = $response->initContentHtml();
39 Main\Loader::includeModule(
'fileman');
41 $canEditPhp = Security\User::current()->canEditPhp();
42 $canUseLpa = Security\User::current()->canUseLpa();
45 ->setModuleId(
'sender')
49 'EMAIL' =>
'test@example.com',
50 'CODE' =>
'test@example.com',
53 ->setHandlerUri(Option::get(
'sender',
'unsub_link'));
55 $html = $request->getPostList()->getRaw(
'content');
56 preg_match_all(
"/#([0-9a-zA-Z_.]+?)#/", $html, $personalizeFields);
59 if(is_object(
$GLOBALS[
"USER"]) && isset($personalizeFields[1]))
61 foreach ($personalizeFields[1] as $field)
63 $fieldArray = explode(
".", $field);
64 if(count($fieldArray) > 1)
66 $document = Helper::getData(
67 $fieldArray[0], [
$GLOBALS[
"USER"]->GetID()]
69 if(!isset($document[1]))
73 $document = $document[1];
75 $fieldsData[$field] = $document
76 && isset($document[$fieldArray[1]])
77 ? $document[$fieldArray[1]] :
'';
82 $previewParams = array(
83 'CAN_EDIT_PHP' => $canEditPhp,
84 'CAN_USE_LPA' => $canUseLpa,
85 'SITE' => $request->get(
'site_id') ?: SITE_ID,
86 'HTML' => ($html && Main\Text\Encoding::detectUtf8($html))
87 ? Main\Text\Encoding::convertEncoding(
94 'FIELDS' => array_merge($fieldsData, array(
95 'SENDER_CHAIN_CODE' =>
'sender_chain_item_0',
96 'UNSUBSCRIBE_LINK' => $tracker->getLink()
101 $content->set($html);