summaryrefslogtreecommitdiffstats
path: root/system/helpers/captcha_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-08 00:42:59 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-08 00:42:59 +0100
commit7203d54604a372fd8dd0b30bd8d4cdbd0af738bc (patch)
treeaf3bac1918ebd0fbd3d7564fc7c5fca34e6c2733 /system/helpers/captcha_helper.php
parent51a22815994cfd4522c78177e41f064ab8e53415 (diff)
parentad9cd5938fe3c0859445e43c893c18ed172a33ce (diff)
Merge upstream branch
Diffstat (limited to 'system/helpers/captcha_helper.php')
-rw-r--r--system/helpers/captcha_helper.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index c302a828b..865a6754d 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -76,8 +76,7 @@ if ( ! function_exists('create_captcha'))
// Remove old images
// -----------------------------------
- list($usec, $sec) = explode(' ', microtime());
- $now = ((float)$usec + (float)$sec);
+ $now = microtime(TRUE);
$current_dir = @opendir($img_path);
while ($filename = @readdir($current_dir))
@@ -158,32 +157,32 @@ if ( ! function_exists('create_captcha'))
// -----------------------------------
// Write the text
// -----------------------------------
- $use_font = ($font_path != '' && file_exists($font_path) && function_exists('imagettftext'));
- if ($use_font == FALSE)
+ $use_font = ($font_path != '' && file_exists($font_path) && function_exists('imagettftext'));
+ if ($use_font === FALSE)
{
$font_size = 5;
- $x = rand(0, $img_width/($length/3));
+ $x = rand(0, $img_width / ($length / 3));
$y = 0;
}
else
{
$font_size = 16;
- $x = rand(0, $img_width/($length/1.5));
- $y = $font_size+2;
+ $x = rand(0, $img_width / ($length / 1.5));
+ $y = $font_size + 2;
}
for ($i = 0; $i < $length; $i++)
{
- if ($use_font == FALSE)
+ if ($use_font === FALSE)
{
- $y = rand(0 , $img_height/2);
+ $y = rand(0 , $img_height / 2);
imagestring($im, $font_size, $x, $y, $word[$i], $text_color);
- $x += ($font_size*2);
+ $x += ($font_size * 2);
}
else
{
- $y = rand($img_height/2, $img_height-3);
+ $y = rand($img_height / 2, $img_height - 3);
imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, $word[$i]);
$x += $font_size;
}
@@ -191,7 +190,7 @@ if ( ! function_exists('create_captcha'))
// Create the border
- imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color);
+ imagerectangle($im, 0, 0, $img_width - 1, $img_height - 1, $border_color);
// -----------------------------------
// Generate the image