mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-19 15:22:08 +02:00
[ticket/12366] Changed to sql_build_query
PHPBB3-12366
This commit is contained in:
parent
baf51dd5fd
commit
03e081df26
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user