|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package ucp
|
|
|
4c79b5 |
* @version $Id: ucp_groups.php 9067 2008-11-21 13:21:53Z Kellanved $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http:
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @ignore
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_PHPBB'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* ucp_groups
|
|
|
4c79b5 |
* @package ucp
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class ucp_groups
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
var $u_action;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($id, $mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $config, $phpbb_root_path, $phpEx;
|
|
|
4c79b5 |
global $db, $user, $auth, $cache, $template;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang('groups');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$return_page = '
' . sprintf($user->lang['RETURN_PAGE'], '', '');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$mark_ary = request_var('mark', array(0));
|
|
|
4c79b5 |
$submit = (!empty($_POST['submit'])) ? true : false;
|
|
|
4c79b5 |
$delete = (!empty($_POST['delete'])) ? true : false;
|
|
|
4c79b5 |
$error = $data = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ($mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'membership':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = 'UCP_USERGROUPS_MEMBER';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($submit || isset($_POST['change_default']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$action = (isset($_POST['change_default'])) ? 'change_default' : request_var('action', '');
|
|
|
4c79b5 |
$group_id = ($action == 'change_default') ? request_var('default', 0) : request_var('selected', 0);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error('NO_GROUP_SELECTED');
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT group_id, group_name, group_type
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . "
|
|
|
4c79b5 |
WHERE group_id IN ($group_id, {$user->data['group_id']})";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_row = array();
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
|
|
4c79b5 |
$group_row[$row['group_id']] = $row;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($group_row))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error('GROUP_NOT_EXIST');
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ($action)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'change_default':
|
|
|
4c79b5 |
// User already having this group set as default?
|
|
|
4c79b5 |
if ($group_id == $user->data['group_id'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['ALREADY_DEFAULT_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$auth->acl_get('u_chggrp'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_AUTHORISED'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// User needs to be member of the group in order to make it default
|
|
|
4c79b5 |
if (!group_memberships($group_id, $user->data['user_id'], true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
group_user_attributes('default', $group_id, $user->data['user_id']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
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']));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_hidden_fields = array(
|
|
|
4c79b5 |
'default' => $group_id,
|
|
|
4c79b5 |
'change_default'=> true
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
confirm_box(false, sprintf($user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'resign':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// User tries to resign from default group but is not allowed to change it?
|
|
|
4c79b5 |
if ($group_id == $user->data['group_id'] && !$auth->acl_get('u_chggrp'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT group_type
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . '
|
|
|
4c79b5 |
WHERE group_id = ' . $group_id;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$group_type = (int) $db->sql_fetchfield('group_type');
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($group_type != GROUP_OPEN && $group_type != GROUP_FREE)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['CANNOT_RESIGN_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
group_user_del($group_id, $user->data['user_id']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_RESIGN', $group_row[$group_id]['group_name']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_hidden_fields = array(
|
|
|
4c79b5 |
'selected' => $group_id,
|
|
|
4c79b5 |
'action' => 'resign',
|
|
|
4c79b5 |
'submit' => true
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
confirm_box(false, ($row['user_pending']) ? 'GROUP_RESIGN_PENDING' : 'GROUP_RESIGN_MEMBERSHIP', build_hidden_fields($s_hidden_fields));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'join':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email
|
|
|
4c79b5 |
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
|
|
|
4c79b5 |
WHERE ug.user_id = u.user_id
|
|
|
4c79b5 |
AND ug.group_id = ' . $group_id . '
|
|
|
4c79b5 |
AND ug.user_id = ' . $user->data['user_id'];
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($row)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($row['user_pending'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check permission to join (open group or request)
|
|
|
4c79b5 |
if ($group_row[$group_id]['group_type'] != GROUP_OPEN && $group_row[$group_id]['group_type'] != GROUP_FREE)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['CANNOT_JOIN_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($group_row[$group_id]['group_type'] == GROUP_FREE)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
group_user_add($group_id, $user->data['user_id']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$email_template = 'group_added';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$email_template = 'group_request';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
|
|
4c79b5 |
$messenger = new messenger();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang
|
|
|
4c79b5 |
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
|
|
|
4c79b5 |
WHERE ug.user_id = u.user_id
|
|
|
4c79b5 |
AND ' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? "ug.user_id = {$user->data['user_id']}" : 'ug.group_leader = 1') . "
|
|
|
4c79b5 |
AND ug.group_id = $group_id";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$messenger->template($email_template, $row['user_lang']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->to($row['user_email'], $row['username']);
|
|
|
4c79b5 |
$messenger->im($row['user_jabber'], $row['username']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->assign_vars(array(
|
|
|
4c79b5 |
'USERNAME' => htmlspecialchars_decode($row['username']),
|
|
|
4c79b5 |
'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']),
|
|
|
4c79b5 |
'REQUEST_USERNAME' => $user->data['username'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id",
|
|
|
4c79b5 |
'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->send($row['user_notify_type']);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$messenger->save_queue();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
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']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_hidden_fields = array(
|
|
|
4c79b5 |
'selected' => $group_id,
|
|
|
4c79b5 |
'action' => 'join',
|
|
|
4c79b5 |
'submit' => true
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
confirm_box(false, ($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOIN' : 'GROUP_JOIN_PENDING', build_hidden_fields($s_hidden_fields));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'demote':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
group_user_attributes('demote', $group_id, $user->data['user_id']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_DEMOTE', $group_row[$group_id]['group_name']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
meta_refresh(3, $this->u_action);
|
|
|
4c79b5 |
trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_hidden_fields = array(
|
|
|
4c79b5 |
'selected' => $group_id,
|
|
|
4c79b5 |
'action' => 'demote',
|
|
|
4c79b5 |
'submit' => true
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
confirm_box(false, 'USER_GROUP_DEMOTE', build_hidden_fields($s_hidden_fields));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT g.*, ug.group_leader, ug.user_pending
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
|
|
|
4c79b5 |
WHERE ug.user_id = ' . $user->data['user_id'] . '
|
|
|
4c79b5 |
AND g.group_id = ug.group_id
|
|
|
4c79b5 |
ORDER BY g.group_type DESC, g.group_name';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_id_ary = array();
|
|
|
4c79b5 |
$leader_count = $member_count = $pending_count = 0;
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$block = ($row['group_leader']) ? 'leader' : (($row['user_pending']) ? 'pending' : 'member');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ($row['group_type'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case GROUP_OPEN:
|
|
|
4c79b5 |
$group_status = 'OPEN';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_CLOSED:
|
|
|
4c79b5 |
$group_status = 'CLOSED';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_HIDDEN:
|
|
|
4c79b5 |
$group_status = 'HIDDEN';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_SPECIAL:
|
|
|
4c79b5 |
$group_status = 'SPECIAL';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_FREE:
|
|
|
4c79b5 |
$group_status = 'FREE';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars($block, array(
|
|
|
4c79b5 |
'GROUP_ID' => $row['group_id'],
|
|
|
4c79b5 |
'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'],
|
|
|
4c79b5 |
'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'],
|
|
|
4c79b5 |
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
|
|
|
4c79b5 |
'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status],
|
|
|
4c79b5 |
'GROUP_COLOUR' => $row['group_colour'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_GROUP_DEFAULT' => ($row['group_id'] == $user->data['group_id']) ? true : false,
|
|
|
4c79b5 |
'S_ROW_COUNT' => ${$block . '_count'}++)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_id_ary[] = $row['group_id'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_and = ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . '
|
|
|
4c79b5 |
WHERE ' . ((sizeof($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . "
|
|
|
4c79b5 |
group_type $sql_and
|
|
|
4c79b5 |
ORDER BY group_type DESC, group_name";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$nonmember_count = 0;
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
switch ($row['group_type'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case GROUP_OPEN:
|
|
|
4c79b5 |
$group_status = 'OPEN';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_CLOSED:
|
|
|
4c79b5 |
$group_status = 'CLOSED';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_HIDDEN:
|
|
|
4c79b5 |
$group_status = 'HIDDEN';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_SPECIAL:
|
|
|
4c79b5 |
$group_status = 'SPECIAL';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case GROUP_FREE:
|
|
|
4c79b5 |
$group_status = 'FREE';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('nonmember', array(
|
|
|
4c79b5 |
'GROUP_ID' => $row['group_id'],
|
|
|
4c79b5 |
'GROUP_NAME' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'],
|
|
|
4c79b5 |
'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'],
|
|
|
4c79b5 |
'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true,
|
|
|
4c79b5 |
'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true,
|
|
|
4c79b5 |
'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status],
|
|
|
4c79b5 |
'S_CAN_JOIN' => ($row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_FREE) ? true : false,
|
|
|
4c79b5 |
'GROUP_COLOUR' => $row['group_colour'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_ROW_COUNT' => $nonmember_count++)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'S_CHANGE_DEFAULT' => ($auth->acl_get('u_chggrp')) ? true : false,
|
|
|
4c79b5 |
'S_LEADER_COUNT' => $leader_count,
|
|
|
4c79b5 |
'S_MEMBER_COUNT' => $member_count,
|
|
|
4c79b5 |
'S_PENDING_COUNT' => $pending_count,
|
|
|
4c79b5 |
'S_NONMEMBER_COUNT' => $nonmember_count,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_UCP_ACTION' => $this->u_action)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'manage':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->page_title = 'UCP_USERGROUPS_MANAGE';
|
|
|
4c79b5 |
$action = (isset($_POST['addusers'])) ? 'addusers' : request_var('action', '');
|
|
|
4c79b5 |
$group_id = request_var('g', 0);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_form_key('ucp_groups');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . "
|
|
|
4c79b5 |
WHERE group_id = $group_id";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$group_row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_row)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Check if the user is allowed to manage this group if set to founder only.
|
|
|
4c79b5 |
if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_name = $group_row['group_name'];
|
|
|
4c79b5 |
$group_type = $group_row['group_type'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$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') : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'GROUP_NAME' => ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name,
|
|
|
4c79b5 |
'GROUP_INTERNAL_NAME' => $group_name,
|
|
|
4c79b5 |
'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',
|
|
|
4c79b5 |
'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']),
|
|
|
4c79b5 |
'GROUP_TYPE' => $group_row['group_type'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'AVATAR' => $avatar_img,
|
|
|
4c79b5 |
'AVATAR_IMAGE' => $avatar_img,
|
|
|
4c79b5 |
'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '',
|
|
|
4c79b5 |
'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '',
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
switch ($action)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'edit':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
|
|
|
4c79b5 |
$user->add_lang(array('acp/groups', 'acp/common'));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data = $submit_ary = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$update = (isset($_POST['update'])) ? true : false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$error = array();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$avatar_select = basename(request_var('avatar_select', ''));
|
|
|
4c79b5 |
$category = basename(request_var('category', ''));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($update)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$group_name = utf8_normalize_nfc(request_var('group_name', '', true));
|
|
|
4c79b5 |
$group_desc = utf8_normalize_nfc(request_var('group_desc', '', true));
|
|
|
4c79b5 |
$group_type = request_var('group_type', GROUP_FREE);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$allow_desc_bbcode = request_var('desc_parse_bbcode', false);
|
|
|
4c79b5 |
$allow_desc_urls = request_var('desc_parse_urls', false);
|
|
|
4c79b5 |
$allow_desc_smilies = request_var('desc_parse_smilies', false);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$submit_ary = array(
|
|
|
4c79b5 |
'colour' => request_var('group_colour', ''),
|
|
|
4c79b5 |
'rank' => request_var('group_rank', 0),
|
|
|
4c79b5 |
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
|
|
|
4c79b5 |
'message_limit' => request_var('group_message_limit', 0),
|
|
|
4c79b5 |
'max_recipients'=> request_var('group_max_recipients', 0),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$data['uploadurl'] = request_var('uploadurl', '');
|
|
|
4c79b5 |
$data['remotelink'] = request_var('remotelink', '');
|
|
|
4c79b5 |
$data['width'] = request_var('width', '');
|
|
|
4c79b5 |
$data['height'] = request_var('height', '');
|
|
|
4c79b5 |
$delete = request_var('delete', '');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$var_ary = array(
|
|
|
4c79b5 |
'uploadurl' => array('string', true, 5, 255),
|
|
|
4c79b5 |
'remotelink' => array('string', true, 5, 255),
|
|
|
4c79b5 |
'width' => array('string', true, 1, 3),
|
|
|
4c79b5 |
'height' => array('string', true, 1, 3),
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($error = validate_data($data, $var_ary)))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$data['user_id'] = "g$group_id";
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if ($data['remotelink'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if ($avatar_select && $config['allow_avatar_local'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$submit_ary['avatar_type'] = AVATAR_GALLERY;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
|
|
|
4c79b5 |
$submit_ary['avatar'] = $category . '/' . $avatar_select;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if ($delete)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$submit_ary['avatar'] = '';
|
|
|
4c79b5 |
$submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if ($data['width'] && $data['height'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($config['avatar_max_width'] || $config['avatar_max_height'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($config['avatar_min_width'] || $config['avatar_min_height'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$submit_ary['avatar_width'] = $data['width'];
|
|
|
4c79b5 |
$submit_ary['avatar_height'] = $data['height'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ((isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']))) || $delete)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (isset($group_row['group_avatar']) && $group_row['group_avatar'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
avatar_delete('group', $group_row, true);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!check_form_key('ucp_groups'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$error[] = $user->lang['FORM_INVALID'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Only set the rank, colour, etc. if it's changed or if we're adding a new
|
|
|
4c79b5 |
// group. This prevents existing group members being updated if no changes
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_attributes = array();
|
|
|
4c79b5 |
$test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients');
|
|
|
4c79b5 |
foreach ($test_variables as $test)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($action == 'add' || (isset($submit_ary[$test]) && $group_row['group_' . $test] != $submit_ary[$test]))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$cache->destroy('sql', GROUPS_TABLE);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
|
|
4c79b5 |
trigger_error($user->lang[$message] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (sizeof($error))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$group_rank = $submit_ary['rank'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_desc_data = array(
|
|
|
4c79b5 |
'text' => $group_desc,
|
|
|
4c79b5 |
'allow_bbcode' => $allow_desc_bbcode,
|
|
|
4c79b5 |
'allow_smilies' => $allow_desc_smilies,
|
|
|
4c79b5 |
'allow_urls' => $allow_desc_urls
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$group_name = utf8_normalize_nfc(request_var('group_name', '', true));
|
|
|
4c79b5 |
$group_desc_data = array(
|
|
|
4c79b5 |
'text' => '',
|
|
|
4c79b5 |
'allow_bbcode' => true,
|
|
|
4c79b5 |
'allow_smilies' => true,
|
|
|
4c79b5 |
'allow_urls' => true
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
$group_rank = 0;
|
|
|
4c79b5 |
$group_type = GROUP_OPEN;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$group_desc_data = generate_text_for_edit($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_options']);
|
|
|
4c79b5 |
$group_rank = $group_row['group_rank'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT *
|
|
|
4c79b5 |
FROM ' . RANKS_TABLE . '
|
|
|
4c79b5 |
WHERE rank_special = 1
|
|
|
4c79b5 |
ORDER BY rank_title';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>';
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : '';
|
|
|
4c79b5 |
$rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : '';
|
|
|
4c79b5 |
$type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : '';
|
|
|
4c79b5 |
$type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : '';
|
|
|
4c79b5 |
$type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($config['allow_avatar_local'] && $display_gallery)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
avatar_gallery($category, $avatar_select, 4);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$avatars_enabled = ($can_upload || ($config['allow_avatar_local'] || $config['allow_avatar_remote'])) ? true : false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'S_EDIT' => true,
|
|
|
4c79b5 |
'S_INCLUDE_SWATCH' => true,
|
|
|
4c79b5 |
'S_CAN_UPLOAD' => $can_upload,
|
|
|
4c79b5 |
'S_FORM_ENCTYPE' => ($can_upload) ? ' enctype="multipart/form-data"' : '',
|
|
|
4c79b5 |
'S_ERROR' => (sizeof($error)) ? true : false,
|
|
|
4c79b5 |
'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false,
|
|
|
4c79b5 |
'S_AVATARS_ENABLED' => $avatars_enabled,
|
|
|
4c79b5 |
'S_DISPLAY_GALLERY' => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
|
|
|
4c79b5 |
'S_IN_GALLERY' => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'ERROR_MSG' => (sizeof($error)) ? implode(' ', $error) : '',
|
|
|
4c79b5 |
'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '',
|
|
|
4c79b5 |
'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0,
|
|
|
4c79b5 |
'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'GROUP_DESC' => $group_desc_data['text'],
|
|
|
4c79b5 |
'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'],
|
|
|
4c79b5 |
'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'],
|
|
|
4c79b5 |
'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_RANK_OPTIONS' => $rank_options,
|
|
|
4c79b5 |
'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'GROUP_TYPE_FREE' => GROUP_FREE,
|
|
|
4c79b5 |
'GROUP_TYPE_OPEN' => GROUP_OPEN,
|
|
|
4c79b5 |
'GROUP_TYPE_CLOSED' => GROUP_CLOSED,
|
|
|
4c79b5 |
'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN,
|
|
|
4c79b5 |
'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'GROUP_FREE' => $type_free,
|
|
|
4c79b5 |
'GROUP_OPEN' => $type_open,
|
|
|
4c79b5 |
'GROUP_CLOSED' => $type_closed,
|
|
|
4c79b5 |
'GROUP_HIDDEN' => $type_hidden,
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_SWATCH' => append_sid("{$phpbb_root_path}adm/swatch.$phpEx", 'form=ucp&name=group_colour'),
|
|
|
4c79b5 |
'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id",
|
|
|
4c79b5 |
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'list':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang(array('acp/groups', 'acp/common'));
|
|
|
4c79b5 |
$start = request_var('start', 0);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$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
|
|
|
4c79b5 |
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
|
|
|
4c79b5 |
WHERE ug.group_id = $group_id
|
|
|
4c79b5 |
AND u.user_id = ug.user_id
|
|
|
4c79b5 |
AND ug.group_leader = 1
|
|
|
4c79b5 |
ORDER BY ug.user_pending DESC, u.username_clean";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('leader', array(
|
|
|
4c79b5 |
'USERNAME' => $row['username'],
|
|
|
4c79b5 |
'USERNAME_COLOUR' => $row['user_colour'],
|
|
|
4c79b5 |
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
4c79b5 |
'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']),
|
|
|
4c79b5 |
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
|
|
|
4c79b5 |
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
|
|
|
4c79b5 |
'USER_POSTS' => $row['user_posts'],
|
|
|
4c79b5 |
'USER_ID' => $row['user_id'])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(user_id) AS total_members
|
|
|
4c79b5 |
FROM ' . USER_GROUP_TABLE . "
|
|
|
4c79b5 |
WHERE group_id = $group_id
|
|
|
4c79b5 |
AND group_leader = 0";
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$total_members = (int) $db->sql_fetchfield('total_members');
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$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
|
|
|
4c79b5 |
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
|
|
|
4c79b5 |
WHERE ug.group_id = $group_id
|
|
|
4c79b5 |
AND u.user_id = ug.user_id
|
|
|
4c79b5 |
AND ug.group_leader = 0
|
|
|
4c79b5 |
ORDER BY ug.user_pending DESC, u.username_clean";
|
|
|
4c79b5 |
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$pending = false;
|
|
|
4c79b5 |
$approved = false;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($row['user_pending'] && !$pending)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('member', array(
|
|
|
4c79b5 |
'S_PENDING' => true)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
$template->assign_var('S_PENDING_SET', true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$pending = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else if (!$row['user_pending'] && !$approved)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('member', array(
|
|
|
4c79b5 |
'S_APPROVED' => true)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
$template->assign_var('S_APPROVED_SET', true);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$approved = true;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_block_vars('member', array(
|
|
|
4c79b5 |
'USERNAME' => $row['username'],
|
|
|
4c79b5 |
'USERNAME_COLOUR' => $row['user_colour'],
|
|
|
4c79b5 |
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
|
|
4c79b5 |
'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']),
|
|
|
4c79b5 |
'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false,
|
|
|
4c79b5 |
'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
|
|
|
4c79b5 |
'USER_POSTS' => $row['user_posts'],
|
|
|
4c79b5 |
'USER_ID' => $row['user_id'])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$s_action_options = '';
|
|
|
4c79b5 |
$options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'deleteusers' => 'DELETE');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($options as $option => $lang)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_action_options .= '<option value="' . $option . '">' . $user->lang['GROUP_' . $lang] . '</option>';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'S_LIST' => true,
|
|
|
4c79b5 |
'S_ACTION_OPTIONS' => $s_action_options,
|
|
|
4c79b5 |
'S_ON_PAGE' => on_page($total_members, $config['topics_per_page'], $start),
|
|
|
4c79b5 |
'PAGINATION' => generate_pagination($this->u_action . "&action=$action&g=$group_id", $total_members, $config['topics_per_page'], $start),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_ACTION' => $this->u_action . "&g=$group_id",
|
|
|
4c79b5 |
'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'approve':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang('acp/groups');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
group_user_attributes('approve', $group_id, $mark_ary, false, false);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
trigger_error($user->lang['USERS_APPROVED'] . '
' . sprintf($user->lang['RETURN_PAGE'], '', ''));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'default':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!sizeof($mark_ary))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$start = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
do
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT user_id
|
|
|
4c79b5 |
FROM ' . USER_GROUP_TABLE . "
|
|
|
4c79b5 |
WHERE group_id = $group_id
|
|
|
4c79b5 |
ORDER BY user_id";
|
|
|
4c79b5 |
$result = $db->sql_query_limit($sql, 200, $start);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$mark_ary = array();
|
|
|
4c79b5 |
if ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
do
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$mark_ary[] = $row['user_id'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$start = (sizeof($mark_ary) < 200) ? 0 : $start + 200;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$start = 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
while ($start);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang('acp/groups');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . '
' . sprintf($user->lang['RETURN_PAGE'], '', ''));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user->add_lang('acp/common');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
|
|
|
4c79b5 |
'mark' => $mark_ary,
|
|
|
4c79b5 |
'g' => $group_id,
|
|
|
4c79b5 |
'i' => $id,
|
|
|
4c79b5 |
'mode' => $mode,
|
|
|
4c79b5 |
'action' => $action))
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'deleteusers':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang(array('acp/groups', 'acp/common'));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$group_row['group_name'] = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$error = group_user_del($group_id, $mark_ary, false, $group_row['group_name']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($error)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang[$error] . '
' . sprintf($user->lang['RETURN_PAGE'], '', ''));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
trigger_error($user->lang['GROUP_USERS_REMOVE'] . '
' . sprintf($user->lang['RETURN_PAGE'], '', ''));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
|
|
|
4c79b5 |
'mark' => $mark_ary,
|
|
|
4c79b5 |
'g' => $group_id,
|
|
|
4c79b5 |
'i' => $id,
|
|
|
4c79b5 |
'mode' => $mode,
|
|
|
4c79b5 |
'action' => $action))
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'addusers':
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$user->add_lang(array('acp/groups', 'acp/common'));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$names = utf8_normalize_nfc(request_var('usernames', '', true));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$group_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$names)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_USERS'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!($row = group_memberships($group_id, $user->data['user_id'])))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
list(, $row) = each($row);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!$row['group_leader'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$name_ary = array_unique(explode("\n", $names));
|
|
|
4c79b5 |
$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$default = request_var('default', 0);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Add user/s to group
|
|
|
4c79b5 |
if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang[$error] . $return_page);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
trigger_error($user->lang['GROUP_USERS_ADDED'] . '
' . sprintf($user->lang['RETURN_PAGE'], '', ''));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$s_hidden_fields = array(
|
|
|
4c79b5 |
'default' => $default,
|
|
|
4c79b5 |
'usernames' => $names,
|
|
|
4c79b5 |
'g' => $group_id,
|
|
|
4c79b5 |
'i' => $id,
|
|
|
4c79b5 |
'mode' => $mode,
|
|
|
4c79b5 |
'action' => $action
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
confirm_box(false, sprintf($user->lang['GROUP_CONFIRM_ADD_USER' . ((sizeof($name_ary) == 1) ? '' : 'S')], implode(', ', $name_ary)), build_hidden_fields($s_hidden_fields));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
trigger_error($user->lang['NO_USERS_ADDED'] . '
' . sprintf($user->lang['RETURN_PAGE'], '', ''));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
default:
|
|
|
4c79b5 |
$user->add_lang('acp/common');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_desc, g.group_desc_uid, g.group_desc_bitfield, g.group_desc_options, g.group_type, ug.group_leader
|
|
|
4c79b5 |
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
|
|
|
4c79b5 |
WHERE ug.user_id = ' . $user->data['user_id'] . '
|
|
|
4c79b5 |
AND g.group_id = ug.group_id
|
|
|
4c79b5 |
AND ug.group_leader = 1
|
|
|
4c79b5 |
ORDER BY g.group_type DESC, g.group_name';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($value = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('leader', array(
|
|
|
4c79b5 |
'GROUP_NAME' => ($value['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $value['group_name']] : $value['group_name'],
|
|
|
4c79b5 |
'GROUP_DESC' => generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']),
|
|
|
4c79b5 |
'GROUP_TYPE' => $value['group_type'],
|
|
|
4c79b5 |
'GROUP_ID' => $value['group_id'],
|
|
|
4c79b5 |
'GROUP_COLOUR' => $value['group_colour'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_LIST' => $this->u_action . "&action=list&g={$value['group_id']}",
|
|
|
4c79b5 |
'U_EDIT' => $this->u_action . "&action=edit&g={$value['group_id']}")
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'ucp_groups_' . $mode;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|