diff options
Diffstat (limited to 'phpBB/phpbb/passwords/driver/helper.php')
-rw-r--r-- | phpBB/phpbb/passwords/driver/helper.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/phpBB/phpbb/passwords/driver/helper.php b/phpBB/phpbb/passwords/driver/helper.php index fbb6f9bb2b..da66347ac3 100644 --- a/phpBB/phpbb/passwords/driver/helper.php +++ b/phpBB/phpbb/passwords/driver/helper.php @@ -23,12 +23,27 @@ if (!defined('IN_PHPBB')) class helper { /** + * @var phpbb\config\config + */ + protected $config; + + /** * base64 alphabet * @var string */ public $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; /** + * Construct a driver helper object + * + * @param phpbb\config\config $config phpBB configuration + */ + public function __construct(\phpbb\config\config $config) + { + $this->config = $config; + } + + /** * Base64 encode hash * * @param string $input Input string @@ -86,16 +101,15 @@ class helper public function unique_id($extra = 'c') { static $dss_seeded = false; - global $config; - $val = $config['rand_seed'] . microtime(); + $val = $this->config['rand_seed'] . microtime(); $val = md5($val); - $config['rand_seed'] = md5($config['rand_seed'] . $val . $extra); + $this->config['rand_seed'] = md5($this->config['rand_seed'] . $val . $extra); - if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10))) + if ($dss_seeded !== true && ($this->config['rand_seed_last_update'] < time() - rand(1,10))) { - set_config('rand_seed_last_update', time(), true); - set_config('rand_seed', $config['rand_seed'], true); + $this->config->set('rand_seed_last_update', time(), true); + $this->config->set('rand_seed', $this->config['rand_seed'], true); $dss_seeded = true; } |