Changeset 901 for trunk/Packages/Common
- Timestamp:
 - Feb 17, 2021, 9:27:32 PM (5 years ago)
 - Location:
 - trunk/Packages/Common
 - Files:
 - 
      
- 1 added
 - 3 edited
 
- 
          
  Common.php (modified) (1 diff)
 - 
          
  Database.php (modified) (5 diffs)
 - 
          
  Modules/Setup.php (modified) (1 diff)
 - 
          
  Pdf.php (added)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/Packages/Common/Common.php
r899 r901 27 27 include_once(dirname(__FILE__).'/BigInt.php'); 28 28 include_once(dirname(__FILE__).'/Int128.php'); 29 include_once(dirname(__FILE__).'/Pdf.php'); 29 30 include_once(dirname(__FILE__).'/Modules/Setup.php'); 30 31 include_once(dirname(__FILE__).'/Modules/ModuleManager.php');  - 
      
trunk/Packages/Common/Database.php
r900 r901 49 49 { 50 50 $this->Prefix = ''; 51 $this->Functions = array('NOW( )', 'CURDATE()', 'CURTIME()', 'UUID()');51 $this->Functions = array('NOW(', 'CURDATE(', 'CURTIME(', 'UUID(', 'SHA1('); 52 52 $this->Type = 'mysql'; // mysql, pgsql 53 53 $this->Error = ''; … … 141 141 } 142 142 143 function IsFunction(string $Text): bool 144 { 145 $Pos = strpos($Text, '('); 146 return ($Pos !== false) && in_array(substr($Text, 0, $Pos + 1), $this->Functions); 147 } 148 143 149 function GetInsert(string $Table, array $Data): string 144 150 { … … 148 154 { 149 155 $Name .= ',`'.$Key.'`'; 150 if (!in_array($Value, $this->Functions)) 156 if (is_null($Value)) $Value = 'NULL'; 157 else if (!$this->IsFunction($Value)) 151 158 { 152 if (is_null($Value)) $Value = 'NULL'; 153 else $Value = $this->PDO->quote($Value); 159 $Value = $this->PDO->quote($Value); 154 160 } 155 161 $Values .= ','.$Value; … … 170 176 foreach ($Data as $Key => $Value) 171 177 { 172 if (!in_array($Value, $this->Functions)) 178 if (is_null($Value)) $Value = 'NULL'; 179 else if (!$this->IsFunction($Value)) 173 180 { 174 if (is_null($Value)) $Value = 'NULL'; 175 else $Value = $this->PDO->quote($Value); 181 $Value = $this->PDO->quote($Value); 176 182 } 177 183 $Values .= ', `'.$Key.'`='.$Value; … … 187 193 foreach ($Data as $Key => $Value) 188 194 { 189 if (!in_array($Value, $this->Functions)) 195 if (is_null($Value)) $Value = 'NULL'; 196 else if (!$this->IsFunction($Value)) 190 197 { 191 if (is_null($Value)) $Value = 'NULL'; 192 else $Value = $this->PDO->quote($Value); 198 $Value = $this->PDO->quote($Value); 193 199 } 194 200 $Name .= ',`'.$Key.'`';  - 
      
trunk/Packages/Common/Modules/Setup.php
r900 r901 194 194 { 195 195 $Output .= '<h3>Odinstalace vše</h3>'; 196 $this->System->ModuleManager->UninstallAll(array(ModuleCondition:: System));196 $this->System->ModuleManager->UninstallAll(array(ModuleCondition::All)); 197 197 $this->Database->query('DROP TABLE IF EXISTS `'.$this->UpdateManager->VersionTable.'`'); 198 198 $Output .= $this->ControlPanel();  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  