aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_queue.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2010-03-11 16:03:14 +0100
committerJoas Schilling <nickvergessen@gmx.de>2011-04-07 13:47:06 +0200
commit27fdcb4c7ec4aac68ba0a809473312ee83b50a66 (patch)
treec1cfbdb38e56d49c9b18c97c8560dac8caea4799 /phpBB/includes/mcp/mcp_queue.php
parent3352141264993982215b714ac7a128854494ac1f (diff)
downloadforums-27fdcb4c7ec4aac68ba0a809473312ee83b50a66.tar
forums-27fdcb4c7ec4aac68ba0a809473312ee83b50a66.tar.gz
forums-27fdcb4c7ec4aac68ba0a809473312ee83b50a66.tar.bz2
forums-27fdcb4c7ec4aac68ba0a809473312ee83b50a66.tar.xz
forums-27fdcb4c7ec4aac68ba0a809473312ee83b50a66.zip
[ticket/9684] Remove code in some more files especially includes/
Topic-Tracking is still missing. PHPBB3-9684
Diffstat (limited to 'phpBB/includes/mcp/mcp_queue.php')
-rw-r--r--phpBB/includes/mcp/mcp_queue.php61
1 files changed, 18 insertions, 43 deletions
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index a5e0e426be..0630f55b12 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -268,13 +268,11 @@ class mcp_queue
trigger_error('NOT_MODERATOR');
}
- $global_id = $forum_list[0];
-
$forum_list = implode(', ', $forum_list);
$sql = 'SELECT SUM(forum_topics) as sum_forum_topics
- FROM ' . FORUMS_TABLE . "
- WHERE forum_id IN (0, $forum_list)";
+ 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);
@@ -290,7 +288,6 @@ class mcp_queue
$forum_info = $forum_info[$forum_id];
$forum_list = $forum_id;
- $global_id = $forum_id;
}
$forum_options = '<option value="0"' . (($forum_id == 0) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_FORUMS'] . '</option>';
@@ -312,10 +309,10 @@ class mcp_queue
if ($mode == 'unapproved_posts')
{
$sql = 'SELECT p.post_id
- FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . "
- WHERE p.forum_id IN (0, $forum_list)
+ FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . '
+ WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . '
AND p.post_approved = 0
- " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
+ ' . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . '
' . (($topic_id) ? 'AND p.topic_id = ' . $topic_id : '') . "
AND t.topic_id = p.topic_id
AND t.topic_first_post_id <> p.post_id
@@ -345,10 +342,7 @@ class mcp_queue
$post_data = $rowset = array();
while ($row = $db->sql_fetchrow($result))
{
- if ($row['forum_id'])
- {
- $forum_names[] = $row['forum_id'];
- }
+ $forum_names[] = $row['forum_id'];
$post_data[$row['post_id']] = $row;
}
$db->sql_freeresult($result);
@@ -368,7 +362,7 @@ class mcp_queue
{
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
FROM ' . TOPICS_TABLE . " t
- WHERE forum_id IN (0, $forum_list)
+ WHERE " . $db->sql_in_set('forum_id', $forum_list) . "
AND topic_approved = 0
$limit_time_sql
ORDER BY $sort_order_sql";
@@ -377,10 +371,7 @@ class mcp_queue
$rowset = array();
while ($row = $db->sql_fetchrow($result))
{
- if ($row['forum_id'])
- {
- $forum_names[] = $row['forum_id'];
- }
+ $forum_names[] = $row['forum_id'];
$rowset[] = $row;
}
$db->sql_freeresult($result);
@@ -404,12 +395,6 @@ class mcp_queue
foreach ($rowset as $row)
{
- $global_topic = ($row['forum_id']) ? false : true;
- if ($global_topic)
- {
- $row['forum_id'] = $global_id;
- }
-
if (empty($row['post_username']))
{
$row['post_username'] = $user->lang['GUEST'];
@@ -417,7 +402,7 @@ class mcp_queue
$template->assign_block_vars('postrow', array(
'U_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']),
- 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
+ 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']),
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&amp;start=$start&amp;mode=approve_details&amp;f={$row['forum_id']}&amp;p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&amp;t={$row['topic_id']}" : '')),
@@ -427,7 +412,7 @@ class mcp_queue
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_ID' => $row['post_id'],
- 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'],
+ 'FORUM_NAME' => $forum_names[$row['forum_id']],
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'TOPIC_TITLE' => $row['topic_title'],
'POST_TIME' => $user->format_date($row['post_time']))
@@ -504,11 +489,7 @@ function approve_post($post_id_list, $id, $mode)
}
$topic_id_list[$post_data['topic_id']] = 1;
-
- if ($post_data['forum_id'])
- {
- $forum_id_list[$post_data['forum_id']] = 1;
- }
+ $forum_id_list[$post_data['forum_id']] = 1;
// User post update (we do not care about topic or post, since user posts are strictly connected to posts)
// But we care about forums where post counts get not increased. ;)
@@ -520,10 +501,7 @@ function approve_post($post_id_list, $id, $mode)
// Topic or Post. ;)
if ($post_data['topic_first_post_id'] == $post_id)
{
- if ($post_data['forum_id'])
- {
- $total_topics++;
- }
+ $total_topics++;
$topic_approve_sql[] = $post_data['topic_id'];
$approve_log[] = array(
@@ -543,16 +521,13 @@ function approve_post($post_id_list, $id, $mode)
);
}
- if ($post_data['forum_id'])
- {
- $total_posts++;
+ $total_posts++;
- // Increment by topic_replies if we approve a topic...
- // This works because we do not adjust the topic_replies when re-approving a topic after an edit.
- if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
- {
- $total_posts += $post_data['topic_replies'];
- }
+ // Increment by topic_replies if we approve a topic...
+ // This works because we do not adjust the topic_replies when re-approving a topic after an edit.
+ if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
+ {
+ $total_posts += $post_data['topic_replies'];
}
$post_approve_sql[] = $post_id;