[Mapbender-commits] r8746 - in trunk/mapbender: http/classes http/php http/plugins http_auth/http owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Dec 8 12:33:25 PST 2013


Author: armin11
Date: 2013-12-08 12:33:25 -0800 (Sun, 08 Dec 2013)
New Revision: 8746

Modified:
   trunk/mapbender/http/classes/class_administration.php
   trunk/mapbender/http/classes/class_connector.php
   trunk/mapbender/http/classes/class_csw.php
   trunk/mapbender/http/classes/class_weldMaps2JPEG.php
   trunk/mapbender/http/classes/class_wfs_1_1_factory.php
   trunk/mapbender/http/classes/class_wms_1_1_1_factory.php
   trunk/mapbender/http/php/mod_inspireDownloadFeed.php
   trunk/mapbender/http/plugins/mb_metadata_layerPreview.php
   trunk/mapbender/http_auth/http/index.php
   trunk/mapbender/owsproxy/http/index.php
Log:
Bugfixes

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/classes/class_administration.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -577,6 +577,37 @@
 	}
 
     /**
+     * selects an array of sublayer ids for a given layer id.
+     *
+     * @param integer			the layer id
+     * @return array	                list of sublayer ids
+     */
+	function getSubLayers($layerId, $subLayer = array(), $layerPos = null, $wmsId = null) {
+		if (!isset($layerPos)) {
+			//get layer_pos for requested layer_id
+			$sql = "SELECT layer_pos, fkey_wms_id FROM layer WHERE layer_id = $1";
+			$v = array($layerId);
+			$t = array("i");
+			$res = db_prep_query($sql, $v, $t);
+			$layerPosRow = db_fetch_array($res);
+			$layerPos = $layerPosRow['layer_pos'];
+			$wmsId = $layerPosRow['fkey_wms_id'];
+			
+		}
+		//select all childs of given layer
+		$sub_layer_sql = "SELECT layer_id, layer_pos FROM layer WHERE fkey_wms_id = $1 AND layer_parent = $2 ORDER BY layer_pos";
+		$v = array($wmsId, $layerPos);
+		$t = array("i","s");
+		$res_sub_layer_sql = db_prep_query($sub_layer_sql, $v, $t);
+		while ($sub_layer_row = db_fetch_array($res_sub_layer_sql)) {
+			$subLayer[] = $sub_layer_row['layer_id'];
+			//recursive creation
+			$subLayer = $this->getSubLayers($layerId, $subLayer, $sub_layer_row['layer_pos'], $wmsId);
+		}
+		return $subLayer;
+	}
+
+    /**
      * selects the WMC for a given wmc_id.
      *
      * @param integer			the wms id

Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/classes/class_connector.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -36,6 +36,7 @@
 	private $httpPostFieldsNumber;
 	private $curlSendCustomHeaders = true; //decide to send own headers or not
 	private $curlCookiesession = true;
+	private $externalHeaders = "";
 	
 		
 	/**
@@ -158,6 +159,10 @@
 			case "timeOut":
 				$this->timeOut = (integer)$value;
 				break;	
+
+			case "externalHeaders":
+				$this->externalHeaders = $value;
+				break;	
 	
 			case "httpContentType":
 				if ($this->isValidHttpContentType($value)) {
@@ -292,13 +297,17 @@
 		$useragent=CONNECTION_USERAGENT;
 		//Build own headers for GET Requests - maybe needful?
 		if(strtoupper($this->httpType) == 'GET'){
-			$headers = array(
-					"GET ".$path." HTTP/1.1",
-					"User-Agent: ".$useragent,
-           				"Host: ".$host.":".$port,
-	           		 	"Accept: */*",
-					"Proxy-Connection: Keep-Alive"
-			);
+			if ($this->externalHeaders !== "") {
+				$headers = $this->externalHeaders;
+			} else {
+				$headers = array(
+						"GET ".$path." HTTP/1.1",
+						"User-Agent: ".$useragent,
+           					"Host: ".$host.":".$port,
+	           		 		"Accept: */*",
+						"Proxy-Connection: Keep-Alive"
+				);
+			}
 		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
 		}
 		#curl_setopt($ch, CURLOPT_HEADER, true);

