source: extensions/CryptograPHP/include/picture.inc.php @ 26041

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

update for 2.6

File size: 1009 bytes
RevLine 
[11316]1<?php
[26041]2defined('CRYPTO_ID') or die('Hacking attempt!');
[11316]3
[19428]4include(CRYPTO_PATH.'include/common.inc.php');
[12617]5add_event_handler('loc_end_picture', 'add_crypto');
[11370]6add_event_handler('user_comment_check', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
[11316]7
[11370]8function add_crypto()
[11316]9{
[12617]10  global $template;
[11370]11  $template->set_prefilter('picture', 'prefilter_crypto');
[11316]12}
13
[11370]14function prefilter_crypto($content, $smarty)
[11316]15{
[17319]16  $search = '{$comment_add.CONTENT}</textarea></p>';
[19428]17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
[11316]18}
19
[11370]20function check_crypto($action, $comment)
[11316]21{
[14527]22  global $conf, $page;
[11316]23 
[12617]24  include_once(CRYPTO_PATH.'securimage/securimage.php');
25  $securimage = new Securimage();
[11316]26
[15118]27  if (!is_a_guest()) return $action;
[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.