1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-17 14:18:24 +01:00

Merge remote-tracking branch 'p/task/php54-ascraeus' into develop

* p/task/php54-ascraeus:
  [task/php54-ascraeus] Bring p_master#module_auth into PHP 5 era.
This commit is contained in:
Andreas Fischer 2012-03-22 10:56:07 +01:00
commit 89f988ecdd
2 changed files with 18 additions and 6 deletions

View File

@ -128,7 +128,7 @@ class acp_users
$dropdown_modes = array();
while ($row = $db->sql_fetchrow($result))
{
if (!$this->p_master->module_auth($row['module_auth']))
if (!$this->p_master->module_auth_self($row['module_auth']))
{
continue;
}

View File

@ -128,7 +128,7 @@ class p_master
foreach ($this->module_cache['modules'] as $key => $row)
{
// Not allowed to view module?
if (!$this->module_auth($row['module_auth']))
if (!$this->module_auth_self($row['module_auth']))
{
unset($this->module_cache['modules'][$key]);
continue;
@ -315,9 +315,23 @@ class p_master
}
/**
* Check module authorisation
* Check module authorisation.
*
* This is a non-static version that uses $this->acl_forum_id
* for the forum id.
*/
function module_auth($module_auth, $forum_id = false)
function module_auth_self($module_auth)
{
return self::module_auth($module_auth, $this->acl_forum_id);
}
/**
* Check module authorisation.
*
* This is a static version, it must be given $forum_id.
* See also module_auth_self.
*/
static function module_auth($module_auth, $forum_id)
{
global $auth, $config;
global $request;
@ -365,8 +379,6 @@ class p_master
// Make sure $id seperation is working fine
$module_auth = str_replace(' , ', ',', $module_auth);
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
$is_auth = false;
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '$request->variable(\'\\1\', false)'), $module_auth) . ');');