phpBB

Code Changes

File: includes/acp/acp_groups.php

  Unmodified   Added   Modified   Removed
Line 49Line 49


// Clear some vars



// Clear some vars

		$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;

		$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;

		$group_row = array();

// Grab basic data for group, if group_id is set and exists

		$group_row = array();

// Grab basic data for group, if group_id is set and exists

Line 80Line 80
			case 'approve':
case 'demote':
case 'promote':

			case 'approve':
case 'demote':
case 'promote':

 
				if (!check_form_key($form_key))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}


				if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

				if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

Line 119Line 124
				if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

				if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

 
				}
else if (empty($mark_ary))
{
trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);

				}

if (confirm_box(true))
{
$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];

				}

if (confirm_box(true))
{
$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];

 
					group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);	
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));
}
else
{
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
'mark' => $mark_ary,
'g' => $group_id,
'i' => $id,
'mode' => $mode,
'action' => $action))
);
}
break;





					if (!sizeof($mark_ary))


			case 'set_default_on_all':
if (confirm_box(true))

					{

					{

 
					$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];


						$start = 0;

do

						$start = 0;

do

Line 157Line 183
							$db->sql_freeresult($result);
}
while ($start);

							$db->sql_freeresult($result);
}
while ($start);

					}
else
{
group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
}

 

trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));
}


trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));
}

Line 175Line 196
						'action'	=> $action))
);
}

						'action'	=> $action))
);
}



 
			break;

case 'deleteusers':

			break;

case 'deleteusers':

			case 'delete':
if (confirm_box(true))

				if (empty($mark_ary))


				{

				{

 
					trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
}
case 'delete':

					if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

					if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

 
				}
else if ($action === 'delete' && $group_row['group_type'] == GROUP_SPECIAL)
{
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);

					}


					}


 
				if (confirm_box(true))
{

					$error = '';

switch ($action)

					$error = '';

switch ($action)

Line 229Line 257
			break;

case 'addusers':

			break;

case 'addusers':

 
				if (!check_form_key($form_key))
{
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
}


				if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

				if (!$group_id)
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);

Line 303Line 336
						'receive_pm'		=> isset($_REQUEST['group_receive_pm']) ? 1 : 0,
'legend' => isset($_REQUEST['group_legend']) ? 1 : 0,
'message_limit' => request_var('group_message_limit', 0),

						'receive_pm'		=> isset($_REQUEST['group_receive_pm']) ? 1 : 0,
'legend' => isset($_REQUEST['group_legend']) ? 1 : 0,
'message_limit' => request_var('group_message_limit', 0),

 
						'max_recipients'	=> request_var('group_max_recipients', 0),

						'founder_manage'	=> 0,

						'founder_manage'	=> 0,

 
						'skip_auth'			=> request_var('group_skip_auth', 0),

					);

if ($user->data['user_type'] == USER_FOUNDER)

					);

if ($user->data['user_type'] == USER_FOUNDER)

Line 386Line 421
						{
avatar_delete('group', $group_row, true);
}

						{
avatar_delete('group', $group_row, true);
}

 
					}

/*
* Validate the length of "Maximum number of allowed recipients per
* private message" setting. We use 16777215 as a maximum because it matches
* MySQL unsigned mediumint maximum value which is the lowest amongst DBMSes
* supported by phpBB3. Also validate the submitted colour value.
*/
$validation_checks = array(
'max_recipients' => array('num', false, 0, 16777215),
'colour' => array('hex_colour', true),
);

if ($validation_error = validate_data($submit_ary, $validation_checks))
{
// Replace "error" string with its real, localised form
$error = array_merge($error, $validation_error);

					}

if (!sizeof($error))

					}

if (!sizeof($error))

Line 395Line 447
						// were made.

$group_attributes = array();

						// were made.

$group_attributes = array();

						$test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'founder_manage');
foreach ($test_variables as $test)















						$test_variables = array(
'rank' => 'int',
'colour' => 'string',
'avatar' => 'string',
'avatar_type' => 'int',
'avatar_width' => 'int',
'avatar_height' => 'int',
'receive_pm' => 'int',
'legend' => 'int',
'message_limit' => 'int',
'max_recipients'=> 'int',
'founder_manage'=> 'int',
'skip_auth' => 'int',
);

