From 0e9f0ac4ecc636336603cc6932ce21a550c7087e Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Sun, 20 Oct 2002 19:19:07 +0000 Subject: Mostly changes to turn userdata into user->data, lang into user->lang + bitstring 2nd format + inheritance for permission admin and various other updates/fixes/changes ... note that user->lang & user->theme isn't final git-svn-id: file:///svn/phpbb/trunk@2958 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/admin/admin_permissions.php | 238 +++++++++++++++++++++++++------------- 1 file changed, 156 insertions(+), 82 deletions(-) (limited to 'phpBB/admin/admin_permissions.php') diff --git a/phpBB/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php index 82b46bd108..d1bbf440e9 100644 --- a/phpBB/admin/admin_permissions.php +++ b/phpBB/admin/admin_permissions.php @@ -36,9 +36,8 @@ if ( !empty($setmodules) ) } define('IN_PHPBB', 1); -// + // Include files -// $phpbb_root_path = '../'; require($phpbb_root_path . 'extension.inc'); require('pagestart.' . $phpEx); @@ -47,7 +46,7 @@ require($phpbb_root_path . 'includes/functions_admin.'.$phpEx); // Do we have forum admin permissions? if ( !$auth->acl_get('a_auth') ) { - message_die(MESSAGE, $lang['No_admin']); + message_die(MESSAGE, $user->lang['No_admin']); } // Define some vars @@ -71,77 +70,55 @@ else $mode = ''; } -// // Start program proper -// switch ( $mode ) { case 'forums': - $l_title = $lang['Permissions']; - $l_title_explain = $lang['Permissions_explain']; + $l_title = $user->lang['Permissions']; + $l_title_explain = $user->lang['Permissions_explain']; $l_can = '_can'; break; case 'moderators': - $l_title = $lang['Moderators']; - $l_title_explain = $lang['Moderators_explain']; + $l_title = $user->lang['Moderators']; + $l_title_explain = $user->lang['Moderators_explain']; $l_can = '_can'; break; case 'supermoderators': - $l_title = $lang['Super_Moderators']; - $l_title_explain = $lang['Super_Moderators_explain']; + $l_title = $user->lang['Super_Moderators']; + $l_title_explain = $user->lang['Super_Moderators_explain']; $l_can = '_can'; break; case 'administrators': - $l_title = $lang['Administrators']; - $l_title_explain = $lang['Administrators_explain']; + $l_title = $user->lang['Administrators']; + $l_title_explain = $user->lang['Administrators_explain']; $l_can = '_can_admin'; break; } -// -// Brief explanation of how things work when updating ... -// -// Granting someone any admin permissions grants them permissions -// to all other options, e.g. Moderator and Forums across the board. -// This is done via the acl class -// +// Call update or delete, both can take multiple user/group +// ids. Additionally inheritance is handled (by the auth API) if ( isset($_POST['update']) ) { $auth_admin = new auth_admin(); - switch ( $_POST['type'] ) + // Admin wants subforums to inherit permissions ... so handle this + if ( !empty($_POST['inherit']) ) { - case 'user': - $set = 'acl_set_user'; - break; - - case 'group': - $set = 'acl_set_group'; - break; + array_push($_POST['inherit'], $forum_id); + $forum_id = $_POST['inherit']; } foreach ( $_POST['entries'] as $id ) { - $auth_admin->$set($forum_id, $id, $_POST['option']); + $auth_admin->acl_set($_POST['type'], $forum_id, $id, $_POST['option']); } - message_die(MESSAGE, 'Permissions updated successfully'); + trigger_error('Permissions updated successfully'); } else if ( isset($_POST['delete']) ) { $auth_admin = new auth_admin(); - switch ( $_POST['type'] ) - { - case 'user': - $set = 'acl_delete_user'; - break; - - case 'group': - $set = 'acl_delete_group'; - break; - } - $option_ids = false; if ( !empty($_POST['option']) ) { @@ -164,23 +141,21 @@ else if ( isset($_POST['delete']) ) foreach ( $_POST['entries'] as $id ) { - $auth_admin->$set($forum_id, $id, $option_ids); + $auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); } - message_die(MESSAGE, 'Permissions updated successfully'); + trigger_error('Permissions updated successfully'); } -// // Get required information, either all forums if // no id was specified or just the requsted if it // was -// if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' ) { - // +// // Clear some vars, grab some info if relevant ... - // $s_hidden_fields = ''; + if ( !empty($forum_id) ) { $sql = "SELECT forum_name @@ -194,17 +169,13 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators $l_title .= ' : ' . $forum_info['forum_name'] . ''; } - // // Generate header - // page_header($l_title); ?>

-

- sql_fetchrow($result) ) { - $group_list .= ''; + $group_list .= ''; } $db->sql_freeresult($result); @@ -247,10 +218,12 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators ?> +

+ - - + + @@ -275,13 +248,13 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators ?> - + - +

lang['Users']; ?>

lang['Groups']; ?>

lang['Manage_users']; ?>
   
@@ -300,19 +273,19 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators $groups = ''; while ( $row = $db->sql_fetchrow($result) ) { - $groups .= ''; + $groups .= ''; } $db->sql_freeresult($result); ?> - + lang['Manage_groups']; ?> -   +   @@ -321,25 +294,25 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators
"> - + - +
lang['Add_users']; ?>
    &mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />     &mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650');return false;" />
"> - + - +
lang['Add_groups']; ?>
   
@@ -403,7 +376,7 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators $auth = array(); while ( $row = $db->sql_fetchrow($result) ) { - $ug_test = ( !empty($lang[$row['name']]) ) ? $lang[$row['name']] : $row['name']; + $ug_test = ( !empty($user->lang[$row['name']]) ) ? $user->lang[$row['name']] : $row['name']; $ug .= ( !strstr($ug, $ug_test) ) ? $ug_test . "\n" : ''; $ug_test = ''; @@ -415,17 +388,80 @@ if ( !empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators ?> -

+ + +

lang['ACL_explain']; ?>

+ +
"> - - - - - + + + +
          Quick settings:
+ + + + + lang['acl_' . $auth_options[$i]['auth_value']]) ) ? $user->lang['acl_' . $auth_options[$i]['auth_value']] : ucfirst(preg_replace('#.*?_#', '', $auth_options[$i]['auth_value'])); - $permit_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_PERMIT ) ? ' checked="checked"' : ''; $allow_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_ALLOW ) ? ' checked="checked"' : ''; $deny_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_DENY ) ? ' checked="checked"' : ''; - $prevent_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_PREVENT ) ? ' checked="checked"' : ''; + $inherit_type = ( $auth[$auth_options[$i]['auth_value']] == ACL_INHERIT ) ? ' checked="checked"' : ''; ?> - - + - + - + + + + + + + +
 lang['Option']; ?>  lang['Allow']; ?>  lang['Deny']; ?>  lang['Inherit']; ?> 
/> /> /> /> />
lang['Inheritance']; ?>
+ + + + + + + + + + + +
lang['Inheritance_explain']; ?>
lang['Mark_all']; ?> :: lang['Unmark_all']; ?>
  
@@ -484,10 +558,10 @@ else
"> - + - +
lang['Select_a_Forum']; ?>
        
-- cgit v1.2.1