[Mapbender-commits] r4524 - branches/2.5/owsproxy/http branches/2.6/owsproxy/http trunk/mapbender/owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Aug 14 03:23:16 EDT 2009


Author: christoph
Date: 2009-08-14 03:23:15 -0400 (Fri, 14 Aug 2009)
New Revision: 4524

Modified:
   branches/2.5/owsproxy/http/index.php
   branches/2.6/owsproxy/http/index.php
   trunk/mapbender/owsproxy/http/index.php
Log:
http://trac.osgeo.org/mapbender/ticket/509

Modified: branches/2.5/owsproxy/http/index.php
===================================================================
--- branches/2.5/owsproxy/http/index.php	2009-08-13 22:37:39 UTC (rev 4523)
+++ branches/2.5/owsproxy/http/index.php	2009-08-14 07:23:15 UTC (rev 4524)
@@ -393,7 +393,7 @@
 function getCapabilities($url){
         global $arrayOnlineresources;
         global $sid,$wms;
-        $t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["$wms_getfeatureinfo"]));
+        $t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["wms_getfeatureinfo"]));
         $new = OWSPROXY ."/". $sid ."/".$wms."?";
         $r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
         header("Content-Type: application/xml");

Modified: branches/2.6/owsproxy/http/index.php
===================================================================
--- branches/2.6/owsproxy/http/index.php	2009-08-13 22:37:39 UTC (rev 4523)
+++ branches/2.6/owsproxy/http/index.php	2009-08-14 07:23:15 UTC (rev 4524)
@@ -1,106 +1,106 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Owsproxy
-# Module maintainer Uli
-# Copyright (C) 2002 CCGIS 
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require(dirname(__FILE__) . "/../../conf/mapbender.conf");
-require(dirname(__FILE__) . "/../../http/classes/class_administration.php");
-require(dirname(__FILE__) . "/../../http/classes/class_connector.php");
-require_once(dirname(__FILE__) . "/../../http/classes/class_mb_exception.php");
-require(dirname(__FILE__) . "/./classes/class_QueryHandler.php");
-
-/***** conf *****/
-$imageformats = array("image/png","image/gif","image/jpeg", "image/jpg");
-/***** conf *****/
-
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Owsproxy
+# Module maintainer Uli
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-$postdata = $HTTP_RAW_POST_DATA;
-
-$owsproxyService = $_REQUEST['wms']; //ToDo: change this to 'service' in the apache url-rewriting
-$query = new QueryHandler();
-
-// an array with keys and values toLoserCase -> caseinsensitiv
-$reqParams = $query->getRequestParams();
-
-$notice = new mb_notice("owsproxy id:".$query->getOwsproxyServiceId());
+require(dirname(__FILE__) . "/../../conf/mapbender.conf");
+require(dirname(__FILE__) . "/../../http/classes/class_administration.php");
+require(dirname(__FILE__) . "/../../http/classes/class_connector.php");
+require_once(dirname(__FILE__) . "/../../http/classes/class_mb_exception.php");
+require(dirname(__FILE__) . "/./classes/class_QueryHandler.php");
 
-// check session
-session_regenerate_id();
-session_destroy();
-session_id($_REQUEST["sid"]);
-session_start();
-if(!$_SESSION['mb_user_id']){
-	$notice = new mb_notice("Permission denied");
+/***** conf *****/
+$imageformats = array("image/png","image/gif","image/jpeg", "image/jpg");
+/***** conf *****/
+
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$postdata = $HTTP_RAW_POST_DATA;
+
+$owsproxyService = $_REQUEST['wms']; //ToDo: change this to 'service' in the apache url-rewriting
+$query = new QueryHandler();
+
+// an array with keys and values toLoserCase -> caseinsensitiv
+$reqParams = $query->getRequestParams();
+
+$notice = new mb_notice("owsproxy id:".$query->getOwsproxyServiceId());
+
+// check session
+session_regenerate_id();
+session_destroy();
+session_id($_REQUEST["sid"]);
+session_start();
+if(!$_SESSION['mb_user_id']){
+	$notice = new mb_notice("Permission denied");
 	throwE("Permission denied");
-	die();
-}
-
-//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
-//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
-//	die();	
-//}
-
-/*************  workflow ************/
+	die();
+}
+
+//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
+//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
+//	die();	
+//}
+
+/*************  workflow ************/
 $n = new administration();
