[phpMP-CVS] CVS: phpMP/includes core.php,1.24,1.25
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2002-11-06 00:31:43
|
Update of /cvsroot/phpmp/phpMP/includes In directory usw-pr-cvs1:/tmp/cvs-serv13734 Modified Files: core.php Log Message: I went on a commenting frenzy. Sue me. Index: core.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/core.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** core.php 5 Nov 2002 22:34:24 -0000 1.24 --- core.php 6 Nov 2002 00:31:40 -0000 1.25 *************** *** 30,49 **** function init ( $optional_files = array() ) { - - $required_array[] = 'debug'; - $required_array[] = 'constants'; - $required_array[] = 'dba'; - $required_array[] = 'functions'; - $required_array[] = 'auth'; - $required_array[] = 'parser'; - $required_array[] = 'Smarty.class'; - $required_array[] = 'template'; ! $required_array = array_merge_recursive( $required_array, $optional_files ); $i = 0; ! while( $my_file = $required_array[$i] ) { include_once('./includes/' . $my_file . '.php'); $i++; --- 30,60 ---- function init ( $optional_files = array() ) { ! ## First, we'll create an array of files that must ! ## be loaded for any instance of the portal. We'll ! ## call this array '$required_files'. ! $required_files[] = 'debug'; ! $required_files[] = 'constants'; ! $required_files[] = 'dba'; ! $required_files[] = 'functions'; ! $required_files[] = 'auth'; ! $required_files[] = 'parser'; ! $required_files[] = 'Smarty.class'; ! $required_files[] = 'template'; ! ! ## Next, we'll merge the $required_files array with ! ## the $optional_files array, allowing us to include ! ## all files that may be needed. ! $file_array = array_merge_recursive( $required_array, $optional_files ); + ## This while() statement will loop through the + ## $file_array and include each file. $i = 0; ! while( $my_file = $file_array[$i] ) { + ## We'll use include_once() in order to keep from + ## including a file more than once (through + ## malicious or accidental coding of a page). */ include_once('./includes/' . $my_file . '.php'); $i++; *************** *** 51,77 **** } ! global $Debug, $DB, $Auth, $Parser, $Template, $Language; $Debug = new Debug(); ! $DB = new DBA(); ! $DBA->connect; ! $this->_initConfig(); } } - // Main Class - // -- Init Function - // -- -- Debug - // -- -- Globals - // -- -- Require Files - // -- -- Load Constants - // -- -- Initiate DBA - // -- -- Load DB-based Config - // -- -- Load Language Files - // -- -- Authenticate User - // -- -- Initiate Template Engine ?> --- 62,90 ---- } ! ## Globalize all major class-containing variables. ! global $Debug, $DB, $Auth, $Language, $Parser, $Template; + ## Create an instance of the Debug interface. $Debug = new Debug(); ! ## We should add initialization function calls later ! ## when they're written. ! ! $DB = new DBA(); ## Create an instance of DBA. ! $DBA->connect; ## Connect to the specified SQL system. ! ! $this->_initConfig(); ## Grab DB-stored config values. ! ! $Auth = new Auth(); ## Create an instance of Auth. ! ! $Language = new Language(); ## Create an instance of Language. ! ! $Parser = new Parser(); ## Create an instance of Parser. ! $Template = new Template(); ## Create an instance of Template. } } ?> |