Technology Temerity

Class – Config

<?php	
	
	/*
	Configuration file. This should be added to all PHP scripts to set up commonly used includes, functions, objects, variables and so on.
	*/
	
	$iReqTime 	= $_SERVER['REQUEST_TIME_FLOAT'];
	$cDocroot 	= NULL; //Document root.	
	$oDB		= NULL;	//Database class object.
	$oErr		= NULL;	//Error class object.
	$oMail		= NULL;	//E-Mail handler class object.
	$oSes		= NULL;	//Session handler class object.
	$oUtl		= NULL;	//Utility class object.
	$oFrm		= NULL;	//Forms class object.
		
	/* Get needed includes. */
	require_once("access.php");		//Account based access.
	require_once("constants.php");	//Global constants.
	require_once("database.php");	//Database handler.
	require_once("forms.php");		//Forms handler.
	require_once("error.php");		//Error handler.
	require_once("mail.php");		//Mail handler.
	require_once("sessions.php");	//Session handler.
	require_once("tables.php");		//Table handler.
	require_once("utility.php");	//Utility functions.	
		
	/* Initialize class objects */
	$oUtl	= new class_utility();														//Utility functions.
	$oMail	= new class_mail();															//E-Mail handler.
	$oErr 	= new class_error(array("Mail" => $oMail, "Utl" => $oUtl));					//Error handler.
	$oDB	= new class_db(array("Utl" => $oUtl, "Err" => $oErr));						//Database handler.
	$oSes	= new class_sessions(array("DB" => $oDB));									//Session handler.	
	$oAcc	= new class_access(array("DB" => $oDB, "Ses" => $oSes, "Utl" => $oUtl));	//Account based access.
	$oTbl 	= new class_tables(array("Utl"=>$oUtl));									//Tables handler.
	$oFrm 	= new class_forms(array("DB"=>$oDB));										//Forms handler.
		
	$cDocroot = $oUtl->utl_get_server_value('DOCUMENT_ROOT')."/";
	
	/* Replace default session handler. */
	session_set_save_handler($oSes, true);
	
	/* If session not started, initialize. */
	if(session_status()==PHP_SESSION_NONE)
	{					
		session_start();
	}
?>

Author: Damon Caskey

Hello all, Damon Caskey here - the esteemed owner of this little slice of cyberspace. Welcome!

Leave a Reply