[Mapbender-commits] r9731 - in trunk/mapbender: http_auth/http owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Apr 3 08:18:20 PDT 2017


Author: armin11
Date: 2017-04-03 08:18:20 -0700 (Mon, 03 Apr 2017)
New Revision: 9731

Modified:
   trunk/mapbender/http_auth/http/index.php
   trunk/mapbender/owsproxy/http/index.php
Log:
Fix for parsing get requests of wfs

Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php	2017-04-03 13:56:02 UTC (rev 9730)
+++ trunk/mapbender/http_auth/http/index.php	2017-04-03 15:18:20 UTC (rev 9731)
@@ -266,7 +266,7 @@
         	$storedQueryId = $reqParams['storedquery_id'];
         	$arrayOnlineresources = checkWfsStoredQueryPermission($owsproxyString, $storedQueryId, $userId);
 	} else {
-		$arrayFeatures = array($reqParams['typename']);
+		$arrayFeatures = array($reqParams['typenames']);
         	$arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
 	}
         $query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
@@ -281,7 +281,7 @@
                 $price, 0, $reqParams['storedquery_id']);
 	    } else {
             	$log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
-                $price, 0, $reqParams['typename']);
+                $price, 0, $reqParams['typenames']);
 	    }
         } else {
 		$log_id = false;
@@ -299,7 +299,7 @@
         }
         break;
     case 'describefeaturetype':
-        $arrayFeatures = array($reqParams['typename']);
+        $arrayFeatures = array($reqParams['typenames']);
         $arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
         $query->setOnlineResource($arrayOnlineresources['wfs_describefeaturetype']);
         $request = $query->getRequest();

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2017-04-03 13:56:02 UTC (rev 9730)
+++ trunk/mapbender/owsproxy/http/index.php	2017-04-03 15:18:20 UTC (rev 9731)
@@ -198,6 +198,7 @@
 switch (strtolower($reqParams['service'])) {
 	case 'wms':
 		$wmsId = $n->getWmsIdFromOwsproxyString($query->getOwsproxyServiceId());
+		$owsproxyString = $query->getOwsproxyServiceId();
 		//get authentication infos if they are available in wms table! if not $auth = false
 		if ($reqParams['request'] !== 'external') {
 			$auth = $n->getAuthInfoOfWMS($wmsId);
@@ -209,6 +210,7 @@
 		
 	case 'wfs':
 		$wfsId = $n->getWfsIdFromOwsproxyString($query->getOwsproxyServiceId());
+		$owsproxyString = $query->getOwsproxyServiceId();
 		//get authentication infos if they are available in wfs table! if not $auth = false
 		if ($reqParams['request'] !== 'external') {
 			$auth = $n->getAuthInfoOfWFS($wfsId);
@@ -345,7 +347,7 @@
         	$storedQueryId = $reqParams['storedquery_id'];
         	$arrayOnlineresources = checkWfsStoredQueryPermission($owsproxyString, $storedQueryId, $userId);
 	} else {
-		$arrayFeatures = array($reqParams['typename']);
+		$arrayFeatures = array($reqParams['typenames']);
         	$arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
 	}
 	$query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
@@ -360,7 +362,7 @@
                 $price, 0, $reqParams['storedquery_id']);
 	    } else {
             	$log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
-                $price, 0, $reqParams['typename']);
+                $price, 0, $reqParams['typenames']);
 	    }
         } else {
 		$log_id = false;
@@ -376,7 +378,7 @@
         }
         break;
     case 'describefeaturetype':
-        $arrayFeatures = array($reqParams['typename']);
+        $arrayFeatures = array($reqParams['typenames']);
         $arrayOnlineresources = checkWfsPermission($query->getOwsproxyServiceId(), $arrayFeatures, $userId);
         $query->setOnlineResource($arrayOnlineresources['wfs_describefeaturetype']);
         $request = $query->getRequest();
@@ -1013,7 +1015,6 @@
     }
 
     foreach ($features as $feature) {
-
         //get appropriate wfs_conf
         $sql = "SELECT wfs_conf.wfs_conf_id FROM wfs_conf ";
         $sql.= "JOIN wfs_featuretype ";
@@ -1344,4 +1345,19 @@
   $tmp = unserialize(serialize($var));
   return memory_get_usage() - $total_memory; 
 }
+
+//function to remove one complete get param out of the query
+function delTotalFromQuery($paramName,$queryString) {
+	//echo $paramName ."<br>";
+	$queryString = "&".$queryString;
+	if ($paramName == "searchText") {
+			$str2exchange = "searchText=*&";
+		} else {
+			$str2exchange = "";
+	}
+	$queryStringNew = preg_replace('/\b'.$paramName.'\=[^&]*&?/',$str2exchange,$queryString); //TODO find empty get params
+	$queryStringNew = ltrim($queryStringNew,'&');
+	$queryStringNew = rtrim($queryStringNew,'&');
+	return $queryStringNew;
+}
 ?>



More information about the Mapbender_commits mailing list