1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-03 23:37:39 +02:00

Hard-coded HTML into admin modules ... no point in continuing to template this stuff since no one (or few) rarely bother to make use of the feature. Lots of changes for permissions, sessions, etc. some new styling stuff present (inc. editing templates though not complete), lots of bugs and non-functioning stuff ... any 'existing' modules will cause the right hand panel to fail ... remove them. If I catch anyone nicking graphics from here I'll kill 'em ...

git-svn-id: file:///svn/phpbb/trunk@2675 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2002-07-14 14:51:03 +00:00
parent 71707ca5db
commit fad21bcb01
19 changed files with 2112 additions and 2189 deletions

View File

@@ -21,14 +21,15 @@
if ( !empty($setmodules) )
{
if ( !$acl->get_acl_admin('forums') )
if ( !$acl->get_acl_admin('auth') )
{
return;
}
$filename = basename(__FILE__);
$module['Forums']['Permissions'] = $filename . $SID . '&mode=forums';
$module['General']['Set_Administrators'] = $filename . $SID . '&mode=admins';
$module['Forums']['Moderators'] = $filename . $SID . '&mode=moderators';
$module['General']['Administrators'] = $filename . $SID . '&mode=administrators';
return;
}
@@ -44,7 +45,7 @@ require('pagestart.' . $phpEx);
//
// Do we have forum admin permissions?
//
if ( !$acl->get_acl_admin('forums') )
if ( !$acl->get_acl_admin('auth') )
{
message_die(MESSAGE, $lang['No_admin']);
}
@@ -55,7 +56,6 @@ if ( !$acl->get_acl_admin('forums') )
if ( isset($HTTP_GET_VARS['f']) || isset($HTTP_POST_VARS['f']) )
{
$forum_id = ( isset($HTTP_POST_VARS['f']) ) ? intval($HTTP_POST_VARS['f']) : intval($HTTP_GET_VARS['f']);
$forum_sql = " WHERE forum_id = $forum_id";
}
else
@@ -64,31 +64,248 @@ else
$forum_sql = '';
}
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
//
// Start program proper
//
switch ( $mode )
{
case 'forums':
$l_title = $lang['Permissions'];
$l_title_explain = $lang['Permissions_explain'];
break;
case 'moderators':
$l_title = $lang['Moderators'];
$l_title_explain = $lang['Moderators_explain'];
break;
case 'administrators':
$l_title = $lang['Administrators'];
$l_title_explain = $lang['Administrators_explain'];
break;
}
//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
if ( !empty($forum_id) )
if ( !empty($forum_id) || $mode == 'administrators' )
{
//
// Output the selection table if no forum id was
// specified
// Clear some vars, grab some info if relevant ...
//
$template->set_filenames(array(
"body" => "admin/auth_select_body.tpl")
);
$select_list = '<select name=f">';
for($i = 0; $i < count($forum_rows); $i++)
$s_hidden_fields = '';
if ( !empty($forum_id) )
{
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
$sql = "SELECT forum_name
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
$result = $db->sql_query($sql);
$forum_info = $db->sql_fetchrow($result);
$l_title .= ' : <i>' . $forum_info['forum_name'] . '</i>';
$s_hidden_fields = '<input type="hidden" name="f" value="' . $forum_id .'" />';
}
$select_list .= '</select>';
//
// Generate header
//
page_header($lang['Forums']);
?>
<h1><?php echo $l_title; ?></h1>
<p><?php echo $l_title_explain; ?></p>
<?php
switch ( $mode )
{
case 'forums':
?>
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>">
<h3><?php echo $lang['Allowed_users']; ?></h3>
<select name="user_allowed"><?php echo $user_allowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<h3><?php echo $lang['Allowed_groups']; ?></h3>
<select name="group_allowed"><?php echo $group_allowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<h3><?php echo $lang['Disallowed_users']; ?></h3>
<select name="user_disallowed"><?php echo $user_disallowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<h3><?php echo $lang['Disallowed_groups']; ?></h3>
<select name="group_disallowed"><?php echo $group_disallowed_options; ?></select>
<p>[ <a href=""><?php echo $lang['Advanced']; ?></a> ]</p>
<?php
break;
case 'moderators':
$sql = "SELECT auth_option
FROM " . ACL_OPTIONS_TABLE . "
WHERE auth_type LIKE 'mod'";
$result = $db->sql_query($sql);
$auth_options = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_options[] = $row;
}
$sql = "SELECT u.user_id, u.username, ao.auth_option
FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " au, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'mod'
AND au.auth_option_id = ao.auth_option_id
AND au.forum_id = $forum_id
AND u.user_id = au.user_id
ORDER BY u.username, u.user_regdate ASC";
$result = $db->sql_query($sql);
$auth_users = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_users[$row['auth_option']] .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
}
$sql = "SELECT g.group_id, g.group_name, ao.auth_option
FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " ag, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'mod'
AND ag.auth_option_id = ao.auth_option_id
AND ag.forum_id = $forum_id
AND g.group_id = ag.group_id
ORDER BY g.group_name ASC";
$result = $db->sql_query($sql);
$auth_groups = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_groups[$row['auth_option']] .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>';
}
?>
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th>Setting</th>
<th>Users</th>
<th>Groups</th>
</tr>
<?php
for($i = 0; $i < sizeof($auth_options); $i++)
{
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
?>
<tr>
<td class="<?php echo $cell_bg; ?>" align="center"><?php echo $auth_options[$i]['auth_option']; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><select name="option[<?php echo $auth_options[$i]['auth_option']; ?>]" multiple="multiple"><?php echo $auth_users[$auth_options[$i]['auth_option']]; ?></select></td>
<td class="<?php echo $cell_bg; ?>" align="center"><select name="option[<?php echo $auth_options[$i]['auth_option']; ?>]" multiple="multiple"><?php echo $auth_groups[$auth_options[$i]['auth_option']]; ?></select></td>
</tr>
<?php
}
?>
</table>
<?php
break;
case 'administrators':
$sql = "SELECT auth_option
FROM " . ACL_OPTIONS_TABLE . "
WHERE auth_type LIKE 'admin'";
$result = $db->sql_query($sql);
$auth_options = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_options[] = $row;
}
$sql = "SELECT u.user_id, u.username, ao.auth_option
FROM " . USERS_TABLE . " u, " . ACL_USERS_TABLE . " au, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'admin'
AND au.auth_option_id = ao.auth_option_id
AND u.user_id = au.user_id
ORDER BY u.username, u.user_regdate ASC";
$result = $db->sql_query($sql);
$auth_users = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_users[$row['auth_option']] .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>';
}
$sql = "SELECT g.group_id, g.group_name, ao.auth_option
FROM " . GROUPS_TABLE . " g, " . ACL_GROUPS_TABLE . " ag, " . ACL_OPTIONS_TABLE . " ao
WHERE ao.auth_type LIKE 'admin'
AND ag.auth_option_id = ao.auth_option_id
AND g.group_id = ag.group_id
ORDER BY g.group_name ASC";
$result = $db->sql_query($sql);
$auth_groups = array();
while ( $row = $db->sql_fetchrow($result) )
{
$auth_groups[$row['auth_option']] .= '<option value="' . $row['group_id'] . '">' . ( ( $row['group_name'] == 'ADMINISTRATORS' ) ? $lang['Admin_group'] : $row['group_name'] ) . '</option>';
}
?>
<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th>Setting</th>
<th>Users</th>
<th>Groups</th>
</tr>
<?php
for($i = 0; $i < sizeof($auth_options); $i++)
{
$cell_bg = ( $cell_bg == 'row1' ) ? 'row2' : 'row1';
$l_can_cell = ( !empty($lang['acl_admin_' . $auth_options[$i]['auth_option']]) ) ? $lang['acl_admin_' . $auth_options[$i]['auth_option']] : $auth_options[$i]['auth_option'];
?>
<tr>
<td class="<?php echo $cell_bg; ?>"><?php echo $l_can_cell; ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php if ( !empty($auth_users[$auth_options[$i]['auth_option']]) ) { ?><select name="user_option[<?php echo $auth_options[$i]['auth_option']; ?>]"><?php echo $auth_users[$auth_options[$i]['auth_option']]; ?></select><?php } else { ?>&nbsp;<?php } ?></td>
<td class="<?php echo $cell_bg; ?>" align="center"><?php if ( !empty($auth_groups[$auth_options[$i]['auth_option']]) ) { ?><select name="group_option[<?php echo $auth_options[$i]['auth_option']; ?>]"><?php echo $auth_groups[$auth_options[$i]['auth_option']]; ?></select><?php } else { ?>&nbsp;<?php } ?></td>
</tr>
<?php
}
?>
</table>
<?php
break;
}
?>
<?php echo $s_hidden_fields; ?></form>
<?php
}
else
{
@@ -108,16 +325,16 @@ else
?>
<h1><?php echo $lang['Permissions']; ?></h1>
<h1><?php echo $l_title; ?></h1>
<p><?php echo $lang['Permissions_explain']; ?></p>
<p><?php echo $l_title_explain ?></p>
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID"; ?>"><table cellspacing="1" cellpadding="4" border="0" align="center" bgcolor="#98AAB1">
<form method="post" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th align="center"><?php echo $lang['Select_a_Forum']; ?></th>
</tr>
<tr>
<td class="row1" align="center">&nbsp;<select name="f"><?php echo $select_list; ?></select>&nbsp;&nbsp;<input type="submit" value="<?php echo $lang['Look_up_Forum']; ?>" class="mainoption" />&nbsp;</td>
<td class="row1" align="center">&nbsp;<select name="f"><?php echo $select_list; ?></select> &nbsp;<input type="submit" value="<?php echo $lang['Look_up_Forum']; ?>" class="mainoption" />&nbsp;</td>
</tr>
</table></form>