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

Last change on this file since 24933 was 19428, checked in by mistic100, 12 years ago

change reload icon with color choice (dark or light), separate HTML and PHP

File size: 1.0 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4include(CRYPTO_PATH.'include/common.inc.php');
5add_event_handler('loc_begin_index', 'add_crypto');
6add_event_handler('user_comment_check_albums', 'check_crypto', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
7
8function add_crypto()
9{
10  global $template;
11  $template->set_prefilter('comments_on_albums', 'prefilter_crypto');
12}
13
14function prefilter_crypto($content, $smarty)
15{
16  $search = '{$comment_add.CONTENT}</textarea></p>';
17  return str_replace($search, $search."\n{\$CRYPTOGRAPHP}", $content);
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  {
31    if ($conf['cryptographp']['comments_action'] == 'reject') array_push($page['errors'], l10n('Invalid Captcha'));
32    return ($action != 'reject') ? $conf['cryptographp']['comments_action'] : 'reject';
33  }
34
35  return $action;
36}
37
38?>
Note: See TracBrowser for help on using the repository browser.