/* ---------------------------------------------------------------------- $Id$ OOS [OSIS Online Shop] http://www.oos-shop.de/ Copyright (c) 2003 - 2007 by the OOS Development Team. ---------------------------------------------------------------------- Released under the GNU General Public License ---------------------------------------------------------------------- */ define('OOS_VALID_MOD', 'yes'); require 'includes/oos_main.php'; include '../includes/classes/class_maps.php'; $query = isset($_GET['query']) ? $_GET['query'] : 'barcelona'; $map = new SPAF_Maps($query); $map->setAPIKey(GOOGLE_MAP_API_KEY); $map->printHeaderJS(); ?> </head> <body> <table cellspacing="0" cellpadding="10" border="0" bgcolor="#c4c4c4"> <tr><td bgcolor="#a4a4a4"><?php $map->showLocationControl(); ?> </td></tr> <tr><td><?php $map->showMap(); ?> </td></tr>
define('OOS_VALID_MOD', 'yes'); require 'includes/oos_main.php'; if (!isset($_SESSION['login_id'])) { oos_redirect_admin(oos_href_link_admin($aFilename['login'], '', 'SSL')); } if ( !current_user_can('popup_google_map') ) oos_redirect_admin(oos_href_link_admin($aFilename['forbiden'])); include '../includes/classes/class_maps.php'; $query = isset($_GET['query']) ? $_GET['query'] : 'barcelona'; $map = new SPAF_Maps($query); $map->setAPIKey(GOOGLE_MAP_API_KEY); $map->printHeaderJS(); ?> </head> <body> <table cellspacing="0" cellpadding="10" border="0" bgcolor="#c4c4c4"> <tr><td bgcolor="#a4a4a4"><?php $map->showLocationControl(); ?></td></tr> <tr><td><?php $map->showMap(); ?></td></tr> </table> <br /> </body> </html>
/** * Get list of Poppulated places matching $search **/ public function getGeonamesHierarchy($search, $style, $lang = 'en') { if (strlen($search) <= 1) { // Ignore too small queries return ''; } $google_conf = PVars::getObj('config_google'); if (!$google_conf || !$google_conf->geonames_webservice) { throw new PException('Google config error!'); } require_once SCRIPT_BASE . 'lib/misc/SPAF_Maps.class.php'; $spaf = new SPAF_Maps($search); $spaf->setConfig('geonames_url', $google_conf->geonames_webservice_custom); $spaf->setConfig('style', $style); $spaf->setConfig('service', 'hierarchy?geonameId='); $spaf->setConfig('lang', $lang); //Try to get results - FIRST TIME $count = 0; $results = @$spaf->getResults(); while (!$results && ++$count <= 3) { //Try to get results - ANOTHER TIME if ($count == 1) { // still didn't work, so use the commercial geonames webservice $spaf->setConfig('geonames_url', $google_conf->geonames_webservice_fallback); } $spaf->results = false; $results = @$spaf->getResults(); if ($count == 3 && !$results) { // giving up MOD_log::get()->write("Connection to geonames webservice failed! (free & commercial)", "Geo"); } } return $results; }