/** * 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'); } }
/** * Deletes selected master picture. * * @return null */ public function deletePicture() { $myConfig = $this->getConfig(); if ($myConfig->isDemoShop()) { // disabling uploading pictures if this is demo shop $oEx = new oxExceptionToDisplay(); $oEx->setMessage('CATEGORY_PICTURES_UPLOADISDISABLED'); /** @var oxUtilsView $oUtilsView */ $oUtilsView = oxRegistry::get("oxUtilsView"); $oUtilsView->addErrorToDisplay($oEx, false); return; } $sOxId = $this->getEditObjectId(); $sField = oxRegistry::getConfig()->getRequestParameter('masterPicField'); if (empty($sField)) { return; } /** @var oxCategory $oItem */ $oItem = oxNew('oxCategory'); $oItem->load($sOxId); $this->_deleteCatPicture($oItem, $sField); }