1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- sperate permissions from sessions

- added some comments to the auth class for better understanding
- revised some permission functions
- added option to negate permission check by prefixing option with a ! (for example checking for !f_read returns true if user is not able to read forum)
- used the new option for testing in ucp front


git-svn-id: file:///svn/phpbb/trunk@5423 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-01-04 07:51:04 +00:00
parent 17dc26e19b
commit d23a07dc7d
7 changed files with 496 additions and 383 deletions

View File

@@ -53,23 +53,15 @@ class ucp_main
$folder = 'folder_announce';
$folder_new = $folder . '_new';
// Determine first forum the user is able to read into - for global announcement link
$forum_ary = $auth->acl_getf('f_read');
$g_forum_id = 0;
foreach ($forum_ary as $forum_id => $allowed)
{
if (!$allowed['f_read'])
{
unset($forum_ary[$forum_id]);
}
}
// Get cleaned up list... return only those forums not having the f_read permission
$forum_ary = $auth->acl_getf('!f_read', true);
$forum_ary = array_unique(array_keys($forum_ary));
// Determine first forum the user is able to read into - for global announcement link
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST . '
AND forum_id IN (' . implode(', ', $forum_ary) . ')';
AND forum_id NOT IN (' . implode(', ', $forum_ary) . ')';
$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id', 0, $result);
$db->sql_freeresult($result);
@@ -140,19 +132,20 @@ class ucp_main
);
}
$post_count_ary = $auth->acl_getf('f_postcount');
$post_count_ary = $auth->acl_getf('!f_postcount');
$forum_read_ary = $auth->acl_getf('!f_read');
$forum_ary = array();
foreach ($post_count_ary as $forum_id => $allowed)
{
if ($allowed['f_read'] && $allowed['f_postcount'])
if ($allowed['f_postcount'] || $forum_read_ary[$forum_id]['f_read'])
{
$forum_ary[] = $forum_id;
}
}
$post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id IN (' . implode(', ', $forum_ary) . ')' : '';
unset($forum_ary, $post_count_ary);
$post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id NOT IN (' . implode(', ', $forum_ary) . ')' : '';
unset($forum_ary, $post_count_ary, $forum_read_ary);
if ($post_count_sql)
{