[Mapbender-commits] r10135 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jun 5 01:02:32 PDT 2019


Author: armin11
Date: 2019-06-05 01:02:32 -0700 (Wed, 05 Jun 2019)
New Revision: 10135

Modified:
   trunk/mapbender/http/php/mod_layerISOMetadata.php
Log:
some fixes

Modified: trunk/mapbender/http/php/mod_layerISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_layerISOMetadata.php	2019-06-04 21:24:13 UTC (rev 10134)
+++ trunk/mapbender/http/php/mod_layerISOMetadata.php	2019-06-05 08:02:32 UTC (rev 10135)
@@ -28,6 +28,19 @@
 require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php");
 require_once(dirname(__FILE__)."/../classes/class_qualityReport.php");
 
+//check for absolute url 
+if (defined("MAPBENDER_PATH") && MAPBENDER_PATH != '') { 
+	$mapbenderUrl = MAPBENDER_PATH;
+} else {
+	if(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='off')  {
+		$mapbenderUrl = "https://".$_SERVER['HTTP_HOST']."/mapbender";
+		$protocol = "https";
+	} else {
+		$mapbenderUrl = "http://".$_SERVER['HTTP_HOST']."/mapbender";
+		$protocol = "http";
+	}
+}
+
 $con = db_connect(DBSERVER,OWNER,PW);
 db_select_db(DB,$con);
 
@@ -94,6 +107,7 @@
 function fillISO19139($iso19139, $recordId) {
         global $wmsView;
 	global $admin;
+	global $mapbenderUrl;
 	//read out relevant information from mapbender database:
 	if ($wmsView != '') {
 		$sql = "SELECT * ";
@@ -462,11 +476,11 @@
 		$MD_BrowseGraphic=$iso19139->createElement("gmd:MD_BrowseGraphic");
 		$fileName=$iso19139->createElement("gmd:fileName");
 		$fileName_cs=$iso19139->createElement("gco:CharacterString");
-		if (defined("MAPBENDER_PATH") && MAPBENDER_PATH != '') { 
+		/*if (defined("MAPBENDER_PATH") && MAPBENDER_PATH != '') { 
 			$mapbenderUrl = MAPBENDER_PATH;
 		} else {
 			$mapbenderUrl = "http://www.geoportal.rlp.de/mapbender";
-		}
+		}*/
 		$previewFilenameText = $iso19139->createTextNode($mapbenderUrl."/geoportal/preview/".$mapbenderMetadata['layer_id']."_layer_map_preview.jpg"); //TODO use constant for absolute path
 		$fileName_cs->appendChild($previewFilenameText);
 		$fileName->appendChild($fileName_cs);
@@ -707,7 +721,7 @@
 
 	//Check if anonymous user has rights to access this layer - if not ? which resource should be advertised? TODO
 	//if ($hasPermission) {
-		$gmd_URLText=$iso19139->createTextNode("http://".$_SERVER['HTTP_HOST']."/mapbender/php/wms.php?inspire=1&layer_id=".$mapbenderMetadata['layer_id']."&REQUEST=GetCapabilities&SERVICE=WMS");
+		$gmd_URLText=$iso19139->createTextNode($mapbenderUrl."/php/wms.php?inspire=1&layer_id=".$mapbenderMetadata['layer_id']."&withChilds=1&REQUEST=GetCapabilities&SERVICE=WMS");
 	//}
 	/*else {
 		$serverWithOutPort80 = str_replace(":80","",$_SERVER['HTTP_HOST']);//fix problem when metadata is generated thru curl invocations
@@ -738,19 +752,19 @@
 		switch ($row_metadata['origin']) {
 			case 'capabilities':
 				$operatesOn=$iso19139->createElement("srv:operatesOn");
-				$operatesOn->setAttribute("xlink:href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row_metadata['uuid']);
+				$operatesOn->setAttribute("xlink:href", $mapbenderUrl."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row_metadata['uuid']);
 				$operatesOn->setAttribute("uuidref", $uniqueResourceIdentifierCodespace.$row_metadata['datasetid']);
 				$SV_ServiceIdentification->appendChild($operatesOn);
 			break;
 			case 'metador':
 				$operatesOn=$iso19139->createElement("srv:operatesOn");
-				$operatesOn->setAttribute("xlink:href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row_metadata['uuid'].'#spatial_dataset_'.md5($row_metadata['uuid']));
+				$operatesOn->setAttribute("xlink:href", $mapbenderUrl."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row_metadata['uuid'].'#spatial_dataset_'.md5($row_metadata['uuid']));
 				$operatesOn->setAttribute("uuidref", $uniqueResourceIdentifierCodespace.$row_metadata['uuid']);
 				$SV_ServiceIdentification->appendChild($operatesOn);
 			break;
 			case 'external':
 				$operatesOn=$iso19139->createElement("srv:operatesOn");
-				$operatesOn->setAttribute("xlink:href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row_metadata['uuid']);
+				$operatesOn->setAttribute("xlink:href", $mapbenderUrl."/php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row_metadata['uuid']);
 				$operatesOn->setAttribute("uuidref", $uniqueResourceIdentifierCodespace.$row_metadata['datasetid']);
 				$SV_ServiceIdentification->appendChild($operatesOn);
 			break;
@@ -786,10 +800,10 @@
 
 	//Check if anonymous user has rights to access this layer - if not ? which resource should be advertised? TODO
 	if ($hasPermission) {
-		$gmd_URLText=$iso19139->createTextNode("http://".$_SERVER['HTTP_HOST']."/mapbender/php/wms.php?inspire=1&layer_id=".$mapbenderMetadata['layer_id']."&REQUEST=GetCapabilities&SERVICE=WMS");
+		$gmd_URLText=$iso19139->createTextNode($mapbenderUrl."/php/wms.php?inspire=1&layer_id=".$mapbenderMetadata['layer_id']."&withChilds=1&REQUEST=GetCapabilities&SERVICE=WMS");
 	}
 	else {
-		$gmd_URLText=$iso19139->createTextNode("https://".$_SERVER['HTTP_HOST']."/http_auth/".$mapbenderMetadata['layer_id']."?REQUEST=GetCapabilities&SERVICE=WMS");
+		$gmd_URLText=$iso19139->createTextNode("https://".$_SERVER['HTTP_HOST']."/http_auth/".$mapbenderMetadata['layer_id']."?withChilds=1&REQUEST=GetCapabilities&SERVICE=WMS");
 	}
 	$gmd_URL->appendChild($gmd_URLText);
 	$gmd_linkage->appendChild($gmd_URL);



More information about the Mapbender_commits mailing list