diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index c648fdf100..088f2f24dd 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -61,8 +61,8 @@ $template->set_custom_style(array( ), ), $phpbb_admin_path . 'style'); -$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); -$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); +$template->assign_var('T_ASSETS_PATH', $phpbb_path_helper->update_web_root_path($phpbb_root_path . 'assets')); +$template->assign_var('T_TEMPLATE_PATH', $phpbb_path_helper->update_web_root_path($phpbb_root_path . 'style')); // Instantiate new module $module = new p_master(); diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php index 7112412ec3..bcfb738144 100644 --- a/phpBB/phpbb/path_helper.php +++ b/phpBB/phpbb/path_helper.php @@ -39,6 +39,9 @@ class path_helper /** @var string */ protected $web_root_path; + /** @var bool Flag whether we're in adm path */ + protected $in_adm_path = false; + /** * Constructor * @@ -117,7 +120,13 @@ class path_helper $path = substr($path, 8); } - return $this->filesystem->clean_path($web_root_path . $path); + $path = $this->filesystem->clean_path($web_root_path . $path); + + // Further clean path if we're in adm + if ($this->in_adm_path && strpos($path, $this->phpbb_root_path . $this->adm_relative_path) === 0) + { + $path = substr($path, strlen($this->phpbb_root_path . $this->adm_relative_path)); + } } return $path; @@ -181,6 +190,11 @@ class path_helper return $this->web_root_path = $this->filesystem->clean_path('./../' . $this->phpbb_root_path); } + if ($path_info === '/' && defined('ADMIN_START') && preg_match('/\/' . preg_quote($this->adm_relative_path, '/') . 'index\.' . $this->php_ext . '$/', $script_name)) + { + $this->in_adm_path = true; + } + /* * If the path info is empty (single /), then we're not using * a route like app.php/foo/bar