Exemplo n.º 1
0
 /**
  * The mailtemplate settings view
  *
  * Stores MailTemplates posted from the {@see MailTemplate::edit()} view.
  * Deletes a MailTemplate on request from the
  * {@see MailTemplate::overview()} view.
  * Includes both the overview and the edit view, activates one depending
  * on the outcome of the call to {@see MailTemplate::storeFromPost()}
  * or the current active_tab.
  * @return  boolean               True on success, false otherwise
  */
 static function view_settings_mail()
 {
     global $_CORELANG;
     // TODO: TEMPORARY.  Remove when a proper update is available.
     $template = \Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'order_confirmation');
     //die(var_export($template, true));
     if (!$template) {
         ShopMail::errorHandler();
     }
     $result = true;
     $_REQUEST['active_tab'] = 1;
     if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'mailtemplate_edit') {
         $_REQUEST['active_tab'] = 2;
     }
     \Cx\Core\MailTemplate\Controller\MailTemplate::deleteTemplate('Shop');
     // If there is anything to be stored, and if that fails, return to
     // the edit view in order to save the posted form content
     $result_store = \Cx\Core\MailTemplate\Controller\MailTemplate::storeFromPost('Shop');
     if ($result_store === false) {
         $_REQUEST['active_tab'] = 2;
     }
     $objTemplate = null;
     $result &= \Cx\Core\Setting\Controller\Setting::show_external($objTemplate, $_CORELANG['TXT_CORE_MAILTEMPLATES'], \Cx\Core\MailTemplate\Controller\MailTemplate::overview('Shop', 'config', \Cx\Core\Setting\Controller\Setting::getValue('numof_mailtemplate_per_page_backend', 'Shop'))->get());
     $result &= \Cx\Core\Setting\Controller\Setting::show_external($objTemplate, empty($_REQUEST['key']) ? $_CORELANG['TXT_CORE_MAILTEMPLATE_ADD'] : $_CORELANG['TXT_CORE_MAILTEMPLATE_EDIT'], \Cx\Core\MailTemplate\Controller\MailTemplate::edit('Shop')->get());
     self::$objTemplate->addBlock('SHOP_SETTINGS_FILE', 'settings_block', $objTemplate->get());
     self::$objTemplate->touchBlock('settings_block');
     return $result;
 }
