mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 14:30:32 +02:00
[ticket/11824] Add option for mod_rewrite
PHPBB3-11824
This commit is contained in:
@@ -36,10 +36,10 @@ class phpbb_controller_helper
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Request object
|
||||
* @var phpbb_request
|
||||
* config object
|
||||
* @var phpbb_config
|
||||
*/
|
||||
protected $request;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* phpBB root path
|
||||
@@ -61,11 +61,11 @@ class phpbb_controller_helper
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $php_ext PHP extension
|
||||
*/
|
||||
public function __construct(phpbb_template $template, phpbb_user $user, phpbb_request_interface $request, $phpbb_root_path, $php_ext)
|
||||
public function __construct(phpbb_template $template, phpbb_user $user, phpbb_config $config, $phpbb_root_path, $php_ext)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->request = $request;
|
||||
$this->config = $config;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
@@ -109,14 +109,12 @@ class phpbb_controller_helper
|
||||
$route = substr($route, 0, $route_delim);
|
||||
}
|
||||
|
||||
$request_uri = $this->request->variable('REQUEST_URI', '', false, phpbb_request::SERVER);
|
||||
$script_name = $this->request->variable('SCRIPT_NAME', '', false, phpbb_request::SERVER);
|
||||
|
||||
// If the app.php file is being used (no rewrite) keep it in the URL.
|
||||
// Otherwise, don't include it.
|
||||
// If enable_mod_rewrite is false, we not need to include app.php
|
||||
$route_prefix = $this->phpbb_root_path;
|
||||
$parts = explode('/', $script_name);
|
||||
$route_prefix .= strpos($request_uri, $script_name) === 0 ? array_pop($parts) . '/' : '';
|
||||
if (empty($this->config['enable_mod_rewrite']))
|
||||
{
|
||||
$route_prefix .= 'app.' . $this->php_ext . '/';
|
||||
}
|
||||
|
||||
return append_sid($route_prefix . "$route" . $route_params, $params, $is_amp, $session_id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user