[phpMP-CVS] CVS: phpMP/core functions.php,1.3,1.4 main.php,1.4,1.5 session.php,1.3,1.4 template.php,
Status: Pre-Alpha
Brought to you by:
heimidal
|
From: Brian R. <hei...@us...> - 2003-09-14 21:55:56
|
Update of /cvsroot/phpmp/phpMP/core
In directory sc8-pr-cvs1:/tmp/cvs-serv4582/core
Modified Files:
functions.php main.php session.php template.php user.php
Removed Files:
language.php
Log Message:
Moved the lang array to $User. No need for a class with only one function.
Index: functions.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/functions.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** functions.php 14 Sep 2003 09:24:25 -0000 1.3
--- functions.php 14 Sep 2003 21:55:51 -0000 1.4
***************
*** 24,29 ****
/**
! * @return void
! * @desc Creates vars with no other place. Temporary.
*/
function create_vars()
--- 24,29 ----
/**
! * @return void
! * @desc Creates vars with no other place. Temporary.
*/
function create_vars()
***************
*** 31,36 ****
global $Portal, $User;
! ( $User->get('date_format') != '' ) ? ($Portal->set('date_format', $User->get('date_format'))) : ($Portal->set('date_format', $Portal->get('default_date_format')));
! $Portal->set('time_now', date( $Portal->get('date_format') ) ); // This is here...for now.
}
--- 31,36 ----
global $Portal, $User;
! ( $User->get('date_format') != '' ) ? ($Portal->cfg_set('date_format', $User->get('date_format'))) : ($Portal->cfg_set('date_format', $Portal->cfg_get('default_date_format')));
! $Portal->cfg_set('time_now', date( $Portal->cfg_get('date_format') ) ); // This is here...for now.
}
Index: main.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/main.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** main.php 14 Sep 2003 21:35:19 -0000 1.4
--- main.php 14 Sep 2003 21:55:51 -0000 1.5
***************
*** 72,76 ****
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
! $blah = include_once( C_PHPMP_ROOT . 'config.php' );
// Globalize all major class-containing variables.
--- 72,76 ----
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
! include_once( C_PHPMP_ROOT . 'config.php' );
// Globalize all major class-containing variables.
***************
*** 108,114 ****
$Session->start();
$Session->run();
!
! include_once(C_PHPMP_ROOT . CORE_DIR . 'language.php');
! $Language = new Language();
include_once(C_PHPMP_ROOT . CORE_DIR . 'mpcode.php');
--- 108,127 ----
$Session->start();
$Session->run();
!
! $cfg_lang = $this->cfg_get('default_lang');
! $usr_lang = $User->get('language');
! $lang = '';
!
! (empty($usr_lang)) ? $lang = $cfg_lang : $lang = $usr_lang;
!
! $this->cfg_set('language', $lang);
! $lang_file = C_PHPMP_ROOT . LANGUAGE_DIR . $lang . '/lang_main.php';
!
! if (!file_exists($lang_file))
! {
! trigger_error("localization error - \"$lang_file\" does not exist.", E_USER_ERROR);
! }
!
! include_once($lang_file);
include_once(C_PHPMP_ROOT . CORE_DIR . 'mpcode.php');
Index: session.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/session.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** session.php 14 Sep 2003 09:24:25 -0000 1.3
--- session.php 14 Sep 2003 21:55:51 -0000 1.4
***************
*** 36,42 ****
var $page;
! /**
! * @return void
! * @desc Starts a session. Must be called implicitly.
*/
function start()
--- 36,42 ----
var $page;
! /**
! * @return void
! * @desc Starts a session. Must be called implicitly.
*/
function start()
***************
*** 51,57 ****
}
! /**
! * @return void
! * @desc Destroys sessions. Used for logging out.
*/
function destroy()
--- 51,57 ----
}
! /**
! * @return void
! * @desc Destroys sessions. Used for logging out.
*/
function destroy()
***************
*** 59,63 ****
global $DB, $Portal, $SID;
! $exp_time = time() + $Portal->get('session_length');
$this->page = basename($_SERVER['REQUEST_URI']);
--- 59,63 ----
global $DB, $Portal, $SID;
! $exp_time = time() + $Portal->cfg_get('session_length');
$this->page = basename($_SERVER['REQUEST_URI']);
***************
*** 74,86 ****
$this->session_user_id = ANONYMOUS;
! setcookie($Portal->get('cookie_name') . '_auto', '', time() - 31536000, $Portal->get('cookie_path'), $Portal->get('cookie_domain'), $Portal->get('cookie_secure'));
$cookie_data = urlencode( ANONYMOUS . ':' . $this->session_key );
! (setcookie($Portal->get('cookie_name') . '_data', $cookie_data, $cur_time + $Portal->get('session_length'), $Portal->get('cookie_path'), $Portal->get('cookie_domain'), $Portal->get('cookie_secure'))) ? ($SID = "?sid=") : ($SID = "?sid=" . $this->session_key);
}
! /**
! * @return void
! * @desc Logs a user in.
*/
function login()
--- 74,86 ----
$this->session_user_id = ANONYMOUS;
! setcookie($Portal->cfg_get('cookie_name') . '_auto', '', time() - 31536000, $Portal->cfg_get('cookie_path'), $Portal->cfg_get('cookie_domain'), $Portal->cfg_get('cookie_secure'));
$cookie_data = urlencode( ANONYMOUS . ':' . $this->session_key );
! (setcookie($Portal->cfg_get('cookie_name') . '_data', $cookie_data, $cur_time + $Portal->cfg_get('session_length'), $Portal->cfg_get('cookie_path'), $Portal->cfg_get('cookie_domain'), $Portal->cfg_get('cookie_secure'))) ? ($SID = "?sid=") : ($SID = "?sid=" . $this->session_key);
}
! /**
! * @return void
! * @desc Logs a user in.
*/
function login()
***************
*** 116,120 ****
{
$auto_cookie_data = urlencode( $this->session_user_id . ':' . $passwd_enc . ':' . $User->get('invisible_mode') );
! setcookie($Portal->get('cookie_name') . '_auto', $auto_cookie_data, time() + 31536000, $Portal->get('cookie_path'), $Portal->get('cookie_domain'), $Portal->get('cookie_secure'));
}
}
--- 116,120 ----
{
$auto_cookie_data = urlencode( $this->session_user_id . ':' . $passwd_enc . ':' . $User->get('invisible_mode') );
! setcookie($Portal->cfg_get('cookie_name') . '_auto', $auto_cookie_data, time() + 31536000, $Portal->cfg_get('cookie_path'), $Portal->cfg_get('cookie_domain'), $Portal->cfg_get('cookie_secure'));
}
}
***************
*** 125,131 ****
}
! /**
! * @return void
! * @desc Saves the session data to the database.
*/
function run()
--- 125,131 ----
}
! /**
! * @return void
! * @desc Saves the session data to the database.
*/
function run()
***************
*** 149,153 ****
$cur_time = time(); // Time as of right now.
! $exp_time = $cur_time + $Portal->get('session_length'); // Time at which this session will become invalid.
$this->ip = $User->get_ip_encoded(); // Gets the user's IP address.
--- 149,153 ----
$cur_time = time(); // Time as of right now.
! $exp_time = $cur_time + $Portal->cfg_get('session_length'); // Time at which this session will become invalid.
$this->ip = $User->get_ip_encoded(); // Gets the user's IP address.
***************
*** 219,230 ****
$cookie_data = urlencode( $this->session_user_id . ':' . $this->session_key );
! (setcookie($Portal->get('cookie_name') . '_data', $cookie_data, $cur_time + $Portal->get('session_length'), $Portal->get('cookie_path'), $Portal->get('cookie_domain'), $Portal->get('cookie_secure'))) ? ($SID = "?sid=") : ($SID = "?sid=" . $this->session_key);
$this->clean();
}
! /**
* @return void
! * @param clean_all boolean
! * @desc Cleans out old session data.
*/
function clean($clean_all = false)
--- 219,230 ----
$cookie_data = urlencode( $this->session_user_id . ':' . $this->session_key );
! (setcookie($Portal->cfg_get('cookie_name') . '_data', $cookie_data, $cur_time + $Portal->cfg_get('session_length'), $Portal->cfg_get('cookie_path'), $Portal->cfg_get('cookie_domain'), $Portal->cfg_get('cookie_secure'))) ? ($SID = "?sid=") : ($SID = "?sid=" . $this->session_key);
$this->clean();
}
! /**
* @return void
! * @param clean_all boolean
! * @desc Cleans out old session data.
*/
function clean($clean_all = false)
***************
*** 248,254 ****
}
! /**
! * @return void
! * @desc Grabs session data for the user.
*/
function get_session_data()
--- 248,254 ----
}
! /**
! * @return void
! * @desc Grabs session data for the user.
*/
function get_session_data()
***************
*** 257,263 ****
// Let's see if we have a standard cookie available.
! if(!empty($_COOKIE[$Portal->get('cookie_name') . '_data']))
{
! $cookie_data = $_COOKIE[$Portal->get('cookie_name') . '_data'];
$cookie_array = explode(':', urldecode( $cookie_data ) );
--- 257,263 ----
// Let's see if we have a standard cookie available.
! if(!empty($_COOKIE[$Portal->cfg_get('cookie_name') . '_data']))
{
! $cookie_data = $_COOKIE[$Portal->cfg_get('cookie_name') . '_data'];
$cookie_array = explode(':', urldecode( $cookie_data ) );
***************
*** 284,290 ****
if( ($this->session_user_id == ANONYMOUS) || empty($this->session_user_id) )
{
! if( !empty( $_COOKIE[$Portal->get('cookie_name') . '_auto'] ) ) // We have an autologin cookie set.
{
! $auto_cookie_data = $_COOKIE[$Portal->get('cookie_name') . '_auto'];
$auto_cookie_array = explode(':', urldecode( $auto_cookie_data ) );
--- 284,290 ----
if( ($this->session_user_id == ANONYMOUS) || empty($this->session_user_id) )
{
! if( !empty( $_COOKIE[$Portal->cfg_get('cookie_name') . '_auto'] ) ) // We have an autologin cookie set.
{
! $auto_cookie_data = $_COOKIE[$Portal->cfg_get('cookie_name') . '_auto'];
$auto_cookie_array = explode(':', urldecode( $auto_cookie_data ) );
***************
*** 306,310 ****
{
// We'll unset the cookie and continue on like nothing ever happened.
! setcookie($Portal->get('cookie_name') . '_auto', '', time() - 31536000, $Portal->get('cookie_path'), $Portal->get('cookie_domain'), $Portal->get('cookie_secure'));
return false;
$this->session_user_id = ANONYMOUS;
--- 306,310 ----
{
// We'll unset the cookie and continue on like nothing ever happened.
! setcookie($Portal->cfg_get('cookie_name') . '_auto', '', time() - 31536000, $Portal->cfg_get('cookie_path'), $Portal->cfg_get('cookie_domain'), $Portal->cfg_get('cookie_secure'));
return false;
$this->session_user_id = ANONYMOUS;
Index: template.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/template.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** template.php 14 Sep 2003 09:24:25 -0000 1.3
--- template.php 14 Sep 2003 21:55:51 -0000 1.4
***************
*** 119,123 ****
function display($handle)
{
! global $Portal, $Local;
if ($filename = $this->_tpl_load($handle))
--- 119,123 ----
function display($handle)
{
! global $Portal;
if ($filename = $this->_tpl_load($handle))
***************
*** 138,142 ****
global $Portal, $user;
! $filename = $this->cachedir . $this->filename[$handle] . '.' . (($this->static_lang) ? $Portal->get('language') . '.' : '') . 'php';
// Recompile page if the original template is newer, otherwise load the compiled version
--- 138,142 ----
global $Portal, $user;
! $filename = $this->cachedir . $this->filename[$handle] . '.' . (($this->static_lang) ? $Portal->cfg_get('language') . '.' : '') . 'php';
// Recompile page if the original template is newer, otherwise load the compiled version
***************
*** 231,235 ****
function _tpl_include($filename, $include = true)
{
! global $user, $Portal, $Local;
$handle = $filename;
--- 231,235 ----
function _tpl_include($filename, $include = true)
{
! global $user, $Portal;
$handle = $filename;
***************
*** 334,338 ****
case 'INCLUDEPHP':
! if ($Portal->get('tpl_php'))
{
$temp = '';
--- 334,338 ----
case 'INCLUDEPHP':
! if ($Portal->cfg_get('tpl_php'))
{
$temp = '';
***************
*** 343,347 ****
case 'PHP':
! if ($Portal->get('tpl_php'))
{
$temp = '';
--- 343,347 ----
case 'PHP':
! if ($Portal->cfg_get('tpl_php'))
{
$temp = '';
***************
*** 395,406 ****
if (!$this->static_lang)
{
! global $Local;
! $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*?)\}#is', "<?php echo ((isset(\$this->_tpldata['.'][0]['L_\\1'])) ? \$this->_tpldata['.'][0]['L_\\1'] : ((isset(\$Local->lang['\\1'])) ? \$Local->lang['\\1'] : '{ ' . ucfirst(strtolower(str_replace('_', ' ', '\\1'))) . ' }')); ?>", $text_blocks);
}
else
{
! global $Local;
! $text_blocks = preg_replace('#\{L_([A-Z0-9\-_]*?)\}#e', "'<?php echo ((isset(\$this->_tpldata[\'.\'][0][\'L_\\1\'])) ? \$this->_tpldata[\'.\'][0][\'L_\\1\'] : \'' . ((isset(\$Local->lang['\\1'])) ? \$Local->lang['\\1'] : '') . '\'); ?>'" , $text_blocks);
}
$text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "<?php echo \$this->_tpldata['.'][0]['\\1']; ?>", $text_blocks);
--- 395,406 ----
if (!$this->static_lang)
{
! global $User;
! $text_blocks = preg_replace('#\{L_([a-z0-9\-_]*?)\}#is', "<?php echo ((isset(\$this->_tpldata['.'][0]['L_\\1'])) ? \$this->_tpldata['.'][0]['L_\\1'] : ((isset(\$User->lang['\\1'])) ? \$User->lang['\\1'] : '{ ' . ucfirst(strtolower(str_replace('_', ' ', '\\1'))) . ' }')); ?>", $text_blocks);
}
else
{
! global $User;
! $text_blocks = preg_replace('#\{L_([A-Z0-9\-_]*?)\}#e', "'<?php echo ((isset(\$this->_tpldata[\'.\'][0][\'L_\\1\'])) ? \$this->_tpldata[\'.\'][0][\'L_\\1\'] : \'' . ((isset(\$User->lang['\\1'])) ? \$User->lang['\\1'] : '') . '\'); ?>'" , $text_blocks);
}
$text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "<?php echo \$this->_tpldata['.'][0]['\\1']; ?>", $text_blocks);
***************
*** 697,701 ****
global $user, $Portal;
! $filename = $this->cachedir . $this->filename[$handle] . '.' . (($this->static_lang) ? $Portal->get('language') . '.' : '') . 'php';
if ($fp = @fopen($filename, 'w+'))
--- 697,701 ----
global $user, $Portal;
! $filename = $this->cachedir . $this->filename[$handle] . '.' . (($this->static_lang) ? $Portal->cfg_get('language') . '.' : '') . 'php';
if ($fp = @fopen($filename, 'w+'))
Index: user.php
===================================================================
RCS file: /cvsroot/phpmp/phpMP/core/user.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** user.php 14 Sep 2003 06:37:52 -0000 1.1
--- user.php 14 Sep 2003 21:55:51 -0000 1.2
***************
*** 27,36 ****
var $_data;
! /**
* @return boolean
* @param userkey mixed(string,array)
! * @param userval string optional
! * @desc Set a variable in userdata.
*/
function set($userkey, $userval = false)
--- 27,37 ----
var $_data;
+ var $lang;
! /**
* @return boolean
* @param userkey mixed(string,array)
! * @param userval string optional
! * @desc Set a variable in userdata.
*/
function set($userkey, $userval = false)
***************
*** 74,81 ****
}
! /**
! * @return void
* @desc Fetches the user's IP in hex-encoded form.
! * Taken from phpBB2.
*/
function get_ip_encoded()
--- 75,82 ----
}
! /**
! * @return void
* @desc Fetches the user's IP in hex-encoded form.
! * Taken from phpBB2.
*/
function get_ip_encoded()
***************
*** 93,101 ****
}
! /**
* @return string
! * @param encoded_ip string
* @desc Decodes a hexed IP.
! * Taken from phpBB2.
*/
function decode_ip($encoded_ip)
--- 94,102 ----
}
! /**
* @return string
! * @param encoded_ip string
* @desc Decodes a hexed IP.
! * Taken from phpBB2.
*/
function decode_ip($encoded_ip)
--- language.php DELETED ---
|