Changeset 29452


Ignore:
Timestamp:
Sep 9, 2014, 9:30:58 PM (10 years ago)
Author:
rvelices
Message:

akismet no csi for robots

Location:
extensions/rv_akismet
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_akismet/csi.php

    r13799 r29452  
    11<?php
     2define('IN_CSI', 1);
    23define('PHPWG_ROOT_PATH','../../');
    34include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
    45
    5 $_SESSION['csi']=1;
     6if (!isset($_SESSION['csi']))
     7        $_SESSION['csi'] = 1;
     8
    69//set_status_header(204);
    710header('Content-Type: image/gif');
  • extensions/rv_akismet/main.inc.php

    r29181 r29452  
    11<?php /*
    22Plugin Name: RV Akismet
    3 Version: 2.6.d
     3Version: 2.7.a
    44Description: Uses Akismet online service to check comments agains spam
    55Plugin URI: http://piwigo.org/ext/extension_view.php?eid=192
     
    1212
    1313add_event_handler('user_comment_check', 'akismet_user_comment_check_wrapper', EVENT_HANDLER_PRIORITY_NEUTRAL+10, 3);
    14 add_event_handler('loc_begin_page_tail', 'akismet_page_tail' );
     14if (!isset($_SESSION['csi']))
     15        add_event_handler('loc_begin_page_tail', 'akismet_page_tail' );
    1516
    1617
     
    6263function akismet_page_tail()
    6364{
    64         global $template, $conf;
    65         if (!isset($_SESSION['csi']) && strpos(@$_SERVER['HTTP_USER_AGENT'],'bot')===false)
    66         {
    67                 $src = get_root_url().'plugins/'.AKIS_DIR.'/csi.php';
    68                 $template->append( 'footer_elements', '<img src="'.$src.'" width=0 height=0>');
    69         }
     65        global $template;
     66
     67        $ua = @$_SERVER['HTTP_USER_AGENT'];
     68        foreach(array('bot','crawl','spider','slurp') as $needle)
     69                if (stripos($ua, $needle)!==false)
     70                                return;
     71
     72        $src = get_root_url().'plugins/'.AKIS_DIR.'/csi.php';
     73        $template->append( 'footer_elements', '<img src="'.$src.'" width=0 height=0>');
    7074}
    7175
Note: See TracChangeset for help on using the changeset viewer.