32         $this->
init(
'oxorderfiles');
 
   42         $oArticleFile = 
oxNew(
'oxFile');
 
   43         $oArticleFile->load($this->oxorderfiles__oxfileid->value);
 
   44         if ( file_exists($oArticleFile->getStoreLocation()) ) {
 
   45             $this->oxorderfiles__oxdownloadcount = 
new oxField( 0 );
 
   46             $this->oxorderfiles__oxfirstdownload = 
new oxField( 
'0000-00-00 00:00:00' );
 
   47             $this->oxorderfiles__oxlastdownload = 
new oxField( 
'0000-00-00 00:00:00' );
 
   48             $iExpirationTime = $this->oxorderfiles__oxlinkexpirationtime->value * 3600;
 
   50             $sDate = date( 
'Y-m-d H:i:s', $sNow + $iExpirationTime );
 
   51             $this->oxorderfiles__oxvaliduntil = 
new oxField( $sDate );
 
   52             $this->oxorderfiles__oxresetcount = 
new oxField( $this->oxorderfiles__oxresetcount->value + 1 );
 
   65         $this->oxorderfiles__oxorderid = 
new oxField( $sOrderId );
 
   77         $this->oxorderfiles__oxorderarticleid = 
new oxField( $sOrderArticleId );
 
   89         $this->oxorderfiles__oxshopid = 
new oxField( $sShopId );
 
  103     public function setFile( $sFileName, $sFileId, $iMaxDownloadCounts, $iExpirationTime, $iExpirationDownloadTime )
 
  106         $sDate = date( 
'Y-m-d G:i', $sNow + $iExpirationTime*3600 );
 
  108         $this->oxorderfiles__oxfileid = 
new oxField( $sFileId );
 
  109         $this->oxorderfiles__oxfilename = 
new oxField( $sFileName );
 
  110         $this->oxorderfiles__oxmaxdownloadcount = 
new oxField( $iMaxDownloadCounts );
 
  111         $this->oxorderfiles__oxlinkexpirationtime = 
new oxField( $iExpirationTime );
 
  112         $this->oxorderfiles__oxdownloadexpirationtime = 
new oxField( $iExpirationDownloadTime );
 
  113         $this->oxorderfiles__oxvaliduntil = 
new oxField( $sDate );
 
  123         $oFile = 
oxNew(
"oxfile");
 
  124         $oFile->load($this->oxorderfiles__oxfileid->value);
 
  125         return $oFile->getSize();
 
  137         $aFieldNames = array(
 
  138             'oxorderfiles__oxarticletitle',
 
  139             'oxorderfiles__oxarticleartnum',
 
  140             'oxorderfiles__oxordernr',
 
  141             'oxorderfiles__oxorderdate',
 
  142             'oxorderfiles__oxispaid',
 
  143             'oxorderfiles__oxpurchasedonly' 
  146         if ( in_array( $sFieldName, $aFieldNames ) ) {
 
  160         if ( !$this->oxorderfiles__oxmaxdownloadcount->value || ($this->oxorderfiles__oxdownloadcount->value < $this->oxorderfiles__oxmaxdownloadcount->value) ) {
 
  162             if ( !$this->oxorderfiles__oxlinkexpirationtime->value && !$this->oxorderfiles__oxdownloadxpirationtime->value ) {
 
  166                 $iTimestamp = strtotime($this->oxorderfiles__oxvaliduntil->value);
 
  167                 if ( !$iTimestamp || ( $iTimestamp > $sNow ) ) {
 
  182         return $this->oxorderfiles__oxispaid->value;
 
  192         return substr( $this->oxorderfiles__oxvaliduntil->value, 0, 16 );
 
  202         $iLeft = $this->oxorderfiles__oxmaxdownloadcount->value - $this->oxorderfiles__oxdownloadcount->value;
 
  218             if (!$this->oxorderfiles__oxdownloadcount->value) {
 
  219                 $this->oxorderfiles__oxdownloadcount = 
new oxField( 1 );
 
  221                 $iExpirationTime = $this->oxorderfiles__oxdownloadexpirationtime->value * 3600;
 
  223                 $this->oxorderfiles__oxvaliduntil = 
new oxField( date( 
'Y-m-d H:i:s', $iTime + $iExpirationTime ) );
 
  225                 $this->oxorderfiles__oxfirstdownload = 
new oxField( date( 
'Y-m-d H:i:s', $iTime ) );
 
  226                 $this->oxorderfiles__oxlastdownload = 
new oxField( date( 
'Y-m-d H:i:s', $iTime ) );
 
  228                 $this->oxorderfiles__oxdownloadcount = 
new oxField( $this->oxorderfiles__oxdownloadcount->value + 1 );
 
  231                 $this->oxorderfiles__oxlastdownload = 
new oxField( date( 
'Y-m-d H:i:s', $iTime ) );
 
  234             return $this->oxorderfiles__oxfileid->value;
 
  241         return $this->oxorderfiles__oxfileid->value;