mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 13:30:25 +02:00
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/10411-2
* 'develop' of https://github.com/phpbb/phpbb3: (497 commits) [ticket/10986] message.id fallback to SERVER_NAME or phpbb.generated [ticket/11358] Changed the name of post parameter. [ticket/11358] Changed the action parameter value to represent the link. [ticket/11358] Enabled link making all users default for a group. [ticket/11358] Removed redundant code and referred proper variable. [ticket/11358] Success message even without selecting a user. [ticket/11355] Referred proper variable when validating selection. [ticket/11355] Wrong error message when no user is selected. [ticket/10896] Add missing email validation lost in develop merge [ticket/7262] Add note about set_config() not updating is_dynamic. [ticket/7262] Add $is_dynamic example to set_config() and set_config_count(). [ticket/7262] Backport set_config() and set_config_count() docs from develop. [ticket/11122] Move rxu to 'Former Contributors' section. [ticket/11122] Add EXreaction to docs/AUTHORS. [ticket/11298] Fix typo in language key; EXTENSIONS -> EXTENSION [ticket/11361] Make sure that array passed to strtr() has the proper format. [ticket/11342] Fix "unexpected token" syntax error [ticket/11179] remove extra & in function call [ticket/11179] correct start parameter in sphinx search [ticket/11179] correct start parameter in native author search ... Conflicts: phpBB/config/services.yml phpBB/includes/functions_user.php phpBB/install/schemas/firebird_schema.sql phpBB/install/schemas/mssql_schema.sql phpBB/install/schemas/mysql_40_schema.sql phpBB/install/schemas/mysql_41_schema.sql phpBB/install/schemas/oracle_schema.sql phpBB/install/schemas/postgres_schema.sql phpBB/install/schemas/sqlite_schema.sql
This commit is contained in:
@@ -2676,12 +2676,12 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (isset($sql_ary['group_avatar']) && !$sql_ary['group_avatar'])
|
||||
if (isset($sql_ary['group_avatar']))
|
||||
{
|
||||
remove_default_avatar($group_id, $user_ary);
|
||||
}
|
||||
|
||||
if (isset($sql_ary['group_rank']) && !$sql_ary['group_rank'])
|
||||
if (isset($sql_ary['group_rank']))
|
||||
{
|
||||
remove_default_rank($group_id, $user_ary);
|
||||
}
|
||||
@@ -2845,7 +2845,7 @@ function avatar_remove_db($avatar_name)
|
||||
*/
|
||||
function group_delete($group_id, $group_name = false)
|
||||
{
|
||||
global $db, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container;
|
||||
global $db, $cache, $auth, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container;
|
||||
|
||||
if (!$group_name)
|
||||
{
|
||||
@@ -2917,12 +2917,12 @@ function group_delete($group_id, $group_name = false)
|
||||
extract($phpbb_dispatcher->trigger_event('core.delete_group_after', compact($vars)));
|
||||
|
||||
// Re-cache moderators
|
||||
if (!function_exists('cache_moderators'))
|
||||
if (!function_exists('phpbb_cache_moderators'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
|
||||
cache_moderators();
|
||||
phpbb_cache_moderators($db, $cache, $auth);
|
||||
|
||||
add_log('admin', 'LOG_GROUP_DELETE', $group_name);
|
||||
|
||||
@@ -3212,8 +3212,8 @@ function remove_default_avatar($group_id, $user_ids)
|
||||
user_avatar_width = 0,
|
||||
user_avatar_height = 0
|
||||
WHERE group_id = " . (int) $group_id . "
|
||||
AND user_avatar = '" . $db->sql_escape($row['group_avatar']) . "'
|
||||
AND " . $db->sql_in_set('user_id', $user_ids);
|
||||
AND user_avatar = '" . $db->sql_escape($row['group_avatar']) . "'
|
||||
AND " . $db->sql_in_set('user_id', $user_ids);
|
||||
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
@@ -3250,9 +3250,9 @@ function remove_default_rank($group_id, $user_ids)
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_rank = 0
|
||||
WHERE group_id = ' . (int)$group_id . '
|
||||
AND user_rank <> 0
|
||||
AND user_rank = ' . (int)$row['group_rank'] . '
|
||||
AND ' . $db->sql_in_set('user_id', $user_ids);
|
||||
AND user_rank <> 0
|
||||
AND user_rank = ' . (int)$row['group_rank'] . '
|
||||
AND ' . $db->sql_in_set('user_id', $user_ids);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
@@ -3281,7 +3281,8 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
|
||||
case 'demote':
|
||||
case 'promote':
|
||||
|
||||
$sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "
|
||||
$sql = 'SELECT user_id
|
||||
FROM ' . USER_GROUP_TABLE . "
|
||||
WHERE group_id = $group_id
|
||||
AND user_pending = 1
|
||||
AND " . $db->sql_in_set('user_id', $user_id_ary);
|
||||
@@ -3379,7 +3380,8 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
|
||||
return 'NO_USERS';
|
||||
}
|
||||
|
||||
$sql = 'SELECT user_id, group_id FROM ' . USERS_TABLE . '
|
||||
$sql = 'SELECT user_id, group_id
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
@@ -3467,7 +3469,7 @@ function group_validate_groupname($group_id, $group_name)
|
||||
*/
|
||||
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false)
|
||||
{
|
||||
global $cache, $db, $phpbb_dispatcher;
|
||||
global $phpbb_container, $db, $phpbb_dispatcher;
|
||||
|
||||
if (empty($user_id_ary))
|
||||
{
|
||||
@@ -3513,45 +3515,69 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
|
||||
}
|
||||
}
|
||||
|
||||
// Before we update the user attributes, we will make a list of those having now the group avatar assigned
|
||||
$updated_sql_ary = $sql_ary;
|
||||
|
||||
// Before we update the user attributes, we will update the rank for users that don't have a custom rank
|
||||
if (isset($sql_ary['user_rank']))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', array('user_rank' => $sql_ary['user_rank'])) . '
|
||||
WHERE user_rank = 0
|
||||
AND ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
unset($sql_ary['user_rank']);
|
||||
}
|
||||
|
||||
// Before we update the user attributes, we will update the avatar for users that don't have a custom avatar
|
||||
$avatar_options = array('user_avatar', 'user_avatar_type', 'user_avatar_height', 'user_avatar_width');
|
||||
|
||||
if (isset($sql_ary['user_avatar']))
|
||||
{
|
||||
// Ok, get the original avatar data from users having an uploaded one (we need to remove these from the filesystem)
|
||||
$sql = 'SELECT user_id, group_id, user_avatar
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary) . '
|
||||
AND user_avatar_type = ' . AVATAR_UPLOAD;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
$avatar_sql_ary = array();
|
||||
foreach ($avatar_options as $avatar_option)
|
||||
{
|
||||
avatar_delete('user', $row);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($sql_ary['user_avatar_type']);
|
||||
unset($sql_ary['user_avatar_height']);
|
||||
unset($sql_ary['user_avatar_width']);
|
||||
if (isset($sql_ary[$avatar_option]))
|
||||
{
|
||||
$avatar_sql_ary[$avatar_option] = $sql_ary[$avatar_option];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $avatar_sql_ary) . "
|
||||
WHERE user_avatar = ''
|
||||
AND " . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
// Remove the avatar options, as we already updated them
|
||||
foreach ($avatar_options as $avatar_option)
|
||||
{
|
||||
unset($sql_ary[$avatar_option]);
|
||||
}
|
||||
|
||||
if (!empty($sql_ary))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
if (isset($sql_ary['user_colour']))
|
||||
{
|
||||
// Update any cached colour information for these users
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
$sql = 'UPDATE ' . FORUMS_TABLE . "
|
||||
SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
WHERE " . $db->sql_in_set('topic_poster', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||
SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "'
|
||||
WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary);
|
||||
$db->sql_query($sql);
|
||||
|
||||
@@ -3563,6 +3589,9 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
|
||||
}
|
||||
}
|
||||
|
||||
// Make all values available for the event
|
||||
$sql_ary = $updated_sql_ary;
|
||||
|
||||
/**
|
||||
* Event when the default group is set for an array of users
|
||||
*
|
||||
@@ -3583,7 +3612,7 @@ function group_set_user_default($group_id, $user_id_ary, $group_attributes = fal
|
||||
}
|
||||
|
||||
// Because some tables/caches use usercolour-specific data we need to purge this here.
|
||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
||||
$phpbb_container->get('cache.driver')->destroy('sql', MODERATOR_CACHE_TABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3682,7 +3711,7 @@ function group_memberships($group_id_ary = false, $user_id_ary = false, $return_
|
||||
*/
|
||||
function group_update_listings($group_id)
|
||||
{
|
||||
global $auth;
|
||||
global $db, $cache, $auth;
|
||||
|
||||
$hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_'));
|
||||
|
||||
@@ -3724,22 +3753,22 @@ function group_update_listings($group_id)
|
||||
|
||||
if ($mod_permissions)
|
||||
{
|
||||
if (!function_exists('cache_moderators'))
|
||||
if (!function_exists('phpbb_cache_moderators'))
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
cache_moderators();
|
||||
phpbb_cache_moderators($db, $cache, $auth);
|
||||
}
|
||||
|
||||
if ($mod_permissions || $admin_permissions)
|
||||
{
|
||||
if (!function_exists('update_foes'))
|
||||
if (!function_exists('phpbb_update_foes'))
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
update_foes(array($group_id));
|
||||
phpbb_update_foes($db, $auth, array($group_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user