Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | $cryptinstall = CRYPTO_PATH.'cryptographp/cryptographp.fct.php'; |
---|
6 | include($cryptinstall); |
---|
7 | |
---|
8 | add_event_handler('loc_end_page_header', 'add_captcha'); |
---|
9 | add_event_handler('register_user_check', 'check_captcha'); |
---|
10 | |
---|
11 | function add_captcha() |
---|
12 | { |
---|
13 | global $template, $conf; |
---|
14 | |
---|
15 | $template->set_prefilter('register', 'captcha_prefilter'); |
---|
16 | $template->assign('CAPTCHA', dsp_crypt($conf['cryptographp_theme'][0].'.cfg.php',1)); |
---|
17 | } |
---|
18 | |
---|
19 | function captcha_prefilter($content, $smarty) |
---|
20 | { |
---|
21 | load_language('plugin.lang', CRYPTO_PATH); |
---|
22 | |
---|
23 | $search = '<p class="bottomButtons">'; |
---|
24 | $replace = ' |
---|
25 | <fieldset> |
---|
26 | <legend>{\'Antibot test\'|@translate}</legend> |
---|
27 | <ul> |
---|
28 | <li> |
---|
29 | <span class="property"> |
---|
30 | <label>{$CAPTCHA}</label> |
---|
31 | </span> |
---|
32 | <input type="text" name="code"> |
---|
33 | </li> |
---|
34 | </ul> |
---|
35 | </fieldset>' |
---|
36 | ."\n".$search; |
---|
37 | |
---|
38 | return str_replace($search, $replace, $content); |
---|
39 | } |
---|
40 | |
---|
41 | function check_captcha($errors) |
---|
42 | { |
---|
43 | if (!chk_crypt($_POST['code'])) |
---|
44 | { |
---|
45 | load_language('plugin.lang', CRYPTO_PATH); |
---|
46 | array_push($errors, l10n('Invalid Captcha')); |
---|
47 | } |
---|
48 | |
---|
49 | return $errors; |
---|
50 | } |
---|
51 | |
---|
52 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.