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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jul 14 07:59:47 EDT 2008


Author: christoph
Date: 2008-07-14 07:59:46 -0400 (Mon, 14 Jul 2008)
New Revision: 2662

Modified:
   trunk/mapbender/http/classes/class_wms.php
Log:
capability document is only encoded before writing it in the database

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2008-07-14 11:56:27 UTC (rev 2661)
+++ trunk/mapbender/http/classes/class_wms.php	2008-07-14 11:59:46 UTC (rev 2662)
@@ -17,15 +17,11 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/class_connector.php");
 require_once(dirname(__FILE__)."/class_user.php");
-require_once(dirname(__FILE__)."/class_mb_exception.php");
 require_once(dirname(__FILE__)."/class_administration.php");
 
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
-  
 class wms {
 	var $lastURL;
 	var $wms_id;
@@ -232,7 +228,7 @@
 		$values = null;
 		$tags = null;
 		$admin = new administration();
-		$this->wms_getcapabilities_doc = $admin->char_encode($data);
+		$this->wms_getcapabilities_doc = $data;
 		$this->wms_upload_url = $url;
 		
 		$this->wms_id = "";
@@ -240,7 +236,7 @@
 		xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
 		xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
 		xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
-		xml_parse_into_struct($parser,$this->wms_getcapabilities_doc,$values,$tags);
+		xml_parse_into_struct($parser,$data,$values,$tags);
 
 		$code = xml_get_error_code($parser);
 		if ($code) {
@@ -1087,7 +1083,8 @@
 	*/
 	function writeObjInDB($gui_id){
 		global $con;
-		
+		$admin = new administration();
+
 		$this->checkObj();
 		db_begin();
 	
@@ -1100,7 +1097,7 @@
 		$sql .= "wms_supportsld, wms_userlayer, wms_userstyle, wms_remotewfs) ";
 		$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,$25,$26,$27,$28)";
 		$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,$admin->char_encode($this->wms_getcapabilities_doc),
 			$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,
@@ -1419,6 +1416,7 @@
 		}
 	}
 	function updateObjInDB($myWMS){
+		$admin = new administration();
 		db_begin();
 		
 		$sql = "UPDATE wms SET ";
@@ -1439,7 +1437,7 @@
 	
 		$v = array($this->wms_version,$this->wms_getcapabilities,
 			$this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,
-			$this->wms_getcapabilities_doc,$this->wms_upload_url,$_SESSION["mb_user_id"],strtotime("now"),
+			$admin->char_encode($this->wms_getcapabilities_doc),$this->wms_upload_url,$_SESSION["mb_user_id"],strtotime("now"),
 			$this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs,$myWMS);
 		$t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i');
 	
@@ -1770,6 +1768,9 @@
 					$this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
 					$this->wms_getlegendurl = $row2["wms_getlegendurl"];
 				}			
+				// TO DO: Capabilities document needs to 
+				// be encoded to the original encoding
+				// if different from the database encoding
 				$this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
 				$this->wms_filter = $row2["wms_filter"];
 				$this->wms_supportsld = $row2["wms_supportsld"];
@@ -1911,6 +1912,9 @@
 				$this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
 				$this->wms_getlegendurl = $row2["wms_getlegendurl"];
 			}			
+			// TO DO: Capabilities document needs to 
+			// be encoded to the original encoding
+			// if different from the database encoding
 			$this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
 			$this->wms_filter = $row2["wms_filter"];
 			$this->wms_supportsld = $row2["wms_supportsld"];



More information about the Mapbender_commits mailing list