phpBB

Code Changes

File: includes/ucp/ucp_groups.php

  Unmodified   Added   Modified   Removed
Line 30Line 30
	{
global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
global $db, $user, $auth, $cache, $template;

	{
global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path;
global $db, $user, $auth, $cache, $template;

		global $request, $phpbb_container;

		global $request, $phpbb_container, $phpbb_log;


$user->add_lang('groups');

$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');



$user->add_lang('groups');

$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');


		$mark_ary	= request_var('mark', array(0));

		$mark_ary	= $request->variable('mark', array(0));

		$submit		= $request->variable('submit', false, false, \phpbb\request\request_interface::POST);

		$submit		= $request->variable('submit', false, false, \phpbb\request\request_interface::POST);

		$delete		= $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
$error = $data = array();



/** @var \phpbb\group\helper $group_helper */
$group_helper = $phpbb_container->get('group_helper');


switch ($mode)
{


switch ($mode)
{

Line 49Line 50

if ($submit || isset($_POST['change_default']))
{


if ($submit || isset($_POST['change_default']))
{

					$action = (isset($_POST['change_default'])) ? 'change_default' : request_var('action', '');
$group_id = ($action == 'change_default') ? request_var('default', 0) : request_var('selected', 0);

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


if (!$group_id)
{


if (!$group_id)
{

Line 65Line 66
					$group_row = array();
while ($row = $db->sql_fetchrow($result))
{

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

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

						$row['group_name'] = $group_helper->get_name($row['group_name']);

						$group_row[$row['group_id']] = $row;
}
$db->sql_freeresult($result);

						$group_row[$row['group_id']] = $row;
}
$db->sql_freeresult($result);

Line 86Line 87

if (!$auth->acl_get('u_chggrp'))
{


if (!$auth->acl_get('u_chggrp'))
{

 
								send_status_line(403, 'Forbidden');

								trigger_error($user->lang['NOT_AUTHORISED'] . $return_page);
}


								trigger_error($user->lang['NOT_AUTHORISED'] . $return_page);
}


Line 99Line 101
							{
group_user_attributes('default', $group_id, $user->data['user_id']);


							{
group_user_attributes('default', $group_id, $user->data['user_id']);


								add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_CHANGE', sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name']));




								$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_CHANGE', false, array(
'reportee_id' => $user->data['user_id'],
sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name'])
));


meta_refresh(3, $this->u_action);
trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page);


meta_refresh(3, $this->u_action);
trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page);

Line 146Line 151
							{
group_user_del($group_id, $user->data['user_id']);


							{
group_user_del($group_id, $user->data['user_id']);


								add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_RESIGN', $group_row[$group_id]['group_name']);




								$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_RESIGN', false, array(
'reportee_id' => $user->data['user_id'],
$group_row[$group_id]['group_name']
));


meta_refresh(3, $this->u_action);
trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page);


meta_refresh(3, $this->u_action);
trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page);

Line 202Line 210
									group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);
}


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


								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']);




								$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), false, array(
'reportee_id' => $user->data['user_id'],
$group_row[$group_id]['group_name']
));


meta_refresh(3, $this->u_action);
trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page);


meta_refresh(3, $this->u_action);
trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page);

Line 237Line 248
							{
group_user_attributes('demote', $group_id, $user->data['user_id']);


							{
group_user_attributes('demote', $group_id, $user->data['user_id']);


								add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_DEMOTE', $group_row[$group_id]['group_name']);




								$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_DEMOTE', false, array(
'reportee_id' => $user->data['user_id'],
$group_row[$group_id]['group_name']
));


meta_refresh(3, $this->u_action);
trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page);


meta_refresh(3, $this->u_action);
trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page);

Line 295Line 309

