Esempio n. 1
0
	function __construct ($debug_level=0) {
		$php_errormsg = '';
		if ($debug_level) $this->debug_level = $debug_level;
		if ($this->debug_level>0) printf("\nDEBUG_LEVEL: %s <br>\n",$this->debug_level);
		$this->exceptions();
		$this->sys_log();

		//local function variables
		$congif_simple_xml = simplexml_load_file(CONFIG_XML_FILE);	//container for xml object tree

		if ($congif_simple_xml === FALSE) {
			sys_log::create_log("Error while parsing XML configuration document for database connection",ADMIN_EMAIL);
			$status["location"] = "db_connection";
			$status["exception_type"] = "fail at constructor";
			$status["error"] = $php_errormsg;
			exceptions::halt($status);
		}

		// extract information for DB connection
		$this->username = $congif_simple_xml->DatabaseAccount->username;
		$this->password = $congif_simple_xml->DatabaseAccount->password;
		$this->host = $congif_simple_xml->DatabaseAccount->host;
		$this->port = $congif_simple_xml->DatabaseAccount->port;
		$this->database = $congif_simple_xml->DatabaseAccount->database;
		$this->client_flags = $congif_simple_xml->DatabaseAccount->client_flags;
		$this->new_connection = $congif_simple_xml->DatabaseAccount->new_connection;
		$this->tty = $congif_simple_xml->DatabaseAccount->tty;
		$this->security_level = $congif_simple_xml->DatabaseAccount->security_level;

		// establish connection
		$this->connect ();

		register_shutdown_function(array(&$this, 'close'));
	}
Esempio n. 2
0
 function log ($email=null) {
   return sys_log::create_log($this->create_log_entry(),$email);
 }