mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/10824] Add missing imports and adjust json sanitizer imports
This way the imports will also be a bit more explicit to the fact that this is only a json sanitizer. PHPBB3-10824
This commit is contained in:
parent
cf8f79356d
commit
c93da86f83
5 changed files with 12 additions and 10 deletions
4
phpBB/phpbb/cache/service.php
vendored
4
phpBB/phpbb/cache/service.php
vendored
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace phpbb\cache;
|
namespace phpbb\cache;
|
||||||
|
|
||||||
use phpbb\json\sanitizer;
|
use phpbb\json\sanitizer as json_sanitizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for grabbing/handling cached entries
|
* Class for grabbing/handling cached entries
|
||||||
|
@ -357,7 +357,7 @@ class service
|
||||||
{
|
{
|
||||||
// Re-parse cfg file
|
// Re-parse cfg file
|
||||||
$json = file_get_contents($filename);
|
$json = file_get_contents($filename);
|
||||||
$parsed_array = sanitizer::decode($json);
|
$parsed_array = json_sanitizer::decode($json);
|
||||||
$parsed_array['filetime'] = @filemtime($filename);
|
$parsed_array['filetime'] = @filemtime($filename);
|
||||||
|
|
||||||
$this->driver->put('_cfg_' . $style['style_path'], $parsed_array);
|
$this->driver->put('_cfg_' . $style['style_path'], $parsed_array);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace phpbb\db\migration\data\v310;
|
namespace phpbb\db\migration\data\v310;
|
||||||
|
|
||||||
use phpbb\json\sanitizer;
|
use phpbb\json\sanitizer as json_sanitizer;
|
||||||
|
|
||||||
class style_update_p1 extends \phpbb\db\migration\migration
|
class style_update_p1 extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ class style_update_p1 extends \phpbb\db\migration\migration
|
||||||
else if (file_exists($fileinfo->getPathname() . '/composer.json'))
|
else if (file_exists($fileinfo->getPathname() . '/composer.json'))
|
||||||
{
|
{
|
||||||
$json = file_get_contents($fileinfo->getPathname() . '/composer.json');
|
$json = file_get_contents($fileinfo->getPathname() . '/composer.json');
|
||||||
$style_data = sanitizer::decode($json);
|
$style_data = json_sanitizer::decode($json);
|
||||||
if (isset($style_data['extra']['phpbb-version']) && version_compare($style_data['extra']['phpbb-version'], '4.0.0-dev', '>='))
|
if (isset($style_data['extra']['phpbb-version']) && version_compare($style_data['extra']['phpbb-version'], '4.0.0-dev', '>='))
|
||||||
{
|
{
|
||||||
// 4.x style
|
// 4.x style
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
|
|
||||||
namespace phpbb\language;
|
namespace phpbb\language;
|
||||||
|
|
||||||
use phpbb\json\sanitizer;
|
use DomainException;
|
||||||
|
use phpbb\json\sanitizer as json_sanitizer;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +56,7 @@ class language_file_helper
|
||||||
foreach ($finder as $file)
|
foreach ($finder as $file)
|
||||||
{
|
{
|
||||||
$json = $file->getContents();
|
$json = $file->getContents();
|
||||||
$data = sanitizer::decode($json);
|
$data = json_sanitizer::decode($json);
|
||||||
|
|
||||||
$available_languages[] = $this->get_language_data_from_json($data);
|
$available_languages[] = $this->get_language_data_from_json($data);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +73,7 @@ class language_file_helper
|
||||||
public function get_language_data_from_composer_file(string $path): array
|
public function get_language_data_from_composer_file(string $path): array
|
||||||
{
|
{
|
||||||
$json_data = file_get_contents($path);
|
$json_data = file_get_contents($path);
|
||||||
return $this->get_language_data_from_json(sanitizer::decode($json_data));
|
return $this->get_language_data_from_json(json_sanitizer::decode($json_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
namespace phpbb;
|
namespace phpbb;
|
||||||
|
|
||||||
use phpbb\exception\version_check_exception;
|
use phpbb\exception\version_check_exception;
|
||||||
|
use phpbb\json\sanitizer as json_sanitizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle version checking and comparison
|
* Class to handle version checking and comparison
|
||||||
|
@ -390,7 +391,7 @@ class version_helper
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize any data we retrieve from a server
|
// Sanitize any data we retrieve from a server
|
||||||
$info = json\sanitizer::decode($info);
|
$info = json_sanitizer::decode($info);
|
||||||
|
|
||||||
if (empty($info['stable']) && empty($info['unstable']))
|
if (empty($info['stable']) && empty($info['unstable']))
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use phpbb\json\sanitizer;
|
use phpbb\json\sanitizer as json_sanitizer;
|
||||||
|
|
||||||
class phpbb_json_sanitizer_test extends phpbb_test_case
|
class phpbb_json_sanitizer_test extends phpbb_test_case
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,6 @@ class phpbb_json_sanitizer_test extends phpbb_test_case
|
||||||
*/
|
*/
|
||||||
public function test_decode_data($input, $output)
|
public function test_decode_data($input, $output)
|
||||||
{
|
{
|
||||||
$this->assertEquals($output, sanitizer::decode($input));
|
$this->assertEquals($output, json_sanitizer::decode($input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue