aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-01-04 07:51:04 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-01-04 07:51:04 +0000
commitd23a07dc7dc4248180d451bce584a47f7defd737 (patch)
treeb7c3197adfe26378bb4c62a318755c63793f236c /phpBB/includes/ucp
parent17dc26e19b1738ccb3a2c8bb4b3757168cf9eabd (diff)
downloadforums-d23a07dc7dc4248180d451bce584a47f7defd737.tar
forums-d23a07dc7dc4248180d451bce584a47f7defd737.tar.gz
forums-d23a07dc7dc4248180d451bce584a47f7defd737.tar.bz2
forums-d23a07dc7dc4248180d451bce584a47f7defd737.tar.xz
forums-d23a07dc7dc4248180d451bce584a47f7defd737.zip
- 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
Diffstat (limited to 'phpBB/includes/ucp')
-rw-r--r--phpBB/includes/ucp/ucp_main.php25
1 files changed, 9 insertions, 16 deletions
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 2ade45c779..8bc98adb3d 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -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)
{