From d71fd5d66091b0ea557ece2e53a02094415362d6 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sat, 15 Mar 2014 19:18:38 +0100 Subject: [ticket/11766] Hide edit, quote and delete buttons if topic is locked But show quote button to guests if topic isn't locked PHPBB3-11766 --- phpBB/viewtopic.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fb12dd925a..e08d6e1ef5 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1509,13 +1509,19 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $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) && + $topic_data['topic_status'] != ITEM_LOCKED && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time']) ))); + $quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED && + ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id)) + ); + $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_status'] != ITEM_LOCKED && $topic_data['topic_last_post_id'] == $row['post_id'] && ($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! @@ -1556,7 +1562,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), '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_QUOTE' => ($quote_allowed) ? 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' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '', -- cgit v1.2.1 From 02378e94e779bbd407ef86166884c00e32d152fc Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Fri, 28 Mar 2014 21:58:18 +0100 Subject: [ticket/10423] Remove * from search or highlight string PHPBB3-10423 --- 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 e08d6e1ef5..4c9302dbbe 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -475,9 +475,10 @@ if ($hilit_words) { if (trim($word)) { + $word = preg_replace('#\s+#u', ' ', trim(preg_replace('#(?<=^|\s)\*(?=\s|$)#', '', $word))); $word = str_replace('\*', '\w+?', preg_quote($word, '#')); $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word); - $highlight_match .= (($highlight_match != '') ? '|' : '') . $word; + $highlight_match .= (($highlight_match != '' && $word != '') ? '|' : '') . $word; } } -- cgit v1.2.1 From face175471b5064117ca57ece53a3403e51e20ba Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Sun, 13 Apr 2014 21:15:14 +0200 Subject: [ticket/10423] Move code into a function and add tests for it PHPBB3-10423 --- 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 4c9302dbbe..31bc1d2701 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -475,7 +475,7 @@ if ($hilit_words) { if (trim($word)) { - $word = preg_replace('#\s+#u', ' ', trim(preg_replace('#(?<=^|\s)\*(?=\s|$)#', '', $word))); + $word = phpbb_clean_search_string($word); $word = str_replace('\*', '\w+?', preg_quote($word, '#')); $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word); $highlight_match .= (($highlight_match != '' && $word != '') ? '|' : '') . $word; -- cgit v1.2.1 From f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Mon, 14 Apr 2014 19:22:14 +0200 Subject: [ticket/10423] Replace foreach with function in viewtopic.php PHPBB3-10423 --- phpBB/viewtopic.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 31bc1d2701..f52e04e1a8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -471,18 +471,11 @@ else $highlight_match = $highlight = ''; if ($hilit_words) { - foreach (explode(' ', trim($hilit_words)) as $word) - { - if (trim($word)) - { - $word = phpbb_clean_search_string($word); - $word = str_replace('\*', '\w+?', preg_quote($word, '#')); - $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word); - $highlight_match .= (($highlight_match != '' && $word != '') ? '|' : '') . $word; - } - } - - $highlight = urlencode($hilit_words); + $highlight_match = phpbb_clean_search_string($hilit_words); + $highlight = urlencode($highlight_match); + $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#')); + $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match); + $highlight_match = str_replace(' ', '|', $highlight_match); } // Make sure $start is set to the last page if it exceeds the amount -- cgit v1.2.1