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