aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-02-27 15:58:07 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-02-27 15:58:07 +0000
commit66062783ce4f2bba642cb2075a42b16c425f941c (patch)
tree54e4b4e740b7f340d9c2b7ca979a72209c375573 /phpBB
parentce4e06811c3a6f6a30812428142139de9259a005 (diff)
downloadforums-66062783ce4f2bba642cb2075a42b16c425f941c.tar
forums-66062783ce4f2bba642cb2075a42b16c425f941c.tar.gz
forums-66062783ce4f2bba642cb2075a42b16c425f941c.tar.bz2
forums-66062783ce4f2bba642cb2075a42b16c425f941c.tar.xz
forums-66062783ce4f2bba642cb2075a42b16c425f941c.zip
Potential (display) support for global announcements ... various issues still need to addressed wrt posting/replying/etc.
git-svn-id: file:///svn/phpbb/trunk@3567 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/viewforum.php7
-rw-r--r--phpBB/viewtopic.php29
2 files changed, 21 insertions, 15 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index eed996e06a..8634a4a7a3 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -184,9 +184,6 @@ if ($forum_data['forum_postable'])
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir);
// Limit topics to certain time frame, obtain correct topic count
- $topics_count = ($forum_data['forum_topics']) ? $forum_data['forum_topics'] : 1;
- $limit_topics_time = $topic_days = '';
-
if ($sort_days)
{
$min_topic_time = time() - ($sort_days * 86400);
@@ -205,6 +202,7 @@ if ($forum_data['forum_postable'])
else
{
$topics_count = ($forum_data['forum_topics']) ? $forum_data['forum_topics'] : 1;
+ $limit_topics_time = '';
}
// Select the sort order
@@ -263,7 +261,8 @@ if ($forum_data['forum_postable'])
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 IN ($forum_id, 0)
+ WHERE (t.forum_id = $forum_id
+ OR t.forum_id = 0)
AND t.topic_type = " . POST_ANNOUNCE . "
ORDER BY $sort_order_sql
LIMIT " . $config['topics_per_page'];
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index ff150774c8..f1b13702ed 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -121,9 +121,9 @@ if ($user->data['user_id'] != ANONYMOUS)
{
switch (SQL_LAYER)
{
- //TODO
case 'oracle':
- break;
+ // TODO
+ break;
default:
$extra_fields .= ', tw.notify_status';
@@ -132,11 +132,17 @@ if ($user->data['user_id'] != ANONYMOUS)
}
}
+// Join to forum table on topic forum_id unless topic forum_id is zero
+// whereupon we join on the forum_id passed as a parameter ... this
+// is done so navigation, forum name, etc. remain consistent with where
+// 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 . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
- AND ( f.forum_id = t.forum_id
- OR f.forum_id = $forum_id )
+ AND (f.forum_id = t.forum_id
+ OR (t.forum_id = 0 AND
+ f.forum_id = $forum_id)
+ )
$order_sql";
$result = $db->sql_query($sql);
@@ -148,12 +154,12 @@ extract($topic_data);
// Configure style, language, etc.
-$user->setup(false, intval($forum_style));
-$auth->acl($user->data, intval($forum_id));
+$user->setup(false, $forum_style);
+$auth->acl($user->data);
// Start auth check
-if (!$auth->acl_gets('f_read', 'm_', 'a_', intval($forum_id)))
+if (!$auth->acl_gets('f_read', 'm_', 'a_', $forum_id))
{
if ($user->data['user_id'] == ANONYMOUS)
{
@@ -188,12 +194,8 @@ $sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_sub
$s_limit_days = $s_sort_key = $s_sort_dir = '';
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir);
-
// Obtain correct post count and ordering SQL if user has
// requested anything different
-$limit_posts_time = '';
-$total_posts = $topic_replies + 1;
-
if ($sort_days)
{
$min_post_time = time() - ($sort_days * 86400);
@@ -209,6 +211,11 @@ if ($sort_days)
$total_posts = ($row = $db->sql_fetchrow($result)) ? $row['num_posts'] : 0;
$limit_posts_time = "AND p.post_time >= $min_post_time ";
}
+else
+{
+ $total_posts = $topic_replies + 1;
+ $limit_posts_time = '';
+}
// Select the sort order
$sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');