Source for file core.class.inc.php

Documentation is available at core.class.inc.php

  1. <?php
  2. /**
  3.  * Core class
  4.  * 
  5.  * Contains everything required to run a db object
  6.  */
  7. class Core {
  8.  
  9.     public $queryTime = 0$executedQueries = 0$dumpSQL = false$queryCode = '';
  10.     public $db;
  11.     public $config;
  12.  
  13.     /**
  14.      * Returns the current micro time
  15.      *
  16.      * @return float 
  17.      */
  18.     function getMicroTime({
  19.         list ($usec$sec)explode(' 'microtime());
  20.         return ((float) $usec + (float) $sec);
  21.     }
  22.  
  23.     /**
  24.      * Exits with error message
  25.      * 
  26.      * @param string $msg Default: unspecified error
  27.      * @param string $query Default: Empty string
  28.      * @param boolean $is_error Default: true
  29.      * @param string $nr Default: Empty string
  30.      * @param string $file Default: Empty string
  31.      * @param string $source Default: Empty string
  32.      * @param string $text Default: Empty string
  33.      * @param string $line Default: Empty string
  34.      * @return void 
  35.      */
  36.     function messageQuit($msg'unspecified error'$query''$is_errortrue$nr''$file''$source''$text''$line''{
  37.         exit("\n\n$msg\n\n$query");
  38.     }
  39.     
  40.     /**
  41.      * Returns the full table name based on db settings
  42.      *
  43.      * @param string $tbl Table name
  44.      * @return string Table name with prefix
  45.      */
  46.     function getFullTableName($tbl{
  47.         return $this->db->config['dbase'".`" $this->db->config['table_prefix'$tbl "`";
  48.     }
  49.  
  50.     /**
  51.      * Get system settings and user settings
  52.      * 
  53.      * @return void 
  54.      */
  55.     function getSettings({
  56.  
  57.         if (!is_array($this->config|| !sizeof($this->config)) {
  58.         
  59.             // System settings
  60.             $rs $this->db->select('setting_name, setting_value'$this->getFullTableName('system_settings'));
  61.             while ($row $this->db->getRow($rs)) {
  62.                 $this->config[$row['setting_name']] $row['setting_value'];
  63.             }
  64.  
  65.         $this->getUserSettings();            
  66.             
  67.         }
  68.     }
  69.     
  70.     /**
  71.      * Get user settings
  72.      *
  73.      * @return void 
  74.      */
  75.     function getUserSettings({
  76.     
  77.         // User settings
  78.         $user_id @$_SESSION['mgrInternalKey']// Bypasses the normal API method. Not ideal, but unlikely to be an issue.
  79.         if ($user_id{
  80.             $rs $this->db->select('setting_name, setting_value'$this->getFullTableName('user_settings')'user='.$user_id);
  81.             while ($row $this->db->getRow($rs)) {
  82.                 $this->config[$row['setting_name']] $row['setting_value'];
  83.             }
  84.         }
  85.     }
  86.  
  87. }

Documentation generated on Fri, 21 Jun 2013 12:37:00 +0100 by phpDocumentor 1.4.4