Exemplo n.º 2
0
 private function overview()
 {
     global $_LANGID;
     // load source code if cmd value is integer
     if ($this->objTemplate->placeholderExists('APPLICATION_DATA')) {
         $page = new \Cx\Core\ContentManager\Model\Entity\Page();
         $page->setVirtual(true);
         $page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
         $page->setModule('Downloads');
         // load source code
         $applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
         \LinkGenerator::parseTemplate($applicationTemplate);
         $this->objTemplate->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
     }
     $objDownload = new Download();
     $objCategory = Category::getCategory($this->categoryId);
     if ($objCategory->getId()) {
         // check access permissions to selected category
         if (!\Permission::checkAccess(143, 'static', true) && $objCategory->getReadAccessId() && !\Permission::checkAccess($objCategory->getReadAccessId(), 'dynamic', true) && $objCategory->getOwnerId() != $this->userId) {
             // TODO: might we have to add a soft noAccess handler in case the output is meant for a regular page (not section=Downloads)
             \Permission::noAccess(base64_encode(CONTREXX_SCRIPT_PATH . $this->moduleParamsJs . '&category=' . $objCategory->getId()));
         }
         // parse crumbtrail
         $this->parseCrumbtrail($objCategory);
         if ($objDownload->load(!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0) && (!$objDownload->getExpirationDate() || $objDownload->getExpirationDate() > time()) && $objDownload->getActiveStatus()) {
             /* DOWNLOAD DETAIL PAGE */
             $this->pageTitle = contrexx_raw2xhtml($objDownload->getName(FRONTEND_LANG_ID));
             $metakeys = $objDownload->getMetakeys(FRONTEND_LANG_ID);
             if ($this->arrConfig['use_attr_metakeys'] && !empty($metakeys)) {
                 \Env::get('cx')->getPage()->setMetakeys($metakeys);
             }
             $this->parseRelatedCategories($objDownload);
             $this->parseRelatedDownloads($objDownload, $objCategory->getId());
             $this->parseDownload($objDownload, $objCategory->getId());
             // hide unwanted blocks on the detail page
             if ($this->objTemplate->blockExists('downloads_category')) {
                 $this->objTemplate->hideBlock('downloads_category');
             }
             if ($this->objTemplate->blockExists('downloads_subcategory_list')) {
                 $this->objTemplate->hideBlock('downloads_subcategory_list');
             }
             if ($this->objTemplate->blockExists('downloads_file_list')) {
                 $this->objTemplate->hideBlock('downloads_file_list');
             }
             if ($this->objTemplate->blockExists('downloads_simple_file_upload')) {
                 $this->objTemplate->hideBlock('downloads_simple_file_upload');
             }
             if ($this->objTemplate->blockExists('downloads_advanced_file_upload')) {
                 $this->objTemplate->hideBlock('downloads_advanced_file_upload');
             }
         } else {
             /* CATEGORY DETAIL PAGE */
             $this->pageTitle = htmlentities($objCategory->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET);
             // process create directory
             $this->processCreateDirectory($objCategory);
             // parse selected category
             $this->parseCategory($objCategory);
             // parse subcategories
             $this->parseCategories($objCategory, array('downloads_subcategory_list', 'downloads_subcategory'), null, 'SUB');
             // parse downloads of selected category
             $this->parseDownloads($objCategory);
             // parse upload form
             $this->parseUploadForm($objCategory);
             // parse create directory form
             $this->parseCreateCategoryForm($objCategory);
             // hide unwanted blocks on the category page
             if ($this->objTemplate->blockExists('downloads_download')) {
                 $this->objTemplate->hideBlock('downloads_download');
             }
             if ($this->objTemplate->blockExists('downloads_file_detail')) {
                 $this->objTemplate->hideBlock('downloads_file_detail');
             }
         }
         // hide unwanted blocks on the category/detail page
         if ($this->objTemplate->blockExists('downloads_overview')) {
             $this->objTemplate->hideBlock('downloads_overview');
         }
         if ($this->objTemplate->blockExists('downloads_most_viewed_file_list')) {
             $this->objTemplate->hideBlock('downloads_most_viewed_file_list');
         }
         if ($this->objTemplate->blockExists('downloads_most_downloaded_file_list')) {
             $this->objTemplate->hideBlock('downloads_most_downloaded_file_list');
         }
         if ($this->objTemplate->blockExists('downloads_most_popular_file_list')) {
             $this->objTemplate->hideBlock('downloads_most_popular_file_list');
         }
         if ($this->objTemplate->blockExists('downloads_newest_file_list')) {
             $this->objTemplate->hideBlock('downloads_newest_file_list');
         }
         if ($this->objTemplate->blockExists('downloads_updated_file_list')) {
             $this->objTemplate->hideBlock('downloads_updated_file_list');
         }
     } else {
         /* CATEGORY OVERVIEW PAGE */
         $this->parseCategories($objCategory, array('downloads_overview', 'downloads_overview_category'), null, null, 'downloads_overview_row', array('downloads_overview_subcategory_list', 'downloads_overview_subcategory'), $this->arrConfig['overview_max_subcats']);
         if (!empty($this->searchKeyword)) {
             $this->parseDownloads($objCategory);
         } else {
             if ($this->objTemplate->blockExists('downloads_file_list')) {
                 $this->objTemplate->hideBlock('downloads_file_list');
             }
         }
         /* PARSE MOST VIEWED DOWNLOADS */
         $this->parseSpecialDownloads(array('downloads_most_viewed_file_list', 'downloads_most_viewed_file'), array('is_active' => true, 'expiration' => array('=' => 0, '>' => time())), array('views' => 'desc'), $this->arrConfig['most_viewed_file_count']);
         /* PARSE MOST DOWNLOADED DOWNLOADS */
         $this->parseSpecialDownloads(array('downloads_most_downloaded_file_list', 'downloads_most_downloaded_file'), array('is_active' => true, 'expiration' => array('=' => 0, '>' => time())), array('download_count' => 'desc'), $this->arrConfig['most_downloaded_file_count']);
         /* PARSE MOST POPULAR DOWNLOADS */
         // TODO: Rating system has to be implemented first!
         //$this->parseSpecialDownloads(array('downloads_most_popular_file_list', 'downloads_most_popular_file'), null, array('rating' => 'desc'), $this->arrConfig['most_popular_file_count']);
         /* PARSE RECENTLY UPDATED DOWNLOADS */
         $filter = array('ctime' => array('>=' => time() - $this->arrConfig['new_file_time_limit']), 'expiration' => array('=' => 0, '>' => time()));
         $this->parseSpecialDownloads(array('downloads_newest_file_list', 'downloads_newest_file'), $filter, array('ctime' => 'desc'), $this->arrConfig['newest_file_count']);
         // parse recently updated downloads
         $filter = array('mtime' => array('>=' => time() - $this->arrConfig['updated_file_time_limit']), 'ctime' => array('<' => time() - $this->arrConfig['new_file_time_limit']), 'expiration' => array('=' => 0, '>' => time()));
         $this->parseSpecialDownloads(array('downloads_updated_file_list', 'downloads_updated_file'), $filter, array('mtime' => 'desc'), $this->arrConfig['updated_file_count']);
         // hide unwanted blocks on the overview page
         if ($this->objTemplate->blockExists('downloads_category')) {
             $this->objTemplate->hideBlock('downloads_category');
         }
         if ($this->objTemplate->blockExists('downloads_crumbtrail')) {
             $this->objTemplate->hideBlock('downloads_crumbtrail');
         }
         if ($this->objTemplate->blockExists('downloads_subcategory_list')) {
             $this->objTemplate->hideBlock('downloads_subcategory_list');
         }
         if ($this->objTemplate->blockExists('downloads_file_detail')) {
             $this->objTemplate->hideBlock('downloads_file_detail');
         }
         if ($this->objTemplate->blockExists('downloads_simple_file_upload')) {
             $this->objTemplate->hideBlock('downloads_simple_file_upload');
         }
         if ($this->objTemplate->blockExists('downloads_advanced_file_upload')) {
             $this->objTemplate->hideBlock('downloads_advanced_file_upload');
         }
     }
     $this->parseGlobalStuff($objCategory);
 }
