source: extensions/EasyCaptcha/include/guestbook.inc.php @ 26069

Last change on this file since 26069 was 26069, checked in by mistic100, 10 years ago

try to simplify integration of captchas

File size: 495 bytes
RevLine 
[24215]1<?php
2defined('EASYCAPTCHA_ID') or die('Hacking attempt!');
3
[26069]4$conf['EasyCaptcha']['template'] = 'guestbook';
[24215]5include(EASYCAPTCHA_PATH.'include/common.inc.php');
[26069]6
[26068]7add_event_handler('user_comment_check', 'check_easycaptcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
[24215]8
9function check_easycaptcha($action, $comment)
10{
11  global $conf, $page;
12
13  if (!is_a_guest()) return $action;
14
15  if (!easycaptcha_check())
16  {
17    $page['errors'][] = l10n('Invalid answer');
18    return 'reject';
19  }
20
21  return $action;
22}
Note: See TracBrowser for help on using the repository browser.