mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-18 22:58:10 +01:00
Seems to be working ...
git-svn-id: file:///svn/phpbb/trunk@3832 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
25711806b3
commit
b7eef16074
@ -43,18 +43,18 @@ require('pagestart.' . $phpEx);
|
||||
//
|
||||
// 'mode' determines what we're altering; administrators, users, deps, etc.
|
||||
// 'submit' is used to determine what we're doing ... special format
|
||||
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
||||
$submode= (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : '';
|
||||
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
|
||||
$submode = (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : '';
|
||||
$which_mode = (!empty($submode) && $submode != $mode) ? $submode : $mode;
|
||||
$submit = array_values(preg_grep('#^submit_(.*)$#i', array_keys($_POST)));
|
||||
$submit = (sizeof($submit)) ? substr($submit[0], strpos($submit[0], '_') + 1) : '';
|
||||
$submit = array_values(preg_grep('#^submit_(.*)$#i', array_keys($_POST)));
|
||||
$submit = (sizeof($submit)) ? substr($submit[0], strpos($submit[0], '_') + 1) : '';
|
||||
|
||||
|
||||
// Submitted setting data
|
||||
//
|
||||
// 'auth_settings' contains the submitted option settings assigned to options, should be an
|
||||
// associative array with integer values
|
||||
$auth_settings = (isset($_POST['settings'])) ? $_POST['settings'] : '';
|
||||
$auth_settings = (isset($_POST['settings'])) ? $_POST['settings'] : '';
|
||||
|
||||
|
||||
// Forum, User or Group information
|
||||
@ -76,6 +76,19 @@ if (!isset($forum_id[$which_mode]))
|
||||
}
|
||||
$sql_forum_id = implode(', ', array_map('intval', $forum_id[$which_mode]));
|
||||
|
||||
// Generate list of forum id's
|
||||
$s_forum_id = '';
|
||||
foreach ($forum_id as $forum_submode => $forum_submode_ids)
|
||||
{
|
||||
foreach ($forum_submode_ids as $submode_forum_id)
|
||||
{
|
||||
$s_forum_id .= '<input type="hidden" name="f[' . $forum_submode . '][]" value="' . $submode_forum_id . '" />';
|
||||
}
|
||||
}
|
||||
unset($forum_submode_ids);
|
||||
unset($forum_submode);
|
||||
unset($submode_forum_id);
|
||||
|
||||
|
||||
// Instantiate a new auth admin object in readiness
|
||||
$auth_admin = new auth_admin();
|
||||
@ -179,88 +192,84 @@ switch ($submit)
|
||||
{
|
||||
case 'update':
|
||||
|
||||
print_r($auth_settings);
|
||||
|
||||
// Here we decide which depedencies we are looking for ... if all the submitted
|
||||
// settings are the same we look for a dependency of "All options". This allows
|
||||
// for situations where for example changing permissions for all options to the
|
||||
// same setting (e.g. 'unset' or 'no') could lead to forum view permissions being
|
||||
// changed to 'unset'. When all options do not have the same setting we lookup
|
||||
// dependencies for the given range of options and settings and those where
|
||||
// "Any option" has been specified for the current range of settings
|
||||
|
||||
// No dependencies exist or we've already shown 'em ... so now
|
||||
// we go ahead and update the permission sets
|
||||
echo "DONE";
|
||||
exit;
|
||||
|
||||
// If we are submitting with dependencies first we set the original options
|
||||
if (isset($_POST['skipdeps']))
|
||||
if (sizeof($auth_settings))
|
||||
{
|
||||
foreach ($ug_data as $id)
|
||||
// Admin wants subforums to inherit permissions ... so add these
|
||||
// forums to the list ... since inheritance is only available for
|
||||
// forum and moderator primary modes we deal with '$forum_id[$mode]'
|
||||
if (!empty($_POST['inherit']))
|
||||
{
|
||||
$auth_admin->acl_set($ug_type, $forum_id_deps, $id, $auth_settings_deps);
|
||||
$forum_id[$mode] = array_merge($forum_id[$mode], array_map('intval', $_POST['inherit']));
|
||||
}
|
||||
|
||||
// Update the permission set ... we loop through each auth setting
|
||||
// array
|
||||
foreach ($auth_settings as $auth_submode => $auth_setting)
|
||||
{
|
||||
// Are any entries * ? If so we need to remove them since they
|
||||
// are options the user wishes to ignore
|
||||
if (in_array('*', $auth_setting))
|
||||
{
|
||||
$temp = array();
|
||||
foreach ($auth_setting as $option => $setting)
|
||||
{
|
||||
if ($setting != '*')
|
||||
{
|
||||
$temp[$option] = $setting;
|
||||
}
|
||||
}
|
||||
$auth_setting = $temp;
|
||||
}
|
||||
|
||||
if (sizeof($auth_setting))
|
||||
{
|
||||
foreach ($ug_data as $id)
|
||||
{
|
||||
$auth_admin->acl_set($ug_type, $forum_id[$auth_submode], $id, $auth_setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($auth_settings_deps);
|
||||
unset($forum_id_deps);
|
||||
unset($auth_submode);
|
||||
unset($auth_setting);
|
||||
|
||||
// Admin wants subforums to inherit permissions ... so handle this
|
||||
if (!empty($_POST['inherit']))
|
||||
// Do we need to recache the moderator lists? We do if the mode
|
||||
// was mod or auth_settings['mod'] is a non-zero size array
|
||||
if ($mode == 'mod' || sizeof($auth_settings['mod']))
|
||||
{
|
||||
array_push($_POST['inherit'], $forum_id);
|
||||
$forum_id = $_POST['inherit'];
|
||||
cache_moderators();
|
||||
}
|
||||
|
||||
// This will be either the submitted dependencies or the "original" options
|
||||
// dependending on whether any dependencies existed and were submitted
|
||||
if (empty($_POST['skipdeps']))
|
||||
{
|
||||
foreach ($ug_data as $id)
|
||||
{
|
||||
$auth_admin->acl_set($ug_type, $forum_id, $id, $auth_settings);
|
||||
}
|
||||
}
|
||||
|
||||
cache_moderators();
|
||||
|
||||
trigger_error($user->lang['AUTH_UPDATED']);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
echo "HERE :: DELETE";
|
||||
exit;
|
||||
|
||||
/*
|
||||
$option_ids = false;
|
||||
if (!empty($settings)
|
||||
$sql = "SELECT auth_option_id
|
||||
FROM " . ACL_OPTIONS_TABLE . "
|
||||
WHERE auth_option LIKE '{$sql_option_mode}_%'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$sql = "SELECT auth_option_id
|
||||
FROM " . ACL_OPTIONS_TABLE . "
|
||||
WHERE auth_option LIKE '" . $settings['option'] . "_%'";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
$option_id_ary = array();
|
||||
do
|
||||
{
|
||||
$option_ids = array();
|
||||
do
|
||||
{
|
||||
$option_ids[] = $row['auth_option_id'];
|
||||
}
|
||||
while($row = $db->sql_fetchrow($result));
|
||||
$option_id_ary[] = $row['auth_option_id'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
while($row = $db->sql_fetchrow($result));
|
||||
|
||||
foreach ($_POST['ug_id'] as $id)
|
||||
{
|
||||
$auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids);
|
||||
foreach ($ug_data as $id)
|
||||
{
|
||||
$auth_admin->acl_delete($ug_type, $forum_id[$mode], $id, $option_id_ary);
|
||||
}
|
||||
unset($option_id_ary);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
cache_moderators();
|
||||
|
||||
trigger_error($user->lang['AUTH_UPDATED']);
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'presetsave':
|
||||
@ -344,9 +353,9 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
|
||||
<th align="center"><?php echo $user->lang['LOOK_UP_FORUM']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center"> <select name="f"><?php echo
|
||||
<td class="row1" align="center"> <select name="f[<?php echo $mode; ?>][]"><?php echo
|
||||
|
||||
make_forum_select();
|
||||
make_forum_select(false, false, true);
|
||||
|
||||
?></select> <input type="submit" name="submit_usergroups" value="<?php echo $user->lang['LOOK_UP_FORUM']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="forum" /><input type="hidden" name="action" value="usergroups" /> </td>
|
||||
</tr>
|
||||
@ -361,7 +370,7 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
|
||||
<th align="center"><?php echo $user->lang['LOOK_UP_USER']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center"><input type="text" class="post" name="ug_data" maxlength="30" size="20" /> <input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_USER']; ?>" class="mainoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onClick="window.open('<?php echo "../memberlist.$phpEx$SID&mode=searchuser&field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="username" /></td>
|
||||
<td class="row1" align="center"><input type="text" class="post" name="ug_data[]" maxlength="30" size="20" /> <input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_USER']; ?>" class="mainoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onClick="window.open('<?php echo "../memberlist.$phpEx$SID&mode=searchuser&field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="username" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@ -390,7 +399,7 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
|
||||
<th align="center"><?php echo $user->lang['LOOK_UP_GROUP']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" align="center"> <select name="ug_data"><?php echo $group_options; ?></select> <input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="group" /> </td>
|
||||
<td class="row1" align="center"> <select name="ug_data[]"><?php echo $group_options; ?></select> <input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="group" /> </td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@ -409,29 +418,19 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
|
||||
|
||||
// Second possible form, this lists the currently enabled
|
||||
// users/groups for the given mode
|
||||
if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || ($submit != 'options' && empty($submode) && in_array($mode, array('admin', 'supermod'))))
|
||||
if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || (!strstr($submit, 'options') && empty($submode) && in_array($mode, array('admin', 'supermod'))))
|
||||
{
|
||||
// Generate list of forum id's
|
||||
$s_forum_id = '';
|
||||
foreach ($forum_id as $forum_submode => $forum_submode_ids)
|
||||
{
|
||||
foreach ($forum_submode_ids as $submode_forum_id)
|
||||
{
|
||||
$s_forum_id .= '<input type="hidden" name="f[' . $forum_submode . '][]" value="' . $submode_forum_id . '" />';
|
||||
}
|
||||
}
|
||||
unset($forum_submode_ids);
|
||||
unset($forum_submode);
|
||||
unset($submode_forum_id);
|
||||
|
||||
?>
|
||||
|
||||
<h1><?php echo $l_title; ?></h1>
|
||||
|
||||
<p><?php echo $l_title_explain; ?></p>
|
||||
|
||||
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td align="center"><h1><?php echo $user->lang['USERS']; ?></h1></td>
|
||||
<td align="center"><h1><?php echo $user->lang['GROUPS']; ?></h1></td>
|
||||
<td align="center"><h1><?php echo $user->lang['USERGROUPS']; ?></h1></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@ -462,7 +461,7 @@ if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || ($submit !=
|
||||
<td class="row1" align="center"><select style="width:280px" name="ug_data[]" multiple="multiple" size="5"><?php echo $users; ?></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" align="center"><input class="liteoption" type="submit" name="submit_delete" value="<?php echo $user->lang['DELETE']; ?>" /> <input class="liteoption" type="submit" name="submit_options" value="<?php echo $user->lang['SET_OPTIONS']; ?>" /><input type="hidden" name="ug_type" value="user" /><?php echo $s_forum_id; ?></td>
|
||||
<td class="cat" align="center"><input class="liteoption" type="submit" name="submit_delete" value="<?php echo $user->lang['DELETE']; ?>" /> <input class="liteoption" type="submit" name="submit_edit_options" value="<?php echo $user->lang['SET_OPTIONS']; ?>" /><input type="hidden" name="ug_type" value="user" /><?php echo $s_forum_id; ?></td>
|
||||
</tr>
|
||||
</table></form></td>
|
||||
|
||||
@ -505,7 +504,7 @@ if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || ($submit !=
|
||||
<td class="row1" align="center"><select style="width:280px" name="ug_data[]" multiple="multiple" size="5"><?php echo $groups; ?></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" align="center"><input class="liteoption" type="submit" name="submit_delete" value="<?php echo $user->lang['DELETE']; ?>" /> <input class="liteoption" type="submit" name="submit_options" value="<?php echo $user->lang['SET_OPTIONS']; ?>" /><input type="hidden" name="ug_type" value="group" /><?php echo $s_forum_id; ?></td>
|
||||
<td class="cat" align="center"><input class="liteoption" type="submit" name="submit_delete" value="<?php echo $user->lang['DELETE']; ?>" /> <input class="liteoption" type="submit" name="submit_edit_options" value="<?php echo $user->lang['SET_OPTIONS']; ?>" /><input type="hidden" name="ug_type" value="group" /><?php echo $s_forum_id; ?></td>
|
||||
</tr>
|
||||
</table></form></td>
|
||||
|
||||
@ -520,7 +519,7 @@ if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || ($submit !=
|
||||
<td class="row1" align="center"><textarea cols="40" rows="4" name="ug_data[]"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" align="center"> <input type="submit" name="submit_options" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /> <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="user" /><?php echo $s_forum_id; ?></td>
|
||||
<td class="cat" align="center"> <input type="submit" name="submit_add_options" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /> <input type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&mode=searchuser&form=2&field=entries', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="user" /><?php echo $s_forum_id; ?></td>
|
||||
</tr>
|
||||
</table></form></td>
|
||||
|
||||
@ -532,7 +531,7 @@ if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || ($submit !=
|
||||
<td class="row1" align="center"><select name="ug_data[]" multiple="multiple" size="4"><?php echo $group_list; ?></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" align="center"> <input type="submit" name="submit_options" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /><input type="hidden" name="ug_type" value="group" /><?php echo $s_forum_id; ?></td>
|
||||
<td class="cat" align="center"> <input type="submit" name="submit_add_options" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /><input type="hidden" name="ug_type" value="group" /><?php echo $s_forum_id; ?></td>
|
||||
</tr>
|
||||
</table></form></td>
|
||||
</tr>
|
||||
@ -550,12 +549,14 @@ if ((in_array($submit, array('usergroups', 'delete', 'cancel'))) || ($submit !=
|
||||
|
||||
// Third possible form, this is the major section of this script. It
|
||||
// handles the entry of permission options for all situations
|
||||
if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) || !empty($submode))
|
||||
if (in_array($submit, array('add_options', 'edit_options', 'presetsave', 'presetdel', 'update')) || !empty($submode))
|
||||
{
|
||||
|
||||
if (!isset($forum_id) && empty($ug_data))
|
||||
// Did the user specify any users or groups?
|
||||
if (empty($ug_data))
|
||||
{
|
||||
trigger_error($user->lang['NO_MODE']);
|
||||
$l_message = ($ug_type == 'user') ? 'NO_USER' : 'NO_GROUP';
|
||||
trigger_error($user->lang[$l_message]);
|
||||
}
|
||||
|
||||
|
||||
@ -577,24 +578,17 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
|
||||
|
||||
// Grab relevant user or group information
|
||||
$ug_ids = $ug_names = $ug_hidden = '';
|
||||
$l_no_error = '';
|
||||
$ug_ids = $ug_names = $ug_hidden = $l_no_error = '';
|
||||
switch ($ug_type)
|
||||
{
|
||||
case 'user':
|
||||
// If we've just come from the usergroup form then user will actually
|
||||
// be a username rather than a user_id, so act appropriately
|
||||
$l_no_error = $user->lang['NO_USER'];
|
||||
$sql = 'SELECT user_id AS id, username AS name
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE user_id';
|
||||
$sql .= (is_array($ug_data)) ? ' IN (' . implode(', ', $ug_data) . ')' : ' = ' . $ug_data;
|
||||
break;
|
||||
|
||||
case 'username':
|
||||
$l_no_error = $user->lang['NO_USER'];
|
||||
$sql = 'SELECT user_id AS id, username AS name
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE username';
|
||||
$sql .= (is_array($ug_data)) ? ' IN (' . implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#', "'\\1'", $ug_data)) . ')' : ' = ' . "'" . trim($ug_data) . "'";
|
||||
FROM ' . USERS_TABLE . '
|
||||
WHERE ';
|
||||
$sql .= ($submit == 'add_options') ? ' username IN (' . implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#', "'\\1'", explode("\n", $ug_data[0]))) . ')' : ' user_id ' . ((is_array($ug_data)) ? 'IN (' . implode(', ', $ug_data) . ')' : '= ' . $ug_data);
|
||||
break;
|
||||
|
||||
case 'group':
|
||||
@ -612,7 +606,6 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
trigger_error($l_no_error);
|
||||
}
|
||||
unset($l_no_error);
|
||||
unset($ug_data);
|
||||
|
||||
// Store the user_ids and names for later use
|
||||
do
|
||||
@ -742,8 +735,8 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
$sql_table = ACL_USERS_TABLE . ' a, ';
|
||||
$sql_join = 'a.user_id';;
|
||||
$sql_table = ACL_USERS_TABLE . ' a ';
|
||||
$sql_join = 'a.user_id';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -765,41 +758,56 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're looking at a view ... so we'll set all options to ignore
|
||||
// We're looking at a view ... so we'll set all options to unset
|
||||
// We could be a little more clever here but the "safe side" looks
|
||||
// better right now
|
||||
$auth_settings[$which_mode] = array();
|
||||
foreach ($auth_options as $option)
|
||||
{
|
||||
$auth_settings[$which_mode][$option['auth_option']] = -1;
|
||||
$auth_settings[$which_mode][$option['auth_option']] = '*';
|
||||
}
|
||||
unset($option);
|
||||
}
|
||||
}
|
||||
|
||||
// Should we display a dropdown for views?
|
||||
$view_options = '';
|
||||
// Should we display a dropdown for views?
|
||||
if (in_array($mode, array('admin', 'supermod', 'mod')))
|
||||
{
|
||||
$view_options .= '<option value="-1">Select view</option>';
|
||||
$view_options .= (!empty($submode) && $mode != $submode) ? '<option value="' . $mode . '">' . $user->lang['ACL_VIEW_' . strtoupper($mode)] . '</option>' : '';
|
||||
$view_options .= '<option value="">Select view</option>';
|
||||
$view_ary = array(
|
||||
'admin' => array('forum' => 'a_auth', 'mod' => 'a_authmods', 'supermod' => 'a_authmods'),
|
||||
'supermod' => array('forum' => 'a_auth'),
|
||||
'mod' => array('forum' => 'a_auth')
|
||||
'admin' => array('admin' => 'a_', 'forum' => 'a_auth', 'supermod' => 'a_authmods', 'mod' => 'a_authmods'),
|
||||
'supermod' => array('supermod' => 'a_authmods', 'mod' => 'a_authmods', 'forum' => 'a_auth'),
|
||||
'mod' => array('mod' => 'a_authmods', 'forum' => 'a_auth')
|
||||
);
|
||||
|
||||
foreach ($view_ary[$mode] as $which_submode => $which_acl)
|
||||
{
|
||||
if ($auth->acl_get($which_acl))
|
||||
{
|
||||
$view_options .= '<option value="' . $which_submode . '"' . (($which_submode == $submode) ? ' selected="selected"' : '') . '>' . $user->lang['ACL_VIEW_' . strtoupper($which_submode)] . '</option>';
|
||||
$view_options .= '<option value="' . $which_submode . '"' . (($which_submode == $which_mode) ? ' selected="selected"' : '') . '>' . $user->lang['ACL_VIEW_' . strtoupper($which_submode)] . '</option>';
|
||||
}
|
||||
|
||||
}
|
||||
unset($view_ary);
|
||||
}
|
||||
|
||||
// print_r($auth_settings);
|
||||
$settings_hidden = '';
|
||||
// Output original settings ... needed when we jump views
|
||||
foreach ($auth_settings as $auth_submode => $auth_submode_settings)
|
||||
{
|
||||
if ($auth_submode != $which_mode)
|
||||
{
|
||||
foreach ($auth_submode_settings as $submode_option => $submode_setting)
|
||||
{
|
||||
$settings_hidden .= ($submode_setting != '*') ? '<input type="hidden" name="settings[' . $auth_submode . '][' . $submode_option . ']" value="' . $submode_setting . '" />' : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($auth_submode);
|
||||
unset($auth_submode_settings);
|
||||
unset($auth_submode_option);
|
||||
unset($auth_submode_setting);
|
||||
|
||||
?>
|
||||
|
||||
@ -848,7 +856,7 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
break;
|
||||
|
||||
case 'all_ignore':
|
||||
if (elem.value == -1)
|
||||
if (elem.value == '*')
|
||||
elem.checked = true;
|
||||
break;
|
||||
|
||||
@ -891,8 +899,36 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
|
||||
<h1><?php echo $l_title; ?></h1>
|
||||
|
||||
<p><?php
|
||||
|
||||
$l_selected_users = ($ug_type == 'user') ? ((sizeof($ug_data) == 1) ? 'SELECTED_USER' : 'SELECTED_USERS') : ((sizeof($ug_data) == 1) ? 'SELECTED_GROUP' : 'SELECTED_GROUPS');
|
||||
|
||||
echo $user->lang[$l_selected_users];
|
||||
|
||||
unset($l_selected_users);
|
||||
unset($ug_data);
|
||||
|
||||
?>: <b><?php echo $ug_names; ?></b></p>
|
||||
|
||||
<p><?php echo $l_title_explain; ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
if ($settings_hidden != '')
|
||||
{
|
||||
|
||||
?>
|
||||
|
||||
<h2 style="color:red"><?php echo $user->lang['WARNING']; ?></h2>
|
||||
|
||||
<p><?php echo $user->lang['WARNING_EXPLAIN']; ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<form method="post" name="acl" action="<?php echo "admin_permissions.$phpEx$SID&mode=$mode&submode=$submode"; ?>"><table cellspacing="2" cellpadding="0" border="0" align="center">
|
||||
<?php
|
||||
|
||||
@ -907,13 +943,13 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
<tr>
|
||||
<td colspan="2" align="right"><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0">
|
||||
<tr>
|
||||
<th colspan="2"> </th>
|
||||
<th colspan="2"><?php echo $user->lang['SELECT_FORUM']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" width="150">Will set options in: <br /><span class="gensmall"></span></td>
|
||||
<td class="row1" width="150"><?php echo $user->lang['WILL_SET_OPTIONS']; ?>:</td>
|
||||
<td class="row2"><select name="f[<?php echo $which_mode; ?>][]" multiple="4"><?php
|
||||
|
||||
echo make_forum_select($forum_id[$which_mode], false);
|
||||
echo make_forum_select($forum_id[$which_mode], false, true);
|
||||
|
||||
?></select></td>
|
||||
</tr>
|
||||
@ -928,23 +964,24 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
<tr>
|
||||
<td align="left"><?php
|
||||
|
||||
$colspan = 4;
|
||||
if ($view_options != '')
|
||||
{
|
||||
$colspan = 5;
|
||||
|
||||
?><select name="submode" onchange="if (this.options[this.selectedIndex].value != -1) this.form.submit();"><?php echo $view_options; ?></select><?php
|
||||
|
||||
?><select name="submode" onchange="if (this.options[this.selectedIndex].value != '') this.form.submit();"><?php echo $view_options; ?></select><?php
|
||||
|
||||
}
|
||||
|
||||
?></td>
|
||||
<td align="right"><?php echo $user->lang['PRESETS']; ?>: <select name="set" onchange="use_preset(this.options[this.selectedIndex].value);"><option class="sep"><?php echo $user->lang['SELECT'] . ' ->'; ?></option><option value="all_yes"><?php echo $user->lang['ALL_YES']; ?></option><option value="all_no"><?php echo $user->lang['ALL_NO']; ?></option><option value="all_unset"><?php echo $user->lang['ALL_UNSET']; ?></option><?php
|
||||
|
||||
$colspan = 4;
|
||||
if ($which_mode != $mode)
|
||||
{
|
||||
echo '<option value="all_ignore">All Ignore</option>';
|
||||
$colspan = 5;
|
||||
echo '<option value="all_ignore">' . $user->lang['ALL_IGNORE'] . '</option>';
|
||||
}
|
||||
|
||||
// Output user preset options ... if any
|
||||
echo ($preset_options) ? '<option class="sep">' . $user->lang['USER_PRESETS'] . ' ->' . '</option>' . $preset_options : '';
|
||||
|
||||
?></select></td>
|
||||
@ -955,13 +992,15 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
<th> <?php echo $user->lang['OPTION']; ?> </th>
|
||||
<th width="50"> <?php echo $user->lang['YES']; ?> </th>
|
||||
<th width="50"> <?php echo $user->lang['UNSET']; ?> </th>
|
||||
<th width="50"> <?php echo $user->lang['NO']; ?> </th><?php
|
||||
<th width="50"> <?php echo $user->lang['NO']; ?> </th>
|
||||
<?php
|
||||
|
||||
if ($which_mode != $mode)
|
||||
{
|
||||
|
||||
?>
|
||||
<th width="50"> <?php echo 'Ignore';?> </th><?php
|
||||
<th width="50"> <?php echo $user->lang['IGNORE']; ?> </th>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
@ -982,44 +1021,45 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
$selected_yes = (isset($auth_settings[$which_mode][$auth_options[$i]['auth_option']]) && $auth_settings[$which_mode][$auth_options[$i]['auth_option']] == ACL_YES) ? ' checked="checked"' : '';
|
||||
$selected_no = (isset($auth_settings[$which_mode][$auth_options[$i]['auth_option']]) && $auth_settings[$which_mode][$auth_options[$i]['auth_option']] == ACL_NO) ? ' checked="checked"' : '';
|
||||
$selected_unset = (!isset($auth_settings[$which_mode][$auth_options[$i]['auth_option']]) || $auth_settings[$which_mode][$auth_options[$i]['auth_option']] == ACL_UNSET) ? ' checked="checked"' : '';
|
||||
$selected_ignore = (isset($auth_settings[$which_mode][$auth_options[$i]['auth_option']]) && $auth_settings[$which_mode][$auth_options[$i]['auth_option']] == -1) ? ' checked="checked"' : '';
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $l_auth_option; ?> </td>
|
||||
|
||||
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="settings<?php echo $s_auth_option ;?>" value="<?php echo ACL_YES; ?>"<?php echo $selected_yes; ?> /></td>
|
||||
|
||||
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="settings<?php echo $s_auth_option ;?>" value="<?php echo ACL_UNSET; ?>"<?php echo $selected_unset; ?> /></td>
|
||||
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="settings<?php echo $s_auth_option ;?>" value="<?php echo ACL_NO; ?>"<?php echo $selected_no; ?> /></td>
|
||||
<?php
|
||||
|
||||
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="settings<?php echo $s_auth_option ;?>" value="<?php echo ACL_NO; ?>"<?php echo $selected_no; ?> /></td><?php
|
||||
|
||||
if ($which_mode != $mode)
|
||||
{
|
||||
$selected_ignore = (isset($auth_settings[$which_mode][$auth_options[$i]['auth_option']]) && $auth_settings[$which_mode][$auth_options[$i]['auth_option']] == '*') ? ' checked="checked"' : '';
|
||||
|
||||
?>
|
||||
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="settings<?php echo $s_auth_option ;?>" value="-1"<?php echo $selected_ignore; ?> /></td><?php
|
||||
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="settings<?php echo $s_auth_option ;?>" value="*"<?php echo $selected_ignore; ?> /></td>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
// Subforum inheritance
|
||||
if (($sql_option_mode == 'f' || ($sql_option_mode == 'm' && $mode != 'supermod')) && empty($submode))
|
||||
|
||||
// If we're setting forum or moderator options and a single forum has
|
||||
// been selected then look to see if any subforums exist. If they do
|
||||
// give user the option of cascading permissions to them
|
||||
if (($mode == 'forum' || $mode == 'mod') && empty($submode) && sizeof($forum_id[$which_mode]) == 1)
|
||||
{
|
||||
$children = get_forum_branch($forum_id[$which_mode], 'children', 'descending', false);
|
||||
$children = get_forum_branch($forum_id[$which_mode][0], 'children', 'descending', false);
|
||||
|
||||
if (!empty($children))
|
||||
{
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th colspan="4"><?php echo $user->lang['ACL_SUBFORUMS']; ?></th>
|
||||
<th colspan="<?php echo $colspan; ?>"><?php echo $user->lang['ACL_SUBFORUMS']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1" colspan="<?php echo $colspan; ?>"><table width="100%" cellspacing="1" cellpadding="0" border="0">
|
||||
@ -1057,7 +1097,7 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
|
||||
?>
|
||||
<!-- tr>
|
||||
<th colspan="4"><?php echo $user->lang['RUN_HOW']; ?></th>
|
||||
<th colspan="<?php echo $colspan; ?>"><?php echo $user->lang['RUN_HOW']; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="<?php echo $row_class; ?>" colspan="4" align="center"><input type="radio" name="runas" value="now" checked="checked" /> <?php echo $user->lang['RUN_AS_NOW']; ?><?php
|
||||
@ -1089,33 +1129,12 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
|
||||
<tr>
|
||||
<td class="cat" colspan="<?php echo $colspan; ?>" align="center"><input class="mainoption" type="submit" name="submit_update" value="<?php echo $user->lang['UPDATE']; ?>" /> <input class="liteoption" type="submit" name="submit_cancel" value="<?php echo $user->lang['CANCEL']; ?>" /><input type="hidden" name="ug_type" value="<?php echo $ug_type; ?>" /><?php echo $ug_hidden; ?><?php
|
||||
|
||||
// Output list of forums
|
||||
foreach ($forum_id as $forum_submode => $forum_submode_ids)
|
||||
{
|
||||
foreach ($forum_submode_ids as $submode_forum_id)
|
||||
{
|
||||
echo '<input type="hidden" name="f[' . $forum_submode . '][]" value="' . $submode_forum_id . '" />';
|
||||
}
|
||||
}
|
||||
unset($forum_submode_ids);
|
||||
unset($forum_submode);
|
||||
unset($submode_forum_id);
|
||||
// Output forum id data
|
||||
echo $s_forum_id;
|
||||
|
||||
// Output original settings ... needed when we jump views
|
||||
foreach ($auth_settings as $auth_submode => $auth_submode_settings)
|
||||
{
|
||||
if ($auth_submode != $which_mode)
|
||||
{
|
||||
foreach ($auth_submode_settings as $submode_option => $submode_setting)
|
||||
{
|
||||
echo '<input type="hidden" name="settings[' . $auth_submode . '][' . $submode_option . ']" value="' . $submode_setting . '" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($auth_submode);
|
||||
unset($auth_submode_settings);
|
||||
unset($auth_submode_option);
|
||||
unset($auth_submode_setting);
|
||||
// Output settings generated from other views
|
||||
echo $settings_hidden;
|
||||
unset($settings_hidden);
|
||||
|
||||
?></td>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user