From 49d56f90e5cd5b21192949bd34dd0b2f10aa2921 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sun, 20 Aug 2006 17:47:47 +0000 Subject: Poll ended at.... git-svn-id: file:///svn/phpbb/trunk@6307 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e296f80438..9a8b893e59 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -755,6 +755,8 @@ if (!empty($topic_data['poll_start'])) ); } + $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; + $template->assign_vars(array( 'POLL_QUESTION' => $topic_data['poll_title'], 'TOTAL_VOTES' => $poll_total, @@ -762,7 +764,7 @@ if (!empty($topic_data['poll_start'])) 'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'), 'L_MAX_VOTES' => ($topic_data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $topic_data['poll_max_options']), - 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($topic_data['poll_length'] + $topic_data['poll_start'])) : '', + 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', 'S_HAS_POLL' => true, 'S_CAN_VOTE' => $s_can_vote, @@ -773,7 +775,7 @@ if (!empty($topic_data['poll_start'])) 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll') ); - unset($poll_info, $voted_id); + unset($poll_end, $poll_info, $voted_id); } // If the user is trying to reach the second half of the topic, fetch it starting from the end -- cgit v1.2.1 From e7cbcfe874d663703a4f6d36974aa8eb19a59c58 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 25 Aug 2006 15:15:53 +0000 Subject: some fixes. David, could you check the pass_complex expressions? They are: .* PASS_TYPE_ANY (any characters are allowed, no check) [a-zA-Z] PASS_TYPE_CASE (password must contain alphanumerics) [a-zA-Z0-9] PASS_TYPE_ALPHA (password must contain alphanumerics and numbers) [a-zA-Z\W] PASS_TYPE_SYMBOL (password must contain alphanumers, numbers and symbols) At the moment the pass complexity check is done within validate_password(), but the expressions are wrong. :) git-svn-id: file:///svn/phpbb/trunk@6317 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 9a8b893e59..14ab1f69ee 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -472,7 +472,7 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); $allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; $topic_mod = ''; -$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '' : '') : ''; +$topic_mod .= ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED)) ? (($topic_data['topic_status'] == ITEM_UNLOCKED) ? '' : '') : ''; $topic_mod .= ($auth->acl_get('m_delete', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_split', $forum_id)) ? '' : ''; -- cgit v1.2.1 From 1d37b69ddd79d9d6bc1346f3761a899d20305636 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 28 Aug 2006 15:50:33 +0000 Subject: - some bugfixes - using E_USER_WARNING if an error occurred within the ACP (sadly not able to use it as a default for trigger_error - it seems to be hardcoded in PHP) git-svn-id: file:///svn/phpbb/trunk@6320 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 14ab1f69ee..f05030493c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -550,7 +550,6 @@ $template->assign_vars(array( 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, - 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', 'U_VIEW_TOPIC' => $viewtopic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"), @@ -828,7 +827,14 @@ $db->sql_freeresult($result); if (!sizeof($post_list)) { - trigger_error('NO_TOPIC'); + if ($sort_days) + { + trigger_error('NO_POSTS_TIME_FRAME'); + } + else + { + trigger_error('NO_TOPIC'); + } } // Holding maximum post time for marking topic read @@ -1490,7 +1496,37 @@ if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time' markread('topic', $forum_id, $topic_id, $max_post_time); // Update forum info - update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); + $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); +} +else +{ + $all_marked_read = true; +} + +// If there are absolutely no more unread posts in this forum and unread posts shown, we can savely show the #unread link +if ($all_marked_read && $post_unread) +{ + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); +} +else if (!$all_marked_read) +{ + $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false; + + // What can happen is that we are at the last displayed page. If so, we also display the #unread link based in $post_unread + if ($last_page && $post_unread) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); + } + else if (!$last_page) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + )); + } } // Change encoding if appropriate -- cgit v1.2.1 From c0a880b6652d330b760b7da7cdde8076f854d836 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 28 Aug 2006 17:20:21 +0000 Subject: - birthdays/age in user's timezone and not server's local time - parse bbcode in posts with fewer characters than selected maximum on search results page - retrieve search word context in posts which are longer than maximum characters (no raw BBCode anymore) - formatted text is processed in the same order everywhere now: censor_text, replace newlines, bbcode, smileys, attachments, highlighting [including Bug #2048] - highlighting pattern updated to exclude style and script (e.g custom BBCode) [Bug #3856] - fixed a style problem in Opera [Bug #3770] - performance increase for user::img() - slight adjustments to search git-svn-id: file:///svn/phpbb/trunk@6321 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f05030493c..6390b72876 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -717,6 +717,7 @@ if (!empty($topic_data['poll_start'])) for ($i = 0, $size = sizeof($poll_info); $i < $size; $i++) { $poll_info[$i]['poll_option_text'] = censor_text($poll_info[$i]['poll_option_text']); + $poll_info[$i]['poll_option_text'] = str_replace("\n", '
', $poll_info[$i]['poll_option_text']); if ($poll_bbcode !== false) { @@ -724,17 +725,16 @@ if (!empty($topic_data['poll_start'])) } $poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']); - $poll_info[$i]['poll_option_text'] = str_replace("\n", '
', $poll_info[$i]['poll_option_text']); } $topic_data['poll_title'] = censor_text($topic_data['poll_title']); + $topic_data['poll_title'] = str_replace("\n", '
', $topic_data['poll_title']); if ($poll_bbcode !== false) { $poll_bbcode->bbcode_second_pass($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']); } $topic_data['poll_title'] = smiley_text($topic_data['poll_title']); - $topic_data['poll_title'] = str_replace("\n", '
', $topic_data['poll_title']); unset($poll_bbcode); @@ -862,8 +862,7 @@ $sql = $db->sql_build_query('SELECT', array( $result = $db->sql_query($sql); -$today = explode('-', date('j-n-Y', time() + $user->timezone + $user->dst)); -$today = array('day' => (int) $today[0], 'month' => (int) $today[1], 'year' => (int) $today[2]); +$now = getdate(time() + $user->timezone + $user->dst); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built @@ -1087,17 +1086,17 @@ while ($row = $db->sql_fetchrow($result)) if ($bday_year) { - $diff = $today['month'] - $bday_month; + $diff = $now['mon'] - $bday_month; if ($diff == 0) { - $diff = ($today['day'] - $bday_day < 0) ? 1 : 0; + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; } else { $diff = ($diff < 0) ? 1 : 0; } - $user_cache[$poster_id]['age'] = (int) ($today['year'] - $bday_year - $diff); + $user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff); } } } @@ -1248,6 +1247,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed'])) { $user_cache[$poster_id]['sig'] = censor_text($user_cache[$poster_id]['sig']); + $user_cache[$poster_id]['sig'] = str_replace("\n", '
', $user_cache[$poster_id]['sig']); if ($user_cache[$poster_id]['sig_bbcode_bitfield']) { @@ -1255,12 +1255,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } $user_cache[$poster_id]['sig'] = smiley_text($user_cache[$poster_id]['sig']); - $user_cache[$poster_id]['sig'] = str_replace("\n", '
', $user_cache[$poster_id]['sig']); $user_cache[$poster_id]['sig_parsed'] = true; } // Parse the message and subject $message = censor_text($row['post_text']); + $message = str_replace("\n", '
', $message); // Second parse bbcode here if ($row['bbcode_bitfield']) @@ -1285,12 +1285,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // Highlight active words (primarily for search) if ($highlight_match) { - $message = preg_replace('#(?!<.*)(?]*>)#i', '\1', $message); + $message = preg_replace('#(?!(?:<(?:s(?:cript|tyle))?)[^<]*)(?]*(?:)#is', '\1', $message); } // Replace naughty words such as farty pants $row['post_subject'] = censor_text($row['post_subject']); - $message = str_replace("\n", '
', $message); // Editing information if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) -- cgit v1.2.1 From 8c567e8c68a3106c94c140f732904b7b5b6eab1a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 4 Sep 2006 13:47:56 +0000 Subject: - fixing profile bug - adjusting acl_gets calls (they are or'd - make sure they get checked correctly based on the situation) - automatically assign the u_download and u_search permission to the guest group git-svn-id: file:///svn/phpbb/trunk@6351 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6390b72876..c4bac162cd 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -478,7 +478,7 @@ $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_merge', $forum_id)) ? '' : ''; $topic_mod .= ($auth->acl_get('m_move', $forum_id)) ? '' : ''; -$topic_mod .= ($allow_change_type && $auth->acl_gets(array('f_sticky', 'f_announce'), $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '' : ''; +$topic_mod .= ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', $forum_id) && $topic_data['topic_type'] != POST_NORMAL) ? '' : ''; $topic_mod .= ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY) ? '' : ''; $topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE) ? '' : ''; $topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL) ? '' : ''; @@ -1136,7 +1136,7 @@ unset($id_cache); // Pull attachment data if (sizeof($attach_list)) { - if ($auth->acl_gets('f_download', 'u_download', $forum_id)) + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' -- cgit v1.2.1 From b76222cb6e9ed69ee8ed0c09f0196eaaafd33fad Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 13 Sep 2006 16:08:36 +0000 Subject: - fixed some bugs - changed attachment handling a bit - tried to remove target tags out of the code - do not add session ids to urls for bots as well as not creating a new session on each page view for them I bet i introduced some bugs too. ;) git-svn-id: file:///svn/phpbb/trunk@6364 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index c4bac162cd..62a5b822f9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1534,6 +1534,14 @@ if ($force_encoding != '') $user->lang['ENCODING'] = $force_encoding; } +// We overwrite $_REQUEST['f'] if there is no forum specified +// to be able to display the correct online list. +// One downside is that the user currently viewing this topic/post is not taken into account. +if (empty($_REQUEST['f'])) +{ + $_REQUEST['f'] = $forum_id; +} + // Output the page page_header($user->lang['VIEW_TOPIC'] .' - ' . $topic_data['topic_title']); -- cgit v1.2.1 From ea065f3e67ee0c0cb28c88569042461dd8cf2c27 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 17 Sep 2006 22:02:28 +0000 Subject: - no more encoding mixture, say hello to UTF-8 (I'll add a validation solution for PHP 4.3.3/4 ASAP) [side effect: fixes Bug #3762] - take local server time into consideration for birthday/age calculation - faster active topic search - allow changing active topic time frame [Bug #4150] - reload stylesheet on language change [Bug #4222] git-svn-id: file:///svn/phpbb/trunk@6380 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 62a5b822f9..a22aedf651 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -804,7 +804,7 @@ else // Container for user details, only process once $post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array(); $has_attachments = $display_notice = false; -$bbcode_bitfield = $force_encoding = ''; +$bbcode_bitfield = ''; $i = $i_total = 0; // Go ahead and pull all data for this topic @@ -862,7 +862,7 @@ $sql = $db->sql_build_query('SELECT', array( $result = $db->sql_query($sql); -$now = getdate(time() + $user->timezone + $user->dst); +$now = getdate(time() + $user->timezone + $user->dst - (date('H', time()) - gmdate('H', time())) * 3600); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built @@ -922,7 +922,6 @@ while ($row = $db->sql_fetchrow($result)) 'post_approved' => $row['post_approved'], 'post_reported' => $row['post_reported'], 'post_text' => $row['post_text'], - 'post_encoding' => $row['post_encoding'], 'bbcode_uid' => $row['bbcode_uid'], 'bbcode_bitfield' => $row['bbcode_bitfield'], 'enable_smilies' => $row['enable_smilies'], @@ -1238,10 +1237,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) continue; } - else if ($row['post_encoding'] != $user->lang['ENCODING'] && $view == 'encoding' && $post_id == $row['post_id']) - { - $force_encoding = $row['post_encoding']; - } // End signature parsing, only if needed if ($user_cache[$poster_id]['sig'] && empty($user_cache[$poster_id]['sig_parsed'])) @@ -1398,8 +1393,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), - 'FORCE_ENCODING' => ($row['post_encoding'] != $user->lang['ENCODING']) ? sprintf($user->lang['POST_ENCODING'], $row['poster'], '', '') : '', - 'U_EDIT' => (($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '', 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', @@ -1528,12 +1521,6 @@ else if (!$all_marked_read) } } -// Change encoding if appropriate -if ($force_encoding != '') -{ - $user->lang['ENCODING'] = $force_encoding; -} - // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account. -- cgit v1.2.1 From 734492958eaa2f193db304fd5d4cf050390eff1a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 26 Sep 2006 19:59:41 +0000 Subject: These changes should let olympus scale a little bit better. i haven't adjusted the schemas but added the details to create_schema_files - david is able to build them then in line with his changes. :) git-svn-id: file:///svn/phpbb/trunk@6411 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a22aedf651..534e72780d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -238,19 +238,34 @@ if (!$topic_data) // This is for determining where we are (page) if ($post_id) { - /** - * @todo adjust for using post_time? Generally adjust query... it is not called very often though - */ - $sql = 'SELECT COUNT(post_id) AS prev_posts - FROM ' . POSTS_TABLE . " - WHERE topic_id = {$topic_data['topic_id']} - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND post_approved = 1' : '') . " - AND " . (($sort_dir == 'd') ? "post_id >= $post_id" : "post_id <= $post_id"); - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + if ($post_id == $topic_data['topic_first_post_id'] || $post_id == $topic_data['topic_last_post_id']) + { + $check_sort = ($post_id == $topic_data['topic_first_post_id']) ? 'd' : 'a'; + + if ($sort_dir == $check_sort) + { + $topic_data['prev_posts'] = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] + 1 : $topic_data['topic_replies'] + 1; + } + else + { + $topic_data['prev_posts'] = 1; + } + } + 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'); - $topic_data['prev_posts'] = $row['prev_posts']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $topic_data['prev_posts'] = $row['prev_posts']; + } } $forum_id = (int) $topic_data['forum_id']; -- cgit v1.2.1 From 485935e1f1a3a773260cda0b7ac3f3800dca990e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 7 Oct 2006 17:40:07 +0000 Subject: he braces style is deprecated as of PHP 6 git-svn-id: file:///svn/phpbb/trunk@6459 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 534e72780d..b7a8822515 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -824,10 +824,10 @@ $i = $i_total = 0; // Go ahead and pull all data for this topic $sql = 'SELECT p.post_id - FROM ' . POSTS_TABLE . ' p' . (($sort_by_sql[$sort_key]{0} == 'u') ? ', ' . USERS_TABLE . ' u': '') . " + FROM ' . POSTS_TABLE . ' p' . (($sort_by_sql[$sort_key][0] == 'u') ? ', ' . USERS_TABLE . ' u': '') . " WHERE p.topic_id = $topic_id " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . " - " . (($sort_by_sql[$sort_key]{0} == 'u') ? 'AND u.user_id = p.poster_id': '') . " + " . (($sort_by_sql[$sort_key][0] == 'u') ? 'AND u.user_id = p.poster_id': '') . " $limit_posts_time ORDER BY $sql_sort_order"; $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); -- cgit v1.2.1 From d7ee6969d21d6144b328b07d3bad1333a466e739 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 11 Oct 2006 14:59:28 +0000 Subject: :) git-svn-id: file:///svn/phpbb/trunk@6479 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b7a8822515..a163ba5bb2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1234,7 +1234,7 @@ $template->assign_vars(array( ); // Output the posts -$first_unread = false; +$first_unread = $post_unread = false; for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $row =& $rowset[$post_list[$i]]; -- cgit v1.2.1 From f4da66a9328d12a3a5cb3a36feb184a4686ca2f3 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 20 Oct 2006 13:48:44 +0000 Subject: - adjust unread query a bit to cope with large topics (thanks bart!) - fixing some bugs - more username_clean work git-svn-id: file:///svn/phpbb/trunk@6513 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a163ba5bb2..ba090f10a2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -69,27 +69,32 @@ if ($view && !$post_id) $topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0; - $sql = 'SELECT p.post_id, p.topic_id, p.forum_id - FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t - WHERE t.topic_id = $topic_id - AND p.topic_id = t.topic_id - " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND p.post_approved = 1') . " - AND (p.post_time > $topic_last_read - OR p.post_id = t.topic_last_post_id) - ORDER BY p.post_time ASC"; + $sql = 'SELECT post_id, topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . " + AND post_time > $topic_last_read + ORDER BY post_time ASC"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); + if (!$row) + { + $sql = 'SELECT topic_last_post_id as post_id, topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + if (!$row) { // Setup user environment so we can process lang string $user->setup('viewtopic'); - $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); - - meta_refresh(3, $redirect); - trigger_error($user->lang['NO_UNREAD_POSTS'] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', '')); + trigger_error('NO_TOPIC'); } $post_id = $row['post_id']; -- cgit v1.2.1 From 22129be21f3d08a27681e0ac6ba8ad401ed8ba96 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 22 Oct 2006 13:32:33 +0000 Subject: - now username changes should work as desired - removed some extract() calls git-svn-id: file:///svn/phpbb/trunk@6517 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ba090f10a2..4275938548 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -16,6 +16,7 @@ $phpbb_root_path = './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/bbcode.' . $phpEx); // Start session management $user->session_begin(); @@ -726,7 +727,6 @@ if (!empty($topic_data['poll_start'])) if ($poll_info[0]['bbcode_bitfield']) { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); $poll_bbcode = new bbcode(); } else @@ -1227,7 +1227,6 @@ if (sizeof($attach_list)) // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { - include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx); $bbcode = new bbcode(base64_encode($bbcode_bitfield)); } -- cgit v1.2.1 From 1544f456211bfdafd09cb873847d99b94002b5c5 Mon Sep 17 00:00:00 2001 From: David M Date: Sat, 4 Nov 2006 13:37:22 +0000 Subject: trimmed the highlight regex git-svn-id: file:///svn/phpbb/trunk@6550 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4275938548..0bcaea8489 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1299,7 +1299,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // Highlight active words (primarily for search) if ($highlight_match) { - $message = preg_replace('#(?!(?:<(?:s(?:cript|tyle))?)[^<]*)(?]*(?:)#is', '\1', $message); + $message = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $message); } // Replace naughty words such as farty pants -- cgit v1.2.1 From d89f60f182afa07e28d4e58f59b90dd25555e3a6 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 12 Nov 2006 15:35:43 +0000 Subject: consistant obtain_* functions git-svn-id: file:///svn/phpbb/trunk@6572 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0bcaea8489..2898a1c20a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -471,18 +471,16 @@ if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('b } // Grab ranks -$ranks = array(); -$cache->obtain_ranks($ranks); +$ranks = $cache->obtain_ranks(); // Grab icons -$icons = array(); -$cache->obtain_icons($icons); +$icons = $cache->obtain_icons(); // Grab extensions $extensions = array(); if ($topic_data['topic_attachment']) { - $cache->obtain_attach_extensions($extensions); + $extensions = $cache->obtain_attach_extensions(); } // Forum rules listing -- cgit v1.2.1