source/Application/Controller/DownloadController.php
public function render()
    {
        $sFileOrderId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sorderfileid');

        if ($sFileOrderId) {
            $oArticleFile = oxNew(\OxidEsales\Eshop\Application\Model\File::class);
            try {
                /** @var \OxidEsales\Eshop\Application\Model\OrderFile $oOrderFile */
                $oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
                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 (\OxidEsales\Eshop\Core\Exception\StandardException $oEx) {
                $sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
            }
        } else {
            $sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
        }
        if ($sError) {
            $oEx = new \OxidEsales\Eshop\Core\Exception\ExceptionToDisplay();
            $oEx->setMessage($sError);
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
            \OxidEsales\Eshop\Core\Registry::getUtils()->redirect(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads');
        }
    }
public function render()
    {
        $sFileOrderId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sorderfileid');

        if ($sFileOrderId) {
            $oArticleFile = oxNew(\OxidEsales\Eshop\Application\Model\File::class);
            try {
                /** @var \OxidEsales\Eshop\Application\Model\OrderFile $oOrderFile */
                $oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
                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 (\OxidEsales\Eshop\Core\Exception\StandardException $oEx) {
                $sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED";
            }
        } else {
            $sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK";
        }
        if ($sError) {
            $oEx = new \OxidEsales\Eshop\Core\Exception\ExceptionToDisplay();
            $oEx->setMessage($sError);
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false);
            \OxidEsales\Eshop\Core\Registry::getUtils()->redirect(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopUrl() . 'index.php?cl=account_downloads');
        }
    }
public function render ( ) { $ sFileOrderId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'sorderfileid' ) ; if ( $ sFileOrderId ) { $ oArticleFile = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ File :: class ) ; try { /** @var \OxidEsales\Eshop\Application\Model\OrderFile $oOrderFile */ $ oOrderFile = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ OrderFile :: class ) ; 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 ( \ OxidEsales \ Eshop \ Core \ Exception \ StandardException $ oEx ) { $ sError = "ERROR_MESSAGE_FILE_DOWNLOAD_FAILED" ; } } else { $ sError = "ERROR_MESSAGE_WRONG_DOWNLOAD_LINK" ; } if ( $ sError ) { $ oEx = new \ OxidEsales \ Eshop \ Core \ Exception \ ExceptionToDisplay ( ) ; $ oEx -> setMessage ( $ sError ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsView ( ) -> addErrorToDisplay ( $ oEx , false ) ; \ OxidEsales \ Eshop \ Core \ Registry :: getUtils ( ) -> redirect ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getShopUrl ( ) . 'index.php?cl=account_downloads' ) ; } }
Checks if given token is valid, formats HTTP headers,
and outputs file to buffer.

If token is not valid, redirects to start page.
Checks if given token is valid formats HTTP headers and outputs file to buffer .