source: extensions/EasyCaptcha/include/register.inc.php @ 26025

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

update for 2.6

File size: 745 bytes
Line 
1<?php
2defined('EASYCAPTCHA_ID') or die('Hacking attempt!');
3
4include(EASYCAPTCHA_PATH.'include/common.inc.php');
5add_event_handler('loc_end_page_header', 'add_easycaptcha');
6add_event_handler('register_user_check', 'check_easycaptcha');
7
8function add_easycaptcha()
9{
10  global $template;
11  $template->set_prefilter('register', 'prefilter_easycaptcha');
12}
13
14function prefilter_easycaptcha($content, $smarty)
15{
16  $search = '<input type="checkbox" name="send_password_by_mail" id="send_password_by_mail" value="1" checked="checked">';
17  return str_replace($search, $search."\n{\$EASYCAPTCHA_CONTENT}", $content);
18}
19
20function check_easycaptcha($errors)
21{
22  if (!easycaptcha_check())
23  {
24    $errors[] = l10n('Invalid answer');
25  }
26
27  return $errors;
28}
Note: See TracBrowser for help on using the repository browser.