Changeset 415
- Timestamp:
- 04/07/08 23:41:21 (5 years ago)
- Location:
- downloadDatabase/files/lib
- Files:
-
- 3 modified
-
acp/form/DownloadDBDataAddForm.class.php (modified) (3 diffs)
-
acp/form/DownloadDBDataEditForm.class.php (modified) (3 diffs)
-
page/DownloadDBFileDownloadPage.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
downloadDatabase/files/lib/acp/form/DownloadDBDataAddForm.class.php
r407 r415 91 91 throw new UserInputException('link', 'empty'); 92 92 } 93 // prÃŒfen ob ein Link UND File angegeben wurden 93 if (!$this->mimeType) { 94 // prÃŒfen ob ein relativer Pfad vorliegt und die Datei existiert 95 if (FileUtil::isURL($this->link) == false) { 96 if (@fopen($this->link,'rb') == false) { 97 throw new UserInputException('link', 'badFile'); 98 } 99 } 100 } 101 94 102 if ($this->action == 'add') { 103 // prÃŒfen ob ein Link UND File angegeben wurden 95 104 if ($this->link && ($this->upload && $this->upload['error'] != 4)) { 96 105 throw new UserInputException('link', 'invalid'); … … 117 126 } else { 118 127 throw new UserInputException('upload'); 128 } 129 } else { 130 if (FileUtil::isURL($this->link) == false) { 131 if (StringUtil::indexOf($this->link, '/') !== false) { 132 $this->fileName = StringUtil::substring($this->link, StringUtil::lastIndexOf($this->link, '/') + 1); 133 } 134 if (StringUtil::indexOf($this->fileName, '.') !== false) { 135 $this->fileExtension = StringUtil::toLowerCase(StringUtil::substring($this->fileName, StringUtil::lastIndexOf($this->fileName, '.') + 1)); 136 } 137 $this->groesse = filesize($this->link); 119 138 } 120 139 } … … 169 188 $dataset = DownloadDBDataEditor::createDataset(intval($this->katID), $this->name, $this->description ,array( 170 189 'link' => StringUtil::encodeHTML($this->link), 190 'fileName' => escapeString($this->fileName), 191 'fileExtension' => escapeString($this->fileExtension), 171 192 'groesse' => intval($this->groesse), 172 193 'downloads' => intval($this->downloads), -
downloadDatabase/files/lib/acp/form/DownloadDBDataEditForm.class.php
r407 r415 107 107 } 108 108 // neuen File anlegen 109 $this->previewIMG = DownloadDBDataEditor::createPreview($dataset->dataID, $this->previewArray['tmp_name'], $this->previewArray['name'], $this->previewArray['type'], 'previewIMG');110 109 $this->previewFile = $this->previewArray['name']; 111 } 112 // Bei neuem Upload den alten file lschen und den neuen anlegen 110 $this->previewIMG = DownloadDBDataEditor::createPreview($this->previewArray['tmp_name'], $this->previewArray['name'], $this->previewArray['type'], 'previewIMG'); 111 } 112 // Bei neuem Upload den alten file löschen und den neuen anlegen 113 113 if ($this->upload && $this->upload['error'] != 4) { 114 114 // auf Fehler beim Upload prfen … … 117 117 } 118 118 // alten File löschen und neuen anlegen 119 DownloadDBDataEditor::updateFile($ dataset->dataID, $this->fileNameAlt, $this->upload['tmp_name'], $this->upload['name'], $this->upload['type'], 'upload');119 DownloadDBDataEditor::updateFile($this->fileNameAlt, $this->upload['tmp_name'], $this->upload['name'], $this->upload['type'], 'upload'); 120 120 //Variablen anpassen 121 121 $this->fileName = $this->upload['name']; … … 126 126 } 127 127 $this->link = FileUtil::addTrailingSlash(PAGE_URL).FileUtil::getRealPath('wcf/'.RELATIVE_WCF_DIR.DOWNLOADDB_FILE_DIR.intval($dataset->dataID).'_'.StringUtil::encodeHTML($this->fileName)); 128 } 129 if (!$this->upload && (FileUtil::isURL($this->link) == false)) { 130 if (StringUtil::indexOf($this->link, '/') !== false) { 131 $this->fileName = StringUtil::substring($this->link, StringUtil::lastIndexOf($this->link, '/') + 1); 132 } 133 if (StringUtil::indexOf($this->fileName, '.') !== false) { 134 $this->fileExtension = StringUtil::toLowerCase(StringUtil::substring($this->fileName, StringUtil::lastIndexOf($this->fileName, '.') + 1)); 135 } 136 $this->groesse = filesize($this->link); 137 128 138 } 129 139 // Daten endgltig speichern -
downloadDatabase/files/lib/page/DownloadDBFileDownloadPage.class.php
r407 r415 43 43 // reset cache 44 44 WCF::getCache()->clear(WCF_DIR.'cache/', 'cache.dldbData.php'); 45 if (!$this->file Name) {45 if (!$this->fileType) { 46 46 if (FileUtil::isURL($this->link)) { 47 47 HeaderUtil::redirect($this->link,false); 48 48 exit; 49 49 } else { 50 $geturl = new downloadDBDataEditor($this->dataID); 51 $link = FileUtil::getRealPath(RELATIVE_WCF_DIR.$geturl->getURL()); 52 $size = filesize($link); 53 $type = 'application/unknown'; 54 $name = StringUtil::toLowerCase(StringUtil::substring($this->link, StringUtil::lastIndexOf($this->link, '/') + 1)); 50 $link = FileUtil::getRealPath(RELATIVE_WCF_DIR.$this->link); 51 $type = 'application/unknown'; 55 52 } 56 53 } else { 57 $geturl = new downloadDBDataEditor($this->dataID); 58 $link = FileUtil::getRealPath(RELATIVE_WCF_DIR.$geturl->getURL()); 59 $size = filesize($link); 54 $dataset = new downloadDBDataEditor($this->dataID); 55 $link = FileUtil::getRealPath(RELATIVE_WCF_DIR.$dataset->getURL()); 60 56 $type = $this->fileType; 61 $name = $this->fileName;62 57 } 63 58 // Set Download Infos 64 59 @ header('Content-Description: File Transfer'); 65 60 @ header('Content-Type: '. $type); 66 @ header('Content-disposition: attachment; filename="' . $ name . '"');67 @ header('Content-Length: ' . $size);61 @ header('Content-disposition: attachment; filename="' . $this->fileName . '"'); 62 @ header('Content-Length: ' . filesize($link)); 68 63 @ header('Pragma: no-cache'); 69 64 @ header('Expires: 0');
