[Mapbender-commits] r6423 - branches/2.5/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jun 24 05:30:25 EDT 2010


Author: christoph
Date: 2010-06-24 09:30:24 +0000 (Thu, 24 Jun 2010)
New Revision: 6423

Modified:
   branches/2.5/http/classes/class_wfs.php
Log:
http://trac.osgeo.org/mapbender/ticket/648

Modified: branches/2.5/http/classes/class_wfs.php
===================================================================
--- branches/2.5/http/classes/class_wfs.php	2010-06-23 13:11:47 UTC (rev 6422)
+++ branches/2.5/http/classes/class_wfs.php	2010-06-24 09:30:24 UTC (rev 6423)
@@ -91,20 +91,20 @@
 			$this->wfs_version = $element[attributes][version];
 		}
 		if(strtoupper($element[tag]) == "NAME"  && $element[level] == '3'){
-			$this->wfs_name = $element[value];
+			$this->wfs_name = trim($element[value]);
 		}
 		if(strtoupper($element[tag]) == "TITLE"  && $element[level] == '3'){
-			$this->wfs_title = $this->stripEndlineAndCarriageReturn($element[value]);
+			$this->wfs_title = trim($this->stripEndlineAndCarriageReturn($element[value]));
 		}
 		if(strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
-			$this->wfs_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
+			$this->wfs_abstract = trim($this->stripEndlineAndCarriageReturn($element[value]));
 		}
 		//new WFS 1.0.0 -- SB 2007-08-06
 		if(strtolower($element[tag]) == "fees"){
-			$this->fees = $element[value];
+			$this->fees = trim($element[value]);
 		}
 		if(strtolower($element[tag]) == "accessconstraints"){
-			$this->accessconstraints = $element[value];
+			$this->accessconstraints = trim($element[value]);
 		}
 		
 		/*capability section*/
@@ -116,18 +116,18 @@
 				$section = "getcapabilities";
 			}
 			if($section == "getcapabilities" && strtoupper($element[tag]) == "POST"){
-				$this->wfs_getcapabilities = $element[attributes][onlineResource];
+				$this->wfs_getcapabilities = trim($element[attributes][onlineResource]);
 			}
 			
 			# descriptFeatureType
 			if(strtoupper($element[tag]) == "DESCRIBEFEATURETYPE" && $element[type] == "open"){
 				$section = "describefeaturetype";
-				$this->wfs_describefeaturetype = $element[attributes][onlineResource];
+				$this->wfs_describefeaturetype = trim($element[attributes][onlineResource]);
 				
 				
 			}
 			if($section == "describefeaturetype" && strtoupper($element[tag]) == "POST"){
-				$this->wfs_describefeaturetype = $element[attributes][onlineResource];
+				$this->wfs_describefeaturetype = trim($element[attributes][onlineResource]);
 			}
 			
 			# getFeature
@@ -135,7 +135,7 @@
 				$section = "getfeature";
 			}
 			if($section == "getfeature" && strtoupper($element[tag]) == "POST"){
-				$this->wfs_getfeature = $element[attributes][onlineResource];
+				$this->wfs_getfeature = trim($element[attributes][onlineResource]);
 			}
 			if(strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "close"){
 				$section = "";
@@ -145,7 +145,7 @@
 				$section = "transaction";
 			}
 			if($section == "transaction" && strtoupper($element[tag]) == "POST"){
-				$this->wfs_transaction = $element[attributes][onlineResource];
+				$this->wfs_transaction = trim($element[attributes][onlineResource]);
 			}
 			if(strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "close"){
 				$section = "";
@@ -155,16 +155,16 @@
 			$section = "featuretype";
 		}
 		if($section == "featuretype" && strtoupper($element[tag]) == "NAME"){
-			$featuretype_name = $element[value];
+			$featuretype_name = trim($element[value]);
 		}
 		if($section == "featuretype" && strtoupper($element[tag]) == "TITLE"){
-			$featuretype_title = $this->stripEndlineAndCarriageReturn($element[value]);
+			$featuretype_title = trim($this->stripEndlineAndCarriageReturn($element[value]));
 		}
 		if($section == "featuretype" && strtoupper($element[tag]) == "ABSTRACT"){
-			$featuretype_abstract = $element[value];
+			$featuretype_abstract = trim($element[value]);
 		}
 		if($section == "featuretype" && strtoupper($element[tag]) == "SRS"){
-			$featuretype_srs = $element[value];
+			$featuretype_srs = trim($element[value]);
 			$this->addFeaturetype($featuretype_name,$featuretype_title,$featuretype_abstract,$featuretype_srs,$this->wfs_describefeaturetype,$this->wfs_version);
 		}
 	}
@@ -736,10 +736,31 @@
 class featuretype extends wfs{
 	var $featuretype_element = array();	
 	var $featuretype_namespace = array();	
+
+	function getConjunctionCharacter ($url) {
+		// does the URL contain "?"
+		$pos = strpos($url, "?");
+
+		// if yes, ...
+		if ($pos > -1) { 
+			// if the last character is "?", return ""
+			if (substr($url, -1) == "?") { 
+				return "";
+			}
+			// if the last character is "&", return ""
+			else if (substr($url, -1) == "&") {
+				return "";
+			}
+			// "?" exists, so the conunction character must be "&"
+			return "&";
+		}
+		// "?" doesn't exist, so the conunction character must be "?"
+		return "?";
+	}
 	
 	function featuretype($name,$title,$abstract,$srs,$url,$version){
 
-		$url .= "&SERVICE=WFS&VERSION=".$version."&REQUEST=DescribeFeatureType&TYPENAME=".$name;
+		$url .= getConjunctionCharacter($url) . "&SERVICE=WFS&VERSION=".$version."&REQUEST=DescribeFeatureType&TYPENAME=".$name;
 		
 		$this->featuretype_name = $name;
 		$this->featuretype_title = $title;



More information about the Mapbender_commits mailing list