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

Fix: Flags are coming back

File:
1 edited

Legend:

Unmodified
Added
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');
Note: See TracChangeset for help on using the changeset viewer.