85         $aFileInfo = $this->
getConfig()->getUploadedFile($sFileIndex);
 
   89         $sFileHash = $this->
_getFileHash($aFileInfo[
'tmp_name']);
 
   93         if (!$this->
_uploadFile($aFileInfo[
'tmp_name'], $sUploadTo)) {
 
   94             throw new oxException(
'EXCEPTION_COULDNOTWRITETOFILE');
 
  109         if (!isset($aFileInfo[
'name']) || !isset($aFileInfo[
'tmp_name'])) {
 
  114         if (isset($aFileInfo[
'error']) && $aFileInfo[
'error']) {
 
  115             throw new oxException(
'EXCEPTION_FILEUPLOADERROR_' . ((
int) $aFileInfo[
'error']));
 
  130         if ($sConfigValue && $sConfigValue[0] == DIRECTORY_SEPARATOR) {
 
  131             return $sConfigValue;
 
  136             $sPath = getShopBasePath() . DIRECTORY_SEPARATOR . $sConfigValue;
 
  142         $sPath = getShopBasePath() . 
"/out/downloads/";
 
  172         if ($storageLocation === 
false) {
 
  178         return strpos($storageLocation, $downloadFolder) !== 
false;
 
  188         $this->_sRelativeFilePath = 
'';
 
  189         $sFileHash = $this->oxfiles__oxstorehash->value;
 
  190         $sFileName = $this->oxfiles__oxfilename->value;
 
  194             $sFileName = basename($sFileName);
 
  199             $this->_sRelativeFilePath .= DIRECTORY_SEPARATOR . $sFileHash;
 
  201             $this->_sRelativeFilePath = DIRECTORY_SEPARATOR . $this->_sManualUploadDir . DIRECTORY_SEPARATOR . $sFileName;
 
  218         $sDir = substr($sFileHash, 0, 2);
 
  221         if (!is_dir($sAbsDir)) {
 
  222             mkdir($sAbsDir, 0755);
 
  238         return md5_file($sFileName);
 
  252         $blDone = move_uploaded_file($sSource, $sTarget);
 
  255             $blDone = @chmod($sTarget, 0644);
 
  272         if ($this->oxfiles__oxstorehash->value) {
 
  286     public function delete($sOxId = null)
 
  288         $sOxId = $sOxId ? $sOxId : $this->
getId();
 
  292         if ($blDeleted = parent::delete($sOxId)) {
 
  310         $sHash = $this->oxfiles__oxstorehash->value;
 
  312         $iCount = $oDb->getOne(
 
  313             'SELECT COUNT(*) FROM `oxfiles` WHERE `OXSTOREHASH` = ' . $oDb->quote($sHash), 
false, false
 
  329         return rawurlencode($this->oxfiles__oxfilename->value);
 
  345         $oUtils->setHeader(
"Pragma: public");
 
  346         $oUtils->setHeader(
"Expires: 0");
 
  347         $oUtils->setHeader(
"Cache-Control: must-revalidate, post-check=0, pre-check=0, private");
 
  348         $oUtils->setHeader(
'Content-Disposition: attachment;filename=' . $sFileName);
 
  349         $oUtils->setHeader(
"Content-Type: application/octet-stream");
 
  350         if ($iFileSize = $this->
getSize()) {
 
  351             $oUtils->setHeader(
"Content-Length: " . $iFileSize);
 
  353         readfile($sFileLocations);
 
  354         $oUtils->showMessageAndExit(null);
 
  374         if ($this->_blHasValidDownloads == null) {
 
  375             $this->_blHasValidDownloads = 
false;
 
  376             $sNow = date(
'Y-m-d H:i:s', 
oxRegistry::get(
"oxUtilsDate")->getTime());
 
  377             $sFileId = $this->
getId();
 
  382                         `oxorderfiles`.`oxid` 
  384                         LEFT JOIN `oxorderarticles` ON `oxorderarticles`.`oxid` = `oxorderfiles`.`oxorderarticleid` 
  385                         LEFT JOIN `oxorder` ON `oxorder`.`oxid` = `oxorderfiles`.`oxorderid` 
  386                      WHERE `oxorderfiles`.`oxfileid` = " . $oDb->quote($sFileId) . 
" 
  387                         AND ( ! `oxorderfiles`.`oxmaxdownloadcount` OR `oxorderfiles`.`oxmaxdownloadcount` > `oxorderfiles`.`oxdownloadcount`) 
  388                         AND ( `oxorderfiles`.`oxvaliduntil` = '0000-00-00 00:00:00' OR `oxorderfiles`.`oxvaliduntil` > '{$sNow}' ) 
  389                         AND `oxorder`.`oxstorno` = 0 
  390                         AND `oxorderarticles`.`oxstorno` = 0";
 
  392             if ($oDb->getOne($sSql)) {
 
  393                 $this->_blHasValidDownloads = 
true;
 
  407         $iMaxCount = $this->oxfiles__oxmaxdownloads->value;
 
  409         if ($iMaxCount < 0) {
 
  410             $iMaxCount = $this->
getConfig()->getConfigParam(
"iMaxDownloadsCount");
 
  423         $iMaxCount = $this->oxfiles__oxmaxunregdownloads->value;
 
  425         if ($iMaxCount < 0) {
 
  426             $iMaxCount = $this->
getConfig()->getConfigParam(
"iMaxDownloadsCountUnregistered");
 
  439         $iExpTime = $this->oxfiles__oxlinkexptime->value;
 
  442             $iExpTime = $this->
getConfig()->getConfigParam(
"iLinkExpirationTime");
 
  455         $iExpTime = $this->oxfiles__oxdownloadexptime->value;
 
  458             $iExpTime = $this->
getConfig()->getConfigParam(
"iDownloadExpirationTime");
 
  472         if ($this->
exist()) {