mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
Merge branch '3.3.x'
This commit is contained in:
@@ -256,7 +256,7 @@ function generate_smilies($mode, $forum_id)
|
||||
*/
|
||||
function update_post_information($type, $ids, $return_update_sql = false)
|
||||
{
|
||||
global $db;
|
||||
global $db, $phpbb_dispatcher;
|
||||
|
||||
if (empty($ids))
|
||||
{
|
||||
@@ -340,14 +340,35 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
|
||||
if (count($last_post_ids))
|
||||
{
|
||||
$sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour
|
||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||
WHERE p.poster_id = u.user_id
|
||||
AND ' . $db->sql_in_set('p.post_id', $last_post_ids);
|
||||
$result = $db->sql_query($sql);
|
||||
$sql_ary = array(
|
||||
'SELECT' => 'p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour',
|
||||
'FROM' => array(
|
||||
POSTS_TABLE => 'p',
|
||||
USERS_TABLE => 'u',
|
||||
),
|
||||
'WHERE' => $db->sql_in_set('p.post_id', $last_post_ids) . '
|
||||
AND p.poster_id = u.user_id',
|
||||
);
|
||||
|
||||
/**
|
||||
* Event to modify the SQL array to get the post and user data from all last posts
|
||||
*
|
||||
* @event core.update_post_info_modify_posts_sql
|
||||
* @var string type The table being updated (forum or topic)
|
||||
* @var array sql_ary SQL array to get some of the last posts' data
|
||||
* @since 3.3.5-RC1
|
||||
*/
|
||||
$vars = [
|
||||
'type',
|
||||
'sql_ary',
|
||||
];
|
||||
extract($phpbb_dispatcher->trigger_event('core.update_post_info_modify_posts_sql', compact($vars)));
|
||||
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
|
||||
|
||||
$rowset = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$rowset[] = $row;
|
||||
$update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id'];
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
|
||||
$update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time'];
|
||||
@@ -356,6 +377,23 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||
$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'";
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
/**
|
||||
* Event to modify the update_sql array to add new update data for forum or topic last posts
|
||||
*
|
||||
* @event core.update_post_info_modify_sql
|
||||
* @var string type The table being updated (forum or topic)
|
||||
* @var array rowset Array with the posts data
|
||||
* @var array update_sql Array with SQL data to update the forums or topics table with
|
||||
* @since 3.3.5-RC1
|
||||
*/
|
||||
$vars = [
|
||||
'type',
|
||||
'rowset',
|
||||
'update_sql',
|
||||
];
|
||||
extract($phpbb_dispatcher->trigger_event('core.update_post_info_modify_sql', compact($vars)));
|
||||
unset($rowset);
|
||||
}
|
||||
unset($empty_forums, $ids, $last_post_ids);
|
||||
|
||||
|
Reference in New Issue
Block a user