1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-20 07:42:09 +02:00

[ticket/11832] Fix constructions of phpbb_filesystem

PHPBB3-11832
This commit is contained in:
Nathan Guse 2013-09-13 10:04:35 -05:00
parent f8e665751a
commit 21624e79fc
8 changed files with 41 additions and 14 deletions

View File

@ -47,7 +47,12 @@ if (!defined('PHPBB_INSTALLED'))
// Eliminate . and .. from the path
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);
$url = (($secure) ? 'https://' : 'http://') . $server_name;

View File

@ -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 $phpbb_dispatcher;
global $symfony_request, $phpbb_root_path, $phpbb_container;
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
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;
@ -2820,7 +2819,7 @@ function build_url($strip_vars = false)
// 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,
// else we use the URL directly.
$url_parts = @parse_url($page);
$url_parts = parse_url($page);
// URL
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')
{
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'))
{
@ -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
// controller because the web paths will be incorrect otherwise.
$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;
// Send a proper content-language to the output

View File

@ -59,7 +59,12 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container,
$this->db,
$this->config,
new phpbb_filesystem(dirname(__FILE__) . '/../../phpBB/'),
new phpbb_filesystem(
new phpbb_symfony_request(
new phpbb_mock_request()
),
dirname(__FILE__) . '/../../phpBB/'
),
'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/',
'php',

View File

@ -114,7 +114,12 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$container,
$db,
$config,
new phpbb_filesystem($phpbb_root_path),
new phpbb_filesystem(
new phpbb_symfony_request(
new phpbb_mock_request()
),
$phpbb_root_path
),
'phpbb_ext',
dirname(__FILE__) . '/',
$php_ext,

View File

@ -65,7 +65,12 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$container,
$this->db,
$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',
$this->phpbb_root_path,
$this->phpEx,

View File

@ -23,10 +23,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
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_container = new phpbb_mock_container_builder();
$phpbb_container->set('filesystem', new phpbb_filesystem($phpbb_root_path));
$expected_data_sets = array(
1 => array(

View File

@ -14,6 +14,11 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = 'php';
$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
);
}
}

View File

@ -203,7 +203,12 @@ class phpbb_functional_test_case extends phpbb_test_case
$container,
$db,
$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',
dirname(__FILE__) . '/',
$php_ext,