Last change
on this file since 22821 was
20189,
checked in by mistic100, 12 years ago
|
fix for new guestbook template + code cleaning
|
File size:
910 bytes
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | include(CRYPTO_PATH.'include/common.inc.php'); |
---|
5 | add_event_handler('loc_begin_index', 'add_crypto'); |
---|
6 | add_event_handler('user_comment_check_guestbook', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); |
---|
7 | |
---|
8 | function add_crypto() |
---|
9 | { |
---|
10 | global $template; |
---|
11 | $template->set_prefilter('index', 'prefilter_crypto'); |
---|
12 | } |
---|
13 | |
---|
14 | function prefilter_crypto($content, $smarty) |
---|
15 | { |
---|
16 | $search = '{$comment_add.CONTENT}</textarea>'; |
---|
17 | return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content); |
---|
18 | } |
---|
19 | |
---|
20 | function check_crypto($action, $comment) |
---|
21 | { |
---|
22 | global $conf, $page; |
---|
23 | |
---|
24 | include_once(CRYPTO_PATH.'securimage/securimage.php'); |
---|
25 | $securimage = new Securimage(); |
---|
26 | |
---|
27 | if (!is_a_guest()) return $action; |
---|
28 | |
---|
29 | if ($securimage->check($_POST['captcha_code']) == false) |
---|
30 | { |
---|
31 | array_push($page['errors'], l10n('Invalid Captcha')); |
---|
32 | return 'reject'; |
---|
33 | } |
---|
34 | |
---|
35 | return $action; |
---|
36 | } |
---|
37 | |
---|
38 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.