-switch (strtolower($reqParams['request'])) {
-	case 'getcapabilities':
-		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
-		$query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
-		$request = $query->getRequest();
-		getCapabilities($request);
-		break;
-	case 'getfeatureinfo':
-		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
-		$query->setOnlineResource($arrayOnlineresources['wms_getfeatureinfo']);
-		$request = $query->getRequest();
-		getFeatureInfo($request);
-		break;
-	case 'getmap':
-		$arrayOnlineresources = checkWmsPermission($owsproxyService);
-		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
-		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
+switch (strtolower($reqParams['request'])) {
+	case 'getcapabilities':
+		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
+		$query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
+		$request = $query->getRequest();
+		getCapabilities($request);
+		break;
+	case 'getfeatureinfo':
+		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
+		$query->setOnlineResource($arrayOnlineresources['wms_getfeatureinfo']);
+		$request = $query->getRequest();
+		getFeatureInfo($request);
+		break;
+	case 'getmap':
+		$arrayOnlineresources = checkWmsPermission($owsproxyService);
+		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
+		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
 		if($layers===""){
 			throwE("Permission denied");
 			die();
 		}
-		$query->setParam("layers",$layers);
-		$request = $query->getRequest();
+		$query->setParam("layers",$layers);
+		$request = $query->getRequest();
 		getImage($request);
-		break;
-	case 'map':
-		$arrayOnlineresources = checkWmsPermission($owsproxyService);
-		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
-		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
-		if($layers===""){
-			throwE("Permission denied");
-			die();
-		}
-		$query->setParam("layers",$layers);
-		$request = $query->getRequest();
-		getImage($request);
+		break;
+	case 'map':
+		$arrayOnlineresources = checkWmsPermission($owsproxyService);
+		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
+		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
+		if($layers===""){
+			throwE("Permission denied");
+			die();
+		}
+		$query->setParam("layers",$layers);
+		$request = $query->getRequest();
+		getImage($request);
 		break;	
 	case 'getlegendgraphic':
 		$url = getLegendUrl($query->getOwsproxyServiceId());
 		getImage($url);
-		break;
-	case 'external':
+		break;
+	case 'external':
 		getExternalRequest($query->getOwsproxyServiceId());
 		break; 
 	case 'getfeature':
@@ -119,84 +119,84 @@
 		$request = $query->getRequest();
 		doTransaction($request, $HTTP_RAW_POST_DATA);
 		break;
-	default:
-		
-}
-/*********************************************************/
-function throwE($e){
-	global $reqParams, $imageformats;
-	if(in_array($reqParams['format'],$imageformats)){
-		throwImage($e);
-	}
-	else{
-		throwText($e);	
-	}
+	default:
+		
 }
-
-function throwImage($e){
-	global $width,$height;
-	$image = imagecreate($width,$height);
-	$transparent = ImageColorAllocate($image,155,155,155); 
-	ImageFilledRectangle($image,0,0,$width,$height,$transparent);
-	imagecolortransparent($image, $transparent);
-	$text_color = ImageColorAllocate ($image, 233, 14, 91);
-	for($i=0; $i<count($e); $i++){
-		ImageString ($image, 3, 5, $i*20, $e[$i], $text_color);
-	}
-	responseImage($image);
-}
-function throwText($e){
-	echo join(" ", $e);
-}
-function responseImage($im){
-	global $reqParams;
-	$format = $reqParams['format'];
-	if($format == 'image/png'){header("Content-Type: image/png");}
-	if($format == 'image/jpeg' || $format == 'image/jpg'){header("Content-Type: image/jpeg");}
-	if($format == 'image/gif'){header("Content-Type: image/gif");}
-		 
-	if($format == 'image/png'){imagepng($im);}
-	if($format == 'image/jpeg' || $format == 'image/jpg'){imagejpeg($im);}
-	if($format == 'image/gif'){imagegif($im);}	
-}
-function completeURL($url){
-	global $reqParams;
-	$mykeys = array_keys($reqParams);
-	for($i=0; $i<count($mykeys);$i++){
-		if($i > 0){ $url .= "&"; }
-		$url .= $mykeys[$i]."=".urlencode($reqParams[$mykeys[$i]]);
-	}
-	return $url;
-}
+/*********************************************************/
+function throwE($e){
+	global $reqParams, $imageformats;
+	if(in_array($reqParams['format'],$imageformats)){
+		throwImage($e);
+	}
+	else{
+		throwText($e);	
+	}
+}
 
+function throwImage($e){
+	global $width,$height;
+	$image = imagecreate($width,$height);
+	$transparent = ImageColorAllocate($image,155,155,155); 
+	ImageFilledRectangle($image,0,0,$width,$height,$transparent);
+	imagecolortransparent($image, $transparent);
+	$text_color = ImageColorAllocate ($image, 233, 14, 91);
+	for($i=0; $i<count($e); $i++){
+		ImageString ($image, 3, 5, $i*20, $e[$i], $text_color);
+	}
+	responseImage($image);
+}
+function throwText($e){
+	echo join(" ", $e);
+}
+function responseImage($im){
+	global $reqParams;
+	$format = $reqParams['format'];
+	if($format == 'image/png'){header("Content-Type: image/png");}
+	if($format == 'image/jpeg' || $format == 'image/jpg'){header("Content-Type: image/jpeg");}
+	if($format == 'image/gif'){header("Content-Type: image/gif");}
+		 
+	if($format == 'image/png'){imagepng($im);}
+	if($format == 'image/jpeg' || $format == 'image/jpg'){imagejpeg($im);}
+	if($format == 'image/gif'){imagegif($im);}	
+}
+function completeURL($url){
+	global $reqParams;
+	$mykeys = array_keys($reqParams);
+	for($i=0; $i<count($mykeys);$i++){
+		if($i > 0){ $url .= "&"; }
+		$url .= $mykeys[$i]."=".urlencode($reqParams[$mykeys[$i]]);
+	}
+	return $url;
+}
+
 /**
  * fetch and returns an image to client
  * 
  * @param string the original url of the image to send
  */
-
-function getImage($or){
-	global $reqParams;
-	header("Content-Type: ".$reqParams['format']);
-	echo getDocumentContent($or);
-}
-
-/**
- * fetchs and returns the content of the FeatureInfo Response
- * 
- * @param string the url of the FeatureInfoRequest
- * @return string the content of the FeatureInfo document
- */
-function getFeatureInfo($url){
-	global $info_format;
-	//$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
-	header("Content-Type: ".$info_format);
-	$content = getDocumentContent($url);
-	$content = matchUrls($content);
-	echo $content;
+
+function getImage($or){
+	global $reqParams;
+	header("Content-Type: ".$reqParams['format']);
+	echo getDocumentContent($or);
 }
 
 /**
+ * fetchs and returns the content of the FeatureInfo Response
+ * 
+ * @param string the url of the FeatureInfoRequest
+ * @return string the content of the FeatureInfo document
+ */
+function getFeatureInfo($url){
+	global $info_format;
+	//$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
+	header("Content-Type: ".$info_format);
+	$content = getDocumentContent($url);
+	$content = matchUrls($content);
+	echo $content;
+}
+
+/**
  * fetchs and returns the content of WFS GetFeature response
  * 
  * @param string the url of the GetFeature request
@@ -246,6 +246,10 @@
  */
 
 function getWfsFeaturesFromTransaction($data){
+	new mb_notice("owsproxy.getWfsFeaturesFromTransaction.data: ".$data);
+	if(!$data || $data == ""){
+		return false;
+	}
 	$features = array();
 	$values = NULL;
 	$tags = NULL;
@@ -311,95 +315,95 @@
 	$result = mb_eregi_replace("[^>]*$", "", $result);
 	
 	echo $result;
-}
-
-function matchUrls($content){
-	if(!session_is_registered("owsproxyUrls")){
-		$_SESSION["owsproxyUrls"] = array();
-		$_SESSION["owsproxyUrls"]["id"] = array();
-		$_SESSION["owsproxyUrls"]["url"] = array();
-	}
-	$pattern = "/[\"|\'](https*:\/\/[^\"|^\']*)[\"|\']/";
-	preg_match_all($pattern,$content,$matches);
-	for($i=0; $i<count($matches[1]); $i++){
-		$req = $matches[1][$i];
-		$id = registerURL($req);
-		$extReq = setExternalRequest($id);
-		$content = str_replace($req,$extReq,$content);
-	}
-	return $content;
 }
-
-function setExternalRequest($id){
-	global $reqParams,$query;
-	$extReq = OWSPROXY ."/". $reqParams['sid'] ."/".$id."?request=external";
-	return $extReq;
-}
-function getExternalRequest($id){
-	for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
-		if($id == $_SESSION["owsproxyUrls"]["id"][$i]){
-			$cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
-			$query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
-			if($query_string != ''){
-				$cUrl .= getConjunctionCharacter($cUrl).$query_string;
-			}	
-			$metainfo = get_headers($cUrl,1);
-			// just for the stupid InternetExplorer
-			header('Pragma: private');
-			header('Cache-control: private, must-revalidate');
-			
-			header("Content-Type: ".$metainfo['Content-Type']);
-			
-			$content = getDocumentContent($cUrl);
-			$content = matchUrls($content);			
-			echo $content; 
-		}	
-	} 
-}
-function removeOWSGetParams($query_string){
-	$r = preg_replace("/.*request=external&/","",$query_string);
-	return $r;
-}
-function getConjunctionCharacter($url){
-	if(strpos($url,"?")){ 
-		if(strpos($url,"?") == strlen($url)){ 
-			$cchar = "";
-		}else if(strpos($url,"&") == strlen($url)){
-			$cchar = "";
-		}else{
-			$cchar = "&";
-		}
-	}
-	if(strpos($url,"?") === false){
-		$cchar = "?";
-	} 
-	return $cchar;  
-}
-function registerUrl($url){	
-	if(!in_array($url,$_SESSION["owsproxyUrls"]["url"])){
-		$id = md5($url);
-		array_push($_SESSION["owsproxyUrls"]["url"],$url);
-		array_push($_SESSION["owsproxyUrls"]["id"], $id);
-	}
-	else{
-		for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
-			if($url == $_SESSION["owsproxyUrls"]["url"][$i]){
-				$id = $_SESSION["owsproxyUrls"]["id"][$i];
-			}			
-		}
-	}
-	return $id;
-}
-function getCapabilities($url){
-	global $arrayOnlineresources;
-	global $sid,$wms;
-	$t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["$wms_getfeatureinfo"]));
-	$new = OWSPROXY ."/". $sid ."/".$wms."?";
-	$r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
-	header("Content-Type: application/xml");
-	echo $r;
+
+function matchUrls($content){
+	if(!session_is_registered("owsproxyUrls")){
+		$_SESSION["owsproxyUrls"] = array();
+		$_SESSION["owsproxyUrls"]["id"] = array();
+		$_SESSION["owsproxyUrls"]["url"] = array();
+	}
+	$pattern = "/[\"|\'](https*:\/\/[^\"|^\']*)[\"|\']/";
+	preg_match_all($pattern,$content,$matches);
+	for($i=0; $i<count($matches[1]); $i++){
+		$req = $matches[1][$i];
+		$id = registerURL($req);
+		$extReq = setExternalRequest($id);
+		$content = str_replace($req,$extReq,$content);
+	}
+	return $content;
 }
 
