phpBB

Code Changes

File: includes/ucp/ucp_groups.php

  Unmodified   Added   Modified   Removed
Line 193Line 193
								if ($group_row[$group_id]['group_type'] == GROUP_FREE)
{
group_user_add($group_id, $user->data['user_id']);

								if ($group_row[$group_id]['group_type'] == GROUP_FREE)
{
group_user_add($group_id, $user->data['user_id']);


$email_template = 'group_added';

 
								}
else
{
group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);

								}
else
{
group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);


$email_template = 'group_request';
}

 

include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger();

$sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang


include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$messenger = new messenger();

$sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang

									FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u

										FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . " u

									WHERE ug.user_id = u.user_id

									WHERE ug.user_id = u.user_id

										AND ' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? "ug.user_id = {$user->data['user_id']}" : 'ug.group_leader = 1') . "

											AND ug.group_leader = 1

										AND ug.group_id = $group_id";
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{

										AND ug.group_id = $group_id";
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{

									$messenger->template($email_template, $row['user_lang']);

										$messenger->template('group_request', $row['user_lang']);


$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);

$messenger->assign_vars(array(


$messenger->to($row['user_email'], $row['username']);
$messenger->im($row['user_jabber'], $row['username']);

$messenger->assign_vars(array(

										'USERNAME'		=> htmlspecialchars_decode($row['username']),
'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']),


											'USERNAME'			=> htmlspecialchars_decode($row['username']),
'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']),
'REQUEST_USERNAME' => $user->data['username'],


'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id",
'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")


'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id",
'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")

Line 233Line 229
								$db->sql_freeresult($result);

$messenger->save_queue();

								$db->sql_freeresult($result);

$messenger->save_queue();

 
								}


add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']);



add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']);


Line 339Line 336
						'S_ROW_COUNT'		=> ${$block . '_count'}++)
);


						'S_ROW_COUNT'		=> ${$block . '_count'}++)
);


					$group_id_ary[] = $row['group_id'];

					$group_id_ary[] = (int) $row['group_id'];

				}
$db->sql_freeresult($result);


				}
$db->sql_freeresult($result);


Line 413Line 410
				$this->page_title = 'UCP_USERGROUPS_MANAGE';
$action = (isset($_POST['addusers'])) ? 'addusers' : request_var('action', '');
$group_id = request_var('g', 0);

				$this->page_title = 'UCP_USERGROUPS_MANAGE';
$action = (isset($_POST['addusers'])) ? 'addusers' : request_var('action', '');
$group_id = request_var('g', 0);

 

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


				add_form_key('ucp_groups');

if ($group_id)

				add_form_key('ucp_groups');

if ($group_id)

Line 434Line 434
					{
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
}

					{
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
}

 

$group_name = $group_row['group_name'];
$group_type = $group_row['group_type'];

$avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />';

$template->assign_vars(array(
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
'GROUP_INTERNAL_NAME' => $group_name,
'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',
'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']),
'GROUP_TYPE' => $group_row['group_type'],

'AVATAR' => $avatar_img,
'AVATAR_IMAGE' => $avatar_img,
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',
));

				}

switch ($action)
{
case 'edit':

				}

switch ($action)
{
case 'edit':


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

 

if (!$group_id)
{


if (!$group_id)
{

Line 470Line 486
						$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));


						$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));


						$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;


// Did we submit?
if ($update)


// Did we submit?
if ($update)

Line 487Line 503
								'colour'		=> request_var('group_colour', ''),
'rank' => request_var('group_rank', 0),
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,

								'colour'		=> request_var('group_colour', ''),
'rank' => request_var('group_rank', 0),
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,

								'message_limit'	=> request_var('group_message_limit', 0)


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

							);

$data['uploadurl'] = request_var('uploadurl', '');

							);

$data['uploadurl'] = request_var('uploadurl', '');

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

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

 
							}

// Validate submitted colour value
if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true))))
{
// Replace "error" string with its real, localised form
$error = array_merge($error, $colour_error);

							}

if (!sizeof($error))

							}

if (!sizeof($error))

Line 585Line 609
								// were made.

$group_attributes = array();

								// were made.

