/** * Composes and sends user written message, returns false if some parameters * are missing. * * @return bool */ public function send() { $aParams = oxRegistry::getConfig()->getRequestParameter('editval'); // checking email address if (!oxRegistry::getUtils()->isValidEmail($aParams['oxuser__oxusername'])) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL'); return false; } // spam spider prevension $sMac = oxRegistry::getConfig()->getRequestParameter('c_mac'); $sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach'); $oCaptcha = $this->getCaptcha(); if (!$oCaptcha->pass($sMac, $sMacHash)) { // even if there is no exception, use this as a default display method oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE'); return false; } $sSubject = oxRegistry::getConfig()->getRequestParameter('c_subject'); if (!$aParams['oxuser__oxfname'] || !$aParams['oxuser__oxlname'] || !$aParams['oxuser__oxusername'] || !$sSubject) { // even if there is no exception, use this as a default display method oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS'); return false; } $oLang = oxRegistry::getLang(); $sMessage = $oLang->translateString('MESSAGE_FROM') . " " . $oLang->translateString($aParams['oxuser__oxsal']) . " " . $aParams['oxuser__oxfname'] . " " . $aParams['oxuser__oxlname'] . "(" . $aParams['oxuser__oxusername'] . ")<br /><br />" . nl2br(oxRegistry::getConfig()->getRequestParameter('c_message')); $oEmail = oxNew('oxemail'); if ($oEmail->sendContactMail($aParams['oxuser__oxusername'], $sSubject, $sMessage)) { $this->_blContactSendStatus = 1; } else { oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL'); } }
/** * Processes PayPal callback * * @return null */ public function processCallBack() { $oPayPalService = $this->getPayPalCheckoutService(); $this->_setParamsForCallbackResponse($oPayPalService); $sRequest = $oPayPalService->callbackResponse(); oxRegistry::getUtils()->showMessageAndExit($sRequest); }
/** * Extends the startup checks with Barzahlen plugin version check. * * @return array */ protected function _doStartUpChecks() { $aMessage = parent::_doStartUpChecks(); $oxConfig = $this->getConfig(); $sShopId = $oxConfig->getShopId(); $sModule = oxConfig::OXMODULE_MODULE_PREFIX . $this->_sModuleId; $sPluginCheck = $oxConfig->getShopConfVar('bzPluginCheck', $sShopId, $sModule); // only check once a week if ($sPluginCheck != null && $sPluginCheck > strtotime("-1 week")) { return $aMessage; } $oxConfig->saveShopConfVar('str', 'bzPluginCheck', time(), $sShopId, $sModule); $sBzShopId = $oxConfig->getShopConfVar('bzShopId', $sShopId, $sModule); $sShopsystem = 'OXID 4.7/5.0'; $sShopsystemVersion = $oxConfig->getVersion(); $sPluginVersion = self::CURRENTVERSION; try { $oChecker = new Barzahlen_Version_Check(); $newAvailable = $oChecker->isNewVersionAvailable($sBzShopId, $sShopsystem, $sShopsystemVersion, $sPluginVersion); } catch (Exception $e) { oxRegistry::getUtils()->writeToLog(date('c') . " " . $e . "\r\r", self::LOGFILE); } if ($newAvailable) { $aMessage['warning'] .= (!empty($aMessage['warning']) ? "<br>" : '') . sprintf(oxRegistry::getLang()->translateString('BZ__NEW_PLUGIN_AVAILABLE'), $oChecker->getNewPluginVersion(), $oChecker->getNewPluginUrl()); } return $aMessage; }
public function sendForgotPwdEmail($sEmailAddress, $sSubject = null) { oxRegistry::getUtils()->writeToLog($sEmailAddress . " haz forgot pwd!", 'pwd.log'); $ret = parent::sendForgotPwdEmail($sEmailAddress, $sSubject); oxRegistry::getUtils()->writeToLog($sEmailAddress . " haz forgot pwd!!!!", 'pwd.log'); return $this->isDebug() ? $this : $ret; }
/** * Generate variants from selection lists * * @param array $aSels ids of selection list * @param object $oArticle parent article */ public function genVariantFromSell($aSels, $oArticle) { $oVariants = $oArticle->getAdminVariants(); $myConfig = $this->getConfig(); $myUtils = oxRegistry::getUtils(); $myLang = oxRegistry::getLang(); $aConfLanguages = $myLang->getLanguageIds(); foreach ($aSels as $sSelId) { $oSel = oxNew("oxi18n"); $oSel->setEnableMultilang(false); $oSel->init('oxselectlist'); $oSel->load($sSelId); $sVarNameUpdate = ""; foreach ($aConfLanguages as $sKey => $sLang) { $sPrefix = $myLang->getLanguageTag($sKey); $aSelValues = $myUtils->assignValuesFromText($oSel->{"oxselectlist__oxvaldesc" . $sPrefix}->value); foreach ($aSelValues as $sI => $oValue) { $aValues[$sI][$sKey] = $oValue; } $aSelTitle[$sKey] = $oSel->{"oxselectlist__oxtitle" . $sPrefix}->value; $sMdSeparator = $oArticle->oxarticles__oxvarname->value ? $this->_sMdSeparator : ''; if ($sVarNameUpdate) { $sVarNameUpdate .= ", "; } $sVarName = oxDb::getDb()->quote($sMdSeparator . $aSelTitle[$sKey]); $sVarNameUpdate .= "oxvarname" . $sPrefix . " = CONCAT(oxvarname" . $sPrefix . ", " . $sVarName . ")"; } $oMDVariants = $this->_assignValues($aValues, $oVariants, $oArticle, $aConfLanguages); if ($myConfig->getConfigParam('blUseMultidimensionVariants')) { $oAttribute = oxNew("oxattribute"); $oAttribute->assignVarToAttribute($oMDVariants, $aSelTitle); } $this->_updateArticleVarName($sVarNameUpdate, $oArticle->oxarticles__oxid->value); } }
/** * Checks if given token is valid, formats HTTP headers, * and outputs file to buffer. * * If token is not valid, redirects to start page. */ public function render() { $sFileOrderId = oxRegistry::getConfig()->getRequestParameter('sorderfileid'); if ($sFileOrderId) { $oArticleFile = oxNew('oxFile'); try { /** @var oxOrderFile $oOrderFile */ $oOrderFile = oxNew('oxOrderFile'); if ($oOrderFile->load($sFileOrderId)) { $sFileId = $oOrderFile->getFileId(); $blLoadedAndExists = $oArticleFile->load($sFileId) && $oArticleFile->exist(); if ($sFileId && $blLoadedAndExists && $oOrderFile->processOrderFile()) { $oArticleFile->download(); } else { $sError = "ERROR_MESSAGE_FILE_DOESNOT_EXIST"; } } } catch (oxException $oEx) { $sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED"; } } else { $sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK"; } if ($sError) { $oEx = new oxExceptionToDisplay(); $oEx->setMessage($sError); oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx, false); oxRegistry::getUtils()->redirect(oxRegistry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads'); } }
/** * Composes and sends drawal form, returns false if some parameters are missing * * @return bool */ public function send() { $aParams = $this->getConfig()->getRequestParameter('editval'); // checking email address if (!oxRegistry::getUtils()->isValidEmail($aParams['pswdf_email'])) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL'); return false; } // spam spider prevension $sMac = $this->getConfig()->getRequestParameter('c_mac'); $sMacHash = $this->getConfig()->getRequestParameter('c_mach'); $oCaptcha = $this->getCaptcha(); if (!$oCaptcha->pass($sMac, $sMacHash)) { // even if there is no exception, use this as a default display method oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE'); return false; } $sSubject = $this->getConfig()->getRequestParameter('c_subject'); if (!$aParams['pswdf_ordernr'] || !$aParams['pswdf_articles'] || !$aParams['pswdf_orderdate'] || !$aParams['pswdf_receiveddate'] || !$aParams['pswdf_name'] || !$aParams['pswdf_address'] || !$aParams['pswdf_email'] || !$aParams['pswdf_drawaldate']) { // even if there is no exception, use this as a default display method oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS'); return false; } $oShop = $this->getConfig()->getActiveShop(); $oLang = oxRegistry::getLang(); $sMessage = $oLang->translateString('PSWDF_MSG2') . "\r\n\r\n" . $oLang->translateString('PSWDF_ORDERNR') . " " . $aParams['pswdf_ordernr'] . "\r\n" . $oLang->translateString('PSWDF_DATE_ARTICLES') . " " . $aParams['pswdf_articles'] . "\r\n" . $oLang->translateString('PSWDF_DATE_ORDER') . " " . $aParams['pswdf_orderdate'] . "\r\n" . $oLang->translateString('PSWDF_DATE_RECEIVED') . " " . $aParams['pswdf_receiveddate'] . "\r\n\r\n" . $oLang->translateString('PSWDF_NAME') . " " . $aParams['pswdf_name'] . "\r\n" . $oLang->translateString('PSWDF_ADDRESS') . " " . $aParams['pswdf_address'] . "\r\n" . $oLang->translateString('PSWDF_EMAIL') . " " . $aParams['pswdf_email'] . "\r\n" . $oLang->translateString('PSWDF_DATE_DRAWAL') . " " . $aParams['pswdf_drawaldate'] . "\r\n"; $oEmail = oxNew('oxemail'); $blSendToOwner = $oEmail->sendEmail($oShop->oxshops__oxorderemail->value, $oLang->translateString('PSWDF_SUBJECT') . " " . $aParams['pswdf_name'] . " (#" . $aParams['pswdf_ordernr'] . ")", $sMessage); $blSendToCustomer = $oEmail->sendEmail($aParams['pswdf_email'], $oLang->translateString('PSWDF_SUBJECT_CUSTOMER') . " " . $aParams['pswdf_name'] . " (#" . $aParams['pswdf_ordernr'] . ")", $sMessage); if ($blSendToOwner && $blSendToCustomer) { $this->_blDrawalFormSendStatus = 1; } else { oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL'); } }
/** * handler for 404 (page not found) error * * @param string $sUrl url which was given, can be not specified in some cases * * @return void */ public function handlePageNotFoundError($sUrl = '') { // module active? if (!oxRegistry::getConfig()->getConfigParam("psRedirect404_status")) { return parent::handlePageNotFoundError($sUrl = ''); } $iShortest = -1; $iHeaderType = 302; $sSearchString = $this->_clearUrl($sUrl); // psRedirect404 // checks based on levenshtein algorithm closest url from // oxid seo urls (oxseo) and redirect with header 302 to this page try { foreach ($this->_getSeoUrls() as $value) { $sUrl = $this->_clearUrl($value[0]); $sLevRes = levenshtein($sSearchString, $sUrl); #echo $sLevRes." - ".$sUrl." (".$value[0].")<br>"; if ($sLevRes <= $iShortest || $iShortest < 0) { $sClosest = $value[0]; $iShortest = $sLevRes; if ($sLevRes <= 10 && oxRegistry::getConfig()->getConfigParam("psRedirect404_redirecttype") == "auto") { $iHeaderType = 301; } } } if (!oxRegistry::getConfig()->getConfigParam("psRedirect404_redirecttype") == "301") { $iHeaderType = 301; } oxRegistry::getUtils()->redirect(oxRegistry::getConfig()->getShopUrl() . $sClosest, false, $iHeaderType); } catch (Exception $e) { } $this->showMessageAndExit("Found"); }
/** * Kicks off the notification process and sends out the header after a * successful or not successful hash validation. * * @return string current template file name */ public function render() { parent::render(); $oUpdateHandler = $this->_getUpdateHandler(); if (!$oUpdateHandler->checkData($_GET)) { $this->_sendHeader(self::STATUS_BAD_REQUEST); return; } switch ($oUpdateHandler->getState()) { case self::STATE_PAID: case self::STATE_EXPIRED: $success = $oUpdateHandler->updatePayment(); break; case self::STATE_REFUND_COMPLETED: case self::STATE_REFUND_EXPIRED: $success = $oUpdateHandler->updateRefund(); break; default: oxRegistry::getUtils()->writeToLog(date('c') . 'Notification failed: Unknown state - ' . $oUpdateHandler->getState() . "\r\r", self::LOGFILE); $success = false; break; } if (!$success) { $this->_sendHeader(self::STATUS_BAD_REQUEST); return; } $this->_sendHeader(self::STATUS_OK); return 'page/shop/start.tpl'; }
/** * Composes and sends user written message, returns false if some parameters * are missing. * * @return bool */ public function send() { $aParams = oxRegistry::getConfig()->getRequestParameter('editval'); // checking email address if (!oxRegistry::getUtils()->isValidEmail($aParams['oxuser__oxusername'])) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOVALIDEMAIL'); return false; } $sSubject = oxRegistry::getConfig()->getRequestParameter('c_subject'); if (!$aParams['oxuser_oxfnameandlname'] || !$aParams['oxuser__oxusername'] || !$sSubject) { // even if there is no exception, use this as a default display method oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_INPUT_NOTALLFIELDS'); return false; } $oLang = oxRegistry::getLang(); $sMessage = $oLang->translateString('MESSAGE_FROM') . " " . $oLang->translateString($aParams['oxuser__oxsal']) . " " . $aParams['oxuser_oxfnameandlname'] . " " . $aParams['oxuser__oxlname'] . " " . $aParams['oxuser__oxcompany'] . " (" . $aParams['oxuser__oxusername'] . ")<br /><br />" . ($sOnlyMessage = nl2br(oxRegistry::getConfig()->getRequestParameter('c_message'))); $aSpamwords = $this->getConfig()->getConfigParam('aJsSpamProtection'); if ($aSpamwords == 0) { foreach ($aSpamwords as $sSpamword) { $sSpamwordToLower = strtolower($sSpamword); if (strpos(strtolower($sSubject), $sSpamwordToLower) !== false || strpos(strtolower($aParams['oxuser__oxusername']), $sSpamwordToLower) !== false || strpos(strtolower($aParams['oxuser_oxfnameandlname']), $sSpamwordToLower) !== false || strpos(strtolower($aParams['oxuser__oxcompany']), $sSpamwordToLower) !== false || strpos(strtolower($sOnlyMessage), $sSpamwordToLower) !== false) { $this->_blSpamStatus = 1; return false; } } } $oEmail = oxNew('oxemail'); if ($oEmail->sendContactMail($aParams['oxuser__oxusername'], $sSubject, $sMessage)) { $this->_blContactSendStatus = 1; } else { oxRegistry::get("oxUtilsView")->addErrorToDisplay('ERROR_MESSAGE_CHECK_EMAIL'); } }
public function testLoadVoucherList() { $myUtils = oxRegistry::getUtils(); $oVouchers = oxNew('oxvoucherlist'); $oVouchers->selectString('select * from oxvouchers where oxvouchers.oxvoucherserieid = "' . $this->_sOxid . '"'); $this->assertEquals(self::MAX_LOOP_AMOUNT, $oVouchers->count()); }
public function request_product() { $myConfig = $this->getConfig(); $myUtils = oxRegistry::getUtils(); //control captcha $sMac = oxRegistry::getConfig()->getRequestParameter('c_mac'); $sMacHash = oxRegistry::getConfig()->getRequestParameter('c_mach'); $oCaptcha = $this->getCaptcha(); if (!$oCaptcha->pass($sMac, $sMacHash)) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_WRONG_VERIFICATION_CODE'); return; } /** @var oxMailValidator $oMailValidator */ $oMailValidator = oxNew('oxMailValidator'); $aParams = oxRegistry::getConfig()->getRequestParameter('pa'); if (!isset($aParams['email']) || !$oMailValidator->isValidEmail($aParams['email'])) { oxRegistry::get("oxUtilsView")->addErrorToDisplay('MESSAGE_INVALID_EMAIL'); return; } $aParams['aid'] = $this->getProduct()->getId(); $oArticleRequest = oxNew("psarticlerequest"); $oArticleRequest->psarticlerequest__oxuserid = new oxField(oxRegistry::getSession()->getVariable('usr')); $oArticleRequest->psarticlerequest__oxemail = new oxField($aParams['email']); $oArticleRequest->psarticlerequest__oxartid = new oxField($aParams['aid']); $oArticleRequest->psarticlerequest__oxshopid = new oxField($myConfig->getShopId()); $oArticleRequest->psarticlerequest__oxlang = new oxField(oxRegistry::getLang()->getBaseLanguage()); $oArticleRequest->psarticlerequest__oxstatus = new oxField(psArticleRequest::STATUS_RECEIVED); $oArticleRequest->save(); $oEmail = oxNew("oxEmail"); $oEmail->sendArticleRequestNotification($aParams, $oArticleRequest); $this->_iArticleRequestStatus = 1; oxRegistry::get("oxUtilsView")->addErrorToDisplay('PS_ARTICLEREQUEST_SUCCESS'); }
/** * Paymorrow function for Verifying Form Data against Paymorrow Services */ public function prepareOrder() { /** @var OxpsPaymorrowRequestControllerProxy $oPmGateWay */ $oPmGateWay = oxNew('OxpsPaymorrowRequestControllerProxy'); $oUtils = oxRegistry::getUtils(); $oUtils->setHeader("Content-Type: application/json"); $oUtils->showMessageAndExit($oPmGateWay->prepareOrder($_POST)); }
/** * Executes parent method parent::render(), prints shop and * PHP configuration information. * * @return string */ public function render() { if ($this->getConfig()->isDemoShop()) { return oxRegistry::getUtils()->showMessageAndExit("Access denied !"); } parent::render(); return "tools.tpl"; }
public function init() { parent::init(); if (!oxRegistry::getConfig()->getRequestParameter('fnc')) { $oViewConf = $this->getViewConfig(); oxRegistry::getUtils()->redirect($oViewConf->getHomeLink(), false); } }
/** * Tear down the fixture. * * @return null */ protected function tearDown() { modOxView::reset(); // restoring $this->getConfig()->getActiveShop()->oxshops__oxseoactive = new oxField($this->_iSeoMode, oxField::T_RAW); oxRegistry::getUtils()->seoIsActive(true); oxTestModules::cleanUp(); parent::tearDown(); }
/** * Finalizes the script. */ public function pageClose() { $mySession = $this->getSession(); if (isset($mySession)) { $mySession->freeze(); } //commit file cache oxRegistry::getUtils()->commitFileCache(); }
/** * Resets template, language and menu xml cache */ public function resetCache() { $aTemplates = $this->getModule()->getTemplates(); $oUtils = oxRegistry::getUtils(); $oUtils->resetTemplateCache($aTemplates); $oUtils->resetLanguageCache(); $oUtils->resetMenuCache(); oxModuleVariablesLocator::resetModuleVariables(); $this->_clearApcCache(); }
/** * Performs the api request. * * @param Barzahlen_Request $oRequest request object * @param integer $iOrderLang order language id * @return updated request object */ protected function _connectBarzahlenApi($oRequest, $iOrderLang) { $oApi = $this->_getBarzahlenApi($iOrderLang); try { $oApi->handleRequest($oRequest); } catch (Exception $e) { oxRegistry::getUtils()->writeToLog(date('c') . " API/Refund failed: " . $e . "\r\r", self::LOGFILE); } return $oRequest; }
/** * Resets template, language and menu xml cache */ public function resetCache() { $aTemplates = $this->getModule()->getTemplates(); $oUtils = oxRegistry::getUtils(); $oUtils->resetTemplateCache($aTemplates); $oUtils->resetLanguageCache(); $oUtils->resetMenuCache(); $oUtilsObject = oxUtilsObject::getInstance(); $oUtilsObject->resetModuleVars(); $this->_clearApcCache(); }
/** * Test loading simple Manufacturer list and counting Manufacturer articles */ public function testLoadManufacturerListAndCountManufacturerArticles() { $myUtils = oxRegistry::getUtils(); $this->getConfig()->setConfigParam('bl_perfShowActionCatArticleCnt', true); $oManufacturerlist = oxNew('oxManufacturerlist'); $oManufacturerlist->setShowManufacturerArticleCnt(true); $oManufacturerlist->loadManufacturerList(); foreach ($oManufacturerlist as $sVndId => $value) { $iArtCount = $oManufacturerlist[$sVndId]->oxmanufacturers__oxnrofarticles->value; $this->assertTrue($iArtCount > 0, "Manufacturer articles were not counted"); } }
/** * Test loading simple vendor list and counting vendor articles */ public function test_loadVendorListAndCountVendorArticles() { $myUtils = oxRegistry::getUtils(); $this->getConfig()->setConfigParam('bl_perfShowActionCatArticleCnt', true); $oVendorlist = oxNew('oxvendorlist'); $oVendorlist->setShowVendorArticleCnt(true); $oVendorlist->loadVendorList(); foreach ($oVendorlist as $sVndId => $value) { $iArtCount = $oVendorlist[$sVndId]->oxvendor__oxnrofarticles->value; $this->assertTrue($iArtCount > 0, "Vendor articles were not counted"); } }
public function sendPromotion() { $promoContent = oxNew('oxcmscontent'); $promoContent->loadByIdent('footer_promotion'); $userEmail = oxRegistry::getConfig()->getSystemConfigParameter('promotion-email'); $email = oxNew('oxemail'); $message = "Promotion: {$promoContent->oxcms_contents__oxtitle->value}<br>\n Message: " . strip_tags($promoContent->oxcms_contents__oxcontent->value) . "<br>\n Email: {$userEmail}"; if ($email->sendContactMail($userEmail, $promoContent->oxcms_contents__oxtitle->value, $message)) { oxRegistry::getUtils()->showMessageAndExit(json_encode(array('success' => 1))); } oxRegistry::getUtils()->showMessageAndExit(json_encode(array('error' => 1))); }
/** * Redirect user to given controller and shows an error. * In case of 'RELOAD_CONFIGURATION_REQUIRED' error, update module settings and redirect. * * @codeCoverageIgnore * * @param $iErrorCode * @param string $sController */ public function redirectWithError($iErrorCode, $sController = 'order') { $sErrorMessage = $this->getErrorByCode($iErrorCode); // Set error $oEx = oxNew('oxExceptionToDisplay'); $oEx->setMessage($sErrorMessage); oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx, false); // Redirect (refresh page) $sUrl = $this->getConfig()->getShopCurrentUrl() . "cl=" . $sController; $sUrl = oxRegistry::get("oxUtilsUrl")->processUrl($sUrl); oxRegistry::getUtils()->redirect($sUrl); return; }
/** * Executes parent method parent::render(), passes data to Smarty engine * and returns name of template file "imex_export.tpl". * * @return string */ public function render() { if ($this->getConfig()->isDemoShop()) { oxRegistry::getUtils()->showMessageAndExit("Access denied !"); } parent::render(); $oAuthUser = oxNew('oxuser'); $oAuthUser->loadAdminUser(); $this->_aViewData["blIsMallAdmin"] = $oAuthUser->oxuser__oxrights->value == "malladmin"; $blShowUpdateViews = $this->getConfig()->getConfigParam('blShowUpdateViews'); $this->_aViewData['showViewUpdate'] = isset($blShowUpdateViews) && !$blShowUpdateViews ? false : true; return "tools_main.tpl"; }
/** * Executes parent::render() and returns active shop object. * * @return object $this->oActShop active shop object */ public function render() { parent::render(); $myConfig = $this->getConfig(); // is shop active? $oShop = $myConfig->getActiveShop(); $sActiveField = 'oxshops__oxactive'; $sClassName = $myConfig->getActiveView()->getClassName(); if (!$oShop->{$sActiveField}->value && 'oxstart' != $sClassName && !$this->isAdmin()) { // redirect to offline if there is no active shop oxRegistry::getUtils()->redirectOffline(); } return $oShop; }
/** * Overwrite default decodeUrl handling to check for toxid pages * * @param $sSeoUrl * * @return mixed */ public function decodeUrl($sSeoUrl) { if ($this->isToxidUrl($sSeoUrl)) { $aRet['cl'] = 'toxid_curl'; $aRet['lang'] = $this->decodedUrl['toxidLang']; $toxidUrl = $this->decodedUrl['toxidUrl']; oxRegistry::getLang()->setBaseLanguage($aRet['lang']); $this->getConfig()->setConfigParam('sToxidCurlPage', $toxidUrl); return $aRet; } if (isset($this->decodedUrl['params'])) { return $this->decodedUrl['params']; } oxRegistry::getUtils()->redirect($this->getConfig()->getShopURL() . $this->decodedUrl['url'], false); }
public function render() { parent::render(); if ($this->err == 'API KEY INVALID') { oxRegistry::getUtils()->setHeader("HTTP/1.0 401 Unauthorized"); } oxRegistry::getUtils()->setHeader("Content-Type: application/json; charset=" . oxRegistry::getLang()->translateString("charset")); $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty(); $this->_aViewData['errmsg'] = $this->err; $this->_aViewData['haserror'] = $this->err !== false; $this->_aViewData['data'] = $this->data; foreach (array_keys($this->_aViewData) as $sViewName) { $oSmarty->assign_by_ref($sViewName, $this->_aViewData[$sViewName]); } oxRegistry::getUtils()->showMessageAndExit($oSmarty->fetch($this->_sThisTemplate, $this->getViewId())); }
/** * Initializes all required components. * * @return null|void */ public function init() { parent::init(); set_exception_handler(array($this, 'exceptionHandler')); try { $this->_initVersionLayer(); } catch (Exception $e) { $sMessage = json_encode($this->_errorMessage($e->getMessage()), JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); if ($this->_hasRegistry('getUtils')) { $oUtils = oxRegistry::getUtils(); } else { $oUtils = oxUtils::getInstance(); } $oUtils->showMessageAndExit($sMessage); } }
/** * Renders requested RSS feed * * Template variables: * <b>rss</b> */ public function render() { parent::render(); $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty(); // #2873: In demoshop for RSS we set php_handling to SMARTY_PHP_PASSTHRU // as SMARTY_PHP_REMOVE removes not only php tags, but also xml if ($this->getConfig()->isDemoShop()) { $oSmarty->php_handling = SMARTY_PHP_PASSTHRU; } foreach (array_keys($this->_aViewData) as $sViewName) { $oSmarty->assign_by_ref($sViewName, $this->_aViewData[$sViewName]); } // return rss xml, no further processing $sCharset = oxRegistry::getLang()->translateString("charset"); oxRegistry::getUtils()->setHeader("Content-Type: text/xml; charset=" . $sCharset); oxRegistry::getUtils()->showMessageAndExit($this->_processOutput($oSmarty->fetch($this->_sThisTemplate, $this->getViewId()))); }