Changeset 690 for trunk/Modules/File
- Timestamp:
- Sep 7, 2014, 6:59:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/File/File.php
r638 r690 6 6 { 7 7 var $FilesDir; 8 9 function __construct($System) 8 9 function __construct($System) 10 10 { 11 11 parent::__construct($System); 12 12 $this->FilesDir = ''; 13 13 } 14 14 15 15 function Delete($Id) 16 16 { … … 18 18 if($DbResult->num_rows > 0) 19 19 { 20 $DbRow = $DbResult->fetch_assoc(); 20 $DbRow = $DbResult->fetch_assoc(); 21 21 $this->Database->delete('File', 'Id='.$Id); 22 22 unlink($this->FilesDir.'/'.$Id.'_'.$DbRow['Name']); 23 23 } 24 24 } 25 25 26 26 function CreateFromUpload($Name) 27 27 { … … 40 40 return($Result); 41 41 } 42 42 43 43 function DetectMimeType($FileName) 44 44 { 45 45 global $MimeTypes; 46 46 47 47 $Result = $MimeTypes[pathinfo($FileName, PATHINFO_EXTENSION)][0]; 48 48 return($Result); … … 61 61 { 62 62 Header('Content-Type: '.$this->DetectMimeType($FileName)); 63 Header('Content-Disposition: attachment; filename="'.$DbRow['Name'].'"');63 Header('Content-Disposition: inline; filename="'.$DbRow['Name'].'"'); 64 64 echo(file_get_contents($FileName)); 65 65 } else echo('Soubor nenalezen!'); 66 66 } else echo('Soubor nenalezen!'); 67 67 } 68 68 69 69 function GetDir($Id) 70 70 { … … 103 103 $this->Description = 'Base module for file management'; 104 104 $this->Dependencies = array(); 105 } 105 } 106 106 107 107 function DoInstall() 108 108 { 109 109 } 110 110 111 111 function DoUninstall() 112 { 112 { 113 113 } 114 114 115 115 function DoStart() 116 116 { 117 117 global $Config; 118 118 119 119 $this->System->RegisterPage('file', 'PageFile'); 120 120 $this->System->AddModule(new File($this->System)); … … 141 141 ), 142 142 )); 143 144 } 145 143 144 } 145 146 146 function DoStop() 147 { 148 } 147 { 148 } 149 149 }
Note:
See TracChangeset
for help on using the changeset viewer.