diff options
Diffstat (limited to 'phpBB')
-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) |