Last change
on this file since 15907 was
14527,
checked in by mistic100, 12 years ago
|
update for 2.4
deactivated for smartpocket, now compatible with simple and stripped on ContactForm
live update of preview on admin page
|
File size:
1.6 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | load_language('plugin.lang', CRYPTO_PATH); |
---|
5 | add_event_handler('loc_end_page_header', 'add_crypto'); |
---|
6 | add_event_handler('register_user_check', 'check_crypto'); |
---|
7 | |
---|
8 | function add_crypto() |
---|
9 | { |
---|
10 | global $template; |
---|
11 | |
---|
12 | $template->set_prefilter('register', 'prefilter_crypto'); |
---|
13 | } |
---|
14 | |
---|
15 | function prefilter_crypto($content, $smarty) |
---|
16 | { |
---|
17 | global $conf, $user; |
---|
18 | |
---|
19 | $search = '#\(\{\'useful when password forgotten\'\|@translate\}\)(\s*)((\{/if\})?)#i'; |
---|
20 | $replace = '({\'useful when password forgotten\'|@translate})$1$2 |
---|
21 | </li> |
---|
22 | <li> |
---|
23 | <span class="property"> |
---|
24 | <label for="captcha_code">{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} <img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label> |
---|
25 | <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false"> |
---|
26 | <img src="'.CRYPTO_PATH.'template/refresh.png"></a> |
---|
27 | </span> |
---|
28 | <input type="text" id="captcha_code" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" />'; |
---|
29 | |
---|
30 | return preg_replace($search, $replace, $content); |
---|
31 | } |
---|
32 | |
---|
33 | function check_crypto($errors) |
---|
34 | { |
---|
35 | include_once(CRYPTO_PATH.'securimage/securimage.php'); |
---|
36 | $securimage = new Securimage(); |
---|
37 | |
---|
38 | if ($securimage->check($_POST['captcha_code']) == false) |
---|
39 | { |
---|
40 | array_push($errors, l10n('Invalid Captcha')); |
---|
41 | } |
---|
42 | |
---|
43 | return $errors; |
---|
44 | } |
---|
45 | |
---|
46 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.