From 39fa3b6b2543b5b88227eee5c97637e184c48994 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sat, 23 Aug 2003 01:01:20 +0000 Subject: [PATCH] Mostly non-working still ... can add new users/team leaders git-svn-id: file:///svn/phpbb/trunk@4421 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_groups.php | 1197 +++++++++++++++++------------- phpBB/language/en/lang_admin.php | 96 ++- 2 files changed, 737 insertions(+), 556 deletions(-) diff --git a/phpBB/adm/admin_groups.php b/phpBB/adm/admin_groups.php index f6855035f9..4bae471635 100644 --- a/phpBB/adm/admin_groups.php +++ b/phpBB/adm/admin_groups.php @@ -19,15 +19,15 @@ * ***************************************************************************/ -if (!empty($setmodules) ) +if (!empty($setmodules)) { - if (!$auth->acl_get('a_group') ) + if (!$auth->acl_get('a_group')) { return; } $module['GROUP']['MANAGE'] = basename(__FILE__) . "$SID&mode=manage"; - $module['GROUP']['PREFERENCES'] = basename(__FILE__) . "$SID&mode=prefs"; + $module['GROUP']['GROUP_PREFS'] = basename(__FILE__) . "$SID&mode=prefs"; return; } @@ -35,7 +35,7 @@ if (!empty($setmodules) ) define('IN_PHPBB', 1); // Include files $phpbb_root_path = '../'; -require($phpbb_root_path . 'extension.inc'); +$phpEx = substr(strrchr(__FILE__, '.'), 1); require('pagestart.' . $phpEx); // Do we have general permissions? @@ -44,8 +44,13 @@ if (!$auth->acl_get('a_group') ) trigger_error($user->lang['NO_ADMIN']); } + + // Check and set some common vars -$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : ''; +$update = (isset($_POST['update'])) ? true : false; +$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : ''; +$group_id = (isset($_REQUEST['g'])) ? intval($_REQUEST['g']) : ''; + if (isset($_POST['addgroup'])) { $action = 'addgroup'; @@ -54,27 +59,27 @@ else if (isset($_POST['delete'])) { $action = 'delete'; } -else if (isset($_POST['add'])) +else if (isset($_POST['addleaders']) || isset($_POST['addusers'])) { - $action = 'add'; + $action = (isset($_POST['addleaders'])) ? 'addleaders' : 'addusers'; } else { - $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : ''; + $action = (isset($_REQUEST['action'])) ? htmlspecialchars($_REQUEST['action']) : ''; } -$group_id = (isset($_REQUEST['g'])) ? intval($_REQUEST['g']) : ''; -$start = (isset($_GET['start']) && $mode == 'member') ? intval($_GET['start']) : 0; -$start_mod = (isset($_GET['start']) && $mode == 'mod') ? intval($_GET['start']) : 0; -$start_pend = (isset($_GET['start']) && $mode == 'pend') ? intval($_GET['start']) : 0; +$start = (isset($_GET['start']) && $action == 'member') ? intval($_GET['start']) : 0; +$start_mod = (isset($_GET['start']) && $action == 'leader') ? intval($_GET['start']) : 0; +$start_pend = (isset($_GET['start']) && $action == 'pending') ? intval($_GET['start']) : 0; + // Grab basic data for group, if group_id is set since it's used // in several places below -if (!empty($group_id)) +if ($group_id) { - $sql = "SELECT * - FROM " . GROUPS_TABLE . " + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . " WHERE group_id = $group_id"; $result = $db->sql_query($sql); @@ -85,134 +90,126 @@ if (!empty($group_id)) $db->sql_freeresult($result); } -// Page header -adm_page_header($user->lang['MANAGE']); -// Which page? -switch ($action) + +switch ($mode) { - case 'edit': - case 'addgroup': + case 'manage': + // Page header + adm_page_header($user->lang['MANAGE']); - $error = ''; - - // Did we submit? - if (isset($_POST['submit']) || isset($_POST['submitprefs'])) + // Which page? + switch ($action) { - if (isset($_POST['submit'])) - { - if ($group_type != GROUP_SPECIAL) - { - $group_name = (!empty($_POST['group_name'])) ? htmlspecialchars($_POST['group_name']) : ''; - $group_type = (!empty($_POST['group_type'])) ? intval($_POST['group_type']) : ''; - } - $group_description = (!empty($_POST['group_description'])) ? htmlspecialchars($_POST['group_description']) : ''; - $group_colour = (!empty($_POST['group_colour'])) ? htmlspecialchars($_POST['group_colour']) : ''; - $group_rank = (isset($_POST['group_rank'])) ? intval($_POST['group_rank']) : ''; - $group_avatar = (!empty($_POST['group_avatar'])) ? htmlspecialchars($_POST['group_avatar']) : ''; + case 'edit': + case 'addgroup': - // Check data - if ($group_name == '' || strlen($group_name) > 40) + // Did we submit? + if ($update) { - $error .= (($error != '') ? '
' : '') . (($group_name == '') ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']); - } - if (strlen($group_description) > 255) - { - $error .= (($error != '') ? '
' : '') . $user->lang['GROUP_ERR_DESC_LONG']; - } - if ($group_type < GROUP_OPEN || $group_type > GROUP_FREE) - { - $error .= (($error != '') ? '
' : '') . $user->lang['GROUP_ERR_TYPE']; - } - } - else - { - $user_lang = (!empty($_POST['user_lang'])) ? htmlspecialchars($_POST['user_lang']) : ''; - $user_tz = (isset($_POST['user_tz'])) ? doubleval($_POST['user_tz']) : ''; - $user_dst = (isset($_POST['user_dst'])) ? intval($_POST['user_dst']) : ''; - } + if ($group_type != GROUP_SPECIAL) + { + $group_name = (!empty($_POST['group_name'])) ? htmlspecialchars($_POST['group_name']) : ''; + $group_type = (!empty($_POST['group_type'])) ? intval($_POST['group_type']) : ''; + } + $group_description = (!empty($_POST['group_description'])) ? htmlspecialchars($_POST['group_description']) : ''; + $group_colour = (!empty($_POST['group_colour'])) ? htmlspecialchars($_POST['group_colour']) : ''; + $group_rank = (isset($_POST['group_rank'])) ? intval($_POST['group_rank']) : ''; + $group_avatar = (!empty($_POST['group_avatar'])) ? htmlspecialchars($_POST['group_avatar']) : ''; - // Update DB - if (!$error) - { - // Update group preferences - $sql = "UPDATE " . GROUPS_TABLE . " - SET group_name = '$group_name', group_description = '$group_description', group_type = $group_type, group_rank = $group_rank, group_colour = '$group_colour' - WHERE group_id = $group_id"; - $db->sql_query($sql); + // Check data + if ($group_name == '' || strlen($group_name) > 40) + { + $error .= (($error != '') ? '
' : '') . (($group_name == '') ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']); + } + if (strlen($group_description) > 255) + { + $error .= (($error != '') ? '
' : '') . $user->lang['GROUP_ERR_DESC_LONG']; + } + if ($group_type < GROUP_OPEN || $group_type > GROUP_FREE) + { + $error .= (($error != '') ? '
' : '') . $user->lang['GROUP_ERR_TYPE']; + } + /* + // Update DB + if (!$error) + { + // Update group preferences + $sql = "UPDATE " . GROUPS_TABLE . " + SET group_name = '$group_name', group_description = '$group_description', group_type = $group_type, group_rank = $group_rank, group_colour = '$group_colour' + WHERE group_id = $group_id"; + $db->sql_query($sql); - $user_sql = ''; - $user_sql .= (isset($_POST['submit'])) ? ((($user_sql != '') ? ', ' : '') . "user_colour = '$group_colour'") : ''; - $user_sql .= (isset($_POST['submit']) && $group_rank != -1) ? ((($user_sql != '') ? ', ' : '') . "user_rank = $group_rank") : ''; - $user_sql .= (isset($_POST['submitprefs']) && $user_lang != -1) ? ((($user_sql != '') ? ', ' : '') . "user_lang = '$user_lang'") : ''; - $user_sql .= (isset($_POST['submitprefs']) && $user_tz != -14) ? ((($user_sql != '') ? ', ' : '') . "user_timezone = $user_tz") : ''; - $user_sql .= (isset($_POST['submitprefs']) && $user_dst != -1) ? ((($user_sql != '') ? ', ' : '') . "user_dst = $user_dst") : ''; + $user_sql = ''; + $user_sql .= (isset($_POST['submit'])) ? ((($user_sql != '') ? ', ' : '') . "user_colour = '$group_colour'") : ''; + $user_sql .= (isset($_POST['submit']) && $group_rank != -1) ? ((($user_sql != '') ? ', ' : '') . "user_rank = $group_rank") : ''; - // Update group members preferences - switch (SQL_LAYER) - { - case 'mysql': - case 'mysql4': - // batchwise? 500 at a time or so maybe? try to reduce memory useage - $more = true; - $start = 0; - do + // Update group members preferences + switch (SQL_LAYER) { - $sql = 'SELECT user_id - FROM ' . USER_GROUP_TABLE . " - WHERE group_id = $group_id - LIMIT $start, 500"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $user_count = 0; - $user_id_sql = ''; + case 'mysql': + case 'mysql4': + // batchwise? 500 at a time or so maybe? try to reduce memory useage + $more = true; + $start = 0; do { - $user_id_sql .= (($user_id_sql != '') ? ', ' : '') . $row['user_id']; - $user_count++; - } - while ($row = $db->sql_fetchrow($result)); + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + LIMIT $start, 500"; + $result = $db->sql_query($sql); - $sql = 'UPDATE ' . USERS_TABLE . " + if ($row = $db->sql_fetchrow($result)) + { + $user_count = 0; + $user_id_sql = ''; + do + { + $user_id_sql .= (($user_id_sql != '') ? ', ' : '') . $row['user_id']; + $user_count++; + } + while ($row = $db->sql_fetchrow($result)); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET $user_sql + WHERE user_id IN ($user_id_sql)"; + $db->sql_query($sql); + + if ($user_count == 500) + { + $start += 500; + } + else + { + $more = false; + } + } + else + { + $more = false; + } + $db->sql_freeresult($result); + unset($user_id_sql); + } + while ($more); + + break; + + default: + $sql ='"UPDATE ' . USERS_TABLE . " SET $user_sql - WHERE user_id IN ($user_id_sql)"; + WHERE user_id IN ( + SELECT user_id + FROM " . USER_GROUP_TABLE . " + WHERE group_id = $group_id)"; $db->sql_query($sql); - - if ($user_count == 500) - { - $start += 500; - } - else - { - $more = false; - } - } - else - { - $more = false; - } - $db->sql_freeresult($result); - unset($user_id_sql); } - while ($more); - break; - - default: - $sql ='"UPDATE ' . USERS_TABLE . " - SET $user_sql - WHERE user_id IN ( - SELECT user_id - FROM " . USER_GROUP_TABLE . " - WHERE group_id = $group_id)"; - $db->sql_query($sql); + trigger_error($user->lang['GROUP_UPDATED']); + }*/ } - trigger_error($user->lang['GROUP_UPDATED']); - } - } ?> @@ -222,28 +219,28 @@ switch ($action) sql_query($sql); + $sql = 'SELECT * + FROM ' . RANKS_TABLE . ' + WHERE rank_special = 1 + ORDER BY rank_title'; + $result = $db->sql_query($sql); - $rank_options = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $selected = (!empty($group_rank) && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; - $rank_options .= ''; - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); + $rank_options = ''; + if ($row = $db->sql_fetchrow($result)) + { + do + { + $selected = (!empty($group_rank) && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; + $rank_options .= ''; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); - $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_free = ($group_type == GROUP_FREE) ? ' 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"' : ''; + $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; ?> @@ -252,47 +249,47 @@ switch ($action) function swatch() { - window.open('./swatch.php?form=settings&name=group_colour', '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636'); + window.open('./swatch.?form=settings&name=group_colour', '_swatch', 'HEIGHT=115,resizable=yes,scrollbars=no,WIDTH=636'); return false; } //--> -
"> +">
- + - + @@ -302,8 +299,8 @@ function swatch() @@ -312,14 +309,14 @@ function swatch() - + @@ -336,132 +333,152 @@ function swatch()
lang['GROUP_DETAILS']; ?>
', $error); ?>
lang['GROUP_NAME']; ?>:lang['GROUP_NAME']; ?>: lang['G_' . $group_name])) ? $user->lang['G_' . $group_name] : $group_name; ?>
lang['GROUP_SETTINGS_SAVE']; ?>
lang['GROUP_COLOR']; ?>:
lang['GROUP_COLOR_EXPLAIN'], '', ''); ?>
lang['GROUP_COLOR']; ?>:
lang['GROUP_COLOR_EXPLAIN'], '', ''); ?>
lang['NO_USERS']); - } - $users = explode("\n", $_POST['usernames']); - - $table_sql = ($mode == 'mod' ) ? GROUPS_MODERATOR_TABLE : USER_GROUP_TABLE; - - // Grab the user ids - $sql = "SELECT user_id - FROM " . USERS_TABLE . " - WHERE username IN (" . implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#', "'\\1'", $users)) . ")"; - $result = $db->sql_query($sql); - - if (!($row = $db->sql_fetchrow($result))) - { - trigger_error($user->lang['NO_USERS']); - } - - $user_id_ary = array(); - do - { - $user_id_ary[] = $row['user_id']; - } - while ($row = $db->sql_fetchrow($result)); - $db->sql_freeresult($result); - - // Remove users who are already members of this group - $sql = "SELECT user_id - FROM $table_sql - WHERE user_id IN (" . implode(', ', $user_id_ary) . ") - AND group_id = $group_id"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $old_user_id_ary = array(); - do - { - $old_user_id_ary[] = $row['user_id']; - } - while ($row = $db->sql_fetchrow($result)); - - $user_id_ary = array_diff($user_id_ary, $old_user_id_ary); - } - $db->sql_freeresult($result); - - if (!sizeof($user_id_ary)) - { - trigger_error($user->lang['GROUP_ERR_USERS_EXIST']); - } - - // Insert the new users - switch (SQL_LAYER) - { - case 'mysql': - case 'mysql4': - $sql = "INSERT INTO $table_sql (user_id, group_id) - VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id)", $user_id_ary)); - $db->sql_query($sql); break; - case 'mssql': - case 'sqlite': - $sql = "INSERT INTO $table_sql (user_id, group_id) " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id)", $user_id_ary)); - $db->sql_query($sql); - break; - default: - foreach ($user_id_ary as $user_id) + case 'addleaders': + case 'addusers': + // TODO : + // Need to add users to user_group table when adding as moderator (if applicable) + + $username_ary = (!empty($_POST['usernames'])) ? array_unique(explode("\n", $_POST['usernames'])) : ''; + if (!$username_ary) { - $sql = "INSERT INTO $table_sql (user_id, group_id) - VALUES ($user_id, $group_id)"; + trigger_error($user->lang['NO_USERS']); + } + + $sql_where = array(); + foreach ($username_ary as $username) + { + if ($username = trim($username)) + { + $sql_where[] = "'$username'"; + } + } + unset($username_ary); + + // Grab the user ids + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE username IN (' . implode(', ', $sql_where) . ')'; + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + trigger_error($user->lang['NO_USERS']); + } + + $id_ary = array(); + do + { + $id_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + // Remove users who are already members of this group + $sql = 'SELECT user_id, group_leader + FROM ' . USER_GROUP_TABLE . ' + WHERE user_id IN (' . implode(', ', $id_ary) . ") + AND group_id = $group_id"; + $result = $db->sql_query($sql); + + $add_id_ary = $update_id_ary = array(); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $add_id_ary[] = $row['user_id']; + + if ($action == 'addleaders' && !$row['group_leader']) + { + $update_id_ary[] = $row['user_id']; + } + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + // Do all the users exist in this group? + $add_id_ary = array_diff($id_ary, $add_id_ary); + unset($id_ary); + + // If we have no users + if (!sizeof($add_id_ary) && !sizeof($update_id_ary)) + { + trigger_error($user->lang['GROUP_USERS_EXIST']); + } + + if (sizeof($add_id_ary)) + { + $group_leader = ($action == 'addleaders') ? 1 : 0; + + // Insert the new users + switch (SQL_LAYER) + { + case 'mysql': + case 'mysql4': + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader) + VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $group_leader)", $add_id_ary)); + $db->sql_query($sql); + break; + + case 'mssql': + case 'sqlite': + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader) + " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', "(\\1, $group_id, $group_leader)", $add_id_ary)); + $db->sql_query($sql); + break; + + default: + foreach ($add_id_ary as $user_id) + { + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, group_leader) + VALUES ($user_id, $group_id, $group_leader)"; + $db->sql_query($sql); + } + break; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_permissions = '' + WHERE user_id IN (" . implode(', ', $add_id_ary) . ')'; $db->sql_query($sql); } + + if (sizeof($update_id_ary)) + { + $sql = 'UPDATE ' . USER_GROUP_TABLE . ' + SET group_leader = 1 + WHERE user_id IN (' . implode(', ', $update_id_ary) . ") + AND group_id = $group_id"; + $db->sql_query($sql); + } + + + // Update user settings (color, rank) if applicable + if (!empty($_POST['default'])) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET group_id = $group_id, user_colour = '$group_colour', user_rank = " . intval($group_rank) . " + WHERE user_id IN (" . implode(', ', $add_id_ary) . ")"; + $db->sql_query($sql); + } + +// add_log(); + + $message = ($mode == 'addleaders') ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED'; + trigger_error($user->lang[$message]); + + + break; - } - // Update user settings (color, rank) if applicable - if (!empty($_POST['settings'])) - { - $sql = "UPDATE " . USERS_TABLE ." - SET user_colour = '$group_colour', user_rank = " . intval($group_rank) . " - WHERE user_id IN (" . implode(', ', $user_id_ary) . ")"; - $db->sql_query($sql); - } -// add_log(); - $message = ($mode == 'mod') ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED'; - trigger_error($user->lang[$message]); - break; - - case 'delete': - - // TODO: - // Need to offer ability to demote moderators or remove from group - - break; - - case 'approve': - - break; - - case 'list': - - $sql = 'SELECT * - FROM ' . GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - - if (!extract($db->sql_fetchrow($result))) - { - trigger_error($user->lang['NO_GROUP']); - } - $db->sql_freeresult($result); + // Show list of leaders, existing and pending members + case 'list': ?> @@ -471,81 +488,113 @@ function swatch() sql_query($sql); + + $total_leaders = ($row = $db->sql_fetchrow($result)) ? $row['total_leaders'] : 0; + $db->sql_freeresult($result); + + // Total number of group members (non-leaders) + $sql = 'SELECT COUNT(user_id) AS total_members + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND group_leader <> 1"; + $result = $db->sql_query($sql); + + $total_members = ($row = $db->sql_fetchrow($result)) ? $row['total_members'] : 0; + $db->sql_freeresult($result); + + // Grab the members + $sql = 'SELECT u.user_id, u.username, 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 + ORDER BY ug.group_leader DESC, ug.user_pending DESC, u.username + LIMIT $start, " . $config['topics_per_page']; + $result = $db->sql_query($sql); + + $leader = $member = 0; + $group_data = array(); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $type = ($row['group_leader']) ? 'leader' : 'member'; + + $group_data[$type][$$type]['user_id'] = $row['user_id']; + $group_data[$type][$$type]['group_id'] = $row['group_id']; + $group_data[$type][$$type]['username'] = $row['username']; + $group_data[$type][$$type]['user_regdate'] = $row['user_regdate']; + $group_data[$type][$$type]['user_posts'] = $row['user_posts']; + $group_data[$type][$$type]['user_pending'] = $row['user_pending']; + + $$type++; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + if ($group_type != GROUP_SPECIAL) + { ?> +

