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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 17 10:45:25 EST 2011


Author: armin11
Date: 2011-11-17 07:45:25 -0800 (Thu, 17 Nov 2011)
New Revision: 8209

Modified:
   trunk/mapbender/http/classes/class_user.php
   trunk/mapbender/http/php/mod_showMetadata.php
Log:
Push anonymous user_id into session, if no user has authenticated before. Allow to load layer from mod_showMetadata.php module.

Modified: trunk/mapbender/http/classes/class_user.php
===================================================================
--- trunk/mapbender/http/classes/class_user.php	2011-11-17 12:36:49 UTC (rev 8208)
+++ trunk/mapbender/http/classes/class_user.php	2011-11-17 15:45:25 UTC (rev 8209)
@@ -61,6 +61,10 @@
 		}
 		else {
 			$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." - !");
+			}
 		}
 		try{
 			$this->load();
@@ -877,5 +881,6 @@
 		}
 		return false;
 	}
+	
 }
 ?>

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2011-11-17 12:36:49 UTC (rev 8208)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2011-11-17 15:45:25 UTC (rev 8209)
@@ -31,14 +31,18 @@
 //outputFormat: html, xml, georss, 
 //languageCode: de, en, fr
 //get language parameter out of mapbender session if it is set else set default language to de_DE
-if (isset($_SESSION['mb_lang']) && ($_SESSION['mb_lang']!='')) {
-	$e = new mb_notice("mod_showMetadata.php: language found in session: ".$_SESSION['mb_lang']);
-	$language = $_SESSION["mb_lang"];
+$sessionLang = Mapbender::session()->get("mb_lang");
+
+
+
+if (isset($sessionLang) && ($sessionLang!='')) {
+	$e = new mb_notice("mod_showMetadata.php: language found in session: ".$sessionLang);
+	$language = $sessionLang;
 	$langCode = explode("_", $language);
 	$langCode = $langCode[0]; # Hopefully de or s.th. else
 	$languageCode = $langCode; #overwrite the GET Parameter with the SESSION information
 }
-$e = new mb_notice("mod_showMetadata.php: language in SESSION: ".$_SESSION['mb_lang']);
+$e = new mb_notice("mod_showMetadata.php: language in SESSION: ".$sessionLang);
 $e = new mb_notice("mod_showMetadata.php: new language: ".$languageCode);
 
 $layout = 'tabs';
@@ -559,7 +563,6 @@
 
 
 
-
 //$e = new mb_exception("mod_showMetadata: fkey_mb_group_id from wms or wfs table: ".$resourceMetadata['fkey_mb_group_id']);
 if (!isset($resourceMetadata['fkey_mb_group_id']) or is_null($resourceMetadata['fkey_mb_group_id']) or $resourceMetadata['fkey_mb_group_id'] == 0){
 	$e = new mb_notice("mod_showMetadata: fkey_mb_group_id not found!");
@@ -833,7 +836,9 @@
 	$html .= $t_a.$translation['resourceAbstract'].$t_b.displayText($resourceMetadata['serviceabstract']).$t_c;
 }
 
+
 $user = new User();
+
 $layerAccessibility = $user->isLayerAccessible ($layerId);
 
 
@@ -1075,6 +1080,7 @@
 if ($metadataContactGroup['metadatapointofcontactorglogo'] != '') {
 	$html .= $t_a.$translation['logo'].$t_b."<img src='".$metadataContactGroup['metadatapointofcontactorglogo']."'  height='30'>".$t_c;
 }
+
 $html .= $t_a.$translation['contactOrganization'].$t_b.displayText($metadataContactGroup['metadatapointofcontactorgtitle']).$t_c;
 $html .= $t_a.$translation['contactAddress'].$t_b.displayText($metadataContactGroup['metadatapointofcontactorgaddress']).$t_c;
 $html .= $t_a.$translation['city'].$t_b.displayText($metadataContactGroup['metadatapointofcontactorgpostcode'].' '.$metadataContactGroup['metadatapointofcontactorgcity']).$t_c;
@@ -1109,6 +1115,7 @@
 	$html .= '<div>';
 }
 $html .= '<p>';
+
 if ($resource == 'wms' or $resource == 'layer') {
 	$touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?resource=wms&id=".$resourceMetadata['serviceid']."&languageCode=".$languageCode."&asTable=true");
 	$tou = $touServiceConnector->file;
@@ -1126,7 +1133,6 @@
 $html .= '</p>';
 $html .= '</div>';
 //**************************termsOfUse part end******************************
-
 //**************************quality part begin******************************
 if ($layout == 'accordion') {
 	$html .= '<h3><a href="#">'.$translation["quality"].'</a></h3>';
@@ -1187,6 +1193,7 @@
 $translation['inspireMetadata'] = 'INSPIRE Service Metadaten';
 $translation['securedCapabilities'] = 'Secured Capabilities URL';*/
 $html .= $tableBegin;
+
 if ($resource == 'wmc') {
 	$html .= $t_a.$translation['wmc'].$t_b."XML".$t_c;
 	//show qr for link 



More information about the Mapbender_commits mailing list