download.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class Download extends oxUBase
00008 {
00015     public function init()
00016     {
00017         // empty for performance reasons
00018     }
00019 
00028     public function render()
00029     {
00030         $sFileOrderId = oxConfig::getParameter('sorderfileid');
00031 
00032         if ( $sFileOrderId ) {
00033             $oArticleFile = oxNew('oxFile');
00034             try {
00035                 $oOrderFile = oxNew('oxOrderFile');
00036                 if ( $oOrderFile->load($sFileOrderId) ) {
00037                     $sFileId = $oOrderFile->processOrderFile();
00038                     if ( $sFileId && $oArticleFile->load($sFileId) ) {
00039                         $oArticleFile->download();
00040                     } else {
00041                         $sError = "ERROR_MESSAGE_FILE_DOESNOT_EXIST";
00042                     }
00043                 }
00044             } catch (oxException $oEx) {
00045                 $sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
00046             }
00047         } else {
00048             $sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
00049         }
00050         if ( $sError ) {
00051             $oEx = new oxExceptionToDisplay();
00052             $oEx->setMessage( $sError );
00053             oxRegistry::get("oxUtilsView")->addErrorToDisplay( $oEx, false );
00054             oxRegistry::getUtils()->redirect( oxRegistry::getConfig()->getShopUrl() . 'index.php?cl=start&showexceptionpage=1');
00055         }
00056     }
00057 }