Changeset 42 for trunk/Base/Database.php


Ignore:
Timestamp:
Nov 24, 2009, 9:13:38 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Přepracován základový webový systém
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Base/Database.php

    r40 r42  
    44// Date: 2009-02-16
    55
    6 
    76class Database extends mysqli
    87{
    98  var $Prefix = '';
    109  var $Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');
     10  var $ShowSQLQuery = false;
     11  var $ShowSQLError = false;
    1112 
    1213  function query($Query)
    13   {
    14     global $Config;
    15  
    16     if($Config['Web']['ShowSQLQuery'] == true)
     14  { 
     15    if($this->ShowSQLQuery)
    1716    {
    1817      if(isset($_SERVER['REMOTE_ADDR'])) echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>');
     
    2019    }
    2120    $Result = parent::query($Query);
    22     if(($this->error != '') and ($Config['Web']['ShowSQLError'] == true))
     21    if(($this->error != '') and ($this->ShowSQLError))
    2322    {
    2423      if(isset($_SERVER['REMOTE_ADDR'])) echo('<div><strong>SQL Error: </strong>'.$this->error.'<br />'.$Query.'</div>');
     
    8786    $this->query('SET NAMES "'.$Charset.'"');
    8887  }
    89  
     88
    9089  function TimeToMysqlDateTime($Time)
    9190  {
    92     return(date('Y-m-d H:i:s', $Time)); 
     91    return(date('Y-m-d H:i:s', $Time));
    9392  }
    9493
     
    9695  {
    9796    $Parts = explode(' ', $Time);
    98     $DateParts = explode('-', $Parts[0]); 
     97    $DateParts = explode('-', $Parts[0]);
    9998    $TimeParts = explode(':', $Parts[1]);
    100     $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 
    101     return($Result); 
     99    $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]);
     100    return($Result);
    102101  }
    103102
    104103  function MysqlDateToTime($Time)
    105104  {
    106     return(MysqlDateTimeToTime($Time.' 0:0:0')); 
    107   } 
     105    return(MysqlDateTimeToTime($Time.' 0:0:0'));
     106  }
    108107}
    109108
Note: See TracChangeset for help on using the changeset viewer.