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
This commit is contained in:
Meik Sievertsen 2007-07-12 08:55:38 +00:00
parent f27d0c466e
commit 48d88164e1
2 changed files with 32 additions and 0 deletions

View file

@ -214,6 +214,7 @@ p a {
<li>[Fix] Make sure selected transfer method exists before calling (Bug #13265)</li> <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 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] 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 &quot;crazy&quot;</li>
</ul> </ul>

View file

@ -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); $hold_str = $this->build_bitstring($hold_ary);
if ($hold_str) if ($hold_str)