Commit b0cf8464 authored by soxofaan's avatar soxofaan

Drupal6 port: addressed changed watchdog() usage

parent 81b24ce0
......@@ -146,9 +146,9 @@ function _captcha_persistence_skip($form_id) {
return isset($_SESSION['captcha']['success']) && ($_SESSION['captcha']['success'] === TRUE);
case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM:
return isset($_SESSION['captcha'][$form_id]['success']) && ($_SESSION['captcha'][$form_id]['success'] === TRUE);
default:
default:
return FALSE;
}
}
}
/**
......@@ -189,8 +189,8 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
if (!$captcha) {
//The selected module returned nothing, maybe it is disabled or it's wrong, we should watchdog that and then quit.
watchdog('CAPTCHA',
t('CAPTCHA problem: hook_captcha() of module %module returned nothing when trying to retrieve challenge type %type for form %form_id.',
array('%type' => $captcha_point->type, '%module' => $captcha_point->module, '%form_id' => $form_id)),
'CAPTCHA problem: hook_captcha() of module %module returned nothing when trying to retrieve challenge type %type for form %form_id.',
array('%type' => $captcha_point->type, '%module' => $captcha_point->module, '%form_id' => $form_id),
WATCHDOG_ERROR);
return;
}
......@@ -329,11 +329,10 @@ function captcha_validate($form, &$form_state) {
// log to watchdog if needed
if (variable_get('captcha_log_wrong_responses', FALSE)) {
watchdog('CAPTCHA',
t('%form_id post blocked by CAPTCHA module: challenge "%challenge" (by module "%module"), user answered "%response", but the solution was "%solution".',
array('%form_id' => $form_id,
'%response' => $captcha_response, '%solution' => $_SESSION['captcha'][$form_id][$captcha_token],
'%challenge' => $captcha_info['type'], '%module' => $captcha_info['module'],
)
'%form_id post blocked by CAPTCHA module: challenge "%challenge" (by module "%module"), user answered "%response", but the solution was "%solution".',
array('%form_id' => $form_id,
'%response' => $captcha_response, '%solution' => $_SESSION['captcha'][$form_id][$captcha_token],
'%challenge' => $captcha_info['type'], '%module' => $captcha_info['module'],
),
WATCHDOG_NOTICE);
}
......
......@@ -49,7 +49,7 @@ function image_captcha_settings_form() {
'#title' => t('Font settings'),
);
$available_fonts = _image_captcha_available_fonts();
list($default_font, $errmsg) = _image_captcha_get_font();
list($default_font, $errmsg, $errvar) = _image_captcha_get_font();
$form['image_captcha_font_settings']['image_captcha_font'] = array(
'#type' => 'select',
'#title' => t('Font'),
......
......@@ -55,11 +55,13 @@ function image_captcha_menu() {
function _image_captcha_get_font() {
$font = variable_get('image_captcha_font', 'BUILTIN');
$errmsg = FALSE;
$errvar = array();
if ($font != 'BUILTIN' && (!is_file($font) || !is_readable($font))) {
$errmsg = t('Could not find or read the configured font "%font" for the image captcha.', array('%font' => $font));
$errmsg = 'Could not find or read the configured font "%font" for the image captcha.';
$errvar = array('%font' => $font);
$font = FALSE;
}
return array($font, $errmsg);
return array($font, $errmsg, $errvar);
}
/**
......@@ -103,7 +105,7 @@ function image_captcha_captcha($op, $captcha_type='') {
switch ($op) {
case 'list':
// only offer image CAPTCHA if possible to generate an image CAPTCHA
list($font, $errmsg) = _image_captcha_get_font();
list($font, $errmsg, $errvar) = _image_captcha_get_font();
if (function_exists('imagejpeg') && $font) {
return array('Image');
}
......
......@@ -48,9 +48,9 @@ function image_captcha_image($seed=NULL) {
*/
function _image_captcha_generate_image($code) {
// get font
list($font, $errmsg) = _image_captcha_get_font();
list($font, $errmsg, $errvar) = _image_captcha_get_font();
if (!$font) {
watchdog('CAPTCHA', $errmsg, WATCHDOG_ERROR);
watchdog('CAPTCHA', $errmsg, $errvar, WATCHDOG_ERROR);
exit();
}
// get other settings
......
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