Changeset 901 for trunk/Packages/Common


Ignore:
Timestamp:
Feb 17, 2021, 9:27:32 PM (4 years ago)
Author:
chronos
Message:
  • Added: Documents section accessible from users panel.
  • Added: Contract model moved to separate module Contract.
  • Added: New action to generate PDF from Contract.
  • Fixed: Allow users to download files only by hash instead of direct id.
  • Added: Support for SHA1 as allowed mysql function.
Location:
trunk/Packages/Common
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Common.php

    r899 r901  
    2727include_once(dirname(__FILE__).'/BigInt.php');
    2828include_once(dirname(__FILE__).'/Int128.php');
     29include_once(dirname(__FILE__).'/Pdf.php');
    2930include_once(dirname(__FILE__).'/Modules/Setup.php');
    3031include_once(dirname(__FILE__).'/Modules/ModuleManager.php');
  • trunk/Packages/Common/Database.php

    r900 r901  
    4949  {
    5050    $this->Prefix = '';
    51     $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');
     51    $this->Functions = array('NOW(', 'CURDATE(', 'CURTIME(', 'UUID(', 'SHA1(');
    5252    $this->Type = 'mysql';  // mysql, pgsql
    5353    $this->Error = '';
     
    141141  }
    142142
     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
    143149  function GetInsert(string $Table, array $Data): string
    144150  {
     
    148154    {
    149155      $Name .= ',`'.$Key.'`';
    150       if (!in_array($Value, $this->Functions))
     156      if (is_null($Value)) $Value = 'NULL';
     157      else if (!$this->IsFunction($Value))
    151158      {
    152         if (is_null($Value)) $Value = 'NULL';
    153         else $Value = $this->PDO->quote($Value);
     159        $Value = $this->PDO->quote($Value);
    154160      }
    155161      $Values .= ','.$Value;
     
    170176    foreach ($Data as $Key => $Value)
    171177    {
    172       if (!in_array($Value, $this->Functions))
     178      if (is_null($Value)) $Value = 'NULL';
     179      else if (!$this->IsFunction($Value))
    173180      {
    174         if (is_null($Value)) $Value = 'NULL';
    175         else $Value = $this->PDO->quote($Value);
     181        $Value = $this->PDO->quote($Value);
    176182      }
    177183      $Values .= ', `'.$Key.'`='.$Value;
     
    187193    foreach ($Data as $Key => $Value)
    188194    {
    189       if (!in_array($Value, $this->Functions))
     195      if (is_null($Value)) $Value = 'NULL';
     196      else if (!$this->IsFunction($Value))
    190197      {
    191         if (is_null($Value)) $Value = 'NULL';
    192         else $Value = $this->PDO->quote($Value);
     198        $Value = $this->PDO->quote($Value);
    193199      }
    194200      $Name .= ',`'.$Key.'`';
  • trunk/Packages/Common/Modules/Setup.php

    r900 r901  
    194194        {
    195195          $Output .= '<h3>Odinstalace vše</h3>';
    196           $this->System->ModuleManager->UninstallAll(array(ModuleCondition::System));
     196          $this->System->ModuleManager->UninstallAll(array(ModuleCondition::All));
    197197          $this->Database->query('DROP TABLE IF EXISTS `'.$this->UpdateManager->VersionTable.'`');
    198198          $Output .= $this->ControlPanel();
Note: See TracChangeset for help on using the changeset viewer.