[Mapbender-commits] r8617 - in trunk/mapbender: http/classes http/javascripts http/php http_auth/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed May 8 07:49:34 PDT 2013


Author: armin11
Date: 2013-05-08 07:49:34 -0700 (Wed, 08 May 2013)
New Revision: 8617

Modified:
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/php/mod_getServiceDisclaimer.php
   trunk/mapbender/http/php/mod_getWmcDisclaimer.php
   trunk/mapbender/http/php/mod_layerISOMetadata.php
   trunk/mapbender/http/php/wms.php
   trunk/mapbender/http_auth/http/index.php
Log:
Fix some small problem when showing disclaimer and less exceptions

Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http/classes/class_user.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -63,7 +63,7 @@
 			$this->id = Mapbender::session()->get("mb_user_id");
 			if ($this->id == '' || !isset($this->id)) {
 				$this->id = (integer)PUBLIC_USER;
-				$e = new mb_exception("class_user: no user_id found in session use PUBLIC_USER with id - ".PUBLIC_USER." - !");
+				$e = new mb_notice("class_user: no user_id found in session use PUBLIC_USER with id - ".PUBLIC_USER." - !");
 			}
 		}
 		try{

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -439,7 +439,7 @@
 		$touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../../php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
 		$touForWMS = $touServiceConnector->file;
 		//add only those who have no special tou defined - 
-		if ($touForWMS != ''){
+		if ($touForWMS != 'free'){
 			$tou .= $touHeader.$touForWMS;
 		}
 		//set the tou to be accepted - TODO maybe do this after the button which deletes the message window - from a ajax request.

Modified: trunk/mapbender/http/php/mod_getServiceDisclaimer.php
===================================================================
--- trunk/mapbender/http/php/mod_getServiceDisclaimer.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http/php/mod_getServiceDisclaimer.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -28,8 +28,7 @@
 	$testMatch = $_REQUEST["id"];
 	$pattern = '/^[\d]*$/';		
  	if (!preg_match($pattern,$testMatch)){ 
-		//echo 'id: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>id</b> is not valid (integer).<br/>'; 
+		echo 'id: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	$id = (integer)$testMatch;
@@ -40,8 +39,7 @@
 	//validate to wms, wfs
 	$testMatch = $_REQUEST["type"];	
  	if (!($testMatch == 'wms' or $testMatch == 'wfs')){ 
-		//echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>type</b> is not valid (wms,wfs).<br/>'; 
+		echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	$type = $testMatch;
@@ -52,8 +50,7 @@
 	//validate to wms, wfs
 	$testMatch = $_REQUEST["languageCode"];	
  	if (!($testMatch == 'de' or $testMatch == 'en' or  $testMatch == 'fr')){ 
-		//echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>type</b> is not valid (de,fr,en).<br/>'; 
+		echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	$languageCode = $testMatch;
@@ -64,8 +61,7 @@
 	//validate to wms, wfs
 	$testMatch = $_REQUEST["withHeader"];	
  	if (!($testMatch == 'true' or $testMatch == 'false')){ 
-		//echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>withHeader</b> is not valid (true or false).<br/>'; 
+		echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	if ($testMatch == 'true'){ 
@@ -80,8 +76,7 @@
 	//validate to wms, wfs
 	$testMatch = $_REQUEST["asTable"];	
  	if (!($testMatch == 'true' or $testMatch == 'false')){ 
-		//echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>asTable</b> is not valid (true or false).<br/>'; 
+		echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	if ($testMatch == 'true'){ 
@@ -329,7 +324,7 @@
 	} else {
 		echo $htmlHeader['noInformation']."<br>" ;
 	}*/
-	echo "";//since it is not neccessary to give information about nothing ;-)
+	echo "free";//since it is not neccessary to give information about nothing ;-)
 }
 
 ?>

Modified: trunk/mapbender/http/php/mod_getWmcDisclaimer.php
===================================================================
--- trunk/mapbender/http/php/mod_getWmcDisclaimer.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http/php/mod_getWmcDisclaimer.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -26,8 +26,7 @@
 	$testMatch = $_REQUEST["id"];
 	$pattern = '/^[\d]*$/';		
  	if (!preg_match($pattern,$testMatch)){ 
-		//echo 'id: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>id</b> is not valid (integer).<br/>'; 
+		echo 'id: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	$id = (integer)$testMatch;
@@ -40,8 +39,7 @@
 	//look for whitelist in mapbender.conf
 	$HOSTNAME_WHITELIST_array = explode(",",HOSTNAME_WHITELIST);
 	if (!in_array($testMatch,$HOSTNAME_WHITELIST_array)) {
-		//echo "Requested hostname <b>".$testMatch."</b> not whitelist! Please control your mapbender.conf.";
-		echo "Requested <b>hostName</b> not in whitelist! Please control your mapbender.conf.";
+		echo "Requested hostname <b>".$testMatch."</b> not whitelist! Please control your mapbender.conf.";
 		$e = new mb_notice("Whitelist: ".HOSTNAME_WHITELIST);
 		$e = new mb_notice($testMatch." not found in whitelist!");
 		die(); 	
@@ -56,8 +54,7 @@
 	//validate to wms, wfs
 	$testMatch = $_REQUEST["languageCode"];	
  	if (!($testMatch == 'de' or $testMatch == 'en' or  $testMatch == 'fr')){ 
-		//echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
-		echo 'Parameter <b>languageCode</b> is not valid (de,en,fr).<br/>'; 
+		echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>'; 
 		die(); 		
  	}
 	$languageCode = $testMatch;
@@ -113,7 +110,7 @@
 	$touServiceConnector = new connector("http://localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?type=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
 	$touForWMS = $touServiceConnector->file;
 	// 
-	if ($touForWMS == ''){
+	if ($touForWMS == 'free'){
 		$wmstou = $translation['noTouInformation'];
 	} else {
 		$wmstou = $touForWMS;

Modified: trunk/mapbender/http/php/mod_layerISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_layerISOMetadata.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http/php/mod_layerISOMetadata.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -108,7 +108,7 @@
 	}
 	//infos about the registrating department, check first if a special metadata point of contact is defined in the service table - function from mod_showMetadata - TODO: should be defined in admin class
 	if (!isset($mapbenderMetadata['fkey_mb_group_id']) or is_null($mapbenderMetadata['fkey_mb_group_id']) or $mapbenderMetadata['fkey_mb_group_id'] == 0){
-		$e = new mb_exception("mod_layerISOMetadata.php: fkey_mb_group_id not found!");
+		$e = new mb_notice("mod_layerISOMetadata.php: fkey_mb_group_id not found!");
 		//Get information about owning user of the relation mb_user_mb_group - alternatively the defined fkey_mb_group_id from the service must be used!
 		$sqlDep = "SELECT mb_group_name, mb_group_title, mb_group_id, mb_group_logo_path, mb_group_address, mb_group_email, mb_group_postcode, mb_group_city, mb_group_voicetelephone, mb_group_facsimiletelephone FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1  AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND c.mb_user_mb_group_type=2 LIMIT 1";
 		$vDep = array($mapbenderMetadata['wms_owner']);
@@ -116,7 +116,7 @@
 		$resDep = db_prep_query($sqlDep, $vDep, $tDep);
 		$departmentMetadata = db_fetch_array($resDep);
 	} else {
-		$e = new mb_exception("mod_layerISOMetadata.php: fkey_mb_group_id found!");
+		$e = new mb_notice("mod_layerISOMetadata.php: fkey_mb_group_id found!");
 		$sqlDep = "SELECT mb_group_name , mb_group_title, mb_group_id, mb_group_logo_path , mb_group_address, mb_group_email, mb_group_postcode, mb_group_city, mb_group_voicetelephone, mb_group_facsimiletelephone FROM mb_group WHERE mb_group_id = $1 LIMIT 1";
 		$vDep = array($mapbenderMetadata['fkey_mb_group_id']);
 		$tDep = array('i');

Modified: trunk/mapbender/http/php/wms.php
===================================================================
--- trunk/mapbender/http/php/wms.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http/php/wms.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -210,6 +210,9 @@
 //
 $monitor = new Layer_load_count();
 $monitor->increment($layerId);
+
+
+
 // ---------------------------------------------------------------------------
 //
 // START TO CREATE CAPABILITIES DOC
@@ -279,15 +282,16 @@
 //url maybe original if proxy is not active
 
 //set new capabilities url:
-
+//$e = new mb_exception($urlPrefix.$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"]);
 $tmpOR = $urlPrefix.$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"];
 $tmpOR = str_replace(SERVERIP, SERVERNAME, $tmpOR);
+//$e = new mb_exception($tmpOR);
 $wms_row['wms_getcapabilities'] = $tmpOR;
 
 if ($inspire) {
 	$wms_row['wms_getcapabilities'] .= "&INSPIRE=1";
 }
-
+$e = new mb_notice($wms_row['wms_getcapabilities']);
 $publicHasPermission=$admin->getLayerPermission($wms_row['wms_id'],$wms_row['layer_name'],PUBLIC_USER);
 if ($wms_row['wms_owsproxy'] <> "" AND $wms_row['wms_owsproxy'] <> NULL) {
 	if ($inspire) {
@@ -317,14 +321,23 @@
 	}
 } 
 
-	//Creating the "OnlineResource" node
-    	$onlineResource = $doc->createElement("OnlineResource");
+//Creating the "OnlineResource" node
+//if($wms_row['wms_getcapabilities'] <> "" AND $wms_row['wms_getcapabilities'] <> NULL) {
+    $onlineResource = $doc->createElement("OnlineResource");
 	$onlineResource = $service->appendChild($onlineResource);
 	$onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink" );
 	$onlineResource->setAttribute("xlink:href", $wms_row['wms_getcapabilities']);
+/*	$onlRes = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . "?layer_id=" . $layerId."&".session_name()."=".$sessionId;
+	if (isset($_SERVER["HTTPS"])) {
+		$onlRes = "https://" . $onlRes;
+	}
+	else {
+		$onlRes = "http://" . $onlRes;
+	}*/
+	//$onlineResource->setAttribute("xlink:href", $onlRes);
 	$onlineResource->setAttribute("xlink:type", "simple");
+//}
 
-
 #Insert contact information
 
 #Creating "Contact Information" node
@@ -530,22 +543,53 @@
 $get = $HTTP->appendChild($get);
 
 #Creating the "OnlineResource" node
+
+//if ($wms_row['wms_getcapabilities'] <> "" AND $wms_row['wms_getcapabilities'] <> NULL) {
 	$onlineResource = $doc->createElement("OnlineResource");
 	$onlineResource = $get->appendChild($onlineResource);
 	$onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
 	$onlineResource->setAttribute("xlink:href", $wms_row['wms_getcapabilities']);
+/*	$onlRes = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . "?layer_id=" . $layerId;
+
+	if ($inspire) {
+	$onlRes = $onlRes."&INSPIRE=1";
+	}
+
+	if (isset($_SERVER["HTTPS"])) {
+		$onlRes = "https://" . $onlRes;
+	}
+	else {
+		$onlRes = "http://" . $onlRes;
+	}*/
+	//$onlineResource->setAttribute("xlink:href", $onlRes);
 	$onlineResource->setAttribute("xlink:type", "simple");		
+//}
 
 #Creating the "Post" node
 $post = $doc->createElement("Post");
 $post = $HTTP->appendChild($post);
 
 #Creating the "OnlineResource" node
+//if ($wms_row['wms_getcapabilities'] <> "" AND $wms_row['wms_getcapabilities'] <> NULL) {
 	$onlineResource = $doc->createElement("OnlineResource");
 	$onlineResource = $post->appendChild($onlineResource);
 	$onlineResource->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
 	$onlineResource->setAttribute("xlink:href", $wms_row['wms_getcapabilities']);
+/*	$onlRes = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . "?layer_id=" . $layerId;
+
+	if ($inspire) {
+	$onlRes = $onlRes."&INSPIRE=1&";
+	}
+	
+	if (isset($_SERVER["HTTPS"])) {
+		$onlRes = "https://" . $onlRes;
+	}
+	else {
+		$onlRes = "http://" . $onlRes;
+	}*/
+	$onlineResource->setAttribute("xlink:href", $onlRes);
 	$onlineResource->setAttribute("xlink:type", "simple");
+//}
 
 ##########################################################
 #GetMap	

Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php	2013-05-06 14:10:59 UTC (rev 8616)
+++ trunk/mapbender/http_auth/http/index.php	2013-05-08 14:49:34 UTC (rev 8617)
@@ -90,7 +90,7 @@
 	unset($auth);
 }
 
-$e = new mb_exception("REQUEST to HTTP_AUTH: ".strtolower($reqParams['request']));
+$e = new mb_notice("REQUEST to HTTP_AUTH: ".strtolower($reqParams['request']));
 
 //what the proxy does
 switch (strtolower($reqParams['request'])) {
@@ -291,7 +291,7 @@
  */
 function getFeatureInfo($url){
 	global $reqParams;
-	$e = new mb_exception("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
+	$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
 	header("Content-Type: ".$reqParams['info_format']);
 	if (func_num_args() == 2) { //new for HTTP Authentication
 		$auth = func_get_arg(1);



More information about the Mapbender_commits mailing list