aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-04-22 16:18:40 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-04-22 16:18:40 +0000
commit856650861f0c454b800fe816ba2592444ef13894 (patch)
treed73a41902d1d58784c7502c94ce4d03998131e0a /phpBB/viewtopic.php
parent68c349fdc1ad29ff3c80961297db31b1e725973f (diff)
downloadforums-856650861f0c454b800fe816ba2592444ef13894.tar
forums-856650861f0c454b800fe816ba2592444ef13894.tar.gz
forums-856650861f0c454b800fe816ba2592444ef13894.tar.bz2
forums-856650861f0c454b800fe816ba2592444ef13894.tar.xz
forums-856650861f0c454b800fe816ba2592444ef13894.zip
- removed group settings from roles
- added forum icon in front of forums in permissions acp - added trace permissions in permission masks (thanks naderman for writing the first code and for the idea... :)) - some bugfixes - PHP6 fix git-svn-id: file:///svn/phpbb/trunk@5824 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php25
1 files changed, 12 insertions, 13 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index afffb21b51..c25c152560 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -51,17 +51,14 @@ if ($view && !$post_id)
{
$sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . "
WHERE topic_id = $topic_id";
- $db->sql_query_limit($sql, 1);
$result = $db->sql_query($sql);
- if ($row = $db->sql_fetchrow($result))
- {
- $forum_id = $row['forum_id'];
- }
- else
+ $forum_id = (int) $db->sql_fetchfield('forum_id');
+ $db->sql_freeresult($result);
+
+ if (!$forum_id)
{
trigger_error('NO_TOPIC');
}
- $db->sql_freeresult($result);
}
if ($view == 'unread')
@@ -80,8 +77,10 @@ if ($view && !$post_id)
OR p.post_id = t.topic_last_post_id)
ORDER BY p.post_time ASC";
$result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- if (!($row = $db->sql_fetchrow($result)))
+ if (!$row)
{
// Setup user environment so we can process lang string
$user->setup('viewtopic');
@@ -90,7 +89,6 @@ if ($view && !$post_id)
$message = $user->lang['NO_UNREAD_POSTS'] . '<br /><br />' . sprintf($user->lang['RETURN_TOPIC'], "<a href=\"viewtopic.$phpEx$SID&amp;f=$forum_id&amp;t=$topic_id\">", '</a>');
trigger_error($message);
}
- $db->sql_freeresult($result);
$post_id = $row['post_id'];
$topic_id = $row['topic_id'];
@@ -108,8 +106,10 @@ if ($view && !$post_id)
AND t.topic_last_post_time $sql_condition t2.topic_last_post_time
ORDER BY t.topic_last_post_time $sql_ordering";
$result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- if (!($row = $db->sql_fetchrow($result)))
+ if (!$row)
{
$message = ($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS';
trigger_error($message);
@@ -141,7 +141,6 @@ if ($view && !$post_id)
}
}
-
// This rather complex gaggle of code handles querying for topics but
// also allows for direct linking to a post (and the calculation of which
// page the post is on and the correct display of viewtopic)
@@ -195,7 +194,7 @@ $sql = "SELECT $select_sql $extra_fields
$join_sql_table . "
WHERE $join_sql
AND (f.forum_id = t.forum_id
- " . ((!$forum_id) ? '' : 'OR (t.topic_type = ' . POST_GLOBAL . " AND f.forum_id = $forum_id)") . "
+ " . ((!$forum_id) ? ' OR t.topic_type = ' . POST_GLOBAL : 'OR (t.topic_type = ' . POST_GLOBAL . " AND f.forum_id = $forum_id)") . "
)
$order_sql";
$result = $db->sql_query($sql);
@@ -354,7 +353,7 @@ $s_watching_topic = $s_watching_topic_img = array();
$s_watching_topic['link'] = $s_watching_topic['title'] = '';
if ($config['email_enable'] && $config['allow_topic_notify'] && $user->data['is_registered'])
{
- watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $topic_id, $topic_data['notify_status'], $start);
+ watch_topic_forum('topic', $s_watching_topic, $s_watching_topic_img, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start);
}
// Bookmarks