Commit 48008b4a authored by soxofaan's avatar soxofaan

fixed issues in image_captcha reported by coder module

parent e603853d
......@@ -166,18 +166,16 @@ function image_captcha_settings_form_pre_render($form) {
* Validation function for image_captcha configuration form
*/
function image_captcha_settings_form_validate($form, &$form_state) {
if ($form['form_id']['#value'] == 'image_captcha_settings_form') {
// check image_captcha_image_allowed_chars for spaces
if (preg_match('/\s/', $form_state['values']['image_captcha_image_allowed_chars'])) {
form_set_error('image_captcha_image_allowed_chars', t('The list of characters to use should not contain spaces.'));
}
// check font
$font = $form_state['values']['image_captcha_font'];
if ($font == '0') {
form_set_error('image_captcha_font', t('You need to select a font'));
}
elseif ($font != 'BUILTIN' && (!is_file($font) || !is_readable($font))) {
form_set_error('image_captcha_font', t('Font does not exist or is not readable.'));
}
// check image_captcha_image_allowed_chars for spaces
if (preg_match('/\s/', $form_state['values']['image_captcha_image_allowed_chars'])) {
form_set_error('image_captcha_image_allowed_chars', t('The list of characters to use should not contain spaces.'));
}
// check font
$font = $form_state['values']['image_captcha_font'];
if ($font == '0') {
form_set_error('image_captcha_font', t('You need to select a font'));
}
elseif ($font != 'BUILTIN' && (!is_file($font) || !is_readable($font))) {
form_set_error('image_captcha_font', t('Font does not exist or is not readable.'));
}
}
......@@ -10,8 +10,8 @@ define('IMAGE_CAPTCHA_ALLOWED_CHARACTERS', 'aAbBCdEeFfGHhijKLMmNPQRrSTtWXYZ23456
/**
* Implementation of hook_help().
*/
function image_captcha_help($section) {
switch ($section) {
function image_captcha_help($path, $arg) {
switch ($path) {
case 'admin/user/captcha/image_captcha':
$output = '<p>'. t('The image CAPTCHA is a popular challenge where a random textual code is obfuscated in an image. The image is generated on the fly for each request, which is rather CPU intensive for the server. Be carefull with the size and computation related settings.') .'</p>';
if (in_array('Image', image_captcha_captcha('list'))) {
......@@ -86,7 +86,7 @@ function _image_captcha_utf8_split($str) {
$width = 4;
}
else {
watchdog('CAPTCHA', t('Encountered an illegal byte while splitting an utf8 string in characters.'), WATCHDOG_ERROR);
watchdog('CAPTCHA', 'Encountered an illegal byte while splitting an utf8 string in characters.', array(), WATCHDOG_ERROR);
return $characters;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment