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

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

captchas not working after trigger rename

File size: 1.1 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
[15118]29  if (!is_a_guest()) return $action;
[11316]30
[12617]31  if ($securimage->check($_POST['captcha_code']) == false)
[11316]32  {
[26041]33    if ($conf['cryptographp']['comments_action'] == 'reject') $page['errors'][] = l10n('Invalid Captcha');
[15118]34    return ($action != 'reject') ? $conf['cryptographp']['comments_action'] : 'reject';
[11316]35  }
[12617]36
37  return $action;
[26041]38}
Note: See TracBrowser for help on using the repository browser.