[Mapbender-commits] r1612 - trunk/mapbender/http/extensions

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 6 06:00:54 EDT 2007


Author: christoph
Date: 2007-08-06 06:00:54 -0400 (Mon, 06 Aug 2007)
New Revision: 1612

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

Modified: trunk/mapbender/http/extensions/geom2wfst.php
===================================================================
--- trunk/mapbender/http/extensions/geom2wfst.php	2007-08-06 09:59:29 UTC (rev 1611)
+++ trunk/mapbender/http/extensions/geom2wfst.php	2007-08-06 10:00:54 UTC (rev 1612)
@@ -90,14 +90,14 @@
 
 
 function sepNameSpace($s){
-	$c = strpos($s,":"); 
-	if($c>0) return substr($s,$c+1);
+	$c = mb_strpos($s,":"); 
+	if($c>0) return mb_substr($s,$c+1);
 	return $s;
 }
 function sendToHost($host,$port,$method,$path,$data){
 	$buf = '';
     if (empty($method)) $method = 'POST';
-    $method = strtoupper($method);
+    $method = mb_strtoupper($method);
     $fp = fsockopen($host, $port);
     fputs($fp, "$method $path HTTP/1.1\r\n");
     fputs($fp, "Host: $host\r\n");
@@ -123,60 +123,17 @@
 
 $data = sendToHost($host,$port,$method,html_entity_decode($path),$filter);
 
-$data = eregi_replace("^[^<]*", "", $data);
-$data = eregi_replace("[^>]*$", "", $data);
-
-/*
-$parser = xml_parser_create(CHARSET);
-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,$data,$values,$tags);
-$code = xml_get_error_code ($parser);
-if ($code) {
-	$result = "Error " . $code . " (" . xml_error_string($code) .  ")";
-	$error = true;
-}
-xml_parser_free($parser);
-if (!$error) {
-	$section;
-	foreach ($values as $element) {
-		$element[tag] = sepNameSpace($element[tag]);
-		if(strtoupper($element[tag]) == "SERVICEEXCEPTIONREPORT" && $element[type] == "open"){
-			$section = "serviceexceptionreport";
-		}
-		if ($section == "serviceexceptionreport" && strtoupper($element[tag]) == "SERVICEEXCEPTION") {
-//			$result = $element[value];
-			$result = "An error occured.";
-			$error = true;
-		}
-		if(strtoupper($element[tag]) == "STATUS" && $element[type] == "open"){
-			$section = "status";
-		}
-		if ($section == "status" && strtoupper($element[tag]) == "SUCCESS") {
-			$result = "Success.";
-			$error = false;
-		}
-	}
-}
-
-
-if ($error) {
-	$e = new mb_exception('WFS error at: host: '.$host.' port: '.$port.' filter: '.$_REQUEST["filter"].' - error message: '.$result);
-}
-else {
-	$e = new mb_exception('WFS successfull host: '.$host.' port: '.$port.' filter: '.$_REQUEST["filter"]);
-}
-*/
+$data = mb_eregi_replace("^[^<]*", "", $data);
+$data = mb_eregi_replace("[^>]*$", "", $data);
 header('Content-type: text/html');
 echo "{";  
-if (stristr($data, "success") !== false) {
+if (mb_strpos(mb_strtoupper($data), "SUCCESS") !== false) {
 	$response = "success";
-	if (ereg("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", $data)) {
-		$fid = ereg_replace("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", "\\1", $data);
+	if (mb_ereg("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", $data)) {
+		$fid = mb_ereg_replace("^.*ogc:FeatureId fid=\"(.+)\"/>.*$", "\\1", $data);
 		echo "\"fid\":\"".$fid."\",";
 	}
-	echo "\"success confirmation\":\"".str_replace("\"", "'", str_replace("\n", "", str_replace("\r", "", $data)))."\",";
+	echo "\"success confirmation\":\"".preg_replace("\"", "'", preg_replace("\n", "", preg_replace("\r", "", $data)))."\",";
 }
 else {
 	$response = "error";



More information about the Mapbender_commits mailing list