mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
Merge pull request #2969 from marc1706/ticket/13073
[ticket/13073] Correctly generate routes from subfolders like /adm * marc1706/ticket/13073: [ticket/13073] Remove _test suffix from common test class [ticket/13073] Switch $input with $expected and add paths with letters [ticket/13073] Use abstract class for controller helper route tests [ticket/13073] Add path regex to get_preg_expression() and add unit tests [ticket/13073] Use just one regex in helper route() [ticket/13073] Properly place comments in helper [ticket/13073] Use correct class names in test files [ticket/13073] Rework route tests and add tests for more directory types [ticket/13073] Test that routes from subfolders like /adm work [ticket/13073] Add tests for routes from adm pages [ticket/13073] Add phpbb root path with mod rewrite enabled for proper routes
This commit is contained in:
@@ -3317,6 +3317,11 @@ function get_preg_expression($mode)
|
||||
case 'table_prefix':
|
||||
return '#^[a-zA-Z][a-zA-Z0-9_]*$#';
|
||||
break;
|
||||
|
||||
// Matches the predecing dot
|
||||
case 'path_remove_dot_trailing_slash':
|
||||
return '#^(?:(\.)?)+(?:(.+)?)+(?:([\\/\\\])$)#';
|
||||
break;
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@@ -140,8 +140,15 @@ class helper
|
||||
// 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);
|
||||
|
||||
// We need to update the base url to move to the directory of the app.php file.
|
||||
$base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url);
|
||||
// We need to update the base url to move to the directory of the app.php file
|
||||
if (empty($this->config['enable_mod_rewrite']))
|
||||
{
|
||||
$base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$base_url .= preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), '$2', $this->phpbb_root_path);
|
||||
}
|
||||
|
||||
$base_url = $this->filesystem->clean_path($base_url);
|
||||
|
||||
|
Reference in New Issue
Block a user