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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Apr 3 06:56:03 PDT 2017


Author: armin11
Date: 2017-04-03 06:56:02 -0700 (Mon, 03 Apr 2017)
New Revision: 9730

Modified:
   trunk/mapbender/http/classes/class_owsPostQueryParser.php
   trunk/mapbender/http_auth/http/index.php
   trunk/mapbender/owsproxy/http/classes/class_QueryHandler.php
   trunk/mapbender/owsproxy/http/index.php
Log:
New options to proxy wfs 2.0+ stored query relevant information thru mapbenders security proxy

Modified: trunk/mapbender/http/classes/class_owsPostQueryParser.php
===================================================================
--- trunk/mapbender/http/classes/class_owsPostQueryParser.php	2017-03-30 11:29:58 UTC (rev 9729)
+++ trunk/mapbender/http/classes/class_owsPostQueryParser.php	2017-04-03 13:56:02 UTC (rev 9730)
@@ -54,6 +54,7 @@
 			$xpath = new DOMXPath($queryDomObject);
 			//test if namespace is used in operation declaration
 			$this->serviceRequestType = $queryDomObject->documentElement->tagName;
+			//$e = new mb_exception($this->serviceRequestType);
 			//explode this
 			$explodedTagName = explode(':', $this->serviceRequestType);
 			if (count($explodedTagName) == 2) {
@@ -101,6 +102,18 @@
 			}
 			//$e = new mb_exception("class_owsPostQueryHandler.php: ".$this->serviceRequestType);
 			$this->serviceVersion = $queryDomObject->documentElement->getAttribute("version");
+			//check for getfeature request with given storedquery_id
+			if ($this->serviceType == "WFS" && ($this->serviceVersion == "2.0.2" || $this->serviceVersion == "2.0.0") && strtolower($this->serviceRequestType) == 'getfeature') {
+				if ($hasNamespace) {
+					$xpath->registerNamespace($explodedTagName[0], $rootNamespace); 
+					$storedQueryNodeList = $xpath->query('/'.$explodedTagName[0].':'.$this->serviceRequestType.'/'.$explodedTagName[0].':StoredQuery');
+				} else {
+					$xpath->registerNamespace('defaultns', $rootNamespace);
+					$storedQueryNodeList = $xpath->query('/defaultns:'.$this->serviceRequestType.'/defaultns:StoredQuery');
+				}
+				//get id from stored query
+				$this->serviceStoredQueryId = $storedQueryNodeList->item(0)->getAttribute('id');
+			}
 			//validate extracted parameters
 		}
 		

Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php	2017-03-30 11:29:58 UTC (rev 9729)
+++ trunk/mapbender/http_auth/http/index.php	2017-04-03 13:56:02 UTC (rev 9730)
@@ -1,5 +1,4 @@
 <?php
-
 # http://www.mapbender2.org/index.php/Owsproxy
 # Module maintainer armin11
 #
@@ -263,17 +262,27 @@
         }
         break;
     case 'getfeature':
-	//$e = new mb_exception($reqParams['typename']);
-        $arrayFeatures = array($reqParams['typename']);
-        $arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
+	if (isset($reqParams['storedquery_id']) && $reqParams['storedquery_id'] !== "") {
+        	$storedQueryId = $reqParams['storedquery_id'];
+        	$arrayOnlineresources = checkWfsStoredQueryPermission($owsproxyString, $storedQueryId, $userId);
+	} else {
+		$arrayFeatures = array($reqParams['typename']);
+        	$arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
+	}
         $query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
         $request = $query->getRequest();
         $request = stripslashes($request);
+	//TODO - what if storedquery are used ? log storedquery_id?
 	if ($n->getWfsLogTag($arrayOnlineresources['wfs_id']) == 1) {
             //get price out of db
             $price = intval($n->getWfsPrice($arrayOnlineresources['wfs_id']));
-            $log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
+	    if (isset($reqParams['storedquery_id']) && $reqParams['storedquery_id'] !== "") {
+		$log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
+                $price, 0, $reqParams['storedquery_id']);
+	    } else {
+            	$log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
                 $price, 0, $reqParams['typename']);
+	    }
         } else {
 		$log_id = false;
 	}
