aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/admin/admin_groups.php217
-rwxr-xr-xphpBB/language/lang_english.php20
-rw-r--r--phpBB/templates/PSO/admin/group_edit_body.tpl43
-rw-r--r--phpBB/templates/PSO/admin/group_select_body.tpl6
4 files changed, 243 insertions, 43 deletions
diff --git a/phpBB/admin/admin_groups.php b/phpBB/admin/admin_groups.php
index 3f7728a2e3..9204f00443 100644
--- a/phpBB/admin/admin_groups.php
+++ b/phpBB/admin/admin_groups.php
@@ -54,83 +54,220 @@ else if( $userdata['user_level'] != ADMIN )
message_die(GENERAL_MESSAGE, $lang['Not_admin']);
}
-if( isset($mode) )
+if( (isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode'])) && empty($HTTP_POST_VARS['updategroup']))
{
//
// Ok they are editing a group or creating a new group
//
+ include("page_header_admin." . $phpEx);
+ if ( $HTTP_POST_VARS['mode'] == "editgroup" )
+ {
+ //
+ // They're editing. Grab the vars.
+ //
+ $sql = "SELECT *
+ FROM " . GROUPS_TABLE . "
+ WHERE group_single_user <> " . TRUE . "
+ AND group_id = " . $g;
+ 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);
+ }
+ else if ( $HTTP_GET_VARS['mode'] == "newgroup" )
+ {
+ $group_info = array (
+ "group_name" => "",
+ "group_description" => "",
+ "group_moderator" => "",
+ "group_type" => "1"
+ );
+ $group_open = "checked=\"checked\"";
+ }
+ //
+ // Ok, now we know everything about them, let's show the page.
+ //
+ $sql = "SELECT user_id, username
+ FROM " . USERS_TABLE . "
+ WHERE user_id <> " . ANONYMOUS . "
+ ORDER BY username";
+ $u_result = $db->sql_query($sql);
+ $user_list = $db->sql_fetchrowset($u_result);
-
+ $select_list = "<select name=\"group_moderator\">";
+ for($i = 0; $i < count($user_list); $i++)
+ {
+ if( $user_list[$i]['user_id'] == $group_info['group_moderator'] )
+ {
+ $select_list .= "<option selected value=\"" . $user_list[$i]['user_id'] . "\">" . $user_list[$i]['username'] . "</option>";
+ }
+ else
+ {
+ $select_list .= "<option value=\"" . $user_list[$i]['user_id'] . "\">" . $user_list[$i]['username'] . "</option>";
+ }
+ }
+ $select_list .= "</select>";
+ $template->set_filenames(array(
+ "body" => "admin/group_edit_body.tpl")
+ );
+ if( !empty($group_info['group_type']) )
+ {
+ $group_open = "checked=\"checked\"";
+ }
+ else
+ {
+ $group_closed = "checked=\"checked\"";
+ }
+ $template->assign_vars(array(
+ "L_GROUP_INFO" => $lang['Group_edit_explain'],
+ "L_GROUP_NAME" => $lang['group_name'],
+ "L_GROUP_DESCRIPTION" => $lang['group_description'],
+ "L_GROUP_MODERATOR" => $lang['group_moderator'],
+ "L_GROUP_STATUS" => $lang['group_status'],
+ "L_GROUP_OPEN" => $lang['group_open'],
+ "L_GROUP_CLOSED" => $lang['group_closed'],
+ "L_GROUP_DELETE" => $lang['group_delete'],
+ "L_GROUP_DELETE_CHECK" => $lang['group_delete_check'],
+ "L_SUBMIT" => $lang['submit_group_changes'],
+ "L_RESET" => $lang['reset_group_changes'],
+
+ "S_GROUP_NAME" => $group_info['group_name'],
+ "S_GROUP_DESCRIPTION" => $group_info['group_description'],
+ "S_GROUP_MODERATOR" => $select_list,
+ "S_GROUP_OPEN_CHECKED" => $group_open,
+ "S_GROUP_CLOSED_CHECKED" => $group_closed,
+ "S_GROUP_ACTION" => append_sid("admin_groups.$phpEx"),
+ "S_GROUP_MODE" => $mode,
+ "GROUP_ID" => $g)
+ );
+ $template->pparse('body');
}
-else if( isset($updategroup) )
+else if( $HTTP_POST_VARS['updategroup'] == "update" )
{
//
// Ok, they are submitting a group, let's save the data based on if it's new or editing
//
- switch($mode)
+ if( isset($deletegroup) )
{
- case 'update':
-
- break;
-
- case 'new':
-
- break;
-
- case 'delete':
+ $sql = "DELETE FROM " . GROUPS_TABLE . "
+ WHERE group_id = " . $group_id;
+ }
+ else
+ {
+ switch($mode)
+ {
+ case 'editgroup':
+ $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 . "'";
+ break;
- break;
+ case 'newgroup':
+ $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'
+ )";
- case 'default':
- message_die(GENERAL_ERROR, $lang['Group_mode_not_selected']);
- break;
+ break;
+
+ case 'default':
+ message_die(GENERAL_ERROR, $lang['Group_mode_not_selected']);
+ break;
+ }
+ }
+ if ( !$result = $db->sql_query($sql) )
+ {
+ $error = TRUE;
+ }
+ if ( $mode == "newgroup" )
+ {
+ $sql = "SELECT * FROM " . GROUPS_TABLE . "
+ WHERE group_name = '" . $group_name . "'";
+ if ( !$result = $db->sql_query($sql) )
+ {
+ $error = TRUE;
+ }
+ $group_info = $db->sql_fetchrow($result);
+ $sql = "INSERT INTO " . USER_GROUP_TABLE . "
+ (
+ group_id,
+ user_id,
+ user_pending
+ )
+ VALUES
+ (
+ '" . $group_info['group_id'] . "',
+ '" . $group_info['group_moderator'] . "',
+ '0'
+ )";
+ if ( !$result = $db->sql_query($sql) )
+ {
+ $error = TRUE;
+ }
+ }
+ if ( isset($error) )
+ {
+ message_die(GENERAL_ERROR, $lang['Error_updating_groups'], __LINE__, __FILE__, $sql);
+ }
+ else
+ {
+ message_die(GENERALL_MESSAGE, $lang['Success_updating_groups']);
}
}
else
{
- //
- // Default group selection box
- //
- // This should be altered on the final system
- //
-
- $sql = "SELECT group_id, group_name
+ include("page_header_admin." . $phpEx);
+ $sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
WHERE group_single_user <> " . TRUE . "
- ORCER BY group_name";
- 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, "No groups exist.");
- }
-
- $select_list = "<select name=\"group\">";
- for($i = 0; $i < count($user_list); $i++)
+ ORDER BY group_name";
+ $g_result = $db->sql_query($sql);
+ $group_list = $db->sql_fetchrowset($g_result);
+
+ $select_list = "<select name=\"" . POST_GROUPS_URL . "\">";
+ for($i = 0; $i < count($group_list); $i++)
{
$select_list .= "<option value=\"" . $group_list[$i]['group_id'] . "\">" . $group_list[$i]['group_name'] . "</option>";
}
$select_list .= "</select>";
- include('page_header_admin.'.$phpEx);
-
$template->set_filenames(array(
"body" => "admin/group_select_body.tpl")
);
$template->assign_vars(array(
- "L_GROUP_TITLE" => $lang['Group'] . " " . $lang['Administration'],
+ "L_GROUP_TITLE" => $lang['Group'] . " " . $lang['Admin'],
"L_GROUP_EXPLAIN" => $lang['Group_admin_explain'],
"L_GROUP_SELECT" => $lang['Select_a'] . " " . $lang['Group'],
- "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'],
+ "L_LOOK_UP" => $lang['Look_up'] . " " . $lang['Group'],
+ "L_GROUP_NEW" => $lang['New_group'],
"S_GROUP_ACTION" => append_sid("admin_groups.$phpEx"),
"S_GROUP_SELECT" => $select_list)
);
+ $template->pparse('body');
}
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php
index c9cae157b8..3d3ddf631e 100755
--- a/phpBB/language/lang_english.php
+++ b/phpBB/language/lang_english.php
@@ -643,6 +643,7 @@ $lang['12'] = "GMT + 12" . " " . $lang['Hours'];
//
// Index
+$lang['Admin'] = "Administration";
$lang['Not_admin'] = "You are not authorised to administer this board";
$lang['Welcome_phpBB'] = "Welcome to phpBB";
$lang['Admin_intro'] = "Thank you for choosing phpBB as your forum solution. This screen will give you a quick overview of all the various statistics of your board. You can get back to this page by clicking on the <u>Admin Index</u> link in the left pane. To return to the index of your board, click the phpBB logo also in the left pane. The other links on the left hand side of this screen will allow you to control every aspect of your forum experience, each screen will have instructions on how to use the tools.";
@@ -809,6 +810,25 @@ $lang['User_admin_explain'] = "Here you can change your user's information. Do n
$lang['User_delete'] = "Delete this user";
$lang['User_delete_explain'] = "Click here to delete this user. This cannot be undone.";
$lang['User_deleted'] = "User was successfully deleted.";
+
+// Group Management
+$lang['Group_admin_explain'] = "Here you can administer all your groups, including deleting, adding, as well as editing groups. You may choose moderators, toggle open/closed group status, and set the name and description.";
+$lang['Error_updating_groups'] = "There was an error while updating the groups.";
+$lang['Success_updating_groups'] = "The group was updated/added successfully.";
+$lang['Group_mode_not_selected'] = "You did not select a mode. Please go back and try again.";
+$lang['Group_edit_explain'] = "Edit group:";
+$lang['group_name'] = "Group name";
+$lang['group_description'] = "Group description";
+$lang['group_moderator'] = "Group moderator";
+$lang['group_status'] = "Group status";
+$lang['group_open'] = "Open group";
+$lang['group_closed'] = "Closed group";
+$lang['New_group'] = "Click here to create a new group.";
+$lang['group_delete'] = "Delete group";
+$lang['group_delete_check'] = "Click here to delete this group.";
+$lang['submit_group_changes'] = "Submit Changes";
+$lang['reset_group_changes'] = "Reset Changes";
+
//
// End
// -------------------------------------------------
diff --git a/phpBB/templates/PSO/admin/group_edit_body.tpl b/phpBB/templates/PSO/admin/group_edit_body.tpl
new file mode 100644
index 0000000000..5a12a47d24
--- /dev/null
+++ b/phpBB/templates/PSO/admin/group_edit_body.tpl
@@ -0,0 +1,43 @@
+
+<form action="{S_GROUP_ACTION}" method="post"><table width="98%" cellspacing="0" cellpadding="4" border="0" align="center">
+ <tr>
+ <td align="left"><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a></span></td>
+ </tr>
+</table>
+
+<table width="98%" cellpadding="1" cellspacing="0" border="0" align="center">
+ <tr>
+ <td class="tablebg"><table border="0" cellpadding="3" cellspacing="1" width="100%">
+ <tr>
+ <td class="cat" colspan="2"><span class="cattitle"><b>{L_GROUP_INFO}</b></span><br /><span class="gensmall">{L_ITEMS_REQUIRED}</span></td>
+ </tr>
+ <tr>
+ <td class="row1" width="38%"><span class="gen">{L_GROUP_NAME}:</span></td>
+ <td class="row2"><input type="text" name="group_name" size="35" maxlength="40" value="{S_GROUP_NAME}" /></td>
+ </tr>
+ <tr>
+ <td class="row1"><span class="gen">{L_GROUP_DESCRIPTION}:</span></td>
+ <td class="row2"><textarea name="group_description" rows=5 cols=51>{S_GROUP_DESCRIPTION}</textarea></td>
+ </tr>
+ <tr>
+ <td class="row1" width="38%"><span class="gen">{L_GROUP_MODERATOR}:</span></td>
+ <td class="row2">{S_GROUP_MODERATOR}</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>
+ <tr>
+ <td class="row1" width="38%"><span class="gen">{L_GROUP_DELETE}:</span></td>
+ <td class="row2"><input type="checkbox" name="deletegroup" value="1">{L_GROUP_DELETE_CHECK}</td>
+ </tr>
+ <tr>
+ <td class="cat" colspan="2" align="center"><span class="cattitle"><input type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" /></span></td>
+ </tr>
+ </table></td>
+ </tr>
+
+<input type="hidden" name="mode" value="{S_GROUP_MODE}" />
+<input type="hidden" name="updategroup" value="update" />
+<input type="hidden" name="group_id" value="{GROUP_ID}" />
+</table></form> \ No newline at end of file
diff --git a/phpBB/templates/PSO/admin/group_select_body.tpl b/phpBB/templates/PSO/admin/group_select_body.tpl
index 7d09be678b..321bdf624f 100644
--- a/phpBB/templates/PSO/admin/group_select_body.tpl
+++ b/phpBB/templates/PSO/admin/group_select_body.tpl
@@ -7,13 +7,13 @@
<table cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
- <td class="cat" align="center"><span class="cattitle"><b>{L_AUTH_SELECT}</b></span></td>
+ <td class="cat" align="center"><span class="cattitle"><b>{L_GROUP_SELECT}</b></span></td>
</tr>
- <tr><form method="get" action="{S_GROUP_ACTION}"><input type="hidden" mode="editgroup">
+ <tr><form method="post" action="{S_GROUP_ACTION}"><input type="hidden" name="mode" value="editgroup">
<td class="row1" align="center">{S_GROUP_SELECT}&nbsp;&nbsp;<input type="submit" value="{L_LOOK_UP}">&nbsp;</td>
</form></tr>
<tr>
- <td class="row2" align="center"><a href="admin_groups.{phpEx}?mode=newgroup">{L_GROUP_NEW}</a></td>
+ <td class="row2" align="center"><a href="admin_groups.php?mode=newgroup">{L_GROUP_NEW}</a></td>
</tr>
</table>