+function setExternalRequest($id){
+	global $reqParams,$query;
+	$extReq = OWSPROXY ."/". $reqParams['sid'] ."/".$id."?request=external";
+	return $extReq;
+}
+function getExternalRequest($id){
+	for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
+		if($id == $_SESSION["owsproxyUrls"]["id"][$i]){
+			$cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
+			$query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
+			if($query_string != ''){
+				$cUrl .= getConjunctionCharacter($cUrl).$query_string;
+			}	
+			$metainfo = get_headers($cUrl,1);
+			// just for the stupid InternetExplorer
+			header('Pragma: private');
+			header('Cache-control: private, must-revalidate');
+			
+			header("Content-Type: ".$metainfo['Content-Type']);
+			
+			$content = getDocumentContent($cUrl);
+			$content = matchUrls($content);			
+			echo $content; 
+		}	
+	} 
+}
+function removeOWSGetParams($query_string){
+	$r = preg_replace("/.*request=external&/","",$query_string);
+	return $r;
+}
+function getConjunctionCharacter($url){
+	if(strpos($url,"?")){ 
+		if(strpos($url,"?") == strlen($url)){ 
+			$cchar = "";
+		}else if(strpos($url,"&") == strlen($url)){
+			$cchar = "";
+		}else{
+			$cchar = "&";
+		}
+	}
+	if(strpos($url,"?") === false){
+		$cchar = "?";
+	} 
+	return $cchar;  
+}
+function registerUrl($url){	
+	if(!in_array($url,$_SESSION["owsproxyUrls"]["url"])){
+		$id = md5($url);
+		array_push($_SESSION["owsproxyUrls"]["url"],$url);
+		array_push($_SESSION["owsproxyUrls"]["id"], $id);
+	}
+	else{
+		for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
+			if($url == $_SESSION["owsproxyUrls"]["url"][$i]){
+				$id = $_SESSION["owsproxyUrls"]["id"][$i];
+			}			
+		}
+	}
+	return $id;
+}
+function getCapabilities($url){
+	global $arrayOnlineresources;
+	global $sid,$wms;
+	$t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["wms_getfeatureinfo"]));
+	$new = OWSPROXY ."/". $sid ."/".$wms."?";
+	$r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
+	header("Content-Type: application/xml");
+	echo $r;
+}
+
 /**
  * gets the original url of the requested legend graphic
  * 
@@ -444,34 +448,34 @@
  * 
  * @param string OWSPROXY md5
  * @return array array with detailed information about requested wms
- */
-function checkWmsPermission($wms){
+ */
+function checkWmsPermission($wms){
 	global $con, $n;
-	$myguis = $n->getGuisByPermission($_SESSION["mb_user_id"],true);
-	$mywms = $n->getWmsByOwnGuis($myguis);
-
-	$sql = "SELECT * FROM wms WHERE wms_owsproxy = $1";
-	$v = array($wms);
-	$t = array("s");
-	$res = db_prep_query($sql, $v, $t);
-	$service = array();
-	if($row = db_fetch_array($res)){
-		$service["wms_id"] = $row["wms_id"];
-		$service["wms_getcapabilities"] = $row["wms_getcapabilities"];	
-		$service["wms_getmap"] = $row["wms_getmap"];
-		$service["wms_getfeatureinfo"] = $row["wms_getfeatureinfo"];
-		$service["wms_getcapabilities_doc"] = $row["wms_getcapabilities_doc"];
-	}
-	if(!$row || count($mywms) == 0){
-		throwE(array("No wms data available."));
-		die();	
-	}
-	
-	if(!in_array($service["wms_id"], $mywms)){
-		throwE(array("Permission denied."," -> ".$service["wms_id"], implode(",", $mywms)));
-		die();
-	}
-	return $service;
+	$myguis = $n->getGuisByPermission($_SESSION["mb_user_id"],true);
+	$mywms = $n->getWmsByOwnGuis($myguis);
+
+	$sql = "SELECT * FROM wms WHERE wms_owsproxy = $1";
+	$v = array($wms);
+	$t = array("s");
+	$res = db_prep_query($sql, $v, $t);
+	$service = array();
+	if($row = db_fetch_array($res)){
+		$service["wms_id"] = $row["wms_id"];
+		$service["wms_getcapabilities"] = $row["wms_getcapabilities"];	
+		$service["wms_getmap"] = $row["wms_getmap"];
+		$service["wms_getfeatureinfo"] = $row["wms_getfeatureinfo"];
+		$service["wms_getcapabilities_doc"] = $row["wms_getcapabilities_doc"];
+	}
+	if(!$row || count($mywms) == 0){
+		throwE(array("No wms data available."));
+		die();	
+	}
+	
+	if(!in_array($service["wms_id"], $mywms)){
+		throwE(array("Permission denied."," -> ".$service["wms_id"], implode(",", $mywms)));
+		die();
+	}
+	return $service;
 }
 /**
  * validates the access permission by getting the appropriate wfs_conf
@@ -538,22 +542,22 @@
 
 	return $service;
 }
-
-function checkLayerPermission($wms_id,$l){
-	global $n, $owsproxyService;
-//	$notice = new mb_notice("owsproxy: checkLayerpermission: wms: ".$wms_id.", layer: ".$l);
-	$myl = split(",",$l);
-	$r = array();
-	foreach($myl as $mysl){
-		if($n->getLayerPermission($wms_id, $mysl, $_SESSION["mb_user_id"]) === true){
-			array_push($r, $mysl);
-		}		
-	}
-	$ret = implode(",",$r);
-	return $ret;
-}
-function getDocumentContent($url){
-	$d = new connector($url);
-	return $d->file;
-}
-?>
\ No newline at end of file
+
+function checkLayerPermission($wms_id,$l){
+	global $n, $owsproxyService;
+//	$notice = new mb_notice("owsproxy: checkLayerpermission: wms: ".$wms_id.", layer: ".$l);
+	$myl = split(",",$l);
+	$r = array();
+	foreach($myl as $mysl){
+		if($n->getLayerPermission($wms_id, $mysl, $_SESSION["mb_user_id"]) === true){
+			array_push($r, $mysl);
+		}		
+	}
+	$ret = implode(",",$r);
+	return $ret;
+}
+function getDocumentContent($url){
+	$d = new connector($url);
+	return $d->file;
+}
+?>

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2009-08-13 22:37:39 UTC (rev 4523)
+++ trunk/mapbender/owsproxy/http/index.php	2009-08-14 07:23:15 UTC (rev 4524)
@@ -1,106 +1,106 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Owsproxy
-# Module maintainer Uli
-# Copyright (C) 2002 CCGIS 
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require(dirname(__FILE__) . "/../../conf/mapbender.conf");
-require(dirname(__FILE__) . "/../../http/classes/class_administration.php");
-require(dirname(__FILE__) . "/../../http/classes/class_connector.php");
-require_once(dirname(__FILE__) . "/../../http/classes/class_mb_exception.php");
-require(dirname(__FILE__) . "/./classes/class_QueryHandler.php");
-
-/***** conf *****/
-$imageformats = array("image/png","image/gif","image/jpeg", "image/jpg");
-/***** conf *****/
-
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Owsproxy
+# Module maintainer Uli
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-$postdata = $HTTP_RAW_POST_DATA;
-
-$owsproxyService = $_REQUEST['wms']; //ToDo: change this to 'service' in the apache url-rewriting
-$query = new QueryHandler();
-
-// an array with keys and values toLoserCase -> caseinsensitiv
-$reqParams = $query->getRequestParams();
-
-$notice = new mb_notice("owsproxy id:".$query->getOwsproxyServiceId());
+require(dirname(__FILE__) . "/../../conf/mapbender.conf");
+require(dirname(__FILE__) . "/../../http/classes/class_administration.php");
+require(dirname(__FILE__) . "/../../http/classes/class_connector.php");
+require_once(dirname(__FILE__) . "/../../http/classes/class_mb_exception.php");
+require(dirname(__FILE__) . "/./classes/class_QueryHandler.php");
 
-// check session
-session_regenerate_id();
-session_destroy();
-session_id($_REQUEST["sid"]);
-session_start();
-if(!$_SESSION['mb_user_id']){
-	$notice = new mb_notice("Permission denied");
+/***** conf *****/
+$imageformats = array("image/png","image/gif","image/jpeg", "image/jpg");
+/***** conf *****/
+
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$postdata = $HTTP_RAW_POST_DATA;
+
+$owsproxyService = $_REQUEST['wms']; //ToDo: change this to 'service' in the apache url-rewriting
+$query = new QueryHandler();
+
+// an array with keys and values toLoserCase -> caseinsensitiv
+$reqParams = $query->getRequestParams();
+
+$notice = new mb_notice("owsproxy id:".$query->getOwsproxyServiceId());
+
+// check session
+session_regenerate_id();
+session_destroy();
+session_id($_REQUEST["sid"]);
+session_start();
+if(!$_SESSION['mb_user_id']){
+	$notice = new mb_notice("Permission denied");
 	throwE("Permission denied");
-	die();
-}
-
-//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
-//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
-//	die();	
-//}
-
-/*************  workflow ************/
+	die();
+}
+
+//if($_SESSION['mb_user_ip'] != $_SERVER['REMOTE_ADDR']){
+//	throwE(array("No session data available.","Permission denied.","Please authenticate."));
+//	die();	
+//}
+
+/*************  workflow ************/
 $n = new administration();
-switch (strtolower($reqParams['request'])) {
-	case 'getcapabilities':
-		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
-		$query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
-		$request = $query->getRequest();
-		getCapabilities($request);
-		break;
-	case 'getfeatureinfo':
-		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
-		$query->setOnlineResource($arrayOnlineresources['wms_getfeatureinfo']);
-		$request = $query->getRequest();
-		getFeatureInfo($request);
-		break;
-	case 'getmap':
-		$arrayOnlineresources = checkWmsPermission($owsproxyService);
-		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
-		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
+switch (strtolower($reqParams['request'])) {
+	case 'getcapabilities':
+		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
+		$query->setOnlineResource($arrayOnlineresources['wms_getcapabilities']);
+		$request = $query->getRequest();
+		getCapabilities($request);
+		break;
+	case 'getfeatureinfo':
+		$arrayOnlineresources = checkWmsPermission($query->getOwsproxyServiceId());
+		$query->setOnlineResource($arrayOnlineresources['wms_getfeatureinfo']);
+		$request = $query->getRequest();
+		getFeatureInfo($request);
+		break;
+	case 'getmap':
+		$arrayOnlineresources = checkWmsPermission($owsproxyService);
+		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
+		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
 		if($layers===""){
 			throwE("Permission denied");
 			die();
 		}
-		$query->setParam("layers",$layers);
-		$request = $query->getRequest();
+		$query->setParam("layers",$layers);
+		$request = $query->getRequest();
 		getImage($request);
-		break;
-	case 'map':
-		$arrayOnlineresources = checkWmsPermission($owsproxyService);
-		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
-		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
-		if($layers===""){
-			throwE("Permission denied");
-			die();
-		}
-		$query->setParam("layers",$layers);
-		$request = $query->getRequest();
-		getImage($request);
+		break;
+	case 'map':
+		$arrayOnlineresources = checkWmsPermission($owsproxyService);
+		$query->setOnlineResource($arrayOnlineresources['wms_getmap']);
+		$layers = checkLayerPermission($arrayOnlineresources['wms_id'],$reqParams['layers']);
+		if($layers===""){
+			throwE("Permission denied");
+			die();
+		}
+		$query->setParam("layers",$layers);
+		$request = $query->getRequest();
+		getImage($request);
 		break;	
 	case 'getlegendgraphic':
 		$url = getLegendUrl($query->getOwsproxyServiceId());
 		getImage($url);
-		break;
-	case 'external':
+		break;
+	case 'external':
 		getExternalRequest($query->getOwsproxyServiceId());
 		break; 
 	case 'getfeature':
@@ -119,84 +119,84 @@
 		$request = $query->getRequest();
 		doTransaction($request, $HTTP_RAW_POST_DATA);
 		break;
-	default:
-		
-}
-/*********************************************************/
-function throwE($e){
-	global $reqParams, $imageformats;
-	if(in_array($reqParams['format'],$imageformats)){
-		throwImage($e);
-	}
-	else{
-		throwText($e);	
-	}
+	default:
+		
 }
-
-function throwImage($e){
-	global $width,$height;
-	$image = imagecreate($width,$height);
-	$transparent = ImageColorAllocate($image,155,155,155); 
-	ImageFilledRectangle($image,0,0,$width,$height,$transparent);
-	imagecolortransparent($image, $transparent);
-	$text_color = ImageColorAllocate ($image, 233, 14, 91);
-	for($i=0; $i<count($e); $i++){
-		ImageString ($image, 3, 5, $i*20, $e[$i], $text_color);
-	}
-	responseImage($image);
-}
-function throwText($e){
-	echo join(" ", $e);
-}
-function responseImage($im){
-	global $reqParams;
-	$format = $reqParams['format'];
-	if($format == 'image/png'){header("Content-Type: image/png");}
-	if($format == 'image/jpeg' || $format == 'image/jpg'){header("Content-Type: image/jpeg");}
-	if($format == 'image/gif'){header("Content-Type: image/gif");}
-		 
-	if($format == 'image/png'){imagepng($im);}
-	if($format == 'image/jpeg' || $format == 'image/jpg'){imagejpeg($im);}
-	if($format == 'image/gif'){imagegif($im);}	
-}
-function completeURL($url){
-	global $reqParams;
-	$mykeys = array_keys($reqParams);
-	for($i=0; $i<count($mykeys);$i++){
-		if($i > 0){ $url .= "&"; }
-		$url .= $mykeys[$i]."=".urlencode($reqParams[$mykeys[$i]]);
-	}
-	return $url;
-}
+/*********************************************************/
+function throwE($e){
+	global $reqParams, $imageformats;
+	if(in_array($reqParams['format'],$imageformats)){
+		throwImage($e);
+	}
+	else{
+		throwText($e);	
+	}
+}
 
+function throwImage($e){
+	global $width,$height;
+	$image = imagecreate($width,$height);
+	$transparent = ImageColorAllocate($image,155,155,155); 
+	ImageFilledRectangle($image,0,0,$width,$height,$transparent);
+	imagecolortransparent($image, $transparent);
+	$text_color = ImageColorAllocate ($image, 233, 14, 91);
+	for($i=0; $i<count($e); $i++){
+		ImageString ($image, 3, 5, $i*20, $e[$i], $text_color);
+	}
+	responseImage($image);
+}
+function throwText($e){
+	echo join(" ", $e);
+}
+function responseImage($im){
+	global $reqParams;
+	$format = $reqParams['format'];
+	if($format == 'image/png'){header("Content-Type: image/png");}
+	if($format == 'image/jpeg' || $format == 'image/jpg'){header("Content-Type: image/jpeg");}
+	if($format == 'image/gif'){header("Content-Type: image/gif");}
+		 
+	if($format == 'image/png'){imagepng($im);}
+	if($format == 'image/jpeg' || $format == 'image/jpg'){imagejpeg($im);}
+	if($format == 'image/gif'){imagegif($im);}	
+}
+function completeURL($url){
+	global $reqParams;
+	$mykeys = array_keys($reqParams);
+	for($i=0; $i<count($mykeys);$i++){
+		if($i > 0){ $url .= "&"; }
+		$url .= $mykeys[$i]."=".urlencode($reqParams[$mykeys[$i]]);
+	}
+	return $url;
+}
+
 /**
  * fetch and returns an image to client
  * 
  * @param string the original url of the image to send
  */
-
-function getImage($or){
-	global $reqParams;
-	header("Content-Type: ".$reqParams['format']);
-	echo getDocumentContent($or);
-}
-
-/**
- * fetchs and returns the content of the FeatureInfo Response
- * 
- * @param string the url of the FeatureInfoRequest
- * @return string the content of the FeatureInfo document
- */
-function getFeatureInfo($url){
-	global $info_format;
-	//$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
-	header("Content-Type: ".$info_format);
-	$content = getDocumentContent($url);
-	$content = matchUrls($content);
-	echo $content;
+
+function getImage($or){
+	global $reqParams;
+	header("Content-Type: ".$reqParams['format']);
+	echo getDocumentContent($or);
 }
 
 /**
+ * fetchs and returns the content of the FeatureInfo Response
+ * 
+ * @param string the url of the FeatureInfoRequest
+ * @return string the content of the FeatureInfo document
+ */
+function getFeatureInfo($url){
+	global $info_format;
+	//$e = new mb_notice("owsproxy: Try to fetch FeatureInfoRequest: ".$url);
+	header("Content-Type: ".$info_format);
+	$content = getDocumentContent($url);
+	$content = matchUrls($content);
+	echo $content;
+}
+
+/**
  * fetchs and returns the content of WFS GetFeature response
  * 
  * @param string the url of the GetFeature request
@@ -246,6 +246,10 @@
  */
 
 function getWfsFeaturesFromTransaction($data){
+	new mb_notice("owsproxy.getWfsFeaturesFromTransaction.data: ".$data);
+	if(!$data || $data == ""){
+		return false;
+	}
 	$features = array();
 	$values = NULL;
 	$tags = NULL;
@@ -311,95 +315,95 @@
 	$result = mb_eregi_replace("[^>]*$", "", $result);
 	
 	echo $result;
-}
-
-function matchUrls($content){
-	if(!session_is_registered("owsproxyUrls")){
-		$_SESSION["owsproxyUrls"] = array();
-		$_SESSION["owsproxyUrls"]["id"] = array();
-		$_SESSION["owsproxyUrls"]["url"] = array();
-	}
-	$pattern = "/[\"|\'](https*:\/\/[^\"|^\']*)[\"|\']/";
-	preg_match_all($pattern,$content,$matches);
-	for($i=0; $i<count($matches[1]); $i++){
-		$req = $matches[1][$i];
-		$id = registerURL($req);
-		$extReq = setExternalRequest($id);
-		$content = str_replace($req,$extReq,$content);
-	}
-	return $content;
 }
-
-function setExternalRequest($id){
-	global $reqParams,$query;
-	$extReq = OWSPROXY ."/". $reqParams['sid'] ."/".$id."?request=external";
-	return $extReq;
-}
-function getExternalRequest($id){
-	for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
-		if($id == $_SESSION["owsproxyUrls"]["id"][$i]){
-			$cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
-			$query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
-			if($query_string != ''){
-				$cUrl .= getConjunctionCharacter($cUrl).$query_string;
-			}	
-			$metainfo = get_headers($cUrl,1);
-			// just for the stupid InternetExplorer
-			header('Pragma: private');
-			header('Cache-control: private, must-revalidate');
-			
-			header("Content-Type: ".$metainfo['Content-Type']);
-			
-			$content = getDocumentContent($cUrl);
-			$content = matchUrls($content);			
-			echo $content; 
-		}	
-	} 
-}
-function removeOWSGetParams($query_string){
-	$r = preg_replace("/.*request=external&/","",$query_string);
-	return $r;
-}
-function getConjunctionCharacter($url){
-	if(strpos($url,"?")){ 
-		if(strpos($url,"?") == strlen($url)){ 
-			$cchar = "";
-		}else if(strpos($url,"&") == strlen($url)){
-			$cchar = "";
-		}else{
-			$cchar = "&";
-		}
-	}
-	if(strpos($url,"?") === false){
-		$cchar = "?";
-	} 
-	return $cchar;  
-}
-function registerUrl($url){	
-	if(!in_array($url,$_SESSION["owsproxyUrls"]["url"])){
-		$id = md5($url);
-		array_push($_SESSION["owsproxyUrls"]["url"],$url);
-		array_push($_SESSION["owsproxyUrls"]["id"], $id);
-	}
-	else{
-		for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
-			if($url == $_SESSION["owsproxyUrls"]["url"][$i]){
-				$id = $_SESSION["owsproxyUrls"]["id"][$i];
-			}			
-		}
-	}
-	return $id;
-}
-function getCapabilities($url){
-	global $arrayOnlineresources;
-	global $sid,$wms;
-	$t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["$wms_getfeatureinfo"]));
-	$new = OWSPROXY ."/". $sid ."/".$wms."?";
-	$r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
-	header("Content-Type: application/xml");
-	echo $r;
+
+function matchUrls($content){
+	if(!session_is_registered("owsproxyUrls")){
+		$_SESSION["owsproxyUrls"] = array();
+		$_SESSION["owsproxyUrls"]["id"] = array();
+		$_SESSION["owsproxyUrls"]["url"] = array();
+	}
+	$pattern = "/[\"|\'](https*:\/\/[^\"|^\']*)[\"|\']/";
+	preg_match_all($pattern,$content,$matches);
+	for($i=0; $i<count($matches[1]); $i++){
+		$req = $matches[1][$i];
+		$id = registerURL($req);
+		$extReq = setExternalRequest($id);
+		$content = str_replace($req,$extReq,$content);
+	}
+	return $content;
 }
 
