mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 07:58:56 +02:00
Using real counts when displaying unapproved items to keep the page count accurate.
git-svn-id: file:///svn/phpbb/trunk@3738 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
42ec5e67da
commit
e572edb513
@ -157,7 +157,7 @@ if ($forum_data['forum_postable'])
|
|||||||
if ($forum_data['prune_next'] < time() && $forum_data['prune_enable'])
|
if ($forum_data['prune_next'] < time() && $forum_data['prune_enable'])
|
||||||
{
|
{
|
||||||
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
require($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
|
||||||
auto_prune($forum_id);
|
auto_prune($forum_id, $forum_data['prune_days'], $forum_data['prune_freq']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,71 +263,41 @@ if ($forum_data['forum_postable'])
|
|||||||
$topics_list = '';
|
$topics_list = '';
|
||||||
$row_ary = array();
|
$row_ary = array();
|
||||||
|
|
||||||
// if (empty($forum_data['topics_list']))
|
$sql = 'SELECT t.*, lr.lastread_time, lr.lastread_type
|
||||||
// {
|
FROM (' . TOPICS_TABLE . ' t
|
||||||
$sql = 'SELECT t.*, lr.lastread_time, lr.lastread_type
|
LEFT JOIN ' . LASTREAD_TABLE . ' lr ON lr.topic_id = t.topic_id
|
||||||
FROM (' . TOPICS_TABLE . ' t
|
AND lr.user_id = ' . $user->data['user_id'] . ")
|
||||||
LEFT JOIN ' . LASTREAD_TABLE . ' lr ON lr.topic_id = t.topic_id
|
WHERE (t.forum_id = $forum_id
|
||||||
AND lr.user_id = ' . $user->data['user_id'] . ")
|
OR t.forum_id = 0)
|
||||||
WHERE (t.forum_id = $forum_id
|
AND t.topic_type = " . POST_ANNOUNCE . "
|
||||||
OR t.forum_id = 0)
|
ORDER BY $sort_order_sql";
|
||||||
AND t.topic_type = " . POST_ANNOUNCE . "
|
|
||||||
ORDER BY $sort_order_sql";
|
|
||||||
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
|
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
// $topics_list .= '.' . str_pad(base_convert($row['topic_id'], 10, 36), 5, '0', STR_PAD_LEFT);
|
|
||||||
$row_ary[] = $row;
|
|
||||||
$total_topics++;
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
$sql = 'SELECT t.*, lr.lastread_time, lr.lastread_type
|
|
||||||
FROM (' . TOPICS_TABLE . ' t
|
|
||||||
LEFT JOIN ' . LASTREAD_TABLE . ' lr ON lr.topic_id = t.topic_id
|
|
||||||
AND lr.user_id = ' . $user->data['user_id'] . ")
|
|
||||||
WHERE t.forum_id = $forum_id
|
|
||||||
" . (($auth->acl_gets('m_approve', 'a_', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
|
||||||
AND t.topic_type <> " . POST_ANNOUNCE . "
|
|
||||||
$limit_topics_time
|
|
||||||
ORDER BY t.topic_type DESC, $sort_order_sql";
|
|
||||||
/* }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
$topic_ids = array();
|
|
||||||
preg_match_all('/.{5,5}/', $forum_data['topics_list'], $m);// explode('.' ?
|
|
||||||
foreach ($m[0] as $topic_id)
|
|
||||||
{
|
|
||||||
$topic_ids[] = base_convert($topic_id, 36, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2
|
|
||||||
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
|
|
||||||
WHERE t.topic_id IN (" . implode(', ', $topic_ids) . ")
|
|
||||||
AND u.user_id = t.topic_poster
|
|
||||||
AND u2.user_id = t.topic_last_poster_id
|
|
||||||
ORDER BY $sort_order";
|
|
||||||
}*/
|
|
||||||
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
|
$result = $db->sql_query_limit($sql, $config['topics_per_page']);
|
||||||
|
|
||||||
while($row = $db->sql_fetchrow($result))
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
// $topics_list .= str_pad(base_convert($row['topic_id'], 10, 36), 5, '0', STR_PAD_LEFT);
|
|
||||||
$row_ary[] = $row;
|
$row_ary[] = $row;
|
||||||
$total_topics++;
|
$total_topics++;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
/*
|
$sql = 'SELECT t.*, lr.lastread_time, lr.lastread_type
|
||||||
if (empty($forum_data['topics_list']) && !empty($topics_list))
|
FROM (' . TOPICS_TABLE . ' t
|
||||||
|
LEFT JOIN ' . LASTREAD_TABLE . ' lr ON lr.topic_id = t.topic_id
|
||||||
|
AND lr.user_id = ' . $user->data['user_id'] . ")
|
||||||
|
WHERE t.forum_id = $forum_id
|
||||||
|
" . (($auth->acl_gets('m_approve', 'a_', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
||||||
|
AND t.topic_type <> " . POST_ANNOUNCE . "
|
||||||
|
$limit_topics_time
|
||||||
|
ORDER BY t.topic_type DESC, $sort_order_sql";
|
||||||
|
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
||||||
|
|
||||||
|
while($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO ' . TOPICS_PREFETCH_TABLE . " (forum_id, start, sort_key, sort_dir, topics_list)
|
$row_ary[] = $row;
|
||||||
VALUES ($forum_id, $start, '$sort_key', '$sort_dir', '$topics_list')";
|
$total_topics++;
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
*/
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Okay, lets dump out the page ...
|
// Okay, lets dump out the page ...
|
||||||
if ($total_topics)
|
if ($total_topics)
|
||||||
@ -413,7 +383,7 @@ if ($forum_data['forum_postable'])
|
|||||||
|
|
||||||
|
|
||||||
// Goto message generation
|
// Goto message generation
|
||||||
$replies = $row['topic_replies'];
|
$replies = ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'];
|
||||||
|
|
||||||
if (($replies + 1) > intval($config['posts_per_page']))
|
if (($replies + 1) > intval($config['posts_per_page']))
|
||||||
{
|
{
|
||||||
@ -475,7 +445,7 @@ if ($forum_data['forum_postable'])
|
|||||||
'LAST_POST_TIME' => $last_post_time,
|
'LAST_POST_TIME' => $last_post_time,
|
||||||
'LAST_POST_AUTHOR' => $last_post_author,
|
'LAST_POST_AUTHOR' => $last_post_author,
|
||||||
'GOTO_PAGE' => $goto_page,
|
'GOTO_PAGE' => $goto_page,
|
||||||
'REPLIES' => $row['topic_replies'],
|
'REPLIES' => ($auth->acl_get('m_approve')) ? $row['topic_replies_real'] : $row['topic_replies'],
|
||||||
'VIEWS' => $row['topic_views'],
|
'VIEWS' => $row['topic_views'],
|
||||||
'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'],
|
'TOPIC_TITLE' => (!empty($censors)) ? preg_replace($censors['match'], $censors['replace'], $row['topic_title']) : $row['topic_title'],
|
||||||
'TOPIC_TYPE' => $topic_type,
|
'TOPIC_TYPE' => $topic_type,
|
||||||
|
@ -153,7 +153,7 @@ if ($user->data['user_id'] != ANONYMOUS)
|
|||||||
// whereupon we join on the forum_id passed as a parameter ... this
|
// whereupon we join on the forum_id passed as a parameter ... this
|
||||||
// is done so navigation, forum name, etc. remain consistent with where
|
// is done so navigation, forum name, etc. remain consistent with where
|
||||||
// user clicked to view a global topic
|
// user clicked to view a global topic
|
||||||
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style" . $extra_fields . "
|
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, " . (($auth->acl_get('m_approve')) ? 't.topic_replies_real AS topic_replies' : 't.topic_replies') . " , t.topic_time, t.topic_type, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_id, f.forum_style" . $extra_fields . "
|
||||||
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
|
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
|
||||||
WHERE $join_sql
|
WHERE $join_sql
|
||||||
AND (f.forum_id = t.forum_id
|
AND (f.forum_id = t.forum_id
|
||||||
@ -167,6 +167,7 @@ if (!$topic_data = $db->sql_fetchrow($result))
|
|||||||
{
|
{
|
||||||
trigger_error('NO_TOPIC');
|
trigger_error('NO_TOPIC');
|
||||||
}
|
}
|
||||||
|
$topic_data['topic_replies'] = max(0, $topic_data['topic_replies']);
|
||||||
extract($topic_data);
|
extract($topic_data);
|
||||||
|
|
||||||
|
|
||||||
@ -350,8 +351,9 @@ $template->assign_vars(array(
|
|||||||
'MCP' => ($auth->acl_get('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&start=$start&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir&posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
|
'MCP' => ($auth->acl_get('m_', $forum_id)) ? sprintf($user->lang['MCP'], "<a href=\"mcp.$phpEx?sid=" . $user->session_id . "&t=$topic_id&start=$start&sort_days=$sort_days&sort_key=$sort_key&sort_dir=$sort_dir&posts_per_page=" . $config['posts_per_page'] . '">', '</a>') : '',
|
||||||
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : $user->lang['NONE'],
|
'MODERATORS' => (sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : $user->lang['NONE'],
|
||||||
|
|
||||||
'POST_IMG' => $post_img,
|
'POST_IMG' => $post_img,
|
||||||
'REPLY_IMG' => $reply_img,
|
'REPLY_IMG' => $reply_img,
|
||||||
|
'REPORT_IMG' => $user->img('icon_report', $user->lang['REPORT_TO_ADMIN']),
|
||||||
|
|
||||||
'REPORTED_IMG' => $user->img('item_reported', 'POST_BEEN_REPORTED'),
|
'REPORTED_IMG' => $user->img('item_reported', 'POST_BEEN_REPORTED'),
|
||||||
'UNAPPROVED_IMG' => $user->img('item_unapproved', 'POST_NOT_BEEN_APPROVED'),
|
'UNAPPROVED_IMG' => $user->img('item_unapproved', 'POST_NOT_BEEN_APPROVED'),
|
||||||
@ -859,8 +861,6 @@ if ($row = $db->sql_fetchrow($result))
|
|||||||
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_gets('m_', $forum_id)) ? TRUE : FALSE,
|
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_gets('m_', $forum_id)) ? TRUE : FALSE,
|
||||||
'U_REPORT' => "report.$phpEx$SID&p=" . $row['post_id'],
|
'U_REPORT' => "report.$phpEx$SID&p=" . $row['post_id'],
|
||||||
'U_MCP_REPORT' => "mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'],
|
'U_MCP_REPORT' => "mcp.$phpEx$SID&mode=post_details&p=" . $row['post_id'],
|
||||||
// no img yet as I could not get the subSilver to work with PSP - Ashe
|
|
||||||
'REPORT_IMG' => $user->img('icon_report', $user->lang['REPORT_TO_ADMIN']),
|
|
||||||
|
|
||||||
'POST_ICON' => (!empty($row['icon_id'])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
'POST_ICON' => (!empty($row['icon_id'])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user