aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_main.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-07-30 14:54:06 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-08-06 16:01:05 -0500
commita2dd99b75e308448c309ce4db807ea0091245443 (patch)
tree1ca8cd81ea39782d57f57c1d8fe296a9b9675af9 /phpBB/includes/ucp/ucp_main.php
parent17681c0770e3a3fb7a4b0ef74e4038c6de787119 (diff)
downloadforums-a2dd99b75e308448c309ce4db807ea0091245443.tar
forums-a2dd99b75e308448c309ce4db807ea0091245443.tar.gz
forums-a2dd99b75e308448c309ce4db807ea0091245443.tar.bz2
forums-a2dd99b75e308448c309ce4db807ea0091245443.tar.xz
forums-a2dd99b75e308448c309ce4db807ea0091245443.zip
[ticket/10885] Fix UCP Main Error if no forums exist
This error is caused by an empty set passed to sql_in_set if the user cannot read any forums PHPBB3-10885
Diffstat (limited to 'phpBB/includes/ucp/ucp_main.php')
-rw-r--r--phpBB/includes/ucp/ucp_main.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index f21ea2471b..94fd59433b 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -69,17 +69,16 @@ class ucp_main
// Get cleaned up list... return only those forums having the f_read permission
$forum_ary = $auth->acl_getf('f_read', true);
$forum_ary = array_unique(array_keys($forum_ary));
-
- $sql = "SELECT t.* $sql_select
- FROM $sql_from
- WHERE t.topic_type = " . POST_GLOBAL . '
- AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . '
- ORDER BY t.topic_last_post_time DESC';
-
$topic_list = $rowset = array();
+
// If the user can't see any forums, he can't read any posts because fid of 0 is invalid
if (!empty($forum_ary))
{
+ $sql = "SELECT t.* $sql_select
+ FROM $sql_from
+ WHERE t.topic_type = " . POST_GLOBAL . '
+ AND ' . $db->sql_in_set('t.forum_id', $forum_ary) . '
+ ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
@@ -671,7 +670,7 @@ class ucp_main
if ($topics_count)
{
phpbb_generate_template_pagination($template, $this->u_action, 'pagination', 'start', $topics_count, $config['topics_per_page'], $start);
-
+
$template->assign_vars(array(
'PAGE_NUMBER' => phpbb_on_page($template, $user, $this->u_action, $topics_count, $config['topics_per_page'], $start),
'TOTAL_TOPICS' => $user->lang('VIEW_FORUM_TOPICS', (int) $topics_count),
@@ -837,7 +836,7 @@ class ucp_main
'U_VIEW_TOPIC' => $view_topic_url,
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
));
-
+
phpbb_generate_template_pagination($template, append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . "&amp;t=$topic_id"), 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
}
}