[Mapbender-commits] r9754 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jul 25 08:00:13 PDT 2017


Author: armin11
Date: 2017-07-25 08:00:13 -0700 (Tue, 25 Jul 2017)
New Revision: 9754

Modified:
   trunk/mapbender/http/classes/class_wfsToDb.php
Log:
Fix of a CRITICAL Bug for update wfs in db - when invoked from metadata editor. Before  the urls have been rewritten to owsproxy urls if proxy was activated! Invoking the secured wfs started a never ending recursion of the proxy invocation!

Modified: trunk/mapbender/http/classes/class_wfsToDb.php
===================================================================
--- trunk/mapbender/http/classes/class_wfsToDb.php	2017-07-24 15:44:40 UTC (rev 9753)
+++ trunk/mapbender/http/classes/class_wfsToDb.php	2017-07-25 15:00:13 UTC (rev 9754)
@@ -188,15 +188,15 @@
 		//$e = new mb_exception("awfs_username: ".$aWfs->auth['username']);
 		$admin = new administration();
 		db_begin();
-	
 		// update WFS
-		$sql = "UPDATE wfs SET wfs_version = $1, wfs_name = $2, wfs_getcapabilities = $3, wfs_getcapabilities_doc = $4, ";
-		$sql .= "wfs_upload_url = $5, wfs_describefeaturetype = $6, wfs_getfeature = $7, ";
-		$sql .= "wfs_transaction = $8, wfs_timestamp = $9, wfs_network_access = $10, fkey_mb_group_id = $11, ";
-		$sql .=  "wfs_max_features = $12, inspire_annual_requests = $13, wfs_username = $14, wfs_password = $15, wfs_auth_type = $16, wfs_license_source_note = $18";
-		$sql .= "WHERE wfs_id = $17";
-	
-		$v = array(
+		if (!$updateMetadataOnly) {
+			$e = new mb_notice("classes/class_wfsToDb.php: - function update - not from metadata editor");
+			$sql = "UPDATE wfs SET wfs_version = $1, wfs_name = $2, wfs_getcapabilities = $3, wfs_getcapabilities_doc = $4, ";
+			$sql .= "wfs_upload_url = $5, wfs_describefeaturetype = $6, wfs_getfeature = $7, ";
+			$sql .= "wfs_transaction = $8, wfs_timestamp = $9, wfs_network_access = $10, fkey_mb_group_id = $11, ";
+			$sql .=  "wfs_max_features = $12, inspire_annual_requests = $13, wfs_username = $14, wfs_password = $15, wfs_auth_type = $16, wfs_license_source_note = $18";
+			$sql .= "WHERE wfs_id = $17";
+			$v = array(
 				$aWfs->getVersion(),
 				$aWfs->name,
 				$aWfs->getCapabilities,
@@ -215,17 +215,41 @@
 				$aWfs->auth['auth_type'],
 				$aWfs->id,
 				$aWfs->wfs_license_source_note
-		);
+			);
 			
-		$t = array('s','s','s','s','s','s','s','s','s','i','i','i','i','s','s','s','i','s');
-		$e = new mb_notice("class_wfsToDb.php: UPDATING WFS " . $aWfs->id);
-		$res = db_prep_query($sql, $v, $t);
-		if (!$res) {
-			$e = new mb_exception("Error while updating WFS in database.");
-			db_rollback();
-			return false;
+			$t = array('s','s','s','s','s','s','s','s','s','i','i','i','i','s','s','s','i','s');
+			$e = new mb_notice("class_wfsToDb.php: UPDATING WFS " . $aWfs->id);
+			$res = db_prep_query($sql, $v, $t);
+			if (!$res) {
+				$e = new mb_exception("Error while updating WFS in database.");
+				db_rollback();
+				return false;
+			}
+		} else {
+			$e = new mb_notice("classes/class_wfsToDb.php: - function update - from metadata editor");
+			//only update wfs elements that are given by metadata editor - noc technical things!
+			$sql = "UPDATE wfs SET wfs_timestamp = $1, wfs_network_access = $2, fkey_mb_group_id = $3, ";
+			$sql .=  "wfs_max_features = $4, inspire_annual_requests = $5, wfs_license_source_note = $7";
+			$sql .= "WHERE wfs_id = $6";
+			$v = array(
+				strtotime("now"),
+				$aWfs->wfs_network_access,
+				$aWfs->fkey_mb_group_id,
+				$aWfs->wfs_max_features,
+				$aWfs->inspire_annual_requests,
+				$aWfs->id,
+				$aWfs->wfs_license_source_note
+			);
+			
+			$t = array('s','i','i','i','i','i','s');
+			$e = new mb_notice("class_wfsToDb.php: UPDATING WFS - metadata editor elements only - " . $aWfs->id);
+			$res = db_prep_query($sql, $v, $t);
+			if (!$res) {
+				$e = new mb_exception("Error while updating WFS in database.");
+				db_rollback();
+				return false;
+			}
 		}
-		
 		//update following metadata only if intended - mapbender.conf
 		if($aWfs->overwrite == true){
 			$sql = "UPDATE wfs SET ";



More information about the Mapbender_commits mailing list