Ignore:
Timestamp:
Dec 21, 2013, 6:37:54 PM (11 years ago)
Author:
mistic100
Message:

try to simplify integration of captchas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/EasyCaptcha/include/guestbook.inc.php

    r26068 r26069  
    22defined('EASYCAPTCHA_ID') or die('Hacking attempt!');
    33
     4$conf['EasyCaptcha']['template'] = 'guestbook';
    45include(EASYCAPTCHA_PATH.'include/common.inc.php');
    5 add_event_handler('loc_begin_index', 'add_easycaptcha');
     6
    67add_event_handler('user_comment_check', 'check_easycaptcha', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
    7 
    8 function add_easycaptcha()
    9 {
    10   global $template;
    11   $template->set_prefilter('guestbook', 'prefilter_easycaptcha');
    12 }
    13 
    14 function prefilter_easycaptcha($content, $smarty)
    15 {
    16   $search = '#{\$comment_add\.CONTENT}</textarea>(\s*)</td>(\s*)</tr>#';
    17   $replace = '{\$comment_add.CONTENT}</textarea>$1</td>$2</tr>'."\n".'{\$EASYCAPTCHA_CONTENT}';
    18   return preg_replace($search, $replace, $content);
    19 }
    208
    219function check_easycaptcha($action, $comment)
Note: See TracChangeset for help on using the changeset viewer.