aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/search.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/search.php')
-rw-r--r--phpBB/search.php36
1 files changed, 24 insertions, 12 deletions
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
{