diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-03-16 04:56:41 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-03-16 04:56:41 -0400 |
commit | ccdd176b72250be2e8f72bd13147679a5f2a263b (patch) | |
tree | df803fcb2b0eb75837c593db8b2b2c353a7a507b /phpBB/includes/functions_module.php | |
parent | 7dfb8d7c2022669087b3ed0ba7871b8346e5a6dd (diff) | |
download | forums-ccdd176b72250be2e8f72bd13147679a5f2a263b.tar forums-ccdd176b72250be2e8f72bd13147679a5f2a263b.tar.gz forums-ccdd176b72250be2e8f72bd13147679a5f2a263b.tar.bz2 forums-ccdd176b72250be2e8f72bd13147679a5f2a263b.tar.xz forums-ccdd176b72250be2e8f72bd13147679a5f2a263b.zip |
[task/php54-ascraeus] Bring p_master#module_auth into PHP 5 era.
Split module_auth into a static and a non-static version.
Call the static version statically and the non-static version non-statically.
PHPBB3-10615
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r-- | phpBB/includes/functions_module.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index db7defdc48..1c1bc42a11 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -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_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. */ - function module_auth($module_auth, $forum_id = false) + 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) . ');'); |