aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php29
1 files changed, 19 insertions, 10 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 53119e2ae7..3b383210c9 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -175,7 +175,7 @@ $sql_array = array(
// The FROM-Order is quite important here, else t.* columns can not be correctly bound.
if ($post_id)
{
- $sql_array['SELECT'] .= ', p.post_approved';
+ $sql_array['SELECT'] .= ', p.post_approved, p.post_time';
$sql_array['FROM'][POSTS_TABLE] = 'p';
}
@@ -275,12 +275,11 @@ if ($post_id)
}
else
{
- $sql = 'SELECT COUNT(p1.post_id) AS prev_posts
- FROM ' . POSTS_TABLE . ' p1, ' . POSTS_TABLE . " p2
- WHERE p1.topic_id = {$topic_data['topic_id']}
- AND p2.post_id = {$post_id}
- " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p1.post_approved = 1' : '') . '
- AND ' . (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' : 'p1.post_time <= p2.post_time');
+ $sql = 'SELECT COUNT(p.post_id) AS prev_posts
+ FROM ' . POSTS_TABLE . " p
+ WHERE p.topic_id = {$topic_data['topic_id']}
+ " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . '
+ AND ' . (($sort_dir == 'd') ? "p.post_time >= {$topic_data['post_time']}" : "p.post_time <= {$topic_data['post_time']}");
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -449,7 +448,7 @@ $s_watching_topic = array(
if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_notify'] && $user->data['is_registered'])
{
- watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start);
+ watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $topic_data['notify_status'], $start, $topic_data['topic_title']);
// Reset forum notification if forum notify is set
if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id))
@@ -546,6 +545,15 @@ $server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/';
// Replace naughty words in title
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
+$s_search_hidden_fields = array(
+ 't' => $topic_id,
+ 'sf' => 'msgonly',
+);
+if ($_SID)
+{
+ $s_search_hidden_fields['sid'] = $_SID;
+}
+
// Send vars to template
$template->assign_vars(array(
'FORUM_ID' => $forum_id,
@@ -597,7 +605,8 @@ $template->assign_vars(array(
'S_VIEWTOPIC' => true,
'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false,
- 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 't=' . $topic_id),
+ 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"),
+ 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
@@ -946,7 +955,7 @@ $sql = $db->sql_build_query('SELECT', array(
$result = $db->sql_query($sql);
-$now = getdate(time() + $user->timezone + $user->dst - date('Z'));
+$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
// Posts are stored in the $rowset array while $attach_list, $user_cache
// and the global bbcode_bitfield are built