Changeset 407

Show
Ignore:
Timestamp:
04/06/08 20:01:50 (5 years ago)
Author:
Tatzelwurm
Message:

diverse kleiner Fehler beseitigt

Location:
downloadDatabase/files/lib
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • downloadDatabase/files/lib/acp/form/DownloadDBDataAddForm.class.php

    r402 r407  
    6565                if (isset($_POST['datum']))             $this->datum            = intval($_POST['datum']); 
    6666                if (isset($_POST['sortOrder']))         $this->sortOrder        = intval($_POST['sortOrder']); 
    67                 if (isset($_POST['supportThread']))     $this->supportThread = StringUtil::encodeHTML($_POST['supportThread']); 
     67                if (isset($_POST['supportThread']))     $this->supportThread = escapeString($_POST['supportThread']); 
    6868                if (isset($_POST['activ']))                     $this->activ            = intval($_POST['activ']); 
    6969                // for File Upload 
     
    114114                                        // import file 
    115115                                        $this->dataID = DownloadDBDataEditor::createFile($this->upload['tmp_name'], $this->upload['name'], $this->upload['type'], 'upload'); 
    116                                         $this->groesse = FileUtil::formatFilesize($this->upload['size']); 
     116                                        $this->groesse = $this->upload['size']; 
    117117                                } else { 
    118118                                        throw new UserInputException('upload'); 
     
    156156                                                        'mimeType'              => escapeString($this->mimeType), 
    157157                                                        'link'                  => StringUtil::encodeHTML($this->link), 
    158                                                         'groesse'               => $this->groesse, 
     158                                                        'groesse'               => intval($this->groesse), 
    159159                                                        'downloads'             => intval($this->downloads), 
    160160                                                        'userID'                => intval($this->dldbUserID), 
     
    219219                parent::assignVariables(); 
    220220 
     221                $maxFileSize = WCF::getUser()->getPermission('user.dldb.maxFileSize'); 
    221222                WCF::getTPL()->assign(array( 
    222223                        'katOptions'    => $this->katOptions, 
     
    238239                        'supportThread' => $this->supportThread, 
    239240                        'activ'                 => $this->activ, 
    240                         'action'                => 'add' 
     241                        'action'                => 'add', 
     242                        'previewExtensions' => DOWNLOADDB_ALLOWED_PREVIEW_EXT, 
     243                        'fileExtensions' => DOWNLOADDB_ALLOWED_FILE_EXT, 
     244                        'maxFileSize'   => $maxFileSize 
    241245                )); 
    242246        } 
  • downloadDatabase/files/lib/acp/form/DownloadDBDataEditForm.class.php

    r402 r407  
    121121                                $this->fileName = $this->upload['name']; 
    122122                                $this->mimeType = $this->upload['type']; 
    123                                 $this->groesse  = FileUtil::formatFilesize($this->upload['size']); 
     123                                $this->groesse  = $this->upload['size']; 
    124124                                if (StringUtil::indexOf($this->fileName, '.') !== false) { 
    125125                                        $this->fileExtension = StringUtil::toLowerCase(StringUtil::substring($this->fileName, StringUtil::lastIndexOf($this->fileName, '.') + 1)); 
     
    138138                                                        'mimeType'              => StringUtil::encodeHTML($this->mimeType), 
    139139                                                        'link'                  => $this->link, 
    140                                                         'groesse'               => $this->groesse, 
     140                                                        'groesse'               => intval($this->groesse), 
    141141                                                        'downloads'             => intval($this->downloads), 
    142142                                                        'userID'                => intval($this->dldbUserID), 
  • downloadDatabase/files/lib/form/DownloadDBAddDataForm.class.php

    r402 r407  
    7474                if (isset($_POST['previewIMG']))        $this->previewIMG       = StringUtil::encodeHTML($_POST['previewIMG']); 
    7575                if (isset($_POST['sortOrder']))         $this->sortOrder        = intval($_POST['sortOrder']); 
    76                 if (isset($_POST['supportThread']))     $this->supportThread = StringUtil::encodeHTML($_POST['supportThread']); 
     76                if (isset($_POST['supportThread']))     $this->supportThread = escapeString($_POST['supportThread']); 
    7777                // for File Upload 
    7878                if (isset($_FILES['upload']))           $this->upload           = $_FILES['upload']; 
     
    112112                                // import upload file 
    113113                                $this->dataID = DownloadDBDataEditor::createFile($this->upload['tmp_name'], $this->upload['name'], $this->upload['type'], 'upload'); 
    114                                 $this->groesse = FileUtil::formatFilesize($this->upload['size']); 
     114                                $this->groesse = $this->upload['size']; 
    115115                        } else { 
    116116                                // no file to upload given 
     
    155155                                        'mimeType'              => escapeString($this->mimeType), 
    156156                                        'link'                  => StringUtil::encodeHTML($this->link), 
    157                                         'groesse'               => $this->groesse, 
     157                                        'groesse'               => intval($this->groesse), 
    158158                                        'downloads'             => intval($this->downloads), 
    159159                                        'userID'                => WCF::getUser()->userID, 
     
    238238                        WCF::getTPL()->assign('offlinemessage', DOWNLOADDB_OFFLINE_MESSAGE); 
    239239                } else { 
     240                        $maxFileSize = WCF::getUser()->getPermission('user.dldb.maxFileSize'); 
    240241                        WCF::getTPL()->assign(array( 
    241242                                'katID'                 => $this->katID, 
     
    256257                                'supportThread' => $this->supportThread, 
    257258                                'activ'                 => $this->activ, 
    258                                 'action'                => 'add' 
     259                                'action'                => 'add', 
     260                                'previewExtensions' => DOWNLOADDB_ALLOWED_PREVIEW_EXT, 
     261                                'fileExtensions' => DOWNLOADDB_ALLOWED_FILE_EXT, 
     262                                'maxFileSize'   => $maxFileSize 
    259263                        )); 
    260264                } 
  • downloadDatabase/files/lib/form/DownloadDBEditDataForm.class.php

    r402 r407  
    159159                                $this->fileName = $this->upload['name']; 
    160160                                $this->mimeType = $this->upload['type']; 
    161                                 $this->groesse = FileUtil::formatFilesize($this->upload['size']); 
     161                                $this->groesse  = $this->upload['size']; 
    162162                        } 
    163163                        if (StringUtil::indexOf($this->fileName, '.') !== false) { 
     
    176176                                'mimeType'              => StringUtil::encodeHTML($this->mimeType), 
    177177                                'link'                  => $this->link, 
    178                                 'groesse'               => $this->groesse, 
     178                                'groesse'               => intval($this->groesse), 
    179179                                'downloads'             => intval($this->downloads), 
    180180                                'userID'                => intval($this->dldbUserID), 
  • downloadDatabase/files/lib/page/DownloadDBDataPage.class.php

    r402 r407  
    8686                        if ($daten['dataID'] == $this->dataID && $daten['activ']) { 
    8787                                $daten['type'] = $this->setFileTypeIcon($daten['mimeType']); 
     88                                $daten['groesse'] = FileUtil::formatFilesize($daten['groesse']); 
    8889                                $IDs = explode(',',$daten['groupcheck']); 
    8990                                $daten['canViewCat'] = false; 
     
    120121                                } 
    121122                                // Beschreibung zur Ausgabe anpassen (BBCode+Smilies) 
    122                                 $daten['name']                  = StringUtil::unescape($this->getFormattedMessage($daten['name'])); 
    123                                 $daten['description']   = StringUtil::unescape($this->getFormattedMessage($daten['description'])); 
     123                                $daten['name']                  = $this->getFormattedMessage(StringUtil::unescape($daten['name'])); 
     124                                $daten['description']   = $this->getFormattedMessage(StringUtil::unescape($daten['description'])); 
    124125                                require_once(WCF_DIR.'lib/data/message/bbcode/URLParser.class.php'); 
    125126                                // URLs wandeln zur formatierten Ausgabe 
    126                                 $daten['thread'] = $this->getFormattedMessage(URLParser::parse(StringUtil::decodeHTML($daten['thread']))); 
     127                                $daten['thread'] = $this->getFormattedMessage(URLParser::parse(StringUtil::decodeHTML(StringUtil::unescape($daten['thread'])))); 
    127128                                $this->daten = $daten; 
    128129                                break; 
  • downloadDatabase/files/lib/page/DownloadDBFileDownloadPage.class.php

    r402 r407  
    3636        public function show() { 
    3737                $this->readDaten(); 
     38                // Anzahl der Downloads erhöhen 
     39                $sql = "UPDATE wcf".WCF_N."_dldb_data 
     40                                SET downloads = downloads + 1 
     41                                WHERE `dataID` = ".$this->dataID; 
     42                $row = WCF::getDB()->registerShutdownUpdate($sql); 
     43                // reset cache 
     44                WCF::getCache()->clear(WCF_DIR.'cache/', 'cache.dldbData.php'); 
    3845                if (!$this->fileName) { 
    39                         $link = FileUtil::downloadFileFromHttp($this->link, 'DLDB_'.$this->dataID); 
     46                        if (FileUtil::isURL($this->link)) { 
     47                                HeaderUtil::redirect($this->link,false); 
     48                                exit; 
     49                        } else { 
     50                        $geturl = new downloadDBDataEditor($this->dataID); 
     51                        $link = FileUtil::getRealPath(RELATIVE_WCF_DIR.$geturl->getURL()); 
    4052                        $size = filesize($link); 
    4153                        $type = 'application/unknown'; 
    4254                        $name = StringUtil::toLowerCase(StringUtil::substring($this->link, StringUtil::lastIndexOf($this->link, '/') + 1)); 
    43                          
     55                        } 
    4456                } else { 
    4557                        $geturl = new downloadDBDataEditor($this->dataID); 
     
    5870                // Start Download 
    5971                @readfile($link); 
    60                 // Anzahl der Downloads erhöhen 
    61                 $sql = "UPDATE wcf".WCF_N."_dldb_data 
    62                                 SET downloads = downloads + 1 
    63                                 WHERE `dataID` = ".$this->dataID; 
    64                 $row = WCF::getDB()->registerShutdownUpdate($sql); 
    65                 // reset cache 
    66                 WCF::getCache()->clear(WCF_DIR.'cache/', 'cache.dldbData.php'); 
    6772        } 
    6873