Module: nagvis Branch: master Commit: 66618bff9e96f8bb94ebb51df950aca6485fae45 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=66618bff9e96f8bb94ebb51df950aca6485fae45
Author: Roman Kyrylych <[email protected]> Date: Thu Aug 13 15:17:38 2009 +0300 gmap: Load key through RPC instead of directly Signed-off-by: Roman Kyrylych <[email protected]> --- share/netmap/Geocode.php | 12 +++++++++--- uifx/src/modules/gmap/mate/StartupEM.mxml | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/share/netmap/Geocode.php b/share/netmap/Geocode.php index 90fb1ea..f8e72bf 100644 --- a/share/netmap/Geocode.php +++ b/share/netmap/Geocode.php @@ -21,8 +21,6 @@ * *****************************************************************************/ -define('KEY', 'ABQIAAAAbL-l0p12tju9OYnJPNXPYBT3DJAw-5FLyP9xbJAH2x0dPCeSTRSPyzBWS-uRnuZRdDF49cYyKSpsdQ'); - class Geocode { /** @@ -33,7 +31,7 @@ class Geocode { $locations = array(); - $request_url = 'http://maps.google.com/maps/geo?output=xml&key=' . KEY + $request_url = 'http://maps.google.com/maps/geo?output=xml&key=' . $this->getKey() . '&sensor=false&oe=utf8&q=' . urlencode($address); if (($xml = @simplexml_load_file($request_url)) === FALSE) throw new Exception('Cannot connect to Google Maps'); @@ -71,6 +69,14 @@ class Geocode return $locations; } + public function getKey() + { + if (($key = file_get_contents('GoogleMaps.key')) !== FALSE) + return trim($key); + else + throw new Exception('Could not read GoogleMaps.key'); + } + public function saveKey($key) { if (file_put_contents('GoogleMaps.key', $key) !== FALSE) diff --git a/uifx/src/modules/gmap/mate/StartupEM.mxml b/uifx/src/modules/gmap/mate/StartupEM.mxml index e4264f1..c8fbb8d 100644 --- a/uifx/src/modules/gmap/mate/StartupEM.mxml +++ b/uifx/src/modules/gmap/mate/StartupEM.mxml @@ -40,7 +40,7 @@ <Injectors target="{MapMD}" debug="true"> - <HTTPServiceInvoker url="GoogleMaps.key"> + <RemoteObjectInvoker destination="zend" source="Geocode" method="getKey"> <resultHandlers> <MethodInvoker generator="{MapMD}" method="showMap" arguments="{resultObject}"/> </resultHandlers> @@ -50,7 +50,7 @@ 'Error' ]}"/> </faultHandlers> - </HTTPServiceInvoker> + </RemoteObjectInvoker> </Injectors> ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