Modified: trunk/mapbender/http/classes/class_csw.php
===================================================================
--- trunk/mapbender/http/classes/class_csw.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/classes/class_csw.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -37,6 +37,7 @@
 	var $cat_op_getrecords;
 	var $cat_op_getrecordbyid;
 	var $cat_op_describerecord;
+
 	var $cat_getcapabilities_doc;
 	
 	var $cat_get_capabilities_values = array();
@@ -132,155 +133,92 @@
 		$this->cat_getcapabilities_doc = $data;
 		$this->cat_upload_url = $url;
 		$this->cat_id="";//Auto-assing catalog id
-		
-		$parser = xml_parser_create("");
-		xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
-		xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
-		xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
-		xml_parse_into_struct($parser,$data,$value_array,$index_array);
-		
-		//echo "values:".print_r($value_array);
-		//echo "index:".print_r($vindex_array);
-		
-		$code = xml_get_error_code($parser);
-		if ($code) {
-			$line = xml_get_current_line_number($parser); 
-			$mb_exception = new mb_exception(xml_error_string($code) .  " in line " . $line);
-		}
-		
-		xml_parser_free($parser);
-		
-		foreach($value_array as $element){
-			//Version 2.0.2
-			//@todo: handle other profiles
-			
-			if((mb_strtoupper($element[tag]) == "CSW:CAPABILITIES" OR mb_strtoupper($element[tag]) == "CAPABILITIES") && $element[type] == "open"){
-				$this->cat_version = $element[attributes][version];
+		//$e = new mb_exception($this->cat_getcapabilities_doc);
+		//alter xml parsing to simple_xml with xpath
+		try {
+			$xml = str_replace('xlink:href', 'xlinkhref', $this->cat_getcapabilities_doc);
+			#http://forums.devshed.com/php-development-5/simplexml-namespace-attributes-problem-452278.html
+			#http://www.leftontheweb.com/message/A_small_SimpleXML_gotcha_with_namespaces
+
+			$csw202Cap = new SimpleXMLElement($xml);
+
+			if ($csw202Cap === false) {
+				foreach(libxml_get_errors() as $error) {
+        				$e = new mb_exception($error->message);
+    				}
+				throw new Exception('Cannot parse CSW 2.0.2 Capabilities!');
 			}
-			
-			//Title
-			if((mb_strtoupper($element[tag]) == "OWS:TITLE" OR mb_strtoupper($element[tag]) == "TITLE") && $element[level] == '3'){
-				$this->cat_title = $this->stripEndlineAndCarriageReturn($element[value]);
-			}
-			
-			//Abstract
-			
-			if((mb_strtoupper($element[tag]) == "OWS:ABSTRACT" OR mb_strtoupper($element[tag]) == "ABSTRACT") && $element[level] == '3'){
-				$this->cat_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
-			}
-			
+		}
+		catch (Exception $e) {
+    			$e = new mb_exception($e->getMessage());
+		}
+
+		if ($csw202Cap !== false) {
+			//read all relevant information an put them into the mapbender csw object
+			//xmlns="http://www.opengis.net/csw"
+			//Setup default namespace
+			$csw202Cap->registerXPathNamespace("ows", "http://www.opengis.net/ows");
+			//$csw202Cap->registerXPathNamespace("ows", "http://www.opengis.net/ows");
+			$csw202Cap->registerXPathNamespace("gml", "http://www.opengis.net/gml");
+			$csw202Cap->registerXPathNamespace("gmd", "http://www.isotc211.org/2005/gmd");
+			$csw202Cap->registerXPathNamespace("csw", "http://www.opengis.net/cat/csw/2.0.2");
+			$csw202Cap->registerXPathNamespace("ogc", "http://www.opengis.net/ogc");
+			$csw202Cap->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
+			$csw202Cap->registerXPathNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+			$csw202Cap->registerXPathNamespace("default", "");
+			$csw202Cap->registerXPathNamespace("inspire_ds", "http://inspire.ec.europa.eu/schemas/inspire_ds/1.0");
+			$csw202Cap->registerXPathNamespace("inspire_com", "http://inspire.ec.europa.eu/schemas/common/1.0");
+			$this->cat_version = $csw202Cap->xpath('/csw:Capabilities/@version');
+			$this->cat_version = $this->cat_version[0];
+			//$e = new mb_exception($this->cat_version);
+			//title part
+			$this->cat_title = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:Title');
+			$this->cat_title = $this->stripEndlineAndCarriageReturn($this->cat_title[0]);
+			//abstract
+			$this->cat_abstract = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:Abstract');
+			$this->cat_abstract = $this->stripEndlineAndCarriageReturn($this->cat_abstract[0]);
 			//fees
-			if(mb_strtolower($element[tag]) == "ows:fees" OR mb_strtolower($element[tag]) == "fees"){
-				$this->fees = $element[value];
-			}
+			$this->fees = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:fees');
+			$this->fees = $this->stripEndlineAndCarriageReturn($this->fees[0]);
+			//accessconstraints
+			$this->accessconstraints = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:AccessConstraints');
+			$this->accessconstraints = $this->stripEndlineAndCarriageReturn($this->accessconstraints[0]);
+			//TODO: keywords
+			//service provider
+			$this->contactorganization = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:ServiceProvider/ows:ProviderName');
+			$this->contactorganization = $this->stripEndlineAndCarriageReturn($this->contactorganization[0]);
+			$this->contactperson = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:ServiceProvider/ows:ServiceContact/ows:IndividualName');
+			$this->contactorganization = $this->stripEndlineAndCarriageReturn($this->contactperson[0]);
+			$this->contactposition = $csw202Cap->xpath('/csw:Capabilities/ows:ServiceIdentification/ows:ServiceProvider/ows:ServiceContact/ows:PositionName');
+			$this->contactorganization = $this->stripEndlineAndCarriageReturn($this->contactposition[0]);
 			//
-			if(mb_strtolower($element[tag]) == "ows:accessconstraints" OR mb_strtolower($element[tag]) == "accessconstraints"){
-				$this->accessconstraints = $element[value];
+			/*$this->address
+			$this->city
+			$this->stateorprovince
+			$this->postcode
+			$this->country
+			$this->contactvoicetelephone
+			$this->contactfacsimiletelephone
+			$this->contactelectronicmailaddress*/
+			//for op_types
+			$op_types = array("GetCapabilities","DescribeRecord","GetRecords","GetRecordById");
+			foreach ($op_types as $op_type)  {
+				$this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'] = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:DCP/ows:HTTP/ows:Get/@xlinkhref');
+				$this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'] = html_entity_decode($this->cat_op_values[mb_strtolower($op_type)]['get']['dflt'][0]);
+				//$e = new mb_exception("class_csw: operationurl: ".$this->cat_op_values[mb_strtolower($op_type)]['get']['dflt']);
+				$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'] = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:DCP/ows:HTTP/ows:Post/@xlinkhref');
+				$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'] = html_entity_decode($this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'][0]);
+				//extract constraints for this operation
+				$constraints = $csw202Cap->xpath('/csw:Capabilities/ows:OperationsMetadata/ows:Operation[@name="'.$op_type.'"]/ows:Constraint[@name="PostEncoding"]/ows:Value');
+				foreach ($constraints as $constraint) {
+					$this->cat_op_values[mb_strtolower($op_type)]['post'][mb_strtolower($constraint)]=$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'];
+					//$e = new mb_exception("class_csw: constraint: ".mb_strtolower($constraint));
+				}
 			}
-			if(mb_strtolower($element[tag]) == "ows:individualname" OR mb_strtolower($element[tag]) == "individualname"){
-				$this->contactperson = $element[value];
+			if (!isset($this->cat_title) || $this->cat_title == "") {
+				$this->cat_title = "No title for CSW given!";
 			}
-			if(mb_strtolower($element[tag]) == "ows:positionname" OR mb_strtolower($element[tag]) == "positionname"){
-				$this->contactposition = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "contactorganization" OR mb_strtolower($element[tag]) == "contactorganization"){
-				$this->contactorganization = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "address"){
-				$this->address = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "city"){
-				$this->city = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "stateorprovince"){
-				$this->stateorprovince = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "postcode"){
-				$this->postcode = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "country"){
-				$this->country = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "ows:Voice" OR mb_strtolower($element[tag]) == "Voice"){
-				$this->contactvoicetelephone = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "contactfacsimiletelephone"){
-				$this->contactfacsimiletelephone = $element[value];
-			}
-			if(mb_strtolower($element[tag]) == "ows:electronicmailaddress" OR mb_strtolower($element[tag]) == "electronicmailaddress"){
-				$this->contactelectronicmailaddress = $element[value];
-			}
-			
-			//Store array of keywords
-	  		if(mb_strtolower($element[tag]) == "ows:keyword" OR mb_strtolower($element[tag]) == "keyword"){
-				$this->keywords[count($this->keywords)] = $element[value];
-			}
-			
-
-			
-			//Handle operational elements
-			//Open operational element
-			if((mb_strtoupper($element[tag]) == "OWS:OPERATION" OR mb_strtoupper($element[tag]) == "OPERATION") && $element[type] == "open"){
-				$op_type = $element[attributes][name];
-			}
-			
-			//Handle GET
-			if(($op_type!=null) && (mb_strtoupper($element[tag]) == "OWS:GET" OR mb_strtoupper($element[tag]) == "GET")){
-				//$this->cat_op_getcapabilities = $element[attributes]["xlink:href"];
-				$this->cat_op_values[mb_strtolower($op_type)]['get']['dflt']=$element[attributes]["xlink:href"];
-			}
-			
-			//Handle POST
-			if(($op_type!=null) && (mb_strtoupper($element[tag]) == "OWS:POST" OR mb_strtoupper($element[tag]) == "POST")){
-				//$this->cat_op_getcapabilities = $element[attributes]["xlink:href"];
-				$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt']=$element[attributes]["xlink:href"];
-				$op_sub_type='post';
-			}
-			
-			//Handle Constraint
-			if(($op_type!=null) && (mb_strtoupper($element[tag]) == "OWS:CONSTRAINT" OR mb_strtoupper($element[tag]) == "CONSTRAINT")){
-				$op_constraint=$element[attributes]["name"];
-			}
-			
-			// Handle POST Constraint
-			if(($op_type!=null) && (mb_strtolower($op_constraint)=='postencoding') && (mb_strtoupper($element[tag]) == "OWS:VALUE" OR mb_strtoupper($element[tag]) == "VALUE")){
-				//$this->cat_op_getcapabilities = $element[attributes]["xlink:href"];
-				$this->cat_op_values[mb_strtolower($op_type)]['post'][mb_strtolower($element[value])]=$this->cat_op_values[mb_strtolower($op_type)]['post']['dflt'];
-				//Assume one value per constraint
-				$op_constraint=null;
-			}
-			
-			/*
-			//GETCAPABILITIES
-			if((mb_strtoupper($op_type)=='GETCAPABILITIES') &&   (mb_strtoupper($element[tag]) == "OWS:GET" OR mb_strtoupper($element[tag]) == "GET")){
-				$this->cat_op_getcapabilities = $element[attributes]["xlink:href"];
-				$this->cat_op_values['getcapabilities_get']=$element[attributes]["xlink:href"];
-			}
-			
-			//GETRECORDS
-			if((mb_strtoupper($op_type)=='GETRECORDS') &&   (mb_strtoupper($element[tag]) == "OWS:GET" OR mb_strtoupper($element[tag]) == "GET")){
-				$this->cat_op_getrecords = $element[attributes]["xlink:href"];
-				$this->cat_op_values['getrecords_get']=$element[attributes]["xlink:href"];
-			}
-			
-			//GETRECORDS
-			if((mb_strtoupper($op_type)=='GETRECORDBYID') &&   (mb_strtoupper($element[tag]) == "OWS:GET" OR mb_strtoupper($element[tag]) == "GET")){
-				$this->cat_op_getrecordbyid = $element[attributes]["xlink:href"];
-				$this->cat_op_values['getrecordbyid_get']=$element[attributes]["xlink:href"];
-			}
-			
-			//DESCRIBERECORD
-			if((mb_strtoupper($op_type)=='DESCRIBERECORDS') &&   (mb_strtoupper($element[tag]) == "OWS:GET" OR mb_strtoupper($element[tag]) == "GET")){
-				$this->cat_op_describerecord = $element[attributes]["xlink:href"];
-				$this->cat_op_values['getcapabilities_get']=$element[attributes]["xlink:href"];
-			}
-			*/
-			
-			//Close operational element
-			if((mb_strtoupper($element[tag]) == "OWS:OPERATION" OR mb_strtoupper($element[tag]) == "OPERATION") && $element[type] == "close"){
-				$op_type = null;
-			}
-			
+			//$e = new mb_exception($this->cat_title);
 		}
 		
 		//Success/Failure
@@ -293,10 +231,7 @@
 			$this->cat_status = true;
 			$e = new mb_notice("class_csw: createCatObjFromXML: CSW " . $url . " has been loaded successfully.");
 			return true;
-		}
-		
-		
-		
+		}	
 	}
 	
 	/**
@@ -434,4 +369,4 @@
 	
 
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/classes/class_weldMaps2JPEG.php
===================================================================
--- trunk/mapbender/http/classes/class_weldMaps2JPEG.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/classes/class_weldMaps2JPEG.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -40,10 +40,43 @@
 		  	break;
 			}
 		}
-		$width = $obj1->get("width");
-		$height = $obj1->get("height");
-		
-		$image = imagecreatetruecolor($width, $height	);
+		//following is only possible, if parameters with and height are given :-( - when getlegendgraphic is used - otherwise we have to get the original width and height from capabilities - or mapbender database itself!
+		//$e = new mb_exception("width: ".$width);
+		//check if url is of type getlegendgraphic or getmap - these are considered here
+		$request = strtoupper($obj1->get("REQUEST"));
+		//$e = new mb_exception(strtoupper($obj1->get("REQUEST")));
+		//$e = new mb_exception("count url: ".count($url));
+		if ($request !== "GETMAP" && $request !== "GETLEGENDGRAPHIC") {
+			//no width or height exists - e.g. legend graphics
+			//$e = new mb_exception("No GetMap or GetLegendGraphic");
+			//$e = new mb_exception("class_welsMaps2JPEG.php: ".$url[0]);
+			if ($url[0] != false){
+				$url[0] = urldecode($url[0]);
+				//$e = new mb_exception("class_weldMaps2JPEG.php: ".$url[0]);
+				//list($width, $height, $type, $attr) = getimagesizefromstring($this->loadpng($url[0]));
+				$img = $this->loadpng($url[0]);	
+				$width = imagesx($img);
+				$height = imagesy($img);
+				//list($width, $height, $type, $attr) = getimagesize($img);
+				//$width = 200;
+				//$height = 200;
+				$image = imagecreatetruecolor($width, $height);
+				$white = ImageColorAllocate($image,255,255,255); 
+				ImageFilledRectangle($image,0,0,$width,$height,$white); 
+				imagecopy($image, $img, 0, 0, 0, 0, $width, $height);
+				//free space
+				@imagedestroy($img); 
+				imagejpeg($image,$filename);
+				//free space
+				imagedestroy($image); 
+				return true;
+			}
+		} else {
+			$e = new mb_exception("Normal GetMap or GetLegendGraphic");
+			$width = $obj1->get("width");
+			$height = $obj1->get("height");
+		}
+		$image = imagecreatetruecolor($width, $height);
 		$white = ImageColorAllocate($image,255,255,255); 
 		ImageFilledRectangle($image,0,0,$width,$height,$white); 
 
@@ -51,9 +84,11 @@
 			if ($url[$i] != false) { //sometimes some false urls will be send? - don't use them
 				//before encode the url it should be decoded to be secure that a decoded url is used!
 				$url[$i] = urldecode($url[$i]);
+				//$e = new mb_exception("oldurl: ".$url[$i]);
 				$obj = new stripRequest($url[$i]);
 				$url[$i] = $obj->setPNG();
 				$url[$i] = $obj->encodeGET($encode);
+				//$e = new mb_exception("newurl: ".$url[$i]);
 				$img = $this->loadpng($url[$i]);
 				if($img != false){
 					imagecopy($image, $img, 0, 0, 0, 0, $width, $height);
@@ -71,16 +106,37 @@
 	
 	function loadpng ($imgurl) {
 		$obj = new stripRequest($imgurl);
-		$x = new connector($imgurl);
-		
+		$x = new connector();
+		//set header
+		//$x->set("curlSendCustomHeaders",true);
+		//$e = new mb_exception($x->file);
+		//$x->set("curlSendCustomHeaders",false);
 		//
-		$f = $obj->get("format");
-		
-		$im = @imagecreatefromstring($x->file);
+		//Accept		text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+		//Accept-Encoding	gzip, deflate
+		//Accept-Language	de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
+		//Cache-Control	max-age=0
+		//Connection	keep-alive
+		//Host	geodaten-luwg.rlp.de
+		//User-Agent	Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0
+		$headers = array(
+				"GET: ".$path." HTTP/1.1",
+				"User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0",
+				"Accept-Encoding: gzip, deflate",
+				"Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3",
+           			"Host: geodaten-luwg.rlp.de",
+				"Cache-Control:	max-age=0",
+	           		"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
+				"Connection: Keep-Alive"
+		);
+		//$x->set("curlSendCustomHeaders",true);
+		//$x->set("externalHeaders", $headers);
+		//$f = $obj->get("format");
+		$im = imagecreatefromstring($x->load($imgurl));
 		if(!$im){
 			$im = false;
-			$e = new mb_exception("weldMaps2JPEG: unable to load image: ".$imgurl);
-		}  
+			$e = new mb_exception("weldMaps2JPEG: loadpng: unable to load image: ".$imgurl);
+		}
 		return $im;
 		
 	}

Modified: trunk/mapbender/http/classes/class_wfs_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -71,7 +71,7 @@
 		$url = $aWfs->describeFeatureType .
 			$aWfs->getConjunctionCharacter($aWfs->describeFeatureType) .
 			implode("&", $paramArray);
-		
+		$e = new mb_exception($url);
 		$xml = $this->get($url);
 		//parse result to see if it is a real featuretype description
 		
@@ -86,10 +86,10 @@
 	*/
 	protected function createFeatureTypeFromXml ($xml, $myWfs, $featureTypeName) {
 		$newFeatureType = new WfsFeatureType($myWfs);
-
+		//$e = new mb_exception($xml);
 		$doc = new DOMDocument();
 		$doc->loadXML($xml);
-		$e = new mb_notice("class_wfs_1_1_factory.php: Got following FeatureType XML: ".$xml);
+		$e = new mb_exception("class_wfs_1_1_factory.php: Got following FeatureType XML: ".$xml);
 		$xpath =  new DOMXpath($doc);
 		$xpath->registerNamespace("xs","http://www.w3.org/2001/XMLSchema");
 

Modified: trunk/mapbender/http/classes/class_wms_1_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wms_1_1_1_factory.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/classes/class_wms_1_1_1_factory.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -38,13 +38,14 @@
 		return parent::createFromDb($id, $myWms);
 	}
 	
