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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 6 03:58:30 EDT 2007


Author: christoph
Date: 2007-08-06 03:58:30 -0400 (Mon, 06 Aug 2007)
New Revision: 1587

Modified:
   trunk/mapbender/http/classes/class_wms.php
Log:
replaced old string functions by multibyte string function

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2007-08-06 07:57:38 UTC (rev 1586)
+++ trunk/mapbender/http/classes/class_wms.php	2007-08-06 07:58:30 UTC (rev 1587)
@@ -115,207 +115,207 @@
 		$cnt_styles = -1;
 		
 		foreach ($values as $element) {
-			if(strtoupper($element[tag]) == "WMT_MS_CAPABILITIES" && $element[type] == "open"){
+			if(mb_strtoupper($element[tag]) == "WMT_MS_CAPABILITIES" && $element[type] == "open"){
 				$this->wms_version = $element[attributes][version];
 			}
-			if(strtoupper($element[tag]) == "TITLE" && $element[level] == '3'){
+			if(mb_strtoupper($element[tag]) == "TITLE" && $element[level] == '3'){
 				$this->wms_title = $this->stripEndlineAndCarriageReturn($element[value]);
 			}
-			if(strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
+			if(mb_strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
 				$this->wms_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
 			}
-			if(strtolower($element[tag]) == "fees"){
+			if(mb_strtolower($element[tag]) == "fees"){
 				$this->fees = $element[value];
 			}
-			if(strtolower($element[tag]) == "accessconstraints"){
+			if(mb_strtolower($element[tag]) == "accessconstraints"){
 				$this->accessconstraints = $element[value];
 			}
-			if(strtolower($element[tag]) == "contactperson"){
+			if(mb_strtolower($element[tag]) == "contactperson"){
 				$this->contactperson = $element[value];
 			}
-			if(strtolower($element[tag]) == "contactposition"){
+			if(mb_strtolower($element[tag]) == "contactposition"){
 				$this->contactposition = $element[value];
 			}
-			if(strtolower($element[tag]) == "contactorganization"){
+			if(mb_strtolower($element[tag]) == "contactorganization"){
 				$this->contactorganization = $element[value];
 			}
-			if(strtolower($element[tag]) == "address"){
+			if(mb_strtolower($element[tag]) == "address"){
 				$this->address = $element[value];
 			}
-			if(strtolower($element[tag]) == "city"){
+			if(mb_strtolower($element[tag]) == "city"){
 				$this->city = $element[value];
 			}
-			if(strtolower($element[tag]) == "stateorprovince"){
+			if(mb_strtolower($element[tag]) == "stateorprovince"){
 				$this->stateorprovince = $element[value];
 			}
-			if(strtolower($element[tag]) == "postcode"){
+			if(mb_strtolower($element[tag]) == "postcode"){
 				$this->postcode = $element[value];
 			}
-			if(strtolower($element[tag]) == "country"){
+			if(mb_strtolower($element[tag]) == "country"){
 				$this->country = $element[value];
 			}
-			if(strtolower($element[tag]) == "contactvoicetelephone"){
+			if(mb_strtolower($element[tag]) == "contactvoicetelephone"){
 				$this->contactvoicetelephone = $element[value];
 			}
-			if(strtolower($element[tag]) == "contactfacsimiletelephone"){
+			if(mb_strtolower($element[tag]) == "contactfacsimiletelephone"){
 				$this->contactfacsimiletelephone = $element[value];
 			}
-			if(strtolower($element[tag]) == "contactelectronicmailaddress"){
+			if(mb_strtolower($element[tag]) == "contactelectronicmailaddress"){
 				$this->contactelectronicmailaddress = $element[value];
 			}
-	  		if(strtolower($element[tag]) == "keyword" && $section != 'layer'){
+	  		if(mb_strtolower($element[tag]) == "keyword" && $section != 'layer'){
 				$this->wms_keyword[count($this->wms_keyword)] = $element[value];
 			}
 			
 			/*map section*/
 			if($this->wms_version == "1.0.0"){
-		 		if(strtoupper($element[tag]) == "MAP" && $element[type] == "open"){
+		 		if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "open"){
 					$section = "map";
 				}
-				if($section == "map" && strtoupper($element[tag]) == "GET"){
+				if($section == "map" && mb_strtoupper($element[tag]) == "GET"){
 					$this->wms_getmap = $element[attributes][onlineResource];
 				}
-				if($section == "map" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+				if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
 					$format = "map";
 				}
-				if(strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
+				if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
 					$this->data_type[$cnt_format] = "map";
 					$this->data_format[$cnt_format] = trim($element[tag]);
 					$cnt_format++;
 				}
-				if(strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
 					$format = "";
 				}
-				if(strtoupper($element[tag]) == "MAP" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			else{
-				if(strtoupper($element[tag]) == "GETMAP" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "open"){
 					$section = "map";
 				}
-				if($section == "map" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+				if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
 					$request = "get";
 				}
-				if($section == "map" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+				if($section == "map" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 					$this->wms_getmap = $element[attributes]["xlink:href"];
 				}
-				if($section == "map" && strtoupper($element[tag]) == "FORMAT"){
+				if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT"){
 					$this->data_type[$cnt_format] = "map";
 					$this->data_format[$cnt_format] = trim($element[value]);
 					$cnt_format++;
 				}
-				if($section == "map" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+				if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
 					$request = "";
 				}
-				if(strtoupper($element[tag]) == "GETMAP" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			/*capabilities section*/
 			if($this->wms_version == "1.0.0"){
-				if(strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "open"){
 					$section = "capabilities";
 				}
-				if($section == "capabilities" && strtoupper($element[tag]) == "GET"){
+				if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET"){
 					$this->wms_getcapabilities = $element[attributes][onlineResource];
 				}
-				if(strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			else{
-				if(strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
 					$section = "capabilities";
 				}
-				if($section == "capabilities" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+				if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
 					$request = "get";
 				}
-				if($section == "capabilities" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+				if($section == "capabilities" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 					$this->wms_getcapabilities = $element[attributes]["xlink:href"];
 				}
-				if($section == "capabilities" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+				if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
 					$request = "";
 				}
-				if(strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			/*featureInfo section*/
 			if($this->wms_version == "1.0.0"){
-				if(strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "open"){
 					$section = "featureinfo";
 				}
-				if($section == "featureinfo" && strtoupper($element[tag]) == "GET"){
+				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET"){
 					$this->wms_getfeatureinfo = $element[attributes][onlineResource];
 				}
-				if($section == "featureinfo" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
 					$format = "featureinfo";
 				}
-				if(strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
+				if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
 					$this->data_type[$cnt_format] = "featureinfo";
 					$this->data_format[$cnt_format] = trim($element[tag]);
 					$cnt_format++;
 				}
-				if(strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
 					$format = "";
 				}
-				if(strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			else{
-				if(strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "open"){
 					$section = "featureinfo";
 				}
-				if($section == "featureinfo" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
 					$request = "get";
 				}
-				if($section == "featureinfo" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+				if($section == "featureinfo" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 					$this->wms_getfeatureinfo = $element[attributes]["xlink:href"];
 				}
-				if($section == "featureinfo" && strtoupper($element[tag]) == "FORMAT"){
+				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT"){
 					$this->data_type[$cnt_format] = "featureinfo";
 					$this->data_format[$cnt_format] = trim($element[value]);
 					$cnt_format++;
 				}
-				if($section == "featureinfo" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+				if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
 					$request = "";
 				}
-				if(strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			/*exception section*/
 			if($this->wms_version == "1.0.0"){
-				if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
 					$section = "exception";
 				}
-				if($section == "exception" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+				if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
 					$format = "exception";
 				}
-				if(strtoupper($element[tag]) != "FORMAT" && $section == "exception" && $format == "exception"){
+				if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "exception" && $format == "exception"){
 					$this->data_type[$cnt_format] = "exception";
 					$this->data_format[$cnt_format] = trim($element[tag]);
 					$cnt_format++;
 				}
-				if($section == "exception" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+				if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
 					$format = "";
 				}
-				if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
 					$section = "";
 				}
 			}
 			else{
-				if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
 					$section = "exception";
 				}
-				if($section == "exception" && strtoupper($element[tag]) == "FORMAT"){
+				if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT"){
 					$this->data_type[$cnt_format] = "exception";
 					$this->data_format[$cnt_format] = trim($element[value]);
 					$cnt_format++;
 				}
-				if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
+				if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
 					$section = "";
 				}
 			}
@@ -324,25 +324,25 @@
 	      
 	      }
 	      else{
-	        if(strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "open"){
+	        if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "open"){
 				$section = "legend";
 			}
-	        if($section == "legend" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+	        if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
 				$request = "get";
 			}
-			if($section == "legend" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+			if($section == "legend" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 				$this->wms_getlegendurl = $element[attributes]["xlink:href"];
 			}
-	        if($section == "legend" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+	        if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
 				$request = "";
 			}
-			if(strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "close"){
+			if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "close"){
 				$section = "";
 			}         
 	      }
 	      
 			/*layer section*/				
-			if(strtoupper($element[tag]) == "LAYER"){
+			if(mb_strtoupper($element[tag]) == "LAYER"){
 				$section = "layer";
 				if ($element[type] == "open") {
 					$cnt_epsg = -1;
@@ -357,7 +357,7 @@
 				}
 			}
 			/* attribution */
-			if(strtoupper($element[tag]) == "ATTRIBUTION"){
+			if(mb_strtoupper($element[tag]) == "ATTRIBUTION"){
 				if ($element[type] == "open") {
 					$section = "attribution";
 				}
@@ -366,7 +366,7 @@
 				}
 			}
 			/* styles */
-			if(strtoupper($element[tag]) == "STYLE"){
+			if(mb_strtoupper($element[tag]) == "STYLE"){
 				$section = "style";
 				if($cnt_layer != $layer_style){
 					$layer_style = $cnt_layer;
@@ -380,64 +380,64 @@
 				}
 			}
 			if($section == "style"){
-				if(strtoupper($element[tag]) == "NAME"){
+				if(mb_strtoupper($element[tag]) == "NAME"){
 					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["name"] = $element[value];
 				}
-				if(strtoupper($element[tag]) == "TITLE"){
+				if(mb_strtoupper($element[tag]) == "TITLE"){
 					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["title"] = $element[value];
 				}
-	      		if(strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "open"){
+	      		if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "open"){
 					$legendurl = true;
 				}
-				if($legendurl && strtoupper($element[tag]) == "FORMAT"){
+				if($legendurl && mb_strtoupper($element[tag]) == "FORMAT"){
 					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurlformat"] = $element[value];
 				}
-				if($legendurl && strtoupper($element[tag]) == "ONLINERESOURCE"){
+				if($legendurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 					$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurl"] = $element[attributes]["xlink:href"];
 				}
-			    if(strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "close"){
+			    if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "close"){
 					$legendurl = false;
 				}   
 			}
 			/* end of styles */
 			if($section == "layer"){
-				if(strtoupper($element[tag]) == "NAME"){
+				if(mb_strtoupper($element[tag]) == "NAME"){
 					$this->objLayer[$cnt_layer]->layer_name = $element[value];
 				}
-				if(strtoupper($element[tag]) == "TITLE"){
+				if(mb_strtoupper($element[tag]) == "TITLE"){
 					$this->objLayer[$cnt_layer]->layer_title = $this->stripEndlineAndCarriageReturn($element[value]);
 				}
-				if(strtoupper($element[tag]) == "ABSTRACT"){
+				if(mb_strtoupper($element[tag]) == "ABSTRACT"){
 					$this->objLayer[$cnt_layer]->layer_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
 				}
-				if(strtoupper($element[tag]) == "KEYWORD"){
-					$this->objLayer[$cnt_layer]->layer_keyword[count($this->objLayer[$cnt_layer]->layer_keyword)] = trim($element[value]);
+				if(mb_strtoupper($element[tag]) == "KEYWORD"){
+					array_push($this->objLayer[$cnt_layer]->layer_keyword, trim($element[value]));
 				}
-	      		if(strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
+	      		if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
 					$dataurl = true;
 				}
-				if($dataurl && strtoupper($element[tag]) == "ONLINERESOURCE"){
+				if($dataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 					$this->objLayer[$cnt_layer]->layer_dataurl_href = $element[attributes]["xlink:href"];
 				}
-			    if(strtoupper($element[tag]) == "DATAURL" && $element[type] == "close"){
+			    if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "close"){
 					$dataurl = false;
 				}   
 				
-				if(strtoupper($element[tag]) == "METADATAURL" && $element[type] == "open"){
+				if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "open"){
 					$metadataurl = true;
 				}
-				if($metadataurl && strtoupper($element[tag]) == "ONLINERESOURCE"){
+				if($metadataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
 					$this->objLayer[$cnt_layer]->layer_metadataurl = $element[attributes]["xlink:href"];
 				}
-			    if(strtoupper($element[tag]) == "METADATAURL" && $element[type] == "close"){
+			    if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "close"){
 					$metadataurl = false;
 				}   
 				
-				if(strtoupper($element[tag]) == "SRS"){
+				if(mb_strtoupper($element[tag]) == "SRS"){
 	  				$this->objLayer[$cnt_layer]->wms_srs1 = $element[value];
 					$this->wms_srs = explode (" ", $this->objLayer[0]->wms_srs1);  				
 				}						      
-				if(strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
+				if(mb_strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
 					$cnt_epsg++;
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = "EPSG:4326";
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
@@ -445,7 +445,7 @@
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
 				}
-				if(strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
+				if(mb_strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
 					$cnt_epsg++;
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = $element[attributes][SRS];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
@@ -453,11 +453,11 @@
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
 					// a default epsg for mapbender
-					if($cnt_layer == 0 && $this->default_epsg == 0 && strlen(trim($element[attributes][SRS]))>= 10){
+					if($cnt_layer == 0 && $this->default_epsg == 0 && mb_strlen(trim($element[attributes][SRS]))>= 10){
 						$this->default_epsg = $cnt_epsg;
 					}
 				}
-				if(strtoupper($element[tag]) == "SCALEHINT"){
+				if(mb_strtoupper($element[tag]) == "SCALEHINT"){
 					if($element[attributes][max]>1000) $max = 0; else $max = $element[attributes][max]; 	
 					if($element[attributes][min]>1000) $min = 0; else $min = $element[attributes][min]; 	
 					$this->objLayer[$cnt_layer]->layer_minscale = round(($min * 2004.3976484406788493955738891127));
@@ -471,11 +471,13 @@
 		if(!$this->wms_title || $this->wms_title == "" || !$this->wms_getmap || $this->wms_getmap == ""){
 			$this->wms_status = false;
 			$this->optimizeWMS();
+			
 			return false;
 		}
 		else{
 			$this->wms_status = true;
 			$this->optimizeWMS();
+
 			return true;
 		}
 	}
@@ -530,7 +532,8 @@
 				$this->objLayer[$i]->layer_abstract = $this->wms_abstract;
 				for ($r = 0; $r < count($this->wms_keyword); $r++) {
 					array_push($this->objLayer[$i]->layer_keyword, trim($this->wms_keyword[$r]));
-				}			}
+				}
+			}
 			if($this->objLayer[$i]->layer_name == ""){
 				$this->objLayer[$i]->layer_name = $this->objLayer[$i]->layer_title;
 			}
@@ -547,32 +550,32 @@
 			$this->objLayer[$i]->gui_layer_maxscale = $this->objLayer[$i]->layer_maxscale;
 		}
 		for($i=0;$i<count($this->data_format);$i++){
-			if(strtolower($this->data_type[$i]) == 'map' && strtoupper($this->data_format[$i]) == strtoupper($map_default)){
-				$this->gui_wms_mapformat = strtolower($map_default);
+			if(mb_strtolower($this->data_type[$i]) == 'map' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($map_default)){
+				$this->gui_wms_mapformat = mb_strtolower($map_default);
 				$map_default_ok = true;
 			}
-			if(strtolower($this->data_type[$i]) == 'featureinfo' && strtoupper($this->data_format[$i]) == strtoupper($featureinfo_default)){
-				$this->gui_wms_featureinfoformat = strtolower($featureinfo_default);
+			if(mb_strtolower($this->data_type[$i]) == 'featureinfo' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($featureinfo_default)){
+				$this->gui_wms_featureinfoformat = mb_strtolower($featureinfo_default);
 				$featureinfo_default_ok = true;
 			}		
-			if(strtolower($this->data_type[$i]) == 'exception' && strtolower($this->data_format[$i]) == strtolower($exception_default)){
-				$this->gui_wms_exceptionformat = strtolower($exception_default);
+			if(mb_strtolower($this->data_type[$i]) == 'exception' && mb_strtolower($this->data_format[$i]) == mb_strtolower($exception_default)){
+				$this->gui_wms_exceptionformat = mb_strtolower($exception_default);
 				$exception_default_ok = true;
 			}		
 		}
 		if($map_default_ok == false){
 			for($i=0;$i<count($this->data_format);$i++){
-				if(strtolower($this->data_type[$i]) == "map" ){$this->gui_wms_mapformat = $this->data_format[$i]; break;}
+				if(mb_strtolower($this->data_type[$i]) == "map" ){$this->gui_wms_mapformat = $this->data_format[$i]; break;}
 			}
 		}
 		if($featureinfo_default_ok == false){
 			for($i=0;$i<count($this->data_format);$i++){
-				if(strtolower($this->data_type[$i]) == "featureinfo" ){$this->gui_wms_featureinfoformat = $this->data_format[$i]; break;}
+				if(mb_strtolower($this->data_type[$i]) == "featureinfo" ){$this->gui_wms_featureinfoformat = $this->data_format[$i]; break;}
 			}
 		}
 		if($exception_default_ok == false){
 			for($i=0;$i<count($this->data_format);$i++){
-				if(strtolower($this->data_type[$i]) == "exception" ){$this->gui_wms_exceptionformat = $this->data_format[$i]; break;}
+				if(mb_strtolower($this->data_type[$i]) == "exception" ){$this->gui_wms_exceptionformat = $this->data_format[$i]; break;}
 			}
 		}
 		
@@ -644,7 +647,7 @@
 	   * private function
 	   */
 	  function stripEndlineAndCarriageReturn($string) {
-	  	return str_replace(chr(13), "", str_replace(chr(10), " ", $string));
+	  	return preg_replace("/\n/", "", preg_replace("/\r/", " ", $string));
 	  }
 	  function createJsObjFromWMS($parent=0){
 	  	if(!$this->wms_title || $this->wms_title == ""){
@@ -749,8 +752,8 @@
 			print("add_wms('". 
 			$this->wms_id ."','".
 			$this->wms_version ."','".
-			str_replace("'", "", $this->wms_title) ."','".
-			str_replace("'", "", $this->wms_abstract) ."','". 
+			preg_replace("'", "", $this->wms_title) ."','".
+			preg_replace("'", "", $this->wms_abstract) ."','". 
 			$this->wms_getmap ."','" .
 			$this->wms_getfeatureinfo ."','".
 			$this->wms_getlegendurl ."','".
@@ -833,9 +836,9 @@
 	*/
 	function writeObjInDB($gui_id){
 		global $con;
-
+		
 		$this->checkObj();
-		db_begin();
+		//db_begin();
 	
 		# TABLE wms
 		$sql = "INSERT INTO wms (wms_version, wms_title, wms_abstract, wms_getcapabilities, wms_getmap, ";
@@ -845,7 +848,7 @@
 		$sql .= "wms_owner,wms_timestamp) ";
 		$sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24)";
 		$v = array($this->wms_version,$this->wms_title,$this->wms_abstract,$this->wms_getcapabilities,
-			$this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,$this->wms_getcapabilities_doc,
+			$this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,"",
 			$this->wms_upload_url,$this->fees,$this->accessconstraints,$this->contactperson,$this->contactposition,
 			$this->contactorganization,$this->address,$this->city,$this->stateorprovince,$this->postcode,$this->country,
 			$this->contactvoicetelephone,$this->contactfacsimiletelephone,$this->contactelectronicmailaddress,
@@ -853,7 +856,7 @@
 		$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i','i');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();
+			////db_rollback();
 		}
 		
 		$myWMS = db_insert_id($con,'wms', 'wms_id');
@@ -891,9 +894,9 @@
 		$t = array('s','i','i','s','s','s','s');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			////db_rollback();	
 		}
-		db_commit();
+		//db_commit();
 	    
 	    #Changes JW
 	    $this->wms_id = $myWMS;
@@ -920,18 +923,20 @@
 		$t = array('i','i','s','s','s','i','i','i','s','s','s');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			////db_rollback();	
 		}
+		else {
+			# save the id of each layer: set param2 true		
+			$this->objLayer[$i]->db_id = db_insert_id($con, 'layer','layer_id');
+			$this->insertLayerEPSG($i);
+			
+			# TABLE layer_style for each layer
+			$this->insertLayerStyle($i);
+			
+			# insert Keywords
+			$this->insertLayerKeyword($i);	
 		
-		# save the id of each layer: set param2 true		
-		$this->objLayer[$i]->db_id = db_insert_id($con, 'layer','layer_id');
-		$this->insertLayerEPSG($i);
-		
-		# TABLE layer_style for each layer
-		$this->insertLayerStyle($i);
-		
-		# insert Keywords
-		$this->insertLayerKeyword($i);	
+		}
 	}
 	function updateLayer($i,$myWMS){
 		$sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
@@ -942,7 +947,7 @@
 			$l_id = $row['layer_id'];	
 		}
 		else{
-			db_rollback();
+			////db_rollback();
 			$e = new mb_exception("Not found: ".$this->objLayer[$i]->layer_name);
 			return;	
 		}	
@@ -987,17 +992,19 @@
 			$res = db_prep_query($sql,$v,$t);
 		}
 		if(!$res){
-			db_rollback();	
+			////db_rollback();	
 		}
-		
-		# save the id of each layer: set param2 true
-		$this->objLayer[$i]->db_id = $l_id;
-		$this->insertLayerEPSG($i);
-		
-		# TABLE layer_style for each layer
-		$this->insertLayerStyle($i);
-		if($this->overwrite == true){
-			$this->insertLayerKeyword($i);
+		else {
+			
+			# save the id of each layer: set param2 true
+			$this->objLayer[$i]->db_id = $l_id;
+			$this->insertLayerEPSG($i);
+			
+			# TABLE layer_style for each layer
+			$this->insertLayerStyle($i);
+			if($this->overwrite == true){
+				$this->insertLayerKeyword($i);
+			}
 		}
 	}
 	function insertGuiLayer($i,$myWMS,$gui_id){
@@ -1012,7 +1019,7 @@
 		$t = array('s','i','i','i','i','i','i','i','i','i','i');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			////db_rollback();	
 		}	
 	}
 	function appendGuiLayer($i,$myWMS,$gui_id){
@@ -1027,17 +1034,17 @@
 		$t = array('s','i','i','i','i','i','i','i','i','i','i');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			////db_rollback();	
 		}	
 	}
 	function insertSRS($myWMS){
 		for($i=0; $i<count($this->wms_srs);$i++){
 			$sql ="INSERT INTO wms_srs (fkey_wms_id, wms_srs) values($1,$2)";		
-			$v = array($myWMS,strtoupper($this->wms_srs[$i]));
+			$v = array($myWMS,mb_strtoupper($this->wms_srs[$i]));
 			$t = array('i','s');		
 			$res = db_prep_query($sql,$v,$t);
 			if(!$res){
-				db_rollback();	
+				//db_rollback();	
 			}
 		}	
 	}
@@ -1049,7 +1056,7 @@
 			$t = array('i','s','s');
 			$res = db_prep_query($sql,$v,$t);
 			if(!$res){
-				db_rollback();	
+				////db_rollback();	
 			}
 		}	
 	}
@@ -1068,7 +1075,7 @@
 			$t = array('i','s','d','d','d','d');
 			$res = db_prep_query($sql,$v,$t);
 			if(!$res){
-				db_rollback();	
+				////db_rollback();	
 			}
 		}
 	}
@@ -1087,7 +1094,7 @@
 			$t = array('i','s','s','s','s');
 			$res = db_prep_query($sql,$v,$t);
 			if(!$res){
-				db_rollback();	
+				////db_rollback();	
 			}
 		}
 	}
@@ -1098,8 +1105,9 @@
 		$t = array('i');
 		$res = db_prep_query($sql,$v,$t);
 		
-		
+//		var_dump($this);
 		$k = $this->objLayer[$i]->layer_keyword;
+//		var_dump($k);
 		for($j=0; $j<count($k); $j++){
 			$keyword_id = "";
 			
@@ -1109,6 +1117,7 @@
 				$t = array('s');
 				$res = db_prep_query($sql,$v,$t);
 				$row = db_fetch_array($res);
+			//print_r($row);
 				if ($row) {
 					$keyword_id = $row["keyword_id"];	
 				}
@@ -1117,9 +1126,10 @@
 					$sql_insertKeyword .= "VALUES ($1)";
 					$v1 = array($k[$j]);
 					$t1 = array('s');
+					echo $k[$j];
 					$res_insertKeyword = db_prep_query($sql_insertKeyword,$v1,$t1);
 					if(!$res_insertKeyword){
-						db_rollback();	
+						//db_rollback();	
 					}
 				}
 			}
@@ -1130,6 +1140,7 @@
 			$t = array('i', 'i');
 			$res_layerKeywordExists = db_prep_query($sql_layerKeywordExists, $v, $t);
 			$row = db_fetch_array($res_layerKeywordExists);
+			//print_r($row);
 			if (!$row) {
 				$sql1 = "INSERT INTO layer_keyword (fkey_keyword_id,fkey_layer_id)";
 				$sql1 .= "VALUES ($1,$2)";
@@ -1137,13 +1148,13 @@
 				$t1 = array('i','i');
 				$res1 = db_prep_query($sql1,$v1,$t1);
 				if(!$res1){
-					db_rollback();	
+					////db_rollback();	
 				}
 			}
 		}
 	}
 	function updateObjInDB($myWMS){
-		db_begin();
+		//db_begin();
 		
 		$sql = "UPDATE wms SET ";
 		$sql .= "wms_version = $1 ,";
@@ -1164,7 +1175,7 @@
 	
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			//db_rollback();	
 		}
 		
 		if($this->overwrite == true){
@@ -1193,7 +1204,7 @@
 			$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i');
 			$res = db_prep_query($sql,$v,$t);
 			if(!$res){
-				db_rollback();	
+				//db_rollback();	
 			}
 		}
 		
@@ -1203,7 +1214,7 @@
 		$t = array('i');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			//db_rollback();	
 		}
 		$this->insertSRS($myWMS);
 		
@@ -1212,7 +1223,7 @@
 		$t = array('i');
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			//db_rollback();	
 		}
 		$this->insertFormat($myWMS);
 		
@@ -1236,7 +1247,7 @@
 		
 		$res = db_prep_query($sql,$v,$t);
 		if(!$res){
-			db_rollback();	
+			//db_rollback();	
 		}
 			
 		# update or insert?
@@ -1274,7 +1285,7 @@
 				}
 			}
 		}
-		db_commit();
+		//db_commit();
 		return;	
 	}
 	function updateGuiLayer($i,$myWMS,$gui_id){
@@ -1286,7 +1297,7 @@
 			$l_id = $row['layer_id'];	
 		}
 		else{
-			db_rollback();
+			//db_rollback();
 			$e = new mb_exception("Not found: ".$this->objLayer[$i]->layer_name. " in gui: ".$gui_id);
 			return;	
 		}
@@ -1302,7 +1313,10 @@
 				$v = array($l_id,$gui_id);
 				$t = array('i','s');
 				$res1 = db_prep_query($sql1,$v,$t);
-				if(!$res1){db_rollback();}
+				if(!$res1){
+					
+				//db_rollback();
+				}
 			}
 			if($this->objLayer[$i]->layer_queryable == 1){
 				$sql1 = "UPDATE gui_layer set gui_layer_queryable = 1 ";
@@ -1310,7 +1324,10 @@
 				$v = array($l_id,$gui_id);
 				$t = array('i','s');
 				$res1 = db_prep_query($sql1,$v,$t);
-				if(!$res1){db_rollback();}
+				if(!$res1){
+					
+				//db_rollback();
+				}
 			}
 			if($row["gui_layer_minscale"] < $this->objLayer[$i]->layer_minscale){
 				$sql1 = "UPDATE gui_layer set gui_layer_minscale = $1 ";
@@ -1318,7 +1335,8 @@
 				$v = array($this->objLayer[$i]->layer_minscale,$l_id,$gui_id);
 				$t = array('i','i','s');
 				$res1 = db_prep_query($sql1,$v,$t);
-				if(!$res1){db_rollback();}
+				if(!$res1){//db_rollback();
+				}
 			}
 			if($row["gui_layer_maxscale"] > $this->objLayer[$i]->layer_maxscale){
 				$sql1 = "UPDATE gui_layer set gui_layer_maxscale = $1 ";
@@ -1326,7 +1344,8 @@
 				$v = array($this->objLayer[$i]->layer_maxscale,$l_id,$gui_id);
 				$t = array('i','i','s');
 				$res1 = db_prep_query($sql1,$v,$t);
-				if(!$res1){db_rollback();}
+				if(!$res1){//db_rollback();
+				}
 			}		
 		}
 	}
@@ -1343,15 +1362,15 @@
 			$sql = "UPDATE gui_wms SET ";		
 			for($i=0; $i<count($this->data_type); $i++){
 				# gui_wms_mapformat
-				if(strtolower($this->data_type[$i]) == "map" && strtolower($this->data_format[$i]) == strtolower($row["gui_wms_mapformat"])){
+				if(mb_strtolower($this->data_type[$i]) == "map" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_mapformat"])){
 					$myMapFormat = true;
 				}
 				# gui_wms_featureinfoformat
-				if(strtolower($this->data_type[$i]) == "featureinfo" && strtolower($this->data_format[$i]) == strtolower($row["gui_wms_featureinfoformat"])){
+				if(mb_strtolower($this->data_type[$i]) == "featureinfo" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_featureinfoformat"])){
 					$myFeatureInfoFormat = true;
 				}
 				# gui_wms_exceptionformat
-				if(strtolower($this->data_type[$i]) == "exception" && strtolower($this->data_format[$i]) == strtolower($row["gui_wms_exceptionformat"])){
+				if(mb_strtolower($this->data_type[$i]) == "exception" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_exceptionformat"])){
 					$myExceptionFormat = true;
 				}
 			}
@@ -1372,7 +1391,7 @@
 				
 			# gui_wms_epsg
 			for($j=0; $j<count($this->objLayer[0]->layer_epsg);$j++){
-				if($this->objLayer[0]->layer_epsg[$j][epsg] == strtoupper($row["gui_wms_epsg"])){
+				if($this->objLayer[0]->layer_epsg[$j][epsg] == mb_strtoupper($row["gui_wms_epsg"])){
 					$myGUI_EPSG = true;
 				}
 			}
@@ -1653,7 +1672,8 @@
 	
 	function layer($id,$parent){
 		$this->layer_id = $id;
-		$this->layer_parent = $parent;		
+		$this->layer_parent = $parent;	
+		//var_dump($this);	
 	}
 }
 ?>
\ No newline at end of file



More information about the Mapbender_commits mailing list