Changeset 6172


Ignore:
Timestamp:
May 13, 2010, 9:37:29 PM (10 years ago)
Author:
vdigital
Message:

Fix: Flags are coming back

Location:
extensions/whois_online
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/whois_online/Changelog.txt.php

    r5954 r6172  
    33Plugin Name: Whois online
    44** History **
     5  2010-04-24 2.0.n
     6                                                 Fix: Flags are coming back
     7
    58  2010-04-24 2.0.m
    69                                                 Fix: IE8 User agent could be too long
    710                                                 Fix: Failure on localisation (a French internet provider blocks external get_files)
    811                                                 Fix: Loss of previous collected data
    9                                                  
    1012  2010-04-18 2.0.l
    1113                                                 "Undefined index:  Code" is removed
  • extensions/whois_online/include/wo_functions.inc.php

    r5954 r6172  
    151151function whois_country($trace, $bypass = false) {
    152152  if (!isset($trace['country'])) {
    153                         pwg_query('ALTER TABLE ' . WHOIS_ONLINE_TABLE . ' ADD `country` VARCHAR( 255 ) NOT NULL AFTER `lang` ;');
     153                        pwg_query('ALTER TABLE ' . WHOIS_ONLINE_TABLE . ' ADD `country` VARCHAR( 254 ) NOT NULL AFTER `lang` ;');
    154154                        $trace['country']='';
    155155        }
     
    157157        if ($trace['country']!='') $c = @unserialize(htmlspecialchars_decode($trace['country']));
    158158        if (isset($c['Code']) and $c['Code']!='' and $c['Code']!='__') return $c;
    159         if ($bypass and isset($c['Code']) and $c['Code']=='__') return $c;
     159        if ($bypass and isset($c['Code'])) return $c;
    160160    $result = pwg_get_contents ('http://api.hostip.info/get_html.php?ip=' . $trace['IP'], 'r');
    161161        if ( $result !== false ) {
     
    163163                $c = array ('Name' => $tokens[1], 'City' => substr($tokens[3],0,-3));
    164164                if (strpos ($c['Name'], '?') === FALSE) {
    165                         $tokens = preg_split ("/[\(\)]/", $c['Name']);
    166                         $c['Code'] = isset($tokens[1]) ? $tokens[1]:'__';
     165                        $c['Code'] = substr($c['Name'],-8,2); # " (Private Address) (XX) City"
    167166                        $c['Name'] = ucwords ( strtolower( substr($c['Name'],0,-5)));
    168167                }
     
    170169        }
    171170        if (stripos($c['Name'], 'Squid')!==false) $c = Array('Code' => '__', 'Name' => l10n('Unknown country'), 'City' => 'N/A',);
    172         else $c = Array('Code' => '__', 'Name' => l10n('Unknown country'), 'City' => 'N/A',);
     171        // else $c = Array('Code' => '__', 'Name' => l10n('Unknown country'), 'City' => 'N/A',);
    173172        if ($c['Code'] == 'Private Address') {
    174173                $c['Name'] = l10n('Private Address');
     
    186185function whois_flag($trace, &$step, $limit = 10) {
    187186  $flag = WHOIS_ONLINE_PATH . 'flags/' . $trace['Country']['Code'] . '.jpg';
    188         if (file_exists($flag)) return $flag;
     187        if (file_exists($flag) and $flag != '__' ) return $flag;
    189188        if ( $step > $limit ) return WHOIS_ONLINE_PATH . 'flags/__.jpg';
    190189        $f = fopen  ('http://api.hostip.info/flag.php?ip=' . $trace['IP'], 'r');
  • extensions/whois_online/main.inc.php

    r5954 r6172  
    2323/*
    2424Plugin Name: Whois online
    25 Version: 2.0.m
     25Version: 2.0.n
    2626Description: Who is online?
    2727Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=279
     
    2929Author URI: http://www.vdigital.org
    3030*/
    31 define('WHOIS_ONLINE_VER', '2.0.m');
     31define('WHOIS_ONLINE_VER', '2.0.n');
    3232global $prefixeTable, $conf;
    3333// $conf['debug_l10n'] = true;
Note: See TracChangeset for help on using the changeset viewer.