phpBB

Code Changes

File: includes/ucp/ucp_groups.php

  Unmodified   Added   Modified   Removed
Line 31Line 31
		global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
global $db, $user, $auth, $cache, $template;
global $request, $phpbb_container, $phpbb_log;

		global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
global $db, $user, $auth, $cache, $template;
global $request, $phpbb_container, $phpbb_log;

 

/** @var \phpbb\language\language $language Language object */
$language = $phpbb_container->get('language');


$user->add_lang('groups');



$user->add_lang('groups');


Line 71Line 74
					}
$db->sql_freeresult($result);


					}
$db->sql_freeresult($result);


					if (!sizeof($group_row))

					if (!count($group_row))

					{
trigger_error('GROUP_NOT_EXIST');
}

					{
trigger_error('GROUP_NOT_EXIST');
}

Line 330Line 333

$sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage
FROM ' . GROUPS_TABLE . '


$sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage
FROM ' . GROUPS_TABLE . '

					WHERE ' . ((sizeof($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . "

					WHERE ' . ((count($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . "

						group_type $sql_and
ORDER BY group_type DESC, group_name";
$result = $db->sql_query($sql);

						group_type $sql_and
ORDER BY group_type DESC, group_name";
$result = $db->sql_query($sql);

Line 396Line 399
				$action		= (isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', '');
$group_id = $request->variable('g', 0);


				$action		= (isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', '');
$group_id = $request->variable('g', 0);


 
				if (!function_exists('phpbb_get_user_rank'))
{

				include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

				include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

 
				}


add_form_key('ucp_groups');



add_form_key('ucp_groups');


Line 528Line 534
								'teampage'	=> $group_row['group_teampage'],
);


								'teampage'	=> $group_row['group_teampage'],
);


							if ($config['allow_avatar'])






							if (!check_form_key('ucp_groups'))
{
$error[] = $user->lang['FORM_INVALID'];
}

if (!count($error) && $config['allow_avatar'])

							{
// Handle avatar
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));

							{
// Handle avatar
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));

Line 548Line 559

// Merge any avatars errors into the primary error array
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));


// Merge any avatars errors into the primary error array
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));

							}

if (!check_form_key('ucp_groups'))
{
$error[] = $user->lang['FORM_INVALID'];

 
							}

// Validate submitted colour value

							}

// Validate submitted colour value

Line 562Line 568
								$error = array_merge($error, $colour_error);
}


								$error = array_merge($error, $colour_error);
}


							if (!sizeof($error))

							if (!count($error))

							{
// Only set the rank, colour, etc. if it's changed or if we're adding a new
// group. This prevents existing group members being updated if no changes

							{
// Only set the rank, colour, etc. if it's changed or if we're adding a new
// group. This prevents existing group members being updated if no changes

Line 605Line 611
								}
}


								}
}


							if (sizeof($error))

							if (count($error))

							{
$error = array_map(array(&$user, 'lang'), $error);
$group_rank = $submit_ary['rank'];

							{
$error = array_map(array(&$user, 'lang'), $error);
$group_rank = $submit_ary['rank'];

Line 703Line 709
							'S_EDIT'			=> true,
'S_INCLUDE_SWATCH' => true,
'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',

							'S_EDIT'			=> true,
'S_INCLUDE_SWATCH' => true,
'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"',

							'S_ERROR'			=> (sizeof($error)) ? true : false,

							'S_ERROR'			=> (count($error)) ? true : false,

							'S_SPECIAL_GROUP'	=> ($group_type == GROUP_SPECIAL) ? true : false,
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
'S_GROUP_MANAGE' => true,


							'S_SPECIAL_GROUP'	=> ($group_type == GROUP_SPECIAL) ? true : false,
'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled),
'S_GROUP_MANAGE' => true,


							'ERROR_MSG'				=> (sizeof($error)) ? implode('<br />', $error) : '',

							'ERROR_MSG'				=> (count($error)) ? implode('<br />', $error) : '',

							'GROUP_RECEIVE_PM'		=> (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '',
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,
'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,

							'GROUP_RECEIVE_PM'		=> (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '',
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,
'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,

Line 867Line 873
						if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . $return_page);

						if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . $return_page);

 
						}

if (!check_form_key('ucp_groups'))
{
trigger_error($user->lang('FORM_INVALID') . $return_page);

						}

if (!($row = group_memberships($group_id, $user->data['user_id'])))

						}

if (!($row = group_memberships($group_id, $user->data['user_id'])))

Line 911Line 922

if (confirm_box(true))
{


if (confirm_box(true))
{

							if (!sizeof($mark_ary))

							if (!count($mark_ary))

							{
$start = 0;


							{
$start = 0;


Line 934Line 945

group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);



group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);


										$start = (sizeof($mark_ary) < 200) ? 0 : $start + 200;

										$start = (count($mark_ary) < 200) ? 0 : $start + 200;

									}
else
{

									}
else
{

Line 1054Line 1065

if (confirm_box(true))
{


if (confirm_box(true))
{

 
							$return_manage_page = '<br /><br />' . $language->lang('RETURN_PAGE', '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>');


							// Add user/s to group
if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row))
{

							// Add user/s to group
if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row))
{

								trigger_error($user->lang[$error] . $return_page);













								$display_message = $language->lang($error);

if ($error == 'GROUP_USERS_INVALID')
{
// Find which users don't exist
$actual_name_ary = $name_ary;
$actual_user_id_ary = [];
user_get_id_name($actual_user_id_ary, $actual_name_ary, false, true);

$display_message = $language->lang('GROUP_USERS_INVALID', implode($language->lang('COMMA_SEPARATOR'), array_udiff($name_ary, $actual_name_ary, 'strcasecmp')));
}

trigger_error($display_message . $return_manage_page);

							}


							}


							trigger_error($user->lang['GROUP_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));

							trigger_error($language->lang('GROUP_USERS_ADDED') . $return_manage_page);

						}
else
{

						}
else
{

Line 1073Line 1098
								'action'	=> $action
);


								'action'	=> $action
);


							confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', sizeof($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields));

							confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', count($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields));

						}

trigger_error($user->lang['NO_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));

						}

trigger_error($user->lang['NO_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));