Changeset 13799 for extensions/rv_akismet/main.inc.php
- Timestamp:
- Mar 29, 2012, 8:48:09 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_akismet/main.inc.php
r12365 r13799 1 1 <?php /* 2 2 Plugin Name: RV Akismet 3 Version: 2. 3.a3 Version: 2.4.a 4 4 Description: Uses Akismet online service to check comments agains spam 5 5 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=192 … … 12 12 13 13 add_event_handler('user_comment_check', 'akismet_user_comment_check_wrapper', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 2); 14 add_event_handler('loc_begin_page_tail', 'akismet_page_tail' ); 15 14 16 15 17 add_event_handler('get_admin_plugin_menu_links', 'akismet_plugin_admin_menu' ); 18 add_event_handler('init', 'akismet_init' ); 19 16 20 17 21 function akismet_plugin_admin_menu($menu) … … 37 41 { 38 42 include_once( dirname(__FILE__).'/check.inc.php' ); 39 return akismet_user_comment_check($action, $comment); 43 $action = akismet_user_comment_check($action, $comment); 44 if (!isset($_SESSION['csi']) && isset($_POST['url']) && strlen($_POST['url']) ) 45 { 46 $action = 'reject'; 47 $_POST['cr'][] = 'csi url'; 48 } 49 return $action; 40 50 } 51 52 function akismet_init() 53 { 54 global $template; 55 $template->smarty->register_prefilter('akismet_prefilter_comment_form'); 56 } 57 58 function akismet_prefilter_comment_form($source, $smarty) 59 { 60 if ( ($pos=strpos($source, '<textarea'))!==false 61 && ($pos2=strpos($source, 'comment', $pos))!==false 62 && $pos2-$pos <300) 63 { 64 $source= substr_replace($source, '{html_style}#urlid{ldelim}display:none}{/html_style}<input type="text" name="url" id="urlid">', $pos,0); 65 } 66 return $source; 67 } 68 69 function akismet_page_tail() 70 { 71 global $template, $conf; 72 if (!isset($_SESSION['csi']) && strpos($_SERVER['HTTP_USER_AGENT'],'bot')===false) 73 { 74 $src = get_root_url().'plugins/'.AKIS_DIR.'/csi.php'; 75 $template->append( 'footer_elements', '<img src="'.$src.'" width=0 height=0>'); 76 } 77 } 78 41 79 ?>
Note: See TracChangeset
for help on using the changeset viewer.