function __construct($pageContent) { parent::__construct(); $this->getSettings(); $this->_pageContent = $pageContent; $this->_objTemplate = new \Cx\Core\Html\Sigma('.'); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTemplate); }
/** * Initializes the news module by loading the configuration options * and initializing the template object with $pageContent. * * @param string News content page */ public function __construct($pageContent) { parent::__construct(); $this->getSettings(); $this->_objTpl = new \Cx\Core\Html\Sigma(); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl); $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE); $this->_objTpl->setTemplate($pageContent); }
/** * PHP5 constructor * @global \Cx\Core\Html\Sigma * @see \Cx\Core\Html\Sigma::setErrorHandling, \Cx\Core\Html\Sigma::setVariable, initialize() */ function __construct($administrate = false) { parent::__construct(); $this->administrate = $administrate; $this->_objTpl = new \Cx\Core\Html\Sigma('.'); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl); $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE); $this->_initialize(); }
/** * PHP5 Constructor * * @access public */ function __construct() { global $_ARRAYLANG, $objInit, $objTemplate, $_CONFIG; parent::__construct(); $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/News/View/Template/Backend'); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl); $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE); $this->_saveSettings(); $this->langId = $objInit->userFrontendLangId; $this->getSettings(); $this->pageTitle = $_ARRAYLANG['TXT_NEWS_MANAGER']; }
function _getNewsPreviewPage() { global $objDatabase, $_ARRAYLANG; \JS::activate('cx'); $mailTemplate = isset($_POST['newsletter_mail_template']) ? intval($_POST['newsletter_mail_template']) : '1'; $importTemplate = isset($_POST['newsletter_import_template']) ? intval($_POST['newsletter_mail_template']) : '2'; if (isset($_GET['view']) && $_GET['view'] == 'iframe') { $selectedNews = isset($_POST['selected']) ? contrexx_input2db($_POST['selected']) : ''; $mailTemplate = isset($_POST['emailtemplate']) ? intval($_POST['emailtemplate']) : '1'; $importTemplate = isset($_POST['importtemplate']) ? intval($_POST['importtemplate']) : '2'; $HTML_TemplateSource_Import = $this->_getBodyContent($this->_prepareNewsPreview($this->GetTemplateSource($importTemplate, 'html'))); $_REQUEST['standalone'] = true; $this->_objTpl = new \Cx\Core\Html\Sigma(); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl); $this->_objTpl->setTemplate($HTML_TemplateSource_Import); $query = ' SELECT n.id AS newsid, n.userid AS newsuid, n.date AS newsdate, n.teaser_image_path, n.teaser_image_thumbnail_path, n.redirect, n.publisher, n.publisher_id, n.author, n.author_id, n.catid, nl.title AS newstitle, nl.text AS newscontent, nl.teaser_text, nc.name AS name FROM ' . DBPREFIX . 'module_news AS n INNER JOIN ' . DBPREFIX . 'module_news_locale AS nl ON nl.news_id = n.id INNER JOIN ' . DBPREFIX . 'module_news_categories_locale AS nc ON nc.category_id=n.catid WHERE status = 1 AND nl.is_active=1 AND nl.lang_id=' . FRONTEND_LANG_ID . ' AND nc.lang_id=' . FRONTEND_LANG_ID . ' AND n.id IN (' . $selectedNews . ') ORDER BY nc.name ASC, n.date DESC'; $objNews = $objDatabase->Execute($query); $objFWUser = \FWUser::getFWUserObject(); $current_category = ''; if ($this->_objTpl->blockExists('news_list')) { if ($objNews !== false) { while (!$objNews->EOF) { $this->_objTpl->setVariable(array('NEWS_CATEGORY_NAME' => $objNews->fields['name'])); if ($current_category == $objNews->fields['catid']) { $this->_objTpl->hideBlock("news_category"); } $current_category = $objNews->fields['catid']; $newsid = $objNews->fields['newsid']; $newstitle = $objNews->fields['newstitle']; $newsUrl = empty($objNews->fields['redirect']) ? empty($objNews->fields['newscontent']) ? '' : 'index.php?section=News&cmd=details&newsid=' . $newsid : $objNews->fields['redirect']; $newstext = ltrim(strip_tags($objNews->fields['newscontent'])); $newsteasertext = ltrim(strip_tags($objNews->fields['teaser_text'])); $newslink = \Cx\Core\Routing\Url::fromModuleAndCmd('News', 'details', '', array('newsid' => $objNews->fields['newsid'])); if ($objNews->fields['newsuid'] && ($objUser = $objFWUser->objUser->getUser($objNews->fields['newsuid']))) { $author = htmlentities($objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET); } else { $author = $_ARRAYLANG['TXT_ANONYMOUS']; } list($image, $htmlLinkImage, $imageSource) = \Cx\Core_Modules\News\Controller\NewsLibrary::parseImageThumbnail($objNews->fields['teaser_image_path'], $objNews->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl); $this->_objTpl->setVariable(array('NEWS_CATEGORY_NAME' => $objNews->fields['name'], 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objNews->fields['newsdate']), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT_DATETIME, $objNews->fields['newsdate']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_URL' => $newslink, 'NEWS_TEASER_TEXT' => $newsteasertext, 'NEWS_TEXT' => $newstext, 'NEWS_AUTHOR' => $author)); $imageTemplateBlock = "news_image"; if (!empty($image)) { $this->_objTpl->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage)); if ($this->_objTpl->blockExists($imageTemplateBlock)) { $this->_objTpl->parse($imageTemplateBlock); } } else { if ($this->_objTpl->blockExists($imageTemplateBlock)) { $this->_objTpl->hideBlock($imageTemplateBlock); } } $this->_objTpl->parse("news_list"); $objNews->MoveNext(); } } $parsedNewsList = $this->_objTpl->get(); } else { if ($objNews !== false) { $parsedNewsList = ''; while (!$objNews->EOF) { $content = $this->_getBodyContent($this->GetTemplateSource($importTemplate, 'html')); $newstext = ltrim(strip_tags($objNews->fields['newscontent'])); $newsteasertext = substr(ltrim(strip_tags($objNews->fields['teaser_text'])), 0, 100); $newslink = \Cx\Core\Routing\Url::fromModuleAndCmd('News', 'detals', '', array('newsid' => $objNews->fields['newsid'])); if ($objNews->fields['newsuid'] && ($objUser = $objFWUser->objUser->getUser($objNews->fields['newsuid']))) { $author = htmlentities($objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET); } else { $author = $_ARRAYLANG['TXT_ANONYMOUS']; } $search = array('[[NEWS_DATE]]', '[[NEWS_LONG_DATE]]', '[[NEWS_TITLE]]', '[[NEWS_URL]]', '[[NEWS_IMAGE_PATH]]', '[[NEWS_TEASER_TEXT]]', '[[NEWS_TEXT]]', '[[NEWS_AUTHOR]]', '[[NEWS_TYPE_NAME]]', '[[NEWS_CATEGORY_NAME]]'); $replace = array(date(ASCMS_DATE_FORMAT_DATE, $objNews->fields['newsdate']), date(ASCMS_DATE_FORMAT_DATETIME, $objNews->fields['newsdate']), $objNews->fields['newstitle'], $newslink, htmlentities($objNews->fields['teaser_image_thumbnail_path'], ENT_QUOTES, CONTREXX_CHARSET), $newsteasertext, $newstext, $author, $objNews->fields['typename'], $objNews->fields['name']); $content = str_replace($search, $replace, $content); if ($parsedNewsList != '') { $parsedNewsList .= "<br/>" . $content; } else { $parsedNewsList = $content; } $objNews->MoveNext(); } } } $previewHTML = str_replace("[[content]]", $parsedNewsList, $this->GetTemplateSource($mailTemplate, 'html')); $this->_objTpl->setTemplate($previewHTML); return $this->_objTpl->get(); } else { $selected = isset($_POST['SelectedNews']) ? $_POST['SelectedNews'] : ''; $selectedNews = implode(",", $selected); $this->_pageTitle = $_ARRAYLANG['TXT_NEWSLETTER_NEWS_IMPORT_PREVIEW']; $this->_objTpl->loadTemplateFile('newsletter_news_preview.html'); $this->_objTpl->setVariable(array('TXT_EMAIL_LAYOUT' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_EMAIL_LAYOUT'], 'TXT_IMPORT_LAYOUT' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_IMPORT_LAYOUT'], 'TXT_NEWS_PREVIEW' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_PREVIEW'], 'TXT_CREATE_EMAIL' => $_ARRAYLANG['TXT_NEWSLETTER_NEWS_CREATE_EMAIL'], 'NEWSLETTER_MAIL_TEMPLATE_MENU' => $this->_getTemplateMenu($mailTemplate, 'id="newsletter_mail_template" name="newsletter_mail_template" style="width:300px;" onchange="refreshIframe();"'), 'NEWSLETTER_IMPORT_TEMPLATE_MENU' => $this->_getTemplateMenu($importTemplate, 'id="newsletter_import_template" name="newsletter_import_template" style="width:300px;" onchange="refreshIframe();"', 'news'), 'NEWSLETTER_SELECTED_NEWS' => $selectedNews, 'NEWSLETTER_SELECTED_EMAIL_TEMPLATE' => $mailTemplate, 'NEWSLETTER_SELECTED_IMPORT_TEMPLATE' => $importTemplate)); } }