Ignore:
Timestamp:
Jul 28, 2009, 9:33:06 PM (15 years ago)
Author:
vdigital
Message:

Minor release: 2009-07-28 2.0.j

Minor changes in Config management
Additionnal flags (Ireland, Armenia, Estonia, Kazakhstan, Belarus,
Andorra, Turkey, Albania, Bosnia and Herzegovina, Azerbaijan, Iceland, European Union,
Israel, Morocco, New Caledonia and some other revised)
Search Engine trapping

Location:
extensions/whois_online
Files:
104 added
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/whois_online/config.php

    r3340 r3695  
    1616if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
    1717global $conf, $conf_whois, $lang;
     18$conf['show_gt'] = true;
    1819load_language('plugin.lang', WHOIS_ONLINE_PATH);
    1920
     
    8384if ( $sub and count($errors) == 0 and $_POST['from']=='config' and !is_adviser()) {
    8485        if ( $conf['Whois Online'] != serialize($conf_whois) ) {
     86                $conf['Whois Online'] = serialize($conf_whois);
    8587                pwg_query('REPLACE INTO ' . CONFIG_TABLE . " (param,value,comment)
    86     VALUES ('Whois Online','". serialize($conf_whois) ."','Whois Online configuration');");
     88    VALUES ('Whois Online','". $conf['Whois Online'] ."','Whois Online configuration');");
    8789                array_push($infos, l10n('Configuration has been saved.'));
    8890        }
     
    210212        // Most members ever online was
    211213        if (!isset($conf_whois['Users']['count']) or $conf_whois['Users']['count'] == 0) {
    212                 $count = mysql_fetch_assoc(pwg_query('SELECT MAX(`id`) AS `ctr` FROM ' . USERS_TABLE));
     214                $count = mysql_fetch_assoc(pwg_query('SELECT MAX(`'. $conf['user_fields']['id'] .'`) AS `ctr` FROM ' . USERS_TABLE));
    213215                $conf_whois['Users']['count'] = $count['ctr'];
    214216        }
  • extensions/whois_online/main.inc.php

    r3340 r3695  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
    23 
    2423/*
    2524Plugin Name: Whois online
    26 Version: 2.0.i
     25Version: 2.0.j
    2726Description: Who is online?
    2827Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=279
     
    3029Author URI: http://www.vdigital.org
    3130*/
    32 /*
    33 
    34 /** History **
    35   2009-05-xx 2.0.j
    36                                                  
    37                                                  Additionnal flags (Ireland, Armenia, Estonia, Kazakhstan, Belarus, Andorra,
    38                                                  Turkey, Albania, Bosnia and Herzegovina, Azerbaijan, Iceland, European Union,
    39                                                  Israel, Morocco, New Caledonia and some other revised)
    40   2009-05-20 2.0.i
    41                                                  Bug resolution.
    42                                                  Icons removed due to tablesorter constraints.
    43                                                  Active link style on active filter.
    44                                                  Additionnal flags (Luxemburg, Austria, Malta, and some other revised)
    45   2009-05-19 2.0.h
    46                                                  Additional links to profile and permissions corrective path with filtering.
    47                                                  Minor optimizations.
    48                                                  Additionnal flags (Egypt, Indonesia, Malaysia)
    49   2009-05-17 2.0.g
    50                                                  htmlspecialchars for Countries (Some City have quoted names)
    51                                                  Keep Previous config.
    52                                                  Additional links to profile and permissions
    53                                                  Additionnal flags
    54   2009-05-12 2.0.e and 2.0.f
    55                                                  IPV4 Localisation
    56                                                  Monitoring Permanence/Temporary user lists
    57                                                  Reporting of User accesses
    58                                                  Most connected
    59                                                  And more...
    60   2009-04-14 2.0.d
    61                                                  Icon on History can be removed
    62                                                  Appropriate titles for both links
    63   2009-04-14 2.0.c
    64                    Default display on admin pages even if not displayed on other pages
    65                                                  Bug on History Search page
    66                                                  Appropriate titles for both links on each first access (later "Random picture")
    67   2009-04-13 2.0.b
    68                    Corrective of &review and &others
    69                                                  Automatic upgrade
    70 */
    71 define('WHOIS_ONLINE_VER', '2.0.i');
     31define('WHOIS_ONLINE_VER', '2.0.j');
    7232global $prefixeTable, $conf;
    7333// $conf['debug_l10n'] = true;
    7434if (!defined('WHOIS_ONLINE_TABLE')) define('WHOIS_ONLINE_TABLE', $prefixeTable.'whois_online');
     35
    7536define('WHOIS_ONLINE_DIR' , basename(dirname(__FILE__)));
    7637define('WHOIS_ONLINE_PATH' , PHPWG_PLUGINS_PATH . WHOIS_ONLINE_DIR . '/');
    7738include_once(WHOIS_ONLINE_PATH.'online.php');
     39/* History:  WHOIS_ONLINE_PATH.'Changelog.txt.php' */
    7840?>
  • extensions/whois_online/maintain.inc.php

    r3319 r3695  
    88function plugin_activate()
    99{
    10         global $user;
     10        global $user,$conf;
    1111        $query = "CREATE TABLE IF NOT EXISTS ". WHOIS_ONLINE_TABLE ." (
    12   `IP` varchar(39) NOT NULL default '',
    13   `hidden_IP` enum('true','false') NOT NULL default 'false',
     12  `IP` varchar(39) NOT NULL DEFAULT '',
     13  `hidden_IP` enum('true','false') NOT NULL DEFAULT 'false',
    1414  `session_id` varchar(40) NOT NULL,
    15   `user_id` smallint(5) NOT NULL default '0',
    16   `username` varchar(100) character set utf8 collate utf8_bin NOT NULL default '',
    17   `lang` char(2) character set utf8 collate utf8_bin NOT NULL default 'en',
    18   `country` VARCHAR( 256 ) NOT NULL default '',
    19   `permanent` enum('true','false') NOT NULL default 'false',
    20   `last_access` varchar(12) NOT NULL default '',
    21   `last_elm_ids` varchar(75) NOT NULL default '',
    22   `last_cat_ids` varchar(75) NOT NULL default '',
    23   `last_tag_ids` varchar(75) NOT NULL default '',
    24   `last_sch_ids` varchar(75) NOT NULL default '',
    25   `first_access_date` varchar(45) NOT NULL default '',
    26   `last_dates` varchar(110) character set utf8 collate utf8_bin NOT NULL default '',
    27   `elm_hits` int(10) unsigned NOT NULL default '0',
    28   `pag_hits` int(10) unsigned NOT NULL default '0',
    29   `db_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
     15  `user_id` smallint(5) NOT NULL DEFAULT '0',
     16  `username` varchar(100) character set utf8 collate utf8_bin NOT NULL DEFAULT '',
     17  `lang` char(2) character set utf8 collate utf8_bin NOT NULL DEFAULT 'en',
     18  `country` VARCHAR( 256 ) NOT NULL DEFAULT '',
     19  `user_agent` VARCHAR( 160 ) NOT NULL DEFAULT '',
     20  `any_previous` VARCHAR( 256 ) NOT NULL DEFAULT '',
     21  `same_previous` VARCHAR( 256 ) NOT NULL DEFAULT '',
     22  `permanent` enum('true','false') NOT NULL DEFAULT 'false',
     23  `last_access` varchar(12) NOT NULL DEFAULT '',
     24  `last_elm_ids` varchar(75) NOT NULL DEFAULT '',
     25  `last_cat_ids` varchar(75) NOT NULL DEFAULT '',
     26  `last_tag_ids` varchar(75) NOT NULL DEFAULT '',
     27  `last_sch_ids` varchar(75) NOT NULL DEFAULT '',
     28  `first_access_date` varchar(45) NOT NULL DEFAULT '',
     29  `last_dates` varchar(110) character set utf8 collate utf8_bin NOT NULL DEFAULT '',
     30  `elm_hits` int(10) unsigned NOT NULL DEFAULT '0',
     31  `pag_hits` int(10) unsigned NOT NULL DEFAULT '0',
     32  `db_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
    3033  PRIMARY KEY  (`session_id`)
    3134) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
    3235";
    3336        $result = pwg_query($query);
    34         if (isset($conf['Whois Online'])) {
    35                 $conf_whois = unserialize($conf['Whois Online']);
    36                 if (!isset($conf_whois['Active'])) $conf_whois['Active'] = true;
    37                 if (!isset($conf_whois['Delete level'])) $conf_whois['Delete level'] = 20;
    38                 if (!isset($conf_whois['Radar limit'])) $conf_whois['Radar limit'] = 25;
    39                 if (!isset($conf_whois['Webmasters'])) $conf_whois['Webmasters'] = 2;
    40                 if (!isset($conf_whois['Administrators'])) $conf_whois['Administrators'] = 2;
    41                 if (!isset($conf_whois['Obsolete limit'])) $conf_whois['Obsolete limit'] = 20;
    42                 if (!isset($conf_whois['Add to Plugins menu'])) $conf_whois['Add to Plugins menu'] = false;
    43                 if (!isset($conf_whois['Add icon to History'])) $conf_whois['Add icon to History'] = true;
    44                 if (!isset($conf_whois['Keep data'])) $conf_whois['Keep data'] = true;
    45                 if (!isset($conf_whois['Default display'])) $conf_whois['Default display'] = true;
    46                 if (!isset($conf_whois['Search id'])) $conf_whois['Search id'] = 0;
    47                 if (!isset($conf_whois['Users']))
    48                         $conf_whois['Users'] = Array('max' => 0, 'When' => date('Y-m-d'), 'count' => 0);
    49                 $conf['Whois Online'] = serialize($conf_whois);
     37        if (!isset($conf['Whois Online'])) {
     38                $conf['Whois Online'] = serialize(Array());
     39                pwg_query('REPLACE INTO ' . CONFIG_TABLE . " (param,value,comment)
     40                VALUES ('Whois Online','". $conf['Whois Online'] ."','Whois Online configuration');");
    5041        }
    51         else {
    52                 $conf['Whois Online'] = serialize(Array(
    53                         'Active' => true,
    54                         'Delete level' => 20,
    55                         'Radar limit' => 25,
    56                         'Obsolete limit' => 20,
    57                         'Webmasters' => 2,
    58                         'Administrators' => 2,
    59                         'Search id' => 0,
    60                         'Users' => Array('max' => 0, 'When' => date('Y-m-d'), 'count' => 0),
    61                         'Add to Plugins menu' => false,
    62                         'Add icon to History' => true,
    63                         'Keep data' => true,
    64                         'Default display' => true,
    65                 ));
    66         }
    67         pwg_query('REPLACE INTO ' . CONFIG_TABLE . " (param,value,comment)
    68         VALUES ('Whois Online','". $conf['Whois Online'] ."','Whois Online configuration');");
    69         $conf_whois = unserialize($conf['Whois Online']);
    7042        if (isset($conf_whois['Keep data']) and !$conf_whois['Keep data']) {
    7143                pwg_query('DELETE FROM ' . WHOIS_ONLINE_TABLE);
  • extensions/whois_online/online.php

    r3340 r3695  
    22
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4 global $conf, $conf_whois;
    5 
     4global $conf, $conf_whois, $prefixeTable;
     5include_once(WHOIS_ONLINE_PATH.'include/wo_functions.inc.php');
    66/* Secure Config */
    7 
    87if (!isset($conf_whois['Active'])) $conf_whois = whois_online_conf();
    98
     
    1110{
    1211        global $conf;
    13         $conf_whois = unserialize($conf['Whois Online']);
    14         if (!isset($conf_whois['Active'])) $conf_whois['Active'] = true;
    15         if (!isset($conf_whois['Delete level'])) $conf_whois['Delete level'] = 20;
    16         if (!isset($conf_whois['Radar limit'])) $conf_whois['Radar limit'] = 25;
    17         if (!isset($conf_whois['Webmasters'])) $conf_whois['Webmasters'] = 2;
    18         if (!isset($conf_whois['Administrators'])) $conf_whois['Administrators'] = 2;
    19         if (!isset($conf_whois['Obsolete limit'])) $conf_whois['Obsolete limit'] = 20;
    20         if (!isset($conf_whois['Add to Plugins menu'])) $conf_whois['Add to Plugins menu'] = false;
    21         if (!isset($conf_whois['Add icon to History'])) $conf_whois['Add icon to History'] = true;
    22         if (!isset($conf_whois['Keep data'])) $conf_whois['Keep data'] = true;
    23         if (!isset($conf_whois['Default display'])) $conf_whois['Default display'] = true;
    24         if (!isset($conf_whois['Search id'])) $conf_whois['Search id'] = 0;
    25         if (!isset($conf_whois['Users']))
    26                 $conf_whois['Users'] = Array('max' => 0, 'When' => date('Y-m-d'), 'count' => 0);
     12        $default = array(
     13          'Active' => true,
     14          'Delete level' => 20,
     15          'Radar limit' => 25,
     16          'Webmasters' => 2, // Normal
     17          'Administrators' => 2,
     18          'Obsolete limit' => 20,
     19                'Default display' => true,
     20          'Add to Plugins menu' => false,
     21          'Add icon to History' => true,
     22          'Keep data' => true,
     23          'Search id' => 0,
     24          'Users' => Array('max' => 0, 'When' => date('Y-m-d'), 'count' => 0),
     25        );
     26        $conf_whois = array_merge($default, unserialize($conf['Whois Online']));
    2727        if ((!isset($conf_whois['Version'])) or $conf_whois['Version'] != WHOIS_ONLINE_VER
    2828                or $conf['Whois Online'] != serialize($conf_whois)) {
     
    3939
    4040/* Admin menus are always available */
    41 $conf['Add to Plugins menu'] = $conf_whois['Add to Plugins menu'];
    42 $conf['Add icon to History'] = $conf_whois['Add icon to History'];
    4341add_event_handler('get_admin_plugin_menu_links', 'whois_add_icon' );
    4442/* On Active */
     
    5149}
    5250
    53 /* --------------- Functions ----------------- */
    54 
    55 // pparse whois_online/default.tpl
     51
     52
     53
     54// Assume the Default display on pages
    5655function whois_default_display() {
    5756        global $template;
    5857        $template->set_filenames(array( 'Whois_display' => dirname(__FILE__).'/default.tpl'));
    5958        $template->pparse('Whois_display');
    60         // Based on get_enums(USER_INFOS_TABLE, 'status') ???
    6159}
    6260
    6361// Add admin links
    6462function whois_add_icon($menu) {
    65         global $conf, $lang;
    66         if ($conf['Add icon to History'])
     63        global $conf_whois, $lang;
     64        if ($conf_whois['Add icon to History'])
    6765                $lang['History'] .= '</a> <a class="external" href="' . get_admin_plugin_menu_link(WHOIS_ONLINE_PATH.'config.php') . '">
    6866                        <img class="button" src="' . WHOIS_ONLINE_PATH . 'icons/Whois_tuner.gif" alt="Whois Online configuration" title="Whois Online configuration" /></a>';
    69         if ($conf['Add to Plugins menu']) array_push($menu, array(
     67        if ($conf_whois['Add to Plugins menu']) array_push($menu, array(
    7068                                'NAME' => 'Whois Online',
    7169                                'URL' => get_admin_plugin_menu_link(WHOIS_ONLINE_PATH.'config.php'),
     
    117115                $c['Code'] = '__';
    118116        }
     117        $new = htmlspecialchars(serialize($c),ENT_QUOTES,'UTF-8');
     118        if ($new == $trace['country']) return $c;
    119119        pwg_query('UPDATE ' . WHOIS_ONLINE_TABLE . '
    120       SET `country` = \'' . htmlspecialchars(serialize($c),ENT_QUOTES,'UTF-8') . '\'
     120      SET `country` = \'' . $new . '\'
    121121    WHERE `session_id` = \'' . $trace['session_id'] . '\';');
    122122  return $c;
     
    185185        }
    186186        // Write or Rewrite the dedicated record
    187         $query = 'REPLACE INTO ' . WHOIS_ONLINE_TABLE . ' (`IP`, `hidden_IP`, `session_id`,`user_id`,`username`,`lang`,
    188         `permanent`,`last_access`,`last_elm_ids`, `last_cat_ids`, `last_tag_ids`, `last_sch_ids`,
     187        $query = 'REPLACE INTO ' . WHOIS_ONLINE_TABLE . ' (`IP`, `hidden_IP`, `session_id`,`user_id`,`username`,`lang`, `user_agent`,
     188        `any_previous`, `same_previous`, `permanent`,`last_access`,`last_elm_ids`, `last_cat_ids`, `last_tag_ids`, `last_sch_ids`,
    189189        `first_access_date`, `last_dates`, `elm_hits`, `pag_hits`)
    190190                VALUES (\''. $dedicated['IP'] .'\', \''
     
    192192                . $dedicated['user_id'] .'\', \''. $dedicated['username'] .'\', \''
    193193                . substr($lang_info['code'],0,2) .'\', \''
     194                . $dedicated['user_agent'] .'\', \''
     195                . $dedicated['any_previous'] .'\', \''
     196                . $dedicated['same_previous'] .'\', \''
    194197                . $dedicated['permanent'] . '\', \''. time() .'\',  \''
    195198                . implode(' ',$dedicated['elm_ids']) . '\', \''
     
    220223}
    221224
     225// Antiaspi delay conversion in seconds
     226// delay in "HH:ii:ss" or "d :HH:ii:ss"
     227// return delay in seconds
     228function whois_online_duration($date_string)
     229{
     230 list($s, $i, $H, $d, $more) =
     231   array_merge(array_reverse(
     232           explode(" ",str_ireplace(':',' ', $date_string))),
     233                 array(0,0,0,0,0));
     234 $t = time();
     235 return strtotime(sprintf("+%s days %s hours %s minutes %s seconds",
     236   $d, $H, $i, $s), $t) - $t;
     237}
     238
    222239/*
    223240                Main process: Analyze, set new values and prepare displayed values.
     
    239256        unset($online[0]);
    240257        $sid = session_id();
    241 
     258       
    242259        // Step 1 - Find the User and/or IP/session_id
    243260        foreach ($online as $key => $record) {
     
    358375        $global['tag_ids'][$hour%12]++;
    359376        $global['sch_ids'][$day%14]++;
    360   // !!! WARNING  !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
     377  // !!! WARNING  !!! WARNING !!! WARNING !!! WARNING !!!
    361378        $global['elm_ids'][10] = $current; // reference minute has changed
    362379        $global['cat_ids'][12] = $five;
    363380        $global['tag_ids'][24] = $hour;
    364381        $global['sch_ids'][14] = $day;
    365   // !!! WARNING  !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!
    366 
     382  // !!! WARNING  !!! WARNING !!! WARNING !!! WARNING !!!
     383
     384        // 5.5 - Add in previous
     385  if (!isset($global['any_previous'])) {
     386                pwg_query('ALTER TABLE ' . WHOIS_ONLINE_TABLE .
     387                        ' ADD `same_previous` VARCHAR( 256 ) NOT NULL DEFAULT \'\'  AFTER `country`;');
     388                pwg_query('ALTER TABLE ' . WHOIS_ONLINE_TABLE .
     389                        ' ADD `any_previous` VARCHAR( 256 ) NOT NULL DEFAULT \'\'  AFTER `country`;');
     390                pwg_query('ALTER TABLE ' . WHOIS_ONLINE_TABLE .
     391                        ' ADD `user_agent` VARCHAR( 160 ) NOT NULL DEFAULT \'\'  AFTER `country`;');
     392        }
     393
     394        $antiaspi = array(
     395    'diff' => '20 pages in 00:00:10' , // Banned for 20 access in 10 seconds or less
     396    'same' => '15 pages in 00:00:30' , // Banned for 15 access on the same page in 30 seconds or less
     397    'banned during' => '23:59:59' ,    // Banned time hh:mm:ss or any valid MySQL datetime expression 'YYYY-MM-DD HH:MM:SS'
     398    'only guest' => true ,             // True, registred members won't be banned
     399    'only picture' => false ,          // True, Check only on picture pages
     400    'allowed ip' => array()            // Allowed IP array (Bots, or your fixed IP)
     401  );
     402  if (isset($conf['antiaspi'])) $antiaspi = array_merge($antiaspi, $conf['antiaspi']);
     403
     404        // For AntiAspi follow ANY PREVIOUS access
     405        $access = '0:';
     406        list($max_any, $maxtext) = explode(' pages in ', $antiaspi['diff']);
     407        $maxtime = whois_online_duration($maxtext);
     408        $prev='';
     409        $previous = (isset($visit['any_previous'])) ? explode(' ', $visit['any_previous']):Array();
     410        foreach ($previous as $v) {
     411                $old = explode(':', $v);
     412                $old[0] += $visit['delay'];
     413                if ($old[0]<$maxtime) $prev .= $old[0].': ';
     414        }
     415        $prev = $access . ' ' . $prev;
     416        $prev = substr($prev, 0, -2);
     417        $visit['any_previous'] = $prev;
     418        // For AntiAspi follow ANY SAME PICTURE access
     419        $access = '0:';
     420        $same_elem = (isset($page['image_id'])) ? $page['image_id']:'0';
     421        list($max_same, $maxtext) = explode(' pages in ', $antiaspi['same']);
     422        $maxtime = whois_online_duration($maxtext);
     423        $access .= $same_elem . ':';
     424        $prev='';
     425        $previous = (isset($visit['same_previous'])) ? explode(' ', $visit['same_previous']):Array();
     426        foreach ($previous as $v) {
     427                $old = explode(':', $v);
     428                $old[0] += $visit['delay'];
     429                if ($old[0]<$maxtime and $old[1]==$same_elem) $prev .= $old[0].':'.$old[1].': ';
     430        }
     431        $prev = $access . ' ' . $prev;
     432        $prev = substr($prev, 0, -2);
     433        $visit['same_previous'] = $prev;
     434       
     435        // Check limits of $visit['any_previous'] and $visit['same_previous']
     436        // by 256 characters
     437        // by $max_any and by $max_same
     438        while (strlen($visit['any_previous'])>256) {
     439          $previous = explode(' ',$visit['any_previous']);
     440                $oldest = array_pop($previous);
     441                $visit['any_previous'] = implode(' ', $previous);
     442        }
     443        $ctr_any = count(explode(' ',$visit['any_previous']));
     444        while (strlen($visit['same_previous'])>256) {
     445          $previous = explode(' ',$visit['same_previous']);
     446                $oldest = array_pop($previous);
     447                $visit['same_previous'] = implode(' ', $previous);
     448        }
     449        $ctr_same = count(explode(' ',$visit['same_previous']));
     450       
     451        $visit['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
     452        $Vip =& $visit['IP'];
     453        $visit['Allowed_SE'] = false;
     454  if (!empty($antiaspi['allowed ip']))
     455  {
     456    $allowed_ips = str_replace(array('.', '%'), array('\.', '.*?'), $antiaspi['allowed ip']);
     457    foreach ($allowed_ips as $ip)
     458    {
     459      if (preg_match("#" . $ip . "#", $Vip)) { $visit['Allowed_SE'] = true; break; }
     460    }
     461  }
     462       
    367463        // Step 6 - Update (on Conf_Update and trace) and send trace to determine global tracing or not
    368464        $dtrace = 0;
  • extensions/whois_online/reload.php

    r3319 r3695  
    99                define('IN_ADMIN', true);
    1010                include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     11                $conf['show_gt'] = true;
    1112                $included = false;
    1213                load_language('plugin.lang', WHOIS_ONLINE_PATH);
     
    7980$limit = 20;
    8081$ql = 0;
     82$inlist = '0';
     83foreach ($online as $k => $v) {
     84  $inlist .= ', ' . implode( ', ', explode(' ',$online[$k]['last_elm_ids']));
     85        $ql++;
     86        if ($ql >= $conf_whois['Radar limit']) break;
     87}
     88$image = array();
     89$result = pwg_query('SELECT * FROM ' . IMAGES_TABLE .
     90        ' WHERE id IN (' . $inlist .');');
     91while ($row = mysql_fetch_assoc($result)) {
     92        $images[$row['id']] = $row;
     93        $images[$row['id']]['tn_url'] = get_thumbnail_url($row);
     94}
    8195foreach ($online as $k => $v) {
    8296  // The stupid History search will be reused instead of created... (even if History search will recreate it)
     
    100114                $online[$k]['guest'] =  false;
    101115        }
    102         $ql++;
    103116        // Images queries are limited (no cluetip over $conf_whois['Radar limit'])
    104117        // For performance reasons
    105         if ($ql <= $conf_whois['Radar limit']) {
    106                 $result = pwg_query('SELECT * FROM ' . IMAGES_TABLE .
    107                         ' WHERE id IN (' . implode(', ',explode(' ',$online[$k]['last_elm_ids'])) .');');
    108                 while ($row = mysql_fetch_assoc($result)) {
    109                         $online[$k]['images'][$row['id']] = $row;
    110                         $online[$k]['images'][$row['id']]['ws_level'] = ($row['level']>$online[$k]['user']['level']) ? 'ws':'';
    111                         $online[$k]['images'][$row['id']]['tn_url'] = get_thumbnail_url($row);
    112                         $online[$k]['images'][$row['id']]['url_modify'] = PHPWG_ROOT_PATH . 'admin.php?page=picture_modify&image_id='.$row['id'];
    113                 }
    114         } else {
    115         // Only the id is available for links (NO LEVEL CONTROL)
    116                 foreach (explode(' ',$online[$k]['last_elm_ids']) as $id) {
    117                         if ($id > 0) {
     118        $online[$k]['Bot'] = is_a_bot($online[$k]['user_agent']);
     119        $online[$k]['last_ids'] = explode(' ',$online[$k]['last_elm_ids']);
     120        foreach ($online[$k]['last_ids'] as $id) {
     121                        if (isset($images[$id])) {
     122                                $online[$k]['images'][$id] = $images[$id];
     123                                $online[$k]['images'][$id]['ws_level'] = ($images[$id]['level']>$online[$k]['user']['level']) ? 'ws':'';
     124                        }
    118125                        $online[$k]['images'][$id]['id'] = $id;
    119                         $online[$k]['images'][$row['id']]['url_modify'] = PHPWG_ROOT_PATH . 'admin.php?page=picture_modify&image_id='.$id;
    120                         }
     126                        $online[$k]['images'][$id]['url_modify'] = PHPWG_ROOT_PATH . 'admin.php?page=picture_modify&image_id='.$id;
    121127                }
    122128        }
    123 }
     129
    124130pwg_debug('*********** Radar reloaded ***********');
    125131$template->assign('search_results', $online);
  • extensions/whois_online/report.tpl

    r3319 r3695  
    4242                {/if}
    4343        </td>
    44   <td>{$detail.first_access_date}</td>
     44  <td>{$detail.first_access_date} {if ($detail.Bot!==false and $detail.Allowed_SE)}<a class="other" href="#" title="{'Allowed Search engine: '|@translate}{$detail.Bot} - ({$detail.user_agent})"><sub>SE</sub></a>{/if}
     45        {if ($detail.Bot!==false and !$detail.Allowed_SE and !$detail.Banned_SE)}<a href="#" title="{'Possible Banned Search engine: '|@translate}{$detail.Bot} - ({$detail.user_agent})"><sub>SE</sub></a>{/if}
     46        {if ($detail.Bot!==false and $detail.Banned_SE)}<a class="external" href="#" title="{'Banned Search engine: '|@translate}{$detail.Bot} - ({$detail.user_agent})"><sub>SE</sub></a>{/if}
     47        </td>
    4548  <td>
    4649                <a href="./admin.php?page=user_perm&amp;user_id={$detail.user_id}" onclick="window.open(this.href); return false;" title="{'permissions'|@translate}">
Note: See TracChangeset for help on using the changeset viewer.