[Mapbender-commits] r7127 - in trunk/mapbender/http: classes geoportal javascripts php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Nov 15 09:45:42 EST 2010


Author: armin11
Date: 2010-11-15 06:45:42 -0800 (Mon, 15 Nov 2010)
New Revision: 7127

Modified:
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/geoportal/mod_initialStartWmc.php
   trunk/mapbender/http/javascripts/mod_addWMS.php
   trunk/mapbender/http/php/mod_callMetadata.php
   trunk/mapbender/http/php/mod_createJSObjFromXML.php
   trunk/mapbender/http/php/mod_layerISOMetadataWriteToFolder.php
Log:
some bugfixing and enhancement

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2010-11-15 14:42:43 UTC (rev 7126)
+++ trunk/mapbender/http/classes/class_wmc.php	2010-11-15 14:45:42 UTC (rev 7127)
@@ -551,7 +551,7 @@
 				$user = new user($this->userId);
 			}
 			catch (Exception $E) {
-				$errMsg = "Error while saving WMC document " . $this->wmc_title . "': Invalud UserId";
+				$errMsg = "Error while saving WMC document " . $this->wmc_title . "': Invalid UserId";
 				$result["success"] = false;
 				$result["message"] = $errMsg;
 				$e = new mb_exception("mod_insertWMCIntoDB: " . $errMsg);

Modified: trunk/mapbender/http/geoportal/mod_initialStartWmc.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_initialStartWmc.php	2010-11-15 14:42:43 UTC (rev 7126)
+++ trunk/mapbender/http/geoportal/mod_initialStartWmc.php	2010-11-15 14:45:42 UTC (rev 7127)
@@ -46,7 +46,7 @@
 if (isset($_REQUEST["hostName"]) & $_REQUEST["hostName"] != "") {
 	//validate to some hosts
 	$testMatch = $_REQUEST["hostName"];	
- 	if (!($testMatch == 'www.geoportal.rlp' or $testMatch == 'www.geoportal.rlp.de' or  $testMatch == 'www.gdi-rp-dienste3.rlp.de' or  $testMatch == '10.7.101.151')){ 
+ 	if (!($testMatch == 'www.geoportal.rlp' or $testMatch == 'www.geoportal.rlp.de' or  $testMatch == 'www.gdi-rp-dienste3.rlp.de' or  $testMatch == '10.7.101.151' or  $testMatch == '10.7.101.165')){ 
 		echo 'hostName: <b>'.$testMatch.'</b> is not a valid server of gdi-rp.<br/>'; 
 		die(); 		
  	}

Modified: trunk/mapbender/http/javascripts/mod_addWMS.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMS.php	2010-11-15 14:42:43 UTC (rev 7126)
+++ trunk/mapbender/http/javascripts/mod_addWMS.php	2010-11-15 14:45:42 UTC (rev 7127)
@@ -36,6 +36,118 @@
 function mod_addWMS(){
    var load = prompt("Capabilities - URL:","");
    if(load){
-      mod_addWMS_load(load);
+      mod_addWMS_load(base64_encode(load));
+	//mod_addWMS_load(base64_encode('http://www.google.de'));
    }
-}
\ No newline at end of file
+}
+
+function base64_encode(data) {
+   // Encodes string using MIME base64 algorithm 
+   //
+   // version: 909.322
+  // discuss at: http://phpjs.org/functions/base64_encode
+    // +   original by: Tyler Akins (http://rumkin.com)
+    // +   improved by: Bayron Guevara
+    // +   improved by: Thunder.m
+    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+    // +   bugfixed by: Pellentesque Malesuada
+    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+   // -    depends on: utf8_encode
+   // *     example 1: base64_encode('Kevin van Zonneveld');
+    // *     returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
+    // mozilla has this native
+   // - but breaks in 2.0.0.12!
+    //if (typeof this.window['atob'] == 'function') {
+   //    return atob(data);
+    //}
+         
+   var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+    var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc="", tmp_arr = [];
+ 
+    if (!data) {
+        return data;
+    }
+ 
+    data = utf8_encode(data+'');
+     
+    do { // pack three octets into four hexets
+        o1 = data.charCodeAt(i++);
+        o2 = data.charCodeAt(i++);
+        o3 = data.charCodeAt(i++);
+ 
+        bits = o1<<16 | o2<<8 | o3;
+ 
+        h1 = bits>>18 & 0x3f;
+        h2 = bits>>12 & 0x3f;
+        h3 = bits>>6 & 0x3f;
+        h4 = bits & 0x3f;
+ 
+        // use hexets to index into b64, and append result to encoded string
+        tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
+    } while (i < data.length);
+     
+    enc = tmp_arr.join('');
+     
+   switch (data.length % 3) {
+        case 1:
+            enc = enc.slice(0, -2) + '==';
+        break;
+        case 2:
+            enc = enc.slice(0, -1) + '=';
+        break;
+    }
+ 
+    return enc;
+}
+
+function utf8_encode ( argString ) {
+    // Encodes an ISO-8859-1 string to UTF-8 
+    //
+    // version: 909.322
+    // discuss at: http://phpjs.org/functions/utf8_encode
+    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
+    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
+    // +   improved by: sowberry
+    // +    tweaked by: Jack
+    // +   bugfixed by: Onno Marsman
+    // +   improved by: Yves Sucaet
+    // +   bugfixed by: Onno Marsman
+    // +   bugfixed by: Ulrich
+    // *     example 1: utf8_encode('Kevin van Zonneveld');
+    // *     returns 1: 'Kevin van Zonneveld'
+    var string = (argString+''); // .replace(/\r\n/g, "\n").replace(/\r/g, "\n");
+ 
+    var utftext = "";
+    var start, end;
+    var stringl = 0;
+ 
+    start = end = 0;
+    stringl = string.length;
+    for (var n = 0; n < stringl; n++) {
+        var c1 = string.charCodeAt(n);
+        var enc = null;
+ 
+        if (c1 < 128) {
+            end++;
+        } else if (c1 > 127 && c1 < 2048) {
+            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
+        } else {
+            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
+        }
+        if (enc !== null) {
+            if (end > start) {
+                utftext += string.substring(start, end);
+            }
+            utftext += enc;
+            start = end = n+1;
+        }
+    }
+ 
+    if (end > start) {
+        utftext += string.substring(start, string.length);
+    }
+ 
+    return utftext;
+}
+
+

Modified: trunk/mapbender/http/php/mod_callMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_callMetadata.php	2010-11-15 14:42:43 UTC (rev 7126)
+++ trunk/mapbender/http/php/mod_callMetadata.php	2010-11-15 14:45:42 UTC (rev 7127)
@@ -236,7 +236,7 @@
 }
 if (isset($_REQUEST["hostName"]) & $_REQUEST["hostName"] != "") {
 	$testMatch = $_REQUEST["hostName"];	
- 	if (!($testMatch == 'www.geoportal.rlp' or $testMatch == 'www.geoportal.rlp.de' or $testMatch == 'geoportal.rlp' or $testMatch == '10.7.101.165' or $testMatch == 'localhost:16580' or $testMatch == 'localhost' or $testMatch == 'www.gdi-rp-dienste3.rlp.de' )){ 
+ 	if (!($testMatch == 'www.geoportal.rlp' or $testMatch == 'www.geoportal.rlp.de' or $testMatch == 'geoportal.rlp' or $testMatch == '10.7.101.151' or $testMatch == 'localhost:16580' or $testMatch == 'localhost' or $testMatch == 'www.gdi-rp-dienste3.rlp.de' )){ 
 		echo 'hostName: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
@@ -884,12 +884,7 @@
 		$str .= "'".$orderBy."' ";
 		$str .= " & ";
 		$e = new mb_exception($str);
-
-		/*
-		 * @security_patch exec done
-		 * Added escapeshellcmd()
-		 */
-		exec(escapeshellcmd($str));
+		exec($str);
 	}
 }
 if ($resultTarget == 'web' or $resultTarget == 'debug') {

Modified: trunk/mapbender/http/php/mod_createJSObjFromXML.php
===================================================================
--- trunk/mapbender/http/php/mod_createJSObjFromXML.php	2010-11-15 14:42:43 UTC (rev 7126)
+++ trunk/mapbender/http/php/mod_createJSObjFromXML.php	2010-11-15 14:45:42 UTC (rev 7127)
@@ -20,6 +20,7 @@
 require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 require_once(dirname(__FILE__)."/../classes/class_wms.php");
 require_once(dirname(__FILE__)."/../classes/class_administration.php");
+#require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
 
 $capabilitiesURL = $_REQUEST['caps'];
 $noHtml = intval($_GET["noHtml"]);
@@ -28,8 +29,13 @@
 $charset = CHARSET;
 
 $mywms = new wms();
-$mywms->createObjFromXML($capabilitiesURL);
 
+#$e = new mb_exception("mod_createJSObjFromXML: CapUrl encoded to load: ".$capabilitiesURL);
+$caps = $capabilitiesURL;
+#$e = new mb_exception("mod_createJSObjFromXML: CapUrl decodes to load: ".$caps);
+$caps = html_entity_decode(base64_decode($_REQUEST['caps']));
+$mywms->createObjFromXML($caps);
+
 $errorMessage = _mb("Error: The Capabilities Document could not be accessed. " . 
 	"Please check whether the server is responding and accessible to " . 
 	"Mapbender.");

Modified: trunk/mapbender/http/php/mod_layerISOMetadataWriteToFolder.php
===================================================================
--- trunk/mapbender/http/php/mod_layerISOMetadataWriteToFolder.php	2010-11-15 14:42:43 UTC (rev 7126)
+++ trunk/mapbender/http/php/mod_layerISOMetadataWriteToFolder.php	2010-11-15 14:45:42 UTC (rev 7127)
@@ -1,5 +1,5 @@
 <?php
-#http://www.geoportal.rlp.de/mapbender/php/mod_layerISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=24356
+#http://www.geoportal.rlp.de/mapbender/php/mod_layerISOMetadataWriteToFolder.php?SERVICE=WMS&outputFormat=iso19139&Id=24356
 # $Id: mod_layerISOMetadata.php 235
 # http://www.mapbender.org/index.php/Inspire_Metadata_Editor
 # Copyright (C) 2002 CCGIS 
@@ -26,7 +26,7 @@
 db_select_db(DB,$con);
 
 //define the view or table where to read out the layer ids for which metadatafiles should be generated
-$wmsView = "wms_search_table_test";
+$wmsView = "wms_search_table";
 //$wmsView = '';
 //parse request parameter
 //make all parameters available as upper case



More information about the Mapbender_commits mailing list