diff options
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r-- | phpBB/includes/mcp/mcp_ban.php | 6 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 23 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_front.php | 45 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_logs.php | 14 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 21 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 39 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_reports.php | 59 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_topic.php | 27 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_warn.php | 79 |
9 files changed, 168 insertions, 145 deletions
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index 7435c3054e..7878e4912c 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -25,9 +25,9 @@ class mcp_ban // Include the admin banning interface... include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); - $bansubmit = (isset($_POST['bansubmit'])) ? true : false; - $unbansubmit= (isset($_POST['unbansubmit'])) ? true : false; - $current_time = time(); + $bansubmit = (isset($_POST['bansubmit'])) ? true : false; + $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; + $current_time = time(); $user->add_lang('acp/ban'); $this->tpl_name = 'mcp_ban'; diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 659baffee0..ceb2dcbff7 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -24,11 +24,11 @@ function mcp_forum_view($id, $mode, $action, $forum_info) unset($_POST['sk'], $_POST['sd'], $_REQUEST['sk'], $_REQUEST['sd']); } - $forum_id = $forum_info['forum_id']; - $start = request_var('start', 0); - $topic_id_list = request_var('topic_id_list', array(0)); - $post_id_list = request_var('post_id_list', array(0)); - $topic_id = request_var('t', 0); + $forum_id = $forum_info['forum_id']; + $start = request_var('start', 0); + $topic_id_list = request_var('topic_id_list', array(0)); + $post_id_list = request_var('post_id_list', array(0)); + $topic_id = request_var('t', 0); // Resync Topics if ($action == 'resync') @@ -180,12 +180,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info) 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', - 'TOPIC_TYPE' => $topic_type, - 'TOPIC_TITLE' => $topic_title, - 'REPLIES' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'], - 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), - 'TOPIC_ID' => $row['topic_id'], - 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? 'checked="checked" ' : '', + 'TOPIC_TYPE' => $topic_type, + 'TOPIC_TITLE' => $topic_title, + 'REPLIES' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies'], + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'TOPIC_ID' => $row['topic_id'], + 'S_TOPIC_CHECKED' => ($topic_id_list && in_array($row['topic_id'], $topic_id_list)) ? 'checked="checked" ' : '', 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_report', $row['forum_id'])) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, @@ -228,6 +228,7 @@ function mcp_resync_topics($topic_ids) { add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']); } + $db->sql_freeresult($result); $msg = (sizeof($topic_ids) == 1) ? $user->lang['TOPIC_RESYNC_SUCCESS'] : $user->lang['TOPICS_RESYNC_SUCCESS']; diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index db38df42ae..3fe9b60018 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -56,6 +56,7 @@ function mcp_front_view($id, $mode, $action) AND post_approved = 0 ORDER BY post_id DESC'; $result = $db->sql_query_limit($sql, 5); + while ($row = $db->sql_fetchrow($result)) { $post_list[] = $row['post_id']; @@ -79,12 +80,12 @@ function mcp_front_view($id, $mode, $action) } $template->assign_block_vars('unapproved', array( - 'U_POST_DETAILS'=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=post_details&f=' . $row['forum_id'] . '&p=' . $row['post_id']), - 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view&f=' . $row['forum_id']) : '', - 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&f=' . $row['forum_id'] . '&t=' . $row['topic_id']), - 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), - 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']), + 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=post_details&f=' . $row['forum_id'] . '&p=' . $row['post_id']), + 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=forum_view&f=' . $row['forum_id']) : '', + 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=topic_view&f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', + 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_AUTHOR' => ($row['poster_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']), 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'TOPIC_TITLE' => $row['topic_title'], @@ -116,6 +117,7 @@ function mcp_front_view($id, $mode, $action) $forum_list = get_forum_list('m_'); $template->assign_var('S_SHOW_REPORTS', (!empty($forum_list)) ? true : false); + if (!empty($forum_list)) { $sql = 'SELECT COUNT(r.report_id) AS total @@ -124,8 +126,8 @@ function mcp_front_view($id, $mode, $action) AND r.report_closed = 0 AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')'; $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $total = $row['total']; + $total = (int) $db->sql_fetchfield('total'); + $db->sql_freeresult($result); if ($total) { @@ -140,7 +142,6 @@ function mcp_front_view($id, $mode, $action) TOPICS_TABLE => 't', USERS_TABLE => 'u', POSTS_TABLE => 'p' - ), 'LEFT_JOIN' => array( @@ -151,11 +152,11 @@ function mcp_front_view($id, $mode, $action) ), 'WHERE' => 'r.post_id = p.post_id - AND r.report_closed = 0 - AND r.reason_id = rr.reason_id - AND p.topic_id = t.topic_id - AND r.user_id = u.user_id - AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')', + AND r.report_closed = 0 + AND r.reason_id = rr.reason_id + AND p.topic_id = t.topic_id + AND r.user_id = u.user_id + AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')', 'ORDER_BY' => 'p.post_id DESC' )); @@ -170,12 +171,12 @@ function mcp_front_view($id, $mode, $action) } $template->assign_block_vars('report', array( - 'U_POST_DETAILS'=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id'] . "&i=reports&mode=report_details"), - 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&i=$id&mode=forum_view") : '', - 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . "&i=$id&mode=topic_view"), - 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), - 'U_REPORTER' => ($row['user_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), + 'U_POST_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id'] . "&i=reports&mode=report_details"), + 'U_MCP_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . "&i=$id&mode=forum_view") : '', + 'U_MCP_TOPIC' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . "&i=$id&mode=topic_view"), + 'U_FORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', + 'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']), + 'U_REPORTER' => ($row['user_id'] == ANONYMOUS) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']), 'FORUM_NAME' => (!$global_topic) ? $row['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'TOPIC_TITLE' => $row['topic_title'], @@ -221,8 +222,8 @@ function mcp_front_view($id, $mode, $action) 'IP' => $row['ip'], 'TIME' => $user->format_date($row['time']), 'ACTION' => $row['action'], - 'U_VIEWTOPIC' => isset($row['viewtopic']) ? $row['viewtopic'] : '', - 'U_VIEWLOGS' => isset($row['viewlogs']) ? $row['viewlogs'] : '') + 'U_VIEWTOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '', + 'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '') ); } } diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 77837006c9..2850505e66 100755 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -17,7 +17,7 @@ class mcp_logs { var $u_action; var $p_master; - + function mcp_main(&$p_master) { $this->p_master = &$p_master; @@ -121,12 +121,12 @@ class mcp_logs 'TOTAL' => ($log_count == 1) ? $user->lang['TOTAL_LOG'] : sprintf($user->lang['TOTAL_LOGS'], $log_count), 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $log_count, $config['topics_per_page'], $start), - 'U_POST_ACTION' => $this->u_action, - 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, - 'S_SELECT_SORT_DIR' => $s_sort_dir, - 'S_SELECT_SORT_KEY' => $s_sort_key, - 'S_SELECT_SORT_DAYS'=> $s_limit_days, - 'S_LOGS' => ($log_count > 0), + 'U_POST_ACTION' => $this->u_action, + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_LOGS' => ($log_count > 0), ) ); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index eb77e68585..abae0d55d4 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -180,7 +180,7 @@ class mcp_main break; default: - trigger_error("Unknown mode: $mode"); + trigger_error("Unknown mode: $mode", E_USER_ERROR); } } } @@ -543,7 +543,9 @@ function mcp_delete_topic($topic_ids) $return = delete_topics('topic_id', $topic_ids, true); - // TODO: Adjust total post count... + /** + * @todo Adjust total post count (mcp_delete_topic) + */ } else { @@ -778,7 +780,7 @@ function mcp_fork_topic($topic_ids) $new_topic_id_list[$topic_id] = $new_topic_id; /** - * @todo enable + * @todo enable? (is this still needed?) * markread('topic', $to_forum_id, $new_topic_id); */ @@ -793,9 +795,14 @@ function mcp_fork_topic($topic_ids) while ($row = $db->sql_fetchrow($result)) { - $sql = 'INSERT INTO ' . POLL_OPTIONS_TABLE . ' (poll_option_id, topic_id, poll_option_text, poll_option_total) - VALUES (' . $row['poll_option_id'] . ', ' . $new_topic_id . ", '" . $db->sql_escape($row['poll_option_text']) . "', 0)"; - $db->sql_query($sql); + $sql_ary = array( + 'poll_option_id' => (int) $row['poll_option_id'], + 'topic_id' => (int) $new_topic_id, + 'poll_option_text' => (string) $row['poll_option_text'], + 'poll_option_total' => 0 + ); + + $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); } } @@ -810,7 +817,7 @@ function mcp_fork_topic($topic_ids) { $post_rows[] = $row; } - $db->sql_freeresult(); + $db->sql_freeresult($result); if (!sizeof($post_rows)) { diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index da7b31f7d9..560431ce87 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -39,7 +39,7 @@ class mcp_queue { case 'approve': case 'disapprove': - include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $post_id_list = request_var('post_id_list', array(0)); @@ -111,7 +111,7 @@ class mcp_queue $message = $post_info['post_text']; if ($post_info['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } @@ -179,7 +179,7 @@ class mcp_queue $forum_list[] = $row['forum_id']; } - if (!$forum_list = implode(', ', $forum_list)) + if (!($forum_list = implode(', ', $forum_list))) { trigger_error('NOT_MODERATOR'); } @@ -244,6 +244,7 @@ class mcp_queue $post_ids[] = $row['post_id']; $row_num[$row['post_id']] = $i++; } + $db->sql_freeresult($result); if (sizeof($post_ids)) { @@ -252,8 +253,8 @@ class mcp_queue WHERE p.post_id IN (" . implode(', ', $post_ids) . ") AND t.topic_id = p.topic_id AND u.user_id = p.poster_id"; - $result = $db->sql_query($sql); + $post_data = $rowset = array(); while ($row = $db->sql_fetchrow($result)) { @@ -311,6 +312,7 @@ class mcp_queue { $forum_names[$row['forum_id']] = $row['forum_name']; } + $db->sql_freeresult($result); } foreach ($rowset as $row) @@ -324,8 +326,6 @@ class mcp_queue $poster = $row['username']; } - $s_checkbox = '<input type="checkbox" class="radio" name="post_id_list[]" value="' . $row['post_id'] . '" />'; - $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) { @@ -333,22 +333,21 @@ class mcp_queue } $template->assign_block_vars('postrow', array( - 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', + 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', // Q: Why accessing the topic by a post_id instead of its topic_id? // A: To prevent the post from being hidden because of wrong encoding or different charset - 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), - 'U_VIEW_DETAILS'=> append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), - 'U_VIEWPROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', + 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), + 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), + 'U_VIEWPROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', + 'POST_ID' => $row['post_id'], 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'TOPIC_TITLE' => $row['topic_title'], 'POSTER' => $poster, - 'POST_TIME' => $user->format_date($row['post_time']), - 'S_CHECKBOX' => $s_checkbox) + 'POST_TIME' => $user->format_date($row['post_time'])) ); } - unset($rowset); - unset($forum_names); + unset($rowset, $forum_names); // Now display the page $template->assign_vars(array( @@ -372,7 +371,9 @@ class mcp_queue } } -// Approve Post/Topic +/** +* Approve Post/Topic +*/ function approve_post($post_id_list, $mode) { global $db, $template, $user, $config; @@ -588,7 +589,9 @@ function approve_post($post_id_list, $mode) } } -// Disapprove Post/Topic +/** +* Disapprove Post/Topic +*/ function disapprove_post($post_id_list, $mode) { global $db, $template, $user, $config; @@ -627,7 +630,7 @@ function disapprove_post($post_id_list, $mode) if (!$row || (!$reason && $row['reason_title'] == 'other')) { - $additional_msg = 'Please give an appropiate reason for disapproval'; + $additional_msg = $user->lang['NO_REASON_DISAPPROVAL']; unset($_POST['confirm']); } else @@ -698,7 +701,7 @@ function disapprove_post($post_id_list, $mode) { if (!function_exists('delete_posts')) { - include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); } // We do not check for permissions here, because the moderator allowed approval/disapproval should be allowed to delete the disapproved posts diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 6900c74879..8614e0cdd2 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -39,7 +39,7 @@ class mcp_reports { case 'close': case 'delete': - include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); $post_id_list = request_var('post_id_list', array(0)); @@ -76,14 +76,14 @@ class mcp_reports AND rr.reason_id = r.reason_id AND r.user_id = u.user_id"; $result = $db->sql_query($sql); + $report = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!($report = $db->sql_fetchrow($result))) + if (!$report) { trigger_error('NO_POST_REPORT'); } - $db->sql_freeresult($result); - $reason = array('title' => $report['reason_title'], 'description' => $report['reason_description']); if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason['title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason['title'])])) { @@ -111,7 +111,8 @@ class mcp_reports $message = $post_info['post_text']; if ($post_info['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $bbcode = new bbcode($post_info['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']); } @@ -126,27 +127,26 @@ class mcp_reports 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => true, - 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', - 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), - 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']), - 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_REPORTER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', - 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', - 'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $post_info['user_id']) : '', + 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}") : '', + 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), + 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']), + 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), + 'U_MCP_WARN_REPORTER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', + 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $post_info['user_id']) : '', 'U_VIEW_REPORTER_PROFILE' => ($report['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $report['user_id']) : '', 'EDIT_IMG' => $user->img('btn_edit', $user->lang['EDIT_POST']), + 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), - 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start) . '">', '</a>'), - 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), - 'REPORT_REASON_TITLE' => $reason['title'], + 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports' . (($post_info['post_reported']) ? '&mode=reports' : '&mode=reports_closed') . '&start=' . $start) . '">', '</a>'), + 'REPORTED_IMG' => $user->img('icon_reported', $user->lang['POST_REPORTED']), + 'REPORT_REASON_TITLE' => $reason['title'], 'REPORT_REASON_DESCRIPTION' => $reason['description'], - 'REPORTER_NAME' => ($report['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $report['username'], - 'REPORT_DATE' => $user->format_date($report['report_time']), - 'REPORT_TEXT' => $report['report_text'], - - 'UNAPPROVED_IMG' => $user->img('icon_unapproved', $user->lang['POST_UNAPPROVED']), + 'REPORTER_NAME' => ($report['user_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $report['username'], + 'REPORT_DATE' => $user->format_date($report['report_time']), + 'REPORT_TEXT' => $report['report_text'], 'POSTER_NAME' => $poster, 'POST_PREVIEW' => $message, @@ -189,7 +189,7 @@ class mcp_reports $forum_list[] = $row['forum_id']; } - if (!$forum_list = implode(', ', $forum_list)) + if (!($forum_list = implode(', ', $forum_list))) { trigger_error('NOT_MODERATOR'); } @@ -200,7 +200,6 @@ class mcp_reports $result = $db->sql_query($sql); $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); $db->sql_freeresult($result); - } else { @@ -263,6 +262,7 @@ class mcp_reports $post_ids[] = $row['post_id']; $row_num[$row['post_id']] = $i++; } + $db->sql_freeresult($result); if (sizeof($post_ids)) { @@ -273,8 +273,8 @@ class mcp_reports AND r.post_id = p.post_id AND u.user_id = p.poster_id AND ru.user_id = r.user_id"; - $result = $db->sql_query($sql); + $post_data = $rowset = array(); while ($row = $db->sql_fetchrow($result)) { @@ -295,8 +295,6 @@ class mcp_reports $poster = $row['username']; } - $s_checkbox = '<input type="checkbox" class="radio" name="post_id_list[]" value="' . $row['post_id'] . '" />'; - $template->assign_block_vars('postrow', array( 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), // Q: Why accessing the topic by a post_id instead of its topic_id? @@ -306,10 +304,9 @@ class mcp_reports 'U_VIEW_POSTER_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', 'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['reporter_id']) : '', - 'S_CHECKBOX' => $s_checkbox, - 'FORUM_NAME' => ($row['forum_id']) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['ALL_FORUMS'], 'POSTER' => $poster, + 'POST_ID' => $row['post_id'], 'POST_SUBJECT' => $row['post_subject'], 'POST_TIME' => $user->format_date($row['post_time']), 'REPORTER' => ($row['reporter_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['reporter_name'], @@ -383,12 +380,9 @@ function close_report($post_id_list, $mode, $action) { $reports[$report['post_id']] = $report; } - $db->sql_freeresult($result); - $close_report_posts = array(); - $close_report_topics = array(); - $notify_reporters = array(); + $close_report_posts = $close_report_topics = $notify_reporters = array(); foreach ($post_info as $post_id => $post_data) { if (isset($reports[$post_id])) @@ -420,6 +414,7 @@ function close_report($post_id_list, $mode, $action) { $keep_report_topics[] = $row['topic_id']; } + $db->sql_freeresult($result); $close_report_topics = array_diff($close_report_topics, $keep_report_topics); unset($keep_report_topics); diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 1c0c1d9a68..92125cd14d 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -31,12 +31,12 @@ function mcp_topic_view($id, $mode, $action) $topic_info = $topic_info[$topic_id]; // Set up some vars - $icon_id = request_var('icon', 0); - $subject = request_var('subject', '', true); - $start = request_var('start', 0); - $to_topic_id = request_var('to_topic_id', 0); - $to_forum_id = request_var('to_forum_id', 0); - $post_id_list = request_var('post_id_list', array(0)); + $icon_id = request_var('icon', 0); + $subject = request_var('subject', '', true); + $start = request_var('start', 0); + $to_topic_id = request_var('to_topic_id', 0); + $to_forum_id = request_var('to_forum_id', 0); + $post_id_list = request_var('post_id_list', array(0)); // Split Topic? if ($action == 'split_all' || $action == 'split_beyond') @@ -60,8 +60,7 @@ function mcp_topic_view($id, $mode, $action) // Jumpbox, sort selects and that kind of things make_jumpbox($url . "&i=$id&mode=forum_view", $topic_info['forum_id'], false, 'm_'); $where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE'; - - + $sort_days = $total = 0; $sort_key = $sort_dir = ''; $sort_by_sql = $sort_order_sql = array(); @@ -73,6 +72,7 @@ function mcp_topic_view($id, $mode, $action) { $total = $topic_info['topic_replies'] + 1; } + $posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page']))); if ($posts_per_page == 0) { @@ -94,6 +94,7 @@ function mcp_topic_view($id, $mode, $action) $rowset[] = $row; $bbcode_bitfield |= $row['bbcode_bitfield']; } + $db->sql_freeresult($result); if ($bbcode_bitfield) { @@ -118,9 +119,6 @@ function mcp_topic_view($id, $mode, $action) $message = smiley_text($message); $message = str_replace("\n", '<br />', $message); - $checked = ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? 'checked="checked" ' : ''; - $s_checkbox = '<input type="checkbox" class="radio" name="post_id_list[]" value="' . $row['post_id'] . '" ' . $checked . '/>'; - if (!$row['post_approved']) { $has_unapproved_posts = true; @@ -136,9 +134,9 @@ function mcp_topic_view($id, $mode, $action) 'MINI_POST_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['is_registered']) ? $user->img('icon_post_new', $user->lang['NEW_POST']) : $user->img('icon_post', $user->lang['POST']), - 'S_CHECKBOX' => $s_checkbox, 'S_POST_REPORTED' => ($row['post_reported']) ? true : false, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, + 'S_CHECKED' => ($post_id_list && in_array(intval($row['post_id']), $post_id_list)) ? true : false, 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details", 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']), @@ -200,8 +198,8 @@ function mcp_topic_view($id, $mode, $action) 'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false, 'S_REPORT_VIEW' => ($action == 'reports') ? true : false, - 'S_SHOW_TOPIC_ICONS'=> $s_topic_icons, - 'S_TOPIC_ICON' => $icon_id, + 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, + 'S_TOPIC_ICON' => $icon_id, 'U_SELECT_TOPIC' => "$url&i=$id&mode=forum_view&action=merge_select", @@ -344,6 +342,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $post_id_list[] = $row['post_id']; } } + $db->sql_freeresult($result); } if (!sizeof($post_id_list)) diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index a40e53649a..13de52c457 100755 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -42,19 +42,22 @@ class mcp_warn case 'front': mcp_warn_front_view($id, $mode); $this->tpl_name = 'mcp_warn_front'; - break; + break; + case 'list': mcp_warn_list_view($id, $mode, $action); $this->tpl_name = 'mcp_warn_list'; - break; + break; + case 'warn_post': mcp_warn_post_view($id, $mode, $action); $this->tpl_name = 'mcp_warn_post'; - break; + break; + case 'warn_user': mcp_warn_user_view($id, $mode, $action); $this->tpl_name = 'mcp_warn_user'; - break; + break; } } } @@ -127,10 +130,10 @@ function mcp_warn_list_view($id, $mode, $action) $user->add_lang('memberlist'); - $start = request_var('start', 0); - $st = request_var('st', 0); - $sk = request_var('sk', 'b'); - $sd = request_var('sd', 'd'); + $start = request_var('start', 0); + $st = request_var('st', 0); + $sk = request_var('sk', 'b'); + $sd = request_var('sd', 'd'); $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); @@ -162,11 +165,11 @@ function mcp_warn_list_view($id, $mode, $action) } $template->assign_vars(array( - 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode"), - 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, - 'S_SELECT_SORT_DIR' => $s_sort_dir, - 'S_SELECT_SORT_KEY' => $s_sort_key, - 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode"), + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, 'PAGE_NUMBER' => on_page($user_count, $config['topics_per_page'], $start), 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&st=$st&sk=$sk&sd=$sd"), $user_count, $config['topics_per_page'], $start), @@ -188,16 +191,18 @@ function mcp_warn_post_view($id, $mode, $action) $notify = (isset($_REQUEST['notify_user'])) ? true : false; $warning = request_var('warning', '', true); - $sql = 'SELECT u.*, p.* FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + $sql = 'SELECT u.*, p.* + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u WHERE post_id = $post_id - AND u.user_id = p.poster_id"; + AND u.user_id = p.poster_id"; $result = $db->sql_query($sql); + $userrow = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (!$userrow = $db->sql_fetchrow($result)) + if (!$userrow) { trigger_error($user->lang['NO_POST']); } - $db->sql_freeresult($result); // There is no point issuing a warning to ignored users (ie anonymous and bots) if ($userrow['user_type'] == USER_IGNORE) @@ -207,16 +212,18 @@ function mcp_warn_post_view($id, $mode, $action) // Check if there is already a warning for this post to prevent multiple // warnings for the same offence - $sql = 'SELECT * FROM ' . WARNINGS_TABLE . " + $sql = 'SELECT post_id + FROM ' . WARNINGS_TABLE . " WHERE post_id = $post_id"; $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if ($row = $db->sql_fetchrow($result)) + if ($row) { trigger_error($user->lang['ALREADY_WARNED']); } - $db->sql_freeresult($result); - + $user_id = $userrow['user_id']; if ($warning && $action == 'add_warning') @@ -237,7 +244,8 @@ function mcp_warn_post_view($id, $mode, $action) // Second parse bbcode here if ($userrow['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); + include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); + $bbcode = new bbcode($userrow['bbcode_bitfield']); $bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']); } @@ -259,14 +267,15 @@ function mcp_warn_post_view($id, $mode, $action) { case AVATAR_UPLOAD: $avatar_img = $config['avatar_path'] . '/'; - break; + break; + case AVATAR_GALLERY: $avatar_img = $config['avatar_gallery_path'] . '/'; - break; + break; } $avatar_img .= $userrow['user_avatar']; - $avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" border="0" alt="" />'; + $avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" alt="" />'; } $template->assign_vars(array( @@ -307,6 +316,11 @@ function mcp_warn_user_view($id, $mode, $action) $userrow = $db->sql_fetchrow($result); $db->sql_freeresult($result); + if (!$userrow) + { + trigger_error('NO_USER'); + } + $user_id = $userrow['user_id']; if ($warning && $action == 'add_warning') @@ -329,14 +343,15 @@ function mcp_warn_user_view($id, $mode, $action) { case AVATAR_UPLOAD: $avatar_img = $config['avatar_path'] . '/'; - break; + break; + case AVATAR_GALLERY: $avatar_img = $config['avatar_gallery_path'] . '/'; - break; + break; } $avatar_img .= $userrow['user_avatar']; - $avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" border="0" alt="" />'; + $avatar_img = '<img src="' . $avatar_img . '" width="' . $userrow['user_avatar_width'] . '" height="' . $userrow['user_avatar_height'] . '" alt="" />'; } // OK, they didn't submit a warning so lets build the page for them to do so @@ -366,13 +381,14 @@ function add_warning($userrow, $warning, $send_pm = true, $post_id = 0) if ($send_pm) { - include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); - include($phpbb_root_path . 'includes/message_parser.'.$phpEx); + include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); $userrow['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $userrow['user_lang'] . "/mcp.$phpEx")) ? $userrow['user_lang'] : $config['default_lang']; - include($phpbb_root_path . 'language/' . $userrow['user_lang'] . "/mcp.$phpEx"); + include($phpbb_root_path . 'language/' . basename($userrow['user_lang']) . "/mcp.$phpEx"); $message_parser = new parse_message(); + $message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning); $message_parser->parse(true, true, true, false, false, true); @@ -412,4 +428,5 @@ function add_warning($userrow, $warning, $send_pm = true, $post_id = 0) WHERE user_id = ' . $userrow['user_id']; $db->sql_query($sql); } + ?>
\ No newline at end of file |