diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index e61fa26988..9a5e04f787 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -122,7 +122,7 @@ class acp_attachments $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; - if ($config_name == 'attachment_quota') + if (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm'))) { $size_var = request_var($config_name, ''); $this->new_config[$config_name] = $config_value = ($size_var == 'kb') ? round($config_value * 1024) : (($size_var == 'mb') ? round($config_value * 1048576) : $config_value); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a63318e35f..dc435b4814 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1229,6 +1229,27 @@ function redirect($url) exit; } +/** +* Re-Apply $SID after page reloads +*/ +function reapply_sid($url) +{ + global $SID, $phpEx; + + if ($url === "index.$phpEx") + { + return "index.$phpEx$SID"; + } + + // Remove previously added sid + if (strpos($url, '?sid=')) + { + $url = preg_replace('/\?sid=[a-z0-9]+(&|&)?/', $SID . '\1', $url); + } + + return (strpos($url, '?') === false) ? $url . $SID : $url . str_replace('?', '&', $SID); +} + /** * Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url */ @@ -1344,7 +1365,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo $s_hidden_fields = build_hidden_fields(array( 'user_id' => $user->data['user_id'], 'sess' => $user->session_id, - 'sid' => $SID) + 'sid' => $user->session_id) ); // generate activation key @@ -1463,22 +1484,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']); // append/replace SID (may change during the session for AOL users) - if ($redirect === "index.$phpEx") - { - $redirect = "index.$phpEx$SID"; - } - else - { - // Remove previously added sid (should not happen) - if (strpos($redirect, '?sid=')) - { - $redirect = preg_replace('/\?sid=[a-z0-9]+(&|&)?/', $SID . '\1', $redirect); - } - else - { - $redirect = (strpos($redirect, '?') === false) ? $redirect . $SID : $redirect . str_replace('?', '&', $SID); - } - } + $redirect = reapply_sid($redirect); meta_refresh(3, $redirect); trigger_error($message . '

