Index: branches/5.2.x/core/units/helpers/geocode_helper.php
===================================================================
diff -u -N -r15856 -r16339
--- branches/5.2.x/core/units/helpers/geocode_helper.php (.../geocode_helper.php) (revision 15856)
+++ branches/5.2.x/core/units/helpers/geocode_helper.php (.../geocode_helper.php) (revision 16339)
@@ -1,6 +1,6 @@
Application->ConfigValue('GoogleMapsURL').'output=xml&key='.
- $this->Application->ConfigValue('GoogleMapsKey').'&q='.kUtil::escape($qaddress, kUtil::ESCAPE_URL);
+ $delay = 0;
+ $query_address = $address . ', ' . $city . ', ' . $state;
- $curl_helper = $this->Application->recallObject('CurlHelper');
+ $curl_helper = $this->Application->recallObject('CurlHelper');
/* @var $curl_helper kCurlHelper */
- $delay = 0;
- while (true)
- {
- $xml = $curl_helper->Send($request_url);
+ while ( true ) {
+ $curl_helper->SetRequestData(array(
+ 'output' => 'xml',
+ 'key' => $this->Application->ConfigValue('GoogleMapsKey'),
+ 'q' => $query_address
+ ));
- if (strpos($xml, '620
')) {
- $delay += 100000;
- } elseif (strpos($xml, '200
')) {
- // get latitude, longitude and zip from xml-answer
+ $xml = $curl_helper->Send($this->Application->ConfigValue('GoogleMapsURL'));
+
+ if ( strpos($xml, '620
') ) {
+ $delay += 100000;
+ }
+ elseif ( strpos($xml, '200
') ) {
+ // get latitude, longitude and zip from xml-answer
$a_coords = explode(',', $this->getTag('coordinates', $xml));
$lat = $a_coords[1];
$lon = abs($a_coords[0]); // set to positive, because required by SQL formula
@@ -105,20 +109,21 @@
$carrier = '';
$assoc_data = Array();
break;
- } else {
+ }
+ else {
$lon = '';
$lat = '';
$zip4 = '';
$dpbc = '';
$carrier = '';
$assoc_data = Array();
break;
- }
- usleep($delay);
- }
+ }
- return Array($lon, $lat, $zip4, $dpbc, $carrier, serialize($assoc_data));
+ usleep($delay);
+ }
+ return Array($lon, $lat, $zip4, $dpbc, $carrier, serialize($assoc_data));
}
/**