@@ -307,6 +316,50 @@
             describeFeaturetype($request);
         }
         break;
+    case 'liststoredqueries':
+	if ($postData !== false) {
+		$operationMethod = "Post";
+	} else {
+		$operationMethod = "Get";
+	}
+	$listStoredQueriesUrl = getWfsOperationUrl($owsproxyString, "ListStoredQueries", $operationMethod);
+        $query->setOnlineResource($listStoredQueriesUrl);
+        $request = $query->getRequest();
+        $request = stripslashes($request);
+	//TODO: following is not the standard way because ows has not to handle vsp!!!
+	$request = delTotalFromQuery("wfs_id",$request);
+	//don't allow get parameters in conjunction with post!
+	if ($postData !== false) {
+		$request = $listStoredQueriesUrl;
+	}
+        if (isset($auth)) {
+            listStoredQueries($request, $auth);
+        } else {
+            listStoredQueries($request);
+        }
+        break;
+    case 'describestoredqueries':
+	if ($postData !== false) {
+		$operationMethod = "Post";
+	} else {
+		$operationMethod = "Get";
+	}
+	$describeStoredQueriesUrl = getWfsOperationUrl($owsproxyString, "DescribeStoredQueries", $operationMethod);
+        $query->setOnlineResource($describeStoredQueriesUrl);
+        $request = $query->getRequest();
+        $request = stripslashes($request);
+	//TODO: following is not the standard way because ows has not to handle vsp!!!
+	$request = delTotalFromQuery("wfs_id",$request);
+	//don't allow get parameters in conjunction with post!
+	if ($postData !== false) {
+		$request = $describeStoredQueriesUrl;
+	}
+        if (isset($auth)) {
+            describeStoredQueries($request, $auth);
+        } else {
+            describeStoredQueries($request);
+        }
+        break;
     case '':
         $arrayFeatures = getWfsFeaturesFromTransaction($HTTP_RAW_POST_DATA);
         $arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
