[phpMP-CVS] CVS: phpMP/includes language.php,1.8,1.9 sessions.php,1.7,1.8 template.php,1.26,1.27 use
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2003-02-08 09:43:32
|
Update of /cvsroot/phpmp/phpMP/includes In directory sc8-pr-cvs1:/tmp/cvs-serv10648/includes Modified Files: language.php sessions.php template.php user.php Log Message: Still correctly the problem with the linebreaks. :-\ Index: language.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/language.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** language.php 7 Feb 2003 23:28:50 -0000 1.8 --- language.php 8 Feb 2003 09:43:29 -0000 1.9 *************** *** 1 **** ! <?php class Language { function Language() { defined("U_LANGUAGE") ? define( "C_LANGUAGE", U_LANGUAGE ) : define( "C_LANGUAGE", C_DEFAULT_LANG ); global $Local; include_once( C_PHPMP_ROOT . 'languages/' . C_LANGUAGE . '/lang_main.php' ); $Local = new Localization(); } } ?> \ No newline at end of file --- 1,20 ---- ! <?php ! ! class Language ! { ! ! function Language() ! { ! ! defined("U_LANGUAGE") ? define( "C_LANGUAGE", U_LANGUAGE ) : define( "C_LANGUAGE", C_DEFAULT_LANG ); ! ! global $Local; ! ! include_once( C_PHPMP_ROOT . 'languages/' . C_LANGUAGE . '/lang_main.php' ); ! $Local = new Localization(); ! ! } ! ! } ! ! ?> \ No newline at end of file Index: sessions.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/sessions.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** sessions.php 4 Feb 2003 21:43:24 -0000 1.7 --- sessions.php 8 Feb 2003 09:43:29 -0000 1.8 *************** *** 1 **** ! <?php // Session Management. // To be developed by Eric. ?> \ No newline at end of file --- 1,6 ---- ! <?php ! ! // Session Management. ! // To be developed by Eric. ! ! ?> \ No newline at end of file Index: template.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/template.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** template.php 7 Feb 2003 23:28:51 -0000 1.26 --- template.php 8 Feb 2003 09:43:29 -0000 1.27 *************** *** 1 **** ! <?php // Contains the Template class. // This will utilize a flat-file template system. class Template extends Smarty { // Assigns template constants. // This function should somehow be integrated into constants.php. // Author: Nrian 'Heimidal' Rose // Accepts: none. // Returns: none. function assignConstants() { $this->assign( array( "C_SITE_ADDR" => SITE_ADDR, "C_SITE_NAME" => SITE_NAME, "C_REL_PATH" => REL_PATH, "C_TIME_NOW" => TIME_NOW, "C_TEMPLATE" => TEMPLATE ) ); } // Assigns template vars through lang files. // Author: Brian 'Heimidal' Rose // Accepts: none. // Returns: none. function assignLangVars() { global $Local; $this->assign( $Local->lang ); } // Initiates the Template engine. // Author: Brian 'Heimidal' Rose // Accepts: none. // Returns: none. function Template() { ( defined( "U_USR_TPL" ) && ( C_OVERRIDE_USR_TPL == 0 ) ) ? define( "C_TEMPLATE", U_TEMPLATE ) : define( "C_TEMPLATE", C_DEFAULT_TPL ); // Set up the directories for Smarty. $this->template_dir = './templates/' . C_TEMPLATE; $this->compile_dir = './templates/' . C_TEMPLATE . '/compile'; $this->config_dir = './templates/' . C_TEMPLATE . '/configs'; $this->cache_dir = ''; // Turn on compile_check. $this->compile_check = 1; // Switch for caching. $this->caching = false; // Caching does not currently work. Maybe later. } } ?> \ No newline at end of file --- 1,67 ---- ! <?php ! ! // Contains the Template class. ! // This will utilize a flat-file template system. ! ! class Template extends Smarty ! { ! ! // Assigns template constants. ! // This function should somehow be integrated into constants.php. ! // Author: Nrian 'Heimidal' Rose ! // Accepts: none. ! // Returns: none. ! function assignConstants() ! { ! ! $this->assign( array( ! ! "C_SITE_ADDR" => SITE_ADDR, ! "C_SITE_NAME" => SITE_NAME, ! "C_REL_PATH" => REL_PATH, ! "C_TIME_NOW" => TIME_NOW, ! "C_TEMPLATE" => TEMPLATE ! ! ) ); ! ! } ! ! // Assigns template vars through lang files. ! // Author: Brian 'Heimidal' Rose ! // Accepts: none. ! // Returns: none. ! function assignLangVars() ! { ! ! global $Local; ! ! $this->assign( $Local->lang ); ! ! } ! ! // Initiates the Template engine. ! // Author: Brian 'Heimidal' Rose ! // Accepts: none. ! // Returns: none. ! function Template() ! { ! ! ( defined( "U_USR_TPL" ) && ( C_OVERRIDE_USR_TPL == 0 ) ) ? define( "C_TEMPLATE", U_TEMPLATE ) : define( "C_TEMPLATE", C_DEFAULT_TPL ); ! ! // Set up the directories for Smarty. ! $this->template_dir = './templates/' . C_TEMPLATE; ! $this->compile_dir = './templates/' . C_TEMPLATE . '/compile'; ! $this->config_dir = './templates/' . C_TEMPLATE . '/configs'; ! $this->cache_dir = ''; ! ! // Turn on compile_check. ! $this->compile_check = 1; ! ! // Switch for caching. ! $this->caching = false; // Caching does not currently work. Maybe later. ! ! } ! ! } ! ! ?> \ No newline at end of file Index: user.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/includes/user.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** user.php 7 Feb 2003 23:28:51 -0000 1.13 --- user.php 8 Feb 2003 09:43:29 -0000 1.14 *************** *** 1 **** ! <?php class User // Creates a barrier between the Auth class and the outside world. // If user doesn't need to be auth'ed, he isn't. { // Fetches user information/variables from the database. // Author: Brian 'Heimidal' Rose // Accepts: $user (integer). // Returns: boolean. function _snapshot( $user ) { global $DB; $sql = "SELECT * FROM " . DB_USERS_TABLE . " WHERE userid=" . $DB->escapeString($user); $qry = $DB->query($sql); if( $DB->numRows( $qry ) < 1 ) { die('User(' . $user . ') not found.'); } else { $user_array = $DB->fetchArray($qry); while( list ($key, $val) = each ($user_array) ) { define( "U_" . strtoupper($key), "$val" ); } return true; } } // Session cleanup routine. // Author: Brian 'Heimidal' Rose // Accepts: none. // Returns: none. function sessionClean() { global $DB; $rand = rand(0,10); if($rand >= 1) // 1:10 chance of session cleanup. This may later become a setting. { $sql = "DELETE FROM " . DB_SESSIONS_TABLE . " WHERE expiry<" . time(); $DB->query($sql); } } // User initialization function. Does -EVERYTHING- except explicit session cleanup. // Author: Brian 'Heimidal' Rose // Accepts: none. // Returns: none. function User() { $this->sessionClean(); // Must decide is this is an anonymous user or a registered user. if( ( C_USE_PORTAL_PERMS == 1 ) || ( defined( P_USE_ADMIN_PERMS ) ) ) // Checks for use_perms setting and makes sure we're not entering the admin area. { // We want to use authentication. global $Auth; include_once( C_PHPMP_ROOT . 'includes/auth.php' ); $Auth = new Auth(); // Initializes Auth, which also authenticates the user. $this->_snapshot( $Auth->curr_user ); // Gets snapshot of user info/vars. } else // We're not going to bother auth'ing the user. { $this->_snapshot('1'); // Gets snapshot of anon user info/vars. } } } ?> \ No newline at end of file --- 1,92 ---- ! <?php ! ! class User // Creates a barrier between the Auth class and the outside world. ! // If user doesn't need to be auth'ed, he isn't. ! { ! ! // Fetches user information/variables from the database. ! // Author: Brian 'Heimidal' Rose ! // Accepts: $user (integer). ! // Returns: boolean. ! function _snapshot( $user ) ! { ! ! global $DB; ! ! $sql = "SELECT * FROM " . DB_USERS_TABLE . " WHERE userid=" . $DB->escapeString($user); ! ! $qry = $DB->query($sql); ! ! if( $DB->numRows( $qry ) < 1 ) { ! ! die('User(' . $user . ') not found.'); ! ! } ! else { ! $user_array = $DB->fetchArray($qry); ! ! while( list ($key, $val) = each ($user_array) ) ! { ! define( "U_" . strtoupper($key), "$val" ); ! } ! ! return true; ! } ! } ! ! // Session cleanup routine. ! // Author: Brian 'Heimidal' Rose ! // Accepts: none. ! // Returns: none. ! function sessionClean() ! { ! ! global $DB; ! ! $rand = rand(0,10); ! if($rand >= 1) // 1:10 chance of session cleanup. This may later become a setting. ! { ! ! $sql = "DELETE FROM " . DB_SESSIONS_TABLE . " WHERE expiry<" . time(); ! $DB->query($sql); ! ! } ! ! } ! ! // User initialization function. Does -EVERYTHING- except explicit session cleanup. ! // Author: Brian 'Heimidal' Rose ! // Accepts: none. ! // Returns: none. ! function User() ! { ! ! $this->sessionClean(); ! ! // Must decide is this is an anonymous user or a registered user. ! ! if( ( C_USE_PORTAL_PERMS == 1 ) || ( defined( P_USE_ADMIN_PERMS ) ) ) // Checks for use_perms setting and makes sure we're not entering the admin area. ! { ! ! // We want to use authentication. ! ! global $Auth; ! ! include_once( C_PHPMP_ROOT . 'includes/auth.php' ); ! $Auth = new Auth(); // Initializes Auth, which also authenticates the user. ! ! $this->_snapshot( $Auth->curr_user ); // Gets snapshot of user info/vars. ! ! } ! else // We're not going to bother auth'ing the user. ! { ! ! $this->_snapshot('1'); // Gets snapshot of anon user info/vars. ! ! } ! ! } ! ! } ! ! ?> \ No newline at end of file |