From: vincent@cubedesigners.com Date: Mon, 5 Nov 2012 10:39:35 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b41918e4b14310603ca911468c4b7381d8d30730;p=cubeextranet.git --- diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index dce75b5ec..72fd7c426 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -523,11 +523,28 @@ class commonTools { cubeHTTP::downloadFile($tmpfile, 'csr.zip'); } - public function geocode(){ - + public static function geocode() { + + $opt = array(); + $opt['adapter'] = 'pdo_mysql'; + $opt['params']['charset'] = 'utf8'; + $opt['params']['adapterNamespace'] = 'CubeIT_Db_Adapter'; + $opt['params']['unix_socket'] = trim(DB_HOST, ':'); + $opt['params']['username'] = DB_USER; + $opt['params']['password'] = DB_PASSWORD; + $opt['params']['dbname'] = DB_NAME; + $db = Zend_Db::factory($opt['adapter'], $opt['params']); + $db->setFetchMode(Zend_Db::FETCH_OBJ); + Zend_Db_Table::setDefaultAdapter($db); + + header('Content-type: application/json'); + ob_end_clean(); + $geocoder = new CubeIT_Services_Google_Geocoder(); + $r = $geocoder->geocode(urldecode($_GET['address']), $_GET['region'], true); + echo CubeIT_Util_Json::encode($r); + exit; } - - + } ?>