From 8eab04f4e550b16f63f23ccbe0a170c130919631 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 21 Dec 2008 14:55:54 +0100 Subject: [PATCH] Should avoid 'empty' countries in geoloc. Signed-off-by: Florent Bruneau --- include/geoloc.inc.php | 5 ++++- templates/geoloc/form.address.tpl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 @@ - + -- 2.1.4