/** * If tags are ON - returns parent::render() value, else - displays 404 * page, as tags are off * * @return string */ public function render() { // if tags are off - showing 404 page if (!$this->showTags()) { error_404_handler(); } return parent::render(); }
/** * Executes parent::render(), loads article list according active tag * * @return string $this->_sThisTemplate current template file name */ public function render() { oxUBase::render(); $oArticleList = $this->getArticleList(); // if tags are off or no articles - showing 404 header (#2139) if (!$this->showTags() || !$oArticleList) { error_404_handler(); } // processing list articles $this->_processListArticles(); return $this->_sThisTemplate; }
/** * processSeoCall handles Server information and passes it to decoder * * @param string $sRequest request * @param string $sPath path * * @access public */ public function processSeoCall($sRequest = null, $sPath = null) { // first - collect needed parameters if (!$sRequest) { if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI']) { $sRequest = $_SERVER['REQUEST_URI']; } else { // try something else $sRequest = $_SERVER['SCRIPT_URI']; } } $sPath = $sPath ? $sPath : str_replace('oxseo.php', '', $_SERVER['SCRIPT_NAME']); if ($sParams = $this->_getParams($sRequest, $sPath)) { // in case SEO url is actual if (is_array($aGet = $this->decodeUrl($sParams))) { $_GET = array_merge($aGet, $_GET); oxRegistry::getLang()->resetBaseLanguage(); } elseif ($sRedirectUrl = $this->_decodeOldUrl($sParams)) { // in case SEO url was changed - redirecting to new location oxRegistry::getUtils()->redirect($this->getConfig()->getShopURL() . $sRedirectUrl, false, 301); } elseif ($sRedirectUrl = $this->_decodeSimpleUrl($sParams)) { // old type II seo urls oxRegistry::getUtils()->redirect($this->getConfig()->getShopURL() . $sRedirectUrl, false, 301); } else { oxRegistry::getSession()->start(); // unrecognized url error_404_handler($sParams); } } }
public function testError_404_handler() { $oUtils = $this->getMock('oxutils', array('handlePageNotFoundError')); $oUtils->expects($this->at(0))->method('handlePageNotFoundError')->with($this->equalTo('')); $oUtils->expects($this->at(1))->method('handlePageNotFoundError')->with($this->equalTo('asd')); oxTestModules::addModuleObject('oxutils', $oUtils); error_404_handler(); error_404_handler('asd'); }
/** * Executes parent::render(), passes template variables to * template engine and generates content. Returns the name * of template to render content::_sThisTemplate * * @return string $this->_sThisTemplate current template file name */ public function render() { parent::render(); $oContent = $this->getContent(); if ($oContent && !$this->_canShowContent($oContent->oxcontents__oxloadid->value)) { oxRegistry::getUtils()->redirect($this->getConfig()->getShopHomeURL() . 'cl=account'); } $sTpl = false; if ($sTplName = $this->_getTplName()) { $this->_sThisTemplate = $sTpl = $sTplName; } elseif ($oContent) { $sTpl = $oContent->getId(); } if (!$sTpl) { error_404_handler(); } // sometimes you need to display plain templates (e.g. when showing popups) if ($this->showPlainTemplate()) { $this->_sThisTemplate = $this->_sThisPlainTemplate; } if ($oContent) { $this->getViewConfig()->setViewConfigParam('oxloadid', $oContent->getLoadId()); } return $this->_sThisTemplate; }
/** * getBargain loads top shop articles to rss * * @access public */ public function bargain() { if ($this->getConfig()->getConfigParam('bl_rssBargain')) { $this->_getRssFeed()->loadBargain(); } else { error_404_handler(); } }