From 1f44b4da18622c526e89858f7f89df9857f3a00e Mon Sep 17 00:00:00 2001 From: n-aleha Date: Mon, 14 Apr 2014 01:14:44 +0300 Subject: [ticket/12345] Improve search flood interval message for ascraeus Show to guests and users the remaining seconds until their next allowed search, if a search flood limit is enabled for them. PHPBB3-12345 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 4756a941f5..749aec45fd 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -108,7 +108,7 @@ if ($interval && !in_array($search_id, array('unreadposts', 'unanswered', 'activ if ($user->data['user_last_search'] > time() - $interval) { $template->assign_var('S_NO_SEARCH', true); - trigger_error('NO_SEARCH_TIME'); + trigger_error($user->lang('NO_SEARCH_TIME', (int) ($user->data['user_last_search'] + $interval - time()))); } } -- cgit v1.2.1 From 2ec9c08a2bce2cb83c68339d2d07039cabc44d68 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 11 Apr 2014 14:10:58 +0200 Subject: [ticket/12052] Use different visibility when post was edited ... and needs to be reapproved. PHPBB3-12052 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index fbb4e93089..778e985bce 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -879,7 +879,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; - $topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $forum_id)) ? true : false; $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; -- cgit v1.2.1 From b32895308d13d5d9b0cd954fd8ce871a1fa073da Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 25 Apr 2014 12:15:44 +0200 Subject: [ticket/12273] Update since version to 3.1.0-a* style PHPBB3-12273 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index fbb4e93089..6364539ab3 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -681,7 +681,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string sql_select The SQL SELECT string used by search to get topic data * @var string sql_from The SQL FROM string used by search to get topic data * @var string sql_where The SQL WHERE string used by search to get topic data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('sql_select', 'sql_from', 'sql_where'); extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); @@ -1004,7 +1004,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @event core.search_modify_tpl_ary * @var array row Array with topic data * @var array tpl_ary Template block array with topic data - * @since 3.1-A1 + * @since 3.1.0-a1 */ $vars = array('row', 'tpl_ary'); extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); -- cgit v1.2.1 From ceca2e9ba17daeae3e6144cf673a27b58a235cf9 Mon Sep 17 00:00:00 2001 From: PayBas Date: Tue, 15 Apr 2014 17:17:47 +0200 Subject: [ticket/12411] Expand vars of event: core.search_modify_tpl_ary PHPBB3-12411 --- phpBB/search.php | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index dfb53c6896..2b616c40fa 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1002,11 +1002,43 @@ if ($keywords || $author || $author_id || $search_id || $submit) * Modify the topic data before it is assigned to the template * * @event core.search_modify_tpl_ary - * @var array row Array with topic data - * @var array tpl_ary Template block array with topic data + * @var array row Array with topic data + * @var array tpl_ary Template block array with topic data + * @var string show_results Display topics or posts + * @var string topic_title Cleaned topic title + * @var int replies The number of topic replies + * @var string view_topic_url The URL to the topic + * @var string folder_img The folder image of the topic + * @var string folder_alt The alt attribute of the topic folder img + * @var int topic_type The topic type + * @var int unread_topic Whether the topic has unread posts + * @var int topic_unapproved Whether the topic is unapproved + * @var int posts_unapproved The number of unapproved posts + * @var int topic_deleted Whether the topic has been deleted + * @var string u_mcp_queue The URL to the corresponding MCP queue page + * @var array zebra The zebra data of the current user + * @var array attachments All the attachments of the search results * @since 3.1.0-a1 + * @changed 3.1.0-b3 Added many vars */ - $vars = array('row', 'tpl_ary'); + $vars = array( + 'row', + 'tpl_ary', + 'show_results', + 'topic_title', + 'replies', + 'view_topic_url', + 'folder_img', + 'folder_alt', + 'topic_type', + 'unread_topic', + 'topic_unapproved', + 'posts_unapproved', + 'topic_deleted', + 'u_mcp_queue', + 'zebra', + 'attachments' + ); extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); $template->assign_block_vars('searchresults', $tpl_ary); -- cgit v1.2.1 From 598d1ecda853702225429432c0dec3faa3f5ad82 Mon Sep 17 00:00:00 2001 From: PayBas Date: Sat, 19 Apr 2014 12:24:08 +0200 Subject: [ticket/12411] Corrected event vars description PHPBB3-12411 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 2b616c40fa..b9454ea792 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1012,9 +1012,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string folder_alt The alt attribute of the topic folder img * @var int topic_type The topic type * @var int unread_topic Whether the topic has unread posts - * @var int topic_unapproved Whether the topic is unapproved + * @var bool topic_unapproved Whether the topic is unapproved * @var int posts_unapproved The number of unapproved posts - * @var int topic_deleted Whether the topic has been deleted + * @var bool topic_deleted Whether the topic has been deleted * @var string u_mcp_queue The URL to the corresponding MCP queue page * @var array zebra The zebra data of the current user * @var array attachments All the attachments of the search results -- cgit v1.2.1 From 91ab67d1d951eca41f45c9f702c7fd32651b8965 Mon Sep 17 00:00:00 2001 From: PayBas Date: Sat, 19 Apr 2014 16:40:49 +0200 Subject: [ticket/12411] Missed on bool var sloppy PHPBB3-12411 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index b9454ea792..fe7544d6d3 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1011,7 +1011,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string folder_img The folder image of the topic * @var string folder_alt The alt attribute of the topic folder img * @var int topic_type The topic type - * @var int unread_topic Whether the topic has unread posts + * @var bool unread_topic Whether the topic has unread posts * @var bool topic_unapproved Whether the topic is unapproved * @var int posts_unapproved The number of unapproved posts * @var bool topic_deleted Whether the topic has been deleted -- cgit v1.2.1 From baf51dd5fd4cf054c9ef27627e345c4a1cb4f520 Mon Sep 17 00:00:00 2001 From: PayBas Date: Sun, 6 Apr 2014 22:05:25 +0200 Subject: [ticket/12366] Add Event core.search_get_posts_data PHPBB3-12366 --- phpBB/search.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index dfb53c6896..2dc65a194d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -635,11 +635,26 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $db->sql_freeresult($result); - $sql = 'SELECT p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour - FROM ' . POSTS_TABLE . ' p + $sql_from = POSTS_TABLE . ' p LEFT JOIN ' . TOPICS_TABLE . ' t ON (p.topic_id = t.topic_id) LEFT JOIN ' . FORUMS_TABLE . ' f ON (p.forum_id = f.forum_id) - LEFT JOIN ' . USERS_TABLE . " u ON (p.poster_id = u.user_id) + LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id) '; + $sql_select = 'p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour'; + + /** + * Event to modify the SQL query before the posts data is retrieved + * + * @event core.search_get_posts_data + * @var string sql_select The SQL SELECT string used by search to get posts data + * @var string sql_from The SQL FROM string used by search to get posts data + * @var string sql_where The SQL WHERE string used by search to get posts data + * @since 3.1.0-b3 + */ + $vars = array('sql_select', 'sql_from', 'sql_where'); + extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); + + $sql = "SELECT $sql_select + FROM $sql_from WHERE $sql_where"; } else -- cgit v1.2.1 From 03e081df26daed6c5e93594a80eec31fe1debb91 Mon Sep 17 00:00:00 2001 From: PayBas Date: Sun, 6 Apr 2014 23:25:17 +0200 Subject: [ticket/12366] Changed to sql_build_query PHPBB3-12366 --- phpBB/search.php | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 2dc65a194d..3314328b62 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -635,27 +635,39 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $db->sql_freeresult($result); - $sql_from = POSTS_TABLE . ' p - LEFT JOIN ' . TOPICS_TABLE . ' t ON (p.topic_id = t.topic_id) - LEFT JOIN ' . FORUMS_TABLE . ' f ON (p.forum_id = f.forum_id) - LEFT JOIN ' . USERS_TABLE . ' u ON (p.poster_id = u.user_id) '; - $sql_select = 'p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour'; + $sql_array = array( + 'SELECT' => 'p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id', + ), + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ), + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'p.poster_id = u.user_id', + ), + ), + 'WHERE' => $sql_where, + ); /** * Event to modify the SQL query before the posts data is retrieved * * @event core.search_get_posts_data - * @var string sql_select The SQL SELECT string used by search to get posts data - * @var string sql_from The SQL FROM string used by search to get posts data - * @var string sql_where The SQL WHERE string used by search to get posts data + * @var array sql_array The SQL array * @since 3.1.0-b3 */ - $vars = array('sql_select', 'sql_from', 'sql_where'); + $vars = array('sql_array'); extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); - $sql = "SELECT $sql_select - FROM $sql_from - WHERE $sql_where"; + $sql = $db->sql_build_query('SELECT', $sql_array); } else { -- cgit v1.2.1 From fadbd2345676fa519a4995a203682fb1f3375011 Mon Sep 17 00:00:00 2001 From: PayBas Date: Mon, 7 Apr 2014 23:06:09 +0200 Subject: [ticket/12366] Include ORDER BY into the query builder PHPBB3-12366 --- phpBB/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 3314328b62..0469f07840 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -655,6 +655,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) ), ), 'WHERE' => $sql_where, + 'ORDER_BY' => $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'), ); /** @@ -716,8 +717,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sql = "SELECT $sql_select FROM $sql_from WHERE $sql_where"; + $sql .= ' ORDER BY ' . $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); } - $sql .= ' ORDER BY ' . $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); $result = $db->sql_query($sql); $result_topic_id = 0; -- cgit v1.2.1 From 573ec0dbe9a1ed9c4b17cfe910b3cd017dbeb63b Mon Sep 17 00:00:00 2001 From: PayBas Date: Mon, 14 Apr 2014 21:44:46 +0200 Subject: [ticket/12366] Expanded event vars PHPBB3-12366 --- phpBB/search.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 0469f07840..d32183b80d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -663,9 +663,21 @@ if ($keywords || $author || $author_id || $search_id || $submit) * * @event core.search_get_posts_data * @var array sql_array The SQL array + * @var array zebra Array of zebra data for the current user + * @var int total_match_count The total number of search matches + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var string s_sort_dir The sort direction + * @var string s_sort_key The sort key + * @var string s_limit_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_fields The data fields to search in + * @var int search_id The id of the search request + * @var int start The starting id of the results * @since 3.1.0-b3 */ - $vars = array('sql_array'); + $vars = array('sql_array', 'zebra', 'total_match_count', 'keywords', 'sort_by_sql', 's_sort_dir', 's_sort_key', 's_limit_days', 'ex_fid_ary', 'author_id_ary', 'search_fields', 'search_id', 'start'); extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_array); -- cgit v1.2.1 From c63f2656a80a49a6f27aa38c460420087e7fa066 Mon Sep 17 00:00:00 2001 From: PayBas Date: Fri, 2 May 2014 14:12:01 +0200 Subject: [ticket/12366] Conform to new event coding guidelines PHPBB3-12366 --- phpBB/search.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index d32183b80d..301c29cd44 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -677,7 +677,21 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var int start The starting id of the results * @since 3.1.0-b3 */ - $vars = array('sql_array', 'zebra', 'total_match_count', 'keywords', 'sort_by_sql', 's_sort_dir', 's_sort_key', 's_limit_days', 'ex_fid_ary', 'author_id_ary', 'search_fields', 'search_id', 'start'); + $vars = array( + 'sql_array', + 'zebra', + 'total_match_count', + 'keywords', + 'sort_by_sql', + 's_sort_dir', + 's_sort_key', + 's_limit_days', + 'ex_fid_ary', + 'author_id_ary', + 'search_fields', + 'search_id', + 'start' + ); extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_array); -- cgit v1.2.1 From 67c26623ed54e94acb1047021359f17856c098b4 Mon Sep 17 00:00:00 2001 From: PayBas Date: Fri, 2 May 2014 16:05:52 +0200 Subject: [ticket/12411] Improved change documentation PHPBB3-12411 --- phpBB/search.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index fe7544d6d3..1c7c970d9f 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1019,7 +1019,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var array zebra The zebra data of the current user * @var array attachments All the attachments of the search results * @since 3.1.0-a1 - * @changed 3.1.0-b3 Added many vars + * @changed 3.1.0-b3 Added vars show_results, topic_title, replies, + * view_topic_url, folder_img, folder_alt, topic_type, unread_topic, + * topic_unapproved, posts_unapproved, topic_deleted, u_mcp_queue, + * zebra, attachments */ $vars = array( 'row', @@ -1037,7 +1040,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'topic_deleted', 'u_mcp_queue', 'zebra', - 'attachments' + 'attachments', ); extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); -- cgit v1.2.1 From 3c936b055d3eebe2555534f77f838c92c461861f Mon Sep 17 00:00:00 2001 From: PayBas Date: Fri, 2 May 2014 17:01:59 +0200 Subject: [ticket/12366] Fixed missing comma PHPBB3-12366 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 301c29cd44..7583cd9e10 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -690,7 +690,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'author_id_ary', 'search_fields', 'search_id', - 'start' + 'start', ); extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); -- cgit v1.2.1