From b57ccb8cb9c597f14e9650ae3ef18afd13c1bd38 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 27 Jan 2005 18:59:38 +0000 Subject: [PATCH] fix admin_session "bug" git-svn-id: file:///svn/phpbb/trunk@5083 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/pagestart.php | 2 +- phpBB/includes/functions.php | 12 ++++++++---- phpBB/includes/functions_profile_fields.php | 11 +++++------ phpBB/includes/functions_user.php | 4 ++-- phpBB/includes/message_parser.php | 2 +- phpBB/includes/session.php | 2 +- phpBB/includes/template.php | 1 - 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/phpBB/adm/pagestart.php b/phpBB/adm/pagestart.php index 402238524c..7b1b6e5f78 100644 --- a/phpBB/adm/pagestart.php +++ b/phpBB/adm/pagestart.php @@ -34,7 +34,7 @@ if ($user->data['user_id'] == ANONYMOUS) } // Have they authenticated (again) as an admin for this session? -if (!isset($user->data['session_admin'])) +if (!$user->data['session_admin']) { login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 7a7de96fc5..a0530cf463 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1442,7 +1442,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if (!defined('HEADER_INC')) { - if (defined('IN_ADMIN') && !empty($user->data['session_admin'])) + if (defined('IN_ADMIN') && $user->data['session_admin']) { adm_page_header('', '', false); } @@ -1456,7 +1456,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); $display_header = (!isset($display_header)) ? false : (bool) $display_header; - if (defined('IN_ADMIN') && !empty($user->data['session_admin'])) + if (defined('IN_ADMIN') && $user->data['session_admin']) { adm_page_message($msg_title, $msg_text, $display_header); adm_page_footer(); @@ -1524,7 +1524,7 @@ function page_header($page_title = '') // Get users online list ... if required $l_online_users = $online_userlist = $l_online_record = ''; - if (!empty($config['load_online']) && !empty($config['load_online_time'])) + if ($config['load_online'] && $config['load_online_time']) { $userlist_ary = $userlist_visible = array(); $logged_visible_online = $logged_hidden_online = $guests_online = $prev_user_id = 0; @@ -1650,6 +1650,10 @@ function page_header($page_title = '') $l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES'; $l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']); } + else + { + $l_online_time = ''; + } $l_privmsgs_text = $l_privmsgs_text_unread = ''; $s_privmsg_new = false; @@ -1822,4 +1826,4 @@ function page_footer() exit; } -?> +?> \ No newline at end of file diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index d23becae48..10af159bd1 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -94,14 +94,14 @@ class custom_profile $cp_data[$row['field_ident']] = $this->get_profile_field($row); // get_profile_field returns an array with values for TEXT fields. - if(is_array($cp_data[$row['field_ident']])) + if (is_array($cp_data[$row['field_ident']])) { // Contains the original text without bbcode processing etc $check_value = $cp_data[$row['field_ident']]['submitted']; - foreach($cp_data[$row['field_ident']] as $key => $value) + foreach ($cp_data[$row['field_ident']] as $key => $value) { - if($key != 'submitted') + if ($key != 'submitted') { $cp_data[$key] = $value; } @@ -223,7 +223,7 @@ class custom_profile $user_fields[$row['user_id']][$ident]['value'] = $value; $user_fields[$row['user_id']][$ident]['data'] = $this->profile_cache[$ident]; } - else if($i = strpos($ident, '_bbcode')) + else if ($i = strpos($ident, '_bbcode')) { // Add extra data (bbcode_uid and bbcode_bitfield) to the data for this profile field. // TODO: Maybe we should try to make this a bit more generic (not limited to bbcode)? @@ -316,7 +316,6 @@ class custom_profile break; case FIELD_DROPDOWN: - print_r($field_data['field_novalue']); if ($field_value == $field_data['field_novalue'] && $field_data['field_required']) { return 'FIELD_REQUIRED'; @@ -538,7 +537,7 @@ class custom_profile global $user; $value = $this->get_var('', $profile_row, $profile_row['lang_default_value'], $preview); - if($preview == false) + if ($preview == false) { $message_parser = new parse_message(); $message_parser->message = $value; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index a0fcfabc48..9791490cf6 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -358,7 +358,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; - if($ip_2_counter == 0 && $ip_2_end == 254) + if ($ip_2_counter == 0 && $ip_2_end == 254) { $ip_2_counter = 256; $ip_2_fragment = 256; @@ -1025,7 +1025,7 @@ function avatar_upload($data, &$error) $realfilename = $data['user_id'] . '_' . str_replace($bad_chars, '_', $realname) . '.' . $filetype; - if(!$php_move($filename, $phpbb_root_path . $config['avatar_path'] . '/' . $realfilename)) + if (!$php_move($filename, $phpbb_root_path . $config['avatar_path'] . '/' . $realfilename)) { @unlink($filename); $error[] = $user->lang['AVATAR_NOT_UPLOADED']; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index bff9d46a59..069dde7f09 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -660,7 +660,7 @@ class parse_message extends bbcode_firstpass $this->message = preg_replace($match, $replace, trim($this->message)); // Message length check. -1 disables this check completely, even allows empty messsages. - if($config['max_' . $mode . '_chars'] != -1) + if ($config['max_' . $mode . '_chars'] != -1) { $msg_len = ($mode == 'post') ? strlen($this->message) : strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#is', ' ', $this->message)); diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 8b006d9c68..9983c8049d 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -357,7 +357,7 @@ class session $db->sql_query($sql); // Reset some basic data immediately - $this->session_id = $this->data['username'] = ''; + $this->session_id = $this->data['username'] = $this->data['user_permissions'] = ''; $this->data['user_id'] = ANONYMOUS; $this->data['session_admin'] = 0; diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 81e674d923..0e6cabbdce 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -163,7 +163,6 @@ class template $this->files[$handle] = $phpbb_root_path . 'styles/' . $user->theme['secondary']['template_path'] . '/template/' . $this->filename[$handle]; } - $str = ''; if ($user->theme[$this->tpl]['template_storedb']) { $sql = 'SELECT * FROM ' . STYLES_TPLDATA_TABLE . '