aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/captcha
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/captcha')
-rw-r--r--phpBB/includes/captcha/captcha_gd.php17
-rw-r--r--phpBB/includes/captcha/plugins/captcha_abstract.php10
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php4
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php4
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php18
5 files changed, 26 insertions, 27 deletions
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php
index 74afc152a2..e8ad9df37d 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/includes/captcha/captcha_gd.php
@@ -32,7 +32,6 @@ class captcha
*/
public static function execute($code, $seed)
{
- global $config;
srand($seed);
mt_srand($seed);
@@ -79,9 +78,9 @@ class captcha
$width_avail -= $offset[$i];
}
- if ($config['captcha_gd_x_grid'])
+ if (phpbb::$config['captcha_gd_x_grid'])
{
- $grid = (int) $config['captcha_gd_x_grid'];
+ $grid = (int) phpbb::$config['captcha_gd_x_grid'];
for ($y = 0; $y < self::height; $y += mt_rand($grid - 2, $grid + 2))
{
$current_colour = $scheme[array_rand($scheme)];
@@ -89,9 +88,9 @@ class captcha
}
}
- if ($config['captcha_gd_y_grid'])
+ if (phpbb::$config['captcha_gd_y_grid'])
{
- $grid = (int) $config['captcha_gd_y_grid'];
+ $grid = (int) phpbb::$config['captcha_gd_y_grid'];
for ($x = 0; $x < self::width; $x += mt_rand($grid - 2, $grid + 2))
{
$current_colour = $scheme[array_rand($scheme)];
@@ -109,8 +108,8 @@ class captcha
$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
$xoffset += $dimm[2];
}
-
- if ($config['captcha_gd_foreground_noise'])
+
+ if (phpbb::$config['captcha_gd_foreground_noise'])
{
self::noise_line($img, 0, 0, self::width, self::height, $colour->get_resource('background'), $scheme, $bg_colours);
}
@@ -1123,7 +1122,7 @@ class colour_manager
{
$mode = $this->mode;
}
-
+
if (!is_array($colour))
{
if (isset($this->named_rgb[$colour]))
@@ -1317,7 +1316,7 @@ class colour_manager
}
// This is a hard problem. I chicken out and try to maintain readability at the cost of less randomness.
-
+
while ($count > 0)
{
$colour[1] = ($colour[1] + mt_rand(40,60)) % 99;
diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php
index c8545cdd69..7cc3bf8abb 100644
--- a/phpBB/includes/captcha/plugins/captcha_abstract.php
+++ b/phpBB/includes/captcha/plugins/captcha_abstract.php
@@ -32,7 +32,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
function init($type)
{
- global $config, $db, $user;
+ global $db, $user;
// read input
$this->confirm_id = request_var('confirm_id', '');
@@ -76,7 +76,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
function get_template()
{
- global $config, $user, $template;
+ global $user, $template;
$template->set_filenames(array(
'captcha' => 'captcha_default.html')
@@ -92,7 +92,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
function get_demo_template($id)
{
- global $config, $user, $template;
+ global $user, $template;
$template->set_filenames(array(
'captcha_demo' => 'captcha_default_acp_demo.html')
@@ -121,7 +121,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
static function garbage_collect($type)
{
- global $db, $config;
+ global $db;
$sql = 'SELECT DISTINCT c.session_id
FROM ' . CONFIRM_TABLE . ' c
@@ -161,7 +161,7 @@ abstract class phpbb_default_captcha implements phpbb_captcha_plugin
function validate()
{
- global $config, $db, $user;
+ global $db, $user;
$this->confirm_code = request_var('confirm_code', '');
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
index 906a63105a..8711c9bb14 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
@@ -50,7 +50,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha implements phpbb_captcha_pl
function acp_page($id, &$module)
{
- global $config, $db, $template, $user;
+ global $db, $template, $user;
$captcha_vars = array(
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
@@ -87,7 +87,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha implements phpbb_captcha_pl
{
foreach ($captcha_vars as $captcha_var => $template_var)
{
- $var = request_var($captcha_var, (int) $config[$captcha_var]);
+ $var = request_var($captcha_var, (int) phpbb::$config[$captcha_var]);
$template->assign_var($template_var, $var);
}
$template->assign_vars(array(
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
index 57f0cb88e3..6b1629f8ad 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
@@ -50,8 +50,8 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha implements phpbb_captc
function acp_page($id, &$module)
{
- global $config, $db, $template, $user;
-
+ global $db, $template, $user;
+
trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
}
}
diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
index ea5069fe99..ddb52ba8e8 100644
--- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
@@ -28,7 +28,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
function init($type)
{
- global $config, $db, $user;
+ global $db, $user;
$user->add_lang('recaptcha');
parent::init($type);
@@ -44,9 +44,9 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
static function is_available()
{
- global $config, $user;
+ global $user;
$user->add_lang('recaptcha');
- return (isset($config['recaptcha_pubkey']) && !empty($config['recaptcha_pubkey']));
+ return (isset(phpbb::$config['recaptcha_pubkey']) && !empty(phpbb::$config['recaptcha_pubkey']));
}
static function get_name()
@@ -61,7 +61,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
function acp_page($id, &$module)
{
- global $config, $db, $template, $user;
+ global $db, $template, $user;
$captcha_vars = array(
'recaptcha_pubkey' => 'RECAPTCHA_PUBKEY',
@@ -96,7 +96,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
{
foreach ($captcha_vars as $captcha_var => $template_var)
{
- $var = request_var($captcha_var, (isset($config[$captcha_var])) ? (string) $config[$captcha_var] : '');
+ $var = request_var($captcha_var, (isset(phpbb::$config[$captcha_var])) ? (string) phpbb::$config[$captcha_var] : '');
$template->assign_var($template_var, $var);
}
$template->assign_vars(array(
@@ -122,7 +122,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
function get_template()
{
- global $config, $user, $template;
+ global $user, $template;
$template->set_filenames(array(
'captcha' => 'captcha_recaptcha.html')
@@ -130,7 +130,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
$template->assign_vars(array(
'RECAPTCHA_SERVER' => self::recaptcha_server,
- 'RECAPTCHA_PUBKEY' => isset($config['recaptcha_pubkey']) ? $config['recaptcha_pubkey'] : '',
+ 'RECAPTCHA_PUBKEY' => isset(phpbb::$config['recaptcha_pubkey']) ? phpbb::$config['recaptcha_pubkey'] : '',
'RECAPTCHA_ERRORGET' => '',
'S_RECAPTCHA_AVAILABLE' => self::is_available(),
));
@@ -260,7 +260,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
*/
protected function recaptcha_check_answer($extra_params = array())
{
- global $config, $user;
+ global $user;
// discard spam submissions
if ($this->challenge == null || strlen($this->challenge) == 0 || $this->response == null || strlen($this->response) == 0)
@@ -269,7 +269,7 @@ class phpbb_recaptcha extends phpbb_default_captcha implements phpbb_captcha_plu
}
$response = $this->_recaptcha_http_post(self::recaptcha_verify_server, '/verify', array(
- 'privatekey' => $config['recaptcha_privkey'],
+ 'privatekey' => phpbb::$config['recaptcha_privkey'],
'remoteip' => $user->ip,
'challenge' => $this->challenge,
'response' => $this->response,