+function setExternalRequest($id){
+	global $reqParams,$query;
+	$extReq = OWSPROXY ."/". $reqParams['sid'] ."/".$id."?request=external";
+	return $extReq;
+}
+function getExternalRequest($id){
+	for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
+		if($id == $_SESSION["owsproxyUrls"]["id"][$i]){
+			$cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
+			$query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
+			if($query_string != ''){
+				$cUrl .= getConjunctionCharacter($cUrl).$query_string;
+			}	
+			$metainfo = get_headers($cUrl,1);
+			// just for the stupid InternetExplorer
+			header('Pragma: private');
+			header('Cache-control: private, must-revalidate');
+			
+			header("Content-Type: ".$metainfo['Content-Type']);
+			
+			$content = getDocumentContent($cUrl);
+			$content = matchUrls($content);			
+			echo $content; 
+		}	
+	} 
+}
+function removeOWSGetParams($query_string){
+	$r = preg_replace("/.*request=external&/","",$query_string);
+	return $r;
+}
+function getConjunctionCharacter($url){
+	if(strpos($url,"?")){ 
+		if(strpos($url,"?") == strlen($url)){ 
+			$cchar = "";
+		}else if(strpos($url,"&") == strlen($url)){
+			$cchar = "";
+		}else{
+			$cchar = "&";
+		}
+	}
+	if(strpos($url,"?") === false){
+		$cchar = "?";
+	} 
+	return $cchar;  
+}
+function registerUrl($url){	
+	if(!in_array($url,$_SESSION["owsproxyUrls"]["url"])){
+		$id = md5($url);
+		array_push($_SESSION["owsproxyUrls"]["url"],$url);
+		array_push($_SESSION["owsproxyUrls"]["id"], $id);
+	}
+	else{
+		for($i=0; $i<count($_SESSION["owsproxyUrls"]["url"]); $i++){
+			if($url == $_SESSION["owsproxyUrls"]["url"][$i]){
+				$id = $_SESSION["owsproxyUrls"]["id"][$i];
+			}			
+		}
+	}
+	return $id;
+}
+function getCapabilities($url){
+	global $arrayOnlineresources;
+	global $sid,$wms;
+	$t = array(htmlentities($arrayOnlineresources["wms_getcapabilities"]),htmlentities($arrayOnlineresources["wms_getmap"]),htmlentities($arrayOnlineresources["wms_getfeatureinfo"]));
+	$new = OWSPROXY ."/". $sid ."/".$wms."?";
+	$r = str_replace($t,$new,$arrayOnlineresources["wms_getcapabilities_doc"]);
+	header("Content-Type: application/xml");
+	echo $r;
+}
+
 /**
  * gets the original url of the requested legend graphic
  * 
@@ -444,34 +448,34 @@
  * 
  * @param string OWSPROXY md5
  * @return array array with detailed information about requested wms
- */
-function checkWmsPermission($wms){
+ */
+function checkWmsPermission($wms){
 	global $con, $n;
-	$myguis = $n->getGuisByPermission($_SESSION["mb_user_id"],true);
-	$mywms = $n->getWmsByOwnGuis($myguis);
-
-	$sql = "SELECT * FROM wms WHERE wms_owsproxy = $1";
-	$v = array($wms);
-	$t = array("s");
-	$res = db_prep_query($sql, $v, $t);
-	$service = array();
-	if($row = db_fetch_array($res)){
-		$service["wms_id"] = $row["wms_id"];
-		$service["wms_getcapabilities"] = $row["wms_getcapabilities"];	
-		$service["wms_getmap"] = $row["wms_getmap"];
-		$service["wms_getfeatureinfo"] = $row["wms_getfeatureinfo"];
-		$service["wms_getcapabilities_doc"] = $row["wms_getcapabilities_doc"];
-	}
-	if(!$row || count($mywms) == 0){
-		throwE(array("No wms data available."));
-		die();	
-	}
-	
-	if(!in_array($service["wms_id"], $mywms)){
-		throwE(array("Permission denied."," -> ".$service["wms_id"], implode(",", $mywms)));
-		die();
-	}
-	return $service;
+	$myguis = $n->getGuisByPermission($_SESSION["mb_user_id"],true);
+	$mywms = $n->getWmsByOwnGuis($myguis);
+
+	$sql = "SELECT * FROM wms WHERE wms_owsproxy = $1";
+	$v = array($wms);
+	$t = array("s");
+	$res = db_prep_query($sql, $v, $t);
+	$service = array();
+	if($row = db_fetch_array($res)){
+		$service["wms_id"] = $row["wms_id"];
+		$service["wms_getcapabilities"] = $row["wms_getcapabilities"];	
+		$service["wms_getmap"] = $row["wms_getmap"];
+		$service["wms_getfeatureinfo"] = $row["wms_getfeatureinfo"];
+		$service["wms_getcapabilities_doc"] = $row["wms_getcapabilities_doc"];
+	}
+	if(!$row || count($mywms) == 0){
+		throwE(array("No wms data available."));
+		die();	
+	}
+	
+	if(!in_array($service["wms_id"], $mywms)){
+		throwE(array("Permission denied."," -> ".$service["wms_id"], implode(",", $mywms)));
+		die();
+	}
+	return $service;
 }
 /**
  * validates the access permission by getting the appropriate wfs_conf
@@ -538,22 +542,22 @@
 
 	return $service;
 }
-
-function checkLayerPermission($wms_id,$l){
-	global $n, $owsproxyService;
-//	$notice = new mb_notice("owsproxy: checkLayerpermission: wms: ".$wms_id.", layer: ".$l);
-	$myl = split(",",$l);
-	$r = array();
-	foreach($myl as $mysl){
-		if($n->getLayerPermission($wms_id, $mysl, $_SESSION["mb_user_id"]) === true){
-			array_push($r, $mysl);
-		}		
-	}
-	$ret = implode(",",$r);
-	return $ret;
-}
-function getDocumentContent($url){
-	$d = new connector($url);
-	return $d->file;
-}
-?>
\ No newline at end of file
+
+function checkLayerPermission($wms_id,$l){
+	global $n, $owsproxyService;
+//	$notice = new mb_notice("owsproxy: checkLayerpermission: wms: ".$wms_id.", layer: ".$l);
+	$myl = split(",",$l);
+	$r = array();
+	foreach($myl as $mysl){
+		if($n->getLayerPermission($wms_id, $mysl, $_SESSION["mb_user_id"]) === true){
+			array_push($r, $mysl);
+		}		
+	}
+	$ret = implode(",",$r);
+	return $ret;
+}
+function getDocumentContent($url){
+	$d = new connector($url);
+	return $d->file;
+}
+?>



More information about the Mapbender_commits mailing list