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