Fix: ignored gkey config value

This commit is contained in:
Bartek Fabiszewski 2017-04-07 16:06:05 +02:00
parent e5bad9e959
commit 4a8bdc91b0
2 changed files with 6 additions and 2 deletions

View File

@ -25,6 +25,9 @@ class uConfig {
// (gmaps = google maps, openlayers = openlayers/osm)
static $mapapi = "openlayers";
// gmaps key
static $gkey = null;
// openlayers additional map layers
// OpenCycleMap (0 = no, 1 = yes)
static $layer_ocm = 1;
@ -91,6 +94,7 @@ class uConfig {
include_once($configFile);
if (isset($mapapi)) { self::$mapapi = $mapapi; }
if (isset($gkey)) { self::$gkey = $gkey; }
if (isset($layer_ocm)) { self::$layer_ocm = $layer_ocm; }
if (isset($layer_mq)) { self::$layer_mq = $layer_mq; }
if (isset($layer_osmapa)) { self::$layer_osmapa = $layer_osmapa; }

View File

@ -175,7 +175,7 @@ print '<!DOCTYPE html>
var lang_submit = "' . $lang_submit . '";
var units = "' . $config::$units . '";
var mapapi = "' . $config::$mapapi . '";
var gkey = ' . (isset($gkey) ? '"' . $gkey . '"' : 'null') . ';
var gkey = ' . (!empty($config::$gkey) ? '"' . $config::$gkey . '"' : 'null') . ';
var layer_ocm = "' . $config::$layer_ocm . '";
var layer_mq = "' . $config::$layer_mq . '";
var layer_osmapa = "' . $config::$layer_osmapa . '";
@ -186,7 +186,7 @@ print '<!DOCTYPE html>
<script type="text/javascript" src="main.js"></script>
';
if ($config::$mapapi == "gmaps") {
print ' <script type="text/javascript" src="//maps.googleapis.com/maps/api/js' . (isset($gkey) ? '?key=' . $gkey : '') . '"></script>
print ' <script type="text/javascript" src="//maps.googleapis.com/maps/api/js' . (!empty($config::$gkey) ? '?key=' . $config::$gkey : '') . '"></script>
<script type="text/javascript" src="api_gmaps.js"></script>
';
} else {