aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/admin/admin_groups.php47
-rw-r--r--phpBB/language/lang_english/lang_main.php3
-rw-r--r--phpBB/templates/PSO/admin/group_edit_body.tpl6
-rw-r--r--phpBB/templates/subSilver/admin/group_edit_body.tpl8
4 files changed, 58 insertions, 6 deletions
diff --git a/phpBB/admin/admin_groups.php b/phpBB/admin/admin_groups.php
index c9f8653e53..89304ba890 100644
--- a/phpBB/admin/admin_groups.php
+++ b/phpBB/admin/admin_groups.php
@@ -132,6 +132,9 @@ if( isset($HTTP_POST_VARS['edit']) || isset($HTTP_POST_VARS['new']) )
"L_GROUP_DELETE_CHECK" => $lang['group_delete_check'],
"L_SUBMIT" => $lang['submit_group_changes'],
"L_RESET" => $lang['reset_group_changes'],
+ "L_DELETE_MODERATOR" => $lang['delete_group_moderator'],
+ "L_DELETE_MODERATOR_EXPLAIN" => $lang['delete_moderator_explain'],
+ "L_YES" => $lang['Yes'],
"S_SELECT_MODERATORS" => $select_list,
"S_GROUP_OPEN_CHECKED" => $group_open,
@@ -161,10 +164,11 @@ else if( isset($HTTP_POST_VARS['group_update']) )
}
else
{
- $group_type = isset($HTTP_POST_VARS['group_type']) ? $HTTP_POST_VARS['group_type'] : "";
- $group_name = isset($HTTP_POST_VARS['group_name']) ? $HTTP_POST_VARS['group_name'] : "";
- $group_description = isset($HTTP_POST_VARS['group_description']) ? $HTTP_POST_VARS['group_description'] : "";
+ $group_type = isset($HTTP_POST_VARS['group_type']) ? trim(addslashes($HTTP_POST_VARS['group_type'])) : "";
+ $group_name = isset($HTTP_POST_VARS['group_name']) ? trim(addslashes($HTTP_POST_VARS['group_name'])) : "";
+ $group_description = isset($HTTP_POST_VARS['group_description']) ? trim(addslashes($HTTP_POST_VARS['group_description'])) : "";
$group_moderator = isset($HTTP_POST_VARS['group_moderator']) ? intval($HTTP_POST_VARS['group_moderator']) : "";
+ $delete_old_moderator = isset($HTTP_POST_VARS['delete_old_moderator']) ? intval($HTTP_POST_VARS['delete_old_moderator']) : "";
if( $group_name == "" )
{
@@ -181,8 +185,39 @@ else if( isset($HTTP_POST_VARS['group_update']) )
if( $mode == "editgroup" )
{
-
- echo $sql = "UPDATE " . GROUPS_TABLE . "
+ $sql = "SELECT *
+ FROM " . GROUPS_TABLE . "
+ WHERE group_single_user <> " . TRUE . "
+ AND group_id = " . $group_id;
+ if(!$result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Error getting group information", "", __LINE__, __FILE__, $sql);
+ }
+ if( !$db->sql_numrows($result) )
+ {
+ message_die(GENERAL_MESSAGE, "That user group does not exist");
+ }
+ $group_info = $db->sql_fetchrow($result);
+
+ if ( $group_info['group_moderator'] != $group_moderator )
+ {
+ if ( $delete_old_moderator != "" )
+ {
+ $sql = "DELETE FROM " . USER_GROUP_TABLE . "
+ WHERE user_id = " . $group_info['group_moderator'] . " AND group_id = " . $group_id;
+ if ( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't update group moderator", "", __LINE__, __FILE__, $sql);
+ }
+ }
+ $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending)
+ VALUES (" . $group_id . ", " . $group_moderator . ", 0)";
+ if ( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't update group moderator", "", __LINE__, __FILE__, $sql);
+ }
+ }
+ $sql = "UPDATE " . GROUPS_TABLE . "
SET group_type = $group_type, group_name = '" . $group_name . "', group_description = '" . $group_description . "', group_moderator = $group_moderator
WHERE group_id = $group_id";
if ( !$result = $db->sql_query($sql) )
@@ -196,7 +231,7 @@ else if( isset($HTTP_POST_VARS['group_update']) )
{
$sql = "INSERT INTO " . GROUPS_TABLE . " (group_type, group_name, group_description, group_moderator, group_single_user)
- VALUES ($group_type, '" . $group_name . "', '" . $group_description . "', $group_moderator, '0')";
+ VALUES ('" . $group_type . "', '" . $group_name . "', '" . $group_description . "', '" . $group_moderator . "', '0')";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert new group", "", __LINE__, __FILE__, $sql);
diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php
index 77af307244..a3533116dc 100644
--- a/phpBB/language/lang_english/lang_main.php
+++ b/phpBB/language/lang_english/lang_main.php
@@ -1005,6 +1005,9 @@ $lang['reset_group_changes'] = "Reset Changes";
$lang['No_group_name'] = "You must specify a name for this group";
$lang['No_group_moderator'] = "You must specify a moderator for this group";
$lang['No_group_mode'] = "You must specify a mode for this group, open or closed";
+$lang['delete_group_moderator'] = "Delete the old group moderator?";
+$lang['delete_moderator_explain'] = "If you're changing the group moderator, check this box to remove the old moderator from the group. Otherwise, do not check it, and the user will become a regular member of the group.";
+
//
diff --git a/phpBB/templates/PSO/admin/group_edit_body.tpl b/phpBB/templates/PSO/admin/group_edit_body.tpl
index 5a12a47d24..40ad1bf86e 100644
--- a/phpBB/templates/PSO/admin/group_edit_body.tpl
+++ b/phpBB/templates/PSO/admin/group_edit_body.tpl
@@ -24,6 +24,12 @@
<td class="row2">{S_GROUP_MODERATOR}</td>
</tr>
<tr>
+ <td class="row1" width="38%"><span class="gen">{L_DELETE_MODERATOR}:</span>
+ <br />
+ <span class="gensmall">{L_DELETE_MODERATOR_EXPLAIN}</span></td>
+ <td class="row2"><input type="checkbox" name="delete_old_moderator" value="1" />&nbsp;&nbsp;{L_YES}</td>
+ </tr>
+ <tr>
<td class="row1" width="38%"><span class="gen">{L_GROUP_STATUS}:</span></td>
<td class="row2"><input type="radio" name="group_type" value="1" {S_GROUP_OPEN_CHECKED} />{L_GROUP_OPEN} &nbsp;&nbsp;<input type="radio" name="group_type" value="0" {S_GROUP_CLOSED_CHECKED} /> {L_GROUP_CLOSED}</td>
</tr>
diff --git a/phpBB/templates/subSilver/admin/group_edit_body.tpl b/phpBB/templates/subSilver/admin/group_edit_body.tpl
index a6c3476ec7..0f587aec4e 100644
--- a/phpBB/templates/subSilver/admin/group_edit_body.tpl
+++ b/phpBB/templates/subSilver/admin/group_edit_body.tpl
@@ -25,6 +25,14 @@
<td class="row2" width="62%">{S_SELECT_MODERATORS}</td>
</tr>
<tr>
+ <td class="row1" width="38%"><span class="gen">{L_DELETE_MODERATOR}</span>
+ <br />
+ <span class="gensmall">{L_DELETE_MODERATOR_EXPLAIN}</span></td>
+ <td class="row2" width="62%">
+ <input type="checkbox" name="delete_old_moderator" value="1">
+ {L_YES}</td>
+ </tr>
+ <tr>
<td class="row1" width="38%"><span class="gen">{L_GROUP_STATUS}:</span></td>
<td class="row2" width="62%">
<input type="radio" name="group_type" value="1" {S_GROUP_OPEN_CHECKED} />