mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +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);
|
||||
}
|
||||
|
25
phpBB/phpbb/db/migration/data/310/mod_rewrite.php
Normal file
25
phpBB/phpbb/db/migration/data/310/mod_rewrite.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_db_migration_data_310_mod_rewrite extends phpbb_db_migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'phpbb_db_migration_data_310_dev',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.add', array('enable_mod_rewrite', '0')),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user