@@ -513,6 +566,30 @@
 }
 
 /**
+ * fetchs and returns the content of WFS 2.0+ ListStoredQueries response
+ * 
+ * @param string the url of the ListStoredQueries request
+ * @return echo the content of the ListStoredQueries document
+ */
+function listStoredQueries($url, $auth = false)
+{
+    global $reqParams;
+    $content = getDocumentContent(false, $url, "Content-Type: application/xml", $auth);
+}
+
+/**
+ * fetchs and returns the content of WFS 2.0+ DescribeStoredQueries response
+ * 
+ * @param string the url of the DescribeStoredQueries request
+ * @return echo the content of the DescribeStoredQueries document
+ */
+function describeStoredQueries($url, $auth = false)
+{
+    global $reqParams;
+    $content = getDocumentContent(false, $url, "Content-Type: application/xml", $auth);
+}
+
+/**
  * simulates a post request to host
  * 
  * @param string host to send the request to
@@ -1003,6 +1080,120 @@
     return $service;
 }
 
+/**
+ * validates the access permission by getting the appropriate wfs_conf
+ * to each feature requested and check the wfs_conf permission
+ * 
+ * @param string owsproxy md5
+ * @param array array of requested featuretype names
+ * @return array array with detailed information on reqested wfs
+ */
+function checkWfsStoredQueryPermission($wfsOws, $storedQueryId, $userId)
+{
+    global $con, $n;
+    $myconfs = $n->getWfsConfByPermission($userId);
+    if ($storedQueryId !== false) {
+    } else {
+	throwE(array("No storedquery_id data available."));
+        die();
+    }
+    //get wfs
+    $sql = "SELECT * FROM wfs WHERE wfs_owsproxy = $1";
+    $v = array($wfsOws);
+    $t = array("s");
+    $res = db_prep_query($sql, $v, $t);
+    $service = array();
+    if ($row = db_fetch_array($res)) {
+        $service["wfs_id"] = $row["wfs_id"];
+        $service["wfs_getcapabilities"] = $row["wfs_getcapabilities"];
+        $service["wfs_getfeature"] = $row["wfs_getfeature"];
+        $service["wfs_describefeaturetype"] = $row["wfs_describefeaturetype"];
+        $service["wfs_transaction"] = $row["wfs_transaction"];
+        $service["wfs_getcapabilities_doc"] = $row["wfs_getcapabilities_doc"];
+    } else {
+        throwE(array("No wfs data available."));
+        die();
+    }
+    //get appropriate wfs_conf
+    $sql = "SELECT wfs_conf.wfs_conf_id FROM wfs_conf WHERE fkey_wfs_id = $1 AND stored_query_id = $2";
+    $v = array($service["wfs_id"], $storedQueryId);
+    $t = array("i", "s");
+    $res = db_prep_query($sql, $v, $t);
+    if (!($row = db_fetch_array($res))) {
+    	$notice = new mb_exception("Permissioncheck failed no wfs conf for wfs " . $service["wfs_id"] . " with storedquery_id " . $storedQueryId);
+	throwE(array("No wfs_conf data for storedquery_id " . $storedQueryId));
+	die();
+    }
+    $conf_id = $row["wfs_conf_id"];
+    //check permission
+    if (!in_array($conf_id, $myconfs)) {
+        $notice = new mb_exception("Permissioncheck failed:" . $conf_id . " not in " . implode(",", $myconfs));
+        throwE(array("Permission denied.", " -> " . $conf_id, implode(",", $myconfs)));
+        die();
+    }
+    return $service;
+}
+
+function getWfsOperationUrl($wfsOws, $operationName, $operationMethod) {
+	$timeBegin = microtime();
+	$sql = "SELECT wfs_getcapabilities_doc FROM wfs WHERE  wfs_owsproxy = $1";
+	$v = array($wfsOws);
+    	$t = array("s");
+    	$res = db_prep_query($sql, $v, $t);
+    	if ($row = db_fetch_array($res)) {
+        	$capXml = $row["wfs_getcapabilities_doc"];
+    	} else {
+        	throwE(array("No wfs data available."));
+        	die();
+    	}
+	//parse capabilities
+	$wfs20Cap = new DOMDocument();
+	try {
+		if (!$wfs20Cap->loadXML($capXml)) {
+        		throw new Exception("Cannot parse WFS 2.0 Capabilities!");
+        	}
+	}
+	catch (Exception $e) {
+    		$e = new mb_exception($e->getMessage());
+	}	
+	if ($wfs20Cap !== false) {
+		$xpath = new DOMXPath($wfs20Cap);
+		$rootNamespace = $wfs20Cap->lookupNamespaceUri($wfs20Cap->namespaceURI);
+		$e = new mb_notice("rootns: ".$rootNamespace);
+		$xpath->registerNamespace('defaultns', $rootNamespace); 
+		$xpath->registerNamespace("ows", "http://www.opengis.net/ows");
+		$xpath->registerNamespace("gml", "http://www.opengis.net/gml");
+		$xpath->registerNamespace("ogc", "http://www.opengis.net/ogc");
+		$xpath->registerNamespace("xlink", "http://www.w3.org/1999/xlink");
+		$xpath->registerNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+		$urlArray = DOMNodeListObjectValuesToArray($xpath->query('/defaultns:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name=\''.$operationName.'\']/ows:DCP/ows:HTTP/ows:'.$operationMethod.'/@xlink:href'));
+		//check for type
+		if (is_array($urlArray)) {
+			$e = new mb_notice("http_auth/http/index.php: url for operation ".$operationName." : ".$urlArray[0]);
+			$timeEnd = microtime();
+			$e = new mb_notice("http_auth/http/index.php: time to get url from capabilities: ".($timeEnd-$timeBegin)*1000);
+			return $urlArray[0];
+		} else {
+			$e = new mb_exception("http_auth/http/index.php: no url for operation ".$operationName." and method ".$operationMethod." found in Capabilities. Function returned: ".json_encode($urlArray[0]));
+			return false;
+		} 
+	} else {
+		$e = new mb_exception("http_auth/http/index.php: Problem while trying to do xpath on capabilities document!");
+		return false;
+	}
+}
+
+function DOMNodeListObjectValuesToArray($domNodeList) {
+	$iterator = 0;
+	$array = array();
+	foreach ($domNodeList as $item) {
+    		$array[$iterator] = $item->nodeValue; // this is a DOMNode instance
+    		// you might want to have the textContent of them like this
+    		$iterator++;
+	}
+	return $array;
+}
+
 function checkLayerPermission($wms_id, $l, $userId)
 {
     global $n, $owsproxyService;
@@ -1031,7 +1222,7 @@
    	 }
 	 $content = $d->file;
     } else {
-		$e = new mb_exception("owsproxy/index.php: postData will be send ");
+		$e = new mb_notice("owsproxy/index.php: postData will be send ");
 		$postInterfaceObject = new connector();
 		$postInterfaceObject->set('httpType','POST');
 		$postInterfaceObject->set('curlSendCustomHeaders',true);
@@ -1101,7 +1292,7 @@
         }
         return true;
     } elseif (strtoupper($reqParams["request"]) == "GETFEATURE") {
-	$e = new mb_notice("owsproxy/http/index.php: GetFeature invoked");
+	$e = new mb_notice("http_auth/http/index.php: GetFeature invoked");
 	$startTime = microtime();
 	//parse featureCollection and get number of objects
 	libxml_use_internal_errors(true);

Modified: trunk/mapbender/owsproxy/http/classes/class_QueryHandler.php
===================================================================
--- trunk/mapbender/owsproxy/http/classes/class_QueryHandler.php	2017-03-30 11:29:58 UTC (rev 9729)
+++ trunk/mapbender/owsproxy/http/classes/class_QueryHandler.php	2017-04-03 13:56:02 UTC (rev 9730)
@@ -58,6 +58,10 @@
 				$this->reqParams['typename'] = $postQueryParser->serviceResourceName;
 				$this->reqParamsToLower['typename'] = $postQueryParser->serviceResourceName;
 			}
