Last change
on this file since 12617 was
12617,
checked in by mistic100, 12 years ago
|
rewrite some prefilters, replace CryptograPHP by Securimage (not abandoned project!)
|
File size:
1.5 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | add_event_handler('loc_end_page_header', 'add_crypto'); |
---|
5 | add_event_handler('register_user_check', 'check_crypto'); |
---|
6 | |
---|
7 | function add_crypto() |
---|
8 | { |
---|
9 | global $template; |
---|
10 | |
---|
11 | $template->set_prefilter('register', 'prefilter_crypto'); |
---|
12 | } |
---|
13 | |
---|
14 | function prefilter_crypto($content, $smarty) |
---|
15 | { |
---|
16 | global $conf; |
---|
17 | |
---|
18 | $search = '#\<\/ul\>(.{0,10})\<\/fieldset\>(.{0,10})\<p class\=\"bottomButtons\"\>#is'; |
---|
19 | $replace = ' |
---|
20 | <li> |
---|
21 | <span class="property"> |
---|
22 | <label><img id="captcha" src="'.CRYPTO_PATH.'securimage/securimage_show.php" alt="CAPTCHA Image"></label> |
---|
23 | </span> |
---|
24 | <b>{\''.($conf['cryptographp']['captcha_type']=='string'?'Enter code':'Solve equation').'\'|@translate} :</b><br> |
---|
25 | <input type="text" name="captcha_code" size="'.($conf['cryptographp']['code_length']+1).'" maxlength="'.$conf['cryptographp']['code_length'].'" /> |
---|
26 | <a href="#" onclick="document.getElementById(\'captcha\').src = \''.CRYPTO_PATH.'securimage/securimage_show.php?\' + Math.random(); return false"> |
---|
27 | <img src="'.CRYPTO_PATH.'template/refresh.png"></a> |
---|
28 | </li> |
---|
29 | </ul> |
---|
30 | |
---|
31 | </fieldset> |
---|
32 | |
---|
33 | <p class="bottomButtons">'; |
---|
34 | |
---|
35 | return preg_replace($search, $replace, $content); |
---|
36 | } |
---|
37 | |
---|
38 | function check_crypto($errors) |
---|
39 | { |
---|
40 | include_once(CRYPTO_PATH.'securimage/securimage.php'); |
---|
41 | $securimage = new Securimage(); |
---|
42 | |
---|
43 | if ($securimage->check($_POST['captcha_code']) == false) |
---|
44 | { |
---|
45 | array_push($errors, l10n('Invalid Captcha')); |
---|
46 | } |
---|
47 | |
---|
48 | return $errors; |
---|
49 | } |
---|
50 | |
---|
51 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.