Line | |
---|
1 | <?php |
---|
2 | defined('EASYCAPTCHA_ID') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | include(EASYCAPTCHA_PATH.'include/common.inc.php'); |
---|
5 | add_event_handler('loc_end_page_header', 'add_easycaptcha'); |
---|
6 | add_event_handler('register_user_check', 'check_easycaptcha'); |
---|
7 | |
---|
8 | function add_easycaptcha() |
---|
9 | { |
---|
10 | global $template; |
---|
11 | $template->set_prefilter('register', 'prefilter_easycaptcha'); |
---|
12 | } |
---|
13 | |
---|
14 | function 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); |
---|
18 | } |
---|
19 | |
---|
20 | function 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.