lang['GROUP_MODS']; ?>

lang['GROUP_MODS_EXPLAIN']; ?>

-
"> +">
- - - + + + + sql_query($sql); - - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $total_moderators = $row['total_members']; - - $sql = 'SELECT u.user_id, u.username, u.user_regdate, u.user_posts - FROM ' . USERS_TABLE . ' u, ' . GROUPS_MODERATOR_TABLE . " gm - WHERE gm.group_id = $group_id - AND u.user_id = gm.user_id - ORDER BY u.username - LIMIT $start_mod, " . $config['topics_per_page']; - $result = $db->sql_query($sql); - - $db->sql_freeresult($result); - - if ($row = $db->sql_fetchrow($result) ) - { - do - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - - $group_mod_ary[] = $row['user_id']; + if (sizeof($group_data['leader'])) + { + foreach ($group_data['leader'] as $row) + { + $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; ?> + sql_fetchrow($result) ); - - } - else - { + } + } + else + { ?> - + + - +
lang['USERNAME']; ?>lang['JOINED']; ?>lang['POSTS']; ?>lang['USERNAME']; ?>Defaultlang['JOINED']; ?>lang['POSTS']; ?> lang['MARK']; ?>
" target="_profile">lang['YES'] : $user->lang['NO']; ?> format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?>
lang['GROUPS_NO_MODS']; ?>lang['GROUPS_NO_MODS']; ?>
+ + + + +
@@ -558,103 +607,109 @@ function swatch()
- +
- + - + + - + + -
lang['ADD_USERS']; ?>lang['ADD_USERS']; ?>
lang['USER_GETS_GROUP_SET']; ?>:
lang['USER_GETS_GROUP_SET_EXPLAIN']; ?>
lang['YES']; ?>   lang['NO']; ?>
  &mode=searchuser&form=mod&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />lang['USERNAME']; ?>:
lang['USERNAMES_EXPLAIN']; ?>
+ +   &mode=searchuser&form=mod&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /> + + + + + sql_query($sql); - - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $total_members = $row['total_members'] - $total_moderators; - - $sql = 'SELECT u.user_id, u.username, u.user_regdate, u.user_posts, ug.user_pending - FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug - WHERE ug.group_id = $group_id - AND u.user_id = ug.user_id - $skip_user_sql - ORDER BY ug.user_pending DESC, u.username - LIMIT $start, " . $config['topics_per_page']; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result) ) - { - $pending = $row['user_pending']; - - // TODO - $user->lang['DATE_FORMAT'] = 'd M Y'; + // Existing members ?>

lang['GROUP_LIST']; ?>

lang['GROUP_LIST_EXPLAIN']; ?>

-
"> +">
- - - + + + + - - - - - - - - + + + + + + sql_fetchrow($result)); + } + } + else + { ?> - + + + + +
lang['USERNAME']; ?>lang['JOINED']; ?>lang['POSTS']; ?>lang['USERNAME']; ?>Defaultlang['JOINED']; ?>lang['POSTS']; ?> lang['MARK']; ?>
Pending Members
Approved MembersApproved Members
Pending Members
" target="_profile">lang['YES'] : $user->lang['NO']; ?> format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?>
lang['GROUPS_NO_MEMBERS']; ?>
+ + + + +
 
@@ -667,26 +722,246 @@ function swatch()
- +
- + - + + - + + - + + +
lang['ADD_USERS']; ?>lang['ADD_USERS']; ?>
lang['USER_GETS_GROUP_SET']; ?> lang['YES']; ?>   lang['NO']; ?>lang['USER_GETS_GROUP_SET']; ?>:
lang['USER_GETS_GROUP_SET_EXPLAIN']; ?>
lang['YES']; ?>   lang['NO']; ?>
lang['USERNAME']; ?>:
lang['USERNAMES_EXPLAIN']; ?>
  &mode=searchuser&form=mod&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />   &mode=searchuser&form=mod&field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" />
+ +
+ + + +

lang['MANAGE']; ?>

+ +

lang['GROUP_MANAGE_EXPLAIN']; ?>

+ +

lang['USER_DEF_GROUPS']; ?>

+ +

lang['USER_DEF_GROUPS_EXPLAIN']; ?>

+ +
"> + + + + + +sql_query($sql); + + $special_toggle = false; + while ($row = $db->sql_fetchrow($result) ) + { + $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; + + if ($row['group_type'] == GROUP_SPECIAL && !$special_toggle) + { + $special_toggle = true; + +?> + + + +
lang['MANAGE']; ?>lang['TOTAL_MEMBERS']; ?>lang['OPTIONS']; ?>
Create new group:
+ +

lang['SPECIAL_GROUPS']; ?>

+ +

lang['SPECIAL_GROUPS_EXPLAIN']; ?>

+ + + + + + + +lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name']; + +?> + + + + + + + + + + + + +sql_freeresult($result); + +?> + +
lang['MANAGE']; ?>lang['TOTAL_MEMBERS']; ?>lang['OPTIONS']; ?>
">   ">Defaultlang['']; ?>  ">lang['EDIT']; ?>  " . $user->lang['DELETE'] . '' : $user->lang['DELETE']; + + +?> 
 
 
sql_freeresult($result); + break; + + + + + } + + // Common javascript +?> + + + +lang['GROUP_PREFS']); + + + adm_page_footer(); + break; + + + + default: + trigger_error($user->lang['NO_MODE']); +} + +exit; + + + + + + + + + + + + + + + + + + +/* + + + + + + + + + + + + case 'add': + + + break; + + + + + + + case 'delete': + // TODO: + // Need to offer ability to demote moderators or remove from group + break; + + + + + + case 'approve': break; @@ -698,11 +973,22 @@ function swatch() - default: - switch ($mode) - { - case 'prefs': +adm_page_footer(); + + + + + + case 'prefs': + + } + else + { + $user_lang = (!empty($_POST['user_lang'])) ? htmlspecialchars($_POST['user_lang']) : ''; + $user_tz = (isset($_POST['user_tz'])) ? doubleval($_POST['user_tz']) : ''; + $user_dst = (isset($_POST['user_dst'])) ? intval($_POST['user_dst']) : ''; + } ?>