+			if (isset($postQueryParser->serviceStoredQueryId) && $postQueryParser->serviceStoredQueryId !== '') {
+				$this->reqParams['storedquery_id'] = $postQueryParser->serviceStoredQueryId;
+				$this->reqParamsToLower['storedquery_id'] = $postQueryParser->serviceStoredQueryId;
+			}
 			$this->hasPost = true;
 			
 		}

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2017-03-30 11:29:58 UTC (rev 9729)
+++ trunk/mapbender/owsproxy/http/index.php	2017-04-03 13:56:02 UTC (rev 9730)
@@ -341,16 +341,27 @@
         getExternalRequest($query->getOwsproxyServiceId());
         break;
     case 'getfeature':
-        $arrayFeatures = array($reqParams['typename']);
-        $arrayOnlineresources = checkWfsPermission($query->getOwsproxyServiceId(), $arrayFeatures, $userId);
-        $query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
+	if (isset($reqParams['storedquery_id']) && $reqParams['storedquery_id'] !== "") {
+        	$storedQueryId = $reqParams['storedquery_id'];
+        	$arrayOnlineresources = checkWfsStoredQueryPermission($owsproxyString, $storedQueryId, $userId);
+	} else {
+		$arrayFeatures = array($reqParams['typename']);
+        	$arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
+	}
+	$query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
         $request = $query->getRequest();
         $request = stripslashes($request);
+	//TODO - what if storedquery are used ? log storedquery_id?
 	if ($n->getWfsLogTag($arrayOnlineresources['wfs_id']) == 1) {
             //get price out of db
             $price = intval($n->getWfsPrice($arrayOnlineresources['wfs_id']));
-            $log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
+	    if (isset($reqParams['storedquery_id']) && $reqParams['storedquery_id'] !== "") {
+		$log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
+                $price, 0, $reqParams['storedquery_id']);
+	    } else {
+            	$log_id = $n->logWfsProxyRequest($arrayOnlineresources['wfs_id'], $userId, $request,
                 $price, 0, $reqParams['typename']);
+	    }
         } else {
 		$log_id = false;
 	}
@@ -380,6 +391,50 @@
             describeFeaturetype($request);
         }
         break;
