source: extensions/CryptograPHP/include/category.inc.php @ 28344

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

add 'guest_only' option

File size: 1.0 KB
Line 
1<?php
2defined('CRYPTO_ID') or die('Hacking attempt!');
3
4$conf['cryptographp']['template'] = 'comment';
5include(CRYPTO_PATH.'include/common.inc.php');
6
7add_event_handler('loc_begin_index', 'add_crypto');
8add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
9
10function add_crypto()
11{
12  global $template;
13  $template->set_prefilter('comments_on_albums', 'prefilter_crypto');
14}
15
16function prefilter_crypto($content, $smarty)
17{
18  $search = '{$comment_add.CONTENT}</textarea></p>';
19  return str_replace($search, $search."\n{\$CRYPTO.parsed_content}", $content);
20}
21
22function check_crypto($action, $comment)
23{
24  global $conf, $page;
25 
26  include_once(CRYPTO_PATH.'securimage/securimage.php');
27  $securimage = new Securimage();
28
29  if ($securimage->check($_POST['captcha_code']) == false)
30  {
31    if ($conf['cryptographp']['comments_action'] == 'reject') $page['errors'][] = l10n('Invalid Captcha');
32    return ($action != 'reject') ? $conf['cryptographp']['comments_action'] : 'reject';
33  }
34
35  return $action;
36}
Note: See TracBrowser for help on using the repository browser.