lang['GROUP_SETTINGS']; ?>

@@ -732,131 +1018,6 @@ function swatch() - -

lang['MANAGE']; ?>

- -

lang['GROUP_MANAGE_EXPLAIN']; ?>

- -

lang['USER_DEF_GROUPS']; ?>

- -

lang['USER_DEF_GROUPS_EXPLAIN']; ?>

- -
"> - - - - -sql_query($sql); - - $special_toggle = false; - while ($row = $db->sql_fetchrow($result) ) - { - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - - if ($row['group_type'] == GROUP_SPECIAL && !$special_toggle) - { - $special_toggle = true; - -?> - - - -
lang['MANAGE']; ?>lang['ACTION']; ?>
Create new group:
- -

lang['SPECIAL_GROUPS']; ?>

- -

lang['SPECIAL_GROUPS_EXPLAIN']; ?>

- - - - - - -lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name']; - -?> - - - - - - - - - - - - -sql_freeresult($result); - -?> - - - -
lang['MANAGE']; ?>lang['ACTION']; ?>
"> ">lang['EDIT']; ?>  ">lang['DELETE']; ?> 
 
 
- - - - - - \ No newline at end of file diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php index 1232f02031..5a77a7553b 100644 --- a/phpBB/language/en/lang_admin.php +++ b/phpBB/language/en/lang_admin.php @@ -46,8 +46,9 @@ $lang += array( 'CRON' => 'Cronjobs', 'PHP_INFO' => 'PHP Information', - 'GROUP_CAT' => 'Usergroups', - 'CREATE' => 'Create', + 'GROUP_CAT' => 'Usergroups', + 'CREATE' => 'Create', + 'GROUP_PREFS' => 'Preferences', 'LOG_CAT' => 'Logging', 'ADMIN_LOGS' => 'Admin Log', @@ -74,6 +75,7 @@ $lang += array( 'PRUNE_USERS' => 'Prune users', 'ADMINISTRATORS' => 'Administrators', + 'USERNAMES_EXPLAIN' => 'Place each username on a seperate line', 'LOOK_UP_FORUM' => 'Select a Forum', 'MANAGE' => 'Manage', 'ADD' => 'Add', @@ -416,6 +418,7 @@ $lang += array( 'acl_u_viewonline' => 'Can view all online', 'acl_u_viewprofile' => 'Can view profiles', 'acl_u_sendemail' => 'Can send emails', + 'acl_u_sendim' => 'Can send instant messages', 'acl_u_sendpm' => 'Can send private messages', 'acl_u_readpm' => 'Can read private messages', 'acl_u_chgavatar' => 'Can change avatar', @@ -859,53 +862,70 @@ $lang += array( // Group admin $lang += array( 'GROUP_MANAGE_EXPLAIN' => 'From this panel you can administer all your usergroups, you can; delete, create and edit existing groups. You may choose moderators, toggle open/closed group status and set the group name and description.', - 'USER_DEF_GROUPS' => 'User defined groups', - 'USER_DEF_GROUPS_EXPLAIN' => 'These are groups created by you or another admin on this board. You can modify, delete or otherwise alter these. You can also define group wide settings which affect each and every member of the group.', - 'SPECIAL_GROUPS' => 'Special groups', - 'SPECIAL_GROUPS_EXPLAIN' => 'These are pre-defined groups, they cannot be deleted or directly modified. However you can still add users and alter settings which affect all members of each group.', + + 'USER_DEF_GROUPS' => 'User defined groups', + 'USER_DEF_GROUPS_EXPLAIN' => 'These are groups created by you or another admin on this board. You can modify, delete or otherwise alter these. You can also define group wide settings which affect each and every member of the group.', + 'SPECIAL_GROUPS' => 'Special groups', + 'SPECIAL_GROUPS_EXPLAIN' => 'These are pre-defined groups, they cannot be deleted or directly modified. However you can still add users and alter settings which affect all members of each group.', + 'TOTAL_MEMBERS' => 'Members', + 'GROUP_EDIT_EXPLAIN' => 'Here you can edit an existing group. You can change its name, description and type (open, closed, etc.). You can also set certain groupwide options such as colouration, rank, etc. Please note that colours can be altered by individual users if they have appropriate permissions. Changes made here override users current settings.', - 'GROUP_SETTINGS' => 'Set user preferences', - 'GROUP_SETTINGS_EXPLAIN' => 'Here you can force changes in users current preferences. Please note these settings are not saved for the group itself. They are intended as a quick method of altering the preferences of all users in this group.', - 'GROUP_MEMBERS' => 'Group members', + + 'GROUP_MEMBERS' => 'Group members', 'GROUP_MEMBERS_EXPLAIN' => 'This is a complete listing of all the members of this usergroup. It includes seperate sections for moderators, pending and existing members. From here you can manage all aspects of who has membership of this group and what their role is.', - 'GROUP_MODS' => 'Group leaders', - 'GROUP_MODS_EXPLAIN' => 'This is a list of users assigned group leader roles. Group leaders can add, approve and remove members of their group.', - 'GROUP_PENDING' => 'Pending Users', + 'GROUP_MODS' => 'Group leaders', + 'GROUP_MODS_EXPLAIN' => 'This is a list of users assigned group leader roles. Group leaders can add, approve and remove members of their group.', + 'GROUP_PENDING' => 'Pending Users', 'GROUP_PENDING_EXPLAIN' => 'These users have requested to join the group but have yet to be approved. You can approve or decline their request, or contact the user for further information.', - 'ADD_NEW_GROUP' => 'Create new group', + 'ADD_NEW_GROUP' => 'Create new group', + 'GROUP_LIST' => 'Current members', 'GROUP_LIST_EXPLAIN' => 'This is a complete list of all the current users with membership of this group. You can delete members (except in certain special groups) or add new ones as you see fit.', 'GROUP_SETTINGS_SAVE' => 'Groupwide settings', 'GROUP_DETAILS' => 'Group details', 'GROUP_NAME' => 'Group name', 'GROUP_DESC' => 'Group description', + 'GROUP_MODERATORS' => 'Group Leaders', - 'GROUP_TYPE' => 'Group type', - 'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.', - 'GROUP_OPEN' => 'Open', - 'GROUP_REQUEST' => 'Request', - 'GROUP_CLOSED' => 'Closed', - 'GROUP_HIDDEN' => 'Hidden', - 'GROUP_COLOR' => 'Group colour', - 'GROUP_COLOR_EXPLAIN' => 'Defines the colour members usernames will appear in, leave blank for user default. Display %sWebsafe Colour Swatch%s.', - 'FORCE_COLOR' => 'Force update', - 'GROUP_RANK' => 'Group rank', - 'GROUP_AVATAR' => 'Group avatar', - 'GROUP_AVATAR_EXPLAIN' => 'This image will be displayed in the Group Control Panel.', - 'GROUP_LANG' => 'Group language', - 'GROUP_TIMEZONE' => 'Group timezone', - 'GROUP_DST' => 'Group daylight savings', - 'USER_DEFAULT' => 'User default', - 'USER_GETS_GROUP_SET' => 'Users inherit group settings', - 'GROUPS_NO_MODS' => 'No group moderators defined', - 'GROUP_ERR_USERNAME' => 'No group name specified.', - 'GROUP_ERR_USER_LONG' => 'Group name too long.', - 'GROUP_ERR_DESC_LONG' => 'Group description too long.', - 'GROUP_ERR_TYPE' => 'Inappropriate group type specified.', + + 'GROUP_TYPE' => 'Group type', + 'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.', + 'GROUP_OPEN' => 'Open', + 'GROUP_REQUEST' => 'Request', + 'GROUP_CLOSED' => 'Closed', + 'GROUP_HIDDEN' => 'Hidden', + 'GROUP_COLOR' => 'Group colour', + 'GROUP_COLOR_EXPLAIN' => 'Defines the colour members usernames will appear in, leave blank for user default. Display %sWebsafe Colour Swatch%s.', + 'FORCE_COLOR' => 'Force update', + 'GROUP_RANK' => 'Group rank', + 'GROUP_AVATAR' => 'Group avatar', + 'GROUP_AVATAR_EXPLAIN' => 'This image will be displayed in the Group Control Panel.', + + 'USER_DEFAULT' => 'User default', + 'USER_GETS_GROUP_SET' => 'Set as default group', + 'USER_GETS_GROUP_SET_EXPLAIN' => 'Saying yes here will set this group as the default group for the added users', + + 'GROUPS_NO_MEMBERS' => 'This group has no members', + 'GROUPS_NO_MODS' => 'No group leaders defined', + + 'GROUP_UPDATED' => 'Group preferences updated successfully.', + 'GROUP_USERS_EXIST' => 'The selected users are already members.', + 'GROUP_USERS_ADDED' => 'New users added to group successfully.', + 'GROUP_MODS_ADDED' => 'New group moderators added successfully.', + + + 'GROUP_SETTINGS' => 'Set user preferences', + 'GROUP_SETTINGS_EXPLAIN' => 'Here you can force changes in users current preferences. Please note these settings are not saved for the group itself. They are intended as a quick method of altering the preferences of all users in this group.', + 'GROUP_LANG' => 'Group language', + 'GROUP_TIMEZONE' => 'Group timezone', + 'GROUP_DST' => 'Group daylight savings', + + + 'GROUP_ERR_USERNAME' => 'No group name specified.', + 'GROUP_ERR_USER_LONG' => 'Group name too long.', + 'GROUP_ERR_DESC_LONG' => 'Group description too long.', + 'GROUP_ERR_TYPE' => 'Inappropriate group type specified.', 'GROUP_ERR_USERS_EXIST' => 'The specified users are already members of this group', - 'GROUP_UPDATED' => 'Group preferences updated successfully.', - 'GROUP_USERS_ADDED' => 'New users added to group successfully.', - 'GROUP_MODS_ADDED' => 'New group moderators added successfully.', ); // Forum Pruning