| @@ 86-107 (lines=22) @@ | ||
| 83 | $letterTpl->assign('catsubscr_id', '0'); |
|
| 84 | ||
| 85 | $templateObj = $helper->getHandler('Template')->get($letterObj->getVar('letter_templateid')); |
|
| 86 | if (is_object($templateObj)) { |
|
| 87 | if ( (int)$templateObj->getVar('template_type') === _XNEWSLETTER_MAILINGLIST_TPL_CUSTOM_VAL) { |
|
| 88 | // get template from database |
|
| 89 | $htmlBody = $letterTpl->fetchFromData($templateObj->getVar('template_content', 'n')); |
|
| 90 | } else { |
|
| 91 | // get template from filesystem |
|
| 92 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/' . $GLOBALS['xoopsConfig']['language'] . '/templates/'; |
|
| 93 | if (!is_dir($template_path)) { |
|
| 94 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/english/templates/'; |
|
| 95 | } |
|
| 96 | $template = $template_path . $templateObj->getVar('template_title') . '.tpl'; |
|
| 97 | $htmlBody = $letterTpl->fetch($template); |
|
| 98 | } |
|
| 99 | try { |
|
| 100 | $textBody = xnewsletter_html2text($htmlBody); |
|
| 101 | } |
|
| 102 | catch (Html2TextException $e) { |
|
| 103 | $helper->addLog($e); |
|
| 104 | } |
|
| 105 | } else { |
|
| 106 | $htmlBody = _AM_XNEWSLETTER_TEMPLATE_ERR; |
|
| 107 | } |
|
| 108 | ||
| 109 | $preview = "<h2>{$letterObj->getVar('letter_title')}</h2>"; |
|
| 110 | $preview .= "<div style='clear:both'>"; |
|
| @@ 75-96 (lines=22) @@ | ||
| 72 | $content .= "<div style='clear:both;'><div style='padding:10px;border:1px solid black;'>"; |
|
| 73 | ||
| 74 | $templateObj = $helper->getHandler('Template')->get($letterObj->getVar('letter_templateid')); |
|
| 75 | if (is_object($templateObj)) { |
|
| 76 | if ( (int)$templateObj->getVar('template_type') === _XNEWSLETTER_MAILINGLIST_TPL_CUSTOM_VAL) { |
|
| 77 | // get template from database |
|
| 78 | $htmlBody = $xoopsTpl->fetchFromData($templateObj->getVar('template_content', 'n')); |
|
| 79 | } else { |
|
| 80 | // get template from filesystem |
|
| 81 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/' . $GLOBALS['xoopsConfig']['language'] . '/templates/'; |
|
| 82 | if (!is_dir($template_path)) { |
|
| 83 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/english/templates/'; |
|
| 84 | } |
|
| 85 | $template = $template_path . $templateObj->getVar('template_title') . '.tpl'; |
|
| 86 | $htmlBody = $xoopsTpl->fetch($template); |
|
| 87 | } |
|
| 88 | try { |
|
| 89 | $textBody = xnewsletter_html2text($htmlBody); |
|
| 90 | } |
|
| 91 | catch (Html2TextException $e) { |
|
| 92 | $helper->addLog($e); |
|
| 93 | } |
|
| 94 | } else { |
|
| 95 | $htmlBody = _AM_XNEWSLETTER_TEMPLATE_ERR; |
|
| 96 | } |
|
| 97 | ||
| 98 | $content .= $htmlBody; |
|
| 99 | $content .= "</div></div>\n"; |
|
| @@ 161-182 (lines=22) @@ | ||
| 158 | $letter_array = $letterObj->toArray(); |
|
| 159 | ||
| 160 | $templateObj = $helper->getHandler('Template')->get($letterObj->getVar('letter_templateid')); |
|
| 161 | if (is_object($templateObj)) { |
|
| 162 | if ( (int)$templateObj->getVar('template_type') === _XNEWSLETTER_MAILINGLIST_TPL_CUSTOM_VAL) { |
|
| 163 | // get template from database |
|
| 164 | $htmlBody = $xoopsTpl->fetchFromData($templateObj->getVar('template_content', 'n')); |
|
| 165 | } else { |
|
| 166 | // get template from filesystem |
|
| 167 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/' . $GLOBALS['xoopsConfig']['language'] . '/templates/'; |
|
| 168 | if (!is_dir($template_path)) { |
|
| 169 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/english/templates/'; |
|
| 170 | } |
|
| 171 | $template = $template_path . $templateObj->getVar('template_title') . '.tpl'; |
|
| 172 | $htmlBody = $xoopsTpl->fetch($template); |
|
| 173 | } |
|
| 174 | try { |
|
| 175 | $textBody = xnewsletter_html2text($htmlBody); |
|
| 176 | } |
|
| 177 | catch (Html2TextException $e) { |
|
| 178 | $helper->addLog($e); |
|
| 179 | } |
|
| 180 | } else { |
|
| 181 | $htmlBody = _AM_XNEWSLETTER_TEMPLATE_ERR; |
|
| 182 | } |
|
| 183 | ||
| 184 | $letter_array['letter_content_templated'] = $htmlBody; |
|
| 185 | $letter_array['letter_content_templated_html'] = $htmlBody; |
|
| @@ 221-242 (lines=22) @@ | ||
| 218 | $letter_array = $letterObj->toArray(); |
|
| 219 | ||
| 220 | $templateObj = $helper->getHandler('Template')->get($letterObj->getVar('letter_templateid')); |
|
| 221 | if (is_object($templateObj)) { |
|
| 222 | if ( (int)$templateObj->getVar('template_type') === _XNEWSLETTER_MAILINGLIST_TPL_CUSTOM_VAL) { |
|
| 223 | // get template from database |
|
| 224 | $htmlBody = $xoopsTpl->fetchFromData($templateObj->getVar('template_content', 'n')); |
|
| 225 | } else { |
|
| 226 | // get template from filesystem |
|
| 227 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/' . $GLOBALS['xoopsConfig']['language'] . '/templates/'; |
|
| 228 | if (!is_dir($template_path)) { |
|
| 229 | $template_path = XOOPS_ROOT_PATH . '/modules/xnewsletter/language/english/templates/'; |
|
| 230 | } |
|
| 231 | $template = $template_path . $templateObj->getVar('template_title') . '.tpl'; |
|
| 232 | $htmlBody = $xoopsTpl->fetch($template); |
|
| 233 | } |
|
| 234 | try { |
|
| 235 | $textBody = xnewsletter_html2text($htmlBody); |
|
| 236 | } |
|
| 237 | catch (Html2TextException $e) { |
|
| 238 | $helper->addLog($e); |
|
| 239 | } |
|
| 240 | } else { |
|
| 241 | $htmlBody = _AM_XNEWSLETTER_TEMPLATE_ERR; |
|
| 242 | } |
|
| 243 | ||
| 244 | $letter_array['letter_content_templated'] = $htmlBody; |
|
| 245 | $letter_array['letter_content_templated_html'] = $htmlBody; |
|