+    case 'liststoredqueries':
+	if ($postData !== false) {
+		$operationMethod = "Post";
+	} else {
+		$operationMethod = "Get";
+	}
+	$listStoredQueriesUrl = getWfsOperationUrl($owsproxyString, "ListStoredQueries", $operationMethod);
+        $query->setOnlineResource($listStoredQueriesUrl);
+        $request = $query->getRequest();
+        $request = stripslashes($request);
+	//TODO: following is not the standard way because ows has not to handle vsp!!!
+	$request = delTotalFromQuery("wfs_id",$request);
+	//don't allow get parameters in conjunction with post!
+	if ($postData !== false) {
+		$request = $listStoredQueriesUrl;
+	}
+        if (isset($auth)) {
+            listStoredQueries($request, $auth);
+        } else {
+            listStoredQueries($request);
+        }
+        break;
+    case 'describestoredqueries':
+	if ($postData !== false) {
+		$operationMethod = "Post";
+	} else {
+		$operationMethod = "Get";
+	}
+	$describeStoredQueriesUrl = getWfsOperationUrl($owsproxyString, "DescribeStoredQueries", $operationMethod);
+        $query->setOnlineResource($describeStoredQueriesUrl);
+        $request = $query->getRequest();
+        $request = stripslashes($request);
+	//TODO: following is not the standard way because ows has not to handle vsp!!!
+	$request = delTotalFromQuery("wfs_id",$request);
+	//don't allow get parameters in conjunction with post!
+	if ($postData !== false) {
+		$request = $describeStoredQueriesUrl;
+	}
+        if (isset($auth)) {
+            describeStoredQueries($request, $auth);
+        } else {
+            describeStoredQueries($request);
+        }
+        break;
     // case wfs transaction (because of raw POST the request param is empty)
     case '':
         $arrayFeatures = getWfsFeaturesFromTransaction($HTTP_RAW_POST_DATA);