+	//what does this function do?
+	//
 	public function createLayerFromDb ($id) {
 		$wmsId = func_num_args() >= 2 ? 
 			func_get_arg(1) : null;
 
 		$appId = func_num_args() >= 3 ? 
 			func_get_arg(2) : null;
-
 		//
 		// get WMS of this layer
 		//
@@ -52,35 +53,31 @@
 			$myWms = $this->createFromDb($wmsId, $appId);
 		}
 		else {
-			$myWms = $this->createFromDb($wmsId);
+			$myWms = $this->createFromDb($wmsId);	
 		}
-		
 		if (is_null($myWms)) {
 			return null;
 		}
-		
 		//
-		// delete all layers apart from the one mentioned (but keep parents and children)
+		// delete all layers apart from the one mentioned (but keep parents and children) better to use recursive creation
 		//
-		
 		// Find layers that have both parents and children for testing:
 		// SELECT DISTINCT q.layer_id, q.layer_pos, q.layer_parent FROM layer q, layer r WHERE r.layer_parent <> '' AND q.layer_pos = CAST(r.layer_parent AS numeric) and q.layer_parent = '0' and q.fkey_wms_id = r.fkey_wms_id
 		$currentLayer = $myWms->getLayerById($id);
-
 		$keep = array();
-
 		$parents = $currentLayer->getParents();
 		foreach ($parents as $parent) {
 			$keep[]= $parent->layer_uid;
 		}
