[Mapbender-commits] r1419 - in trunk/mapbender/http: classes php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jun 1 10:58:25 EDT 2007


Author: christoph
Date: 2007-06-01 10:58:25 -0400 (Fri, 01 Jun 2007)
New Revision: 1419

Modified:
   trunk/mapbender/http/classes/class_wms.php
   trunk/mapbender/http/php/mod_editWMS_Metadata.php
Log:
*added TRIM before inserting the keyword in the database
*check if keyword already exists is now case insensitive

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2007-06-01 13:53:15 UTC (rev 1418)
+++ trunk/mapbender/http/classes/class_wms.php	2007-06-01 14:58:25 UTC (rev 1419)
@@ -401,7 +401,7 @@
 					$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)] = $element[value];
+					$this->objLayer[$cnt_layer]->layer_keyword[count($this->objLayer[$cnt_layer]->layer_keyword)] = trim($element[value]);
 				}
 	      		if(strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
 					$dataurl = true;
@@ -518,7 +518,7 @@
 			}
 			if(!is_int($this->objLayer[$i]->layer_parent)){
 				$this->objLayer[$i]->layer_abstract = $this->wms_abstract;
-				$this->objLayer[$i]->layer_keyword = $this->wms_keyword;
+				$this->objLayer[$i]->layer_keyword = trim($this->wms_keyword);
 			}
 			if($this->objLayer[$i]->layer_name == ""){
 				$this->objLayer[$i]->layer_name = $this->objLayer[$i]->layer_title;
@@ -1093,7 +1093,7 @@
 			$keyword_id = "";
 			
 			while ($keyword_id == "") {
-				$sql = "SELECT keyword_id FROM keyword WHERE keyword = $1";
+				$sql = "SELECT keyword_id FROM keyword WHERE UPPER(keyword) = UPPER($1)";
 				$v = array($k[$j]);
 				$t = array('s');
 				$res = db_prep_query($sql,$v,$t);

Modified: trunk/mapbender/http/php/mod_editWMS_Metadata.php
===================================================================
--- trunk/mapbender/http/php/mod_editWMS_Metadata.php	2007-06-01 13:53:15 UTC (rev 1418)
+++ trunk/mapbender/http/php/mod_editWMS_Metadata.php	2007-06-01 14:58:25 UTC (rev 1419)
@@ -207,10 +207,10 @@
                     if($keywords[$i] != null)
                     {
                         #echo "3: Eintr�ge ungleich null: Keyword: ", $keywords[$i], "; Index: ", $i, ";<nr>";
-                        $keyword = $keywords[$i];
+                        $keyword = trim($keywords[$i]);
                         #Check, if the keyword is exsiting in the database
                         $keyword_sql = "SELECT keyword_id FROM keyword " .
-                                       "WHERE keyword = '$keyword'";
+                                       "WHERE UPPER(keyword) = UPPER('$keyword')";
                         $res_keyword_sql = db_query($keyword_sql);
                         $keyword_row = db_fetch_array($res_keyword_sql);
                         #Keyword exists in the database



More information about the Mapbender_commits mailing list