diff options
Diffstat (limited to 'phpBB/modules/mcp')
-rw-r--r-- | phpBB/modules/mcp/mcp_ban.php | 10 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_forum.php | 38 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_front.php | 40 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_logs.php | 16 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_main.php | 136 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_notes.php | 12 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_post.php | 60 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_queue.php | 66 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_reports.php | 80 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_topic.php | 44 | ||||
-rw-r--r-- | phpBB/modules/mcp/mcp_warn.php | 36 |
11 files changed, 269 insertions, 269 deletions
diff --git a/phpBB/modules/mcp/mcp_ban.php b/phpBB/modules/mcp/mcp_ban.php index b9f6c3e634..0a0452ccf9 100644 --- a/phpBB/modules/mcp/mcp_ban.php +++ b/phpBB/modules/mcp/mcp_ban.php @@ -163,22 +163,22 @@ class mcp_ban $sql = 'SELECT username, user_email, user_ip FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); switch ($mode) { case 'user': - $pre_fill = (string) $db->sql_fetchfield('username'); + $pre_fill = (string) phpbb::$db->sql_fetchfield('username'); break; case 'ip': - $pre_fill = (string) $db->sql_fetchfield('user_ip'); + $pre_fill = (string) phpbb::$db->sql_fetchfield('user_ip'); break; case 'email': - $pre_fill = (string) $db->sql_fetchfield('user_email'); + $pre_fill = (string) phpbb::$db->sql_fetchfield('user_email'); break; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } else if ($post_id) { diff --git a/phpBB/modules/mcp/mcp_forum.php b/phpBB/modules/mcp/mcp_forum.php index d7185bcca6..1a9028d232 100644 --- a/phpBB/modules/mcp/mcp_forum.php +++ b/phpBB/modules/mcp/mcp_forum.php @@ -154,26 +154,26 @@ function mcp_forum_view($id, $mode, $action, $forum_info) " . ((phpbb::$acl->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql"; - $result = $db->sql_query_limit($sql, $topics_per_page, $start); + $result = phpbb::$db->sql_query_limit($sql, $topics_per_page, $start); $topic_list = $topic_tracking_info = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_list[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = "SELECT t.*$read_tracking_select FROM " . TOPICS_TABLE . " t $read_tracking_join - WHERE " . $db->sql_in_set('t.topic_id', $topic_list, false, true); + WHERE " . phpbb::$db->sql_in_set('t.topic_id', $topic_list, false, true); - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_rows[$row['topic_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync if (!sizeof($topic_list) && $forum_topics && $start > 0) @@ -312,15 +312,15 @@ function mcp_resync_topics($topic_ids) $sql = 'SELECT topic_id, forum_id, topic_title FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); // Log this action - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $msg = (sizeof($topic_ids) == 1) ? phpbb::$user->lang['TOPIC_RESYNC_SUCCESS'] : phpbb::$user->lang['TOPICS_RESYNC_SUCCESS']; @@ -365,15 +365,15 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) { $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); $post_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_id_list[] = $row['post_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!sizeof($post_id_list)) @@ -414,11 +414,11 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) // If the topic no longer exist, we will update the topic watch table. // To not let it error out on users watching both topics, we just return on an error... - $db->sql_return_on_error(true); - $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); - $db->sql_return_on_error(false); + phpbb::$db->sql_return_on_error(true); + phpbb::$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids)); + phpbb::$db->sql_return_on_error(false); - $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + phpbb::$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids)); // Link to the new topic $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); diff --git a/phpBB/modules/mcp/mcp_front.php b/phpBB/modules/mcp/mcp_front.php index 95b12e9a7b..932c5e9b1e 100644 --- a/phpBB/modules/mcp/mcp_front.php +++ b/phpBB/modules/mcp/mcp_front.php @@ -40,9 +40,9 @@ function mcp_front_view($id, $mode, $action) FROM ' . POSTS_TABLE . ' WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') AND post_approved = 0'; - $result = $db->sql_query($sql); - $total = (int) $db->sql_fetchfield('total'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $total = (int) phpbb::$db->sql_fetchfield('total'); + phpbb::$db->sql_freeresult($result); if ($total) { @@ -50,27 +50,27 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_list); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_list); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') AND post_approved = 0 ORDER BY post_time DESC'; - $result = $db->sql_query_limit($sql, 5); + $result = phpbb::$db->sql_query_limit($sql, 5); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_list[] = $row['post_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (empty($post_list)) { @@ -82,13 +82,13 @@ function mcp_front_view($id, $mode, $action) { $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('p.post_id', $post_list) . ' + WHERE ' . phpbb::$db->sql_in_set('p.post_id', $post_list) . ' AND t.topic_id = p.topic_id AND p.poster_id = u.user_id ORDER BY p.post_time DESC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) @@ -115,7 +115,7 @@ function mcp_front_view($id, $mode, $action) 'POST_TIME' => phpbb::$user->format_date($row['post_time'])) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } $template->assign_vars(array( @@ -153,15 +153,15 @@ function mcp_front_view($id, $mode, $action) WHERE r.post_id = p.post_id AND r.report_closed = 0 AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')'; - $result = $db->sql_query($sql); - $total = (int) $db->sql_fetchfield('total'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $total = (int) phpbb::$db->sql_fetchfield('total'); + phpbb::$db->sql_freeresult($result); if ($total) { $global_id = $forum_list[0]; - $sql = $db->sql_build_query('SELECT', array( + $sql = phpbb::$db->sql_build_query('SELECT', array( 'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name', 'FROM' => array( @@ -189,9 +189,9 @@ function mcp_front_view($id, $mode, $action) 'ORDER_BY' => 'p.post_time DESC' )); - $result = $db->sql_query_limit($sql, 5); + $result = phpbb::$db->sql_query_limit($sql, 5); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) diff --git a/phpBB/modules/mcp/mcp_logs.php b/phpBB/modules/mcp/mcp_logs.php index 026609e09f..5fe8ff1df1 100644 --- a/phpBB/modules/mcp/mcp_logs.php +++ b/phpBB/modules/mcp/mcp_logs.php @@ -87,9 +87,9 @@ class mcp_logs $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $topic_id; - $result = $db->sql_query($sql); - $forum_id = (int) $db->sql_fetchfield('forum_id'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $forum_id = (int) phpbb::$db->sql_fetchfield('forum_id'); + phpbb::$db->sql_freeresult($result); if (!in_array($forum_id, $forum_list)) { @@ -109,9 +109,9 @@ class mcp_logs { $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND ' . $db->sql_in_set('log_id', $marked); - $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('forum_id', $forum_list) . ' + AND ' . phpbb::$db->sql_in_set('log_id', $marked); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_MOD'); } @@ -119,13 +119,13 @@ class mcp_logs { $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list); + AND ' . phpbb::$db->sql_in_set('forum_id', $forum_list); if ($mode == 'topic_logs') { $sql .= ' AND topic_id = ' . $topic_id; } - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_MOD'); } diff --git a/phpBB/modules/mcp/mcp_main.php b/phpBB/modules/mcp/mcp_main.php index 73b4e880ea..2d172075ca 100644 --- a/phpBB/modules/mcp/mcp_main.php +++ b/phpBB/modules/mcp/mcp_main.php @@ -245,8 +245,8 @@ function lock_unlock($action, $ids) { $sql = "UPDATE $table SET $set_id = " . (($action == 'lock' || $action == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . ' - WHERE ' . $db->sql_in_set($sql_id, $ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set($sql_id, $ids); + phpbb::$db->sql_query($sql); $data = ($action == 'lock' || $action == 'unlock') ? get_topic_data($ids) : get_post_data($ids); @@ -332,9 +332,9 @@ function change_topic_type($action, $topic_ids) { $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_type = $new_topic_type - WHERE " . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id <> 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Reset forum id if a global topic is within the array $to_forum_id = request_var('to_forum_id', 0); @@ -343,24 +343,24 @@ function change_topic_type($action, $topic_ids) { $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_type = $new_topic_type, forum_id = $to_forum_id - WHERE " . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id = 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Update forum_ids for all posts $sql = 'UPDATE ' . POSTS_TABLE . " SET forum_id = $to_forum_id - WHERE " . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id = 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Do a little forum sync stuff $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids); - $result = $db->sql_query($sql); - $row_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); + $row_data = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sync_sql = array(); @@ -381,7 +381,7 @@ function change_topic_type($action, $topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } sync('forum', 'forum_id', $to_forum_id); @@ -392,42 +392,42 @@ function change_topic_type($action, $topic_ids) // Get away with those topics already being a global announcement by re-calculating $topic_ids $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id <> 0'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_ids[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($topic_ids)) { // Delete topic shadows for global announcements $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_moved_id', $topic_ids); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_type = $new_topic_type, forum_id = 0 - WHERE " . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids); + phpbb::$db->sql_query($sql); // Update forum_ids for all posts $sql = 'UPDATE ' . POSTS_TABLE . ' SET forum_id = 0 - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids); + phpbb::$db->sql_query($sql); // Do a little forum sync stuff $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids); - $result = $db->sql_query($sql); - $row_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); + $row_data = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sync_sql = array(); @@ -448,7 +448,7 @@ function change_topic_type($action, $topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } sync('forum', 'forum_id', $forum_id); @@ -476,11 +476,11 @@ function change_topic_type($action, $topic_ids) { $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id = 0'; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -593,14 +593,14 @@ function mcp_move_topic($topic_ids) } } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids); - $result = $db->sql_query($sql); - $row_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); + $row_data = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sync_sql = array(); @@ -633,7 +633,7 @@ function mcp_move_topic($topic_ids) $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_type = ' . POST_ANNOUNCE . ' WHERE topic_id = ' . (int) $row['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Leave a redirection if required and only if the topic is visible to users @@ -674,7 +674,7 @@ function mcp_move_topic($topic_ids) 'poll_last_vote' => (int) $row['poll_last_vote'] ); - $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); + phpbb::$db->sql_query('INSERT INTO ' . TOPICS_TABLE . phpbb::$db->sql_build_array('INSERT', $shadow)); $topics_authed_moved--; $topics_moved--; @@ -696,10 +696,10 @@ function mcp_move_topic($topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); sync('forum', 'forum_id', array($forum_id, $to_forum_id)); } @@ -830,16 +830,16 @@ function mcp_delete_post($post_ids) $sql = 'SELECT DISTINCT topic_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_id', $post_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $post_ids); + $result = phpbb::$db->sql_query($sql); $topic_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_id_list[] = $row['topic_id']; } $affected_topics = sizeof($topic_id_list); - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $post_data = get_post_data($post_ids); @@ -853,11 +853,11 @@ function mcp_delete_post($post_ids) $sql = 'SELECT COUNT(topic_id) AS topics_left FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_id_list); - $result = $db->sql_query_limit($sql, 1); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_id_list); + $result = phpbb::$db->sql_query_limit($sql, 1); - $deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics; - $db->sql_freeresult($result); + $deleted_topics = ($row = phpbb::$db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics; + phpbb::$db->sql_freeresult($result); $topic_id = request_var('t', 0); @@ -1001,8 +1001,8 @@ function mcp_fork_topic($topic_ids) 'poll_length' => (int) $topic_row['poll_length'] ); - $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - $new_topic_id = $db->sql_nextid(); + phpbb::$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); + $new_topic_id = phpbb::$db->sql_nextid(); $new_topic_id_list[$topic_id] = $new_topic_id; if ($topic_row['poll_start']) @@ -1012,9 +1012,9 @@ function mcp_fork_topic($topic_ids) $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . " WHERE topic_id = $topic_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_ary = array( 'poll_option_id' => (int) $row['poll_option_id'], @@ -1023,7 +1023,7 @@ function mcp_fork_topic($topic_ids) 'poll_option_total' => 0 ); - $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } } @@ -1031,14 +1031,14 @@ function mcp_fork_topic($topic_ids) FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id ORDER BY post_time ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $post_rows = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_rows[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (!sizeof($post_rows)) { @@ -1076,8 +1076,8 @@ function mcp_fork_topic($topic_ids) 'post_postcount' => 0, ); - $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - $new_post_id = $db->sql_nextid(); + phpbb::$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); + $new_post_id = phpbb::$db->sql_nextid(); // Copy whether the topic is dotted markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']); @@ -1089,10 +1089,10 @@ function mcp_fork_topic($topic_ids) WHERE post_msg_id = {$row['post_id']} AND topic_id = $topic_id AND in_message = 0"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $sql_ary = array(); - while ($attach_row = $db->sql_fetchrow($result)) + while ($attach_row = phpbb::$db->sql_fetchrow($result)) { $sql_ary[] = array( 'post_msg_id' => (int) $new_post_id, @@ -1111,11 +1111,11 @@ function mcp_fork_topic($topic_ids) 'thumbnail' => (int) $attach_row['thumbnail'] ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($sql_ary)) { - $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); } } } @@ -1123,10 +1123,10 @@ function mcp_fork_topic($topic_ids) $sql = 'SELECT user_id, notify_status FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . $topic_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_ary[] = array( 'topic_id' => (int) $new_topic_id, @@ -1134,11 +1134,11 @@ function mcp_fork_topic($topic_ids) 'notify_status' => (int) $row['notify_status'], ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($sql_ary)) { - $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } } @@ -1156,7 +1156,7 @@ function mcp_fork_topic($topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } sync('forum', 'forum_id', $to_forum_id); diff --git a/phpBB/modules/mcp/mcp_notes.php b/phpBB/modules/mcp/mcp_notes.php index ae5c975ccf..44dcec52c6 100644 --- a/phpBB/modules/mcp/mcp_notes.php +++ b/phpBB/modules/mcp/mcp_notes.php @@ -78,14 +78,14 @@ class mcp_notes add_form_key('mcp_notes'); - $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; $sql = 'SELECT * FROM ' . USERS_TABLE . " WHERE $sql_where"; - $result = $db->sql_query($sql); - $userrow = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $userrow = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$userrow) { @@ -119,7 +119,7 @@ class mcp_notes { $sql_in[] = $mark; } - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + $where_sql = ' AND ' . phpbb::$db->sql_in_set('log_id', $sql_in); unset($sql_in); } @@ -131,7 +131,7 @@ class mcp_notes WHERE log_type = ' . LOG_USERS . " AND reportee_id = $user_id $where_sql"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_USER', $userrow['username']); diff --git a/phpBB/modules/mcp/mcp_post.php b/phpBB/modules/mcp/mcp_post.php index 0ba2becec1..0c21fc5dc5 100644 --- a/phpBB/modules/mcp/mcp_post.php +++ b/phpBB/modules/mcp/mcp_post.php @@ -68,7 +68,7 @@ function mcp_post_details($id, $mode, $action) if ($action == 'chgposter') { $username = request_var('username', '', true); - $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_where = "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; } else { @@ -79,9 +79,9 @@ function mcp_post_details($id, $mode, $action) $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $sql_where; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -145,13 +145,13 @@ function mcp_post_details($id, $mode, $action) WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($attachments)) { @@ -252,9 +252,9 @@ function mcp_post_details($id, $mode, $action) AND r.reason_id = re.reason_id AND u.user_id = r.user_id ORDER BY r.report_time DESC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_var('S_SHOW_REPORTS', true); @@ -278,9 +278,9 @@ function mcp_post_details($id, $mode, $action) 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), )); } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // Get IP @@ -298,12 +298,12 @@ function mcp_post_details($id, $mode, $action) // Get other users who've posted under this IP $sql = 'SELECT poster_id, COUNT(poster_id) as postings FROM ' . POSTS_TABLE . " - WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "' + WHERE poster_ip = '" . phpbb::$db->sql_escape($post_info['poster_ip']) . "' GROUP BY poster_id ORDER BY postings DESC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Fill the user select list with users who have posted under this IP if ($row['poster_id'] != $post_info['poster_id']) @@ -311,22 +311,22 @@ function mcp_post_details($id, $mode, $action) $users_ary[$row['poster_id']] = $row; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($users_ary)) { // Get the usernames $sql = 'SELECT user_id, username FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_keys($users_ary)); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', array_keys($users_ary)); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $users_ary[$row['user_id']]['username'] = $row['username']; $usernames_ary[utf8_clean_string($row['username'])] = $users_ary[$row['user_id']]; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($users_ary as $user_id => $user_row) { @@ -352,9 +352,9 @@ function mcp_post_details($id, $mode, $action) WHERE poster_id = ' . $post_info['poster_id'] . " GROUP BY poster_ip ORDER BY postings DESC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : ''; @@ -368,7 +368,7 @@ function mcp_post_details($id, $mode, $action) 'U_WHOIS' => append_sid('mcp', "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}")) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $user_select = ''; @@ -402,7 +402,7 @@ function change_poster(&$post_info, $userdata) $sql = 'UPDATE ' . POSTS_TABLE . " SET poster_id = {$userdata['user_id']} WHERE post_id = $post_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Resync topic/forum if needed if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id || $post_info['topic_first_post_id'] == $post_id) @@ -418,12 +418,12 @@ function change_poster(&$post_info, $userdata) SET user_posts = user_posts - 1 WHERE user_id = ' . $post_info['user_id'] .' AND user_posts > 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + 1 WHERE user_id = ' . $userdata['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Add posted to information for this topic for the new user @@ -436,16 +436,16 @@ function change_poster(&$post_info, $userdata) FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $post_info['topic_id'] . ' AND poster_id = ' . $post_info['user_id']; - $result = $db->sql_query_limit($sql, 1); - $topic_id = (int) $db->sql_fetchfield('topic_id'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $topic_id = (int) phpbb::$db->sql_fetchfield('topic_id'); + phpbb::$db->sql_freeresult($result); if (!$topic_id) { $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' WHERE user_id = ' . $post_info['user_id'] . ' AND topic_id = ' . $post_info['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -457,7 +457,7 @@ function change_poster(&$post_info, $userdata) WHERE poster_id = ' . $post_info['user_id'] . ' AND post_msg_id = ' . $post_info['post_id'] . ' AND topic_id = ' . $post_info['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // refresh search cache of this post diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php index 27db877836..b429ffea32 100644 --- a/phpBB/modules/mcp/mcp_queue.php +++ b/phpBB/modules/mcp/mcp_queue.php @@ -146,13 +146,13 @@ class mcp_queue WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($attachments)) { @@ -273,9 +273,9 @@ class mcp_queue $sql = 'SELECT SUM(forum_topics) as sum_forum_topics FROM ' . FORUMS_TABLE . " WHERE forum_id IN (0, $forum_list)"; - $result = $db->sql_query($sql); - $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $forum_info['forum_topics'] = (int) phpbb::$db->sql_fetchfield('sum_forum_topics'); + phpbb::$db->sql_freeresult($result); } else { @@ -319,29 +319,29 @@ class mcp_queue AND t.topic_first_post_id <> p.post_id $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $i = 0; $post_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_ids[] = $row['post_id']; $row_num[$row['post_id']] = $i++; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($post_ids)) { $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('p.post_id', $post_ids) . ' AND t.topic_id = p.topic_id AND u.user_id = p.poster_id ORDER BY ' . $sort_order_sql; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $post_data = $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['forum_id']) { @@ -349,7 +349,7 @@ class mcp_queue } $post_data[$row['post_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($post_ids as $post_id) { @@ -370,10 +370,10 @@ class mcp_queue AND topic_approved = 0 $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['forum_id']) { @@ -381,7 +381,7 @@ class mcp_queue } $rowset[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (sizeof($forum_names)) @@ -389,15 +389,15 @@ class mcp_queue // Select the names for the forum_ids $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_names); - $result = $db->sql_query($sql, 3600); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_names); + $result = phpbb::$db->sql_query($sql, 3600); $forum_names = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } foreach ($rowset as $row) @@ -584,16 +584,16 @@ function approve_post($post_id_list, $id, $mode) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_approved = 1 - WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_approve_sql); + phpbb::$db->sql_query($sql); } if (sizeof($post_approve_sql)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_approved = 1 - WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $post_approve_sql); + phpbb::$db->sql_query($sql); } foreach ($approve_log as $log_data) @@ -608,7 +608,7 @@ function approve_post($post_id_list, $id, $mode) $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_replies = topic_replies + $num_replies WHERE topic_id = $topic_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -623,7 +623,7 @@ function approve_post($post_id_list, $id, $mode) $sql .= ($row['forum_posts']) ? "forum_posts = forum_posts + {$row['forum_posts']}" : ''; $sql .= " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -641,8 +641,8 @@ function approve_post($post_id_list, $id, $mode) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + ' . $user_posts . ' - WHERE ' . $db->sql_in_set('user_id', $user_id_ary); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', $user_id_ary); + phpbb::$db->sql_query($sql); } } @@ -810,9 +810,9 @@ function disapprove_post($post_id_list, $id, $mode) $sql = 'SELECT reason_title, reason_description FROM ' . REPORTS_REASONS_TABLE . " WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row || (!$reason && strtolower($row['reason_title']) == 'other')) { @@ -904,7 +904,7 @@ function disapprove_post($post_id_list, $id, $mode) $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_topics_real = forum_topics_real - $topics_real WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -915,7 +915,7 @@ function disapprove_post($post_id_list, $id, $mode) $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_replies_real = topic_replies_real - $num_replies WHERE topic_id = $topic_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } diff --git a/phpBB/modules/mcp/mcp_reports.php b/phpBB/modules/mcp/mcp_reports.php index 5deaa7a728..d79abb209e 100644 --- a/phpBB/modules/mcp/mcp_reports.php +++ b/phpBB/modules/mcp/mcp_reports.php @@ -77,9 +77,9 @@ class mcp_reports AND rr.reason_id = r.reason_id AND r.user_id = u.user_id ORDER BY report_closed ASC'; - $result = $db->sql_query_limit($sql, 1); - $report = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $report = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$report) { @@ -155,13 +155,13 @@ class mcp_reports WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($attachments)) { @@ -292,10 +292,10 @@ class mcp_reports $sql = 'SELECT SUM(forum_topics) as sum_forum_topics FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_list); - $result = $db->sql_query($sql); - $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_list); + $result = phpbb::$db->sql_query($sql); + $forum_info['forum_topics'] = (int) phpbb::$db->sql_fetchfield('sum_forum_topics'); + phpbb::$db->sql_freeresult($result); } else { @@ -341,7 +341,7 @@ class mcp_reports $sql = 'SELECT r.report_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . ' - WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . " + WHERE ' . phpbb::$db->sql_in_set('p.forum_id', $forum_list) . " $report_state AND r.post_id = p.post_id " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . ' @@ -350,31 +350,31 @@ class mcp_reports AND t.topic_id = p.topic_id $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $i = 0; $report_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $report_ids[] = $row['report_id']; $row_num[$row['report_id']] = $i++; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($report_ids)) { $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru - WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_ids) . ' AND t.topic_id = p.topic_id AND r.post_id = p.post_id AND u.user_id = p.poster_id AND ru.user_id = r.user_id ORDER BY ' . $sort_order_sql; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $report_data = $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) @@ -406,7 +406,7 @@ class mcp_reports 'TOPIC_TITLE' => $row['topic_title']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); unset($report_ids, $row); } @@ -441,11 +441,11 @@ function close_report($report_id_list, $mode, $action) { $sql = 'SELECT r.post_id FROM ' . REPORTS_TABLE . ' r - WHERE ' . $db->sql_in_set('r.report_id', $report_id_list); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_id_list); + $result = phpbb::$db->sql_query($sql); $post_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_id_list[] = $row['post_id']; } @@ -486,13 +486,13 @@ function close_report($report_id_list, $mode, $action) $sql = 'SELECT r.report_id, r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . ' + WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_id_list) . ' ' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . ' AND r.user_id = u.user_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array(); - while ($report = $db->sql_fetchrow($result)) + while ($report = phpbb::$db->sql_fetchrow($result)) { $reports[$report['report_id']] = $report; $report_id_list[] = $report['report_id']; @@ -508,7 +508,7 @@ function close_report($report_id_list, $mode, $action) $notify_reporters[$report['report_id']] = &$reports[$report['report_id']]; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($reports)) { @@ -520,56 +520,56 @@ function close_report($report_id_list, $mode, $action) // Get a list of topics that still contain reported posts $sql = 'SELECT DISTINCT topic_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $close_report_topics) . ' AND post_reported = 1 - AND ' . $db->sql_in_set('post_id', $close_report_posts, true); - $result = $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('post_id', $close_report_posts, true); + $result = phpbb::$db->sql_query($sql); $keep_report_topics = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $keep_report_topics[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $close_report_topics = array_diff($close_report_topics, $keep_report_topics); unset($keep_report_topics); } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); if ($action == 'close') { $sql = 'UPDATE ' . REPORTS_TABLE . ' SET report_closed = 1 - WHERE ' . $db->sql_in_set('report_id', $report_id_list); + WHERE ' . phpbb::$db->sql_in_set('report_id', $report_id_list); } else { $sql = 'DELETE FROM ' . REPORTS_TABLE . ' - WHERE ' . $db->sql_in_set('report_id', $report_id_list); + WHERE ' . phpbb::$db->sql_in_set('report_id', $report_id_list); } - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if (sizeof($close_report_posts)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_reported = 0 - WHERE ' . $db->sql_in_set('post_id', $close_report_posts); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $close_report_posts); + phpbb::$db->sql_query($sql); if (sizeof($close_report_topics)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 0 - WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . ' - OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $close_report_topics) . ' + OR ' . phpbb::$db->sql_in_set('topic_moved_id', $close_report_topics); + phpbb::$db->sql_query($sql); } } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); } unset($close_report_posts, $close_report_topics); diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php index 8f645be185..ab7bd0e983 100644 --- a/phpBB/modules/mcp/mcp_topic.php +++ b/phpBB/modules/mcp/mcp_topic.php @@ -131,17 +131,17 @@ function mcp_topic_view($id, $mode, $action) AND p.poster_id = u.user_id ' . $limit_time_sql . ' ORDER BY ' . $sort_order_sql; - $result = $db->sql_query_limit($sql, $posts_per_page, $start); + $result = phpbb::$db->sql_query_limit($sql, $posts_per_page, $start); $rowset = $post_id_list = array(); $bbcode_bitfield = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $rowset[] = $row; $post_id_list[] = $row['post_id']; $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($bbcode_bitfield !== '') { @@ -176,16 +176,16 @@ function mcp_topic_view($id, $mode, $action) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_msg_id', $post_id_list) . ' + WHERE ' . phpbb::$db->sql_in_set('post_msg_id', $post_id_list) . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[$row['post_msg_id']][] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -435,11 +435,11 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $limit_time_sql ORDER BY $sort_order_sql"; } - $result = $db->sql_query_limit($sql, 0, $start); + $result = phpbb::$db->sql_query_limit($sql, 0, $start); $store = false; $post_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // If split from selected post (split_beyond), we split the unapproved items too. if (!$row['post_approved'] && !phpbb::$acl->acl_get('m_approve', $row['forum_id'])) @@ -458,7 +458,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $post_id_list[] = $row['post_id']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!sizeof($post_id_list)) @@ -475,10 +475,10 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) 'topic_approved'=> 1 ); - $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); + phpbb::$db->sql_query($sql); - $to_topic_id = $db->sql_nextid(); + $to_topic_id = phpbb::$db->sql_nextid(); move_posts($post_id_list, $to_topic_id); $topic_info = get_topic_data(array($topic_id)); @@ -489,9 +489,9 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) // Change topic title of first post $sql = 'UPDATE ' . POSTS_TABLE . " - SET post_subject = '" . $db->sql_escape($subject) . "' + SET post_subject = '" . phpbb::$db->sql_escape($subject) . "' WHERE post_id = {$post_id_list[0]}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $success_msg = 'TOPIC_SPLIT_SUCCESS'; @@ -583,9 +583,9 @@ function merge_posts($topic_id, $to_topic_id) $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $topic_id; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -595,11 +595,11 @@ function merge_posts($topic_id, $to_topic_id) { // If the topic no longer exist, we will update the topic watch table. // To not let it error out on users watching both topics, we just return on an error... - $db->sql_return_on_error(true); - $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); - $db->sql_return_on_error(false); + phpbb::$db->sql_return_on_error(true); + phpbb::$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); + phpbb::$db->sql_return_on_error(false); - $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id); + phpbb::$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id); } // Link to the new topic diff --git a/phpBB/modules/mcp/mcp_warn.php b/phpBB/modules/mcp/mcp_warn.php index 05e994858a..d3fbdccc2c 100644 --- a/phpBB/modules/mcp/mcp_warn.php +++ b/phpBB/modules/mcp/mcp_warn.php @@ -105,9 +105,9 @@ class mcp_warn FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w WHERE u.user_id = w.user_id ORDER BY w.warning_time DESC'; - $result = $db->sql_query_limit($sql, 5); + $result = phpbb::$db->sql_query_limit($sql, 5); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('latest', array( 'U_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $row['user_id']), @@ -121,7 +121,7 @@ class mcp_warn 'WARNINGS' => $row['user_warnings'], )); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } /** @@ -194,9 +194,9 @@ class mcp_warn FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u WHERE post_id = $post_id AND u.user_id = p.poster_id"; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -220,9 +220,9 @@ class mcp_warn $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); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -331,14 +331,14 @@ class mcp_warn $notify = phpbb_request::is_set('notify_user'); $warning = utf8_normalize_nfc(request_var('warning', '', true)); - $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $sql_where; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -470,21 +470,21 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) 'warning_time' => time(), ); - $db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_warnings = user_warnings + 1, user_last_warning = ' . time() . ' WHERE user_id = ' . $user_row['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // We add this to the mod log too for moderators to see that a specific user got warned. $sql = 'SELECT forum_id, topic_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $post_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']); } |