diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-15 15:35:50 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-15 15:35:50 +0000 |
| commit | 548cc2c10b56cc9e5c71c2f87356947939abe888 (patch) | |
| tree | 82a2ceac1eb474aad83281f5d5b4fe94b0ad4d92 /phpBB/includes/captcha/captcha_non_gd.php | |
| parent | 979e36077fa6ae9bbee81bacaaef029aa13c6df0 (diff) | |
| download | forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.gz forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.bz2 forums-548cc2c10b56cc9e5c71c2f87356947939abe888.tar.xz forums-548cc2c10b56cc9e5c71c2f87356947939abe888.zip | |
- fixes for the following bugs:
#5326
#5318
#5304
#5290
#5288
#5278
#5276
#5272
#5266
- also fixed the "Call-time pass-by-reference" bug #5252
- within this step changed the normalize calls to require references.
- added captcha size variables to the class scope (suggestion was posted at area51)
git-svn-id: file:///svn/phpbb/trunk@6584 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/captcha/captcha_non_gd.php')
| -rw-r--r-- | phpBB/includes/captcha/captcha_non_gd.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/phpBB/includes/captcha/captcha_non_gd.php b/phpBB/includes/captcha/captcha_non_gd.php index e4ab36f30b..41bd22868e 100644 --- a/phpBB/includes/captcha/captcha_non_gd.php +++ b/phpBB/includes/captcha/captcha_non_gd.php @@ -17,6 +17,8 @@ class captcha { var $filtered_pngs; + var $width = 320; + var $height = 50; /** * Define filtered pngs on init @@ -32,9 +34,7 @@ class captcha */ function execute($code) { - $total_width = 320; - $total_height = 50; - $img_height = 40; + $img_height = $this->height - 10; $img_width = 0; list($usec, $sec) = explode(' ', microtime()); @@ -45,7 +45,7 @@ class captcha for ($i = 0; $i < $code_len; $i++) { - $char = $code{$i}; + $char = $code[$i]; $width = mt_rand(0, 4); $raw_width = $this->filtered_pngs[$char]['width']; @@ -59,11 +59,11 @@ class captcha } } - $offset_x = mt_rand(0, $total_width - $img_width); - $offset_y = mt_rand(0, $total_height - $img_height); + $offset_x = mt_rand(0, $this->width - $img_width); + $offset_y = mt_rand(0, $this->height - $img_height); $image = ''; - for ($i = 0; $i < $total_height; $i++) + for ($i = 0; $i < $this->height; $i++) { $image .= chr(0); @@ -79,14 +79,14 @@ class captcha $image .= $this->randomise(substr($hold_chars[$code{$j}][$i - $offset_y - 1], 1), $char_widths[$j]); } - for ($j = $offset_x + $img_width; $j < $total_width; $j++) + for ($j = $offset_x + $img_width; $j < $this->width; $j++) { $image .= chr(mt_rand(140, 255)); } } else { - for ($j = 0; $j < $total_width; $j++) + for ($j = 0; $j < $this->width; $j++) { $image .= chr(mt_rand(140, 255)); } @@ -94,7 +94,7 @@ class captcha } unset($hold_chars); - $image = $this->create_png($image, $total_width, $total_height); + $image = $this->create_png($image, $this->width, $this->height); // Output image header('Content-Type: image/png'); |
