[Mapbender-commits] r9596 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Sep 15 03:55:31 PDT 2016


Author: verenadiewald
Date: 2016-09-15 03:55:31 -0700 (Thu, 15 Sep 2016)
New Revision: 9596

Modified:
   trunk/mapbender/http/php/mod_showMetadata.php
Log:
check the showMapUrls for question marks and don't add them to url if already exist

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2016-09-13 11:48:32 UTC (rev 9595)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2016-09-15 10:55:31 UTC (rev 9596)
@@ -946,7 +946,14 @@
 
 
 if ($layerAccessibility && WRAPPER_PATH != '' && ($resource == 'layer' or $resource == 'wms' )) {
-	$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."?LAYER[zoom]=1&LAYER[id]=".$resourceMetadata['contentid']."&LAYER[visible]=0&LAYER[querylayer]=0";
+	$pos = stripos($mapbenderBaseUrl.WRAPPER_PATH, "?");
+	if ($pos>0) {
+		$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."LAYER[zoom]=1&LAYER[id]=".$resourceMetadata['contentid']."&LAYER[visible]=0&LAYER[querylayer]=0";
+	}
+	else {
+		$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."?LAYER[zoom]=1&LAYER[id]=".$resourceMetadata['contentid']."&LAYER[visible]=0&LAYER[querylayer]=0";
+	}
+	
 	//$html .= $t_a.$translation['addLayerToMap'].$t_b."<a href='".$showMapUrl."' target='_blank'><img src='../img/osgeo_graphics/layer-wms-add.png'></a>".$t_c;
 	$html .= $t_a."<button onclick='window.open(\"".$showMapUrl."\", 
   \"windowname1\", 
@@ -956,7 +963,14 @@
 }
 
 if (WRAPPER_PATH != '' && $resource == 'wmc') {
-	$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."?WMC=".$resourceMetadata['contentid'];
+	$pos = stripos($mapbenderBaseUrl.WRAPPER_PATH, "?");
+	if ($pos>0) {
+		$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."WMC=".$resourceMetadata['contentid'];
+	}
+	else {
+		$showMapUrl = $mapbenderBaseUrl.WRAPPER_PATH."?WMC=".$resourceMetadata['contentid'];
+	}
+	
 	//$html .= $t_a.$translation['addLayerToMap'].$t_b."<a href='".$showMapUrl."' target='_blank'><img src='../img/osgeo_graphics/layer-wms-add.png'></a>".$t_c;
 	$html .= $t_a."<button onclick='window.open(\"".$showMapUrl."\", 
   \"windowname1\", 
@@ -968,10 +982,22 @@
 if (TWITTER_METADATA) {
 	if ($resource == 'wfs' or $resource == 'wms') {
 		$dataUrl = $mapbenderBaseUrl."/".$resource."/".$resourceMetadata['serviceid'];
-		$dataCountUrl = $mapbenderBaseUrl.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
+		$pos = stripos($mapbenderBaseUrl.$_SERVER['PHP_SELF'], "?");
+		if ($pos>0) {
+			$dataCountUrl = $mapbenderBaseUrl.$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'];
+		}
+		else {
+			$dataCountUrl = $mapbenderBaseUrl.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
+		}
 	} else {
 		$dataUrl = $mapbenderBaseUrl."/".$resource."/".$resourceMetadata['contentid'];
-		$dataCountUrl = $mapbenderBaseUrl.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
+		$pos = stripos($mapbenderBaseUrl.$_SERVER['PHP_SELF'], "?");
+		if ($pos>0) {
+			$dataCountUrl = $mapbenderBaseUrl.$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'];
+		}
+		else {
+			$dataCountUrl = $mapbenderBaseUrl.$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
+		}
 	}
 	$twitterUrl="https://twitter.com/share";
 	$html .=  '<script charset="utf-8" src="//platform.twitter.com/widgets.js" type="text/javascript"></script>';



More information about the Mapbender_commits mailing list