-
 		$keep[]= $currentLayer->layer_uid;
-
-		$children = $currentLayer->getChildren();
-		foreach ($children as $child) {
-			$keep[]= $child->layer_uid;
+		//TODO: delete the following at each possible position - it is wrong !!! -> $children = $currentLayer->getChildren();
+		//$children = $currentLayer->getChildren();
+		//new way:
+		$admin = new administration();
+		$sublayers = $admin->getSubLayers($id);
+		foreach ($sublayers as $subLayerId) {
+			$keep[] = $subLayerId;
 		}
-
 		//
 		// 2. delete layers not for keeping
 		//
@@ -97,4 +94,4 @@
 		return $myWms;
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -1139,6 +1139,7 @@
 				$crsUpper = str_replace("epsg","EPSG",$crs);
 				//Exchange :: with :
 				$crsUpper = str_replace("::",":",$crsUpper);
+				$crsUpper = str_replace(":6.9:",":",$crsUpper);
 				$epsgId = explode('EPSG:',$crsUpper);
 				$epsgId = end($epsgId);
 				//check if order have to be altered

Modified: trunk/mapbender/http/plugins/mb_metadata_layerPreview.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_layerPreview.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http/plugins/mb_metadata_layerPreview.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -46,6 +46,7 @@
 
 switch ($ajaxResponse->getMethod()) {
 	case "saveLayerPreview":
+		$e = new mb_exception("plugins/mb_metadatalayerPreview.php: weld map");
 		$mapImg = new weldMaps2JPEG($mapurl, $layerPreviewMapFileName);
 		if(!$mapImg) {
 			$ajaxResponse->setSuccess(false);
@@ -53,6 +54,7 @@
 			$ajaxResponse->send();
 		} 
 		if ($legendUrl) {
+			$e = new mb_exception("plugins/mb_metadatalayerPreview.php: weld legend");
 			$legendImg = new weldMaps2JPEG($legendUrl, $layerPreviewLegendFileName);
 			if(!$legendImg) {
 				$ajaxResponse->setSuccess(false);

Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/http_auth/http/index.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -154,6 +154,8 @@
 		}
 		$query->setParam("layers",urldecode($layers));
 		$request = $query->getRequest();
+		//add some parameter for ArcGIS because some clients don't send it
+		$request.="&SERVICE=WMS";
 		#log proxy requests
 		if($n->getWmsLogTag($wmsId)==1) {
 			#do log to db

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2013-12-02 09:45:55 UTC (rev 8745)
+++ trunk/mapbender/owsproxy/http/index.php	2013-12-08 20:33:25 UTC (rev 8746)
@@ -258,8 +258,9 @@
 		} else {
 			$request = $query->getRequest();
 		}
-		//$request = $query->getRequest();
-		#log proxy requests
+		//add some parameter for ArcGIS because some clients don't send it
+		$request.="&SERVICE=WMS";
+		//log proxy requests
 		if($n->getWmsLogTag($arrayOnlineresources['wms_id'])==1) {
 			#do log to db
 			#TODO read out size of bbox and calculate price



More information about the Mapbender_commits mailing list