Changeset 901 for trunk/Modules/File
- Timestamp:
- Feb 17, 2021, 9:27:32 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/File/File.php
r899 r901 20 20 $Desc->AddReference('Directory', FileDirectory::GetClassName(), true); 21 21 $Desc->AddDateTime('Time'); 22 $Desc->AddString('Hash'); 23 $Desc->AddBoolean('Generate'); 22 24 return $Desc; 23 25 } … … 59 61 } 60 62 61 function Download(string $Id): void 62 { 63 $DbResult = $this->Database->select('File', '*', 'Id='.addslashes($Id)); 63 function DownloadHash(string $Hash): void 64 { 65 $this->Download('Hash="'.addslashes($Hash).'"'); 66 } 67 68 function DownloadId(string $Id): void 69 { 70 if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('File', 'DownloadById')) 71 echo('Nemáte oprávnění'); 72 $this->Download('Id='.addslashes($Id)); 73 } 74 75 function Download(string $Where): void 76 { 77 $DbResult = $this->Database->select('File', '*', $Where); 64 78 if ($DbResult->num_rows > 0) 65 79 { … … 105 119 function Show(): string 106 120 { 107 if (array_key_exists('id', $_GET)) $Id = $_GET['id']; 108 else if (array_key_exists('i', $_GET)) $Id = $_GET['i']; 121 if (array_key_exists('h', $_GET)) 122 { 123 $Hash = $_GET['h']; 124 $this->ClearPage = true; 125 ModuleFile::Cast($this->System->GetModule('File'))->File->DownloadHash($Hash); 126 return ''; 127 } 128 else if (array_key_exists('i', $_GET)) 129 { 130 $Id = $_GET['i'] * 1; 131 $this->ClearPage = true; 132 ModuleFile::Cast($this->System->GetModule('File'))->File->DownloadId($Id); 133 } 109 134 else return $this->SystemMessage('Chyba', 'Nezadáno id souboru'); 110 $this->ClearPage = true; 111 $Output = ModuleFile::Cast($this->System->GetModule('File'))->File->Download($Id); 112 return $Output; 135 return ''; 113 136 } 114 137 } … … 208 231 'Size' => array('Type' => 'Integer', 'Caption' => 'Velikost', 'Default' => ''), 209 232 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas vytvoření', 'Default' => ''), 233 'Hash' => array('Type' => 'String', 'Caption' => 'Haš', 'Default' => ''), 210 234 'Invoices' => array('Type' => 'TFinanceInvoiceListFile', 'Caption' => 'Faktury', 'Default' => ''), 211 235 'Operations' => array('Type' => 'TFinanceOperationListFile', 'Caption' => 'Operace', 'Default' => ''),
Note:
See TracChangeset
for help on using the changeset viewer.