<?php

include_once('Database.php');

class Module
{
  var $Database;
  var $Config;
  var $System;
  
  function __construct($System)
  {
    $this->Database = &$System->Database;
    $this->Config = &$System->Config;
    $this->System = &$System;
  }
}

class System 
{
  var $Database;
  var $Config;
  
  function __construct()
  {
    $this->Database = new Database();
    $this->Config = array();
  }
  
  function Init()
  {
    include('config.php');
    $this->Config = $Config;
    $this->Database->HostName = $this->Config['Database']['Host'];
    $this->Database->UserName = $this->Config['Database']['User'];
    $this->Database->Password = $this->Config['Database']['Password'];
    $this->Database->Schema = $this->Config['Database']['Database'];
    $this->Database->Charset = $this->Config['Database']['Charset'];
    $this->Database->ShowSQLQuery = $this->Config['Web']['ShowSQLQuery'];
    $this->Database->ShowSQLError = $this->Config['Web']['ShowSQLError'];
    $this->Database->open();
  }
  
  function GetMicrotime()
  {
    list($Usec, $Sec) = explode(' ', microtime());
    return ((float)$Usec + (float)$Sec);
  }
  
  function Link($Target)
  {
    global $Config;
    
    return($Config['Web']['BaseURL'].$Target);
  } 
} 

?>
