diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2007-07-12 08:55:38 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-07-12 08:55:38 +0000 |
commit | 48d88164e19fd81b849490d827dc5f43615171cb (patch) | |
tree | 63b52be679f5517d63357a68e3667986690cb28a | |
parent | f27d0c466e54e95aa1400e0435b78a8f7465256f (diff) | |
download | forums-48d88164e19fd81b849490d827dc5f43615171cb.tar forums-48d88164e19fd81b849490d827dc5f43615171cb.tar.gz forums-48d88164e19fd81b849490d827dc5f43615171cb.tar.bz2 forums-48d88164e19fd81b849490d827dc5f43615171cb.tar.xz forums-48d88164e19fd81b849490d827dc5f43615171cb.zip |
do not consider permissions the admin is not able to change, track or see.
git-svn-id: file:///svn/phpbb/trunk@7873 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
-rw-r--r-- | phpBB/includes/auth.php | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index a023137ee2..6255ff1e05 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -214,6 +214,7 @@ p a { <li>[Fix] Make sure selected transfer method exists before calling (Bug #13265)</li> <li>[Fix] Correctly escape language keys in language editor (Bug #13279)</li> <li>[Fix] Correctly hide post/reply buttons if permissions are not given (related to Bug #12809)</li> + <li>[Fix] Remove orphan/wrong permission entries for non-existent forums - self-repairing permissions if conversions went "crazy"</li> </ul> diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 76d6036c77..389fe99bdb 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -345,6 +345,37 @@ class auth } } + // Sometimes, it can happen $hold_ary holding forums which do not exist. + // Since this function is not called that often (we are caching the data) we check for this inconsistency. + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', array_keys($hold_ary)); + $result = $db->sql_query($sql); + + $forum_ids = (isset($hold_ary[0])) ? array(0) : array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Now determine forums which do not exist and remove the unneeded information (for modding purposes it is clearly the wrong place. ;)) + $missing_forums = array_diff(array_keys($hold_ary), $forum_ids); + + if (sizeof($missing_forums)) + { + foreach ($missing_forums as $forum_id) + { + unset($hold_ary[$forum_id]); + } + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $missing_forums); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $missing_forums); + $db->sql_query($sql); + } + $hold_str = $this->build_bitstring($hold_ary); if ($hold_str) |