1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 07:08:09 +01:00

Seems to be working ...

git-svn-id: file:///svn/phpbb/trunk@3832 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-04-15 17:32:49 +00:00
parent 25711806b3
commit b7eef16074

View File

@ -43,18 +43,18 @@ require('pagestart.' . $phpEx);
// //
// 'mode' determines what we're altering; administrators, users, deps, etc. // 'mode' determines what we're altering; administrators, users, deps, etc.
// 'submit' is used to determine what we're doing ... special format // 'submit' is used to determine what we're doing ... special format
$mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : ''; $mode = (isset($_REQUEST['mode'])) ? htmlspecialchars($_REQUEST['mode']) : '';
$submode= (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : ''; $submode = (isset($_REQUEST['submode'])) ? htmlspecialchars($_REQUEST['submode']) : '';
$which_mode = (!empty($submode) && $submode != $mode) ? $submode : $mode; $which_mode = (!empty($submode) && $submode != $mode) ? $submode : $mode;
$submit = array_values(preg_grep('#^submit_(.*)$#i', array_keys($_POST))); $submit = array_values(preg_grep('#^submit_(.*)$#i', array_keys($_POST)));
$submit = (sizeof($submit)) ? substr($submit[0], strpos($submit[0], '_') + 1) : ''; $submit = (sizeof($submit)) ? substr($submit[0], strpos($submit[0], '_') + 1) : '';
// Submitted setting data // Submitted setting data
// //
// 'auth_settings' contains the submitted option settings assigned to options, should be an // 'auth_settings' contains the submitted option settings assigned to options, should be an
// associative array with integer values // associative array with integer values
$auth_settings = (isset($_POST['settings'])) ? $_POST['settings'] : ''; $auth_settings = (isset($_POST['settings'])) ? $_POST['settings'] : '';
// Forum, User or Group information // 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])); $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 // Instantiate a new auth admin object in readiness
$auth_admin = new auth_admin(); $auth_admin = new auth_admin();
@ -179,88 +192,84 @@ switch ($submit)
{ {
case 'update': case 'update':
print_r($auth_settings); if (sizeof($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']))
{ {
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($auth_submode);
unset($forum_id_deps); unset($auth_setting);
// Admin wants subforums to inherit permissions ... so handle this // Do we need to recache the moderator lists? We do if the mode
if (!empty($_POST['inherit'])) // 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); cache_moderators();
$forum_id = $_POST['inherit'];
} }
// 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']); trigger_error($user->lang['AUTH_UPDATED']);
break; break;
case 'delete': case 'delete':
echo "HERE :: DELETE";
exit;
/* $sql = "SELECT auth_option_id
$option_ids = false; FROM " . ACL_OPTIONS_TABLE . "
if (!empty($settings) WHERE auth_option LIKE '{$sql_option_mode}_%'";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{ {
$sql = "SELECT auth_option_id $option_id_ary = array();
FROM " . ACL_OPTIONS_TABLE . " do
WHERE auth_option LIKE '" . $settings['option'] . "_%'";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{ {
$option_ids = array(); $option_id_ary[] = $row['auth_option_id'];
do
{
$option_ids[] = $row['auth_option_id'];
}
while($row = $db->sql_fetchrow($result));
} }
$db->sql_freeresult($result); while($row = $db->sql_fetchrow($result));
}
foreach ($_POST['ug_id'] as $id) foreach ($ug_data as $id)
{ {
$auth_admin->acl_delete($_POST['type'], $forum_id, $id, $option_ids); $auth_admin->acl_delete($ug_type, $forum_id[$mode], $id, $option_id_ary);
}
unset($option_id_ary);
} }
$db->sql_freeresult($result);
cache_moderators(); cache_moderators();
trigger_error($user->lang['AUTH_UPDATED']); trigger_error($user->lang['AUTH_UPDATED']);
*/
break; break;
case 'presetsave': 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> <th align="center"><?php echo $user->lang['LOOK_UP_FORUM']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" align="center">&nbsp;<select name="f"><?php echo <td class="row1" align="center">&nbsp;<select name="f[<?php echo $mode; ?>][]"><?php echo
make_forum_select(); make_forum_select(false, false, true);
?></select> &nbsp;<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" />&nbsp;</td> ?></select> &nbsp;<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" />&nbsp;</td>
</tr> </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> <th align="center"><?php echo $user->lang['LOOK_UP_USER']; ?></th>
</tr> </tr>
<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&amp;mode=searchuser&amp;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&amp;mode=searchuser&amp;field=username"; ?>', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;" /><input type="hidden" name="ug_type" value="username" /></td>
</tr> </tr>
<?php <?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> <th align="center"><?php echo $user->lang['LOOK_UP_GROUP']; ?></th>
</tr> </tr>
<tr> <tr>
<td class="row1" align="center">&nbsp;<select name="ug_data"><?php echo $group_options; ?></select> &nbsp;<input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="group" />&nbsp;</td> <td class="row1" align="center">&nbsp;<select name="ug_data[]"><?php echo $group_options; ?></select> &nbsp;<input type="submit" name="submit_options" value="<?php echo $user->lang['LOOK_UP_GROUP']; ?>" class="mainoption" /><input type="hidden" name="ug_type" value="group" />&nbsp;</td>
</tr> </tr>
<?php <?php
@ -409,29 +418,19 @@ if (in_array($mode, array('user', 'group', 'forum', 'mod')) && empty($submit))
// Second possible form, this lists the currently enabled // Second possible form, this lists the currently enabled
// users/groups for the given mode // 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> <p><?php echo $l_title_explain; ?></p>
<table width="100%" cellspacing="0" cellpadding="0" border="0"> <table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td align="center"><h1><?php echo $user->lang['USERS']; ?></h1></td> <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>
<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> <td class="row1" align="center"><select style="width:280px" name="ug_data[]" multiple="multiple" size="5"><?php echo $users; ?></select></td>
</tr> </tr>
<tr> <tr>
<td class="cat" align="center"><input class="liteoption" type="submit" name="submit_delete" value="<?php echo $user->lang['DELETE']; ?>" /> &nbsp; <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']; ?>" /> &nbsp; <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> </tr>
</table></form></td> </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> <td class="row1" align="center"><select style="width:280px" name="ug_data[]" multiple="multiple" size="5"><?php echo $groups; ?></select></td>
</tr> </tr>
<tr> <tr>
<td class="cat" align="center"><input class="liteoption" type="submit" name="submit_delete" value="<?php echo $user->lang['DELETE']; ?>" /> &nbsp; <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']; ?>" /> &nbsp; <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> </tr>
</table></form></td> </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> <td class="row1" align="center"><textarea cols="40" rows="4" name="ug_data[]"></textarea></td>
</tr> </tr>
<tr> <tr>
<td class="cat" align="center"> <input type="submit" name="submit_options" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" />&nbsp; <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" />&nbsp; <input type="submit" name="usersubmit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&amp;mode=searchuser&amp;form=2&amp;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" />&nbsp; <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" />&nbsp; <input type="submit" value="<?php echo $user->lang['FIND_USERNAME']; ?>" class="liteoption" onclick="window.open('<?php echo "../memberlist.$phpEx$SID"; ?>&amp;mode=searchuser&amp;form=2&amp;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> </tr>
</table></form></td> </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> <td class="row1" align="center"><select name="ug_data[]" multiple="multiple" size="4"><?php echo $group_list; ?></select></td>
</tr> </tr>
<tr> <tr>
<td class="cat" align="center"> <input type="submit" name="submit_options" value="<?php echo $user->lang['SUBMIT']; ?>" class="mainoption" />&nbsp; <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" />&nbsp; <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> </tr>
</table></form></td> </table></form></td>
</tr> </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 // Third possible form, this is the major section of this script. It
// handles the entry of permission options for all situations // 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 // Grab relevant user or group information
$ug_ids = $ug_names = $ug_hidden = ''; $ug_ids = $ug_names = $ug_hidden = $l_no_error = '';
$l_no_error = '';
switch ($ug_type) switch ($ug_type)
{ {
case 'user': 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']; $l_no_error = $user->lang['NO_USER'];
$sql = 'SELECT user_id AS id, username AS name $sql = 'SELECT user_id AS id, username AS name
FROM ' . USERS_TABLE . ' FROM ' . USERS_TABLE . '
WHERE user_id'; WHERE ';
$sql .= (is_array($ug_data)) ? ' IN (' . implode(', ', $ug_data) . ')' : ' = ' . $ug_data; $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 '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) . "'";
break; break;
case 'group': case 'group':
@ -612,7 +606,6 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
trigger_error($l_no_error); trigger_error($l_no_error);
} }
unset($l_no_error); unset($l_no_error);
unset($ug_data);
// Store the user_ids and names for later use // Store the user_ids and names for later use
do do
@ -742,8 +735,8 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
break; break;
case 'user': case 'user':
$sql_table = ACL_USERS_TABLE . ' a, '; $sql_table = ACL_USERS_TABLE . ' a ';
$sql_join = 'a.user_id';; $sql_join = 'a.user_id';
break; break;
} }
@ -765,41 +758,56 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
} }
else 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 // We could be a little more clever here but the "safe side" looks
// better right now // better right now
$auth_settings[$which_mode] = array(); $auth_settings[$which_mode] = array();
foreach ($auth_options as $option) 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 = ''; $view_options = '';
// Should we display a dropdown for views?
if (in_array($mode, array('admin', 'supermod', 'mod'))) if (in_array($mode, array('admin', 'supermod', 'mod')))
{ {
$view_options .= '<option value="-1">Select view</option>'; $view_options .= '<option value="">Select view</option>';
$view_options .= (!empty($submode) && $mode != $submode) ? '<option value="' . $mode . '">' . $user->lang['ACL_VIEW_' . strtoupper($mode)] . '</option>' : '';
$view_ary = array( $view_ary = array(
'admin' => array('forum' => 'a_auth', 'mod' => 'a_authmods', 'supermod' => 'a_authmods'), 'admin' => array('admin' => 'a_', 'forum' => 'a_auth', 'supermod' => 'a_authmods', 'mod' => 'a_authmods'),
'supermod' => array('forum' => 'a_auth'), 'supermod' => array('supermod' => 'a_authmods', 'mod' => 'a_authmods', 'forum' => 'a_auth'),
'mod' => array('forum' => 'a_auth') 'mod' => array('mod' => 'a_authmods', 'forum' => 'a_auth')
); );
foreach ($view_ary[$mode] as $which_submode => $which_acl) foreach ($view_ary[$mode] as $which_submode => $which_acl)
{ {
if ($auth->acl_get($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); 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; break;
case 'all_ignore': case 'all_ignore':
if (elem.value == -1) if (elem.value == '*')
elem.checked = true; elem.checked = true;
break; break;
@ -891,8 +899,36 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
<h1><?php echo $l_title; ?></h1> <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> <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&amp;mode=$mode&amp;submode=$submode"; ?>"><table cellspacing="2" cellpadding="0" border="0" align="center"> <form method="post" name="acl" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode&amp;submode=$submode"; ?>"><table cellspacing="2" cellpadding="0" border="0" align="center">
<?php <?php
@ -907,13 +943,13 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
<tr> <tr>
<td colspan="2" align="right"><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"> <td colspan="2" align="right"><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0">
<tr> <tr>
<th colspan="2">&nbsp;</th> <th colspan="2"><?php echo $user->lang['SELECT_FORUM']; ?></th>
</tr> </tr>
<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 <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> ?></select></td>
</tr> </tr>
@ -928,23 +964,24 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
<tr> <tr>
<td align="left"><?php <td align="left"><?php
$colspan = 4;
if ($view_options != '') if ($view_options != '')
{ {
$colspan = 5;
?><select name="submode" onchange="if (this.options[this.selectedIndex].value != '') this.form.submit();"><?php echo $view_options; ?></select><?php
?><select name="submode" onchange="if (this.options[this.selectedIndex].value != -1) this.form.submit();"><?php echo $view_options; ?></select><?php
} }
?></td> ?></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'] . ' -&gt;'; ?></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 <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'] . ' -&gt;'; ?></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) 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'] . ' -&gt;' . '</option>' . $preset_options : ''; echo ($preset_options) ? '<option class="sep">' . $user->lang['USER_PRESETS'] . ' -&gt;' . '</option>' . $preset_options : '';
?></select></td> ?></select></td>
@ -955,13 +992,15 @@ if (in_array($submit, array('options', 'presetsave', 'presetdel', 'update')) ||
<th>&nbsp;<?php echo $user->lang['OPTION']; ?>&nbsp;</th> <th>&nbsp;<?php echo $user->lang['OPTION']; ?>&nbsp;</th>
<th width="50">&nbsp;<?php echo $user->lang['YES']; ?>&nbsp;</th> <th width="50">&nbsp;<?php echo $user->lang['YES']; ?>&nbsp;</th>
<th width="50">&nbsp;<?php echo $user->lang['UNSET']; ?>&nbsp;</th> <th width="50">&nbsp;<?php echo $user->lang['UNSET']; ?>&nbsp;</th>
<th width="50">&nbsp;<?php echo $user->lang['NO']; ?>&nbsp;</th><?php <th width="50">&nbsp;<?php echo $user->lang['NO']; ?>&nbsp;</th>
<?php
if ($which_mode != $mode) if ($which_mode != $mode)
{ {
?> ?>
<th width="50">&nbsp;<?php echo 'Ignore';?>&nbsp;</th><?php <th width="50">&nbsp;<?php echo $user->lang['IGNORE']; ?>&nbsp;</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_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_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_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> <tr>
<td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $l_auth_option; ?>&nbsp;</td> <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $l_auth_option; ?>&nbsp;</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_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_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) 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> </tr>
<?php <?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)) if (!empty($children))
{ {
?> ?>
<tr> <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>
<tr> <tr>
<td class="row1" colspan="<?php echo $colspan; ?>"><table width="100%" cellspacing="1" cellpadding="0" border="0"> <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> <!-- 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>
<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 <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> <tr>
<td class="cat" colspan="<?php echo $colspan; ?>" align="center"><input class="mainoption" type="submit" name="submit_update" value="<?php echo $user->lang['UPDATE']; ?>" />&nbsp;&nbsp;<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 <td class="cat" colspan="<?php echo $colspan; ?>" align="center"><input class="mainoption" type="submit" name="submit_update" value="<?php echo $user->lang['UPDATE']; ?>" />&nbsp;&nbsp;<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 // Output forum id data
foreach ($forum_id as $forum_submode => $forum_submode_ids) echo $s_forum_id;
{
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 original settings ... needed when we jump views // Output settings generated from other views
foreach ($auth_settings as $auth_submode => $auth_submode_settings) echo $settings_hidden;
{ unset($settings_hidden);
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);
?></td> ?></td>
</tr> </tr>