mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/13493] Append page name to base url if it doesn't contain it
PHPBB3-13493
This commit is contained in:
parent
c6a371531b
commit
25b54791f9
3 changed files with 55 additions and 1 deletions
|
@ -142,6 +142,12 @@ class helper
|
||||||
|
|
||||||
$base_url = $context->getBaseUrl();
|
$base_url = $context->getBaseUrl();
|
||||||
|
|
||||||
|
// Append page name if base URL does not contain it
|
||||||
|
if (!empty($page_name) && strpos($base_url, '/' . $page_name) === false)
|
||||||
|
{
|
||||||
|
$base_url .= '/' . $page_name;
|
||||||
|
}
|
||||||
|
|
||||||
// If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it.
|
// If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it.
|
||||||
$base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
|
$base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url);
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,11 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||||
return '/app.php';
|
return '/app.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function get_base_uri()
|
||||||
|
{
|
||||||
|
return $this->get_uri();
|
||||||
|
}
|
||||||
|
|
||||||
protected function get_script_name()
|
protected function get_script_name()
|
||||||
{
|
{
|
||||||
return 'app.php';
|
return 'app.php';
|
||||||
|
@ -66,7 +71,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||||
$this->request = new phpbb_mock_request();
|
$this->request = new phpbb_mock_request();
|
||||||
$this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
|
$this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
|
||||||
$this->request->overwrite('SCRIPT_FILENAME', $this->get_script_name(), \phpbb\request\request_interface::SERVER);
|
$this->request->overwrite('SCRIPT_FILENAME', $this->get_script_name(), \phpbb\request\request_interface::SERVER);
|
||||||
$this->request->overwrite('REQUEST_URI', $this->get_uri(), \phpbb\request\request_interface::SERVER);
|
$this->request->overwrite('REQUEST_URI', $this->get_base_uri(), \phpbb\request\request_interface::SERVER);
|
||||||
$this->request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER);
|
$this->request->overwrite('SERVER_NAME', 'localhost', \phpbb\request\request_interface::SERVER);
|
||||||
$this->request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER);
|
$this->request->overwrite('SERVER_PORT', '80', \phpbb\request\request_interface::SERVER);
|
||||||
|
|
||||||
|
|
43
tests/controller/helper_route_slash_test.php
Normal file
43
tests/controller/helper_route_slash_test.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* This file is part of the phpBB Forum Software package.
|
||||||
|
*
|
||||||
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||||
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||||
|
*
|
||||||
|
* For full copyright and license information, please see
|
||||||
|
* the docs/CREDITS.txt file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||||
|
require_once dirname(__FILE__) . '/common_helper_route.php';
|
||||||
|
|
||||||
|
class phpbb_controller_helper_route_slash_test extends phpbb_controller_common_helper_route
|
||||||
|
{
|
||||||
|
protected function get_phpbb_root_path()
|
||||||
|
{
|
||||||
|
return './../';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_uri()
|
||||||
|
{
|
||||||
|
return '/phpBB3/app.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_base_uri()
|
||||||
|
{
|
||||||
|
return '/phpBB3';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_script_name()
|
||||||
|
{
|
||||||
|
return 'app.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function path_to_app()
|
||||||
|
{
|
||||||
|
return 'phpBB3/';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue