mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-22 08:13:14 +02:00
[ticket/11700] Move all recent code to namespaces
PHPBB3-11700
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\avatar\driver;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Base class for avatar drivers
|
||||
* @package phpBB3
|
||||
*/
|
||||
abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interface
|
||||
abstract class driver implements \phpbb\avatar\driver\driver_interface
|
||||
{
|
||||
/**
|
||||
* Avatar driver name
|
||||
@@ -29,7 +31,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interfa
|
||||
|
||||
/**
|
||||
* Current board configuration
|
||||
* @var phpbb_config
|
||||
* @var \phpbb\config\config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
@@ -47,7 +49,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interfa
|
||||
|
||||
/**
|
||||
* Cache driver
|
||||
* @var phpbb_cache_driver_driver_interface
|
||||
* @var \phpbb\cache\driver\driver_interface
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
@@ -69,13 +71,13 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interfa
|
||||
/**
|
||||
* Construct a driver object
|
||||
*
|
||||
* @param phpbb_config $config phpBB configuration
|
||||
* @param phpbb_request $request Request object
|
||||
* @param \phpbb\config\config $config phpBB configuration
|
||||
* @param \phpbb\request\request $request Request object
|
||||
* @param string $phpbb_root_path Path to the phpBB root
|
||||
* @param string $php_ext PHP file extension
|
||||
* @param phpbb_cache_driver_driver_interface $cache Cache driver
|
||||
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
|
||||
*/
|
||||
public function __construct(phpbb_config $config, $phpbb_root_path, $php_ext, phpbb_cache_driver_driver_interface $cache = null)
|
||||
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\avatar\driver;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Interface for avatar drivers
|
||||
* @package phpBB3
|
||||
*/
|
||||
interface phpbb_avatar_driver_driver_interface
|
||||
interface driver_interface
|
||||
{
|
||||
/**
|
||||
* Returns the name of the driver.
|
||||
@@ -32,7 +34,7 @@ interface phpbb_avatar_driver_driver_interface
|
||||
* Get the avatar url and dimensions
|
||||
*
|
||||
* @param array $row User data or group data that has been cleaned with
|
||||
* phpbb_avatar_manager::clean_row
|
||||
* \phpbb\avatar\manager::clean_row
|
||||
* @return array Avatar data, must have keys src, width and height, e.g.
|
||||
* ['src' => '', 'width' => 0, 'height' => 0]
|
||||
*/
|
||||
@@ -41,9 +43,9 @@ interface phpbb_avatar_driver_driver_interface
|
||||
/**
|
||||
* Returns custom html if it is needed for displaying this avatar
|
||||
*
|
||||
* @param phpbb_user $user phpBB user object
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
* @param array $row User data or group data that has been cleaned with
|
||||
* phpbb_avatar_manager::clean_row
|
||||
* \phpbb\avatar\manager::clean_row
|
||||
* @param string $alt Alternate text for avatar image
|
||||
*
|
||||
* @return string HTML
|
||||
@@ -53,11 +55,11 @@ interface phpbb_avatar_driver_driver_interface
|
||||
/**
|
||||
* Prepare form for changing the settings of this avatar
|
||||
*
|
||||
* @param phpbb_request $request Request object
|
||||
* @param phpbb_template $template Template object
|
||||
* @param phpbb_user $user User object
|
||||
* @param \phpbb\request\request $request Request object
|
||||
* @param \phpbb\template\template $template Template object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param array $row User data or group data that has been cleaned with
|
||||
* phpbb_avatar_manager::clean_row
|
||||
* \phpbb\avatar\manager::clean_row
|
||||
* @param array &$error Reference to an error array that is filled by this
|
||||
* function. Key values can either be a string with a language key or
|
||||
* an array that will be passed to vsprintf() with the language key in
|
||||
@@ -70,7 +72,7 @@ interface phpbb_avatar_driver_driver_interface
|
||||
/**
|
||||
* Prepare form for changing the acp settings of this avatar
|
||||
*
|
||||
* @param phpbb_user $user phpBB user object
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*
|
||||
* @return array Array of configuration options as consumed by acp_board.
|
||||
* The setting for enabling/disabling the avatar will be handled by
|
||||
@@ -81,11 +83,11 @@ interface phpbb_avatar_driver_driver_interface
|
||||
/**
|
||||
* Process form data
|
||||
*
|
||||
* @param phpbb_request $request Request object
|
||||
* @param phpbb_template $template Template object
|
||||
* @param phpbb_user $user User object
|
||||
* @param \phpbb\request\request $request Request object
|
||||
* @param \phpbb\template\template $template Template object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param array $row User data or group data that has been cleaned with
|
||||
* phpbb_avatar_manager::clean_row
|
||||
* \phpbb\avatar\manager::clean_row
|
||||
* @param array &$error Reference to an error array that is filled by this
|
||||
* function. Key values can either be a string with a language key or
|
||||
* an array that will be passed to vsprintf() with the language key in
|
||||
@@ -100,7 +102,7 @@ interface phpbb_avatar_driver_driver_interface
|
||||
* Delete avatar
|
||||
*
|
||||
* @param array $row User data or group data that has been cleaned with
|
||||
* phpbb_avatar_manager::clean_row
|
||||
* \phpbb\avatar\manager::clean_row
|
||||
*
|
||||
* @return bool True if avatar has been deleted or there is no need to delete,
|
||||
* i.e. when the avatar is not hosted locally.
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\avatar\driver;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Handles avatars hosted at gravatar.com
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
|
||||
class gravatar extends \phpbb\avatar\driver\driver
|
||||
{
|
||||
/**
|
||||
* The URL for the gravatar service
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\avatar\driver;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Handles avatars selected from the board gallery
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||
class local extends \phpbb\avatar\driver\driver
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -144,7 +146,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||
* Get a list of avatars that are locally available
|
||||
* Results get cached for 24 hours (86400 seconds)
|
||||
*
|
||||
* @param phpbb_user $user User object
|
||||
* @param \phpbb\user $user User object
|
||||
*
|
||||
* @return array Array containing the locally available avatars
|
||||
*/
|
||||
@@ -157,7 +159,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||
$avatar_list = array();
|
||||
$path = $this->phpbb_root_path . $this->config['avatar_gallery_path'];
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS), RecursiveIteratorIterator::SELF_FIRST);
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
foreach ($iterator as $file_info)
|
||||
{
|
||||
$file_path = $file_info->getPath();
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\avatar\driver;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Handles avatars hosted remotely
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_avatar_driver_remote extends phpbb_avatar_driver
|
||||
class remote extends \phpbb\avatar\driver\driver
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -120,8 +122,8 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
|
||||
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
|
||||
}
|
||||
|
||||
$types = fileupload::image_types();
|
||||
$extension = strtolower(filespec::get_extension($url));
|
||||
$types = \fileupload::image_types();
|
||||
$extension = strtolower(\filespec::get_extension($url));
|
||||
|
||||
if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]])))
|
||||
{
|
||||
|
@@ -7,6 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\avatar\driver;
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||
* Handles avatars uploaded to the board
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_avatar_driver_upload extends phpbb_avatar_driver
|
||||
class upload extends \phpbb\avatar\driver\driver
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
@@ -66,7 +68,7 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
|
||||
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
|
||||
}
|
||||
|
||||
$upload = new fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false));
|
||||
$upload = new \fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false));
|
||||
|
||||
$url = $request->variable('avatar_upload_url', '');
|
||||
$upload_file = $request->file('avatar_upload_file');
|
||||
|
Reference in New Issue
Block a user