aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/captcha/captcha_gd.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/captcha/captcha_gd.php')
-rw-r--r--phpBB/includes/captcha/captcha_gd.php52
1 files changed, 25 insertions, 27 deletions
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php
index ecdad43978..3a82457c4a 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/includes/captcha/captcha_gd.php
@@ -2,9 +2,8 @@
/**
*
* @package VC
-* @version $Id$
* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -27,7 +26,6 @@ class captcha
var $width = 360;
var $height = 96;
-
/**
* Create the image containing $code with a seed of $seed
*/
@@ -70,7 +68,6 @@ class captcha
$bounding_boxes[$i] = $box;
}
-
// Redistribute leftover x-space
$offset = array();
for ($i = 0; $i < $code_len; ++$i)
@@ -100,12 +97,12 @@ class captcha
imagedashedline($img, mt_rand($x -3, $x + 3), mt_rand(0, 4), mt_rand($x -3, $x + 3), mt_rand($this->height - 5, $this->height), $current_colour);
}
}
+
if ($config['captcha_gd_wave'] && ($config['captcha_gd_y_grid'] || $config['captcha_gd_y_grid']))
{
$this->wave($img);
}
-
-
+
if ($config['captcha_gd_3d_noise'])
{
$xoffset = mt_rand(0,9);
@@ -123,11 +120,12 @@ class captcha
$dimm = $bounding_boxes[$i];
$xoffset += ($offset[$i] - $dimm[0]);
$yoffset = mt_rand(-$dimm[1], $this->height - $dimm[3]);
-
+
$noise[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
$xoffset += $dimm[2];
}
}
+
$xoffset = 5;
for ($i = 0; $i < $code_len; ++$i)
{
@@ -138,14 +136,17 @@ class captcha
$characters[$i]->drawchar($sizes[$i], $xoffset, $yoffset, $img, $colour->get_resource('background'), $scheme);
$xoffset += $dimm[2];
}
+
if ($config['captcha_gd_wave'])
{
$this->wave($img);
}
+
if ($config['captcha_gd_foreground_noise'])
{
$this->noise_line($img, 0, 0, $this->width, $this->height, $colour->get_resource('background'), $scheme, $bg_colours);
}
+
// Send image
header('Content-Type: image/png');
header('Cache-control: no-cache, no-store');
@@ -234,7 +235,6 @@ class captcha
imagesetthickness($img, 1);
}
-
function captcha_noise_bg_bitmaps()
{
return array(
@@ -293,7 +293,7 @@ class captcha
),
));
}
-
+
/**
* Return bitmaps
*/
@@ -2226,8 +2226,8 @@ class colour_manager
return $this->random_colour($colour, $mode);
}
- $rgb = colour_manager::model_convert($colour, $mode, 'rgb');
- $store = ($this->mode == 'rgb') ? $rgb : colour_manager::model_convert($colour, $mode, $this->mode);
+ $rgb = $this->model_convert($colour, $mode, 'rgb');
+ $store = ($this->mode == 'rgb') ? $rgb : $this->model_convert($colour, $mode, $this->mode);
$resource = imagecolorallocate($this->img, $rgb[0], $rgb[1], $rgb[2]);
$this->colours[$resource] = $store;
@@ -2345,7 +2345,7 @@ class colour_manager
$resource = $pre;
}
- $colour = colour_manager::model_convert($this->colours[$resource], $this->mode, $mode);
+ $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
$results = ($include_original) ? array($resource) : array();
$colour2 = $colour3 = $colour4 = $colour;
$colour2[0] += 150;
@@ -2380,7 +2380,7 @@ class colour_manager
$resource = $pre;
}
- $colour = colour_manager::model_convert($this->colours[$resource], $this->mode, $mode);
+ $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
$results = array();
if ($include_original)
@@ -2418,11 +2418,11 @@ class colour_manager
switch ($from_model)
{
case 'ahsv':
- return colour_manager::ah2h($colour);
+ return $this->ah2h($colour);
break;
case 'rgb':
- return colour_manager::rgb2hsv($colour);
+ return $this->rgb2hsv($colour);
break;
}
break;
@@ -2432,11 +2432,11 @@ class colour_manager
switch ($from_model)
{
case 'hsv':
- return colour_manager::h2ah($colour);
+ return $this->h2ah($colour);
break;
case 'rgb':
- return colour_manager::h2ah(colour_manager::rgb2hsv($colour));
+ return $this->h2ah($this->rgb2hsv($colour));
break;
}
break;
@@ -2445,11 +2445,11 @@ class colour_manager
switch ($from_model)
{
case 'hsv':
- return colour_manager::hsv2rgb($colour);
+ return $this->hsv2rgb($colour);
break;
case 'ahsv':
- return colour_manager::hsv2rgb(colour_manager::ah2h($colour));
+ return $this->hsv2rgb($this->ah2h($colour));
break;
}
break;
@@ -2462,7 +2462,7 @@ class colour_manager
*/
function hsv2rgb($hsv)
{
- colour_manager::normalize_hue($hsv[0]);
+ $this->normalize_hue($hsv[0]);
$h = $hsv[0];
$s = min(1, max(0, $hsv[1] / 100));
@@ -2554,7 +2554,7 @@ class colour_manager
break;
}
}
- colour_manager::normalize_hue($h);
+ $this->normalize_hue($h);
return array($h, $s * 100, $v * 100);
}
@@ -2578,10 +2578,10 @@ class colour_manager
{
if (is_array($ahue))
{
- $ahue[0] = colour_manager::ah2h($ahue[0]);
+ $ahue[0] = $this->ah2h($ahue[0]);
return $ahue;
}
- colour_manager::normalize_hue($ahue);
+ $this->normalize_hue($ahue);
// blue through red is already ok
if ($ahue >= 240)
@@ -2612,10 +2612,10 @@ class colour_manager
{
if (is_array($hue))
{
- $hue[0] = colour_manager::h2ah($hue[0]);
+ $hue[0] = $this->h2ah($hue[0]);
return $hue;
}
- colour_manager::normalize_hue($hue);
+ $this->normalize_hue($hue);
// blue through red is already ok
if ($hue >= 240)
@@ -2636,5 +2636,3 @@ class colour_manager
}
}
}
-
-?> \ No newline at end of file