aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-08-25 01:38:49 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-08-25 01:38:49 +0000
commitd96bb3a86e4a78ec4f1753f87d9dd0411f8da896 (patch)
tree807e990e138728b80e2fde4484ad67b226c40dc9 /phpBB
parentfb5a64a31959aab27262c56f5fdbd6e5b231fa9c (diff)
downloadforums-d96bb3a86e4a78ec4f1753f87d9dd0411f8da896.tar
forums-d96bb3a86e4a78ec4f1753f87d9dd0411f8da896.tar.gz
forums-d96bb3a86e4a78ec4f1753f87d9dd0411f8da896.tar.bz2
forums-d96bb3a86e4a78ec4f1753f87d9dd0411f8da896.tar.xz
forums-d96bb3a86e4a78ec4f1753f87d9dd0411f8da896.zip
A few more changes ... nearly there ... deleting users is going to be a little troublesome
git-svn-id: file:///svn/phpbb/trunk@4430 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/admin_groups.php416
-rw-r--r--phpBB/includes/functions.php15
-rw-r--r--phpBB/includes/functions_admin.php2
-rw-r--r--phpBB/language/en/lang_admin.php62
4 files changed, 293 insertions, 202 deletions
diff --git a/phpBB/adm/admin_groups.php b/phpBB/adm/admin_groups.php
index 4bae471635..ea8016d434 100644
--- a/phpBB/adm/admin_groups.php
+++ b/phpBB/adm/admin_groups.php
@@ -1,23 +1,16 @@
<?php
-/***************************************************************************
- * admin_groups.php
- * -------------------
- * begin : Saturday, Feb 13, 2001
- * copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
- *
- * $Id$
- *
- ***************************************************************************/
-
-/***************************************************************************
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- ***************************************************************************/
+// -------------------------------------------------------------
+//
+// $Id$
+//
+// FILENAME : admin_groups.php
+// STARTED : Sat Feb 13, 2001
+// COPYRIGHT : © 2001,2003 phpBB Group
+// WWW : http://www.phpbb.com/
+// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
+//
+// -------------------------------------------------------------
+
if (!empty($setmodules))
{
@@ -55,10 +48,6 @@ if (isset($_POST['addgroup']))
{
$action = 'addgroup';
}
-else if (isset($_POST['delete']))
-{
- $action = 'delete';
-}
else if (isset($_POST['addleaders']) || isset($_POST['addusers']))
{
$action = (isset($_POST['addleaders'])) ? 'addleaders' : 'addusers';
@@ -70,7 +59,6 @@ else
$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;
@@ -101,115 +89,192 @@ switch ($mode)
// Which page?
switch ($action)
{
+ case 'delete':
+ if (!$group_id)
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
+ break;
+
+ case 'approve':
+ if (!$group_id)
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
+
+ if (!empty($_POST['mark']))
+ {
+ $id_ary = array_map('intval', $_POST['mark']);
+
+ $sql = 'UPDATE ' . USER_GROUP_TABLE . '
+ SET user_pending = 1
+ WHERE user_id IN (' . implode(', ', $id_ary) . ")
+ AND group_id = $group_id";
+ $db->sql_query($sql);
+
+ $sql = 'SELECT username
+ FROM ' . USERS_TABLE . '
+ WHERE user_id IN (' . implode(', ', $id_ary) . ')';
+ $result = $db->sql_query($sql);
+
+ $usernames = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $usernames[] = $row['username'];
+ }
+ $db->sql_freeresult($result);
+
+ add_log('admin', 'LOG_GROUP_APPROVE', $group_name, implode(', ', $usernames));
+ unset($usernames);
+
+ trigger_error($user->lang['USERS_APPROVED']);
+ }
+ break;
+
+ case 'default':
+ if (!$group_id)
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
+
+ $id_ary = (!empty($_POST['mark'])) ? array_map('intval', $_POST['mark']) : false;
+
+ switch (SQL_LAYER)
+ {
+ case 'mysql':
+ case 'mysql4':
+ $start = 0;
+ do
+ {
+ $sql = 'SELECT user_id
+ FROM ' . USER_GROUP_TABLE . "
+ WHERE group_id = $group_id
+ ORDER BY user_id
+ LIMIT $start, 200";
+ $result = $db->sql_query($sql);
+
+ $user_id_ary = array();
+ if ($row = $db->sql_fetchrow($result))
+ {
+ do
+ {
+ $user_id_ary[] = $row['user_id'];
+ }
+ while ($row = $db->sql_fetchrow($result));
+
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET group_id = $group_id, user_colour = '$group_colour', user_rank = $group_rank
+ WHERE user_id IN (" . implode(', ', $user_id_ary) . ')';
+ $db->sql_query($sql);
+
+ $start = (sizeof($user_id_ary) < 200) ? 0 : $start + 200;
+ }
+ else
+ {
+ $start = 0;
+ }
+ $db->sql_freeresult($result);
+ }
+ while ($start);
+ break;
+
+ default:
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET group_id = $group_id, user_colour = '$group_color', user_rank = $group_rank
+ WHERE user_id IN (
+ SELECT user_id
+ FROM " . USER_GROUP_TABLE . "
+ WHERE group_id = $group_id
+ )";
+ $db->sql_query($sql);
+ break;
+ }
+
+ add_log('admin', 'LOG_GROUP_DEFAULTS', $group_name);
+
+ trigger_error($user->lang['GROUP_DEFS_UPDATED']);
+ break;
+
case 'edit':
case 'addgroup':
+ if ($action == 'edit' && !$group_id)
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
// Did we submit?
if ($update)
{
if ($group_type != GROUP_SPECIAL)
{
- $group_name = (!empty($_POST['group_name'])) ? htmlspecialchars($_POST['group_name']) : '';
+ $group_name = (!empty($_POST['group_name'])) ? stripslashes(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']) : '';
+ $group_description = (!empty($_POST['group_description'])) ? stripslashes(htmlspecialchars($_POST['group_description'])) : '';
+ $group_colour2 = (!empty($_POST['group_colour'])) ? stripslashes(htmlspecialchars($_POST['group_colour'])) : '';
+ $group_avatar2 = (!empty($_POST['group_avatar'])) ? stripslashes(htmlspecialchars($_POST['group_avatar'])) : '';
+ $group_rank2 = (isset($_POST['group_rank'])) ? intval($_POST['group_rank']) : '';
// Check data
- if ($group_name == '' || strlen($group_name) > 40)
+ if (!strlen($group_name) || strlen($group_name) > 40)
{
- $error .= (($error != '') ? '<br />' : '') . (($group_name == '') ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']);
+ $error[] = (!strlen($group_name)) ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG'];
}
+
if (strlen($group_description) > 255)
{
- $error .= (($error != '') ? '<br />' : '') . $user->lang['GROUP_ERR_DESC_LONG'];
+ $error[] = $user->lang['GROUP_ERR_DESC_LONG'];
}
+
if ($group_type < GROUP_OPEN || $group_type > GROUP_FREE)
{
- $error .= (($error != '') ? '<br />' : '') . $user->lang['GROUP_ERR_TYPE'];
+ $error[] = $user->lang['GROUP_ERR_TYPE'];
}
- /*
+
// Update DB
- if (!$error)
+ if (!sizeof($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";
+ $sql_ary = array(
+ 'group_name' => (string) $group_name,
+ 'group_description' => (string) $group_description,
+ 'group_type' => (int) $group_type,
+ 'group_rank' => (int) $group_rank2,
+ 'group_colour' => (string) $group_colour2,
+ );
+
+ $sql = ($action == 'edit') ? 'UPDATE ' . GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE group_id = $group_id" : 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$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") : '';
-
- // Update group members preferences
- switch (SQL_LAYER)
+ if ($group_id && ($group_colour != $group_colour2 || $group_rank != $group_rank2 || $group_avatar != $group_avatar2))
{
- case 'mysql':
- case 'mysql4':
- // batchwise? 500 at a time or so maybe? try to reduce memory useage
- $more = true;
- $start = 0;
- do
- {
- $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 = '';
- 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);
+ $sql_ary = array(
+ 'user_rank' => (string) $group_rank2,
+ 'user_colour' => (string) $group_colour2,
+ );
- 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);
+ $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE group_id = $group_id";
+ $db->sql_query($sql);
}
- trigger_error($user->lang['GROUP_UPDATED']);
- }*/
- }
+ $log = ($action == 'edit') ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED';
+ add_log('admin', $log, $group_name);
+ $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
+ trigger_error($message);
+ }
+
+ $group_colour = &$group_colour2;
+ $group_rank = &$group_rank2;
+ $group_avatar = &$group_avatar2;
+ }
+ else if (!$group_id)
+ {
+ $group_name = (!empty($_POST['group_name'])) ? stripslashes(htmlspecialchars($_POST['group_name'])) : '';
+ $group_description = $group_colour = $group_avatar = '';
+ $group_type = GROUP_FREE;
+ }
?>
@@ -237,10 +302,10 @@ switch ($mode)
}
$db->sql_freeresult($result);
+ $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"' : '';
?>
@@ -256,7 +321,7 @@ function swatch()
//-->
</script>
-<form name="settings" method="post" action="admin_groups.<?php echo "$phpEx$SID&amp;action=$action&amp;g=$group_id"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
+<form name="settings" method="post" action="admin_groups.<?php echo "$phpEx$SID&amp;mode=$mode&amp;action=$action&amp;g=$group_id"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['GROUP_DETAILS']; ?></th>
</tr>
@@ -287,7 +352,7 @@ function swatch()
else
{
-?><b><?php echo (!empty($user->lang['G_' . $group_name])) ? $user->lang['G_' . $group_name] : $group_name; ?></b><?php
+?><b><?php echo ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name; ?></b><?php
}
@@ -316,8 +381,8 @@ function swatch()
<th colspan="2"><?php echo $user->lang['GROUP_SETTINGS_SAVE']; ?></th>
</tr>
<tr>
- <td class="row2"><b><?php echo $user->lang['GROUP_COLOR']; ?>:</b><br /><span class="gensmall"><?php echo sprintf($user->lang['GROUP_COLOR_EXPLAIN'], '<a href="swatch.' . $phpEx . '" onclick="swatch();return false" target="_swatch">', '</a>'); ?></span></td>
- <td class="row1" nowrap="nowrap"><input class="post" type="text" name="group_colour" value="<?php echo (!empty($group_colour)) ? $group_colour : ''; ?>" size="6" maxlength="6" /></td>
+ <td class="row2"><b><?php echo $user->lang['GROUP_COLOR']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['GROUP_COLOR_EXPLAIN']; ?></span></td>
+ <td class="row1" nowrap="nowrap"><input class="post" type="text" name="group_colour" value="<?php echo (!empty($group_colour)) ? $group_colour : ''; ?>" size="6" maxlength="6" /> &nbsp; [ <a href="<?php echo "swatch.$phpEx"; ?>" onclick="swatch();return false" target="_swatch"><?php echo $user->lang['COLOUR_SWATCH']; ?></a> ]</td>
</tr>
<tr>
<td class="row2"><b><?php echo $user->lang['GROUP_RANK']; ?>:</b></td>
@@ -328,7 +393,7 @@ function swatch()
<td class="row1">&nbsp;</td>
</tr -->
<tr>
- <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> &nbsp; <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
+ <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['SUBMIT']; ?>" /> &nbsp; <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td>
</tr>
</table></form>
<?php
@@ -338,8 +403,10 @@ function swatch()
case 'addleaders':
case 'addusers':
- // TODO :
- // Need to add users to user_group table when adding as moderator (if applicable)
+ if (!$group_id)
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
$username_ary = (!empty($_POST['usernames'])) ? array_unique(explode("\n", $_POST['usernames'])) : '';
if (!$username_ary)
@@ -358,7 +425,7 @@ function swatch()
unset($username_ary);
// Grab the user ids
- $sql = 'SELECT user_id
+ $sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . '
WHERE username IN (' . implode(', ', $sql_where) . ')';
$result = $db->sql_query($sql);
@@ -368,9 +435,10 @@ function swatch()
trigger_error($user->lang['NO_USERS']);
}
- $id_ary = array();
+ $id_ary = $username_ary = array();
do
{
+ $username_ary[$row['user_id']] = $row['username'];
$id_ary[] = $row['user_id'];
}
while ($row = $db->sql_fetchrow($result));
@@ -446,6 +514,7 @@ function swatch()
$db->sql_query($sql);
}
+ $usernames = array();
if (sizeof($update_id_ary))
{
$sql = 'UPDATE ' . USER_GROUP_TABLE . '
@@ -453,32 +522,49 @@ function swatch()
WHERE user_id IN (' . implode(', ', $update_id_ary) . ")
AND group_id = $group_id";
$db->sql_query($sql);
- }
+ foreach ($update_id_ary as $id)
+ {
+ $usernames[] = $username_ary[$id];
+ }
+ }
+ else
+ {
+ foreach ($add_id_ary as $id)
+ {
+ $usernames[] = $username_ary[$id];
+ }
+ }
+ unset($username_ary);
// Update user settings (color, rank) if applicable
+ // TODO
+ // Do not update users who are not approved
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) . ")";
+ WHERE user_id IN (" . implode(', ', array_merge($add_id_ary, $update_id_ary)) . ")";
$db->sql_query($sql);
}
+ unset($update_id_ary);
+ unset($add_id_ary);
-// add_log();
+ $log = ($mode == 'addleaders') ? 'LOG_MODS_ADDED' : 'LOG_USERS_ADDED';
+ add_log('admin', $log, $group_name, implode(', ', $usernames));
$message = ($mode == 'addleaders') ? 'GROUP_MODS_ADDED' : 'GROUP_USERS_ADDED';
trigger_error($user->lang[$message]);
-
-
-
- break;
-
+ break;
// Show list of leaders, existing and pending members
case 'list':
+ if (!$group_id)
+ {
+ trigger_error($user->lang['NO_GROUP']);
+ }
?>
@@ -565,11 +651,11 @@ function swatch()
?>
<tr>
- <td class="<?php echo $row_class; ?>"><a href="../ucp.<?php echo "$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id']; ?>" target="_profile"><?php echo $row['username']; ?></a></td>
+ <td class="<?php echo $row_class; ?>"><a href="<?php echo "admin_users.$phpEx$SID&amp;mode=edit&amp;u=" . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo ($row['group_id'] == $group_id) ? $user->lang['YES'] : $user->lang['NO']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['user_posts']; ?></td>
- <td class="<?php echo $row_class; ?>" align="center"><input type="checkbox" name="mark[<?php echo $row['user_id']; ?>]" /></td>
+ <td class="<?php echo $row_class; ?>" align="center"><input class="checkbox" type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" /></td>
</tr>
<?php
@@ -589,12 +675,7 @@ function swatch()
?>
<tr>
- <td class="cat" colspan="5"><table width="100%" cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td><input class="btnlite" type="submit" name="displayadd" value="<?php echo $user->lang['ADD_USERS']; ?>" onclick="showbox('addleaders');return false" /></td>
- <td align="right"><input class="btnlite" type="submit" name="delete" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> </td>
- </tr>
- </table></td>
+ <td class="cat" colspan="5" align="right">Select option: <select name="action"><option value="approve">Approve</option><option value="default">Default</option><option value="delete">Delete</option></select> &nbsp; <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['UPDATE_MARKED']; ?>" /> &nbsp; <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['UPDATE_ALL']; ?>" />&nbsp;</td>
</tr>
</table>
@@ -607,7 +688,7 @@ function swatch()
<br clear="all" />
-<div style="display: none;" id="addleaders"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
+<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['ADD_USERS']; ?></th>
</tr>
@@ -622,7 +703,7 @@ function swatch()
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="addleaders" value="<?php echo $user->lang['SUBMIT']; ?>" /> &nbsp; <input class="btnlite" type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&amp;mode=searchuser&amp;form=mod&amp;field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /></td>
</tr>
-</table></div>
+</table>
</form>
@@ -681,11 +762,11 @@ function swatch()
?>
<tr>
- <td class="<?php echo $row_class; ?>"><a href="../ucp.<?php echo "$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id']; ?>" target="_profile"><?php echo $row['username']; ?></a></td>
+ <td class="<?php echo $row_class; ?>"><a href="<?php echo "admin_users.$phpEx$SID&amp;mode=edit&amp;u=" . $row['user_id']; ?>"><?php echo $row['username']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo ($row['group_id'] == $group_id) ? $user->lang['YES'] : $user->lang['NO']; ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $user->format_date($row['user_regdate'], $user->lang['DATE_FORMAT']); ?></td>
<td class="<?php echo $row_class; ?>" align="center"><?php echo $row['user_posts']; ?></td>
- <td class="<?php echo $row_class; ?>" align="center"><input type="checkbox" name="mark[<?php echo $row['user_id']; ?>]" /></td>
+ <td class="<?php echo $row_class; ?>" align="center"><input class="checkbox" type="checkbox" name="mark[]" value="<?php echo $row['user_id']; ?>" /></td>
</tr>
<?php
@@ -704,12 +785,7 @@ function swatch()
?>
<tr>
- <td class="cat" colspan="5"><table width="100%" cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td><input class="btnlite" type="submit" name="displayadd" value="<?php echo $user->lang['ADD_USERS']; ?>" onclick="showbox('addusers');return false" /></td>
- <td align="right"><select name="action"><option value="approve">Approve Marked</option><option value="default">Make Default Marked</option><option value="delete">Delete Marked</option></select> <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['UPDATE']; ?>" />&nbsp;<!--input class="btnlite" type="submit" name="approve" value="Approve Marked" /> &nbsp; <input class="btnlite" type="submit" name="delete" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /--> </td>
- </tr>
- </table></td>
+ <td class="cat" colspan="5" align="right">Select option: <select name="action"><option value="approve">Approve</option><option value="default">Default</option><option value="delete">Delete</option></select> &nbsp; <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['UPDATE_MARKED']; ?>" /> &nbsp; <input class="btnmain" type="submit" name="update" value="<?php echo $user->lang['UPDATE_ALL']; ?>" />&nbsp;</td>
</tr>
</table>
@@ -722,22 +798,22 @@ function swatch()
<br clear="all" />
-<div style="display: none;" id="addusers"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
+<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th colspan="2"><?php echo $user->lang['ADD_USERS']; ?></th>
</tr>
<tr>
- <td class="row1" width="40%"><b><?php echo $user->lang['USER_GETS_GROUP_SET']; ?>:</b> <br /><span class="gensmall"><?php echo $user->lang['USER_GETS_GROUP_SET_EXPLAIN']; ?></span></td>
+ <td class="row1"><b><?php echo $user->lang['USER_GETS_GROUP_SET']; ?>:</b> <br /><span class="gensmall"><?php echo $user->lang['USER_GETS_GROUP_SET_EXPLAIN']; ?></span></td>
<td class="row2"><input type="radio" name="default" value="1" /> <?php echo $user->lang['YES']; ?> &nbsp; <input type="radio" name="default" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
- <td class="row1" width="40%"><b><?php echo $user->lang['USERNAME']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['USERNAMES_EXPLAIN']; ?></span></td>
+ <td class="row1"><b><?php echo $user->lang['USERNAME']; ?>:</b><br /><span class="gensmall"><?php echo $user->lang['USERNAMES_EXPLAIN']; ?></span></td>
<td class="row2"><textarea name="usernames" cols="40" rows="5"></textarea></td>
</tr>
<tr>
<td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="addusers" value="<?php echo $user->lang['SUBMIT']; ?>" /> &nbsp; <input class="btnlite" type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&amp;mode=searchuser&amp;form=mod&amp;field=usernames', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /></td>
</tr>
-</table></div>
+</table>
</form>
@@ -767,24 +843,36 @@ function swatch()
<?php
$sql = 'SELECT g.group_id, g.group_name, g.group_type, COUNT(ug.user_id) AS total_members
- FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
- WHERE ug.group_id = g.group_id
- GROUP BY ug.group_id
+ FROM (' . GROUPS_TABLE . ' g
+ LEFT JOIN ' . USER_GROUP_TABLE . ' ug USING (group_id))
+ GROUP BY g.group_id
ORDER BY g.group_type ASC, g.group_name';
$result = $db->sql_query($sql);
- $special_toggle = false;
+ $special = $normal = 0;
+ $group_ary = array();
while ($row = $db->sql_fetchrow($result) )
{
- $row_class = ($row_class != 'row1') ? 'row1' : 'row2';
+ $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : 'normal';
- if ($row['group_type'] == GROUP_SPECIAL && !$special_toggle)
+ $group_ary[$type][$$type]['group_id'] = $row['group_id'];
+ $group_ary[$type][$$type]['group_name'] = $row['group_name'];
+ $group_ary[$type][$$type]['group_type'] = $row['group_type'];
+ $group_ary[$type][$$type]['total_members'] = $row['total_members'];
+
+ $$type++;
+ }
+ $db->sql_freeresult($result);
+
+ $special_toggle = false;
+ foreach ($group_ary as $type => $row_ary)
+ {
+ if ($type == 'special')
{
- $special_toggle = true;
?>
<tr>
- <td class="cat" colspan="5" align="right">Create new group: <input class="post" type="text" name="group_name" maxlength="30" /> <input class="btnmain" type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
+ <td class="cat" colspan="5" align="right">Create new group: <input class="post" type="text" name="group_name" maxlength="30" /> <input class="btnmain" type="submit" name="addgroup" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
</tr>
</table>
@@ -802,8 +890,12 @@ function swatch()
}
- $group_id = $row['group_id'];
- $group_name = (!empty($user->lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name'];
+ foreach ($row_ary as $row)
+ {
+ $row_class = ($row_class != 'row1') ? 'row1' : 'row2';
+
+ $group_id = $row['group_id'];
+ $group_name = (!empty($user->lang['G_' . $row['group_name']]))? $user->lang['G_' . $row['group_name']] : $row['group_name'];
?>
<tr>
@@ -813,30 +905,14 @@ function swatch()
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap">&nbsp;<a href="<?php echo "admin_groups.$phpEx$SID&amp;mode=$mode&amp;action=edit&amp;g=$group_id"; ?>"><?php echo $user->lang['EDIT']; ?></a>&nbsp;</td>
<td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap">&nbsp;<?php
- echo (!$special_toggle) ? "<a href=\"admin_groups.$phpEx$SID&amp;mode=$mode&amp;&amp;action=delete&amp;g=$group_id\">" . $user->lang['DELETE'] . '</a>' : $user->lang['DELETE'];
-
+ echo ($row['group_type'] != GROUP_SPECIAL) ? "<a href=\"admin_groups.$phpEx$SID&amp;mode=$mode&amp;&amp;action=delete&amp;g=$group_id\">" . $user->lang['DELETE'] . '</a>' : $user->lang['DELETE'];
?>&nbsp;</td>
</tr>
<?php
- if (is_array($pending[$group_id]) )
- {
- foreach ($pending[$group_id] as $pending_ary )
- {
- $row_class = ($row_class != 'row1') ? 'row1' : 'row2';
-
-?>
- <tr>
- <td class="<?php echo $row_class; ?>"><?php echo $pending_ary['username'];?></td>
- <td class="<?php echo $row_class; ?>" align="center"><input class="btnlite" type="submit" name="approve[<?php echo $pending_ary['user_id']; ?>]" value="<?php echo $user->lang['Approve_selected'];?>" /> &nbsp; <input class="btnlite" type="submit" name="decline[<?php echo $pending_ary['user_id']; ?>]" value="<?php echo $user->lang['Deny_selected'];?>" /></td>
- </tr>
-<?php
-
- }
}
}
- $db->sql_freeresult($result);
?>
<tr>
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 3f9709ba42..57282981ba 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -650,13 +650,13 @@ function markread($mode, $forum_id = 0, $topic_id = 0, $marktime = false)
// Pagination routine, generates page number sequence
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
{
- global $user;
+ global $template, $user;
$total_pages = ceil($num_items/$per_page);
if ($total_pages == 1 || !$num_items)
{
- return '';
+ return false;
}
$on_page = floor($start_item / $per_page) + 1;
@@ -697,16 +697,23 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$page_string .= ($on_page == $total_pages) ? '<b>' . $total_pages . '</b>' : '<a href="' . $base_url . '&amp;start=' . (($total_pages - 1) * $per_page) . '">' . $total_pages . '</a>&nbsp;&nbsp;<a href="' . $base_url . "&amp;start=" . ($on_page * $per_page) . '">' . $user->lang['NEXT'] . '</a>';
+// $page_string = '<a href="javascript:goto();">' . $user->lang['GOTO_PAGE'] . '</a> ' . $page_string;
$page_string = $user->lang['GOTO_PAGE'] . ' ' . $page_string;
+// $template->assign_var('BASE_URL', $base_url);
+
return $page_string;
}
function on_page($num_items, $per_page, $start)
{
- global $user;
+ global $template, $user;
+
+ $on_page = floor($start / $per_page) + 1;
+
+// $template->assign_var('ON_PAGE', $on_page);
- return sprintf($user->lang['PAGE_OF'], floor($start / $per_page) + 1, max(ceil($num_items / $per_page), 1));
+ return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1));
}
// Obtain list of naughty words and build preg style replacement arrays for use by the
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index c1d329f60b..503ede56ca 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -172,7 +172,7 @@ function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png')
$dir = ($dir && substr($dir, -1) != '/') ? $dir . '/' : $dir;
$dh = opendir($rootdir . $dir);
- while ($fname = readdir($dh))
+ while (($fname = readdir($dh)) !== false)
{
if (is_file("$rootdir$dir$fname"))
{
diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php
index 5a77a7553b..061881bc74 100644
--- a/phpBB/language/en/lang_admin.php
+++ b/phpBB/language/en/lang_admin.php
@@ -86,6 +86,9 @@ $lang += array(
'CONFIG_UPDATED' => 'Configuration updated successfully',
'DOWNLOAD_STORE' => 'Download or Store file',
'DOWNLOAD_STORE_EXPLAIN'=> 'You may directly download the file or save it in your store/ folder.',
+ 'COLOUR_SWATCH' => 'Web-safe colour swatch',
+ 'UPDATE_MARKED' => 'Update Marked',
+ 'UPDATE_ALL' => 'Update All',
'log_index_activate' => '<b>Activated inactive users</b><br />&#187; %s users',
'log_index_delete' => '<b>Deleted inactive users</b><br />&#187; %s',
@@ -170,6 +173,13 @@ $lang += array(
'LOG_FORUM_DEL_POSTS_FORUMS'=> '<b>Deleted forum, its messages and subforums</b><br />&#187; %s',
'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => '<b>Deleted forum, moved posts</b> to %s <b>and subforums</b> to %s<br />&#187; %s',
+ 'LOG_GROUP_UPDATED' => '<b>Usergroup details updated</b><br />&#187; %s',
+ 'LOG_GROUP_CREATED' => '<b>New usergroup created</b><br />&#187; %s',
+ 'LOG_MODS_ADDED' => '<b>Added new leaders to usergroup</b> %s<br />&#187; %s',
+ 'LOG_USERS_ADDED' => '<b>Added new leaders to usergroup</b> %s<br />&#187; %s',
+ 'LOG_GROUP_DEFAULTS' => '<b>Group made default for members</b><br />&#187; %s',
+ 'LOG_USERS_APPROVED' => '<b>Users approved in usergroup</b> %s<br />&#187; %s',
+
'LOG_ADD_STYLE' => '<b>Added new style</b><br />&#187; %s',
'LOG_EDIT_STYLE' => '<b>Edited style</b><br />&#187; %s',
'LOG_EXPORT_STYLE' => '<b>Exported style</b><br />&#187; %s',
@@ -864,30 +874,38 @@ $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.',
+ 'USER_DEF_GROUPS_EXPLAIN' => 'These are groups created by you or another admin on this board. You can manage memberships as well as edit group properties or even delete the group. By clicking "Default" you can set the relevant group to the default for all its members.',
'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.',
+ 'SPECIAL_GROUPS_EXPLAIN' => 'These are pre-defined groups, they cannot be deleted or directly modified. However you can still add users and alter basic settings. By clicking "Default" you can set the relevant group to the default for all its members.',
'TOTAL_MEMBERS' => 'Members',
+ 'GROUP_DEFS_UPDATED' => 'Default group set for all 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_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_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_MODERATORS' => 'Group Leaders',
'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',
+ 'GROUPS_NO_MEMBERS' => 'This group has no members',
+ 'GROUPS_NO_MODS' => 'No group leaders defined',
+ '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',
+ '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_USERS_APPROVED' => 'Users approved successfully.',
- '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_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_DETAILS' => 'Group details',
+ 'GROUP_NAME' => 'Group name',
+ 'GROUP_DESC' => 'Group description',
'GROUP_TYPE' => 'Group type',
'GROUP_TYPE_EXPLAIN' => 'This determines which users can join or view this group.',
'GROUP_OPEN' => 'Open',
@@ -895,30 +913,21 @@ $lang += array(
'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.',
+ 'GROUP_COLOR_EXPLAIN' => 'Defines the colour members usernames will appear in, leave blank for user default.',
'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_CREATED' => 'Group has been created successfully',
+ 'GROUP_SETTINGS_SAVE' => 'Groupwide 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_LANG' => 'Group language',
- 'GROUP_TIMEZONE' => 'Group timezone',
- 'GROUP_DST' => 'Group daylight savings',
+ 'GROUP_LANG' => 'Group language',
+ 'GROUP_TIMEZONE' => 'Group timezone',
+ 'GROUP_DST' => 'Group daylight savings',
'GROUP_ERR_USERNAME' => 'No group name specified.',
@@ -1207,7 +1216,6 @@ $lang += array(
'REPEAT_Y' => 'Only vertically',
'REPEAT_ALL' => 'Both directions',
'FOREGROUND' => 'Foreground',
- 'COLOUR_SWATCH' => 'Web-safe colour swatch',
'COLOUR_EXPLAIN' => 'This is a hex-triplet of the form #RRGGBB or colour name',
'FONT_COLOUR' => 'Font colour',
'FONT_FACE' => 'Font face',