|
From: FlorinCB <ory...@us...> - 2008-09-30 07:07:20
|
Update of /cvsroot/mxbb/core/includes/sessions/phpbb3 In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26368/includes/sessions/phpbb3 Modified Files: login.php session.php Log Message: rewrite for php4 and php6 issues Index: login.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/sessions/phpbb3/login.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** login.php 9 Feb 2008 12:41:11 -0000 1.5 --- login.php 30 Sep 2008 07:04:40 -0000 1.6 *************** *** 17,21 **** if($mx_request_vars->is_request('login') && ($userdata['user_id'] == ANONYMOUS || $mx_request_vars->is_post('admin')) ) { ! $username = $mx_request_vars->is_post('username') ? phpBB2::phpbb_clean_username($mx_request_vars->post('username', MX_TYPE_NO_TAGS)) : ''; $password = $mx_request_vars->post('password', MX_TYPE_NO_TAGS); --- 17,21 ---- if($mx_request_vars->is_request('login') && ($userdata['user_id'] == ANONYMOUS || $mx_request_vars->is_post('admin')) ) { ! $username = $mx_request_vars->is_post('username') ? $phpBB2->phpbb_clean_username($mx_request_vars->post('username', MX_TYPE_NO_TAGS)) : ''; $password = $mx_request_vars->post('password', MX_TYPE_NO_TAGS); *************** *** 63,67 **** $password_new_format = ''; ! phpBB3::set_var($password_new_format, stripslashes($password_old_format), 'string'); //mx_message_die(CRITICAL_ERROR, "Couldn't start session : login", $password_new_format, ''); --- 63,67 ---- $password_new_format = ''; ! $phpBB3->set_var($password_new_format, stripslashes($password_old_format), 'string'); //mx_message_die(CRITICAL_ERROR, "Couldn't start session : login", $password_new_format, ''); *************** *** 78,82 **** if (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password']) { ! $hash = phpBB3::phpbb_hash($password_new_format); // Update the password in the users table to the new format and remove user_pass_convert flag --- 78,82 ---- if (md5($password_old_format) == $row['user_password'] || md5(utf8_to_cp1252($password_old_format)) == $row['user_password']) { ! $hash = $phpBB3->phpbb_hash($password_new_format); // Update the password in the users table to the new format and remove user_pass_convert flag *************** *** 113,117 **** $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format; $password_new_format = ''; ! phpBB3::set_var($password_new_format, stripslashes($password_old_format), 'string'); //mx_message_die(CRITICAL_ERROR, "Couldn't start session : login", $password_new_format, ''); --- 113,117 ---- $password_old_format = (!STRIP) ? addslashes($password_old_format) : $password_old_format; $password_new_format = ''; ! $phpBB3->set_var($password_new_format, stripslashes($password_old_format), 'string'); //mx_message_die(CRITICAL_ERROR, "Couldn't start session : login", $password_new_format, ''); *************** *** 125,129 **** // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding ! if (md5($password_old_format) == $row['user_password'] || md5($password) == $row['user_password'] || phpBB3::phpbb_check_hash($password, $row['user_password'])) { $autologin = $mx_request_vars->is_post('autologin'); --- 125,129 ---- // cp1252 is phpBB2's default encoding, characters outside ASCII range might work when converted into that encoding ! if (md5($password_old_format) == $row['user_password'] || md5($password) == $row['user_password'] || $phpBB3->phpbb_check_hash($password, $row['user_password'])) { $autologin = $mx_request_vars->is_post('autologin'); *************** *** 175,179 **** } // Check password ... ! if (!$row['user_pass_convert'] && phpBB3::phpbb_check_hash($password, $row['user_password'])) { if ($row['user_login_attempts'] != 0) --- 175,179 ---- } // Check password ... ! if (!$row['user_pass_convert'] && $phpBB3->phpbb_check_hash($password, $row['user_password'])) { if ($row['user_login_attempts'] != 0) Index: session.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/sessions/phpbb3/session.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** session.php 4 Sep 2008 00:39:17 -0000 1.30 --- session.php 30 Sep 2008 07:04:41 -0000 1.31 *************** *** 129,132 **** --- 129,133 ---- function extract_current_page($root_path) { + global $phpBB2; $page_array = array(); *************** *** 165,170 **** // current directory within the phpBB root (for example: adm) ! $root_dirs = explode('/', str_replace('\\', '/', phpBB2::phpbb_realpath($root_path))); ! $page_dirs = explode('/', str_replace('\\', '/', phpBB2::phpbb_realpath('./'))); $intersection = array_intersect_assoc($root_dirs, $page_dirs); --- 166,171 ---- // current directory within the phpBB root (for example: adm) ! $root_dirs = explode('/', str_replace('\\', '/', $phpBB2->phpbb_realpath($root_path))); ! $page_dirs = explode('/', str_replace('\\', '/', $phpBB2->phpbb_realpath('./'))); $intersection = array_intersect_assoc($root_dirs, $page_dirs); *************** *** 228,232 **** function session_begin($update_session_page = true) { ! global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $board_config, $phpbb_root_path; // Give us some basic information --- 229,233 ---- function session_begin($update_session_page = true) { ! global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $board_config, $phpbb_root_path, $phpBB3; // Give us some basic information *************** *** 269,275 **** if (isset($_COOKIE[$board_config['cookie_name'] . '_sid']) || isset($_COOKIE[$board_config['cookie_name'] . '_u'])) { ! $this->cookie_data['u'] = phpBB3::request_var($board_config['cookie_name'] . '_u', 0, false, true); ! $this->cookie_data['k'] = phpBB3::request_var($board_config['cookie_name'] . '_k', '', false, true); ! $this->session_id = phpBB3::request_var($board_config['cookie_name'] . '_sid', '', false, true); // original code: $SID = (defined('NEED_SID')) ? 'sid=' . $this->session_id : 'sid='; --- 270,276 ---- if (isset($_COOKIE[$board_config['cookie_name'] . '_sid']) || isset($_COOKIE[$board_config['cookie_name'] . '_u'])) { ! $this->cookie_data['u'] = $phpBB3->request_var($board_config['cookie_name'] . '_u', 0, false, true); ! $this->cookie_data['k'] = $phpBB3->request_var($board_config['cookie_name'] . '_k', '', false, true); ! $this->session_id = $phpBB3->request_var($board_config['cookie_name'] . '_sid', '', false, true); // original code: $SID = (defined('NEED_SID')) ? 'sid=' . $this->session_id : 'sid='; *************** *** 279,283 **** if (empty($this->session_id)) { ! $this->session_id = $_SID = phpBB3::request_var('sid', ''); $SID = 'sid=' . $this->session_id; $this->cookie_data = array('u' => 0, 'k' => ''); --- 280,284 ---- if (empty($this->session_id)) { ! $this->session_id = $_SID = $phpBB3->request_var('sid', ''); $SID = 'sid=' . $this->session_id; $this->cookie_data = array('u' => 0, 'k' => ''); *************** *** 286,290 **** else { ! $this->session_id = $_SID = phpBB3::request_var('sid', ''); $SID = 'sid=' . $this->session_id; } --- 287,291 ---- else { ! $this->session_id = $_SID = $phpBB3->request_var('sid', ''); $SID = 'sid=' . $this->session_id; } *************** *** 417,421 **** if (defined('DEBUG_EXTRA') && $this->data['user_id'] != ANONYMOUS) { ! add_log('critical', 'LOG_IP_BROWSER_FORWARDED_CHECK', $u_ip, $s_ip, $u_browser, $s_browser, htmlspecialchars($u_forwarded_for), htmlspecialchars($s_forwarded_for)); } } --- 418,422 ---- if (defined('DEBUG_EXTRA') && $this->data['user_id'] != ANONYMOUS) { ! mx_add_log('critical', 'LOG_IP_BROWSER_FORWARDED_CHECK', $u_ip, $s_ip, $u_browser, $s_browser, htmlspecialchars($u_forwarded_for), htmlspecialchars($s_forwarded_for)); } } *************** *** 439,442 **** --- 440,444 ---- { global $SID, $_SID, $db, $board_config, $cache, $phpbb_root_path, $phpEx; + global $phpBB3; $this->data = array(); *************** *** 711,715 **** } ! $this->session_id = $this->data['session_id'] = md5(phpBB3::unique_id()); $sql_ary['session_id'] = (string) $this->session_id; --- 713,717 ---- } ! $this->session_id = $this->data['session_id'] = md5($phpBB3->unique_id()); $sql_ary['session_id'] = (string) $this->session_id; *************** *** 1202,1206 **** function set_login_key($user_id = false, $key = false, $user_ip = false) { ! global $board_config, $db; $user_id = ($user_id === false) ? $this->data['user_id'] : $user_id; --- 1204,1208 ---- function set_login_key($user_id = false, $key = false, $user_ip = false) { ! global $board_config, $db, $phpBB3; $user_id = ($user_id === false) ? $this->data['user_id'] : $user_id; *************** *** 1208,1212 **** $key = ($key === false) ? (($this->cookie_data['k']) ? $this->cookie_data['k'] : false) : $key; ! $key_id = phpBB3::unique_id(hexdec(substr($this->session_id, 0, 8))); $sql_ary = array( --- 1210,1214 ---- $key = ($key === false) ? (($this->cookie_data['k']) ? $this->cookie_data['k'] : false) : $key; ! $key_id = $phpBB3->unique_id(hexdec(substr($this->session_id, 0, 8))); $sql_ary = array( *************** *** 1338,1342 **** { global $db, $template, $board_config, $userdata, $phpbb_auth, $phpEx, $phpbb_root_path, $mx_root_path, $mx_cache; ! global $mx_request_vars, $portal_config, $mx_backend; //added for mxp if (!empty($_GET['style']) && $phpbb_auth->acl_get('a_styles')) --- 1340,1344 ---- { global $db, $template, $board_config, $userdata, $phpbb_auth, $phpEx, $phpbb_root_path, $mx_root_path, $mx_cache; ! global $mx_request_vars, $portal_config, $mx_backend, $phpBB3; //added for mxp if (!empty($_GET['style']) && $phpbb_auth->acl_get('a_styles')) *************** *** 1344,1348 **** global $SID, $_EXTRA_URL; ! $style = phpBB3::request_var('style', 0); $SID .= '&style=' . $style; $_EXTRA_URL = array('style=' . $style); --- 1346,1350 ---- global $SID, $_EXTRA_URL; ! $style = $phpBB3->request_var('style', 0); $SID .= '&style=' . $style; $_EXTRA_URL = array('style=' . $style); *************** *** 1502,1506 **** if (@file_exists("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg")) { ! $cfg_data_imageset_data = phpBB3::parse_cfg_file("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg"); foreach ($cfg_data_imageset_data as $image_name => $value) { --- 1504,1508 ---- if (@file_exists("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg")) { ! $cfg_data_imageset_data = $phpBB3->parse_cfg_file("{$phpbb_root_path}styles/{$this->theme['imageset_path']}/imageset/{$this->img_lang}/imageset.cfg"); foreach ($cfg_data_imageset_data as $image_name => $value) { |