' . sprintf($l_redirect, '', '')); @@ -1880,9 +1886,6 @@ function censor_text($text) { $censors = array(); - /** - * @todo For ANONYMOUS censoring should be enabled by default - */ if ($user->optionget('viewcensors')) { $cache->obtain_word_list($censors); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ad3b7a4897..43b0caf794 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -916,4 +916,163 @@ function display_reasons($reason_id = 0) $db->sql_freeresult($result); } +/** +* Display user activity (action forum/topic) +*/ +function display_user_activity(&$userdata) +{ + global $auth, $template, $db, $user; + global $phpbb_root_path, $SID, $phpEx; + + // Init new auth class if user is different + if ($user->data['user_id'] != $userdata['user_id']) + { + $auth2 = new auth(); + $auth2->acl($userdata); + + $post_count_ary = $auth2->acl_getf('!f_postcount'); + } + else + { + $post_count_ary = $auth->acl_getf('!f_postcount'); + } + + $forum_read_ary = $auth->acl_getf('!f_read'); + + $forum_ary = array(); + + // Do not include those forums the user is not having read access to... + foreach ($forum_read_ary as $forum_id => $not_allowed) + { + if ($not_allowed['f_read']) + { + $forum_ary[] = (int) $forum_id; + } + } + + // Now do not include those forums where the posts do not count... + foreach ($post_count_ary as $forum_id => $not_counted) + { + if ($not_counted['f_postcount']) + { + $forum_ary[] = (int) $forum_id; + } + } + + $forum_ary = array_unique($forum_ary); + $post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : ''; + + // Firebird does not support ORDER BY on aliased columns + // MySQL does not support ORDER BY on functions + switch (SQL_LAYER) + { + case 'firebird': + $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts + FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f + WHERE p.poster_id = ' . $userdata['user_id'] . " + AND f.forum_id = p.forum_id + $post_count_sql + GROUP BY f.forum_id + ORDER BY COUNT(p.post_id) DESC"; + break; + + default: + $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts + FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f + WHERE p.poster_id = ' . $userdata['user_id'] . " + AND f.forum_id = p.forum_id + $post_count_sql + GROUP BY f.forum_id + ORDER BY num_posts DESC"; + break; + } + + $result = $db->sql_query_limit($sql, 1); + $active_f_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($active_f_row)) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $active_f_row['forum_id']; + $result = $db->sql_query($sql, 3600); + $active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + } + + // Firebird does not support ORDER BY on aliased columns + // MySQL does not support ORDER BY on functions + switch (SQL_LAYER) + { + case 'firebird': + $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f + WHERE p.poster_id = ' . $userdata['user_id'] . " + AND t.topic_id = p.topic_id + AND f.forum_id = t.forum_id + $post_count_sql + GROUP BY t.topic_id + ORDER BY COUNT(p.post_id) DESC"; + break; + + default: + $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f + WHERE p.poster_id = ' . $userdata['user_id'] . " + AND t.topic_id = p.topic_id + AND f.forum_id = t.forum_id + $post_count_sql + GROUP BY t.topic_id + ORDER BY num_posts DESC"; + break; + } + + $result = $db->sql_query_limit($sql, 1); + $active_t_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($active_t_row)) + { + $sql = 'SELECT topic_title + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $active_t_row['topic_id']; + $result = $db->sql_query($sql); + $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title'); + $db->sql_freeresult($result); + } + + $userdata['active_t_row'] = $active_t_row; + $userdata['active_f_row'] = $active_f_row; + + $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; + if (!empty($active_f_row['num_posts'])) + { + $active_f_name = $active_f_row['forum_name']; + $active_f_id = $active_f_row['forum_id']; + $active_f_count = $active_f_row['num_posts']; + $active_f_pct = ($userdata['user_posts']) ? ($active_f_count / $userdata['user_posts']) * 100 : 0; + } + + $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; + if (!empty($active_t_row['num_posts'])) + { + $active_t_name = $active_t_row['topic_title']; + $active_t_id = $active_t_row['topic_id']; + $active_t_count = $active_t_row['num_posts']; + $active_t_pct = ($userdata['user_posts']) ? ($active_t_count / $userdata['user_posts']) * 100 : 0; + } + + $template->assign_vars(array( + 'ACTIVE_FORUM' => $active_f_name, + 'ACTIVE_FORUM_POSTS' => ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), + 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct), + 'ACTIVE_TOPIC' => censor_text($active_t_name), + 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), + 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct), + 'U_ACTIVE_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=$active_f_id", + 'U_ACTIVE_TOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&t=$active_t_id") + ); +} + ?> \ No newline at end of file diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 073d434839..717c188a02 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1311,7 +1311,7 @@ function submit_pm($mode, $subject, &$data, $update_message, $put_in_outbox = tr $db->sql_transaction(); // Submit Attachments - if (sizeof($data['attachment_data']) && $data['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) + if (!empty($data['attachment_data']) && $data['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) { $space_taken = $files_added = 0; diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 5b7433a6a3..dc4df52f50 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -243,12 +243,8 @@ function lock_unlock($action, $ids) confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((sizeof($ids) == 1) ? '' : 'S'), $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -352,12 +348,8 @@ function change_topic_type($action, $topic_ids) confirm_box(false, $l_new_type, $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -501,12 +493,8 @@ function mcp_move_topic($topic_ids) confirm_box(false, 'MOVE_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -567,12 +555,8 @@ function mcp_delete_topic($topic_ids) confirm_box(false, (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -690,12 +674,8 @@ function mcp_delete_post($post_ids) confirm_box(false, (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -936,12 +916,8 @@ function mcp_fork_topic($topic_ids) confirm_box(false, 'FORK_TOPIC' . ((sizeof($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 948d345ea5..8c0dc9cd6d 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -510,12 +510,8 @@ function approve_post($post_id_list, $mode) confirm_box(false, 'APPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -714,12 +710,8 @@ function disapprove_post($post_id_list, $mode) confirm_box(false, 'DISAPPROVE_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 0f97dd7e27..e71e7507bb 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -482,12 +482,8 @@ function close_report($post_id_list, $mode, $action) confirm_box(false, $user->lang[strtoupper($action) . '_REPORT' . ((sizeof($post_id_list) == 1) ? '' : 'S') . '_CONFIRM'], $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index b6a9bebd83..b8fbfd3bae 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -380,12 +380,8 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) confirm_box(false, ($action == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { @@ -476,12 +472,8 @@ function merge_posts($topic_id, $to_topic_id) confirm_box(false, 'MERGE_POSTS', $s_hidden_fields); } - $redirect = request_var('redirect', "index.$phpEx$SID"); - - if (strpos($redirect, '?') === false) - { - $redirect = substr_replace($redirect, ".$phpEx$SID&", strpos($redirect, '&'), 1); - } + $redirect = request_var('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); if (!$success_msg) { diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index a4944ed2d8..f06a6671b9 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -146,7 +146,11 @@ class ucp_main if ($config['load_user_activity']) { - $this->show_user_activity(); + if (!function_exists('display_user_activity')) + { + include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + display_user_activity($user->data); } // Do the relevant calculations @@ -779,151 +783,6 @@ class ucp_main // Set desired template $this->tpl_name = 'ucp_main_' . $mode; } - - function show_user_activity() - { - global $auth, $template, $db, $user; - global $phpbb_root_path, $SID, $phpEx; - - $post_count_ary = $auth->acl_getf('!f_postcount'); - $forum_read_ary = $auth->acl_getf('!f_read'); - - $forum_ary = array(); - - // Do not include those forums the user is not having read access to... - foreach ($forum_read_ary as $forum_id => $not_allowed) - { - if ($not_allowed['f_read']) - { - $forum_ary[] = (int) $forum_id; - } - } - - // Now do not include those forums where the posts do not count... - foreach ($post_count_ary as $forum_id => $not_counted) - { - if ($not_counted['f_postcount']) - { - $forum_ary[] = (int) $forum_id; - } - } - - $forum_ary = array_unique($forum_ary); - - $post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : ''; - - // Firebird does not support ORDER BY on aliased columns - // MySQL does not support ORDER BY on functions - switch (SQL_LAYER) - { - case 'firebird': - $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f - WHERE p.poster_id = ' . $user->data['user_id'] . " - AND f.forum_id = p.forum_id - $post_count_sql - GROUP BY f.forum_id - ORDER BY COUNT(p.post_id) DESC"; - break; - - default: - $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f - WHERE p.poster_id = ' . $user->data['user_id'] . " - AND f.forum_id = p.forum_id - $post_count_sql - GROUP BY f.forum_id - ORDER BY num_posts DESC"; - break; - } - - $result = $db->sql_query_limit($sql, 1); - $active_f_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!empty($active_f_row)) - { - $sql = 'SELECT forum_name - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $active_f_row['forum_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $active_f_row['forum_name'] = $row['forum_name']; - } - - // Firebird does not support ORDER BY on aliased columns - // MySQL does not support ORDER BY on functions - switch (SQL_LAYER) - { - case 'firebird': - $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f - WHERE p.poster_id = ' . $user->data['user_id'] . " - AND t.topic_id = p.topic_id - AND f.forum_id = t.forum_id - $post_count_sql - GROUP BY t.topic_id - ORDER BY COUNT(p.post_id) DESC"; - break; - - default: - $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f - WHERE p.poster_id = ' . $user->data['user_id'] . " - AND t.topic_id = p.topic_id - AND f.forum_id = t.forum_id - $post_count_sql - GROUP BY t.topic_id - ORDER BY num_posts DESC"; - break; - } - - $result = $db->sql_query_limit($sql, 1); - $active_t_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!empty($active_t_row)) - { - $sql = 'SELECT topic_title - FROM ' . TOPICS_TABLE . ' - WHERE topic_id = ' . $active_t_row['topic_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $active_t_row['topic_title'] = $row['topic_title']; - } - - $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; - if (!empty($active_f_row['num_posts'])) - { - $active_f_name = $active_f_row['forum_name']; - $active_f_id = $active_f_row['forum_id']; - $active_f_count = $active_f_row['num_posts']; - $active_f_pct = ($user->data['user_posts']) ? ($active_f_count / $user->data['user_posts']) * 100 : 0; - } - - $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; - if (!empty($active_t_row['num_posts'])) - { - $active_t_name = $active_t_row['topic_title']; - $active_t_id = $active_t_row['topic_id']; - $active_t_count = $active_t_row['num_posts']; - $active_t_pct = ($user->data['user_posts']) ? ($active_t_count / $user->data['user_posts']) * 100 : 0; - } - - $template->assign_vars(array( - 'ACTIVE_FORUM' => $active_f_name, - 'ACTIVE_FORUM_POSTS' => ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), - 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct), - 'ACTIVE_TOPIC' => censor_text($active_t_name), - 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), - 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct), - 'U_ACTIVE_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=$active_f_id", - 'U_ACTIVE_TOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&t=$active_t_id") - ); - } - } ?> \ No newline at end of file diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index a98bab1f2e..2696a2eb1e 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -471,7 +471,7 @@ class ucp_register $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', 'USERNAME' => (isset($username)) ? $username : '', - 'PASSWORD' => (isset($password)) ? $password : '', + 'PASSWORD' => (isset($new_password)) ? $new_password : '', 'PASSWORD_CONFIRM' => (isset($password_confirm)) ? $password_confirm : '', 'EMAIL' => (isset($email)) ? $email : '', 'EMAIL_CONFIRM' => (isset($email_confirm)) ? $email_confirm : '', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 40ec02f412..5363c9a7fa 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -313,7 +313,7 @@ switch ($mode) } // Get user... - $sql = 'SELECT username, user_id, user_type, user_colour, group_id, user_permissions, user_sig, user_sig_bbcode_uid, user_sig_bbcode_bitfield, user_allow_viewemail, user_allow_viewonline, user_posts, user_warnings, user_regdate, user_rank, user_from, user_occ, user_interests, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_avatar, user_avatar_width, user_avatar_height, user_avatar_type, user_lastvisit + $sql = 'SELECT * FROM ' . USERS_TABLE . " WHERE user_id = $user_id AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; @@ -343,7 +343,6 @@ switch ($mode) FROM ' . SESSIONS_TABLE . " WHERE session_user_id = $user_id"; $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -353,7 +352,11 @@ switch ($mode) if ($config['load_user_activity']) { - show_user_activity($member); + if (!function_exists('display_user_activity')) + { + include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + display_user_activity($member); } // Do the relevant calculations @@ -1240,153 +1243,4 @@ function show_profile($data) ); } -function show_user_activity(&$member) -{ - global $auth, $template, $db, $user; - global $phpbb_root_path, $SID, $phpEx; - - $auth2 = new auth(); - $auth2->acl($member); - - $post_count_ary = $auth2->acl_getf('!f_postcount'); - $forum_read_ary = $auth->acl_getf('!f_read'); - - $forum_ary = array(); - - // Do not include those forums the user watching this profile is not having read access to... - foreach ($forum_read_ary as $forum_id => $not_allowed) - { - if ($not_allowed['f_read']) - { - $forum_ary[] = (int) $forum_id; - } - } - - // Now do not include those forums where the posts do not count for the members profile... - foreach ($post_count_ary as $forum_id => $not_counted) - { - if ($not_counted['f_postcount']) - { - $forum_ary[] = (int) $forum_id; - } - } - - $forum_ary = array_unique($forum_ary); - $post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : ''; - - // Firebird does not support ORDER BY on aliased columns - // MySQL does not support ORDER BY on functions - switch (SQL_LAYER) - { - case 'firebird': - $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f - WHERE p.poster_id = {$member['user_id']} - AND f.forum_id = p.forum_id - $post_count_sql - GROUP BY f.forum_id - ORDER BY COUNT(p.post_id) DESC"; - break; - - default: - $sql = 'SELECT f.forum_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f - WHERE p.poster_id = {$member['user_id']} - AND f.forum_id = p.forum_id - $post_count_sql - GROUP BY f.forum_id - ORDER BY num_posts DESC"; - break; - } - - $result = $db->sql_query_limit($sql, 1); - $active_f_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!empty($active_f_row)) - { - $sql = 'SELECT forum_name - FROM ' . FORUMS_TABLE . ' - WHERE forum_id = ' . $active_f_row['forum_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $active_f_row['forum_name'] = $row['forum_name']; - } - - // Firebird does not support ORDER BY on aliased columns - // MySQL does not support ORDER BY on functions - switch (SQL_LAYER) - { - case 'firebird': - $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f - WHERE p.poster_id = {$member['user_id']} - AND t.topic_id = p.topic_id - AND f.forum_id = t.forum_id - $post_count_sql - GROUP BY t.topic_id - ORDER BY COUNT(p.post_id) DESC"; - break; - - default: - $sql = 'SELECT t.topic_id, COUNT(p.post_id) AS num_posts - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f - WHERE p.poster_id = {$member['user_id']} - AND t.topic_id = p.topic_id - AND f.forum_id = t.forum_id - $post_count_sql - GROUP BY t.topic_id - ORDER BY num_posts DESC"; - break; - } - - $result = $db->sql_query_limit($sql, 1); - $active_t_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!empty($active_t_row)) - { - $sql = 'SELECT topic_title - FROM ' . TOPICS_TABLE . ' - WHERE topic_id = ' . $active_t_row['topic_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $active_t_row['topic_title'] = $row['topic_title']; - } - - $member['active_t_row'] = $active_t_row; - $member['active_f_row'] = $active_f_row; - - $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; - if (!empty($active_f_row['num_posts'])) - { - $active_f_name = $active_f_row['forum_name']; - $active_f_id = $active_f_row['forum_id']; - $active_f_count = $active_f_row['num_posts']; - $active_f_pct = ($member['user_posts']) ? ($active_f_count / $member['user_posts']) * 100 : 0; - } - - $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; - if (!empty($active_t_row['num_posts'])) - { - $active_t_name = $active_t_row['topic_title']; - $active_t_id = $active_t_row['topic_id']; - $active_t_count = $active_t_row['num_posts']; - $active_t_pct = ($member['user_posts']) ? ($active_t_count / $member['user_posts']) * 100 : 0; - } - - $template->assign_vars(array( - 'ACTIVE_FORUM' => $active_f_name, - 'ACTIVE_FORUM_POSTS' => ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), - 'ACTIVE_FORUM_PCT' => sprintf($user->lang['POST_PCT'], $active_f_pct), - 'ACTIVE_TOPIC' => censor_text($active_t_name), - 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), - 'ACTIVE_TOPIC_PCT' => sprintf($user->lang['POST_PCT'], $active_t_pct), - 'U_ACTIVE_FORUM' => "{$phpbb_root_path}viewforum.$phpEx$SID&f=$active_f_id", - 'U_ACTIVE_TOPIC' => "{$phpbb_root_path}viewtopic.$phpEx$SID&t=$active_t_id") - ); -} - ?> \ No newline at end of file diff --git a/phpBB/styles/subSilver/template/ucp_profile_signature.html b/phpBB/styles/subSilver/template/ucp_profile_signature.html index 21ae225559..591af464c5 100644 --- a/phpBB/styles/subSilver/template/ucp_profile_signature.html +++ b/phpBB/styles/subSilver/template/ucp_profile_signature.html @@ -130,7 +130,7 @@ e_help = "{LA_BBCODE_E_HELP}"; {L_SIGNATURE_PREVIEW} -
{SIGNATURE_PREVIEW}
+
{SIGNATURE_PREVIEW}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c8c325f970..3161bb2787 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -835,6 +835,7 @@ while ($row = $db->sql_fetchrow($result)) { $rowset[$row['post_id']] = array( 'foe' => true, + 'user_id' => $row['user_id'], 'post_id' => $row['post_id'], 'poster' => $poster, );