Show
Ignore:
Timestamp:
09/28/08 17:57:26 (5 years ago)
Author:
Tatzelwurm
Message:

New Filenames for Uploads.
Some Eventlistener Points added.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • downloadDatabase/files/lib/data/downloadDB/DownloadDBData.class.php

    r541 r668  
    3434         */ 
    3535        public function getURL() { 
    36                 return DOWNLOADDB_FILE_DIR . intval($this->dataID) . '_' . StringUtil::encodeHTML($this->fileName); 
     36                if(file_exists(RELATIVE_WCF_DIR.DOWNLOADDB_FILE_DIR . intval($this->dataID) . '_' . StringUtil::encodeHTML($this->fileName))){ 
     37                        return DOWNLOADDB_FILE_DIR . intval($this->dataID) . '_' . StringUtil::encodeHTML($this->fileName); 
     38                } 
     39                return DOWNLOADDB_FILE_DIR . 'Upload-' . $this->dataID . '.' . $this->fileExtension; 
    3740        } 
    3841 
     
    6265        public function deleteFile($fName) { 
    6366                // delete file 
    64                 @unlink(WCF_DIR.DOWNLOADDB_FILE_DIR . $this->dataID . '_' . $fName); 
     67                if(file_exists(RELATIVE_WCF_DIR.DOWNLOADDB_FILE_DIR . intval($this->dataID) . '_' . StringUtil::encodeHTML($fName))){ 
     68                        @unlink(WCF_DIR.DOWNLOADDB_FILE_DIR . $this->dataID . '_' . $fName); 
     69                } else { 
     70                        @unlink(WCF_DIR . DOWNLOADDB_FILE_DIR . 'Upload-' .$this->dataID . '.' . $this->fileExtension); 
     71                } 
    6572        } 
    6673         
     
    7178        public function deletePreview($fName) { 
    7279                // delete file 
    73                 @unlink(WCF_DIR . DOWNLOADDB_PREVIEW_DIR . $this->dataID . '_' . $fName); 
    74                 @unlink(WCF_DIR . DOWNLOADDB_PREVIEW_DIR . 'thumbnail-' . $this->dataID . '_' . $fName); 
     80                if(file_exists(RELATIVE_WCF_DIR.DOWNLOADDB_PREVIEW_DIR . $this->dataID . '_' . $fName)){ 
     81                        @unlink(WCF_DIR . DOWNLOADDB_PREVIEW_DIR . $this->dataID . '_' . $fName); 
     82                        @unlink(WCF_DIR . DOWNLOADDB_PREVIEW_DIR . 'thumbnail-' . $this->dataID . '_' . $fName); 
     83                } else { 
     84                        $fExt = StringUtil::toLowerCase(StringUtil::substring($fName, StringUtil::lastIndexOf($fName, '.') + 1)); 
     85                        @unlink(WCF_DIR . DOWNLOADDB_PREVIEW_DIR . 'Preview-' . $this->dataID . '.' . $fExt); 
     86                        @unlink(WCF_DIR . DOWNLOADDB_PREVIEW_DIR . 'thumbnail-' . $this->dataID . '.' . $fExt); 
     87                } 
    7588        } 
    7689