From 12a9e001837da139a9ea07b8dd52019ee071d9bd Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 6 Jan 2008 17:00:09 +0000 Subject: - Do not split topic list for topics being promoted to announcements after been moved to another forum (Bug #18635) - Allow editing usernames within database_update on username cleanup (Bug #18415) - Fixing wrong sync() calls if moving all posts by a member in ACP (Bug #18385) - Check entered imagemagick path for trailing slash (Bug #18205) - Use proper title on index for new/unread posts (Bug #13101) - patch provided by Pyramide - Allow calls to $user->set_cookie() define no cookie time for setting session cookies (Bug #18025) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8310 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 f24eebd1a7..4240c3da7a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -578,7 +578,7 @@ $template->assign_vars(array( 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"), - 'S_TOPIC_MOD' => ($topic_mod != '') ? '' : '', + 'S_TOPIC_MOD' => ($topic_mod != '') ? '' : '', 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, -- cgit v1.2.1 From 325ff1fa1b0f75b7da6a6abbc9d6bbf032bcdedf Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 30 Jan 2008 16:01:15 +0000 Subject: One commit for those fixes having a very tiny impact (mostly only whitespaces or forgotten spans, etc.) Although i somehow mistakingly got #20445 and #15249 into it. :/ Removing s_watching_img from watch_topic_forum() function (Bug #20445) Changing order for post review if more than one post affected (Bug #15249) Language typos/fixes (Bug #20425, #15719, #15429, #14669, #13479) Style/Template fixes (Bug #20065, #19405, #19205, #15028, #14934, #14821, #14752, #14497, #13707, #14738) Tiny code fixes (Bug #20165, #20025, #19795, #14804) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8350 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4240c3da7a..daae349401 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -445,13 +445,15 @@ if ($start < 0 || $start > $total_posts) $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')); // Are we watching this topic? -$s_watching_topic = $s_watching_topic_img = array(); -$s_watching_topic['link'] = $s_watching_topic['title'] = ''; -$s_watching_topic['is_watching'] = false; +$s_watching_topic = array( + 'link' => '', + 'title' => '', + 'is_watching' => false, +); 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'], $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); } // Bookmarks @@ -663,7 +665,7 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - + if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id)) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); @@ -681,7 +683,7 @@ if (!empty($topic_data['poll_start'])) { $message = 'VOTE_CONVERTED'; } - + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); trigger_error($message); } -- cgit v1.2.1 From 968cccfb56476d70ce3f6c0c8e84e9df708040bf Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 2 May 2008 16:36:52 +0000 Subject: #26605 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8536 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index daae349401..810f944529 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1003,7 +1003,6 @@ while ($row = $db->sql_fetchrow($result)) 'rank_image' => '', 'rank_image_src' => '', 'sig' => '', - 'posts' => '', 'profile' => '', 'pm' => '', 'email' => '', -- cgit v1.2.1 From 3ecdbd068cfb904705be07d718881dc727e3665f Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 4 Jun 2008 14:44:19 +0000 Subject: #28025 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8595 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 810f944529..77450813be 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -451,9 +451,16 @@ $s_watching_topic = array( 'is_watching' => false, ); -if ($config['email_enable'] && $config['allow_topic_notify'] && $user->data['is_registered']) +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); + + // Reset forum notification if forum notify is set + if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) + { + $s_watching_forum = $s_watching_topic; + watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0); + } } // Bookmarks -- cgit v1.2.1 From 35ce15a6bf89503e86ef986f7938bfed66c0895f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 4 Jun 2008 15:48:19 +0000 Subject: corrected link for searching post author's other posts [Bug #26455] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8601 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 77450813be..0fafefad1e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1072,7 +1072,7 @@ while ($row = $db->sql_fetchrow($result)) 'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '', 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', - 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'search_author=' . urlencode($row['username']) .'&showresults=posts') : '', + 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'search_author=' . urlencode($row['username']) .'&sr=posts') : '', ); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); -- cgit v1.2.1 From 8904d95d59d14d00fd3cfaf93a357ad68d608586 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 28 Jul 2008 13:26:20 +0000 Subject: tiny alterations/bugfixes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8691 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 0fafefad1e..350aef2c11 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -176,6 +176,7 @@ $sql_array = array( 'FROM' => array( FORUMS_TABLE => 'f', + TOPICS_TABLE => 't', ) ); @@ -239,7 +240,6 @@ else } $sql_array['WHERE'] .= ')'; -$sql_array['FROM'][TOPICS_TABLE] = 't'; // 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 -- cgit v1.2.1 From 6926a359023e797385f71df85de9929cae7486df Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 13 Aug 2008 14:37:17 +0000 Subject: #31185 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8751 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 350aef2c11..d6ecf03c56 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -31,9 +31,13 @@ $voted_id = request_var('vote_id', array('' => 0)); $start = request_var('start', 0); $view = request_var('view', ''); -$sort_days = request_var('st', ((!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0)); -$sort_key = request_var('sk', ((!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't')); -$sort_dir = request_var('sd', ((!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a')); +$default_sort_days = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0; +$default_sort_key = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'; +$default_sort_dir = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'; + +$sort_days = request_var('st', $default_sort_days); +$sort_key = request_var('sk', $default_sort_key); +$sort_dir = request_var('sd', $default_sort_dir); $update = request_var('update', false); @@ -388,7 +392,8 @@ $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIM $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; -gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); // Obtain correct post count and ordering SQL if user has // requested anything different @@ -442,7 +447,7 @@ if ($start < 0 || $start > $total_posts) } // General Viewtopic URL for return links -$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')); +$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); // Are we watching this topic? $s_watching_topic = array( @@ -523,7 +528,7 @@ $topic_mod .= ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_mod .= ($auth->acl_get('m_', $forum_id)) ? '' : ''; // If we've got a hightlight set pass it on to pagination. -$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); +$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); // Navigation links generate_forum_nav($topic_data); @@ -557,7 +562,7 @@ $template->assign_vars(array( 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), - 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start&$u_sort_param", true, $user->session_id) : '', + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), -- cgit v1.2.1 From f56391d5f7d2170397759e26962925635e6a8263 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 21 Aug 2008 15:41:12 +0000 Subject: as per evil3, some more anti-CSRF git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8775 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d6ecf03c56..652b30e99b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -471,25 +471,31 @@ if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_n // Bookmarks if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) { - if (!$topic_data['bookmarked']) + if (check_link_hash(request_var('hash', ''),"topic_$topic_id")) { - $sql = 'INSERT INTO ' . BOOKMARKS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => $user->data['user_id'], - 'topic_id' => $topic_id, - )); - $db->sql_query($sql); + if (!$topic_data['bookmarked']) + { + $sql = 'INSERT INTO ' . BOOKMARKS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => $user->data['user_id'], + 'topic_id' => $topic_id, + )); + $db->sql_query($sql); + } + else + { + $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND topic_id = $topic_id"; + $db->sql_query($sql); + } + $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']) . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); } else { - $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . " - WHERE user_id = {$user->data['user_id']} - AND topic_id = $topic_id"; - $db->sql_query($sql); + $message = $user->lang['BOOKMARK_ERR'] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); } - meta_refresh(3, $viewtopic_url); - $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']) . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); trigger_error($message); } @@ -615,12 +621,12 @@ $template->assign_vars(array( 'L_WATCH_TOPIC' => $s_watching_topic['title'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], - 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1' : '', + 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '', 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id") : '', - 'U_BUMP_TOPIC' => (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=bump&f=$forum_id&t=$topic_id") : '') + 'U_BUMP_TOPIC' => (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=bump&f=$forum_id&t=$topic_id&hash=" . generate_link_hash("topic_$topic_id")) : '') ); // Does this topic contain a poll? -- cgit v1.2.1 From 674777246a2874bad99721189b84e1d875e46c53 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 6 Sep 2008 12:58:29 +0000 Subject: Stop search bots incrementing topic views. #32675 Use correct link for post author search. #32595 Insert missing space. #32315 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8835 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 652b30e99b..8db6ed1ebd 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1083,7 +1083,7 @@ while ($row = $db->sql_fetchrow($result)) 'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '', 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', - 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", 'search_author=' . urlencode($row['username']) .'&sr=posts') : '', + 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', ); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); @@ -1505,8 +1505,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } unset($rowset, $user_cache); -// Update topic view and if necessary attachment view counters ... but only if this is the first 'page view' -if (isset($user->data['session_page']) && strpos($user->data['session_page'], '&t=' . $topic_id) === false) +// Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view' +if (isset($user->data['session_page']) && !$user->data['is_bot'] && strpos($user->data['session_page'], '&t=' . $topic_id) === false) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " @@ -1580,7 +1580,7 @@ if (empty($_REQUEST['f'])) } // Output the page -page_header($user->lang['VIEW_TOPIC'] .' - ' . $topic_data['topic_title']); +page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']); $template->set_filenames(array( 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') -- cgit v1.2.1 From 8dd2c17bf94b33d3629e96679a07bc6908caff38 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 16 Sep 2008 12:36:28 +0000 Subject: Fix Wrong table order in query obtaining posts if post id given. In MSSQL there is an sql error due to this bug. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8851 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8db6ed1ebd..fac6476a55 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -178,12 +178,18 @@ if ($view && !$post_id) $sql_array = array( 'SELECT' => 't.*, f.*', - 'FROM' => array( - FORUMS_TABLE => 'f', - TOPICS_TABLE => 't', - ) + 'FROM' => array(FORUMS_TABLE => 'f'), ); +// The FROM-Order is quite important here, else t.* columns can not be correctly bound. +if ($post_id) +{ + $sql_array['FROM'][POSTS_TABLE] = 'p'; +} + +// Topics table need to be the last in the chain +$sql_array['FROM'][TOPICS_TABLE] = 't'; + if ($user->data['is_registered']) { $sql_array['SELECT'] .= ', tw.notify_status'; @@ -226,7 +232,6 @@ if (!$post_id) else { $sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id" . ((!$auth->acl_get('m_approve', $forum_id)) ? ' AND p.post_approved = 1' : ''); - $sql_array['FROM'][POSTS_TABLE] = 'p'; } $sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id'; -- cgit v1.2.1 From 615188cd06a1d18de7097f34fff562aac1f3d1fc Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 18 Sep 2008 13:36:09 +0000 Subject: Display assigned rank/avatar for guests. (Bug #19155) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8872 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fac6476a55..17e29fe60f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1021,7 +1021,7 @@ while ($row = $db->sql_fetchrow($result)) 'sig_bbcode_bitfield' => '', 'online' => false, - 'avatar' => '', + 'avatar' => ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', @@ -1045,6 +1045,8 @@ while ($row = $db->sql_fetchrow($result)) 'warnings' => 0, 'allow_pm' => 0, ); + + get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); } else { -- cgit v1.2.1 From 9c5a3cca8995b4d1704c3cd57756a8434d4887af Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 23 Sep 2008 18:04:52 +0000 Subject: Stop users from deleting posts after the edit time has passed or they have been locked. #19115 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8924 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 17e29fe60f..a0771d38c0 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -980,6 +980,7 @@ while ($row = $db->sql_fetchrow($result)) 'post_edit_time' => $row['post_edit_time'], 'post_edit_reason' => $row['post_edit_reason'], 'post_edit_user' => $row['post_edit_user'], + 'post_edit_locked' => $row['post_edit_locked'], // Make sure the icon actually exists 'icon_id' => (isset($icons[$row['icon_id']]['img'], $icons[$row['icon_id']]['height'], $icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0, @@ -1439,7 +1440,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($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) : '', - 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], -- cgit v1.2.1 From 3b42ffcc9e44e8b6e8c5c7233de9273e8cb374f6 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 26 Sep 2008 13:14:11 +0000 Subject: nitpick alarm. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8944 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 a0771d38c0..a98a6176ad 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -476,7 +476,7 @@ if (($config['email_enable'] || $config['jab_enable']) && $config['allow_topic_n // Bookmarks if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) { - if (check_link_hash(request_var('hash', ''),"topic_$topic_id")) + if (check_link_hash(request_var('hash', ''), "topic_$topic_id")) { if (!$topic_data['bookmarked']) { -- cgit v1.2.1 From 876b193180f72424be0adcf6d63064db4e3f6a8a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 6 Oct 2008 05:50:16 +0000 Subject: some whitespace changes and opening files in binary mode in functions_messenger git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8971 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 a98a6176ad..b0b7b946be 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -181,7 +181,7 @@ $sql_array = array( 'FROM' => array(FORUMS_TABLE => 'f'), ); -// The FROM-Order is quite important here, else t.* columns can not be correctly bound. +// The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { $sql_array['FROM'][POSTS_TABLE] = 'p'; -- cgit v1.2.1 From e44dcce325d9c280caad88d36c9596f9ff5630d0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 13 Oct 2008 09:58:38 +0000 Subject: Round the displayed percentages in polls. #32375 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9010 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 b0b7b946be..35b0d401ba 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -819,7 +819,7 @@ if (!empty($topic_data['poll_start'])) foreach ($poll_info as $poll_option) { $option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0; - $option_pct_txt = sprintf("%.1d%%", ($option_pct * 100)); + $option_pct_txt = sprintf("%.1d%%", round($option_pct * 100)); $template->assign_block_vars('poll_option', array( 'POLL_OPTION_ID' => $poll_option['poll_option_id'], -- cgit v1.2.1 From a2e454262b89dfbcd022dcc2f36a9244aa4fb80e Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 16 Oct 2008 19:03:02 +0000 Subject: Correctly display topic when start parameter is equal to the number of posts. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9022 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 35b0d401ba..3241c9c21a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -446,7 +446,7 @@ if ($hilit_words) } // Make sure $start is set to the last page if it exceeds the amount -if ($start < 0 || $start > $total_posts) +if ($start < 0 || $start >= $total_posts) { $start = ($start < 0) ? 0 : floor(($total_posts - 1) / $config['posts_per_page']) * $config['posts_per_page']; } -- cgit v1.2.1 From e02c3e3b4aeb0a0588cacb4d96ef3d8c4ba0ef8a Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 22 Nov 2008 20:26:09 +0000 Subject: Only display special ranks to guests; no longer display normal ranks for guests (Bug #36735) [a bit ugly, but retains backward compatibility] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9082 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 3241c9c21a..b7b130bbd1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1047,7 +1047,7 @@ while ($row = $db->sql_fetchrow($result)) 'allow_pm' => 0, ); - get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); + get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); } else { -- cgit v1.2.1 From 7752023b44d1b9283d9b5d6d6294d783b5ba42dc Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 30 Nov 2008 16:53:36 +0000 Subject: force full date on "edited by" line. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9138 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 b7b130bbd1..995874b6b5 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1348,7 +1348,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $display_username = get_username_string('full', $row['post_edit_user'], $post_edit_list[$row['post_edit_user']]['username'], $post_edit_list[$row['post_edit_user']]['user_colour']); } - $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time']), $row['post_edit_count']); + $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); } else { @@ -1367,7 +1367,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $display_username = get_username_string('full', $row['post_edit_user'], $user_cache[$row['post_edit_user']]['username'], $user_cache[$row['post_edit_user']]['user_colour']); } - $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time']), $row['post_edit_count']); + $l_edited_by = sprintf($l_edit_time_total, $display_username, $user->format_date($row['post_edit_time'], false, true), $row['post_edit_count']); } } else -- cgit v1.2.1 From 308ded3f55cc9143dda9c9acb0b334f30836c366 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 17 Mar 2009 15:31:03 +0000 Subject: Bug #39735 - force full date on bump message git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9388 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 995874b6b5..6cc7de0106 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1381,7 +1381,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // It is safe to grab the username from the user cache array, we are at the last // post and only the topic poster and last poster are allowed to bump. // Admins and mods are bound to the above rules too... - $l_bumped_by = '

' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'])); + $l_bumped_by = '

' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true)); } else { -- cgit v1.2.1 From 06c4fbf81fdc66cc3eea11628b35f5c4ebbbaaba Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 19 Mar 2009 19:24:47 +0000 Subject: SQL optimisations git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9399 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6cc7de0106..02bb502075 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -898,7 +898,7 @@ $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); $i = ($store_reverse) ? $sql_limit - 1 : 0; while ($row = $db->sql_fetchrow($result)) { - $post_list[$i] = $row['post_id']; + $post_list[$i] = (int) $row['post_id']; ($store_reverse) ? $i-- : $i++; } $db->sql_freeresult($result); @@ -952,12 +952,12 @@ while ($row = $db->sql_fetchrow($result)) $max_post_time = $row['post_time']; } - $poster_id = $row['poster_id']; + $poster_id = (int) $row['poster_id']; // Does post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) { - $attach_list[] = $row['post_id']; + $attach_list[] = (int) $row['post_id']; if ($row['post_approved']) { -- cgit v1.2.1 From e6ed42ed4dde41812b88b47c6e5bb5c41402f14c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 28 Mar 2009 18:34:09 +0000 Subject: - Add indicator to be used in code if session was created (user visits the site for the first time) - Correctly count topic views for guests visiting the website the first time by entering the topic directly (Bug #43445) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9411 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 02bb502075..495a536932 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1514,7 +1514,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) unset($rowset, $user_cache); // Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view' -if (isset($user->data['session_page']) && !$user->data['is_bot'] && strpos($user->data['session_page'], '&t=' . $topic_id) === false) +if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($user->data['session_page'], '&t=' . $topic_id) === false || isset($user->data['session_created']))) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " -- cgit v1.2.1 From 9d3d63181f3735a63e266fa610067d74486c833e Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 30 Mar 2009 11:09:51 +0000 Subject: Redirect to relevant MCP page of multi-page topic if accessing quickmod tools (Split option for example) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9414 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 495a536932..ebdb54fe8d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -604,7 +604,7 @@ $template->assign_vars(array( 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"), 'S_TOPIC_MOD' => ($topic_mod != '') ? '' : '', - 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), + 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id&start=$start&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, -- cgit v1.2.1 From 607389caf0c91dac9f8301ea620c25415b85ca61 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 30 Mar 2009 14:03:28 +0000 Subject: #43595 - we should also check for existing classes and use include instead of include_once (of course) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9418 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ebdb54fe8d..cd0dae2b46 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1143,7 +1143,10 @@ $db->sql_freeresult($result); // Load custom profile fields if ($config['load_cpf_viewtopic']) { - include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + if (!class_exists('custom_profile')) + { + include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx); + } $cp = new custom_profile(); // Grab all profile fields from users in id cache for later use - similar to the poster cache -- cgit v1.2.1 From ea5be14933b97334af000f018f95a083eb228013 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 10 Apr 2009 09:21:47 +0000 Subject: also redirect to topic if forum id not specified (Bug #30855) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9431 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 cd0dae2b46..019a1121a0 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -262,9 +262,9 @@ $db->sql_freeresult($result); if (!$topic_data) { // If post_id was submitted, we try at least to display the topic as a last resort... - if ($post_id && $forum_id && $topic_id) + if ($post_id && $topic_id) { - redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id")); + redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); } trigger_error('NO_TOPIC'); -- cgit v1.2.1 From 5404af2d29c98435b657dfc706539d1e9e866301 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 10 Apr 2009 10:21:49 +0000 Subject: Force full date on print view (Bug #40355) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9435 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 019a1121a0..b76f6c5e88 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1424,7 +1424,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_WARNINGS' => $user_cache[$poster_id]['warnings'], 'POSTER_AGE' => $user_cache[$poster_id]['age'], - 'POST_DATE' => $user->format_date($row['post_time']), + 'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false), 'POST_SUBJECT' => $row['post_subject'], 'MESSAGE' => $message, 'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '', -- cgit v1.2.1 From e3bdaea2656f788dd58e04d62896435246b6f23b Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 18 Apr 2009 17:22:41 +0000 Subject: Ability to vote in poll is now required for the ability to change existing vote. (Bug #38925) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9470 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 b76f6c5e88..2bc8086efe 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -679,8 +679,8 @@ if (!empty($topic_data['poll_start'])) } } - $s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) || - ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change'])) && + // Can not vote at all if no vote permission + $s_can_vote = ($auth->acl_get('f_vote', $forum_id) && (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && $topic_data['topic_status'] != ITEM_LOCKED && $topic_data['forum_status'] != ITEM_LOCKED) ? true : false; -- cgit v1.2.1 From b9ece6bdfe65b2e63c42d4a83fd831b4377e1b90 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Tue, 2 Jun 2009 13:51:19 +0000 Subject: #44875 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9523 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2bc8086efe..e0584f3dc3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -394,7 +394,8 @@ if (!isset($topic_tracking_info)) $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); -$sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.post_time', 's' => 'p.post_subject'); +$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => 'p.post_time', 's' => array('p.post_subject', 'p.post_id')); +$join_user_sql = array('a' => true, 't' => false, 's' => false); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -858,6 +859,7 @@ if (!empty($topic_data['poll_start'])) // If the user is trying to reach the second half of the topic, fetch it starting from the end $store_reverse = false; $sql_limit = $config['posts_per_page']; +$sql_sort_order = $direction = ''; if ($start > $total_posts / 2) { @@ -869,15 +871,24 @@ if ($start > $total_posts / 2) } // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); $sql_start = max(0, $total_posts - $sql_limit - $start); } else { // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); $sql_start = $start; } +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + // Container for user details, only process once $post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array(); @@ -887,10 +898,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' . (($join_user_sql[$sort_key]) ? ', ' . 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': '') . " + " . (($join_user_sql[$sort_key]) ? '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 27d4c7229d97ba25e5bd303b21f376e14550eba6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Jun 2009 10:17:08 +0000 Subject: Fix bug #34295 - Move post bump information markup to the template. Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9563 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 e0584f3dc3..5af6516095 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1395,7 +1395,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // It is safe to grab the username from the user cache array, we are at the last // post and only the topic poster and last poster are allowed to bump. // Admins and mods are bound to the above rules too... - $l_bumped_by = '

' . sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true)); + $l_bumped_by = sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true)); } else { -- cgit v1.2.1 From 7650b6526f6338236ce41640896015b9e17e4c0f Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 9 Jun 2009 18:09:29 +0000 Subject: Fix a regression introduced in r9470 #45895 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9567 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5af6516095..aedf464248 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -684,7 +684,9 @@ if (!empty($topic_data['poll_start'])) $s_can_vote = ($auth->acl_get('f_vote', $forum_id) && (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && $topic_data['topic_status'] != ITEM_LOCKED && - $topic_data['forum_status'] != ITEM_LOCKED) ? true : false; + $topic_data['forum_status'] != ITEM_LOCKED && + (!sizeof($cur_voted_id) || + ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || $view == 'viewpoll') ? true : false; if ($update && $s_can_vote) -- cgit v1.2.1 From 050567483f8646a58b91e4abeb2bf61f735b0526 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 21 Jun 2009 09:36:13 +0000 Subject: Ability to fetch moderators with get_moderators() even if load_moderators setting is off. (Bug #35955) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9640 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index aedf464248..0387ae3a05 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -550,7 +550,10 @@ generate_forum_rules($topic_data); // Moderators $forum_moderators = array(); -get_moderators($forum_moderators, $forum_id); +if ($config['load_moderators']) +{ + get_moderators($forum_moderators, $forum_id); +} // This is only used for print view so ... $server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/'; -- cgit v1.2.1 From a130dd31ed6cf2c630f3e5a4457c5bb47e475bca Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 14:36:40 +0000 Subject: this is very much work in progress; please feel free to improve markup, usability and to introduce possible further settings (per forum, per user) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9688 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0387ae3a05..94f866a35c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -41,6 +41,7 @@ $sort_dir = request_var('sd', $default_sort_dir); $update = request_var('update', false); +$s_can_vote = false; /** * @todo normalize? */ @@ -695,7 +696,7 @@ if (!empty($topic_data['poll_start'])) if ($update && $s_can_vote) { - if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id)) + if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); @@ -708,10 +709,14 @@ if (!empty($topic_data['poll_start'])) { $message = 'TOO_MANY_VOTE_OPTIONS'; } - else + else if (in_array(VOTE_CONVERTED, $cur_voted_id)) { $message = 'VOTE_CONVERTED'; } + else + { + $message = 'FORM_INVALID'; + } $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); trigger_error($message); @@ -1422,6 +1427,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $s_first_unread = $first_unread = true; } + // $postrow = array( @@ -1598,6 +1604,41 @@ else if (!$all_marked_read) } } +// let's set up quick_reply +// TODO: introduce a per-forum and a per-user setting +if ($s_can_vote || $config['allow_quick_reply']) +{ + add_form_key('posting'); + if ($user->data['is_registered'] && $config['allow_quick_reply']) + { + + $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $qr_hidden_fields = array( + 'topic_cur_post_id' => $topic_data['topic_last_post_id'], + 'lastclick' => time(), + 'topic_id' => $topic_data['topic_id'], + 'forum_id' => $forum_id, + 'disable_bbcode' => !$s_bbcode, + 'disable_smilies' => !$s_smilies, + 'disable_magic_url' => !$config['allow_post_links'], + 'attach_sig' => $s_attach_sig, + 'notify' => $s_notify, + ); + + $template->assign_vars(array( + 'S_QUICK_REPLY' => true, + 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), + 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), + 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), + + )); + } +} + + // 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 18c5c8e8eca03e4d0e142f106168eecfde3b2450 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:25:56 +0000 Subject: oh, it is already in here git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9691 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 94f866a35c..70dc8b77bb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,10 +1606,11 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -if ($s_can_vote || $config['allow_quick_reply']) +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY); +if ($s_can_vote || $s_quick_reply ) { add_form_key('posting'); - if ($user->data['is_registered'] && $config['allow_quick_reply']) + if ($s_quick_reply) { $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); -- cgit v1.2.1 From 957d1d43dc003adf0df735bea001f438b61ca39a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:30:04 +0000 Subject: And check for permissions... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9692 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 70dc8b77bb..94fdf821c3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,7 +1606,7 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY); +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; if ($s_can_vote || $s_quick_reply ) { add_form_key('posting'); -- cgit v1.2.1 From 31968a5070a60d22aae1ed7bf503c92259b562e0 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Jun 2009 15:33:55 +0000 Subject: gah git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9693 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 94fdf821c3..90e033dab7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,7 +1606,7 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; if ($s_can_vote || $s_quick_reply ) { add_form_key('posting'); @@ -1638,6 +1638,7 @@ if ($s_can_vote || $s_quick_reply ) )); } } +// now I have the urge to wash my hands :( // We overwrite $_REQUEST['f'] if there is no forum specified -- cgit v1.2.1 From 89d87a21823494069bf7d34f450985e0e705abeb Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 2 Jul 2009 08:50:57 +0000 Subject: #47725 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9712 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 90e033dab7..0ddf8603fc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -28,6 +28,9 @@ $topic_id = request_var('t', 0); $post_id = request_var('p', 0); $voted_id = request_var('vote_id', array('' => 0)); +$voted_id = (sizeof($voted_id) > 1) ? array_unique($voted_id) : $voted_id; + + $start = request_var('start', 0); $view = request_var('view', ''); -- cgit v1.2.1 From f7b5c060ae67a7ad568b3317043a743f84052f79 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 18 Jul 2009 09:42:28 +0000 Subject: Fix bug #37635 - Hide profile-icon from viewtopic-page if user has no permissions (subsilver2 only) - Patch by leviatan21 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9775 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0ddf8603fc..5fdf3fd825 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1470,7 +1470,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) '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) : '', 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), - 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], -- cgit v1.2.1 From e9830e5530739f90fa094106fb93f456643afd37 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 18 Jul 2009 13:03:45 +0000 Subject: fix r9775 Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9780 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 5fdf3fd825..0ddf8603fc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1470,6 +1470,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) '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) : '', 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], -- cgit v1.2.1 From aee21acf48dca17da97d4ab89761adf2d6abf7bd Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 19 Jul 2009 09:41:09 +0000 Subject: Cache get_username_string() function calls on viewtopic. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9790 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0ddf8603fc..f3f6923381 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1116,6 +1116,11 @@ while ($row = $db->sql_fetchrow($result)) 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', + + 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), + 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), + 'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']), + 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), ); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); @@ -1434,10 +1439,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) // $postrow = array( - 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), - 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), - 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), - 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_profile'] : get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'RANK_TITLE' => $user_cache[$poster_id]['rank_title'], 'RANK_IMG' => $user_cache[$poster_id]['rank_image'], -- cgit v1.2.1 From 76508b59d71f5c9943256045a4677888aca2464c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 19 Jul 2009 11:41:57 +0000 Subject: QR changes to let the options actually work (we use checkboxes and isset()) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9798 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f3f6923381..69267f08dc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1435,7 +1435,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $s_first_unread = $first_unread = true; } - + // $postrow = array( @@ -1614,41 +1614,44 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; -if ($s_can_vote || $s_quick_reply ) +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id); + +if ($s_can_vote || $s_quick_reply) { add_form_key('posting'); + if ($s_quick_reply) { - - $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); - $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); - $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); - $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $s_attach_sig = $config['allow_sig'] && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $qr_hidden_fields = array( - 'topic_cur_post_id' => $topic_data['topic_last_post_id'], - 'lastclick' => time(), - 'topic_id' => $topic_data['topic_id'], - 'forum_id' => $forum_id, - 'disable_bbcode' => !$s_bbcode, - 'disable_smilies' => !$s_smilies, - 'disable_magic_url' => !$config['allow_post_links'], - 'attach_sig' => $s_attach_sig, - 'notify' => $s_notify, + 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], + 'lastclick' => (int) time(), + 'topic_id' => (int) $topic_data['topic_id'], + 'forum_id' => (int) $forum_id, ); - + + // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked + (!$s_bbcode) ? $qr_hidden_fields['disable_bbcode'] = 1 : true; + (!$s_smilies) ? $qr_hidden_fields['disable_smilies'] = 1 : true; + (!$config['allow_post_links']) ? $qr_hidden_fields['disable_magic_url'] = 1 : true; + ($s_attach_sig) ? $qr_hidden_fields['attach_sig'] = 1 : true; + ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; + $template->assign_vars(array( - 'S_QUICK_REPLY' => true, + 'S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), - )); } } // now I have the urge to wash my hands :( - - + + // 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 4fcd83fa7d44e0e875697eecef2386f732052b58 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Fri, 24 Jul 2009 12:05:17 +0000 Subject: Fix bug #38055 - Post reply button shown in locked forum Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9846 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 69267f08dc..aa2a6be10a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -605,7 +605,7 @@ $template->assign_vars(array( 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), - 'S_IS_LOCKED' =>($topic_data['topic_status'] == ITEM_UNLOCKED) ? false : true, + 'S_IS_LOCKED' => ($topic_data['topic_status'] == ITEM_UNLOCKED && $topic_data['forum_status'] == ITEM_UNLOCKED) ? false : true, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, -- cgit v1.2.1 From 2958890439f29b9cf45997c52c8cfa57e0f16bc8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 1 Aug 2009 12:28:50 +0000 Subject: Apply locale-independent basename() to attachment filenames. New function added: utf8_basename(). (Bug #43335 - Patch by ocean=Yohsuke) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9905 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index aa2a6be10a..52bae414df 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1613,7 +1613,6 @@ else if (!$all_marked_read) } // let's set up quick_reply -// TODO: introduce a per-forum and a per-user setting $s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id); if ($s_can_vote || $s_quick_reply) -- cgit v1.2.1 From 1f871950d8bbefe59e18c00ea3238591c0b73807 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Mon, 3 Aug 2009 15:46:56 +0000 Subject: #48985 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9916 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 52bae414df..fc96f0c901 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1179,7 +1179,22 @@ if ($config['load_cpf_viewtopic']) $cp = new custom_profile(); // Grab all profile fields from users in id cache for later use - similar to the poster cache - $profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache); + $profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache); + + // filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs. + $profile_fields_cache = array(); + foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) + { + $profile_fields_cache[$profile_user_id] = array(); + foreach ($profile_fields as $used_ident => $profile_field) + { + if ($profile_field['data']['field_show_on_vt']) + { + $profile_fields_cache[$profile_user_id][$used_ident] = $profile_field; + } + } + } + unset($profile_fields_tmp); } // Generate online information for user -- cgit v1.2.1 From 914687075da7769583e2752701121deee61ff525 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Wed, 5 Aug 2009 12:51:48 +0000 Subject: Fix bug #15729 - Global announcements marked as read if all new topics in forum are viewed Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9926 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 fc96f0c901..51a8682229 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1582,10 +1582,10 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use // Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed. if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) { - markread('topic', $forum_id, $topic_id, $max_post_time); + markread('topic', (($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_id, $max_post_time); // Update forum info - $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); + $all_marked_read = update_forum_tracking_info((($topic_data['topic_type'] == POST_GLOBAL) ? 0 : $forum_id), $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); } else { -- cgit v1.2.1 From 2d0d35db48b0c3aae9952e1cf805beebe222958c Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 12 Aug 2009 10:30:37 +0000 Subject: populate who is online only where required git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9961 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 51a8682229..10f782089b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1675,7 +1675,7 @@ if (empty($_REQUEST['f'])) } // Output the page -page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']); +page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title'], true, $forum_id); $template->set_filenames(array( 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') -- cgit v1.2.1 From 09ad10a734c0993f9465e6ac3463951251602fc6 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 12 Aug 2009 15:00:47 +0000 Subject: ok, i am very sorry, but this needs to be fixed. Generally, our config table is not really suited for holding large datasets. Because feed settings for the forums to enable news feeds and excluded forums rely on the forums itself we have decided to introduce a forum_options table where custom options can be stored. Additionally, for this to work across all DBMS we support, we added a new method to the DBAL for the bitwise AND operator. Also moved the forum/topic feed template variable to the location where they belong to (forum and topic view) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9965 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 10f782089b..baaf3cfaf1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -620,6 +620,7 @@ $template->assign_vars(array( '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, + 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $topic_data['forum_options'])) ? true : false, 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_FORUM' => $server_path, @@ -1180,7 +1181,7 @@ if ($config['load_cpf_viewtopic']) // Grab all profile fields from users in id cache for later use - similar to the poster cache $profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache); - + // filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs. $profile_fields_cache = array(); foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) -- cgit v1.2.1 From 84154098e78226c999ef90cb986e8f99613673fd Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 14 Aug 2009 15:51:34 +0000 Subject: #47795 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9983 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index baaf3cfaf1..1f42c041ff 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -86,6 +86,7 @@ if ($view && !$post_id) WHERE topic_id = $topic_id " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND post_approved = 1') . " AND post_time > $topic_last_read + AND forum_id = $forum_id ORDER BY post_time ASC"; $result = $db->sql_query_limit($sql, 1); $row = $db->sql_fetchrow($result); @@ -188,6 +189,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['FROM'][POSTS_TABLE] = 'p'; } @@ -235,7 +237,7 @@ if (!$post_id) } else { - $sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id" . ((!$auth->acl_get('m_approve', $forum_id)) ? ' AND p.post_approved = 1' : ''); + $sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id"; } $sql_array['WHERE'] .= ' AND (f.forum_id = t.forum_id'; @@ -263,6 +265,7 @@ $result = $db->sql_query($sql); $topic_data = $db->sql_fetchrow($result); $db->sql_freeresult($result); +// link to unapproved post or incorrect link if (!$topic_data) { // If post_id was submitted, we try at least to display the topic as a last resort... @@ -274,9 +277,23 @@ if (!$topic_data) trigger_error('NO_TOPIC'); } +$forum_id = (int) $topic_data['forum_id']; +$topic_id = (int) $topic_data['topic_id']; + // This is for determining where we are (page) if ($post_id) { + // are we where we are supposed to be? + if ($post_id && !$topic_data['post_approved'] && !$auth->acl_get('m_approve', $topic_data['forum_id'])) + { + // If post_id was submitted, we try at least to display the topic as a last resort... + if ($post_id && $topic_id) + { + redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); + } + + trigger_error('NO_TOPIC'); + } 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'; @@ -307,9 +324,6 @@ if ($post_id) } } -$forum_id = (int) $topic_data['forum_id']; -$topic_id = (int) $topic_data['topic_id']; - // $topic_replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies']; -- cgit v1.2.1 From e1fa222dc56883f1f529e1efddd0b7a8d019cb14 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 14 Aug 2009 15:55:50 +0000 Subject: we are not supposed to know that yet git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9984 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 1f42c041ff..2592b1be07 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -278,8 +278,6 @@ if (!$topic_data) } $forum_id = (int) $topic_data['forum_id']; -$topic_id = (int) $topic_data['topic_id']; - // This is for determining where we are (page) if ($post_id) { @@ -324,6 +322,7 @@ if ($post_id) } } +$topic_id = (int) $topic_data['topic_id']; // $topic_replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_data['topic_replies_real'] : $topic_data['topic_replies']; -- cgit v1.2.1 From 57420e4dc9b2ae90975fc1f6266913d4d946515c Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 14 Aug 2009 15:56:35 +0000 Subject: we are not supposed to know that yet git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9985 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 2592b1be07..1aa120622e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -282,10 +282,10 @@ $forum_id = (int) $topic_data['forum_id']; if ($post_id) { // are we where we are supposed to be? - if ($post_id && !$topic_data['post_approved'] && !$auth->acl_get('m_approve', $topic_data['forum_id'])) + if (!$topic_data['post_approved'] && !$auth->acl_get('m_approve', $topic_data['forum_id'])) { // If post_id was submitted, we try at least to display the topic as a last resort... - if ($post_id && $topic_id) + if ($topic_id) { redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); } -- cgit v1.2.1 From d2d5ecef8d5fba02747b57e58bb89360100ea021 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Tue, 18 Aug 2009 14:51:08 +0000 Subject: Better tracking of global announcements Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10018 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1aa120622e..e743a92651 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1593,6 +1593,27 @@ if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($use } } +// Get last post time for all global announcements +// to keep proper forums tracking +if ($topic_data['topic_type'] == POST_GLOBAL) +{ + $sql = 'SELECT topic_last_post_time as forum_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = 0 + ORDER BY topic_last_post_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $topic_data['forum_last_post_time'] = (int) $db->sql_fetchfield('forum_last_post_time'); + $db->sql_freeresult($result); + + $sql = 'SELECT mark_time as forum_mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE forum_id = 0 + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $topic_data['forum_mark_time'] = (int) $db->sql_fetchfield('forum_mark_time'); + $db->sql_freeresult($result); +} + // Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed. if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) { -- cgit v1.2.1 From 74879efcb5c8af253c1d4bdbe97c8065681a1778 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 20 Aug 2009 14:50:40 +0000 Subject: Sort private messages by message time and not message id. (Bug #50015) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10035 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 e743a92651..ed4b60cf2c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -907,6 +907,7 @@ else $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); $sql_start = $start; } + if (is_array($sort_by_sql[$sort_key])) { $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; @@ -916,7 +917,6 @@ else $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } - // 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; @@ -1604,7 +1604,7 @@ if ($topic_data['topic_type'] == POST_GLOBAL) $result = $db->sql_query_limit($sql, 1); $topic_data['forum_last_post_time'] = (int) $db->sql_fetchfield('forum_last_post_time'); $db->sql_freeresult($result); - + $sql = 'SELECT mark_time as forum_mark_time FROM ' . FORUMS_TRACK_TABLE . ' WHERE forum_id = 0 -- cgit v1.2.1 From 7ce940680a410f9c8086001d8fb0c316e5dcf646 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 31 Aug 2009 12:29:45 +0000 Subject: Do not take edit post time into account for determining permission to delete last post in topic. (Bug #48615) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10076 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ed4b60cf2c..eaa17279a2 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1465,6 +1465,20 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $s_first_unread = $first_unread = true; } + $edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( + $user->data['user_id'] == $poster_id && + $auth->acl_get('f_edit', $forum_id) && + !$row['post_edit_locked'] && + ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) + ))); + + $delete_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ( + $user->data['user_id'] == $poster_id && + $auth->acl_get('f_delete', $forum_id) && + $topic_data['topic_last_post_id'] == $row['post_id'] && + // we do not want to allowe removal of the last post if a moderator locked it! + !$row['post_edit_locked'] + ))); // $postrow = array( @@ -1499,10 +1513,10 @@ 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), - 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($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_EDIT' => ($edit_allowed) ? 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) : '', - 'U_DELETE' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '', 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], -- cgit v1.2.1 From 139f1d35302fc675b5e972e55c62d36cbc42af5c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 31 Aug 2009 14:57:04 +0000 Subject: fix r10076 for #48615 - Ability to specify amount of time user is able to delete his last post in topic. Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10080 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eaa17279a2..e7522841e3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1476,7 +1476,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && - // we do not want to allowe removal of the last post if a moderator locked it! + ($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) && + // we do not want to allow removal of the last post if a moderator locked it! !$row['post_edit_locked'] ))); -- cgit v1.2.1 From bc677ae3adb353be88696ade0e27cf1668657763 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 18 Sep 2009 14:28:45 +0000 Subject: Fix Bug #51375 - Do not show QR in closed topics/forums Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10161 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e7522841e3..236c018afe 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1678,7 +1678,8 @@ else if (!$all_marked_read) } // let's set up quick_reply -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id); +$s_allowed_reply = ((!$auth->acl_get('f_reply', $forum_id) || ($topic_data['forum_status'] == ITEM_LOCKED) || ($topic_data['topic_status'] == ITEM_LOCKED)) && !$auth->acl_get('m_edit', $forum_id)) ? false : true; +$s_quick_reply = $s_allowed_reply && $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY); if ($s_can_vote || $s_quick_reply) { -- cgit v1.2.1 From 87eb1d9f20d2c534b20baed199e0b96f1f9df98d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 23 Sep 2009 08:19:22 +0000 Subject: Fix Bug #51775 - Do not unlock topics with QuickReply Authorised by: AcydBurn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10179 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 236c018afe..7fb954017d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1705,6 +1705,7 @@ if ($s_can_vote || $s_quick_reply) (!$config['allow_post_links']) ? $qr_hidden_fields['disable_magic_url'] = 1 : true; ($s_attach_sig) ? $qr_hidden_fields['attach_sig'] = 1 : true; ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; + ($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true; $template->assign_vars(array( 'S_QUICK_REPLY' => true, -- cgit v1.2.1 From cf9e42ffd88aa76c559a43f9a68f736a2367b9cf Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 30 Nov 2009 00:06:15 +0000 Subject: Fix Bug #53025 - Correctly show topic ATOM feed link when only post id is specified. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10295 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 7fb954017d..a114940449 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1726,6 +1726,12 @@ if (empty($_REQUEST['f'])) $_REQUEST['f'] = $forum_id; } +// We need to do the same with the topic_id. See #53025. +if (empty($_REQUEST['t']) && !empty($topic_id)) +{ + $_REQUEST['t'] = $topic_id; +} + // Output the page page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title'], true, $forum_id); -- cgit v1.2.1 From f8178778f83bf388af3426f952b5d7ed336b0e81 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 17 Jan 2010 16:30:33 +0000 Subject: Bug #56235 - Do not unsubscribe users from topics replying with quickreply. Authorised by: ToonArmy git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10408 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 a114940449..93c1f99f0e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1690,7 +1690,7 @@ if ($s_can_vote || $s_quick_reply) $s_attach_sig = $config['allow_sig'] && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); - $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $s_notify = $config['allow_topic_notify'] && ($user->data['user_notify'] || $s_watching_topic['is_watching']); $qr_hidden_fields = array( 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], -- cgit v1.2.1 From f7575b3a0ce73157b4e2d14c07f4e99b53aade27 Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Sun, 17 Jan 2010 16:49:23 +0000 Subject: Fix bug #56555 - Quick reply + posting permission Authorised by: ToonArmy git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10414 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 93c1f99f0e..8f42342a87 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1678,8 +1678,12 @@ else if (!$all_marked_read) } // let's set up quick_reply -$s_allowed_reply = ((!$auth->acl_get('f_reply', $forum_id) || ($topic_data['forum_status'] == ITEM_LOCKED) || ($topic_data['topic_status'] == ITEM_LOCKED)) && !$auth->acl_get('m_edit', $forum_id)) ? false : true; -$s_quick_reply = $s_allowed_reply && $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY); +$s_quick_reply = false; +if ($user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id)) +{ + // Quick reply enabled forum + $s_quick_reply = (($topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED) || $auth->acl_get('m_edit', $forum_id)) ? true : false; +} if ($s_can_vote || $s_quick_reply) { -- cgit v1.2.1 From 14b5aab07feda92f405adc699499438e40e3f371 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 20 Feb 2010 00:02:56 +0000 Subject: Firebird based board can now access their global announcements, took a while to discover this one. #57525 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10509 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/viewtopic.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8f42342a87..29c4e5cdc1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -186,6 +186,13 @@ $sql_array = array( 'FROM' => array(FORUMS_TABLE => 'f'), ); +// Firebird handles two columns of the same name a little differently, this +// addresses that by forcing the forum_id to come from the forums table. +if ($db->sql_layer === 'firebird') +{ + $sql_array['SELECT'] = 'f.forum_id AS forum_id, ' . $sql_array['SELECT']; +} + // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { -- cgit v1.2.1