protected function preRender($lang) { if ($this->template->placeholderExists('LEVELS_FULL') || $this->template->placeholderExists('levels_full')) { $this->rootNode = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node')->getRoot(); } $this->realPreRender($lang); }
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); }
static function verify_payment_details() { global $_ARRAYLANG; if (empty($_POST['check'])) { return true; } // if it is the internal_lsv payment processor, store the sent data into // session if (self::processor_name() == 'internal_lsv') { if (!empty($_POST['account_holder'])) { $_SESSION['shop']['account_holder'] = contrexx_input2raw($_POST['account_holder']); } if (!empty($_POST['account_bank'])) { $_SESSION['shop']['account_bank'] = contrexx_input2raw($_POST['account_bank']); } if (!empty($_POST['account_blz'])) { $_SESSION['shop']['account_blz'] = contrexx_input2raw($_POST['account_blz']); } } $status = true; // Payment status is true, if either // - the total price (including VAT and shipment) is zero (or less!?), or // - the paymentId is set and valid, and the LSV status evaluates to true. // luckily, shipping, VAT, and price have been handled in update_session() // above already, so we'll only have to check grand_total_price if ($_SESSION['shop']['grand_total_price'] > 0 && (empty($_SESSION['shop']['paymentId']) || self::processor_name() == 'Internal_LSV' && !self::lsv_complete())) { //\DBG::log("Shop::verify_payment_details(): Payment missing!"); $status = false; \Message::error($_ARRAYLANG['TXT_FILL_OUT_ALL_REQUIRED_FIELDS']); } // Shipment status is true, if either // - no shipment is desired, or // - the shipperId is set already (and the shipment conditions were validated) if (Cart::needs_shipment()) { //\DBG::log("Shop::verify_payment_details(): Shipment necessary"); if (empty($_SESSION['shop']['shipperId'])) { //\DBG::log("Shop::verify_payment_details(): Shipment missing!"); // Ask the Customer to pick a different Shipper if none is // selected or it did not work $status = false; \Message::error($_ARRAYLANG['TXT_SHIPPER_NO_GOOD']); } } // AGB status is true, if either // - the agb placeholder does not exist // - the agb checkbox has been checked if (!(self::$objTemplate->placeholderExists('SHOP_AGB') ? !empty($_POST['agb']) ? true : false : true)) { //\DBG::log("Shop::verify_payment_details(): AGB missing!"); $status = false; \Message::error($_ARRAYLANG['TXT_ACCEPT_AGB']); } // Ditto for cancellation terms if (!(self::$objTemplate->placeholderExists('SHOP_CANCELLATION_TERMS_CHECKED') ? !empty($_POST['cancellation_terms']) ? true : false : true)) { //\DBG::log("Shop::verify_payment_details(): cancellation terms missing!"); $status = false; \Message::error($_ARRAYLANG['TXT_SHOP_CANCELLATION_TERMS_PLEASE_ACCEPT']); } if ($status) { // Everything is set and valid \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'confirm')); } // Something is missing od invalid return false; }