added api key to minimap url

This commit is contained in:
flopp
2013-05-17 22:12:58 +02:00
parent de572aab21
commit 9fc8c75ac5
2 changed files with 13 additions and 2 deletions

View File

@@ -311,7 +311,7 @@
*
* Coordinates of new caches are appended to the url.
*/
$opt['logic']['minimapurl'] = 'http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=220x220&maptype=roadmap&markers=color:blue|size:small';
$opt['logic']['minimapurl'] = 'http://maps.googleapis.com/maps/api/staticmap?sensor=false&key={gmkey}&size=220x220&maptype=roadmap&markers=color:blue|size:small';
/* target vars
* all _REQUEST-vars that identifiy the current page for target redirection after login

View File

@@ -103,7 +103,18 @@
// enable minimap for new caches if url is set
if ($opt['logic']['minimapurl'] != '')
{
$tpl->assign('minimap_url', $opt['logic']['minimapurl']);
// get the correct api key for google maps
$gmkey = '';
$sHost = strtolower($_SERVER['HTTP_HOST']);
if (isset($opt['lib']['google']['mapkey'][$sHost]))
$gmkey = $opt['lib']['google']['mapkey'][$sHost];
// build static maps url by inserting api key
$url = $opt['logic']['minimapurl'];
$url = mb_ereg_replace('{gmkey}', $gmkey, $url);
// put into template
$tpl->assign('minimap_url', $url);
$tpl->assign('minimap_enabled', true);
}
else