X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fgeocoding.inc.php;h=a828366dc48aefe9feafb37d9c8e2119b70ed692;hb=d47dcad7cd97a90d35bbf923764e7b8afe7e64bf;hp=cb2763598bc8fc7f0bbdd576d471bc32fc0abe58;hpb=d66464d5ea0a69c47f2f49ace9de2f4b7b8c4d62;p=platal.git diff --git a/include/geocoding.inc.php b/include/geocoding.inc.php index cb27635..a828366 100644 --- a/include/geocoding.inc.php +++ b/include/geocoding.inc.php @@ -1,6 +1,6 @@ numRows() == 0) { - $address[$area . 'Id'] = XDB::execute("INSERT INTO " . $databases[$area] . " (name, country) - VALUES ({?}, {?})", - $address[$area . 'Name'], $address['countryId']); + XDB::execute('INSERT INTO ' . $databases[$area] . ' (name, country) + VALUES ({?}, {?})', + $address[$area . 'Name'], $address['countryId']); + $address[$area . 'Id'] = XDB::insertId(); } else { $address[$area . 'Id'] = $res->fetchOneCell(); } @@ -337,7 +338,12 @@ class GMapsGeocoder extends Geocoder { $address['text'] = $address['geoloc']; $address['postalText'] = $address['geocodedPostalText']; unset($address['geoloc'], $address['geocodedPostalText']); + } else { + $address['geoloc'] = str_replace("\n", "\r\n", $address['geoloc']); + $address['geocodedPostalText'] = str_replace("\n", "\r\n", $address['geocodedPostalText']); } + $address['text'] = str_replace("\n", "\r\n", $address['text']); + $address['postalText'] = str_replace("\n", "\r\n", $address['postalText']); } // Returns the address formated for postal use. @@ -409,9 +415,9 @@ class GMapsGeocoder extends Geocoder { } if ($isPseudoCountry) { - return $address['text']; + return implode("\n", array_slice($textLines, 0, -1)); } - return implode("\n", array_slice($textLines, 0, -1)); + return $address['text']; } // Search for the lign from the given address that is the closest to the geocoded thoroughfareName