Correctly display topic in MCP when start parameter is equal to or greater than the number of posts. #30525

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9023 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Chris Smith 2008-10-16 19:12:12 +00:00
parent a2e454262b
commit 77058f31c2
2 changed files with 8 additions and 0 deletions

View file

@ -148,6 +148,7 @@
<li>[Fix] Forum last post information is now correctly updated when a topic/post is disapproved due to editing. (Bug #24475)</li> <li>[Fix] Forum last post information is now correctly updated when a topic/post is disapproved due to editing. (Bug #24475)</li>
<li>[Fix] Moderators can only see reports/queue/logs from forums they can actually read. (Bug #31085)</li> <li>[Fix] Moderators can only see reports/queue/logs from forums they can actually read. (Bug #31085)</li>
<li>[Fix] Correctly display topic when start parameter is equal to the number of posts.</li> <li>[Fix] Correctly display topic when start parameter is equal to the number of posts.</li>
<li>[Fix] Correctly display topic in MCP when start parameter is equal to or greater than the number of posts. (Bug #30525)</li>
<li>[Change] No longer allow the direct use of MULTI_INSERT in sql_build_array. sql_multi_insert() must be used.</li> <li>[Change] No longer allow the direct use of MULTI_INSERT in sql_build_array. sql_multi_insert() must be used.</li>
<li>[Change] Display warning in ACP if config.php file is left writable.</li> <li>[Change] Display warning in ACP if config.php file is left writable.</li>

View file

@ -114,11 +114,18 @@ function mcp_topic_view($id, $mode, $action)
{ {
$posts_per_page = $total; $posts_per_page = $total;
} }
if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page) if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page)
{ {
$start = 0; $start = 0;
} }
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start >= $total)
{
$start = ($start < 0) ? 0 : floor(($total - 1) / $posts_per_page) * $posts_per_page;
}
$sql = 'SELECT u.username, u.username_clean, u.user_colour, p.* $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.*
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . ' WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '