phpBB

Code Changes

File: includes/functions_user.php

  Unmodified   Added   Modified   Removed
Line 119Line 119
	global $config, $db, $cache, $phpbb_dispatcher;

$update_ary = array(

	global $config, $db, $cache, $phpbb_dispatcher;

$update_ary = array(

		FORUMS_TABLE			=> array('forum_last_poster_name'),
MODERATOR_CACHE_TABLE => array('username'),
POSTS_TABLE => array('post_username'),
TOPICS_TABLE => array('topic_first_poster_name', 'topic_last_poster_name'),










		FORUMS_TABLE			=> array(
'forum_last_poster_id' => 'forum_last_poster_name',
),
MODERATOR_CACHE_TABLE => array(
'user_id' => 'username',
),
POSTS_TABLE => array(
'poster_id' => 'post_username',
),
TOPICS_TABLE => array(
'topic_poster' => 'topic_first_poster_name',
'topic_last_poster_id' => 'topic_last_poster_name',
),

	);

foreach ($update_ary as $table => $field_ary)
{

	);

foreach ($update_ary as $table => $field_ary)
{

		foreach ($field_ary as $field)

		foreach ($field_ary as $id_field => $name_field)

		{
$sql = "UPDATE $table

		{
$sql = "UPDATE $table

				SET $field = '" . $db->sql_escape($new_name) . "'
WHERE $field = '" . $db->sql_escape($old_name) . "'";


				SET $name_field = '" . $db->sql_escape($new_name) . "'
WHERE $name_field = '" . $db->sql_escape($old_name) . "'
AND $id_field <> " . ANONYMOUS;

			$db->sql_query($sql);
}
}

			$db->sql_query($sql);
}
}

Line 262Line 272
	* Use this event to modify the values to be inserted when a user is added
*
* @event core.user_add_modify_data

	* Use this event to modify the values to be inserted when a user is added
*
* @event core.user_add_modify_data

	* @var array	user_row		Array of user details submited to user_add
* @var array cp_data Array of Custom profile fields submited to user_add
* @var array sql_ary Array of data to be inserted when a user is added


	* @var array	user_row			Array of user details submited to user_add
* @var array cp_data Array of Custom profile fields submited to user_add
* @var array sql_ary Array of data to be inserted when a user is added
* @var array notifications_data Array of notification data to be inserted when a user is added

	* @since 3.1.0-a1

	* @since 3.1.0-a1

	* @change 3.1.0-b5


	* @changed 3.1.0-b5 Added user_row and cp_data
* @changed 3.1.11-RC1 Added notifications_data

	*/

	*/

	$vars = array('user_row', 'cp_data', 'sql_ary');

	$vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data');

	extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars)));

$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);

	extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars)));

$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);

Line 1281Line 1293
*/
function user_unban($mode, $ban)
{

*/
function user_unban($mode, $ban)
{

	global $db, $user, $auth, $cache;

	global $db, $user, $auth, $cache, $phpbb_dispatcher;


// Delete stale bans
$sql = 'DELETE FROM ' . BANLIST_TABLE . '


// Delete stale bans
$sql = 'DELETE FROM ' . BANLIST_TABLE . '

Line 1348Line 1360
				add_log('user', $user_id, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
}
}

				add_log('user', $user_id, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
}
}

 

/**
* Use this event to perform actions after the unban has been performed
*
* @event core.user_unban
* @var string mode One of the following: user, ip, email
* @var array user_ids_ary Array with user_ids
* @since 3.1.11-RC1
*/
$vars = array(
'mode',
'user_ids_ary',
);
extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars)));

	}

$cache->destroy('sql', BANLIST_TABLE);

	}

$cache->destroy('sql', BANLIST_TABLE);

Line 2269Line 2295
{
global $config, $user;


{
global $config, $user;


	return $user->lang('AVATAR_EXPLAIN',

	return $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN',

		$user->lang('PIXELS', (int) $config['avatar_max_width']),
$user->lang('PIXELS', (int) $config['avatar_max_height']),
round($config['avatar_filesize'] / 1024));

		$user->lang('PIXELS', (int) $config['avatar_max_width']),
$user->lang('PIXELS', (int) $config['avatar_max_height']),
round($config['avatar_filesize'] / 1024));

Line 2698Line 2724
*/
function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false)
{

*/
function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false)
{

	global $db, $auth, $phpbb_container;

	global $db, $auth, $phpbb_container, $phpbb_dispatcher;


// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);


// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);

Line 2774Line 2800

// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);


// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);

 

/**
* Event after users are added to a group
*
* @event core.group_add_user_after
* @var int group_id ID of the group to which users are added
* @var string group_name Name of the group
* @var array user_id_ary IDs of the users which are added
* @var array username_ary names of the users which are added
* @var int pending Pending setting, 1 if user(s) added are pending
* @since 3.1.7-RC1
*/
$vars = array(
'group_id',
'group_name',
'user_id_ary',
'username_ary',
'pending',
);
extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars)));


if (!$group_name)
{


if (!$group_name)
{

Line 2811Line 2857
*
* @return false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER'
*/

*
* @return false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER'
*/

function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false)

function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $log_action = true)

{
global $db, $auth, $config, $phpbb_dispatcher, $phpbb_container;


{
global $db, $auth, $config, $phpbb_dispatcher, $phpbb_container;


Line 2933Line 2979
	// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);


	// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);


 
	/**
* Event after users are removed from a group
*
* @event core.group_delete_user_after
* @var int group_id ID of the group from which users are deleted
* @var string group_name Name of the group
* @var array user_id_ary IDs of the users which are removed
* @var array username_ary names of the users which are removed
* @since 3.1.7-RC1
*/
$vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary');
extract($phpbb_dispatcher->trigger_event('core.group_delete_user_after', compact($vars)));

if ($log_action)
{

	if (!$group_name)
{
$group_name = get_group_name($group_id);

	if (!$group_name)
{
$group_name = get_group_name($group_id);

Line 2943Line 3004
	if ($group_name)
{
add_log('admin', $log, $group_name, implode(', ', $username_ary));

	if ($group_name)
{
add_log('admin', $log, $group_name, implode(', ', $username_ary));

 
		}

	}

group_update_listings($group_id);

	}

group_update_listings($group_id);

Line 3040Line 3102
*/
function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false)
{

*/
function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false)
{

	global $db, $auth, $phpbb_root_path, $phpEx, $config, $phpbb_container;

	global $db, $auth, $phpbb_root_path, $phpEx, $config, $phpbb_container, $phpbb_dispatcher;


// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);


// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);

Line 3170Line 3232
			$log = 'LOG_GROUP_DEFAULTS';
break;
}

			$log = 'LOG_GROUP_DEFAULTS';
break;
}

 

/**
* Event to perform additional actions on setting user group attributes
*
* @event core.user_set_group_attributes
* @var int group_id ID of the group
* @var string group_name Name of the group
* @var array user_id_ary IDs of the users to set group attributes
* @var array username_ary Names of the users to set group attributes
* @var array group_attributes Group attributes which were changed
* @var string action Action to perform over the group members
* @since 3.1.10-RC1
*/
$vars = array(
'group_id',
'group_name',
'user_id_ary',
'username_ary',
'group_attributes',
'action',
);
extract($phpbb_dispatcher->trigger_event('core.user_set_group_attributes', compact($vars)));


// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);


// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);

Line 3586Line 3670
	}

// We need to call group_user_del here, because this function makes sure everything is correctly changed.

	}

// We need to call group_user_del here, because this function makes sure everything is correctly changed.

	// A downside for a call within the session handler is that the language is not set up yet - so no log entry
group_user_del($group_id, $user_id);

	// Force function to not log the removal of users from newly registered users group
group_user_del($group_id, $user_id, false, false, false);


// Set user_new to 0 to let this not be triggered again
$sql = 'UPDATE ' . USERS_TABLE . '


// Set user_new to 0 to let this not be triggered again
$sql = 'UPDATE ' . USERS_TABLE . '