[Mapbender-commits] r7459 - in trunk/mapbender/http: javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jan 20 02:05:49 EST 2011
Author: armin11
Date: 2011-01-19 23:05:48 -0800 (Wed, 19 Jan 2011)
New Revision: 7459
Modified:
trunk/mapbender/http/javascripts/initWmcObj.php
trunk/mapbender/http/php/mod_getWmcDisclaimer.php
trunk/mapbender/http/php/mod_showMetadata.php
Log:
Some changes to fix the problem under ms windows with file_get_contents and local webservices
Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php 2011-01-19 12:47:11 UTC (rev 7458)
+++ trunk/mapbender/http/javascripts/initWmcObj.php 2011-01-20 07:05:48 UTC (rev 7459)
@@ -420,7 +420,23 @@
$resultOfCheck = $classTou->check('wms',$WMS['id']);
if ($resultOfCheck['accepted'] == 0) {
$tou .= $resourceSymbol." <a href='../php/mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."' target='_blank'>".$WMS['title']."</a><br>";
- $touServiceConnector = new connector("http://localhost".$_SERVER['SCRIPT_NAME']."/../../php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
+
+ if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
+ $mapbenderProtocol = "https://";
+ $mapbenderBaseUrl = "https://".$hostName;
+ }
+ else {
+ $mapbenderProtocol = "http://";
+ $mapbenderBaseUrl = "http://".$hostName;
+ }
+
+
+
+
+
+
+
+ $touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../../php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
$tou .= $touServiceConnector->file;
//set the tou to be accepted - TODO maybe do this after the button which deletes the message window - from a ajax request.
$classTou->set('wms',$WMS['id']);
Modified: trunk/mapbender/http/php/mod_getWmcDisclaimer.php
===================================================================
--- trunk/mapbender/http/php/mod_getWmcDisclaimer.php 2011-01-19 12:47:11 UTC (rev 7458)
+++ trunk/mapbender/http/php/mod_getWmcDisclaimer.php 2011-01-20 07:05:48 UTC (rev 7459)
@@ -2,6 +2,7 @@
require_once(dirname(__FILE__)."/../classes/class_json.php");
require_once dirname(__FILE__) . "/../classes/class_wmc_factory.php";
require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__)."/../classes/class_connector.php");
//following is needed cause sometimes the service is invoked as a localhost service and then no userId is known but the userId in the session is needed for class_wmc to read from database!!! TODO: check if needed in this class.
$userId = Mapbender::session()->get("mb_user_id");
@@ -93,9 +94,22 @@
$resourceSymbol = "<img src='../img/osgeo_graphics/geosilk/server_map.png' alt='".$translation['wms']." - picture' title='".$translation['wms']."'>";
//read out all wms id's
$validWMS = $wmcObj->getValidWms();
+if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
+ $mapbenderBaseUrl = "https://".$hostName;
+ $mapbenderProtocol = "https://";
+ }
+ else {
+ $mapbenderBaseUrl = "http://".$hostName;
+ $mapbenderProtocol = "http://";
+}
+
foreach($validWMS as $WMS) {
- echo $resourceSymbol." <a href='http://".$hostName."/mapbender/php/mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."'>".$WMS['title']."</a><br>";
- $wmstou = file_get_contents("http://localhost/mapbender/php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
+
+ echo $resourceSymbol." <a href='".$mapbenderBaseUrl.$_SERVER['SCRIPT_NAME']."/../php/mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."'>".$WMS['title']."</a><br>";
+
+ $touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
+ $wmstou .= $touServiceConnector->file;
+ #$wmstou = file_get_contents("http://localhost/mapbender/php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
echo $wmstou."<br>";
}
//var_dump($validWMS);
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2011-01-19 12:47:11 UTC (rev 7458)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2011-01-20 07:05:48 UTC (rev 7459)
@@ -18,6 +18,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
+require_once dirname(__FILE__)."/../classes/class_connector.php";
require_once dirname(__FILE__) . "/../classes/class_user.php";
require_once dirname(__FILE__) . "/../../tools/wms_extent/extent_service.conf";
@@ -92,8 +93,18 @@
}
$subscribe = intval($_GET["subscribe"]);
+$hostName = $_SERVER['HTTP_HOST'];
+if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
+ $mapbenderBaseUrl = "https://".$hostName;
+ $mapbenderProtocol = "https://";
+ }
+ else {
+ $mapbenderBaseUrl = "http://".$hostName;
+ $mapbenderProtocol = "http://";
+}
+
//Array with translations:
switch ($languageCode) {
case "de":
@@ -467,10 +478,10 @@
$rowP = db_fetch_array($resP);
if ($rowP['layer_map_preview_filename'] != "") {
//$resourceMetadata['preview'] = "<img src = '".PREVIEW_DIR."/".$rowP['layer_map_preview_filename']."'>";
- $resourceMetadata['preview'] = "<img src = 'http://".$_SERVER['HTTP_HOST']."/mapbender/geoportal/mod_showPreview.php?resource=layer&id=".$layerId."'>";
+ $resourceMetadata['preview'] = "<img src = '".$mapbenderBaseUrl.$_SERVER['SCRIPT_NAME']."/../../geoportal/mod_showPreview.php?resource=layer&id=".$layerId."'>";
}
if ($rowP['layer_legend_preview_filename'] != "") {
- $resourceMetadata['legend'] .= "<img src = 'http://".$_SERVER['HTTP_HOST']."/mapbender/geoportal/mod_showPreview.php?resource=layerlegend&id=".$layerId."'>";
+ $resourceMetadata['legend'] .= "<img src = '".$mapbenderBaseUrl.$_SERVER['SCRIPT_NAME']."/../../geoportal/mod_showPreview.php?resource=layerlegend&id=".$layerId."'>";
}
/* if ($rowP['layer_extent_preview_filename'] != "") {
$resourceMetadata['extent'] .= "<img src = '../x_geoportal/layer_preview/".$rowP['layer_extent_preview_filename']."'>";
@@ -478,7 +489,7 @@
}
if ($resource == 'wmc') {
- $resourceMetadata['preview'] = "<img src = 'http://".$_SERVER['HTTP_HOST']."/mapbender/geoportal/mod_showPreview.php?resource=wmc&id=".$resourceMetadata['contentid']."'>";
+ $resourceMetadata['preview'] = "<img src = '".$mapbenderBaseUrl.$_SERVER['SCRIPT_NAME']."/../../geoportal/mod_showPreview.php?resource=wmc&id=".$resourceMetadata['contentid']."'>";
}
//db select for service quality
if ($resource == 'wms' or $resource == 'layer') {
@@ -879,11 +890,13 @@
}
$html .= '<p>';
if ($resource == 'wms' or $resource == 'layer') {
- $tou = file_get_contents("http://localhost/mapbender/php/mod_getServiceDisclaimer.php?type=".$serviceType."&id=".$serviceId."&languageCode=".$languageCode."&asTable=true");
+ $touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../../php/mod_getServiceDisclaimer.php?resource=wms&id=".$resourceMetadata['serviceid']."&languageCode=".$languageCode."&asTable=true");
+ $tou .= $touServiceConnector->file;
}
if ($resource == 'wmc' ) {
$e = new mb_exception("mod_showMetadata: wmcid for disclaimer: ".$resourceMetadata['contentid']);
- $tou = file_get_contents("http://localhost/mapbender/php/mod_getWmcDisclaimer.php?&id=".$resourceMetadata['contentid']."&languageCode=".$languageCode."&hostName=".$_SERVER['HTTP_HOST']);
+ $touWmcConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../../php/mod_getWmcDisclaimer.php?&id=".$resourceMetadata['contentid']."&languageCode=".$languageCode."&hostName=".$hostName);
+ $tou .= $touWmcConnector->file;
}
$html .= $tou;
More information about the Mapbender_commits
mailing list