1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-04 07:47:34 +02:00

- ability to change anonymous user settings more easily

- fix serious bugs in permissions (always allowing if permissions explicitly set and getting wrong permission options from bitfield)
- added option for returning an array to make_forum_select
- again fixing bugs in module system (one for a very query consuming part and one for correctly filling the cache)


git-svn-id: file:///svn/phpbb/trunk@5517 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-02-03 20:59:39 +00:00
parent dd865bb517
commit bd30d226a5
8 changed files with 141 additions and 493 deletions

View File

@@ -75,22 +75,31 @@ class p_master
$this->module_cache['modules'] = array();
while ($row = $db->sql_fetchrow($result))
{
// Only add if we are allowed to view this module...
if (!$this->module_auth($row['module_auth']))
{
continue;
}
$this->module_cache['modules'][] = $row;
}
$db->sql_freeresult($result);
// Get module parents
$this->module_cache['parents'] = array();
// We pre-get all parents due to the huge amount of queries required if we do not do so. ;)
$sql = 'SELECT module_id, parent_id, left_id, right_id
FROM ' . MODULES_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
$parents = array();
while ($row = $db->sql_fetchrow($result))
{
$parents[$row['module_id']] = $row;
}
$db->sql_freeresult($result);
foreach ($this->module_cache['modules'] as $row)
{
$this->module_cache['parents'][$row['module_id']] = $this->get_parents($row['parent_id'], $row['left_id'], $row['right_id']);
$this->module_cache['parents'][$row['module_id']] = $this->get_parents($row['parent_id'], $row['left_id'], $row['right_id'], $parents);
}
unset($parents);
$file = '<?php $this->module_cache=' . $cache->format_array($this->module_cache) . "; ?>";
@@ -113,6 +122,7 @@ class p_master
// Not allowed to view module?
if (!$this->module_auth($row['module_auth']))
{
unset($this->module_cache['modules'][$key]);
continue;
}
@@ -336,7 +346,7 @@ class p_master
}
}
function get_parents($parent_id, $left_id, $right_id)
function get_parents($parent_id, $left_id, $right_id, &$all_parents)
{
global $db;
@@ -344,19 +354,18 @@ class p_master
if ($parent_id > 0)
{
$sql = 'SELECT module_id, parent_id
FROM ' . MODULES_TABLE . '
WHERE left_id < ' . $left_id . '
AND right_id > ' . $right_id . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
$parents = array();
while ($row = $db->sql_fetchrow($result))
foreach ($all_parents as $module_id => $row)
{
$parents[$row['module_id']] = $row['parent_id'];
if ($row['left_id'] < $left_id && $row['right_id'] > $right_id)
{
$parents[$module_id] = $row['parent_id'];
}
if ($row['left_id'] > $left_id)
{
break;
}
}
$db->sql_freeresult($result);
}
return $parents;