aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/controller/helper.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-09-04 16:45:53 +0200
committerTristan Darricau <github@nicofuma.fr>2014-09-04 23:21:55 +0200
commitcb3eb84665db10e6fe55e11e694d39e742f313a4 (patch)
tree436bb37e278805f1dafc7ca95c82fbd93ceef8e6 /phpBB/phpbb/controller/helper.php
parent10c99b3c2b92206840e6c3048fea4bd273f53472 (diff)
downloadforums-cb3eb84665db10e6fe55e11e694d39e742f313a4.tar
forums-cb3eb84665db10e6fe55e11e694d39e742f313a4.tar.gz
forums-cb3eb84665db10e6fe55e11e694d39e742f313a4.tar.bz2
forums-cb3eb84665db10e6fe55e11e694d39e742f313a4.tar.xz
forums-cb3eb84665db10e6fe55e11e694d39e742f313a4.zip
[ticket/13034] Fix the route generated for the frontend not in the phpbb root
PHPBB3-13034
Diffstat (limited to 'phpBB/phpbb/controller/helper.php')
-rw-r--r--phpBB/phpbb/controller/helper.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index dd89d0504a..931a489535 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -119,27 +119,23 @@ class helper
$anchor = '#' . $params['#'];
unset($params['#']);
}
- $url_generator = new UrlGenerator($this->route_collection, new RequestContext());
- $route_url = $url_generator->generate($route, $params);
- if (strpos($route_url, '/') === 0)
- {
- $route_url = substr($route_url, 1);
- }
+ $context = new RequestContext();
+ $context->fromRequest($this->symfony_request);
+
+ $script_name = $this->symfony_request->getScriptName();
+ $page_name = substr($script_name, -1, 1) == '/' ? '' : basename($script_name);
+ $context->setBaseUrl(str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $context->getBaseUrl()));
+
+ $url_generator = new UrlGenerator($this->route_collection, $context);
+ $route_url = $url_generator->generate($route, $params);
if ($is_amp)
{
$route_url = str_replace(array('&amp;', '&'), array('&', '&amp;'), $route_url);
}
- // If enable_mod_rewrite is false, we need to include app.php
- $route_prefix = $this->phpbb_root_path;
- if (empty($this->config['enable_mod_rewrite']))
- {
- $route_prefix .= 'app.' . $this->php_ext . '/';
- }
-
- return append_sid($route_prefix . $route_url . $anchor, false, $is_amp, $session_id);
+ return append_sid($route_url . $anchor, false, $is_amp, $session_id, true);
}
/**