diff options
Diffstat (limited to 'phpBB/includes/captcha')
-rw-r--r-- | phpBB/includes/captcha/captcha_gd.php | 15 | ||||
-rw-r--r-- | phpBB/includes/captcha/captcha_gd_wave.php | 6 |
2 files changed, 11 insertions, 10 deletions
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/includes/captcha/captcha_gd.php index f58b590c4b..ab45aa9db6 100644 --- a/phpBB/includes/captcha/captcha_gd.php +++ b/phpBB/includes/captcha/captcha_gd.php @@ -26,7 +26,6 @@ class captcha var $width = 360; var $height = 96; - /** * Create the image containing $code with a seed of $seed */ @@ -69,7 +68,6 @@ class captcha $bounding_boxes[$i] = $box; } - // Redistribute leftover x-space $offset = array(); for ($i = 0; $i < $code_len; ++$i) @@ -99,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); @@ -122,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) { @@ -137,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'); @@ -233,7 +235,6 @@ class captcha imagesetthickness($img, 1); } - function captcha_noise_bg_bitmaps() { return array( @@ -292,7 +293,7 @@ class captcha ), )); } - + /** * Return bitmaps */ diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/includes/captcha/captcha_gd_wave.php index e19f54f777..185352dd4e 100644 --- a/phpBB/includes/captcha/captcha_gd_wave.php +++ b/phpBB/includes/captcha/captcha_gd_wave.php @@ -86,7 +86,7 @@ class captcha $fontcolors[0] = imagecolorallocate($img, mt_rand(0, 120), mt_rand(0, 120), mt_rand(0, 120)); - $colors = array(); + $colors = array(); $minr = mt_rand(20, 30); $ming = mt_rand(20, 30); @@ -184,7 +184,7 @@ class captcha for ($x = 1; $x <= $full_x; ++$x) { - $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, 1, $x_grid, $y_grid); + $cur_height = $this->wave_height($x, $y, $subdivision_factor) + $this->grid_height($x, $y, $x_grid, $y_grid, 1); // height is a z-factor, not a y-factor $offset = $cur_height - $prev_height; @@ -264,7 +264,7 @@ class captcha return ((sin($x / (3 * $factor)) + sin($y / (3 * $factor))) * 10 * $tweak); } - function grid_height($x, $y, $factor = 1, $x_grid, $y_grid) + function grid_height($x, $y, $x_grid, $y_grid, $factor = 1) { return ((!($x % ($x_grid * $factor)) || !($y % ($y_grid * $factor))) ? 3 : 0); } |