foreach ($test_variables as $test => $type)

						{
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
{

						{
if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
{

 
								settype($submit_ary[$test], $type);

								$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
}
}

								$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
}
}

Line 463Line 530

if (sizeof($error))
{


if (sizeof($error))
{

 
						$error = array_map(array(&$user, 'lang'), $error);

						$group_rank = $submit_ary['rank'];

$group_desc_data = array(

						$group_rank = $submit_ary['rank'];

$group_desc_data = array(

Line 555Line 623
					'GROUP_FOUNDER_MANAGE'	=> (isset($group_row['group_founder_manage']) && $group_row['group_founder_manage']) ? ' checked="checked"' : '',
'GROUP_LEGEND' => (isset($group_row['group_legend']) && $group_row['group_legend']) ? ' checked="checked"' : '',
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,

					'GROUP_FOUNDER_MANAGE'	=> (isset($group_row['group_founder_manage']) && $group_row['group_founder_manage']) ? ' checked="checked"' : '',
'GROUP_LEGEND' => (isset($group_row['group_legend']) && $group_row['group_legend']) ? ' 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_COLOUR'			=> (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',

					'GROUP_COLOUR'			=> (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',



					'GROUP_SKIP_AUTH'		=> (!empty($group_row['group_skip_auth'])) ? ' checked="checked"' : '',


'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'],
'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'],


'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'],
'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'],

Line 585Line 654
					'U_SWATCH'			=> append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&name=group_colour'),
'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id",
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),

					'U_SWATCH'			=> append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&name=group_colour'),
'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id",
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),

					)
);

				));



return;
break;


return;
break;

Line 601Line 669
				$this->page_title = 'GROUP_MEMBERS';

// Grab the leaders - always, on every page...

				$this->page_title = 'GROUP_MEMBERS';

// Grab the leaders - always, on every page...

				$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending

				$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending

					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id

					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id

Line 615Line 683
						'U_USER_EDIT'		=> append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),

'USERNAME' => $row['username'],

						'U_USER_EDIT'		=> append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),

'USERNAME' => $row['username'],

 
						'USERNAME_COLOUR'	=> $row['user_colour'],

						'S_GROUP_DEFAULT'	=> ($row['group_id'] == $group_id) ? true : false,
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
'USER_POSTS' => $row['user_posts'],

						'S_GROUP_DEFAULT'	=> ($row['group_id'] == $group_id) ? true : false,
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
'USER_POSTS' => $row['user_posts'],

						'USER_ID'			=> $row['user_id'])
);

						'USER_ID'			=> $row['user_id'],
));

				}
$db->sql_freeresult($result);


				}
$db->sql_freeresult($result);


Line 652Line 721
					'U_ACTION'			=> $this->u_action . "&g=$group_id",
'U_BACK' => $this->u_action,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'),

					'U_ACTION'			=> $this->u_action . "&g=$group_id",
'U_BACK' => $this->u_action,
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=list&field=usernames'),

					'U_DEFAULT_ALL'		=> "{$this->u_action}&action=default&g=$group_id",

					'U_DEFAULT_ALL'		=> "{$this->u_action}&action=set_default_on_all&g=$group_id",

				));

// Grab the members

				));

// Grab the members

				$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending

				$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending

					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id

					FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id

Line 681Line 750
						'U_USER_EDIT'		=> append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),

'USERNAME' => $row['username'],

						'U_USER_EDIT'		=> append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&action=edit&u={$row['user_id']}"),

'USERNAME' => $row['username'],

 
						'USERNAME_COLOUR'	=> $row['user_colour'],

						'S_GROUP_DEFAULT'	=> ($row['group_id'] == $group_id) ? true : false,
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
'USER_POSTS' => $row['user_posts'],

						'S_GROUP_DEFAULT'	=> ($row['group_id'] == $group_id) ? true : false,
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
'USER_POSTS' => $row['user_posts'],

Line 757Line 827
					
'GROUP_NAME' => $group_name,
'TOTAL_MEMBERS' => $row['total_members'],

					
'GROUP_NAME' => $group_name,
'TOTAL_MEMBERS' => $row['total_members'],

					)
);

				));


			}
}
}
}

?>

			}
}
}
}

?>