mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11832] Fix constructions of phpbb_filesystem
PHPBB3-11832
This commit is contained in:
parent
f8e665751a
commit
21624e79fc
8 changed files with 41 additions and 14 deletions
|
@ -47,7 +47,12 @@ if (!defined('PHPBB_INSTALLED'))
|
||||||
|
|
||||||
// Eliminate . and .. from the path
|
// Eliminate . and .. from the path
|
||||||
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
|
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
|
||||||
$phpbb_filesystem = new phpbb_filesystem($phpbb_root_path);
|
$phpbb_filesystem = new phpbb_filesystem(
|
||||||
|
new phpbb_symfony_request(
|
||||||
|
new phpbb_request()
|
||||||
|
),
|
||||||
|
$phpbb_root_path
|
||||||
|
);
|
||||||
$script_path = $phpbb_filesystem->clean_path($script_path);
|
$script_path = $phpbb_filesystem->clean_path($script_path);
|
||||||
|
|
||||||
$url = (($secure) ? 'https://' : 'http://') . $server_name;
|
$url = (($secure) ? 'https://' : 'http://') . $server_name;
|
||||||
|
|
|
@ -2411,7 +2411,6 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
|
||||||
{
|
{
|
||||||
global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem;
|
global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem;
|
||||||
global $phpbb_dispatcher;
|
global $phpbb_dispatcher;
|
||||||
global $symfony_request, $phpbb_root_path, $phpbb_container;
|
|
||||||
|
|
||||||
if ($params === '' || (is_array($params) && empty($params)))
|
if ($params === '' || (is_array($params) && empty($params)))
|
||||||
{
|
{
|
||||||
|
@ -2422,7 +2421,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
|
||||||
// Update the root path with the correct relative web path
|
// Update the root path with the correct relative web path
|
||||||
if ($phpbb_filesystem instanceof phpbb_filesystem)
|
if ($phpbb_filesystem instanceof phpbb_filesystem)
|
||||||
{
|
{
|
||||||
$url = $phpbb_filesystem->update_web_root_path($url, $symfony_request);
|
$url = $phpbb_filesystem->update_web_root_path($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$append_sid_overwrite = false;
|
$append_sid_overwrite = false;
|
||||||
|
@ -2820,7 +2819,7 @@ function build_url($strip_vars = false)
|
||||||
// On some situations, the redirect path is an absolute URL, sometimes a relative path
|
// On some situations, the redirect path is an absolute URL, sometimes a relative path
|
||||||
// For a relative path, let's prefix it with $phpbb_root_path to point to the correct location,
|
// For a relative path, let's prefix it with $phpbb_root_path to point to the correct location,
|
||||||
// else we use the URL directly.
|
// else we use the URL directly.
|
||||||
$url_parts = @parse_url($page);
|
$url_parts = parse_url($page);
|
||||||
|
|
||||||
// URL
|
// URL
|
||||||
if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host']))
|
if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host']))
|
||||||
|
@ -5081,7 +5080,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
|
||||||
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
|
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
|
||||||
{
|
{
|
||||||
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
|
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
|
||||||
global $phpbb_dispatcher, $request, $phpbb_container, $symfony_request, $adm_relative_path;
|
global $phpbb_dispatcher, $request, $phpbb_container, $adm_relative_path;
|
||||||
|
|
||||||
if (defined('HEADER_INC'))
|
if (defined('HEADER_INC'))
|
||||||
{
|
{
|
||||||
|
@ -5242,7 +5241,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
// call below. We need to correct it in case we are accessing from a
|
// call below. We need to correct it in case we are accessing from a
|
||||||
// controller because the web paths will be incorrect otherwise.
|
// controller because the web paths will be incorrect otherwise.
|
||||||
$phpbb_filesystem = $phpbb_container->get('filesystem');
|
$phpbb_filesystem = $phpbb_container->get('filesystem');
|
||||||
$corrected_path = $phpbb_filesystem->get_web_root_path($symfony_request);
|
$corrected_path = $phpbb_filesystem->get_web_root_path();
|
||||||
$web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;
|
$web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;
|
||||||
|
|
||||||
// Send a proper content-language to the output
|
// Send a proper content-language to the output
|
||||||
|
|
|
@ -59,7 +59,12 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
|
||||||
$container,
|
$container,
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->config,
|
$this->config,
|
||||||
new phpbb_filesystem(dirname(__FILE__) . '/../../phpBB/'),
|
new phpbb_filesystem(
|
||||||
|
new phpbb_symfony_request(
|
||||||
|
new phpbb_mock_request()
|
||||||
|
),
|
||||||
|
dirname(__FILE__) . '/../../phpBB/'
|
||||||
|
),
|
||||||
'phpbb_ext',
|
'phpbb_ext',
|
||||||
dirname(__FILE__) . '/../../phpBB/',
|
dirname(__FILE__) . '/../../phpBB/',
|
||||||
'php',
|
'php',
|
||||||
|
|
|
@ -114,7 +114,12 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||||
$container,
|
$container,
|
||||||
$db,
|
$db,
|
||||||
$config,
|
$config,
|
||||||
new phpbb_filesystem($phpbb_root_path),
|
new phpbb_filesystem(
|
||||||
|
new phpbb_symfony_request(
|
||||||
|
new phpbb_mock_request()
|
||||||
|
),
|
||||||
|
$phpbb_root_path
|
||||||
|
),
|
||||||
'phpbb_ext',
|
'phpbb_ext',
|
||||||
dirname(__FILE__) . '/',
|
dirname(__FILE__) . '/',
|
||||||
$php_ext,
|
$php_ext,
|
||||||
|
|
|
@ -65,7 +65,12 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||||
$container,
|
$container,
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->config,
|
$this->config,
|
||||||
new phpbb_filesystem($this->phpbb_root_path),
|
new phpbb_filesystem(
|
||||||
|
new phpbb_symfony_request(
|
||||||
|
new phpbb_mock_request()
|
||||||
|
),
|
||||||
|
$this->phpbb_root_path
|
||||||
|
),
|
||||||
'phpbb_ext',
|
'phpbb_ext',
|
||||||
$this->phpbb_root_path,
|
$this->phpbb_root_path,
|
||||||
$this->phpEx,
|
$this->phpEx,
|
||||||
|
|
|
@ -23,10 +23,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
|
||||||
|
|
||||||
public static function view_log_function_data()
|
public static function view_log_function_data()
|
||||||
{
|
{
|
||||||
global $phpEx, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path;
|
global $phpEx, $phpbb_dispatcher;
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$phpbb_container = new phpbb_mock_container_builder();
|
|
||||||
$phpbb_container->set('filesystem', new phpbb_filesystem($phpbb_root_path));
|
|
||||||
|
|
||||||
$expected_data_sets = array(
|
$expected_data_sets = array(
|
||||||
1 => array(
|
1 => array(
|
||||||
|
|
|
@ -14,6 +14,11 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->php_ext = 'php';
|
$this->php_ext = 'php';
|
||||||
$this->extensions = $extensions;
|
$this->extensions = $extensions;
|
||||||
$this->filesystem = new phpbb_filesystem($phpbb_root_path);
|
$this->filesystem = new phpbb_filesystem(
|
||||||
|
new phpbb_symfony_request(
|
||||||
|
new phpbb_mock_request()
|
||||||
|
),
|
||||||
|
$phpbb_root_path
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,12 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
$container,
|
$container,
|
||||||
$db,
|
$db,
|
||||||
$config,
|
$config,
|
||||||
new phpbb_filesystem($phpbb_root_path),
|
new phpbb_filesystem(
|
||||||
|
new phpbb_symfony_request(
|
||||||
|
new phpbb_mock_request()
|
||||||
|
),
|
||||||
|
$phpbb_root_path
|
||||||
|
),
|
||||||
self::$config['table_prefix'] . 'ext',
|
self::$config['table_prefix'] . 'ext',
|
||||||
dirname(__FILE__) . '/',
|
dirname(__FILE__) . '/',
|
||||||
$php_ext,
|
$php_ext,
|
||||||
|
|
Loading…
Add table
Reference in a new issue