[phpMP-CVS] CVS: phpMP/includes user.php,NONE,1.1 auth.php,1.22,1.23 core.php,1.31,1.32
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2002-12-02 10:59:53
|
Update of /cvsroot/phpmp/phpMP/includes In directory sc8-pr-cvs1:/tmp/cvs-serv1956/includes Modified Files: auth.php core.php Added Files: user.php Log Message: Made use of files within hierarchy much easier. Separated User and Auth so we aren't forced into loading Auth. Started writing a basic auth system (though the parts written are contained in User). --- NEW FILE: user.php --- <? class User // Creates a barrier between the Auth class and the outside world. // If user doesn't need to be auth'ed, be isn't. { var $array; function snapshot( $user ) { global $DB; $sql = "SELECT * FROM " . USERS_TABLE . " WHERE userid=$user"; $qry = $DB->query($sql); return $DB->fetchArray($qry); } function User() { // Must decide is this is an anonymous user or a registered user. if( USE_PERMS == 1 ) { // We want to use authentication. global $Auth; include_once(PHPMP_ROOT . 'includes/auth.php'); $Auth = new Auth(); $curr_user = $this->lookup(); $this->array = $this->snapshot( $curr_user ); } else // We're not going to bother auth'ing the user. { $this->array = $this->snapshot(1); } } } ?> Index: auth.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/auth.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** auth.php 5 Nov 2002 22:11:06 -0000 1.22 --- auth.php 2 Dec 2002 10:59:50 -0000 1.23 *************** *** 1,6 **** <? ! // Auth and User class/functions. ! // To be developed by Eric. ?> --- 1,14 ---- <? ! class Auth // Authenticates user. Only included if user auth is set to be used. ! { ! ! function Auth() ! { ! ! // Authenticates user and discovers the privileges that user should have. ! // Does nothing in the way of setting up variables and declaring things scripts need to know. ! ! } ?> Index: core.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/core.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** core.php 1 Dec 2002 21:49:11 -0000 1.31 --- core.php 2 Dec 2002 10:59:50 -0000 1.32 *************** *** 40,49 **** include_once('./config.php'); ! //include_once('./includes/debug.php'); //$Debug = new Debug(); global $DB; ! include( './dba/' . DB_TYPE . '.dba' ); $DB = new DB(); $DB->connect(); --- 40,49 ---- include_once('./config.php'); ! //include_once(PHPMP_ROOT . 'includes/debug.php'); //$Debug = new Debug(); global $DB; ! include( PHPMP_ROOT . 'dba/' . DB_TYPE . '.dba' ); $DB = new DB(); $DB->connect(); *************** *** 51,64 **** $this->_initConfig(); // Grab DB-stored config values. ! include_once('./includes/auth.php'); ! //$Auth = new Auth(); // Create an instance of Auth. ! include_once('./includes/language.php'); ! include_once('./includes/constants.php'); ! include_once('./includes/functions.php'); ! include_once('./includes/mpcode.php'); // This while() statement will loop through the --- 51,64 ---- $this->_initConfig(); // Grab DB-stored config values. ! include_once(PHPMP_ROOT . 'includes/user.php'); ! $User = new User(); // Create an instance of User. ! include_once(PHPMP_ROOT . 'includes/language.php'); ! include_once(PHPMP_ROOT . 'includes/constants.php'); ! include_once(PHPMP_ROOT . 'includes/functions.php'); ! include_once(PHPMP_ROOT . 'includes/mpcode.php'); // This while() statement will loop through the *************** *** 71,85 **** // including a file more than once (through // malicious or accidental coding of a page). ! include_once('./includes/' . $my_file . '.php'); $i++; } ! include_once('./includes/Smarty.class.php'); ! include_once('./includes/template.php'); $Template = new Template(); // Create an instance of Template. // Globalize all major class-containing variables. ! global $Debug, $Auth, $Language, $Parser, $Template; } --- 71,85 ---- // including a file more than once (through // malicious or accidental coding of a page). ! include_once(PHPMP_ROOT . 'includes/' . $my_file . '.php'); $i++; } ! include_once(PHPMP_ROOT . 'includes/Smarty.class.php'); ! include_once(PHPMP_ROOT . 'includes/template.php'); $Template = new Template(); // Create an instance of Template. // Globalize all major class-containing variables. ! global $Debug, $User, $Language, $Parser, $Template; } |