From: Florent Bruneau Date: Sun, 21 Dec 2008 13:55:54 +0000 (+0100) Subject: Should avoid 'empty' countries in geoloc. X-Git-Tag: xorg/0.10.1~49^2~40 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8eab04f4e550b16f63f23ccbe0a170c130919631;p=platal.git Should avoid 'empty' countries in geoloc. Signed-off-by: Florent Bruneau --- diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index 28ffe51..e3ee252 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -82,7 +82,7 @@ function get_address_infos($txt) if (!($f = @fopen($url, 'r'))) return false; $keys = explode('|',fgets($f)); $vals = explode('|',fgets($f)); - $infos = array(); + $infos = empty_address(); foreach ($keys as $i=>$key) { if($vals[$i]) { if ($key == 'sql') { @@ -93,6 +93,9 @@ function get_address_infos($txt) } } } + if (empty($infos['country'])) { + $infos['country'] = '00'; + } if (isset($infos['sql']) && $infos['sql']) XDB::execute("REPLACE INTO geoloc_city VALUES ".$infos['sql']); diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index 63389f7..2906484 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -56,7 +56,7 @@ - +