@@ -545,6 +600,30 @@
 }
 
 /**
+ * fetchs and returns the content of WFS 2.0+ ListStoredQueries response
+ * 
+ * @param string the url of the ListStoredQueries request
+ * @return echo the content of the ListStoredQueries document
+ */
+function listStoredQueries($url, $auth = false)
+{
+    global $reqParams;
+    $content = getDocumentContent(false, $url, "Content-Type: application/xml", $auth);
+}
+
+/**
+ * fetchs and returns the content of WFS 2.0+ DescribeStoredQueries response
+ * 
+ * @param string the url of the DescribeStoredQueries request
+ * @return echo the content of the DescribeStoredQueries document
+ */
+function describeStoredQueries($url, $auth = false)
+{
+    global $reqParams;
+    $content = getDocumentContent(false, $url, "Content-Type: application/xml", $auth);
+}
+
+/**
  * simulates a post request to host
  * 
  * @param string host to send the request to
@@ -962,6 +1041,121 @@
     return $service;
 }
 
+/**
+ * validates the access permission by getting the appropriate wfs_conf
+ * to each feature requested and check the wfs_conf permission
+ * 
+ * @param string owsproxy md5
+ * @param array array of requested featuretype names
+ * @return array array with detailed information on reqested wfs
+ */
+function checkWfsStoredQueryPermission($wfsOws, $storedQueryId, $userId)
+{
+    global $con, $n;
+    $myconfs = $n->getWfsConfByPermission($userId);
+    if ($storedQueryId !== false) {
+    } else {
+	throwE(array("No storedquery_id data available."));
+        die();
+    }
+    //get wfs
+    $sql = "SELECT * FROM wfs WHERE wfs_owsproxy = $1";
+    $v = array($wfsOws);
+    $t = array("s");
+    $res = db_prep_query($sql, $v, $t);
+    $service = array();
+    if ($row = db_fetch_array($res)) {
+        $service["wfs_id"] = $row["wfs_id"];
+        $service["wfs_getcapabilities"] = $row["wfs_getcapabilities"];
+        $service["wfs_getfeature"] = $row["wfs_getfeature"];
+        $service["wfs_describefeaturetype"] = $row["wfs_describefeaturetype"];
+        $service["wfs_transaction"] = $row["wfs_transaction"];
+        $service["wfs_getcapabilities_doc"] = $row["wfs_getcapabilities_doc"];
+    } else {
+        throwE(array("No wfs data available."));
+        die();
+    }
+    //get appropriate wfs_conf
+    $sql = "SELECT wfs_conf.wfs_conf_id FROM wfs_conf WHERE fkey_wfs_id = $1 AND stored_query_id = $2";
+    $v = array($service["wfs_id"], $storedQueryId);
+    $t = array("i", "s");
+    $res = db_prep_query($sql, $v, $t);
+    if (!($row = db_fetch_array($res))) {
+    	$notice = new mb_exception("Permissioncheck failed no wfs conf for wfs " . $service["wfs_id"] . " with storedquery_id " . $storedQueryId);
+	throwE(array("No wfs_conf data for storedquery_id " . $storedQueryId));
+	die();
+    }
+    $conf_id = $row["wfs_conf_id"];
+    //check permission
+    if (!in_array($conf_id, $myconfs)) {
+        $notice = new mb_exception("Permissioncheck failed:" . $conf_id . " not in " . implode(",", $myconfs));
+        throwE(array("Permission denied.", " -> " . $conf_id, implode(",", $myconfs)));
+        die();
+    }
+    return $service;
+}
+
+function getWfsOperationUrl($wfsOws, $operationName, $operationMethod) {
+	$timeBegin = microtime();
+	$sql = "SELECT wfs_getcapabilities_doc FROM wfs WHERE  wfs_owsproxy = $1";
+	$v = array($wfsOws);
+    	$t = array("s");
+    	$res = db_prep_query($sql, $v, $t);
+    	if ($row = db_fetch_array($res)) {
+        	$capXml = $row["wfs_getcapabilities_doc"];
+    	} else {
+        	throwE(array("No wfs data available."));
+        	die();
+    	}
+	//parse capabilities
+	$wfs20Cap = new DOMDocument();
+	try {
+		if (!$wfs20Cap->loadXML($capXml)) {
+        		throw new Exception("Cannot parse WFS 2.0 Capabilities!");
+        	}
+	}
+	catch (Exception $e) {
+    		$e = new mb_exception($e->getMessage());
+	}	
+	if ($wfs20Cap !== false) {
+		$xpath = new DOMXPath($wfs20Cap);
+		$rootNamespace = $wfs20Cap->lookupNamespaceUri($wfs20Cap->namespaceURI);
+		$e = new mb_notice("rootns: ".$rootNamespace);
+		$xpath->registerNamespace('defaultns', $rootNamespace); 
+		$xpath->registerNamespace("ows", "http://www.opengis.net/ows");
+		$xpath->registerNamespace("gml", "http://www.opengis.net/gml");
+		$xpath->registerNamespace("ogc", "http://www.opengis.net/ogc");
+		$xpath->registerNamespace("xlink", "http://www.w3.org/1999/xlink");
+		$xpath->registerNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+		$urlArray = DOMNodeListObjectValuesToArray($xpath->query('/defaultns:WFS_Capabilities/ows:OperationsMetadata/ows:Operation[@name=\''.$operationName.'\']/ows:DCP/ows:HTTP/ows:'.$operationMethod.'/@xlink:href'));
+		//check for type
+		if (is_array($urlArray)) {
+			$e = new mb_notice("http_auth/http/index.php: url for operation ".$operationName." : ".$urlArray[0]);
+			$timeEnd = microtime();
+			$e = new mb_notice("http_auth/http/index.php: time to get url from capabilities: ".($timeEnd-$timeBegin)*1000);
+			return $urlArray[0];
+		} else {
+			$e = new mb_exception("http_auth/http/index.php: no url for operation ".$operationName." and method ".$operationMethod." found in Capabilities. Function returned: ".json_encode($urlArray[0]));
+			return false;
+		} 
+	} else {
+		$e = new mb_exception("http_auth/http/index.php: Problem while trying to do xpath on capabilities document!");
+		return false;
+	}
+}
+
+function DOMNodeListObjectValuesToArray($domNodeList) {
+	$iterator = 0;
+	$array = array();
+	foreach ($domNodeList as $item) {
+    		$array[$iterator] = $item->nodeValue; // this is a DOMNode instance
+    		// you might want to have the textContent of them like this
+    		$iterator++;
+	}
+	return $array;
+}
+
+
 function checkLayerPermission($wms_id, $l, $userId)
 {
     global $n, $owsproxyService;



More information about the Mapbender_commits mailing list