[Mapbender-commits] r8728 - trunk/mapbender/http_auth/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Oct 17 02:13:29 PDT 2013


Author: armin11
Date: 2013-10-17 02:13:29 -0700 (Thu, 17 Oct 2013)
New Revision: 8728

Modified:
   trunk/mapbender/http_auth/http/index.php
Log:
Allow withChilds option also for http_auth secured capabilities ;-)

Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php	2013-10-11 20:09:05 UTC (rev 8727)
+++ trunk/mapbender/http_auth/http/index.php	2013-10-17 09:13:29 UTC (rev 8728)
@@ -70,6 +70,12 @@
 //let's do the proxy things (came from owsproxy.php):
 $postdata = $HTTP_RAW_POST_DATA;
 $layerId = $_REQUEST['layer_id'];
+//new option for nested layers
+$withChilds = false;
+if (isset($_REQUEST["withChilds"]) && $_REQUEST["withChilds"] === "1") {
+	$withChilds = true;
+}
+
 $query = new QueryHandler();
 
 // an array with keys and values toLoserCase -> caseinsensitiv
@@ -108,8 +114,13 @@
 			$request = MAPBENDER_PATH."/php/wms.php?layer_id=".$layerId;
 		} else {
 			$request = $urlPrefix.$_SERVER['HTTP_HOST']."/mapbender/php/wms.php?layer_id=".$layerId;
+			
 		}
-		$requestFull .= $request.'&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS';
+		if ($withChilds) {
+			$requestFull .= $request.'&withChilds=1&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS';
+		} else {
+			$requestFull .= $request.'&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS';
+		}
 		if(isset($auth)){
 			getCapabilities($request,$requestFull,$auth);
 		}
@@ -452,6 +463,15 @@
 	$new = "http_auth/". $layerId."?";
         $pattern = "#owsproxy/[a-z0-9]{32}\/[a-z0-9]{32}\?#m";
 	$httpAuthUrl = preg_replace($pattern,$new,$owsUrl);
+	//also replace the getcapabilities url with authenticated one ;-)
+	if (defined("MAPBENDER_PATH") && MAPBENDER_PATH != '') {
+		$wmsUrl = parse_url(MAPBENDER_PATH);
+		$path = $wmsUrl['path'];
+		$pattern = "#".$path."/php/wms.php\?layer_id=".$layerId."&#m";
+	} else {
+		$pattern = "#mapbender/php/wms.php\?layer_id=".$layerId."&#m";
+	}
+	$httpAuthUrl = preg_replace($pattern,"/".$new,$httpAuthUrl);
 	return $httpAuthUrl;
 }
 



More information about the Mapbender_commits mailing list