$template->assign_block_vars($block, array(
'GROUP_ID' => $row['group_id'],


$template->assign_block_vars($block, array(
'GROUP_ID' => $row['group_id'],

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

						'GROUP_NAME'	=> $group_helper->get_name($row['group_name']),

						'GROUP_DESC'	=> ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'],
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status],

						'GROUP_DESC'	=> ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'],
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status],

Line 349Line 363

$template->assign_block_vars('nonmember', array(
'GROUP_ID' => $row['group_id'],


$template->assign_block_vars('nonmember', array(
'GROUP_ID' => $row['group_id'],

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

						'GROUP_NAME'	=> $group_helper->get_name($row['group_name']),

						'GROUP_DESC'	=> ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'],
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true,

						'GROUP_DESC'	=> ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'],
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true,

Line 379Line 393
			case 'manage':

$this->page_title = 'UCP_USERGROUPS_MANAGE';

			case 'manage':

$this->page_title = 'UCP_USERGROUPS_MANAGE';

				$action		= (isset($_POST['addusers'])) ? 'addusers' : request_var('action', '');
$group_id = request_var('g', 0);

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


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



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


Line 414Line 428
					$avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);

$template->assign_vars(array(

					$avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true);

$template->assign_vars(array(

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

						'GROUP_NAME'			=> $group_helper->get_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_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']),

Line 447Line 461
							trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}


							trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}


						$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;

 
						$user->add_lang(array('acp/groups', 'acp/common'));

						$user->add_lang(array('acp/groups', 'acp/common'));


$data = $submit_ary = array();

 

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



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


Line 461Line 472
						$avatar_drivers = null;
$avatar_data = null;
$avatar_error = array();

						$avatar_drivers = null;
$avatar_data = null;
$avatar_error = array();

 

/** @var \phpbb\avatar\manager $phpbb_avatar_manager */
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');


if ($config['allow_avatar'])
{


if ($config['allow_avatar'])
{

							$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');

 
							$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();

// This is normalised data, without the group_ prefix

							$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();

// This is normalised data, without the group_ prefix

Line 497Line 510
						// Did we submit?
if ($update)
{

						// Did we submit?
if ($update)
{

							$group_name	= utf8_normalize_nfc(request_var('group_name', '', true));
$group_desc = utf8_normalize_nfc(request_var('group_desc', '', true));
$group_type = request_var('group_type', GROUP_FREE);

							$group_name	= $request->variable('group_name', '', true);
$group_desc = $request->variable('group_desc', '', true);
$group_type = $request->variable('group_type', GROUP_FREE);





							$allow_desc_bbcode	= request_var('desc_parse_bbcode', false);
$allow_desc_urls = request_var('desc_parse_urls', false);
$allow_desc_smilies = request_var('desc_parse_smilies', false);

							$allow_desc_bbcode	= $request->variable('desc_parse_bbcode', false);
$allow_desc_urls = $request->variable('desc_parse_urls', false);
$allow_desc_smilies = $request->variable('desc_parse_smilies', false);


$submit_ary = array(


$submit_ary = array(

								'colour'		=> request_var('group_colour', ''),
'rank' => request_var('group_rank', 0),

								'colour'		=> $request->variable('group_colour', ''),
'rank' => $request->variable('group_rank', 0),

								'receive_pm'	=> isset($_REQUEST['group_receive_pm']) ? 1 : 0,

								'receive_pm'	=> isset($_REQUEST['group_receive_pm']) ? 1 : 0,

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

								'message_limit'	=> $request->variable('group_message_limit', 0),
'max_recipients'=> $request->variable('group_max_recipients', 0),

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

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

Line 519Line 532
							{
// 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', ''));

								$config_name = preg_replace('#^avatar\.driver.#', '', $driver_name);

 

if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
{


if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete'))
{

Line 608Line 620
						}
else if (!$group_id)
{

						}
else if (!$group_id)
{

							$group_name = utf8_normalize_nfc(request_var('group_name', '', true));

 
							$group_desc_data = array(
'text' => '',
'allow_bbcode' => true,

							$group_desc_data = array(
'text' => '',
'allow_bbcode' => true,

Line 648Line 659
						{
$avatars_enabled = false;
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type']));

						{
$avatars_enabled = false;
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type']));

 

// Assign min and max values before generating avatar driver html
$template->assign_vars(array(
'AVATAR_MIN_WIDTH' => $config['avatar_min_width'],
'AVATAR_MAX_WIDTH' => $config['avatar_max_width'],
'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'],
'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'],
));


foreach ($avatar_drivers as $current_driver)
{


foreach ($avatar_drivers as $current_driver)
{

Line 737Line 756
						}

$user->add_lang(array('acp/groups', 'acp/common'));

						}

$user->add_lang(array('acp/groups', 'acp/common'));

						$start = request_var('start', 0);

						$start = $request->variable('start', 0);


// Grab the leaders - always, on every page...
$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


// Grab the leaders - always, on every page...
$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

Line 826Line 845
							$s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';
}


							$s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';
}


 
						/* @var $pagination \phpbb\pagination */

						$pagination = $phpbb_container->get('pagination');
$base_url = $this->u_action . "&amp;action=$action&amp;g=$group_id";
$start = $pagination->validate_start($start, $config['topics_per_page'], $total_members);

						$pagination = $phpbb_container->get('pagination');
$base_url = $this->u_action . "&amp;action=$action&amp;g=$group_id";
$start = $pagination->validate_start($start, $config['topics_per_page'], $total_members);

Line 887Line 907
							trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}


							trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}


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

						$group_row['group_name'] = $group_helper->get_name($group_row['group_name']);


if (confirm_box(true))
{


if (confirm_box(true))
{

Line 966Line 986
							trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}


							trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
}


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

						$group_row['group_name'] = $group_helper->get_name($group_row['group_name']);


if (confirm_box(true))
{


if (confirm_box(true))
{

Line 1004Line 1024

$user->add_lang(array('acp/groups', 'acp/common'));



$user->add_lang(array('acp/groups', 'acp/common'));


						$names = utf8_normalize_nfc(request_var('usernames', '', true));

						$names = $request->variable('usernames', '', true);


if (!$group_id)
{


if (!$group_id)
{

Line 1028Line 1048
						}

$name_ary = array_unique(explode("\n", $names));

						}

$name_ary = array_unique(explode("\n", $names));

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

						$group_name = $group_helper->get_name($group_row['group_name']);





						$default = request_var('default', 0);

						$default = $request->variable('default', 0);


if (confirm_box(true))
{


if (confirm_box(true))
{

Line 1074Line 1094
						while ($value = $db->sql_fetchrow($result))
{
$template->assign_block_vars('leader', array(

						while ($value = $db->sql_fetchrow($result))
{
$template->assign_block_vars('leader', array(

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

								'GROUP_NAME'	=> $group_helper->get_name($value['group_name']),

								'GROUP_DESC'	=> generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']),
'GROUP_TYPE' => $value['group_type'],
'GROUP_ID' => $value['group_id'],

								'GROUP_DESC'	=> generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']),
'GROUP_TYPE' => $value['group_type'],
'GROUP_ID' => $value['group_id'],