[Mapbender-commits] r8236 - trunk/mapbender/http/geoportal
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jan 26 10:05:49 EST 2012
Author: armin11
Date: 2012-01-26 07:05:49 -0800 (Thu, 26 Jan 2012)
New Revision: 8236
Modified:
trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php
Log:
Bugfix to open cap urls from portalu opensearch interface.
Modified: trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php 2012-01-23 08:32:08 UTC (rev 8235)
+++ trunk/mapbender/http/geoportal/mod_readOpenSearchResults.php 2012-01-26 15:05:49 UTC (rev 8236)
@@ -454,13 +454,42 @@
}
}
function correctWmsUrl($wms_url) {
- $findme1 = "VERSION=";
- $findme2 = "version=";
- $pos1 = strpos($wms_url, $findme1);
- $pos2 = strpos($wms_url, $findme2);
- if ($pos1 === false && $pos2 === false) {
- $wms_url .= "&VERSION=1.1.1";
+ //check if last sign is ? or & or none of them
+ $lastChar = substr($wms_url,-1);
+ //check if getcapabilities is set as a parameter
+ $findme = "getcapabilities";
+ $posGetCap = strpos(strtolower($wms_url), $findme);
+ if ($posGetCap === false) {
+ $posGetAmp = strpos(strtolower($wms_url), "?");
+ if ($posGetAmp === false) {
+ $wms_url .= "?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS";
+ } else {
+ switch ($lastChar) {
+ case "?":
+ $wms_url .= "REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS";
+ break;
+ case "&":
+ $wms_url .= "REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS";
+ break;
+ default:
+ $wms_url .= "&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS";
+ break;
+ }
+ }
+ } else {
+ //check if version is defined
+ $findme1 = "version=";
+ $posVersion = strpos(strtolower($wms_url), $findme1);
+ if ($posVersion === false) {
+ $wms_url .= "&VERSION=1.1.1";
+ } else {
+ //mapbender only handle 1.1.1
+ $wms_url = str_replace('version=1.3.0', 'VERSION=1.1.1', $wms_url);
+ $wms_url = str_replace('VERSION=1.3.0', 'VERSION=1.1.1', $wms_url);
+ }
+
}
+
//exchange &? with & and &
$wms_url = str_replace('&?', '&', $wms_url);
$wms_url = str_replace('&?', '&', $wms_url);
More information about the Mapbender_commits
mailing list