From 3f63b9b470b2848abdd6288a45ca56331a3bb77c Mon Sep 17 00:00:00 2001 From: Marc Alexander <admin@m-a-styles.de> Date: Fri, 27 Sep 2013 11:16:47 +0200 Subject: [feature/passwords] Modify passwords files for namespacing changes PHPBB3-11610 --- phpBB/phpbb/passwords/driver/base.php | 10 ++-- phpBB/phpbb/passwords/driver/bcrypt.php | 4 +- phpBB/phpbb/passwords/driver/bcrypt_2y.php | 4 +- phpBB/phpbb/passwords/driver/driver_interface.php | 70 +++++++++++++++++++++++ phpBB/phpbb/passwords/driver/helper.php | 4 +- phpBB/phpbb/passwords/driver/interface.php | 68 ---------------------- phpBB/phpbb/passwords/driver/phpass.php | 4 +- phpBB/phpbb/passwords/driver/salted_md5.php | 4 +- 8 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 phpBB/phpbb/passwords/driver/driver_interface.php delete mode 100644 phpBB/phpbb/passwords/driver/interface.php (limited to 'phpBB/phpbb/passwords/driver') diff --git a/phpBB/phpbb/passwords/driver/base.php b/phpBB/phpbb/passwords/driver/base.php index 2984dafef7..298b7367ad 100644 --- a/phpBB/phpbb/passwords/driver/base.php +++ b/phpBB/phpbb/passwords/driver/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\passwords\driver; + /** * @ignore */ @@ -18,12 +20,12 @@ if (!defined('IN_PHPBB')) /** * @package passwords */ -abstract class phpbb_passwords_driver_base implements phpbb_passwords_driver_interface +abstract class base implements \phpbb\passwords\driver\driver_interface { - /** @var phpbb_config */ + /** @var phpbb\config\config */ protected $config; - /** @var phpbb_passwords_driver_helper */ + /** @var phpbb\passwords\driver\helper */ protected $helper; /** @var driver name */ @@ -34,7 +36,7 @@ abstract class phpbb_passwords_driver_base implements phpbb_passwords_driver_int * * @return string Hash prefix */ - public function __construct(phpbb_config $config, phpbb_passwords_driver_helper $helper) + public function __construct(\phpbb\config\config $config, \phpbb\passwords\driver\helper $helper) { $this->config = $config; $this->helper = $helper; diff --git a/phpBB/phpbb/passwords/driver/bcrypt.php b/phpBB/phpbb/passwords/driver/bcrypt.php index db41fe6b38..2f6cc1b381 100644 --- a/phpBB/phpbb/passwords/driver/bcrypt.php +++ b/phpBB/phpbb/passwords/driver/bcrypt.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\passwords\driver; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * @package passwords */ -class phpbb_passwords_driver_bcrypt extends phpbb_passwords_driver_base +class bcrypt extends \phpbb\passwords\driver\base { const PREFIX = '$2a$'; diff --git a/phpBB/phpbb/passwords/driver/bcrypt_2y.php b/phpBB/phpbb/passwords/driver/bcrypt_2y.php index 5b0dbdd311..8da8c8dbc8 100644 --- a/phpBB/phpbb/passwords/driver/bcrypt_2y.php +++ b/phpBB/phpbb/passwords/driver/bcrypt_2y.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\passwords\driver; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * @package passwords */ -class phpbb_passwords_driver_bcrypt_2y extends phpbb_passwords_driver_bcrypt +class bcrypt_2y extends \phpbb\passwords\driver\bcrypt { const PREFIX = '$2y$'; diff --git a/phpBB/phpbb/passwords/driver/driver_interface.php b/phpBB/phpbb/passwords/driver/driver_interface.php new file mode 100644 index 0000000000..8c12834641 --- /dev/null +++ b/phpBB/phpbb/passwords/driver/driver_interface.php @@ -0,0 +1,70 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb\passwords\driver; + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* @package passwords +*/ +interface driver_interface +{ + /** + * Check if hash type is supported + * + * @return bool True if supported, false if not + */ + public function is_supported(); + /** + * Returns the hash prefix + * + * @return string Hash prefix + */ + public function get_prefix(); + + /** + * Hash the password + * + * @return string Password hash + */ + public function hash($password); + + /** + * Check the password against the supplied hash + * + * @param string $password The password to check + * @param string $hash The password hash to check against + * @return bool True if password is correct, else false + */ + public function check($password, $hash); + + /** + * Get only the settings of the specified hash + * + * @param string $hash Password hash + * @param bool $full Return full settings or only settings + * related to the salt + * @return string String containing the hash settings + */ + public function get_settings_only($hash, $full = false); + + /** + * Get the driver name + * + * @return string Driver name + */ + public function get_name(); +} diff --git a/phpBB/phpbb/passwords/driver/helper.php b/phpBB/phpbb/passwords/driver/helper.php index a50ac8819e..fbb6f9bb2b 100644 --- a/phpBB/phpbb/passwords/driver/helper.php +++ b/phpBB/phpbb/passwords/driver/helper.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\passwords\driver; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * @package passwords */ -class phpbb_passwords_driver_helper +class helper { /** * base64 alphabet diff --git a/phpBB/phpbb/passwords/driver/interface.php b/phpBB/phpbb/passwords/driver/interface.php deleted file mode 100644 index a2088db81c..0000000000 --- a/phpBB/phpbb/passwords/driver/interface.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* @package passwords -*/ -interface phpbb_passwords_driver_interface -{ - /** - * Check if hash type is supported - * - * @return bool True if supported, false if not - */ - public function is_supported(); - /** - * Returns the hash prefix - * - * @return string Hash prefix - */ - public function get_prefix(); - - /** - * Hash the password - * - * @return string Password hash - */ - public function hash($password); - - /** - * Check the password against the supplied hash - * - * @param string $password The password to check - * @param string $hash The password hash to check against - * @return bool True if password is correct, else false - */ - public function check($password, $hash); - - /** - * Get only the settings of the specified hash - * - * @param string $hash Password hash - * @param bool $full Return full settings or only settings - * related to the salt - * @return string String containing the hash settings - */ - public function get_settings_only($hash, $full = false); - - /** - * Get the driver name - * - * @return string Driver name - */ - public function get_name(); -} diff --git a/phpBB/phpbb/passwords/driver/phpass.php b/phpBB/phpbb/passwords/driver/phpass.php index d52ce96d11..32ccc399ba 100644 --- a/phpBB/phpbb/passwords/driver/phpass.php +++ b/phpBB/phpbb/passwords/driver/phpass.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\passwords\driver; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * @package passwords */ -class phpbb_passwords_driver_phpass extends phpbb_passwords_driver_salted_md5 +class phpass extends \phpbb\passwords\driver\salted_md5 { const PREFIX = '$P$'; diff --git a/phpBB/phpbb/passwords/driver/salted_md5.php b/phpBB/phpbb/passwords/driver/salted_md5.php index 6fa12948be..13d25560fe 100644 --- a/phpBB/phpbb/passwords/driver/salted_md5.php +++ b/phpBB/phpbb/passwords/driver/salted_md5.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\passwords\driver; + /** * @ignore */ @@ -18,7 +20,7 @@ if (!defined('IN_PHPBB')) /** * @package passwords */ -class phpbb_passwords_driver_salted_md5 extends phpbb_passwords_driver_base +class salted_md5 extends \phpbb\passwords\driver\base { const PREFIX = '$H$'; -- cgit v1.2.1