summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorash <ashleybaker@gmail.com>2013-04-10 14:59:42 +0200
committerash <ashleybaker@gmail.com>2013-04-10 14:59:42 +0200
commit29ae72d893627edb07ad4fa124f4f8c4e1e0df34 (patch)
treed7b91aba1855339907b1774dbede9301d8630dcc /system/helpers
parent4fa6385ff8232273f15f08fe8ef2799c9305419b (diff)
removed sanity checks (developer-supplied value, not user input), added changelog entry, changed variable names
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/captcha_helper.php18
1 files changed, 3 insertions, 15 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 731b59e14..61a478e9d 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -51,7 +51,7 @@ if ( ! function_exists('create_captcha'))
*/
function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '')
{
- $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200, 'captcha_word_length' => 8, 'character_pool_for_generated_word' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
+ $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200, 'word_length' => 8, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
foreach ($defaults as $key => $val)
{
@@ -72,17 +72,6 @@ if ( ! function_exists('create_captcha'))
return FALSE;
}
-
-
- // -----------------------------------
- // Make sure captcha max length is a valid/realistic value.
- // -----------------------------------
-
- $captcha_word_length = (int) $captcha_word_length;
- if ($captcha_word_length < 4) { $captcha_word_length = 4;}
- if ($captcha_word_length > 15) { $captcha_word_length = 15; }
-
-
// -----------------------------------
// Remove old images
// -----------------------------------
@@ -107,9 +96,9 @@ if ( ! function_exists('create_captcha'))
if (empty($word))
{
$word = '';
- for ($i = 0, $mt_rand_max = strlen($character_pool_for_generated_word) - 1; $i < $captcha_word_length; $i++)
+ for ($i = 0, $mt_rand_max = strlen($pool) - 1; $i < $word_length; $i++)
{
- $word .= $character_pool_for_generated_word[mt_rand(0, $mt_rand_max)];
+ $word .= $pool[mt_rand(0, $mt_rand_max)];
}
}
elseif ( ! is_string($word))
@@ -217,4 +206,3 @@ if ( ! function_exists('create_captcha'))
/* End of file captcha_helper.php */
/* Location: ./system/helpers/captcha_helper.php */
-