Exemplo n.º 3
0
 /**
  * Calls hooks before content is processed
  * @todo Remove usage of globals
  * @global null $moduleStyleFile
  * @global type $plainCmd
  * @global type $plainSection
  * @global type $themesPages
  * @global type $page_template
  */
 protected function preContentLoad()
 {
     global $moduleStyleFile, $plainCmd, $plainSection, $themesPages, $page_template;
     $this->ch->callPreContentLoadHooks();
     if ($this->mode == self::MODE_FRONTEND) {
         // load content.html template (or customized version)
         $this->template->setTemplate($themesPages['index']);
         $this->template->addBlock('CONTENT_FILE', 'page_template', $page_template);
         // load application content template
         $this->loadContentTemplateOfPage();
         // Set global content variables.
         $pageContent = $this->resolvedPage->getContent();
         $this->parseGlobalPlaceholders($pageContent);
         $pageContent = str_replace('{TITLE}', $this->resolvedPage->getTitle(), $pageContent);
         //replace the {NODE_<ID>_<LANG>}- placeholders
         \LinkGenerator::parseTemplate($pageContent);
         $this->resolvedPage->setContent($pageContent);
         $moduleStyleFile = null;
     } else {
         if ($this->mode == self::MODE_BACKEND) {
             // Skip the nav/language bar for modules which don't make use of either.
             // TODO: Remove language selector for modules which require navigation but bring their own language management.
             if ($this->ch->isLegacyComponent($plainCmd)) {
                 $this->template->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             }
             $plainSection = $plainCmd;
         }
     }
 }