aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-04-01 00:06:11 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-04-01 00:06:11 +0000
commit5231006c03848f7e35ef53b0548a4ed5b5732a5e (patch)
tree1dda392cb8077f61261bc9e0ace9e6359d63376d /phpBB
parent3257af80f0f510c11b4d7370bebf9c580a524d49 (diff)
downloadforums-5231006c03848f7e35ef53b0548a4ed5b5732a5e.tar
forums-5231006c03848f7e35ef53b0548a4ed5b5732a5e.tar.gz
forums-5231006c03848f7e35ef53b0548a4ed5b5732a5e.tar.bz2
forums-5231006c03848f7e35ef53b0548a4ed5b5732a5e.tar.xz
forums-5231006c03848f7e35ef53b0548a4ed5b5732a5e.zip
Just throwing this in ... dependencies still not complete ... the GUI and storage has caused me to do more "thinking" than I'd anticipated ... comments are welcome on what you see. Note also ALLOW/DENY/INHERIT have become YES/NO/UNSET
git-svn-id: file:///svn/phpbb/trunk@3772 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/admin_permissions.php302
-rw-r--r--phpBB/includes/functions.php3
-rw-r--r--phpBB/includes/functions_admin.php47
-rw-r--r--phpBB/install/schemas/mysql_basic.sql2
-rw-r--r--phpBB/install/schemas/mysql_schema.sql11
-rw-r--r--phpBB/language/en/lang_admin.php191
6 files changed, 347 insertions, 209 deletions
diff --git a/phpBB/adm/admin_permissions.php b/phpBB/adm/admin_permissions.php
index 1be21c51de..c6c60429b5 100644
--- a/phpBB/adm/admin_permissions.php
+++ b/phpBB/adm/admin_permissions.php
@@ -231,11 +231,11 @@ if ($mode == 'deps')
// Generate header
page_header($l_title);
- $chg_acl_type = (isset($_POST['chg_type'])) ? htmlspecialchars($_POST['chg_type']) : '';
- $chg_acl_option_id = (isset($_POST['chg_option'])) ? intval($_POST['chg_option']) : '';
- $chg_acl_value = (isset($_POST['chg_value'])) ? intval($_POST['chg_value']) : '';
- $chg_forum_id = (isset($_POST['f'])) ? intval($_POST['f']) : 0;
- $chg_acl_options = (isset($_POST['option'])) ? $_POST['option'] : '';
+ $dep_quick_access = (isset($_POST['dep_quick_access'])) ? htmlspecialchars($_POST['dep_quick_access']) : '';
+ $dep_type = (isset($_POST['dep_type'])) ? htmlspecialchars($_POST['dep_type']) : -1;
+ $dep_option = (isset($_POST['dep_option'])) ? $_POST['dep_option'] : array();
+ $dep_value = (isset($_POST['dep_value'])) ? intval($_POST['dep_value']) : -1;
+ $dep_forum_id = (isset($_POST['f'])) ? $_POST['f'] : array(0);
$acl_types = $auth_options = $value_options = $forum_options = '';
@@ -243,139 +243,247 @@ if ($mode == 'deps')
foreach ($types as $value => $option)
{
- $acl_types .= '<option value="' . $value . '"' . (($chg_acl_type == $value) ? ' selected="selected"' : '') . '>' . $option . '</option>';
+ $acl_types .= '<option value="' . $value . '"' . (($dep_type == $value) ? ' selected="selected"' : '') . '>' . $option . '</option>';
}
- if (isset($_POST['chg_type']))
+ if (!empty($dep_type))
{
- switch ($chg_acl_type)
+ switch ($dep_type)
{
case 'admin':
- $type_sql = 'a';
+ $dep_type = 'a';
break;
case 'supermod':
case 'mod':
- $type_sql = 'm';
+ $dep_type = 'm';
break;
}
$founder_sql = ($user->data['user_founder']) ? ' AND founder_only <> 1' : '';
- $sql = "SELECT auth_option_id, auth_value
+ $sql = "SELECT auth_value
FROM " . ACL_OPTIONS_TABLE . "
- WHERE auth_value LIKE '" . $type_sql . "_%'
+ WHERE auth_value LIKE '" . $dep_type . "_%'
$founder_sql";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
- {
- $auth_options .= '<option value="' . $row['auth_option_id'] . '"' . (($chg_acl_option_id == $row['auth_option_id']) ? ' selected="selected"' : '') . '>' . ((!empty($user->lang['acl_' . $row['auth_value']])) ? $user->lang['acl_' . $row['auth_value']] : (($row['auth_value'] == $chg_type_sql . '_') ? 'Any option' : ucfirst(preg_replace('#.*?_#', '', $row['auth_value'])))) . '</option>';
+ {
+ $auth_options .= '<option value="' . $row['auth_value'] . '"' . ((in_array($row['auth_value'], $dep_option)) ? ' selected="selected"' : '') . '>' . ((!empty($user->lang['acl_' . $row['auth_value']])) ? $user->lang['acl_' . $row['auth_value']] : (($row['auth_value'] == $dep_type . '_') ? 'Any option' : ucfirst(preg_replace('#.*?_#', '', $row['auth_value'])))) . '</option>';
}
$db->sql_freeresult($result);
}
- if (isset($_POST['chg_option']) && strstr($_POST['field'], 'options'))
+ $values = array(ACL_DENY => $user->lang['NO'], ACL_ALLOW => $user->lang['YES'], ACL_INHERIT => $user->lang['UNSET']);
+
+ foreach ($values as $value => $option)
{
- $values = array(ACL_DENY => $user->lang['DENY'], ACL_ALLOW => $user->lang['ALLOW'], ACL_INHERIT => $user->lang['INHERIT']);
+ $value_options .= '<option value="' . $value . '"' . (($dep_value === $value) ? ' selected="selected"' : '') . '>' . $option . '</option>';
+ }
- foreach ($values as $value => $option)
+ $forum_options = make_forum_select($dep_forum_id, false, false);
+
+ // Look for custom presets
+ $sql = "SELECT preset_id, preset_name, preset_data
+ FROM " . ACL_PRESETS_TABLE . "
+ WHERE preset_type = '$type_sql'
+ ORDER BY preset_id ASC";
+ $result = $db->sql_query($sql);
+
+ if ($row = $db->sql_fetchrow($result))
+ {
+ do
{
- $value_options .= '<option value="' . $value . '"' . (($chg_acl_value == $value && strstr($_POST['field'], 'values')) ? ' selected="selected"' : '') . '>' . $option . '</option>';
+ $preset_update_options .= '<option value="' . $row['preset_id'] . '">' . $row['preset_name'] . '</option>';
+ $preset_options .= '<option value="preset_' . $row['preset_id'] . '">' . $row['preset_name'] . '</option>';
+
+ $preset_data = unserialize($row['preset_data']);
+
+ foreach ($preset_data as $preset_type => $preset_type_ary)
+ {
+ $holding[$preset_type] = '';
+ foreach ($preset_type_ary as $preset_option)
+ {
+ $holding[$preset_type] .= "$preset_option, ";
+ }
+ }
+
+ $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new Array();" . "\n";
+ $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n";
}
+ while ($row = $db->sql_fetchrow($result));
}
+ unset($holding);
- if (isset($_POST['chg_value']) && strstr($_POST['field'], 'values'))
+ if ($dep_quick_access)
{
- $forum_options = make_forum_select(false, false, false);
+ $sql = 'SELECT auth_deps
+ FROM ' . ACL_DEPS_TABLE . "
+ WHERE dep_name ='$dep_quick_access'";
+ $result = $db->sql_query($sql);
+
+ $auth_values = array();
+ if ($row = $db->sql_fetchrow($result))
+ {
+ $auth_values = unserialize($row);
+ }
+ $db->sql_freeresult($result);
}
?>
-<h1><?php echo $l_title; ?></h1>
-
-<p><?php echo $l_title_explain; ?></p>
+<script language="Javascript" type="text/javascript">
+<!--
-<form method="post" name="acl" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table class="bg" width="60%" cellspacing="1" cellpadding="4" border="0" align="center">
- <tr>
- <th colspan="2">&nbsp;</th>
- </tr>
- <tr>
- <td class="row1">Permission type: </td>
- <td class="row2"><select name="chg_type" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.field.value = 'type'; this.form.submit() }"><option value="-1">Choose type</option><?php echo $acl_types; ?></select></td>
- </tr>
+ var presets = new Array();
<?php
- if ($auth_options != '')
- {
+ echo $preset_js;
?>
- <tr>
- <td class="row1">Changing option:</td>
- <td class="row2"><select name="chg_option" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.field.value = 'type, options'; this.form.submit() }"><option value="-1">Choose option</option><?php echo $auth_options; ?></select></td>
- </tr>
-<?php
+ function preset_obj(allow, deny, inherit)
+ {
+ this.allow = allow;
+ this.deny = deny;
+ this.inherit = inherit;
}
- if ($value_options != '')
+ function use_preset(option)
{
+ if (option)
+ {
+ document.acl.set.selectedIndex = 0;
+ var expr = new RegExp(/\d+/);
+ for (i = 0; i < document.acl.length; i++)
+ {
+ var elem = document.acl.elements[i];
+ if (elem.name.indexOf('aclopt') == 0)
+ {
+ switch (option)
+ {
+ case 'all_yes':
+ if (elem.value == <?php echo ACL_ALLOW; ?>)
+ elem.checked = true;
+ break;
+ case 'all_no':
+ if (elem.value == <?php echo ACL_DENY; ?>)
+ elem.checked = true;
+ break;
+ case 'all_unset':
+ if (elem.value == <?php echo ACL_INHERIT; ?>)
+ elem.checked = true;
+ break;
+ default:
+ option_name = elem.name.substr(7, elem.name.length - 8);
-?>
+ if (presets[option].allow.indexOf(option_name + ',') != -1 && elem.value == <?php echo ACL_ALLOW; ?>)
+ elem.checked = true;
+ else if (presets[option].deny.indexOf(option_name + ',') != -1 && elem.value == <?php echo ACL_DENY; ?>)
+ elem.checked = true;
+ else if (presets[option].inherit.indexOf(option_name + ',') != -1 && elem.value == <?php echo ACL_INHERIT; ?>)
+ elem.checked = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+//-->
+</script>
+
+<h1><?php echo $l_title; ?></h1>
+
+<p><?php echo $l_title_explain; ?></p>
+
+<table cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
- <td class="row1">To value:</td>
- <td class="row2"><select name="chg_value" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.field.value = 'type, options, values';this.form.submit() }"><option>Choose value</option><?php echo $value_options; ?></select></td>
- </tr>
-<?php
+ <td align="right"><form method="post" name="deps" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><?php echo $user->lang['QUICK ACCESS']; ?>: <select name="set" onchange="use_preset(this.options[this.selectedIndex].value);"><option class="sep"><?php echo $user->lang['SELECT'] . ' -&gt;'; ?></option><?php
- }
+ echo ($preset_options) ? '<option class="sep">' . $user->lang['USER_PRESETS'] . ' -&gt;' . '</option>' . $preset_options : '';
+
+?></select><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0">
+ <tr>
+ <th colspan="2">&nbsp;</th>
+ </tr>
+ <tr>
+ <td class="row1" width="150">Permission type: </td>
+ <td class="row2"><select name="dep_type" onchange="if (this.options[this.selectedIndex].value != -1) this.form.submit();"><option value="-1"<?php
- if ($forum_options != '')
+ echo ($dep_type == -1) ? ' selected="selected"' : '';
+
+?>>Choose type</option><?php echo $acl_types; ?></select></td>
+ </tr>
+<?php
+
+ if ($dep_type != -1)
{
?>
- <tr>
- <td class="row1">Set option in: <br /><span class="gensmall"></span></td>
- <td class="row2"><select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.field.value = 'type, options, values, forum'; this.form.submit() }"><option class="sep" value="0">All forums</option><?php
+ <tr>
+ <td class="row1" width="150">Changing option:</td>
+ <td class="row2"><select name="dep_option[]" multiple="4"><?php echo $auth_options; ?></select></td>
+ </tr>
+ <tr>
+ <td class="row1" width="150">To value:</td>
+ <td class="row2"><select name="dep_value"><option value="-1"<?php
+
+ echo ($dep_value == -1) ? ' selected="selected"' : '';
+
+?>>Choose value</option><?php echo $value_options; ?></select></td>
+ </tr>
+ <tr>
+ <td class="row1" width="150">Will set options in: <br /><span class="gensmall"></span></td>
+ <td class="row2"><select name="f[]" multiple="4"><option class="sep" value="0"<?php
+
+ echo ($dep_forum_id == 0) ? ' selected="selected"' : '';
+
+?>>All current forums</option><?php
- if ($_POST['type'] == 'mod')
- {
+ if ($dep_type == 'mod')
+ {
-?><option class="sep" value="-1">Affected forum</option><?php
+?><option class="sep" value="-2">Affected forum</option><?php
- }
+ }
echo $forum_options; ?></select></td>
- </tr>
-</table>
+ </tr>
+ <tr>
+ <td class="row1">Quick access name:</td>
+ <td class="row2"><input class="post" type="text" name="dep_name" value="" /></td>
+ </tr>
+ <tr>
+ <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="setdep" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
+ </tr>
<?php
}
- if (isset($_POST['f']) && strstr($_POST['field'], 'forum'))
+?>
+ </table></form></td>
+ </tr>
+<?php
+
+ if (isset($_POST['setdep']) && $dep_option && $dep_value != -1)
{
?>
-<table class="bg" width="60%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
- <th>&nbsp;<?php echo $user->lang['OPTION']; ?>&nbsp;</th>
- <th>&nbsp;<?php echo $user->lang['ALLOW']; ?>&nbsp;</th>
- <th>&nbsp;<?php echo $user->lang['DENY']; ?>&nbsp;</th>
- <th>&nbsp;<?php echo $user->lang['INHERIT']; ?>&nbsp;</th>
- </tr>
-<?php
+ <td align="right"><form method="post" name="acl" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><?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
- $sql = 'SELECT auth_dep
- FROM ' . ACL_DEPS_TABLE . "
- WHERE auth_value = $chg_acl_option
- AND auth_allow = $chg_acl_value
- AND forum_id = $chg_forum_id";
- $result = $db->sql_query($sql);
+ echo ($preset_options) ? '<option class="sep">' . $user->lang['USER_PRESETS'] . ' -&gt;' . '</option>' . $preset_options : '';
- $auth_values = array();
- if ($row = $db->sql_fetchrow($result))
- {
- $auth_values = unserialize($row);
- }
- $db->sql_freeresult($result);
+?></select></td>
+ </tr>
+ <tr>
+ <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0">
+ <tr>
+ <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['NO']; ?>&nbsp;</th>
+ <th width="50">&nbsp;<?php echo $user->lang['UNSET']; ?>&nbsp;</th>
+ </tr>
+<?php
$founder_sql = ($user->data['user_founder']) ? ' AND founder_only <> 1' : '';
$sql = "SELECT auth_option_id, auth_value
@@ -393,29 +501,31 @@ if ($mode == 'deps')
$allow_type = (isset($auth_values[$row['auth_value']]) && $auth_values[$row['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : '';
$deny_type = (isset($auth_values[$row['auth_value']]) && $auth_values[$row['auth_value']] == ACL_DENY) ? ' checked="checked"' : '';
- $inherit_type = (empty($auth_values[$row['auth_value']]) || $auth_values[$row['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : '';
+ $inherit_type = (!isset($auth_values[$row['auth_value']]) || $auth_values[$row['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : '';
?>
- <tr>
- <td class="<?php echo $row_class; ?>"><?php echo $l_can_cell; ?></td>
- <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $row['auth_value']; ?>]" value="<?php echo ACL_ALLOW; ?>"<?php echo $allow_type; ?> /></td>
- <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $row['auth_value']; ?>]" value="<?php echo ACL_DENY; ?>"<?php echo $deny_type; ?> /></td>
- <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $row['auth_value']; ?>]" value="<?php echo ACL_INHERIT; ?>"<?php echo $inherit_type; ?> /></td>
- </tr>
+ <tr>
+ <td class="<?php echo $row_class; ?>"><?php echo $l_can_cell; ?></td>
+ <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="aclopt[<?php echo $row['auth_value']; ?>]" value="<?php echo ACL_ALLOW; ?>"<?php echo $allow_type; ?> /></td>
+ <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="aclopt[<?php echo $row['auth_value']; ?>]" value="<?php echo ACL_DENY; ?>"<?php echo $deny_type; ?> /></td>
+ <td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="aclopt[<?php echo $row['auth_value']; ?>]" value="<?php echo ACL_INHERIT; ?>"<?php echo $inherit_type; ?> /></td>
+ </tr>
<?php
}
?>
- <tr>
- <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
+ <tr>
+ <td class="cat" colspan="4" align="center"><input class="mainoption" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /></td>
+ </tr>
+ </table></form></td>
</tr>
<?php
}
?>
-</table><input type="hidden" name="field" value="" /></form>
+</table>
<?php
@@ -707,15 +817,15 @@ else if (!empty($forum_id) ||
{
switch (option)
{
- case 'all_allow':
+ case 'all_yes':
if (elem.value == <?php echo ACL_ALLOW; ?>)
elem.checked = true;
break;
- case 'all_deny':
+ case 'all_no':
if (elem.value == <?php echo ACL_DENY; ?>)
elem.checked = true;
break;
- case 'all_inherit':
+ case 'all_unset':
if (elem.value == <?php echo ACL_INHERIT; ?>)
elem.checked = true;
break;
@@ -750,7 +860,7 @@ else if (!empty($forum_id) ||
<form method="post" name="acl" action="<?php echo "admin_permissions.$phpEx$SID&amp;mode=$mode"; ?>"><table cellspacing="2" cellpadding="0" border="0" align="center">
<tr>
- <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_allow"><?php echo $user->lang['ALL_ALLOW']; ?></option><option value="all_deny"><?php echo $user->lang['ALL_DENY']; ?></option><option value="all_inherit"><?php echo $user->lang['ALL_INHERIT']; ?></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
echo ($preset_options) ? '<option class="sep">' . $user->lang['USER_PRESETS'] . ' -&gt;' . '</option>' . $preset_options : '';
@@ -760,9 +870,9 @@ else if (!empty($forum_id) ||
<td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th>&nbsp;<?php echo $user->lang['OPTION']; ?>&nbsp;</th>
- <th>&nbsp;<?php echo $user->lang['ALLOW']; ?>&nbsp;</th>
- <th>&nbsp;<?php echo $user->lang['DENY']; ?>&nbsp;</th>
- <th>&nbsp;<?php echo $user->lang['INHERIT']; ?>&nbsp;</th>
+ <th width="50">&nbsp;<?php echo $user->lang['YES']; ?>&nbsp;</th>
+ <th width="50">&nbsp;<?php echo $user->lang['NO']; ?>&nbsp;</th>
+ <th width="50">&nbsp;<?php echo $user->lang['UNSET']; ?>&nbsp;</th>
</tr>
<?php
@@ -782,12 +892,12 @@ else if (!empty($forum_id) ||
{
$allow_type = (isset($auth_values[$auth_options[$i]['auth_value']]) && $auth_values[$auth_options[$i]['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : '';
$deny_type = (isset($auth_values[$auth_options[$i]['auth_value']]) && $auth_values[$auth_options[$i]['auth_value']] == ACL_DENY) ? ' checked="checked"' : '';
- $inherit_type = (empty($auth_values[$auth_options[$i]['auth_value']]) || $auth_values[$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : '';
+ $inherit_type = (!isset($auth_values[$auth_options[$i]['auth_value']]) || $auth_values[$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : '';
}
?>
<tr>
- <td class="<?php echo $row_class; ?>"><?php echo $l_can_cell; ?></td>
+ <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $l_can_cell; ?>&nbsp;</td>
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $auth_options[$i]['auth_value']; ?>]" value="<?php echo ACL_ALLOW; ?>"<?php echo $allow_type; ?> /></td>
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $auth_options[$i]['auth_value']; ?>]" value="<?php echo ACL_DENY; ?>"<?php echo $deny_type; ?> /></td>
<td class="<?php echo $row_class; ?>" align="center"><input type="radio" name="option[<?php echo $auth_options[$i]['auth_value']; ?>]" value="<?php echo ACL_INHERIT; ?>"<?php echo $inherit_type; ?> /></td>
@@ -805,12 +915,12 @@ else if (!empty($forum_id) ||
{
?>
<tr>
- <th colspan="4"><?php echo $user->lang['INHERITANCE']; ?></th>
+ <th colspan="4"><?php echo $user->lang['ACL_SUBFORUMS']; ?></th>
</tr>
<tr>
<td class="row1" colspan="4"><table width="100%" cellspacing="1" cellpadding="0" border="0">
<tr>
- <td colspan="4" height="16"><span class="gensmall"><?php echo $user->lang['INHERITANCE_EXPLAIN']; ?></span></td>
+ <td class="gensmall" colspan="4" height="16" align="center"><?php echo $user->lang['ACL_SUBFORUMS_EXPLAIN']; ?></td>
</tr>
<?php
foreach ($children as $row)
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a7f3589a87..ac15245922 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -955,7 +955,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
die("Unable to show notice, \$user class hasn't been instantiated yet.<br />Error triggered in: " . $errfile .":". $errline);
}
- if (empty($user->session_id))
+ if (empty($user->data))
{
$user->start();
}
@@ -996,6 +996,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
include($phpbb_root_path . 'includes/page_tail.' . $phpEx);
}
+ exit;
break;
}
}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 8977ffeebe..f8eadeafc2 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -20,7 +20,7 @@
***************************************************************************/
// Simple version of jumpbox, just lists authed forums
-function make_forum_select($forum_id = false, $ignore_forum = false, $add_select = true)
+function make_forum_select($forum_id = false, $ignore_forum = false, $add_select = false)
{
global $db, $user, $auth;
@@ -34,7 +34,7 @@ function make_forum_select($forum_id = false, $ignore_forum = false, $add_select
while ($row = $db->sql_fetchrow($result))
{
- if (!$auth->acl_gets('f_list', 'm_', 'a_', $row['forum_id']) || $row['forum_id'] == $ignore_forum)
+ if (!$auth->acl_get('f_list', $row['forum_id']) || $row['forum_id'] == $ignore_forum)
{
// if the user does not have permissions to list this forum skip
continue;
@@ -51,7 +51,7 @@ function make_forum_select($forum_id = false, $ignore_forum = false, $add_select
$right = $row['right_id'];
- $selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '';
+ $selected = (is_array($forum_id)) ? ((in_array($row['forum_id'], $forum_id)) ? ' selected="selected"' : '') : (($row['forum_id'] == $forum_id) ? ' selected="selected"' : '');
if ($row['left_id'] > $cat_right)
{
@@ -1117,7 +1117,8 @@ function cache_moderators()
{
case 'mysql':
case 'mysql4':
- $sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname) VALUES ' . implode(', ', preg_replace('#^(.*)$#', '(\1)', $m_sql));
+ $sql = 'INSERT INTO ' . MODERATOR_TABLE . ' (forum_id, user_id, username, group_id, groupname)
+ VALUES ' . implode(', ', preg_replace('#^(.*)$#', '(\1)', $m_sql));
$result = $db->sql_query($sql);
$db->sql_freeresult($result);
break;
@@ -1132,7 +1133,8 @@ function cache_moderators()
default:
foreach ($m_sql as $k => $sql)
{
- $result = $db->sql_query('INSERT INTO ' . MODERATOR_TABLE . " (forum_id, user_id, username, group_id, groupname) VALUES ($sql)");
+ $result = $db->sql_query('INSERT INTO ' . MODERATOR_TABLE . " (forum_id, user_id, username, group_id, groupname)
+ VALUES ($sql)");
$db->sql_freeresult($result);
}
}
@@ -1147,6 +1149,30 @@ class auth_admin extends auth
{
global $db;
+ // One or more forums
+ if (!is_array($forum_id))
+ {
+ $forum_id = array($forum_id);
+ }
+
+ // Obtain list of dependencies - WRONG
+/* $sql = 'SELECT auth_value, forum_id, auth_allow, auth_dep
+ FROM ' . ACL_DEPS_TABLE . '
+ WHERE forum_id IN (' . implode(', ', $forum_id) . ')
+ AND auth_value IN (' . implode(', ', preg_replace('#^(.*?)$#', "'\\1'", $auth)) . ')';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $row = unserialize($row['auth_dep']);
+ foreach ($row as $auth_value => $allow)
+ {
+ $auth[$auth_value] = $allow;
+ }
+ unset($row);
+ }
+ $db->sql_freeresult($result);
+*/
// Set any flags as required
foreach ($auth as $auth_value => $allow)
{
@@ -1167,11 +1193,6 @@ class auth_admin extends auth
}
$db->sql_freeresult($result);
- // One or more forums
- if (!is_array($forum_id))
- {
- $forum_id = array($forum_id);
- }
// NOTE THIS USED TO BE IN ($forum_id, 0) ...
$forum_sql = 'AND a.forum_id IN (' . implode(', ', $forum_id) . ')';
@@ -1366,12 +1387,12 @@ function add_log()
if ($mode == 'admin')
{
$sql = 'INSERT INTO ' . LOG_ADMIN_TABLE . ' (user_id, log_ip, log_time, log_operation, log_data)
- VALUES (' . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')";
+ VALUES (' . $user->data['user_id'] . ", '$user->ip', " . time() . ", '$action', '$data')";
}
else
{
$sql = 'INSERT INTO ' . LOG_MOD_TABLE . ' (user_id, forum_id, topic_id, log_ip, log_time, log_operation, log_data)
- VALUES (' . $user->data['user_id'] . ", $forum_id, $topic_id, '$user->ip', " . time() . ", '$action', '$data')";
+ VALUES (' . $user->data['user_id'] . ", $forum_id, $topic_id, '$user->ip', " . time() . ", '$action', '$data')";
}
$db->sql_query($sql);
@@ -1402,7 +1423,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
do
{
$log[$i]['id'] = $row['log_id'];
- $log[$i]['username'] = '<a href="admin_users.'.$phpEx . $SID . '&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>';
+ $log[$i]['username'] = '<a href="admin_users.' . $phpEx . $SID . '&amp;u=' . $row['user_id'] . '">' . $row['username'] . '</a>';
$log[$i]['ip'] = $row['log_ip'];
$log[$i]['time'] = $row['log_time'];
diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql
index 8fa39e3055..c33599cc55 100644
--- a/phpBB/install/schemas/mysql_basic.sql
+++ b/phpBB/install/schemas/mysql_basic.sql
@@ -184,7 +184,7 @@ INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_sendpm', 1);
INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_viewonline', 1);
INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_viewprofile', 1);
INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_chgavatar', 1);
-INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_chgcolor', 1);
+INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_chggrp', 1);
INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_chgemail', 1);
INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_chgname', 1);
INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('u_chgpasswd', 1);
diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql
index 35f8a6d2bd..78c1fb4442 100644
--- a/phpBB/install/schemas/mysql_schema.sql
+++ b/phpBB/install/schemas/mysql_schema.sql
@@ -45,11 +45,14 @@ CREATE TABLE phpbb_attach_desc (
# Table structure for table `phpbb_auth_dependencies`
#
CREATE TABLE phpbb_auth_dependencies (
- auth_value varchar(20) NOT NULL default '',
+ dep_id tinyint(4) UNSIGNED NOT NULL auto_increment,
+ dep_name varchar(50) NOT NULL DEFAULT '',
+ auth_value text NOT NULL,
auth_allow tinyint(1) NOT NULL default '2',
- forum_id int(11) NOT NULL default '0',
- auth_deps text NOT NULL default '',
- PRIMARY KEY (auth_value)
+ forum_id text NOT NULL,
+ auth_deps text NOT NULL,
+ PRIMARY KEY (dep_id),
+ KEY dep_name (dep_name)
);
diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php
index 5acfacbe7d..0ab5636d8e 100644
--- a/phpBB/language/en/lang_admin.php
+++ b/phpBB/language/en/lang_admin.php
@@ -199,7 +199,7 @@ $lang = array_merge($lang, array(
'Restore_Error_no_file' => 'No file was uploaded',
- 'ACL_EXPLAIN' => 'Permissions are based on an ALLOW / INHERIT / DENY system with all options being denied by default. The precedent is DENY &gt; ALLOW &gt; INHERIT for any combination of user or group settings. The INHERIT setting causes permissions granted elsewhere for the option being used in place of a specific ALLOW / DENY setting here.',
+ 'ACL_EXPLAIN' => 'Permissions are based on a simple YES / NO system. Setting an option to NO for a user or usergroup overrides any other value assigned to it. If you do not wish to assign a value for an option for this user or group select UNSET. If values are assigned for this option elsewhere they will be used in preference, else NO is assumed.',
'PERMISSIONS_EXPLAIN' => 'Here you can alter which users and groups can access which forums. To assign moderators or define administrators please use the appropriate page (see left hand side menu).',
'MODERATORS' => 'Moderators',
'MODERATORS_EXPLAIN' => 'Here you can assign users and groups as forum moderators. To assign users access to forums, to define super moderators or administrators please use the appropriate page (see left hand side menu).',
@@ -225,108 +225,111 @@ $lang = array_merge($lang, array(
'REMOVE_SELECTED' => 'Remove selected',
'SET_OPTIONS' => 'Set Options',
'OPTION' => 'Option',
- 'ALLOW' => 'Allow',
- 'INHERIT' => 'Inherit',
- 'DENY' => 'Deny',
+ 'YES' => 'Yes',
+ 'NO' => 'No',
+ 'UNSET' => 'Unset',
'PRESETS' => 'Presets',
- 'ALL_ALLOW' => 'All Allow',
- 'ALL_DENY' => 'All Deny',
- 'ALL_INHERIT' => 'All Inherit',
+ 'ALL_YES' => 'All Yes',
+ 'ALL_NO' => 'All No',
+ 'ALL_UNSET' => 'All Unset',
'USER_PRESETS' => 'User presets',
- 'INHERIT_PARENT'=> 'From Parent',
- 'INHERITANCE' => 'Inheritance',
- 'INHERITANCE_EXPLAIN' => 'Select the subforums you want to inherit these permissions',
+ 'FROM_PARENT' => 'From Parent',
+ 'ACL_SUBFORUMS' => 'Assign to sub-forums',
+ 'ACL_SUBFORUMS_EXPLAIN' => 'Select the subforums (if any) you want to inherit these permissions',
'PRESETS_EXPLAIN' => 'To update or delete an existing preset select it from the list.',
'SELECT_PRESET' => 'Select preset',
'PRESET_NAME' => 'Preset name',
'EMPTY' => 'Empty',
+ 'QUICK ACCESS' => 'Quick access',
+
'AUTH_UPDATED' => 'Permissions have been updated',
- 'acl_a_server' => 'Alter Server/Email Settings',
- 'acl_a_defaults' => 'Alter Board Defaults',
- 'acl_a_board' => 'Alter Board Settings',
- 'acl_a_cookies' => 'Alter Cookie Settings',
- 'acl_a_names' => 'Alter Disallowed Names',
- 'acl_a_words' => 'Alter Word Censors',
- 'acl_a_icons' => 'Alter Topic Icons/Emoticons',
- 'acl_a_search' => 'Re-index Search Tables',
- 'acl_a_prune' => 'Prune Forums',
- 'acl_a_bbcode' => 'Define BBCode Tags',
- 'acl_a_attach' => 'Manage Attachments',
- 'acl_a_events' => 'Manage User/Group Events',
- 'acl_a_ranks' => 'Manage Ranks',
- 'acl_a_user' => 'Manage Users',
- 'acl_a_userdel' => 'Delete/Prune Users',
- 'acl_a_useradd' => 'Add New Users',
- 'acl_a_group' => 'Manage Groups',
- 'acl_a_groupdel' => 'Delete Groups',
- 'acl_a_groupadd' => 'Add New Groups',
- 'acl_a_forum' => 'Manage Forums',
- 'acl_a_forumdel' => 'Delete Forums',
- 'acl_a_forumadd' => 'Add New Forums',
- 'acl_a_ban' => 'Manage Bans',
- 'acl_a_auth' => 'Alter Forum Permissions',
- 'acl_a_authmods' => 'Alter Moderator Permissions',
- 'acl_a_authadmins' => 'Alter Admin Permissions',
- 'acl_a_authusers' => 'Alter User Permissions',
- 'acl_a_authgroups' => 'Alter Group Permissions',
- 'acl_a_email' => 'Mass Email',
- 'acl_a_styles' => 'Manage Styles',
- 'acl_a_backup' => 'Backup Database',
- 'acl_a_restore' => 'Restore Database',
- 'acl_a_clearlogs' => 'Clear Admin/Mod Logs',
- 'acl_a_events' => 'Use Event system',
- 'acl_a_cron' => 'Use Cron system',
- 'acl_a_authdeps' => 'Set ACL Dependencies',
-
- 'acl_m_edit' => 'Edit posts',
- 'acl_m_delete' => 'Delete posts',
- 'acl_m_move' => 'Move posts',
- 'acl_m_lock' => 'Lock topics',
- 'acl_m_split' => 'Split topics',
- 'acl_m_merge' => 'Merge topics',
- 'acl_m_approve' => 'Approve posts',
- 'acl_m_unrate' => 'Un-rate topics',
- 'acl_m_auth' => 'Set permissions',
- 'acl_m_ip' => 'View IP\'s',
-
- 'acl_f_list' => 'See forum',
- 'acl_f_read' => 'Read forum',
- 'acl_f_post' => 'Post in forum',
- 'acl_f_reply' => 'Reply to posts',
- 'acl_f_edit' => 'Edit own posts',
- 'acl_f_delete' => 'Delete own posts',
- 'acl_f_poll' => 'Create polls',
- 'acl_f_vote' => 'Vote in polls',
- 'acl_f_announce' => 'Post announcements',
- 'acl_f_sticky' => 'Post stickies',
- 'acl_f_attach' => 'Attach files',
- 'acl_f_download' => 'Download files',
- 'acl_f_html' => 'Post HTML',
- 'acl_f_bbcode' => 'Post BBCode',
- 'acl_f_smilies' => 'Post smilies',
- 'acl_f_img' => 'Post images',
- 'acl_f_flash' => 'Post Flash',
- 'acl_f_sigs' => 'Use signatures',
- 'acl_f_search' => 'Search the forum',
- 'acl_f_email' => 'Email topics',
- 'acl_f_rate' => 'Rate topics',
- 'acl_f_print' => 'Print topics',
- 'acl_f_ignoreflood' => 'Ignore flood limit',
- 'acl_f_ignorequeue' => 'Ignore mod queue',
+ 'acl_a_server' => 'Can alter server and email settings',
+ 'acl_a_defaults' => 'Can alter board defaults',
+ 'acl_a_board' => 'Can alter board settings',
+ 'acl_a_cookies' => 'Can alter cookie settings',
+ 'acl_a_names' => 'Can alter disallowed names',
+ 'acl_a_words' => 'Can alter word censors',
+ 'acl_a_icons' => 'Can alter topic icons and emoticons',
+ 'acl_a_search' => 'Can re-index search tables',
+ 'acl_a_prune' => 'Can prune forums',
+ 'acl_a_bbcode' => 'Can define BBCode tags',
+ 'acl_a_attach' => 'Can manage attachments',
+ 'acl_a_ranks' => 'Can manage ranks',
+ 'acl_a_user' => 'Can manage users',
+ 'acl_a_userdel' => 'Can delete or prune users',
+ 'acl_a_useradd' => 'Can add new users',
+ 'acl_a_group' => 'Can manage groups',
+ 'acl_a_groupdel' => 'Can delete groups',
+ 'acl_a_groupadd' => 'Can add new groups',
+ 'acl_a_forum' => 'Can manage forums',
+ 'acl_a_forumdel' => 'Can delete forums',
+ 'acl_a_forumadd' => 'Can add new forums',
+ 'acl_a_ban' => 'Can manage bans',
+ 'acl_a_auth' => 'Can alter forum permissions',
+ 'acl_a_authmods' => 'Can alter moderator permissions',
+ 'acl_a_authadmins' => 'Can alter admin permissions',
+ 'acl_a_authusers' => 'Can alter user permissions',
+ 'acl_a_authgroups' => 'Can alter group permissions',
+ 'acl_a_email' => 'Can send mass email',
+ 'acl_a_styles' => 'Can manage styles',
+ 'acl_a_backup' => 'Can backup database',
+ 'acl_a_restore' => 'Can restore database',
+ 'acl_a_clearlogs' => 'Can clear admin and mod logs',
+ 'acl_a_events' => 'Can use event system',
+ 'acl_a_cron' => 'Can use cron system',
+ 'acl_a_authdeps' => 'Can set dependencies',
+
+ 'acl_m_edit' => 'Can edit posts',
+ 'acl_m_delete' => 'Can delete posts',
+ 'acl_m_move' => 'Can move topics',
+ 'acl_m_lock' => 'Can lock topics',
+ 'acl_m_split' => 'Can split topics',
+ 'acl_m_merge' => 'Can merge topics',
+ 'acl_m_approve' => 'Can approve posts',
+ 'acl_m_unrate' => 'Can un-rate posts',
+ 'acl_m_auth' => 'Can set permissions',
+ 'acl_m_ip' => 'Can view IP\'s',
+
+ 'acl_f_list' => 'Can see forum',
+ 'acl_f_read' => 'Can read forum',
+ 'acl_f_post' => 'Can post in forum',
+ 'acl_f_reply' => 'Can reply to posts',
+ 'acl_f_quote' => 'Can quote posts',
+ 'acl_f_edit' => 'Can edit own posts',
+ 'acl_f_delete' => 'Can delete own posts',
+ 'acl_f_poll' => 'Can create polls',
+ 'acl_f_vote' => 'Can vote in polls',
+ 'acl_f_announce' => 'Can post announcements',
+ 'acl_f_sticky' => 'Can post stickies',
+ 'acl_f_attach' => 'Can attach files',
+ 'acl_f_download' => 'Can download files',
+ 'acl_f_html' => 'Can post HTML',
+ 'acl_f_bbcode' => 'Can post BBCode',
+ 'acl_f_smilies' => 'Can post smilies',
+ 'acl_f_img' => 'Can post images',
+ 'acl_f_flash' => 'Can post Flash',
+ 'acl_f_sigs' => 'Can use signatures',
+ 'acl_f_search' => 'Can search the forum',
+ 'acl_f_email' => 'Can email topics',
+ 'acl_f_rate' => 'Can rate posts',
+ 'acl_f_report' => 'Can report posts',
+ 'acl_f_print' => 'Can print topics',
+ 'acl_f_ignoreflood' => 'Can ignore flood limit',
'acl_f_postcount' => 'Increment post counter',
-
- 'acl_u_viewonline' => 'View all online',
- 'acl_u_viewprofile' => 'View profiles',
- 'acl_u_sendemail' => 'Send emails',
- 'acl_u_sendpm' => 'Send messages',
- 'acl_u_readpm' => 'Read messages',
- 'acl_u_chgavatar' => 'Change avatar',
- 'acl_u_chgcolor' => 'Change colour',
- 'acl_u_chgemail' => 'Change email address',
- 'acl_u_chgname' => 'Change username',
- 'acl_u_chgpasswd' => 'Change password',
- 'acl_u_search' => 'Search board',
+ 'acl_f_moderate' => 'Posts are moderated',
+
+ 'acl_u_viewonline' => 'Can view all online',
+ 'acl_u_viewprofile' => 'Can view profiles',
+ 'acl_u_sendemail' => 'Can send emails',
+ 'acl_u_sendpm' => 'Can send messages',
+ 'acl_u_readpm' => 'Can read messages',
+ 'acl_u_chgavatar' => 'Can change avatar',
+ 'acl_u_chgcolor' => 'Can change default group',
+ 'acl_u_chgemail' => 'Can change email address',
+ 'acl_u_chgname' => 'Can change username',
+ 'acl_u_chgpasswd' => 'Can change password',
+ 'acl_u_search' => 'Can search board',
'Prune_users' => 'Prune Users',