svn commit: r130 - trunk/mapbender/http/php/mod_monitorCapabilities.php
arnulf at osgeo.org
arnulf at osgeo.org
Sun Apr 23 06:02:20 EDT 2006
Author: arnulf
Date: 2006-04-23 10:02:20+0000
New Revision: 130
Modified:
trunk/mapbender/http/php/mod_monitorCapabilities.php (contents, props changed)
Log:
cleaned, added SVN headers (this is still beta)
Modified: trunk/mapbender/http/php/mod_monitorCapabilities.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_monitorCapabilities.php?view=diff&rev=130&p1=trunk/mapbender/http/php/mod_monitorCapabilities.php&p2=trunk/mapbender/http/php/mod_monitorCapabilities.php&r1=129&r2=130
==============================================================================
--- trunk/mapbender/http/php/mod_monitorCapabilities.php (original)
+++ trunk/mapbender/http/php/mod_monitorCapabilities.php 2006-04-23 10:02:20+0000
@@ -1,4 +1,6 @@
<?php
+# $Id$
+# http://www.mapbender.org/index.php/Monitor_Capabilities
# Copyright (C) 2002 CCGIS
#
# This program is free software; you can redistribute it and/or modify
@@ -15,7 +17,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
require_once("../php/mb_validateSession.php");
require_once("../../conf/mapbender.conf");
import_request_variables("PG");
@@ -48,53 +49,38 @@
//$remoteXml = implode("", file($someUrl));
//echo $remoteXml;
-
-function fetchUrlWithoutHanging($url)
- {
- // Set maximum number of seconds (can have floating-point) to wait for feed before displaying page without feed
- $numberOfSeconds=4;
-
- // Suppress error reporting so Web site visitors are unaware if the feed fails
- error_reporting(0);
-
- // Extract resource path and domain from URL ready for fsockopen
-
- $url = str_replace("http://","",$url);
- $urlComponents = explode("/",$url);
- $domain = $urlComponents[0];
- $resourcePath = str_replace($domain,"",$url);
-
- // Establish a connection
- $socketConnection = fsockopen($domain, 80, $errno, $errstr, $numberOfSeconds);
-
- if (!$socketConnection)
- {
- // You may wish to remove the following debugging line on a live Web site
- print("<!-- Network error: $errstr ($errno) -->");
- } // end if
- else {
- $xml = '';
- fputs($socketConnection, "GET /$resourcePath HTTP/1.0\r\nHost: $domain\r\n\r\n");
-
- // Loop until end of file
- while (!feof($socketConnection))
- {
- $xml .= fgets($socketConnection, 128);
- } // end while
-
- fclose ($socketConnection);
-
- } // end else
-
- return($xml);
-
- } // end function
+function fetchUrlWithoutHanging($url){
+ // Set maximum number of seconds to wait for feed before displaying page without feed
+ $numberOfSeconds=4;
+ // Suppress error reporting so Web site visitors are unaware if the feed fails
+ error_reporting(0);
+ // Extract resource path and domain from URL ready for fsockopen
+ $url = str_replace("http://","",$url);
+ $urlComponents = explode("/",$url);
+ $domain = $urlComponents[0];
+ $resourcePath = str_replace($domain,"",$url);
+ // Establish a connection
+ $socketConnection = fsockopen($domain, 80, $errno, $errstr, $numberOfSeconds);
+ if (!$socketConnection) {
+ // You may wish to remove the following debugging line on a live Web site
+ print("<!-- Network error: $errstr ($errno) -->");
+ } // end if
+ else {
+ $xml = '';
+ fputs($socketConnection, "GET /$resourcePath HTTP/1.0\r\nHost: $domain\r\n\r\n");
+ // Loop until end of file
+ while (!feof($socketConnection)){
+ $xml .= fgets($socketConnection, 128);
+ } // end while
+ fclose ($socketConnection);
+ } // end else
+ return($xml);
+} // end function
//for ($k=0; $k<count($wms_id_own) && 0 == 1; $k++) {
echo "<table cellspacing=10 cellpadding = 8 border = 1>";
for ($k=0; $k<count($wms_id_own); $k++) {
$wmsId = $wms_id_own[$k];
-
echo "<tr><td><b>Processing WMS Id </b>" . $wmsId . "<br>";
// get the wms version, capabilities, capabilities_doc
$sql = "SELECT wms_version, wms_getcapabilities, wms_getcapabilities_doc FROM wms WHERE wms_id = '" . $wmsId . "'";
@@ -109,7 +95,7 @@
$myURL = $capabilities . "REQUEST=GetCapabilities&SERVICE=wms&VERSION=" . $version;
}
elseif ($version == "1.0.0" ) {
- $myURL = $capabilities . "REQUEST=capabilities&WMTVER=1.0.0";
+ $myURL = $capabilities . "REQUEST=capabilities&WMTVER=1.0.0";
}
else {
echo "Unknown wms version '" . $version . "'! No update possible.</td><td><img src ='../img/trafficlights/stop.bmp'></td></tr>";
@@ -120,20 +106,16 @@
$localXml = $capabilities_doc;
set_time_limit(30);
$remoteXml = implode("", file($myURL));
-
$localXmlArray = explode("\n", $localXml);
$remoteXmlArray = explode("\n", $remoteXml);
-
-
for ($i=0; $i<count($localXmlArray); $i++) {
$localXmlArray[$i] = trim(htmlentities($localXmlArray[$i]));
- }
+ }
for ($i=0; $i<count($remoteXmlArray); $i++) {
$remoteXmlArray[$i] = trim(htmlentities($remoteXmlArray[$i]));
- }
-
- //print_r($localXmlArray);
- //print_r($remoteXmlArray);
+ }
+ //print_r($localXmlArray);
+ //print_r($remoteXmlArray);
if (!$remoteXml) {
$result = -1;
// echo "Can't connect to " . $myURL . "</td><td><img src ='../img/trafficlights/stop.bmp'></td></tr>";
@@ -151,8 +133,6 @@
$result = 0;
}
}
-
-
if ($result == 0) {
echo "Updating WMS " . $wmsId . "...</td><td><img src ='../img/trafficlights/wait.bmp'></td></tr>";
# $mywms = new wms();
@@ -160,13 +140,10 @@
# $mywms->optimizeWMS();
# $mywms->updateObjInDB($wmsId);
}
-
}
-
}
echo "</table>";
echo "<br><br>done!";
-
?>
</body>
</html>
\ No newline at end of file
More information about the Mapbender_commits
mailing list