Commit cc6069d9 authored by Arnab Nandi's avatar Arnab Nandi

Fixed #51384. Thanks @gordon

parent 4ee441b2
......@@ -29,11 +29,17 @@ function captcha_menu($may_cache) {
$items = array();
$suffix = '';
if (arg(2)!=null) $suffix='/'.arg(2);
$items[] = array('path' => 'captcha/image'.$suffix, 'title' => t('captcha image'),
'callback' => _captcha_call('_captcha_image'), 'access' => user_access('access captchas'),
'type' => MENU_CALLBACK);
if ($may_cache) {
if (arg(2)!=null) $suffix='/'.arg(2);
$items[] = array(
'path' => 'captcha/image'.$suffix, 'title' => t('captcha image'),
'callback' => '_captcha_call',
'callback arguments' => array('_captcha_image'),
'access' => user_access('access captchas'),
'type' => MENU_CALLBACK
);
}
return $items;
}
......@@ -211,7 +217,7 @@ function _captcha_font_list() {
function _captcha_call($func) {
_captcha_load();
//if (function_exists($func)) call_user_func_array($func, array());
if (function_exists($func)) call_user_func_array($func, array());
}
/**
......
<?
function _captcha_image_challenge(&$form) {
$form['captcha_image'] = array (
'#type' => 'item',
'#title' => 'captcha image',
'#weight' => 0,
'#value' => '<img src="' . url('captcha/image/'.time()) . '" alt="Captcha Image: you will need to recognize the text in it."/>',
);
$form['captcha_response'] = array (
'#type' => 'textfield',
'#title' => t('Word'),
'#title' => t('Captcha Validation'),
'#defaultvalue' => '',
'#weight' => 0,
'#required' => TRUE,
'#validate' => array('_captcha_validate' => array()),
'#description' => t('Please type in the letters/numbers that are shown in the image above.')
'#description' => t('Please type in the letters/numbers that are shown in the image above.'),
'#prefix' => '<img src="' . url('captcha/image/'.time()) . '" alt="Captcha Image: you will need to recognize the text in it."/>',
);
return $form;
......
<?
function _captcha_math_challenge(&$form, &$captcha) {
$x = rand(1,10);
......
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