diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
commit | 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch) | |
tree | 3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/includes/functions_module.php | |
parent | 91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff) | |
download | forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.gz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.bz2 forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.xz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.zip |
ok... i hope i haven't messed too much with the code and everything is still working.
Changes:
- Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed.
- A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added.
git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r-- | phpBB/includes/functions_module.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index f4ee454033..c1d04cf245 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -44,8 +44,7 @@ class p_master */ function list_modules($p_class) { - global $auth, $db, $user, $cache; - global $config, $phpbb_root_path, $phpEx; + global $auth, $db, $user, $cache, $config; // Sanitise for future path use, it's escaped as appropriate for queries $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); @@ -393,9 +392,9 @@ class p_master */ function load_active($mode = false, $module_url = false, $execute_module = true) { - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user; + global $user; - $module_path = $phpbb_root_path . 'includes/' . $this->p_class; + $module_path = PHPBB_ROOT_PATH . 'includes/' . $this->p_class; $icat = request_var('icat', ''); if ($this->active_module === false) @@ -405,16 +404,16 @@ class p_master if (!class_exists("{$this->p_class}_$this->p_name")) { - if (!file_exists("$module_path/{$this->p_class}_$this->p_name.$phpEx")) + if (!file_exists("$module_path/{$this->p_class}_$this->p_name." . PHP_EXT)) { - trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name.$phpEx", E_USER_ERROR); + trigger_error("Cannot find module $module_path/{$this->p_class}_$this->p_name." . PHP_EXT, E_USER_ERROR); } - include("$module_path/{$this->p_class}_$this->p_name.$phpEx"); + include("$module_path/{$this->p_class}_$this->p_name." . PHP_EXT); if (!class_exists("{$this->p_class}_$this->p_name")) { - trigger_error("Module file $module_path/{$this->p_class}_$this->p_name.$phpEx does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); + trigger_error("Module file $module_path/{$this->p_class}_$this->p_name." . PHP_EXT . " does not contain correct class [{$this->p_class}_$this->p_name]", E_USER_ERROR); } if (!empty($mode)) @@ -438,7 +437,7 @@ class p_master } // Not being able to overwrite ;) - $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + $this->module->u_action = append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; } else { @@ -449,7 +448,7 @@ class p_master } else { - $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; + $this->module->u_action = PHPBB_ROOT_PATH . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; } $this->module->u_action = append_sid($this->module->u_action, "i={$this->p_name}") . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; @@ -816,7 +815,7 @@ class p_master */ function add_mod_info($module_class) { - global $user, $phpEx; + global $user; if (file_exists($user->lang_path . 'mods')) { @@ -828,9 +827,9 @@ class p_master { while (($entry = readdir($dir)) !== false) { - if (strpos($entry, 'info_' . strtolower($module_class) . '_') === 0 && substr(strrchr($entry, '.'), 1) == $phpEx) + if (strpos($entry, 'info_' . strtolower($module_class) . '_') === 0 && substr(strrchr($entry, '.'), 1) == PHP_EXT) { - $add_files[] = 'mods/' . substr(basename($entry), 0, -(strlen($phpEx) + 1)); + $add_files[] = 'mods/' . substr(basename($entry), 0, -(strlen(PHP_EXT) + 1)); } } closedir($dir); |