source: extensions/CryptograPHP/include/guestbook.inc.php @ 26066

Last change on this file since 26066 was 26066, checked in by mistic100, 10 years ago

compatibility with contactform and guestbook

File size: 882 bytes
RevLine 
[15996]1<?php
[26041]2defined('CRYPTO_ID') or die('Hacking attempt!');
[15996]3
[19428]4include(CRYPTO_PATH.'include/common.inc.php');
[15996]5add_event_handler('loc_begin_index', 'add_crypto');
[26066]6add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
[15996]7
8function add_crypto()
9{
10  global $template;
[26066]11  $template->set_prefilter('guestbook', 'prefilter_crypto');
[15996]12}
13
14function prefilter_crypto($content, $smarty)
15{
[20189]16  $search = '{$comment_add.CONTENT}</textarea>';
[19428]17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
[15996]18}
19
20function 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  {
[26041]31    $page['errors'][] = l10n('Invalid Captcha');
[15996]32    return 'reject';
33  }
34
35  return $action;
[26041]36}
Note: See TracBrowser for help on using the repository browser.