aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/routing
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/routing')
-rw-r--r--phpBB/phpbb/routing/helper.php11
-rw-r--r--phpBB/phpbb/routing/router.php31
2 files changed, 20 insertions, 22 deletions
diff --git a/phpBB/phpbb/routing/helper.php b/phpBB/phpbb/routing/helper.php
index f56974a354..c15608dce5 100644
--- a/phpBB/phpbb/routing/helper.php
+++ b/phpBB/phpbb/routing/helper.php
@@ -104,6 +104,15 @@ class helper
$context = new RequestContext();
$context->fromRequest($this->symfony_request);
+ if ($this->config['force_server_vars'])
+ {
+ $context->setHost($this->config['server_name']);
+ $context->setScheme(substr($this->config['server_protocol'], 0, -3));
+ $context->setHttpPort($this->config['server_port']);
+ $context->setHttpsPort($this->config['server_port']);
+ $context->setBaseUrl(rtrim($this->config['script_path'], '/'));
+ }
+
$script_name = $this->symfony_request->getScriptName();
$page_name = substr($script_name, -1, 1) == '/' ? '' : utf8_basename($script_name);
@@ -119,7 +128,7 @@ class helper
$base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
// We need to update the base url to move to the directory of the app.php file if the current script is not app.php
- if ($page_name !== 'app.php')
+ if ($page_name !== 'app.php' && !$this->config['force_server_vars'])
{
if (empty($this->config['enable_mod_rewrite']))
{
diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php
index 5d237b6433..f19886fb0b 100644
--- a/phpBB/phpbb/routing/router.php
+++ b/phpBB/phpbb/routing/router.php
@@ -49,13 +49,6 @@ class router implements RouterInterface
protected $loader;
/**
- * phpBB root path
- *
- * @var string
- */
- protected $phpbb_root_path;
-
- /**
* PHP file extensions
*
* @var string
@@ -63,13 +56,6 @@ class router implements RouterInterface
protected $php_ext;
/**
- * Name of the current environment
- *
- * @var string
- */
- protected $environment;
-
- /**
* @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface|null
*/
protected $matcher;
@@ -90,24 +76,27 @@ class router implements RouterInterface
protected $route_collection;
/**
+ * @var string
+ */
+ protected $cache_dir;
+
+ /**
* Construct method
*
* @param ContainerInterface $container DI container
* @param resources_locator_interface $resources_locator Resources locator
* @param LoaderInterface $loader Resources loader
- * @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP file extension
- * @param string $environment Name of the current environment
+ * @param string $cache_dir phpBB cache directory
*/
- public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $phpbb_root_path, $php_ext, $environment)
+ public function __construct(ContainerInterface $container, resources_locator_interface $resources_locator, LoaderInterface $loader, $php_ext, $cache_dir)
{
$this->container = $container;
$this->resources_locator = $resources_locator;
$this->loader = $loader;
- $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
- $this->environment = $environment;
$this->context = new RequestContext();
+ $this->cache_dir = $cache_dir;
}
/**
@@ -211,7 +200,7 @@ class router implements RouterInterface
{
try
{
- $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_matcher.{$this->php_ext}", defined('DEBUG'));
+ $cache = new ConfigCache("{$this->cache_dir}url_matcher.{$this->php_ext}", defined('DEBUG'));
if (!$cache->isFresh())
{
$dumper = new PhpMatcherDumper($this->get_routes());
@@ -266,7 +255,7 @@ class router implements RouterInterface
{
try
{
- $cache = new ConfigCache("{$this->phpbb_root_path}cache/{$this->environment}/url_generator.{$this->php_ext}", defined('DEBUG'));
+ $cache = new ConfigCache("{$this->cache_dir}url_generator.{$this->php_ext}", defined('DEBUG'));
if (!$cache->isFresh())
{
$dumper = new PhpGeneratorDumper($this->get_routes());