From b81613e5e57fd208e832637b6886abf9ec806c4b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 12:25:28 -0400 Subject: [ticket/11700] With namespaces interface will no longer be a valid classname PHPBB3-11700 --- phpBB/phpbb/avatar/driver/driver_interface.php | 116 +++++++++++++++++++++++++ phpBB/phpbb/avatar/driver/interface.php | 116 ------------------------- 2 files changed, 116 insertions(+), 116 deletions(-) create mode 100644 phpBB/phpbb/avatar/driver/driver_interface.php delete mode 100644 phpBB/phpbb/avatar/driver/interface.php (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php new file mode 100644 index 0000000000..0a44a7a1fe --- /dev/null +++ b/phpBB/phpbb/avatar/driver/driver_interface.php @@ -0,0 +1,116 @@ + '', 'width' => 0, 'height' => 0] + */ + public function get_data($row); + + /** + * Returns custom html if it is needed for displaying this avatar + * + * @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 + * @param string $alt Alternate text for avatar image + * + * @return string HTML + */ + public function get_custom_html($user, $row, $alt = ''); + + /** + * 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 array $row User data or group data that has been cleaned with + * 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 + * the first array key. + * + * @return bool True if form has been successfully prepared + */ + public function prepare_form($request, $template, $user, $row, &$error); + + /** + * Prepare form for changing the acp settings of this avatar + * + * @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 + * the avatar manager. + */ + public function prepare_form_acp($user); + + /** + * Process form data + * + * @param phpbb_request $request Request object + * @param phpbb_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 + * @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 + * the first array key. + * + * @return array Array containing the avatar data as follows: + * ['avatar'], ['avatar_width'], ['avatar_height'] + */ + public function process_form($request, $template, $user, $row, &$error); + + /** + * Delete avatar + * + * @param array $row User data or group data that has been cleaned with + * 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. + */ + public function delete($row); + + /** + * Get the avatar driver's template name + * + * @return string Avatar driver's template name + */ + public function get_template_name(); +} diff --git a/phpBB/phpbb/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/interface.php deleted file mode 100644 index 3d62969aef..0000000000 --- a/phpBB/phpbb/avatar/driver/interface.php +++ /dev/null @@ -1,116 +0,0 @@ - '', 'width' => 0, 'height' => 0] - */ - public function get_data($row); - - /** - * Returns custom html if it is needed for displaying this avatar - * - * @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 - * @param string $alt Alternate text for avatar image - * - * @return string HTML - */ - public function get_custom_html($user, $row, $alt = ''); - - /** - * 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 array $row User data or group data that has been cleaned with - * 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 - * the first array key. - * - * @return bool True if form has been successfully prepared - */ - public function prepare_form($request, $template, $user, $row, &$error); - - /** - * Prepare form for changing the acp settings of this avatar - * - * @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 - * the avatar manager. - */ - public function prepare_form_acp($user); - - /** - * Process form data - * - * @param phpbb_request $request Request object - * @param phpbb_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 - * @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 - * the first array key. - * - * @return array Array containing the avatar data as follows: - * ['avatar'], ['avatar_width'], ['avatar_height'] - */ - public function process_form($request, $template, $user, $row, &$error); - - /** - * Delete avatar - * - * @param array $row User data or group data that has been cleaned with - * 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. - */ - public function delete($row); - - /** - * Get the avatar driver's template name - * - * @return string Avatar driver's template name - */ - public function get_template_name(); -} -- cgit v1.2.1 From da2752e4004b296ae5acdd08b7c0a758d8f61e9d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 13:30:52 -0400 Subject: [ticket/11700] Modify all code to use the new interface names PHPBB3-11700 --- phpBB/phpbb/avatar/driver/driver.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index 29c58d4e62..a125759e3f 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) * Base class for avatar drivers * @package phpBB3 */ -abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface +abstract class phpbb_avatar_driver implements phpbb_avatar_driver_driver_interface { /** * Avatar driver name @@ -47,7 +47,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface /** * Cache driver - * @var phpbb_cache_driver_interface + * @var phpbb_cache_driver_driver_interface */ protected $cache; @@ -73,9 +73,9 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface * @param phpbb_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_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_interface $cache = null) + public function __construct(phpbb_config $config, $phpbb_root_path, $php_ext, phpbb_cache_driver_driver_interface $cache = null) { $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- phpBB/phpbb/avatar/driver/driver.php | 16 ++++++++------ phpBB/phpbb/avatar/driver/driver_interface.php | 30 ++++++++++++++------------ phpBB/phpbb/avatar/driver/gravatar.php | 4 +++- phpBB/phpbb/avatar/driver/local.php | 8 ++++--- phpBB/phpbb/avatar/driver/remote.php | 8 ++++--- phpBB/phpbb/avatar/driver/upload.php | 6 ++++-- phpBB/phpbb/avatar/manager.php | 16 ++++++++------ 7 files changed, 51 insertions(+), 37 deletions(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index a125759e3f..d688e7d70c 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -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; diff --git a/phpBB/phpbb/avatar/driver/driver_interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php index 0a44a7a1fe..d9540c19db 100644 --- a/phpBB/phpbb/avatar/driver/driver_interface.php +++ b/phpBB/phpbb/avatar/driver/driver_interface.php @@ -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. diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php index d559da1c0d..3ad783932e 100644 --- a/phpBB/phpbb/avatar/driver/gravatar.php +++ b/phpBB/phpbb/avatar/driver/gravatar.php @@ -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 diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index f4bcd4ce74..d779099c46 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -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(); diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php index 7da58107a1..1e29fb5735 100644 --- a/phpBB/phpbb/avatar/driver/remote.php +++ b/phpBB/phpbb/avatar/driver/remote.php @@ -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]]))) { diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index 685ac4f349..377c9a0b04 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -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'); diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 58d994c3c0..717ba00ed7 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\avatar; + /** * @ignore */ @@ -18,11 +20,11 @@ if (!defined('IN_PHPBB')) /** * @package avatar */ -class phpbb_avatar_manager +class manager { /** * phpBB configuration - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; @@ -59,11 +61,11 @@ class phpbb_avatar_manager /** * Construct an avatar manager object * - * @param phpbb_config $config phpBB configuration + * @param \phpbb\config\config $config phpBB configuration * @param array $avatar_drivers Avatar drivers passed via the service container * @param object $container Container object */ - public function __construct(phpbb_config $config, $avatar_drivers, $container) + public function __construct(\phpbb\config\config $config, $avatar_drivers, $container) { $this->config = $config; $this->avatar_drivers = $avatar_drivers; @@ -194,7 +196,7 @@ class phpbb_avatar_manager $keys = array_keys($row); $values = array_values($row); - $keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys); + $keys = array_map(array('\phpbb\avatar\manager', 'strip_prefix'), $keys); return array_combine($keys, $values); } @@ -281,7 +283,7 @@ class phpbb_avatar_manager /** * Replace "error" strings with their real, localized form * - * @param phpbb_user phpBB User object + * @param \phpbb\user phpBB User object * @param array $error Array containing error strings * 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 the @@ -289,7 +291,7 @@ class phpbb_avatar_manager * * @return array Array containing the localized error strings */ - public function localize_errors(phpbb_user $user, $error) + public function localize_errors(\phpbb\user $user, $error) { foreach ($error as $key => $lang) { -- cgit v1.2.1 From fcd36ddd1f7c8a8b224423dca7599addbdaf1f57 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:36:21 +0200 Subject: [ticket/11700] Correctly generate lang key from avatar driver class PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 717ba00ed7..5d7f8f1b8f 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -264,7 +264,7 @@ class manager $config_name = $this->get_driver_config_name($driver); return array( - 'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper($config_name), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper(str_replace('\\', '_', $config_name)), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), ); } -- cgit v1.2.1 From 6e6681fa59a55393c52350d0086806662ba820fd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:58:40 +0200 Subject: [ticket/11700] Load avatar explanations correctly from namespaces PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 5d7f8f1b8f..894ed080e6 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -277,7 +277,7 @@ class manager */ public function get_driver_config_name($driver) { - return preg_replace('#^phpbb_avatar_driver_#', '', get_class($driver)); + return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); } /** -- cgit v1.2.1 From 77ffd5c6ba02e5dabebc34c479aa964e05f4038d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 06:44:16 +0200 Subject: [ticket/11700] Use underscores in avatar driver template file names PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 894ed080e6..0408467064 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -235,7 +235,7 @@ class manager */ static public function prepare_driver_name($name) { - return str_replace('.', '_', $name); + return str_replace(array('\\', '.'), '_', $name); } /** -- cgit v1.2.1 From 15413f43e48b317fda276d0f9bb42d122caacf3c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 15:45:35 +0200 Subject: [ticket/11700] Correctly handle avatar drivers with namespaces PHPBB3-11700 --- phpBB/phpbb/avatar/manager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 0408467064..11f401d9ed 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -222,7 +222,7 @@ class manager */ static public function clean_driver_name($name) { - return str_replace('_', '.', $name); + return str_replace(array('\\', '_'), '.', $name); } /** @@ -235,7 +235,7 @@ class manager */ static public function prepare_driver_name($name) { - return str_replace(array('\\', '.'), '_', $name); + return str_replace('.', '_', $name); } /** @@ -277,7 +277,7 @@ class manager */ public function get_driver_config_name($driver) { - return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); + return preg_replace('#^phpbb\\avatar\\driver\\\\#', '', get_class($driver)); } /** -- cgit v1.2.1 From 40ea7422b12b618cf7eecc01868b462eaed462a9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 19 Sep 2013 16:21:38 +0200 Subject: [ticket/11700] Correctly load avatar templates for namespaced drivers PHPBB3-11700 --- phpBB/phpbb/avatar/driver/driver.php | 2 +- phpBB/phpbb/avatar/manager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/avatar') diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index d688e7d70c..0c54951cbd 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -114,7 +114,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface */ public function get_template_name() { - $driver = preg_replace('#^phpbb_avatar_driver_#', '', get_class($this)); + $driver = preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this)); $template = "ucp_avatar_options_$driver.html"; return $template; diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index 11f401d9ed..c28380a401 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -277,7 +277,7 @@ class manager */ public function get_driver_config_name($driver) { - return preg_replace('#^phpbb\\avatar\\driver\\\\#', '', get_class($driver)); + return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver)); } /** -- cgit v1.2.1