mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
gurgle blurp ... make some more changes, blurp, gurgle, move discover_auth to auth class as acl_get_list method, blurp gurgle blurp
git-svn-id: file:///svn/phpbb/trunk@4661 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -210,70 +210,6 @@ function get_moderators(&$forum_moderators, $forum_id = false)
|
||||
return;
|
||||
}
|
||||
|
||||
function discover_auth($user_id = false, $opts = false, $forum_id = false)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql_user = ($user_id) ? ((!is_array($user_id)) ? "user_id = $user_id" : 'user_id IN (' . implode(', ', $user_id) . ')') : '';
|
||||
$sql_forum = ($forum_id) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND a.forum_id IN (' . implode(', ', $forum_id) . ')') : '';
|
||||
$sql_opts = ($opts) ? ((!is_array($opts)) ? "AND ao.auth_option = '$opts'" : 'AND ao.auth_option IN (' . implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . $db->sql_escape('\\1') . \"'\"", $opts)) . ')') : '';
|
||||
|
||||
$hold_ary = array();
|
||||
// First grab user settings ... each user has only one setting for each
|
||||
// option ... so we shouldn't need any ACL_NO checks ... he says ...
|
||||
$sql = 'SELECT ao.auth_option, a.user_id, a.forum_id, a.auth_setting
|
||||
FROM ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_USERS_TABLE . ' a
|
||||
WHERE ao.auth_option_id = a.auth_option_id
|
||||
' . (($sql_user) ? 'AND a.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts
|
||||
ORDER BY a.forum_id, ao.auth_option";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $row['auth_setting'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Now grab group settings ... ACL_NO overrides ACL_YES so act appropriatley
|
||||
$sql = 'SELECT ug.user_id, ao.auth_option, a.forum_id, a.auth_setting
|
||||
FROM ' . USER_GROUP_TABLE . ' ug, ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_GROUPS_TABLE . ' a
|
||||
WHERE ao.auth_option_id = a.auth_option_id
|
||||
AND a.group_id = ug.group_id
|
||||
' . (($sql_user) ? 'AND ug.' . $sql_user : '') . "
|
||||
$sql_forum
|
||||
$sql_opts
|
||||
ORDER BY a.forum_id, ao.auth_option";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (!isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) || (isset($hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']]) && $hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] != ACL_NO))
|
||||
{
|
||||
$hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $row['auth_setting'];
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$auth_ary = array();
|
||||
foreach ($hold_ary as $user_id => $forum_ary)
|
||||
{
|
||||
foreach ($forum_ary as $forum_id => $auth_option_ary)
|
||||
{
|
||||
foreach ($auth_option_ary as $auth_option => $auth_setting)
|
||||
{
|
||||
if ($auth_setting == ACL_YES)
|
||||
{
|
||||
$auth_ary[$forum_id][$auth_option][] = $user_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $auth_ary;
|
||||
}
|
||||
|
||||
// User authorisation levels output
|
||||
function gen_forum_rules($mode, &$forum_id)
|
||||
{
|
||||
|
Reference in New Issue
Block a user