$group_attributes = array();

								$test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height');
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',
);

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

								{

								{

									if ($action == 'add' || (isset($submit_ary[$test]) && $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 605Line 642

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 629Line 667
						}
else
{

						}
else
{

							$group_name = $group_row['group_name'];

 
							$group_desc_data = generate_text_for_edit($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_options']);

							$group_desc_data = generate_text_for_edit($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_options']);

							$group_type = $group_row['group_type'];

 
							$group_rank = $group_row['group_rank'];
}


							$group_rank = $group_row['group_rank'];
}


Line 653Line 689
						$type_open		= ($group_type == GROUP_OPEN) ? ' checked="checked"' : '';
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';

						$type_open		= ($group_type == GROUP_OPEN) ? ' checked="checked"' : '';
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';


$avatar_img = (!empty($group_row['group_avatar'])) ? get_user_avatar($group_row['group_avatar'], $group_row['group_avatar_type'], $group_row['group_avatar_width'], $group_row['group_avatar_height'], 'GROUP_AVATAR') : '<img src="' . $phpbb_root_path . 'adm/images/no_avatar.gif" alt="" />';

 

$display_gallery = (isset($_POST['display_gallery'])) ? true : false;



$display_gallery = (isset($_POST['display_gallery'])) ? true : false;


						if ($config['allow_avatar_local'] && $display_gallery)

						if ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery)

						{
avatar_gallery($category, $avatar_select, 4);
}


						{
avatar_gallery($category, $avatar_select, 4);
}


						$avatars_enabled = ($can_upload || ($config['allow_avatar_local'] || $config['allow_avatar_remote'])) ? true : false;


						$avatars_enabled = ($config['allow_avatar'] && (($can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) || ($config['allow_avatar_local'] || $config['allow_avatar_remote']))) ? true : false;



$template->assign_vars(array(
'S_EDIT' => true,
'S_INCLUDE_SWATCH' => true,


$template->assign_vars(array(
'S_EDIT' => true,
'S_INCLUDE_SWATCH' => true,

							'S_CAN_UPLOAD'		=> $can_upload,
'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',

							'S_FORM_ENCTYPE'	=> ($config['allow_avatar'] && $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload'])) ? ' enctype="multipart/form-data"' : '',


							'S_ERROR'			=> (sizeof($error)) ? true : false,
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
'S_AVATARS_ENABLED' => $avatars_enabled,

							'S_ERROR'			=> (sizeof($error)) ? true : false,
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
'S_AVATARS_ENABLED' => $avatars_enabled,

							'S_DISPLAY_GALLERY'	=> ($config['allow_avatar_local'] && !$display_gallery) ? true : false,

							'S_DISPLAY_GALLERY'	=> ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false,

							'S_IN_GALLERY'		=> ($config['allow_avatar_local'] && $display_gallery) ? true : false,

							'S_IN_GALLERY'		=> ($config['allow_avatar_local'] && $display_gallery) ? true : false,

 

'S_UPLOAD_AVATAR_FILE' => ($config['allow_avatar'] && $config['allow_avatar_upload'] && $can_upload) ? true : false,
'S_UPLOAD_AVATAR_URL' => ($config['allow_avatar'] && $config['allow_avatar_remote_upload'] && $can_upload) ? true : false,
'S_LINK_AVATAR' => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false,


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


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

							'GROUP_NAME'			=> ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
'GROUP_INTERNAL_NAME' => $group_name,
'GROUP_DESC' => $group_desc_data['text'],

 
							'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_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_COLOUR'			=> (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',

							'GROUP_MAX_RECIPIENTS'	=> (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,





 
							'GROUP_DESC'			=> $group_desc_data['text'],

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

'S_RANK_OPTIONS' => $rank_options,

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

'S_RANK_OPTIONS' => $rank_options,

							'AVATAR'				=> $avatar_img,
'AVATAR_IMAGE' => $avatar_img,

 
							'AVATAR_MAX_FILESIZE'	=> $config['avatar_filesize'],

							'AVATAR_MAX_FILESIZE'	=> $config['avatar_filesize'],

							'AVATAR_WIDTH'			=> (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',

 

'GROUP_TYPE_FREE' => GROUP_FREE,
'GROUP_TYPE_OPEN' => GROUP_OPEN,


'GROUP_TYPE_FREE' => GROUP_FREE,
'GROUP_TYPE_OPEN' => GROUP_OPEN,

Line 741Line 771
							WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id
AND ug.group_leader = 1

							WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id
AND ug.group_leader = 1

							ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";

							ORDER BY ug.user_pending DESC, u.username_clean";

						$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))

						$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))

Line 774Line 804
							WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id
AND ug.group_leader = 0

							WHERE ug.group_id = $group_id
AND u.user_id = ug.user_id
AND ug.group_leader = 0

							ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean";

							ORDER BY ug.user_pending DESC, u.username_clean";

						$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);

$pending = false;

						$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);

$pending = false;

 
						$approved = false;


while ($row = $db->sql_fetchrow($result))
{


while ($row = $db->sql_fetchrow($result))
{

Line 786Line 817
								$template->assign_block_vars('member', array(
'S_PENDING' => true)
);

								$template->assign_block_vars('member', array(
'S_PENDING' => true)
);

 
								$template->assign_var('S_PENDING_SET', true);


$pending = true;


$pending = true;

 
							}
else if (!$row['user_pending'] && !$approved)
{
$template->assign_block_vars('member', array(
'S_APPROVED' => true)
);
$template->assign_var('S_APPROVED_SET', true);

$approved = true;

							}

$template->assign_block_vars('member', array(

							}

$template->assign_block_vars('member', array(

Line 818Line 859
							'PAGINATION'		=> generate_pagination($this->u_action . "&amp;action=$action&amp;g=$group_id", $total_members, $config['topics_per_page'], $start),

'U_ACTION' => $this->u_action . "&amp;g=$group_id",

							'PAGINATION'		=> generate_pagination($this->u_action . "&amp;action=$action&amp;g=$group_id", $total_members, $config['topics_per_page'], $start),

'U_ACTION' => $this->u_action . "&amp;g=$group_id",

 
							'S_UCP_ACTION'		=> $this->u_action . "&amp;g=$group_id",

							'U_FIND_USERNAME'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=ucp&amp;field=usernames'),
));


							'U_FIND_USERNAME'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=ucp&amp;field=usernames'),
));


Line 926Line 968
								'action'	=> $action))
);
}

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

 

// redirect to last screen
redirect($this->u_action . '&amp;action=list&amp;g=' . $group_id);


break;



break;


Line 972Line 1017
								'action'	=> $action))
);
}

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

 

// redirect to last screen
redirect($this->u_action . '&amp;action=list&amp;g=' . $group_id);


break;



break;