[Mapbender-commits] r3100 - in branches/noframes: conf core http/classes http/javascripts http/php http/print http/tools

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Oct 3 04:42:59 EDT 2008


Author: christoph
Date: 2008-10-03 04:42:59 -0400 (Fri, 03 Oct 2008)
New Revision: 3100

Removed:
   branches/noframes/http/javascripts/wfs_usemap.js
Modified:
   branches/noframes/conf/wfs_additional_spatial_search.conf
   branches/noframes/conf/wfs_default.conf
   branches/noframes/core/globalSettings.php
   branches/noframes/http/classes/class_administration.php
   branches/noframes/http/classes/class_bbox.php
   branches/noframes/http/classes/class_kml_line.php
   branches/noframes/http/classes/class_kml_linearring.php
   branches/noframes/http/classes/class_kml_ows.php
   branches/noframes/http/classes/class_kml_parser_ows.php
   branches/noframes/http/classes/class_kml_placemark.php
   branches/noframes/http/classes/class_kml_point.php
   branches/noframes/http/classes/class_locale.php
   branches/noframes/http/classes/class_point.php
   branches/noframes/http/classes/class_wfs.php
   branches/noframes/http/classes/class_wfs_conf.php
   branches/noframes/http/javascripts/geometry.js
   branches/noframes/http/javascripts/mod_highlightPOI.php
   branches/noframes/http/javascripts/mod_savewmc.php
   branches/noframes/http/javascripts/mod_wfs_SpatialRequest.php
   branches/noframes/http/javascripts/mod_wfs_gazetteer_client.php
   branches/noframes/http/javascripts/wfs.js
   branches/noframes/http/php/mod_forgottenPassword.php
   branches/noframes/http/php/mod_meetingPoint.php
   branches/noframes/http/print/mod_printPDF.php
   branches/noframes/http/print/mod_printPDF_pdf.php
   branches/noframes/http/tools/mod_monitorCapabilities_read.php
Log:
merged w/ trunk

Modified: branches/noframes/conf/wfs_additional_spatial_search.conf
===================================================================
--- branches/noframes/conf/wfs_additional_spatial_search.conf	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/conf/wfs_additional_spatial_search.conf	2008-10-03 08:42:59 UTC (rev 3100)
@@ -12,6 +12,8 @@
 var buttonPoint = {"status":1, "img":"select_point_off.png","title":"Punktauswahl"};
 var buttonExtent = {"status":1,"img":"select_extent_off.png","title":"Auswahl Kartenrahmen"};
 
+var mb_wfs_tolerance = 8;
+
 var spatialRequestIsSetMessage = "Gebiet eingegrenzt, bitte OK klicken!";
 var clearFilterButtonLabel = "Neu";
 

Modified: branches/noframes/conf/wfs_default.conf
===================================================================
--- branches/noframes/conf/wfs_default.conf	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/conf/wfs_default.conf	2008-10-03 08:42:59 UTC (rev 3100)
@@ -14,6 +14,8 @@
 var buttonExtent = {"status":1, "x":840, "y":10, "img":"select_extent_off.png"};
 var buttonDialogue = {"status":1, "x":870, "y":10, "img":"select_choose_off.png"};
 
+var mb_wfs_tolerance = 8;
+
 var buttonWfs_imgdir = "../img/button_gray/";
 var buttonWfs_zIndex = 10;
 

Modified: branches/noframes/core/globalSettings.php
===================================================================
--- branches/noframes/core/globalSettings.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/core/globalSettings.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -63,4 +63,9 @@
 //
 $con = db_connect($DBSERVER, $OWNER, $PW);
 db_select_db(DB, $con);
+
+//
+// Do not display PHP errors
+//
+ini_set("display_errors", "0");
 ?>

Modified: branches/noframes/http/classes/class_administration.php
===================================================================
--- branches/noframes/http/classes/class_administration.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_administration.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -585,6 +585,83 @@
 		}
 	}
 
+	function getAllFilteredUsers($owner) {
+		$allUsers = array();
+		$sql = "SELECT mb_user_id,mb_user_name,mb_user_email FROM mb_user ";
+		$sql .= " WHERE mb_user_owner = $1 ORDER BY mb_user_name ";
+		$v = array($owner);
+		$t = array('i'); 
+		$res = db_prep_query($sql, $v, $t);
+		while ($row = db_fetch_array($res)) {
+			array_push($allUsers, array("mb_user_id" => $row["mb_user_id"], "mb_user_name" => $row["mb_user_name"], "mb_user_email" => $row["mb_user_email"]));
+		}
+		$json = new Mapbender_JSON();
+		$output = $json->encode($allUsers);
+
+		header("Content-type:text/plain; charset=utf-8");
+		return $output;
+	}
+
+	function getAllUserColumns($userId) {
+		$userArray = array();
+		$sql = "SELECT * FROM mb_user WHERE mb_user_id = $1";
+		$v = array($userId); 
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		while ($row = db_fetch_array($res)) {
+			foreach ($row as $key => $value){
+				if (is_int($key)==false) {
+					array_push($userArray, array("id" => $key, "value" => $value));
+				}
+			}
+		}
+		$json = new Mapbender_JSON();
+		$output = $json->encode($userArray);
+
+		header("Content-type:text/plain; charset=utf-8");
+		return $output;
+	}
+
+	/**
+	 * Returns an array of column names and fieldtype for a table.
+	 * 
+	 */
+	function getTableColumns($table) {
+		$sql = "SELECT * FROM $table LIMIT 1";
+		$columnArray = array();
+
+		$v = array(); 
+		$t = array();
+		$res = db_prep_query($sql,$v,$t);
+
+		$i = 0;
+		while ($i < db_num_fields($res)) {
+			if(db_field_type($res, $i)=="varchar") {
+				$fieldType = "s";
+			}
+			else {
+				$fieldType = "i";
+			}
+			$columnArray[db_fieldname($res, $i)] = $fieldType;
+			$i++;
+		}
+
+		return $columnArray;
+	}
+
+	function deleteTableRecord($table,$keyField,$keyFieldValue) {
+		$sql = "DELETE FROM $table WHERE $keyField = $1";
+		$v = array($keyFieldValue); 
+		$t = array('s');
+		$res = db_prep_query($sql,$v,$t);
+		if (!$res) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
 	function getUserIdByUserName($username){
 		$sql = "SELECT mb_user_id FROM mb_user ";
 		$sql .= "WHERE mb_user_name = $1 GROUP BY mb_user_id";

Modified: branches/noframes/http/classes/class_bbox.php
===================================================================
--- branches/noframes/http/classes/class_bbox.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_bbox.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -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__)."/class_point.php");
 
 /**
  * A bounding box consisting of an lower left and an upper right point, and an EPSG.

Modified: branches/noframes/http/classes/class_kml_line.php
===================================================================
--- branches/noframes/http/classes/class_kml_line.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_kml_line.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -44,34 +44,32 @@
 				#
 				if (preg_match("/,/", $pointArray[$i])) {
 					$aPoint = explode(",", $pointArray[$i]);
-					# ignore altitude
 					// KML only supperts EPSG 4326, so
 					// the coordinates are transformed 
-					$pt = new Mapbender_point($aPoint[0], $aPoint[1], $epsg);
+					$pt = new Mapbender_point($aPoint[0], $aPoint[1], $aPoint[2], $epsg);
 					if (isset($epsg) && $epsg != 4326) {
 						$pt->transform(4326);
 					}
-					$point = array("x" => $pt->x, "y" => $pt->y);
+					$point = array("x" => $pt->x, "y" => $pt->y, "z" => $pt->z);
 					array_push($this->pointArray, $point);
 				}
 			}
 		}
 		else {
 			$pointArray = explode(" ", $geometryString);
-			for ($i=0; $i < count($pointArray); $i+=2) {
+			for ($i=0; $i < count($pointArray); $i+=3) {
 				#
 				# Some KMLs have a lot of whitespaces; this "if" is an
 				# ugly hack to prevent adding empty points
 				#
 				if ($pointArray[$i] && $pointArray[$i+1]) {
-					# ignore altitude
-					$pt = new Mapbender_point($pointArray[$i], $pointArray[$i+1], $epsg);
+					$pt = new Mapbender_point($pointArray[$i], $pointArray[$i+1], $pointArray[$i+2], $epsg);
 					// KML only supperts EPSG 4326, so
 					// the coordinates are transformed 
 					if (isset($epsg) && $epsg != 4326) {
 						$pt->transform(4326);
 					}
-					$point = array("x" => $pt->x, "y" => $pt->y);
+					$point = array("x" => $pt->x, "y" => $pt->y, "z" => $pt->z);
 					array_push($this->pointArray, $point);
 				}
 			}
@@ -96,7 +94,12 @@
 				if ($i > 0) {
 					$str .= ",";
 				}
-				$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				if ($this->pointArray[$i]["z"]) {
+					$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"].",".$this->pointArray[$i]["z"]."]";
+				}
+				else {
+					$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				}
 			}
 			return "{\"type\": \"LineString\", \"coordinates\":[" . $str . "]}";
 		}
@@ -106,7 +109,7 @@
 	}
 
 	/**
-	 * @return array an array of points as associative array, coordinates as ["x"] and ["y"]
+	 * @return array an array of points as associative array, coordinates as ["x"] and ["y"] and ["z"]
 	 */
 	public function getPointArray () {
 		return $this->pointArray;
@@ -114,7 +117,7 @@
 	
 	/**
 	 * An array of points, with a point being an associative 
-	 * array consisting of attributes "x" and "y".
+	 * array consisting of attributes "x" and "y" and "z"
 	 */
 	protected $pointArray = array();
 }

Modified: branches/noframes/http/classes/class_kml_linearring.php
===================================================================
--- branches/noframes/http/classes/class_kml_linearring.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_kml_linearring.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -42,7 +42,12 @@
 				if ($i > 0) {
 					$str .= ",";
 				}
-				$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				if ($this->pointArray[$i]["z"]) {
+					$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"].",".$this->pointArray[$i]["z"]."]";
+				}
+				else {
+					$str .= "[".$this->pointArray[$i]["x"].",".$this->pointArray[$i]["y"]."]";
+				}
 			}
 			return "[" . $str . "]";
 		}

Modified: branches/noframes/http/classes/class_kml_ows.php
===================================================================
--- branches/noframes/http/classes/class_kml_ows.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_kml_ows.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -45,6 +45,114 @@
 	public function __construct() {
 	} 
 
+	public function toSingleLineStringKml() {
+		//KML 2.2 output
+		$doc = new DOMDocument("1.0", CHARSET);
+		$doc->preserveWhiteSpace = false;
+	
+		// attach kml and Document tag
+		$e_kml = $doc->createElementNS("http://earth.google.com/kml/2.2", "kml");
+		$e_document = $doc->createElement("Document");
+		$e_kml->appendChild($e_document);
+		$doc->appendChild($e_kml);
+	
+		// attach placemarks
+		$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
+
+		$lineStyleNode = $doc->createElement("Style");
+		$lineStyleNode->setAttribute("id", "linestyleExample");
+		$lineStyleColorNode = $doc->createElement("color", "7f0000ff");
+		$lineStyleWidthNode = $doc->createElement("width", 4);
+		$lineStyleNode->appendChild($lineStyleColorNode);
+		$lineStyleNode->appendChild($lineStyleWidthNode);
+		$e_document->appendChild($lineStyleNode);
+		
+		//
+		// line segments first
+		//
+		$coordinates = "";
+
+		for ($i = 0; $i < count($this->placemarkArray); $i++) {
+			$currentPlacemark = $this->placemarkArray[$i];
+			$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
+
+			switch ($currentPlacemark->getGeometryType()) {
+				case "KMLLine" :
+					$coordinatesArray = $currentPlacemark->getGeometry()->getPointArray();
+					for ($j = 0; $j < count($coordinatesArray); $j++) {
+						if (!($j == 0 && $i == 0)) {
+							$coordinates .= " ";
+						}
+						$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . "," . $coordinatesArray[$j]["z"];
+						
+					}
+					break;
+			}
+		}
+		// create a placemark tag with a geometry and add it to the document
+		$e_coordinates = $doc->createElement("coordinates", $coordinates);
+		$e_geometry = $doc->createElement("LineString");
+		$e_geometry->appendChild($e_coordinates);
+		$e_placemark = $doc->createElement("Placemark");
+		$e_placemark->appendChild($e_geometry);
+		$e_pl_name = $doc->createElement("name", "Route");
+		$e_placemark->appendChild($e_pl_name);
+		$e_pl_style = $doc->createElement("styleUrl", "#linestyleExample");
+		$e_placemark->appendChild($e_pl_style);
+		$e_document->appendChild($e_placemark);
+		
+/*		
+		//
+		// now pois
+		//
+		// attach placemarks
+		$e = new mb_notice("to string: #placemarks: " . count($this->placemarkArray));
+		for ($i = 0; $i < count($this->placemarkArray); $i++) {
+			$currentPlacemark = $this->placemarkArray[$i];
+
+			$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
+			
+			$pl_instructions = $currentPlacemark->getProperty("instruction");
+			$pl_name_array = array();
+			$pl_name = false;
+			$pl_description = false;
+			if ($pl_instructions != null) {
+				$pl_name_array = explode("|", $pl_instructions);
+			}
+
+			switch ($currentPlacemark->getGeometryType()) {
+				case "KMLPoint" :
+					if (count($pl_name_array) > 2) {
+						$pl_name = $pl_name_array[0];
+						$pl_description = $pl_name_array[1];
+					}
+					$e_geometry = $doc->createElement("Point");
+					$point = $currentPlacemark->getGeometry()->getPoint();
+					$coordinates = $point["x"] . "," . $point["y"];
+					$e_coordinates = $doc->createElement("coordinates", $coordinates);
+					$e_geometry->appendChild($e_coordinates);
+					break;
+
+			}
+			// create a placemark tag with a geometry and add it to the document
+			if ($e_geometry) {
+				$e_placemark = $doc->createElement("Placemark");
+				$e_placemark->appendChild($e_geometry);
+				if ($pl_name) {
+					$e_pl_name = $doc->createElement("name", $pl_name);
+					$e_placemark->appendChild($e_pl_name);
+				}
+				if ($pl_description) {
+					$e_pl_description = $doc->createElement("description", $pl_description);
+					$e_placemark->appendChild($e_pl_description);
+				}
+				$e_document->appendChild($e_placemark);
+			}
+		}
+*/
+		return $doc->saveXML();
+	}
+	
 	/**
 	 * @return string the KML document.
 	 */
@@ -69,9 +177,20 @@
 
 				$e = new mb_notice("now: " . $i . " of " . (count($this->placemarkArray)-1) . " (is a " . get_class($currentPlacemark) . ")");
 				
+				$pl_instructions = $currentPlacemark->getProperty("instruction");
+				$pl_name_array = array();
+				$pl_name = false;
+				$pl_description = false;
+				if ($pl_instructions != null) {
+					$pl_name_array = explode("|", $pl_instructions);
+				}
 
 				switch ($currentPlacemark->getGeometryType()) {
 					case "KMLPoint" :
+						if (count($pl_name_array) > 2) {
+							$pl_name = $pl_name_array[0];
+							$pl_description = $pl_name_array[1];
+						}
 						$e_geometry = $doc->createElement("Point");
 						$point = $currentPlacemark->getGeometry()->getPoint();
 						$coordinates = $point["x"] . "," . $point["y"];
@@ -100,6 +219,9 @@
 						break;
 */					
 					case "KMLLine" :
+						if (count($pl_name_array) > 2) {
+							$pl_description = $pl_name_array[1];
+						}
 						$e_geometry = $doc->createElement("LineString");
 						$coordinatesArray = $currentPlacemark->getGeometry()->getPointArray();
 						$coordinates = "";
@@ -107,7 +229,7 @@
 							if ($j > 0) {
 								$coordinates .= " ";
 							}
-							$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . ",0";
+							$coordinates .= $coordinatesArray[$j]["x"] . "," . $coordinatesArray[$j]["y"] . "," . $coordinatesArray[$j]["z"];
 							
 						}
 						$e_coordinates = $doc->createElement("coordinates", $coordinates);
@@ -123,6 +245,14 @@
 				if ($e_geometry) {
 					$e_placemark = $doc->createElement("Placemark");
 					$e_placemark->appendChild($e_geometry);
+					if ($pl_name) {
+						$e_pl_name = $doc->createElement("name", $pl_name);
+						$e_placemark->appendChild($e_pl_name);
+					}
+					if ($pl_description) {
+						$e_pl_description = $doc->createElement("description", $pl_description);
+						$e_placemark->appendChild($e_pl_description);
+					}
 					$e_document->appendChild($e_placemark);
 				}
 			}
@@ -300,23 +430,29 @@
 	 * @return boolean true, if the KML could be stored in the database; else false.
 	 */
 	private function storeInDb () {
-		$con = db_connect(DBSERVER,OWNER,PW);
-		db_select_db(DB,$con);
-
-		$sql  = "INSERT INTO gui_kml ";
-		$sql .= "(fkey_mb_user_id, fkey_gui_id, kml_doc, kml_name, kml_description, kml_timestamp) ";
-		$sql .= "VALUES ";
-		$sql .= "($1, $2, $3, $4, $5, $6)";
-		$v = array ($_SESSION["mb_user_id"], $_SESSION["mb_user_gui"], $this->kml, "name", "description", time());
-		$t = array ("i", "s", "s", "s", "s", "s");
-		$res = db_prep_query($sql, $v, $t);
-		if (!$res) {
-			$e = new mb_exception("class_kml.php: storeInDb: failed to store KML in database: " . db_error());
-			return false;
+		if ($_SESSION["mb_user_id"] && $_SESSION["mb_user_gui"]) {
+			$con = db_connect(DBSERVER,OWNER,PW);
+			db_select_db(DB,$con);
+	
+			$sql  = "INSERT INTO gui_kml ";
+			$sql .= "(fkey_mb_user_id, fkey_gui_id, kml_doc, kml_name, kml_description, kml_timestamp) ";
+			$sql .= "VALUES ";
+			$sql .= "($1, $2, $3, $4, $5, $6)";
+			$v = array ($_SESSION["mb_user_id"], $_SESSION["mb_user_gui"], $this->kml, "name", "description", time());
+			$t = array ("i", "s", "s", "s", "s", "s");
+			$res = db_prep_query($sql, $v, $t);
+			if (!$res) {
+				$e = new mb_exception("class_kml.php: storeInDb: failed to store KML in database: " . db_error());
+				return false;
+			}
+	
+			$this->id = db_insert_id($con, "gui_kml", "kml_id");
+			return true;
 		}
-
-		$this->id = db_insert_id($con, "gui_kml", "kml_id");
-		return true;
+		else {
+			// should be false, but code in caller has to be changed first.
+			return true;
+		}
 	}
 
 	/**

Modified: branches/noframes/http/classes/class_kml_parser_ows.php
===================================================================
--- branches/noframes/http/classes/class_kml_parser_ows.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_kml_parser_ows.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -44,6 +44,9 @@
 		$id = 0;
 		
 		if (gettype($geometryFromGeoJSON) == "object" && $geometryFromGeoJSON->type == "FeatureCollection") {
+			if ($geometryFromGeoJSON->crs->type == "EPSG" && $geometryFromGeoJSON->crs->properties->code) {
+				$epsg = $geometryFromGeoJSON->crs->properties->code;	
+			}
 			// create Placemarks
 			for ($i = 0; $i < count($geometryFromGeoJSON->features); $i++) {
 				$e = new mb_notice("parsing plm #" . $i . "...length of placemarkArray: " . count($this->placemarkArray));
@@ -52,7 +55,9 @@
 					if ($feature->geometry->crs->type == "EPSG") {
 						$epsg = $feature->geometry->crs->properties->code;	
 					}
-					$e = new mb_notice("EPSG: " . $epsg);
+					if (!$epsg) {
+						$e = new mb_notice("EPSG is not set! Aborting...(" . $epsg . ")");
+					}
 					$geometry = $feature->geometry;
 					
 					$currentGeometry = false;

Modified: branches/noframes/http/classes/class_kml_placemark.php
===================================================================
--- branches/noframes/http/classes/class_kml_placemark.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_kml_placemark.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -54,7 +54,7 @@
 	 * @return mixed       the property value; if none exists, null.
 	 */
 	public function getProperty ($key) {
-		if (array_key_exists($key)) {
+		if (array_key_exists($key, $this->properties)) {
 			return $this->properties[$key];
 		}
 		$e = new mb_exception("class_kml_placemark.php: getProperty: no value for key '" . $key . "'");

Modified: branches/noframes/http/classes/class_kml_point.php
===================================================================
--- branches/noframes/http/classes/class_kml_point.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_kml_point.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -41,12 +41,12 @@
 		if (preg_match("/,/", $geometryString)) {
 			$aPoint = explode(",", $geometryString);
 			// ignore altitude
-			$pt = new Mapbender_point($aPoint[0], $aPoint[1], $epsg);
+			$pt = new Mapbender_point($aPoint[0], $aPoint[1], $aPoint[2], $epsg);
 		}
 		else {
 			$aPoint = explode(" ", $geometryString);
 			// ignore altitude
-			$pt = new Mapbender_point($aPoint[0], $aPoint[1], $epsg);
+			$pt = new Mapbender_point($aPoint[0], $aPoint[1], $aPoint[2], $epsg);
 		}
 
 		// KML only supperts EPSG 4326, so
@@ -54,7 +54,7 @@
 		if (isset($epsg) && $epsg != 4326) {
 			$pt->transform(4326);
 		}
-		$this->point = array("x" => $pt->x, "y" => $pt->y);
+		$this->point = array("x" => $pt->x, "y" => $pt->y, "z" => $pt->z);
 	}
 
 	/**
@@ -69,7 +69,12 @@
 	 */
 	public function toGeoJSON () {
 		if ($this->point !== null) {
-			return "{\"type\": \"Point\", \"coordinates\": [".$this->point["x"].",".$this->point["y"]."]}";
+			if ($this->point["z"]) {
+				return "{\"type\": \"Point\", \"coordinates\": [".$this->point["x"].",".$this->point["y"].",".$this->point["z"]."]}";
+			}
+			else {
+				return "{\"type\": \"Point\", \"coordinates\": [".$this->point["x"].",".$this->point["y"]."]}";
+			}
 		}
 
 		$e = new mb_exception("KMLPoint: toGeoJSON: this point is null.");
@@ -77,14 +82,14 @@
 	}
 
 	/**
-	 * @return array a point as associative array, coordinates as ["x"] and ["y"]
+	 * @return array a point as associative array, coordinates as ["x"] and ["y"] and ["z"]
 	 */
 	public function getPoint () {
 		return $this->point;
 	}
 		
 	/**
-	 * @var	float[] an associative array, with "x", and "y" being float values.
+	 * @var	float[] an associative array, with "x", and "y"  and "z" being float values.
 	 */
 	private $point;
 }

Modified: branches/noframes/http/classes/class_locale.php
===================================================================
--- branches/noframes/http/classes/class_locale.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_locale.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -1,216 +1,218 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/class_locale.php
-# 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_once(dirname(__FILE__)."/../../core/globalSettings.php");
-
-/**
- * sets the locale, depending on various settings:
- * 1) a language ID passed to the constructor
- * 2) the browser settings $_SERVER["HTTP_ACCEPT_LANGUAGE"]
- * 3) a default language ID
- * 
- */
-class Mb_locale {
-	var $knownLanguages = null;
-	var $systemLocales = null;
-	var $browserLanguages = null;
-	var $os = null;
-	var $name = null;
-	var $defaultLanguage = "en";
-	var $status = "No locale set.";
-	
-	function Mb_locale($languageId) {
-		if (!$languageId) {
-			$languageId = LANGUAGE;
-		}
-  		$e = new Mb_notice("class_locale: setting locale to " . $languageId);
-		if (USE_I18N) {
-			if (!$this->setCurrentLocale($languageId)) {
-				$e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
-			}
-		}
-		else {
-			$this->setCurrentLocale($this->defaultLanguage);
-		}
-	}
-
-	/**
-	 * Get the current locale, evaluating GET/POST variables, browser languages
-	 * and a default locale (in that preference)
-	 *
-	 * @returns current locale
-	 */
-	function setCurrentLocale($languageId) {
-
-	  	// try to set the locale to $languageId
-		if ($this->checkAndSetLocale($languageId)) {
-			return true;
-	  	}
-	  	else {
-	  		$e = new Mb_notice("class_locale: no input parameter specified.");
-	  	}
-
-		// determine the browser setting and try to set locale according to that
-		if ($this->browserLanguage == null) {
-			$this->setBrowserLanguages();
-		}		
-		foreach ($this->browserLanguages as $lang) {
-			$e = new Mb_notice("trying browser setting " . $lang);
-			if ($this->checkAndSetLocale($lang)) {
-				return true;
-			}
-		}	
-		
-		// set to default language
-		$e = new Mb_notice("trying default language " . $this->defaultLanguage);
-		return $this->checkAndSetLocale($this->defaultLanguage);
-	}
-	
-	/**
-	 * checks if a locale is available; if yes, it is set via setlocale
-	 * 
-	 * @returns true if the the locale is set successfully; otherwise false
-	 */
-	function checkAndSetLocale($languageId) {
-		if ($this->os == null) {
-			$this->os = $this->guessHostOS();
-		}
-		
-		if (!USE_I18N || ($this->os != null && isset($languageId))) {
-			if ($this->isKnownLanguage($languageId)) {
-				
-				if ($this->systemLocales == null) {
-					$this->setSystemLocales();					
-				}
-				
-				$locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];				
-				$selectedLocale = setlocale(LC_MESSAGES, $locale);
-				if ($selectedLocale) {
-					$this->name = $selectedLocale;
-					$_SESSION["mb_lang"] = $languageId;
-					$_SESSION["mb_locale"] = $this->name;
-					$e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
-					// from http://de3.php.net/manual/de/function.gettext.php
-					$path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
-					$enc = bind_textdomain_codeset("Mapbender", "UTF-8");
-					$dom = textdomain("Mapbender");
-					return true;
-				}
-			}
-		}
-		$e = new Mb_notice("locale " . $locale . " not found.");
-		return false;
-	}
-	
-	/**
-	 * Guess the operating system which on which this code is running
-	 * multiple methods are tested for reliably guessing the os
-	 * 
-	 * @private
-	 * @returns string with os name
-	 */
-	function guessHostOS(){
-	  if (strncasecmp(php_uname(), 'Windows', 7) == 0)
-	    return 'windows';
-	  else if (strncasecmp(php_uname(), 'Linux', 5) == 0)
-	    return 'linux';
-	  else if (strncasecmp(php_uname(), 'OpenBSD', 7) == 0)
-	    return 'bsd';
-	  else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0)
-	    return 'bsd';  
-	  else {
-	    $e = new mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
-	    return null;
-	  }
-	}
-
-	/**
-	 * checks if a language is supported
-	 * 
-	 * @returns true if the language is supported; otherwise false
-	 */
-	function isKnownLanguage($languageId) {
-		if ($this->knownLocales == null) {
-			$this->setKnownLanguages();
-		}
-		if (array_key_exists($languageId, $this->knownLanguages)) {
-			return true;
-		}
-		else {
-			$e = new Mb_notice("language " . $languageId . " not supported.");
-		}	
-		return false; 
-	}
-	
-
-
-	/**
-	 * determines the available Locales on this system
-	 */
-	function setSystemLocales() {
-		$this->systemLocales['it_IT'] = array('linux' => 'it_IT.utf8',
-	                                'windows' => 'Italian_Italy.1252',
-	                                'bsd' => 'it_IT',
-	                                'posix' => 'it_IT');
-		$this->systemLocales['de_DE'] = array('linux' => 'de_DE.utf8',
-	                                'windows' => 'German_Germany.1252',
-	                                'bsd' => 'de_DE',
-	                                'posix' => 'it_IT');
-		$this->systemLocales['en_US'] = array('linux' => 'en_US.utf8',
-	                                'windows' => 'English_United States.1252',
-	                                'bsd' => 'en_US',
-	                                'posix' => 'it_IT');
-	}
-	
-	/**
-	 * set the known languages
-	 */
-	function setKnownLanguages() {
-		$this->knownLanguages = array('en_US' => 'en_US',
-                      'en' => 'en_US',
-                      'de_DE' => 'de_DE',
-                      'de' => 'de_DE',
-                      'bg_BG' => 'bg_BG',
-                      'bg' => 'bg_BG',
-                      'es_ES' => 'es_ES',
-                      'es' => 'es_ES',  
-                      'nl_NL' => 'nl_NL',
-                      'nl' => 'nl_NL',                                                                
-                      'gr_GR' => 'gr_GR',
-                      'gr' => 'gr_GR',
-                      'it_IT' => 'it_IT',
-                      'it' => 'it_IT');
-	}
-	
-	/**
-	 * sets the languages accepted by the client browser
-	 */
-	function setBrowserLanguages () {
-		$this->browserLanguages = array();
-		
-	    $bLangs = split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
-	    foreach ($bLangs as $lang) {
-			if (strpos($lang, ';') === false)
-				array_push($this->browserLanguages, $lang);
-			else
-				array_push($this->browserLanguages, substr($lang, 0, strpos($lang, ';')));
-	    }		
-	}
-}
-?>
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/class_locale.php
+# 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_once(dirname(__FILE__)."/../../core/globalSettings.php");
+
+/**
+ * sets the locale, depending on various settings:
+ * 1) a language ID passed to the constructor
+ * 2) the browser settings $_SERVER["HTTP_ACCEPT_LANGUAGE"]
+ * 3) a default language ID
+ *
+ */
+class Mb_locale {
+        var $knownLanguages = null;
+        var $systemLocales = null;
+        var $browserLanguages = null;
+        var $os = null;
+        var $name = null;
+        var $defaultLanguage = "en";
+        var $status = "No locale set.";
+
+        function Mb_locale($languageId) {
+                if (!$languageId) {
+                        $languageId = LANGUAGE;
+                }
+                  $e = new Mb_notice("class_locale: setting locale to " . $languageId);
+                if (USE_I18N) {
+                        if (!$this->setCurrentLocale($languageId)) {
+                                $e = new Mb_exception("Locale could not be set. Language ID: '" . $languageId . "'");
+                        }
+                }
+                else {
+                        $this->setCurrentLocale($this->defaultLanguage);
+                }
+        }
+
+        /**
+         * Get the current locale, evaluating GET/POST variables, browser languages
+         * and a default locale (in that preference)
+         *
+         * @returns current locale
+         */
+        function setCurrentLocale($languageId) {
+
+                  // try to set the locale to $languageId
+                if ($this->checkAndSetLocale($languageId)) {
+                        return true;
+                  }
+                  else {
+                          $e = new Mb_notice("class_locale: no input parameter specified.");
+                  }
+
+                // determine the browser setting and try to set locale according to that
+                if ($this->browserLanguage == null) {
+                        $this->setBrowserLanguages();
+                }
+                foreach ($this->browserLanguages as $lang) {
+                        $e = new Mb_notice("trying browser setting " . $lang);
+                        if ($this->checkAndSetLocale($lang)) {
+                                return true;
+                        }
+                }
+
+                // set to default language
+                $e = new Mb_notice("trying default language " . $this->defaultLanguage);
+                return $this->checkAndSetLocale($this->defaultLanguage);
+        }
+
+        /**
+         * checks if a locale is available; if yes, it is set via setlocale
+         *
+         * @returns true if the the locale is set successfully; otherwise false
+         */
+        function checkAndSetLocale($languageId) {
+                if ($this->os == null) {
+                        $this->os = $this->guessHostOS();
+                }
+
+                if (!USE_I18N || ($this->os != null && isset($languageId))) {
+                        if ($this->isKnownLanguage($languageId)) {
+
+                                if ($this->systemLocales == null) {
+                                        $this->setSystemLocales();
+                                }
+
+                                $locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];
+                                $selectedLocale = setlocale(LC_MESSAGES, $locale);
+                                if ($selectedLocale) {
+                                        $this->name = $selectedLocale;
+                                        $_SESSION["mb_lang"] = $languageId;
+                                        $_SESSION["mb_locale"] = $this->name;
+                                        $e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
+                                        // from http://de3.php.net/manual/de/function.gettext.php
+                                        $path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
+                                        $enc = bind_textdomain_codeset("Mapbender", "UTF-8");
+                                        $dom = textdomain("Mapbender");
+                                        return true;
+                                }
+                        }
+                }
+                $e = new Mb_notice("locale " . $locale . " not found.");
+                return false;
+        }
+
+        /**
+         * Guess the operating system which on which this code is running
+         * multiple methods are tested for reliably guessing the os
+         *
+         * @private
+         * @returns string with os name
+         */
+        function guessHostOS(){
+          if (strncasecmp(php_uname(), 'Windows', 7) == 0)
+            return 'windows';
+          else if (strncasecmp(php_uname(), 'Linux', 5) == 0)
+            return 'linux';
+          else if (strncasecmp(php_uname(), 'OpenBSD', 7) == 0)
+            return 'bsd';
+          else if (strncasecmp(php_uname(), 'FreeBSD', 7) == 0)
+            return 'bsd';
+          else {
+            throw new Mb_exception('unknown platform: could not interpret uname. php_uname() returned '. php_uname().'. Please report to MB developers');
+            return null;
+          }
+        }
+
+        /**
+         * checks if a language is supported
+         *
+         * @returns true if the language is supported; otherwise false
+         */
+        function isKnownLanguage($languageId) {
+                if ($this->knownLocales == null) {
+                        $this->setKnownLanguages();
+                }
+                if (array_key_exists($languageId, $this->knownLanguages)) {
+                        return true;
+                }
+                else {
+                        $e = new Mb_notice("language " . $languageId . " not supported.");
+                }
+                return false;
+        }
+
+
+
+        /**
+         * determines the available Locales on this system
+         */
+        function setSystemLocales() {
+                $this->systemLocales['it_IT'] = array('linux' => 'it_IT.utf8',
+                                        'windows' => 'Italian_Italy.1252',
+                                        'bsd' => 'it_IT',
+                                        'posix' => 'it_IT');
+                $this->systemLocales['de_DE'] = array('linux' => 'de_DE.utf8',
+                                        'windows' => 'German_Germany.1252',
+                                        'bsd' => 'de_DE',
+                                        'posix' => 'de_DE');
+                $this->systemLocales['en_US'] = array('linux' => 'en_US.utf8',
+                                        'windows' => 'English_United States.1252',
+                                        'bsd' => 'en_US',
+                                        'posix' => 'en_US');
+        }
+
+        /**
+         * set the known languages
+         */
+        function setKnownLanguages() {
+                $this->knownLanguages = array('en_US' => 'en_US',
+                      'en' => 'en_US',
+                      'de_DE' => 'de_DE',
+                      'de' => 'de_DE',
+                      'bg_BG' => 'bg_BG',
+                      'bg' => 'bg_BG',
+                      'es_ES' => 'es_ES',
+                      'es' => 'es_ES',
+                      'nl_NL' => 'nl_NL',
+                      'nl' => 'nl_NL',
+					  'fr_FR' => 'fr_FR',
+                      'fr' => 'fr_FR',
+                      'gr_GR' => 'gr_GR',
+                      'gr' => 'gr_GR',
+                      'it_IT' => 'it_IT',
+                      'it' => 'it_IT');
+        }
+
+        /**
+         * sets the languages accepted by the client browser
+         */
+        function setBrowserLanguages () {
+                $this->browserLanguages = array();
+
+            $bLangs = split(',', $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+            foreach ($bLangs as $lang) {
+                        if (strpos($lang, ';') === false)
+                                array_push($this->browserLanguages, $lang);
+                        else
+                                array_push($this->browserLanguages, substr($lang, 0, strpos($lang, ';')));
+            }
+        }
+}
+?>
\ No newline at end of file

Modified: branches/noframes/http/classes/class_point.php
===================================================================
--- branches/noframes/http/classes/class_point.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_point.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -20,22 +20,30 @@
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 
 /**
- * A Mapbender_point is a 2-dimensional point with an EPSG. 
+ * A Mapbender_point is a 2- or 3-dimensional point with an EPSG. 
  */
 class Mapbender_point {
 	var $x;
 	var $y;
+	var $z;
 	var $epsg;
 	
 	/**
 	 * @constructor
 	 */
-	function __construct($x, $y, $epsg) {
-		if (!$x || !$y || !$epsg) {
-			$e = new mb_exception("Mapbender_point: constructor: some parameters are not set (set (x: ".$x.", y: ".$y.", epsg:".$epsg.")!");
+	function __construct($x, $y, $z, $epsg) {
+		// may be called without $z; so $epsg is the third parameter, $z
+		if (isset($x) && isset($y) && isset($z) && !isset($epsg)) {
+			$e = new mb_notice("Mapbender_point: constructor: probably 2d call (x: ".$x.", y: ".$y.", z: ".$z.", epsg:".$epsg.")!");
+			$epsg = $z;
+			$z = false;
 		}
+		if (!isset($x) || !isset($y) || !isset($epsg)) {
+			$e = new mb_exception("Mapbender_point: constructor: some parameters are not set (set (x: ".$x.", y: ".$y.", z: ".$z.", epsg:".$epsg.")!");
+		}
 		$this->x = $x;
 		$this->y = $y;
+		$this->z = $z;
 		$this->epsg = $epsg;
 	}
 	
@@ -136,11 +144,20 @@
 			$currentEpsg = preg_replace("/EPSG:/", "", $this->epsg);
 			$targetEpsg = preg_replace("/EPSG:/", "", $toEpsg);
 			$sql = "SELECT X(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as x, ";
-			$sql .= "Y(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as y";
+			$sql .= "Y(transform(GeometryFromText('POINT(".$this->x." ".$this->y.")',".$currentEpsg."),".$targetEpsg.")) as y, ";
+			if (isset($this->z)) {
+				$sql .= "Z(transform(GeometryFromText('POINT(".$this->x." ".$this->y." ".$this->z.")',".$currentEpsg."),".$targetEpsg.")) as z";
+			}
 			$res = db_query($sql);
-			$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), $toEpsg);
+			if (isset($this->z)) {
+				$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), db_result($res,0,"z"), $toEpsg);
+			}
+			else {
+				$point = new Mapbender_point(db_result($res,0,"x"), db_result($res,0,"y"), $toEpsg);
+			}
 			$this->x = $point->x;
 			$this->y = $point->y;
+			$this->z = $point->z;
 			$this->epsg = $point->epsg;
 		}
 		else {
@@ -169,7 +186,7 @@
 	}
 	
 	function __toString() {
-		return (string) "(" . $this->x . "," . $this->y . "," . $this->epsg . ")";
+		return (string) "(" . $this->x . "," . $this->y . "," . $this->z . "," . $this->epsg . ")";
 	}
 }
 ?>

Modified: branches/noframes/http/classes/class_wfs.php
===================================================================
--- branches/noframes/http/classes/class_wfs.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_wfs.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -22,8 +22,8 @@
 */
 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
-require_once(dirname(__FILE__)."/class_connector.php");
-require_once(dirname(__FILE__)."/class_administration.php");
+require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_administration.php");
 
 class wfs {
 
@@ -64,7 +64,7 @@
 	$values = null;
 	$tags = null;
 	$admin = new administration();
-	$this->wfs_getcapabilities_doc = $admin->char_encode($data);
+	$this->wfs_getcapabilities_doc = $admin->char_encode($data);
 	$this->wfs_upload_url = $url;
 	
 	# for temporary wfs a id has to be created...
@@ -75,7 +75,7 @@
 	xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
 	xml_parse_into_struct($parser,$this->wfs_getcapabilities_doc,$values,$tags);
 	//xml_parse_into_struct($parser,$data,$values,$tags);
-	
+	
 	xml_parser_free($parser);
 	
 	$section = false;
@@ -115,7 +115,7 @@
 			if(strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
 				$section = "getcapabilities";
 			}
-			if($section == "getcapabilities" && strtoupper($element[tag]) == "GET"){
+			if($section == "getcapabilities" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_getcapabilities = $element[attributes][onlineResource];
 			}
 			
@@ -126,7 +126,7 @@
 				
 				
 			}
-			if($section == "describefeaturetype" && strtoupper($element[tag]) == "GET"){
+			if($section == "describefeaturetype" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_describefeaturetype = $element[attributes][onlineResource];
 			}
 			
@@ -134,7 +134,7 @@
 			if(strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "open"){
 				$section = "getfeature";
 			}
-			if($section == "getfeature" && strtoupper($element[tag]) == "GET"){
+			if($section == "getfeature" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_getfeature = $element[attributes][onlineResource];
 			}
 			if(strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "close"){
@@ -144,7 +144,7 @@
 			if(strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "open"){
 				$section = "transaction";
 			}
-			if($section == "transaction" && strtoupper($element[tag]) == "GET"){
+			if($section == "transaction" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_transaction = $element[attributes][onlineResource];
 			}
 			if(strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "close"){
@@ -195,7 +195,7 @@
 } 
 function addFeaturetype($name,$title,$abstract,$srs,$url,$version){
 	$this->wfs_featuretype[count($this->wfs_featuretype)] = new featuretype($name,$title,$abstract,$srs,$url,$version);
-}
+}
  function stripEndlineAndCarriageReturn($string) {
 	  	return preg_replace("/\n/", "", preg_replace("/\r/", " ", $string));
 	  }
@@ -565,7 +565,7 @@
 			if(strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
 				$section = "getcapabilities";
 			}
-			if($section == "getcapabilities" && strtoupper($element[tag]) == "GET"){
+			if($section == "getcapabilities" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_getcapabilities = $element[attributes][onlineResource];
 			}
 			
@@ -576,7 +576,7 @@
 				
 				
 			}
-			if($section == "describefeaturetype" && strtoupper($element[tag]) == "GET"){
+			if($section == "describefeaturetype" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_describefeaturetype = $element[attributes][onlineResource];
 			}
 			
@@ -584,7 +584,7 @@
 			if(strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "open"){
 				$section = "getfeature";
 			}
-			if($section == "getfeature" && strtoupper($element[tag]) == "GET"){
+			if($section == "getfeature" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_getfeature = $element[attributes][onlineResource];
 			}
 			if(strtoupper($element[tag]) == "GETFEATURE" && $element[type] == "close"){
@@ -594,7 +594,7 @@
 			if(strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "open"){
 				$section = "transaction";
 			}
-			if($section == "transaction" && strtoupper($element[tag]) == "GET"){
+			if($section == "transaction" && strtoupper($element[tag]) == "POST"){
 				$this->wfs_transaction = $element[attributes][onlineResource];
 			}
 			if(strtoupper($element[tag]) == "TRANSACTION" && $element[type] == "close"){
@@ -808,4 +808,4 @@
 		}		
 	}
 }
-?>
+?>
\ No newline at end of file

Modified: branches/noframes/http/classes/class_wfs_conf.php
===================================================================
--- branches/noframes/http/classes/class_wfs_conf.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/classes/class_wfs_conf.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -93,27 +93,19 @@
 	 * @param $idArray Array an array of integer values representing WFS conf IDs.
 	 */
 	private static function getWfsConfFromDbByArray ($idArray) {
-		$sql = "SELECT * FROM wfs_conf ";
-		$sql .= "JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
-		$sql .= "WHERE wfs_conf.wfs_conf_id IN (";
-		
-		$v = array();
-		$t = array();
-		for ($i = 0; $i < count($idArray); $i++) {
-			if ($i > 0) {$sql .= ", ";}
-			$sql .= "$" . ($i+1);
-			array_push($v, $idArray[$i]);
-			array_push($t, 'i');
-		}
-		$sql .= ")";
-		
-		$res = db_prep_query($sql, $v, $t);
-		
 		$rowArray = array();
-		while ($row = db_fetch_array($res)) {
-			array_push($rowArray, $row);
-		}
-		return $rowArray;
+        foreach ($idArray as $id) {
+        		$sql = "SELECT * FROM wfs_conf ";
+                $sql .= "JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
+                $sql .= "WHERE wfs_conf.wfs_conf_id = $1 LIMIT 1";
+        
+                $v = array($id);
+                $t = array("i");
+                $res = db_prep_query($sql, $v, $t);
+                $row = db_fetch_array($res);
+                array_push($rowArray, $row);
+        }
+        return $rowArray;
 	}
 	
 	/**

Modified: branches/noframes/http/javascripts/geometry.js
===================================================================
--- branches/noframes/http/javascripts/geometry.js	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/geometry.js	2008-10-03 08:42:59 UTC (rev 3100)
@@ -231,7 +231,7 @@
 	var q = this.get(0).get(0).get(0);
 	var min = cloneObject(q);
 	var max = cloneObject(q);
-	for(var i=0; i<this.count();i++){
+	for(var i=0; i < this.count();i++){
 		var pos = this.get(i).getBBox();
 		if (pos[0].x < min.x) {min.x = pos[0].x;}
 		if (pos[1].x > max.x) {max.x = pos[1].x;}
@@ -363,7 +363,7 @@
 																		this.addMember(geomType.point);
 																		
 																		this.get(-1).addGeometry();
-																		this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1]);
+																		this.getGeometry(-1,-1).addPointByCoordinates(coordinates[0], coordinates[1], coordinates[2]);
 																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		this.close();
 																		break;
@@ -376,7 +376,7 @@
 																		this.get(-1).addGeometry();
 																		for (var m = 0; m < coordinates.length; m++) {
 																			var currentPoint = coordinates[m];
-																			this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
+																			this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
 																		}
 																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		this.close();
@@ -392,7 +392,7 @@
 																			var currentLine = coordinates[m];
 																			for (var n = 0; n < currentLine.length; n++) {
 																				var currentPoint = currentLine[n];
-																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
+																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
 																			}
 																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		}
@@ -409,7 +409,7 @@
 																			var currentPolygon = coordinates[m];
 																			for (var n = 0; n < currentPolygon.length; n++) {
 																				var currentPoint = currentPolygon[n];
-																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
+																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
 																			}
 																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		}
@@ -426,7 +426,7 @@
 																			var currentPolygon = coordinates[m];
 																			for (var n = 0; n < currentPolygon.length; n++) {
 																				var currentPoint = currentPolygon[n];
-																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
+																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1], currentPoint[2]);
 																			}
 																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		}
@@ -1395,7 +1395,7 @@
 
 	var diameter = 8;
 	var minWidth = 8;
-	var lineWidth = aLineWidth;
+	var lineWidth = aLineWidth || 2;
 	var mapframe = aMapframe;
 	var mapObjInd = getMapObjIndexByName(mapframe);
 	var mapframeWidth = mb_mapObj[mapObjInd].width;
@@ -1861,7 +1861,7 @@
 	for (attr in a) {
 		var b = a[attr];
 		if (typeof(b) == "object") {z += objString(b);}
-		else {z += attr + " " + b + "\n";alert(attr + " " + b);}
+		else {z += attr + " " + b + "\n";}
 	}	
 	return z;
 }

Modified: branches/noframes/http/javascripts/mod_highlightPOI.php
===================================================================
--- branches/noframes/http/javascripts/mod_highlightPOI.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/mod_highlightPOI.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -67,14 +67,14 @@
 
 function mod_highlightPOI_init(){
 		var myPOI = "<?php if (CHARSET == 'UTF-8'){
-				echo utf8_encode($_SESSION['mb_myPOI']);
+				echo preg_replace("/\n/", "<br>", $_SESSION['mb_myPOI']);
 			}else{
-				echo $_SESSION['mb_myPOI'];
+				echo preg_replace("/\n/", "<br>", utf8_decode($_SESSION['mb_myPOI']));
 			} 
 			?>";
 
 	if(myPOI != ""){
- 		mod_highlightPOI_params = myPOI.split(",");
+ 		mod_highlightPOI_params = myPOI.split("|");
 
 	  
   

Modified: branches/noframes/http/javascripts/mod_savewmc.php
===================================================================
--- branches/noframes/http/javascripts/mod_savewmc.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/mod_savewmc.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -36,7 +36,10 @@
 try {if (saveInSession) {}}catch(e) {saveInSession = 0;}
 
 if (saveInSession == 1) {
-	mb_registerInitFunctions('setOnUnload()');
+	eventAfterMapRequest.register(function () {
+		mod_savewmc_session();
+	});
+//	mb_registerInitFunctions('setOnUnload()');
 }
 
 <?php 

Modified: branches/noframes/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- branches/noframes/http/javascripts/mod_wfs_SpatialRequest.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/mod_wfs_SpatialRequest.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -60,7 +60,6 @@
 var button_rectangle = "rectangle";
 var button_extent = "extent";
 var button_dialogue = "dialogue";
-var mb_wfs_tolerance = 8;
 
 var activeButton = null;
 var mod_wfs_spatialRequest_geometry = null;
@@ -576,7 +575,7 @@
 		var mapPosYRemovePix = mapPos[1] - buffer;
 		var realWorld1 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYRemovePix);
 		var realWorld2 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
-		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYAddPix);
+		var realWorld3 = makeClickPos2RealWorldPos("mapframe1",mapPosXAddPix,mapPosYRemovePix);
 		var realWorld4 = makeClickPos2RealWorldPos("mapframe1",mapPosXRemovePix,mapPosYAddPix);
 		for(var i=0; i<js_wfs_conf_id.length; i++){
 			var srs = wfs_config[js_wfs_conf_id[i]]['featuretype_srs'];
@@ -782,4 +781,4 @@
 }
 if(wfsResultToPopupDiv==1){
 	mb_registerWfsReadSubFunctions(function(geom){displayPopup(geom);});
-}
\ No newline at end of file
+}

Modified: branches/noframes/http/javascripts/mod_wfs_gazetteer_client.php
===================================================================
--- branches/noframes/http/javascripts/mod_wfs_gazetteer_client.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/mod_wfs_gazetteer_client.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -84,7 +84,6 @@
 var button_polygon = "polygon";
 var button_rectangle = "rectangle";
 var button_extent = "extent";
-var mb_wfs_tolerance = 8;
 
 var activeButton = null;
 var mod_wfs_spatialRequest_geometry = null;

Modified: branches/noframes/http/javascripts/wfs.js
===================================================================
--- branches/noframes/http/javascripts/wfs.js	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/wfs.js	2008-10-03 08:42:59 UTC (rev 3100)
@@ -1,33 +1,166 @@
-<?php
-#$Id$
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_wfs_spatialRequest.php,v 1.4 2006/03/08 15:26:26 c_baudson Exp $
-# 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.
+// ---------------------------------------------------------------------------------------------------------------
+// --- usemap (begin) --------------------------------------------------------------------------------------------
 
-session_start();
-import_request_variables("PG");
-require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-require_once(dirname(__FILE__) . "/../../conf/mapbender.conf");
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
+function mod_usemap(wfs_name) {
+	if (wfs_name == "") {
+		usemap = "";
+	}
+	var ind = getMapObjIndexByName(mb_wfs_target);
+	var myImg = window.frames[mb_wfs_target].document.getElementById("um_img").style; 
+	myImg.width = mb_mapObj[ind].width;
+	myImg.height = mb_mapObj[ind].height;
 
-$e_id_css = "wfs";
-include '../include/dyn_js.php';
-require_once(dirname(__FILE__) . "/wfs_usemap.js");
-?>
+	for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
+		if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
+		
+			if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
+				usemap += mod_usemap_polygon(i);
+			}
+			else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
+				usemap += mod_usemap_circle(i);
+			}
+			else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
+				usemap += mod_usemap_line(i);
+			}
+		}
+	}
+	writeUsemap(usemap);
+}
+
+function mod_usemap_circle(ind){
+	var str = "";
+	var coord = "";
+	
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var p = mb_wfs_fetch.getPoint(ind, i, 0);
+		var pos = realToMap(mb_wfs_target,p);
+		coord += pos.x + ", " + pos.y;
+		
+		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
+		str += coord + ", " + mod_usemap_radius + "' href='#'>";
+	}
+	
+	return str;
+}
+
+function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
+	var coord = "";
+
+	var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
+	var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
+
+	var vec = p2.minus(p1);
+	
+	if (vec.x != 0 || vec.y != 0) {
+		var n_vec;
+		if (vec.x != 0) {
+			if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
+			else n_vec = new Point(vec.y/vec.x, 1);
+		}
+		else {
+			if (vec.y > 0) n_vec = new Point(1,0);
+			else n_vec = new Point(-1,0);
+		}
+		n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
+
+		lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
+
+		if (cnt > 0) coord += ", ";
+
+		coord += parseInt(lp.x) + ", " + parseInt(lp.y);
+		coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
+	}
+	return coord;
+}
+
+function mod_usemap_line(ind){
+	var str = "";
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var coord = "";
+		var cnt = 0;
+
+		for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1  ; j ++) {
+			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
+			if (result != "") {
+				coord += result;
+				cnt++;
+			}
+		}
+		
+		for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
+			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
+			if (result != "") {
+				coord += result;
+				cnt++;
+			}
+		}
+		
+		if (coord != "") {
+			str += "<AREA title='"+title+"'";
+			str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
+			str += "shape='poly'  coords='";
+			str += coord + "' href='#'>";
+		}
+		else {
+			//display circle
+			var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
+			coord += pos.x + ", " + pos.y;
+			
+			str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
+			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
+			str += coord + ", " + mod_usemap_radius + "' href='#'>";
+		}
+	}
+	
+	return str;
+}
+
+function mod_usemap_polygon(ind){
+	var str = "";
+	var coord = "";
+	var title = "";
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
+		if (i>0) title += "&#10;";
+		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
+	}
+
+	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
+		var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
+		coord += pos.x + ", " + pos.y;
+		
+		for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
+			pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
+			coord += ", " + pos.x + ", " + pos.y;
+		}
+		
+		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
+		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly'  coords='";
+		str += coord + "' href='#'>";
+	}
+	
+	return str;
+}
+
+function writeUsemap(str) {
+	writeTag(mb_wfs_targets[0], 'um', str);
+}
+// --- usemap (end) ----------------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------
+
+
 var highlight_tag_id = "wfs_highlight_tag";
 var mb_wfs_fetched = [];
 
@@ -86,14 +219,14 @@
 		var ind = getMapObjIndexByName(mb_wfs_targets[0]);
 		var pos_a = makeClickPos2RealWorldPos(mb_wfs_targets[0],0,0);
 		var pos_b = makeClickPos2RealWorldPos(mb_wfs_targets[0],mb_mapObj[ind].width,mb_mapObj[ind].height);
-	
+
 		var x = [];
 		var y = [];
 		x[0] = pos_a[0];
 		x[1] = pos_b[0];
 		y[0] = pos_a[1];
 		y[1] = pos_b[1];
-		
+
 		mb_setwfsrequest(mb_wfs_targets[0],'rectangle',x,y);
 	}
 }
@@ -133,7 +266,7 @@
 function mb_wfs_reset(){
 	mb_wfs_fetch = new parent.GeometryArray();
 	usemap = "";
-	
+
 	if(mb_wfs_objwin == null){
 		var iframe=document.createElement('div');
 		iframe.setAttribute("style","position:absolute;left:"+mb_wfs_objwin_left+"px;top:"+mb_wfs_objwin_top+"px;width:"+mb_wfs_objwin_width+"px;height:"+mb_wfs_objwin_height+"px");
@@ -183,7 +316,7 @@
 		highlight.del(m, '#ff0000');
 		highlight.paint();
 	}
-	else 
+	else
 		if (type == 'click') {
 			var tmp = m.getBBox();
 			if (m.geomType == geomType.point) {
@@ -205,17 +338,17 @@
 
 function get_wfs_str(myconf, d, m, type, fid) {
 
-	<!-- Getting the Namspace for the FeautureType -->	
+	<!-- Getting the Namspace for the FeautureType -->
 	var featureTypeArray = myconf['featuretype_name'].split(':')
 	var featureNS = featureTypeArray[0];
 
 	var str = '<wfs:Transaction version="1.0.0" service="WFS" ';
 
 	var ns_gml = false;	var ns_ogc = false;	var ns_xsi = false;	var ns_wfs = false;	var ns_featureNS = false;
-	
+
 	for (var q = 0 ; q < myconf['namespaces'].length ; q++) {
-	
-		if (myconf['namespaces'][q]['name'] == "gml"){		
+
+		if (myconf['namespaces'][q]['name'] == "gml"){
 			 ns_gml = true;
 			 str += 'xmlns:' + myconf['namespaces'][q]['name'] + '="' + myconf['namespaces'][q]['location'] + '" ';
 		} else if (myconf['namespaces'][q]['name'] == "ogc") {
@@ -233,13 +366,13 @@
 			strForSchemaLocation = myconf['namespaces'][q]['location'];
 		}
 	}
-	
+
 	if (ns_gml == false) str += 'xmlns:gml="http://www.opengis.net/gml" ';
 	if (ns_ogc == false) str += 'xmlns:ogc="http://www.opengis.net/ogc" ';
 	if (ns_xsi == false) str += 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
 	if (ns_featureNS == false) str += 'xmlns:"+featureNS+"="http://www.someserver.com/"+featureNS+"" ';
 	if (ns_wfs == false) str += 'xmlns:wfs="http://www.opengis.net/wfs" ';
-	
+
 	str += 'xsi:schemaLocation="http://www.opengis.net/wfs';
 	str += ' http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd';
 	str += ' ' + strForSchemaLocation;
@@ -261,24 +394,24 @@
 		}
 		for(var j=0; j<myconf['element'].length; j++){
 			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];	
+				var el_geom = myconf['element'][j]['element_name'];
 			}
 		}
-		str += '<' + el_geom + '>';	
+		str += '<' + el_geom + '>';
 		if(d.get(m).geomType == geomType.point){
 			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:coordinates>';
-			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y; 
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
 			str += '</gml:coordinates>';
-			str += '</gml:Point>';		
+			str += '</gml:Point>';
 		}
 		if(d.get(m).geomType == geomType.line){
 			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			} 
+			}
 			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
 			str += '</gml:MultiLineString>';
 		}
@@ -287,12 +420,12 @@
 			str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
 
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			} 
+			}
 			str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>';
 		}
-		str += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';		
+		str += '</' + el_geom + '></'+ myconf['featuretype_name']+'></wfs:Insert>';
 	}
 	//
 	// --------------------------------------- UPDATE ------------------------------------------------
@@ -309,22 +442,22 @@
 		}
 		for(var j=0; j<myconf['element'].length; j++){
 			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];	
+				var el_geom = myconf['element'][j]['element_name'];
 			}
 		}
 		str += '<wfs:Property><wfs:Name>' + el_geom + '</wfs:Name><wfs:Value>';
 		if(d.get(m).geomType == geomType.point){
 			str += '<gml:Point srsName="' + myconf['featuretype_srs'] + '"><gml:coordinates>';
-			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y; 
-			str += '</gml:coordinates></gml:Point>';		
+			str += d.getPoint(m,0,0).x + "," + d.getPoint(m,0,0).y;
+			str += '</gml:coordinates></gml:Point>';
 		}
 		if(d.get(m).geomType == geomType.line){
 			str += '<gml:MultiLineString srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:lineStringMember><gml:LineString><gml:coordinates>';
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			} 
+			}
 			str += '</gml:coordinates></gml:LineString></gml:lineStringMember>';
 			str += '</gml:MultiLineString>';
 		}
@@ -332,9 +465,9 @@
 			str += '<gml:MultiPolygon srsName="' + myconf['featuretype_srs'] + '">';
 			str += '<gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>';
 			for(var k=0; k<d.getGeometry(m,0).count(); k++){
-				if(k>0)	str += " ";	
+				if(k>0)	str += " ";
 				str += d.getPoint(m,0,k).x + "," + d.getPoint(m,0,k).y;
-			} 
+			}
 			str += '</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon>';
 		}
 		str += '</wfs:Value></wfs:Property>';
@@ -348,13 +481,13 @@
 		str += '<wfs:Delete typeName="'+ myconf['featuretype_name']+'">';
 		for(var j=0; j<myconf['element'].length; j++){
 			if(myconf['element'][j]['f_geom'] == 1){
-				var el_geom = myconf['element'][j]['element_name'];	
+				var el_geom = myconf['element'][j]['element_name'];
 			}
 		}
 		str += '<ogc:Filter><ogc:FeatureId fid="'+fid+'"/></ogc:Filter>';
 		str += '</wfs:Delete>';
 	}
-	
+
 	str += '</wfs:Transaction>';
 	return str;
-}
+}
\ No newline at end of file

Deleted: branches/noframes/http/javascripts/wfs_usemap.js
===================================================================
--- branches/noframes/http/javascripts/wfs_usemap.js	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/javascripts/wfs_usemap.js	2008-10-03 08:42:59 UTC (rev 3100)
@@ -1,167 +0,0 @@
-/* 
-* $Id$
-* COPYRIGHT: (C) 2001 by ccgis. This program is free software under the GNU General Public
-* License (>=v2). Read the file gpl.txt that comes with Mapbender for details. 
-*/
-
-// ---------------------------------------------------------------------------------------------------------------
-// --- usemap (begin) --------------------------------------------------------------------------------------------
-
-function mod_usemap(wfs_name) {
-	if (wfs_name == "") {
-		usemap = "";
-	}
-	var ind = getMapObjIndexByName(mb_wfs_target);
-	var myImg = window.frames[mb_wfs_target].document.getElementById("um_img").style; 
-	myImg.width = mb_mapObj[ind].width;
-	myImg.height = mb_mapObj[ind].height;
-
-	for (var i = 0 ; i < mb_wfs_fetch.count() ; i ++) {
-		if (mb_wfs_fetch.get(i).wfs_conf == wfs_name || wfs_name == "") {
-		
-			if (mb_wfs_fetch.get(i).geomType == geomType.polygon) {
-				usemap += mod_usemap_polygon(i);
-			}
-			else if (mb_wfs_fetch.get(i).geomType == geomType.point) {
-				usemap += mod_usemap_circle(i);
-			}
-			else if (mb_wfs_fetch.get(i).geomType == geomType.line) {
-				usemap += mod_usemap_line(i);
-			}
-		}
-	}
-	writeUsemap(usemap);
-}
-
-function mod_usemap_circle(ind){
-	var str = "";
-	var coord = "";
-	
-	var title = "";
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
-		if (i>0) title += "&#10;";
-		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
-	}
-
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
-		var p = mb_wfs_fetch.getPoint(ind, i, 0);
-		var pos = realToMap(mb_wfs_target,p);
-		coord += pos.x + ", " + pos.y;
-		
-		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
-		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
-		str += coord + ", " + mod_usemap_radius + "' href='#'>";
-	}
-	
-	return str;
-}
-
-function mod_usemap_line_calculate (aGeometry, j, orientation, cnt) {
-	var coord = "";
-
-	var p1 = realToMap(mb_wfs_targets[0],aGeometry.get(j));
-	var p2 = realToMap(mb_wfs_targets[0],aGeometry.get(j+orientation));
-
-	var vec = p2.minus(p1);
-	
-	if (vec.x != 0 || vec.y != 0) {
-		var n_vec;
-		if (vec.x != 0) {
-			if (vec.x > 0) n_vec = new Point((-vec.y)/vec.x, -1);
-			else n_vec = new Point(vec.y/vec.x, 1);
-		}
-		else {
-			if (vec.y > 0) n_vec = new Point(1,0);
-			else n_vec = new Point(-1,0);
-		}
-		n_vec = n_vec.times(mod_usemap_line_tolerance).dividedBy(n_vec.dist(new Point(0,0)))
-
-		lp = new Point(p1.x + n_vec.x, p1.y - n_vec.y);
-
-		if (cnt > 0) coord += ", ";
-
-		coord += parseInt(lp.x) + ", " + parseInt(lp.y);
-		coord += ", " + parseInt(lp.x+vec.x) + ", " + parseInt(lp.y+vec.y);
-	}
-	return coord;
-}
-
-function mod_usemap_line(ind){
-	var str = "";
-	var title = "";
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
-		if (i>0) title += "&#10;";
-		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
-	}
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
-		var coord = "";
-		var cnt = 0;
-
-		for (var j = 0 ; j < mb_wfs_fetch.getGeometry(ind,i).count() - 1  ; j ++) {
-			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, 1, cnt);
-			if (result != "") {
-				coord += result;
-				cnt++;
-			}
-		}
-		
-		for (var j = (mb_wfs_fetch.getGeometry(ind,i).count() - 1) ; j > 0 ; j--) {
-			var result = mod_usemap_line_calculate(mb_wfs_fetch.getGeometry(ind,i), j, -1, cnt);
-			if (result != "") {
-				coord += result;
-				cnt++;
-			}
-		}
-		
-		if (coord != "") {
-			str += "<AREA title='"+title+"'";
-			str += "onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
-			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' ";
-			str += "shape='poly'  coords='";
-			str += coord + "' href='#'>";
-		}
-		else {
-			//display circle
-			var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind,i,0));
-			coord += pos.x + ", " + pos.y;
-			
-			str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch["+ind+"])' ";
-			str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='circle'  coords='";
-			str += coord + ", " + mod_usemap_radius + "' href='#'>";
-		}
-	}
-	
-	return str;
-}
-
-function mod_usemap_polygon(ind){
-	var str = "";
-	var coord = "";
-	var title = "";
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).e.count(); i++) {
-		if (i>0) title += "&#10;";
-		title += mb_wfs_fetch.get(ind).e.getName(i) + ": " + mb_wfs_fetch.get(ind).e.getValue(i);
-	}
-
-	for (var i = 0 ; i < mb_wfs_fetch.get(ind).count() ; i ++) {
-		var pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, 0));
-		coord += pos.x + ", " + pos.y;
-		
-		for (var j = 1 ; j < mb_wfs_fetch.getGeometry(ind,i).count() ; j ++) {
-			pos = realToMap(mb_wfs_targets[0],mb_wfs_fetch.getPoint(ind, i, j));
-			coord += ", " + pos.x + ", " + pos.y;
-		}
-		
-		str += "<AREA title='"+title+"' onmouseover='parent.mb_wfs_perform(\"over\",parent.mb_wfs_fetch.get("+ind+"))' ";
-		str += "onmouseout='parent.mb_wfs_perform(\"out\",parent.mb_wfs_fetch.get("+ind+"))' shape='poly'  coords='";
-		str += coord + "' href='#'>";
-	}
-	
-	return str;
-}
-
-function writeUsemap(str) {
-	writeTag(mb_wfs_targets[0], 'um', str);
-}
-// --- usemap (end) ----------------------------------------------------------------------------------------------
-// ---------------------------------------------------------------------------------------------------------------

Modified: branches/noframes/http/php/mod_forgottenPassword.php
===================================================================
--- branches/noframes/http/php/mod_forgottenPassword.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/php/mod_forgottenPassword.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 import_request_variables("PG");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../classes/class_administration.php");
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Modified: branches/noframes/http/php/mod_meetingPoint.php
===================================================================
--- branches/noframes/http/php/mod_meetingPoint.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/php/mod_meetingPoint.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -221,7 +221,7 @@
     	my_meetingPoint += encodeURIComponent(document.forms[0].mytext.value);
 
     	
-    	my_meetingPoint += "," + document.forms[0].x.value + ",";
+    	my_meetingPoint += "|" + document.forms[0].x.value + "|";
     	my_meetingPoint += document.forms[0].y.value;
 
     	if(meetingPoint_export_format == 'email'){

Modified: branches/noframes/http/print/mod_printPDF.php
===================================================================
--- branches/noframes/http/print/mod_printPDF.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/print/mod_printPDF.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -1,429 +1,400 @@
-<?php
-# $Id: mod_printPDF.php
-# http://www.mapbender.org/index.php/mod_printPDF.php
-# 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.
-session_start();
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-<meta http-equiv="cache-control" content="no-cache">
-<meta http-equiv="pragma" content="no-cache">
-<meta http-equiv="expires" content="0">
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Print PDF</title>
-</head>
-<style type="text/css">
-<!-- 
-select{
-   width:150px;
-} 
-input{
-	width:150px;
-}
-.mycheck{
-	width:15px;
-}
-div{
-	font-family : Arial, Helvetica, sans-serif;
-	font-size: 12px;
-}
--->
-</style>
-<?php
-
-//FIXME:
-//setlocale(LC_ALL, "de_DE.utf8");
-
-require_once(dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
-echo "<script type='text/javascript'>";
-echo "var target = '".$_REQUEST["target"]."';";
-echo "var comment = '".$label_comment."';";
-echo "var comment_length = ".$comment_length.";";
-echo "var label_button = '".$label_button."';";
-echo "var type = '".$type."';";
-echo "</script>";
-?>
-<script type="text/javascript">
-<!--
-
-
-var size;
-var format;
-var map_width;
-var map_height;
-
-if(type=='window'){
-	var pt = window.opener;
-}
-else if(type == 'iframe'){
-	var pt = parent;
-}
-
-function mod_legend_print(){
-	var mod_legend_target = target;
-	var ind = pt.getMapObjIndexByName(mod_legend_target);
-	var layers;
-
-	document.forms[0].layers.value = "";
-	document.forms[0].wms_id.value = "";
-	document.forms[0].wms_title.value = "";
-	document.forms[0].legendurl.value = "";
-	
-	for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-		layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
-		if(layers != "" && layers){
-		
-			if(i>0 && document.forms[0].wms_id.value!=''){
-			    document.forms[0].layers.value += "___";
-			    document.forms[0].wms_id.value += "___";
-			    document.forms[0].wms_title.value += "___";
-			    document.forms[0].legendurl.value += "___";
-			}
-					
-			document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;   
-			document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
-				
-			for(var j=0; j<layers.length; j++){			
-				var layer = layers[j];
-				var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
-				var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
-				if(layerStyle==false){
-					var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");	
-				}
-				else{
-					var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
-				}
-				
-				//---------- legendurl ----------
-				tmp_name = "";	
-				if(j>0){
-					document.forms[0].layers.value += ",";
-				}
-					document.forms[0].layers.value += title;
-				if(j>0){
-					document.forms[0].legendurl.value += ",";
-				}
-				if (temp_legendurl!= '' || !temp_legendurl == 'true'){
-					document.forms[0].legendurl.value += temp_legendurl;
-				}else{
-					document.forms[0].legendurl.value +='0';
-				}	
-			}	
-		}
-		else{
-			if(i>0 && document.forms[0].wms_id.value!=''){
-			    document.forms[0].layers.value += "___";
-			    document.forms[0].wms_id.value += "___";
-			    document.forms[0].wms_title.value += "___";
-			    document.forms[0].legendurl.value += "___";
-		    }
-			
-			document.forms[0].layers.value += "0";
-		    document.forms[0].wms_id.value += "0";
-		    document.forms[0].wms_title.value += "0";
-		    document.forms[0].legendurl.value += "0";
-		}
-	}//for
-	//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);	
-		
-}
-
-function validate(){
-	size = document.form1.size.options[document.form1.size.selectedIndex].value;
-	format = document.form1.format.options[document.form1.format.selectedIndex].value;
-	if(size != "" && format != ""){
-		var ind = pt.getMapObjIndexByName(target);
-		var coord = pt.mb_mapObj[ind].extent.split(",");
-		var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
-		var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
-		if(size == "A4" && format == "portrait"){
-			map_width = <?php echo $a4p_map_width; ?>; 
-			map_height = <?php echo $a4p_map_height; ?>; 
-		}
-		if(size == "A4" && format == "landscape"){
-			map_width = <?php echo $a4l_map_width; ?>;
-			map_height = <?php echo $a4l_map_height; ?>; 
-		}
-		if(size == "A3" && format == "portrait"){
-			map_width = <?php echo $a3p_map_width; ?>;
-			map_height = <?php echo $a3p_map_height; ?>;
-		}
-		if(size == "A3" && format == "landscape"){
-			map_width = <?php echo $a3l_map_width; ?>;
-			map_height = <?php echo $a3l_map_height; ?>;
-		}  
-		if(size == "A2" && format == "portrait"){
-			map_width = <?php echo $a2p_map_width; ?>;
-			map_height = <?php echo $a2p_map_height; ?>;
-		}
-		if(size == "A2" && format == "landscape"){
-			map_width = <?php echo $a2l_map_width; ?>;
-			map_height = <?php echo $a2l_map_height; ?>;
-		}
-		if(size == "A1" && format == "portrait"){
-			map_width = <?php echo $a1p_map_width; ?>;
-			map_height = <?php echo $a1p_map_height; ?>;
-		}
-		if(size == "A1" && format == "landscape"){
-			map_width = <?php echo $a1l_map_width; ?>;
-			map_height = <?php echo $a1l_map_height; ?>;
-		}
-		if(size == "A0" && format == "portrait"){
-			map_width = <?php echo $a0p_map_width; ?>;
-			map_height = <?php echo $a0p_map_height; ?>;
-		}
-		if(size == "A0" && format == "landscape"){
-			map_width = <?php echo $a0l_map_width; ?>;
-			map_height = <?php echo $a0l_map_height; ?>;
-		}     
-		var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
-		var prevscale= pt.mb_getScale(target);
-		pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-
-		pt.mb_mapObj[ind].width = Math.round(map_width);
-		pt.mb_mapObj[ind].height = Math.round(map_height);
-		pt.document.getElementById(target).style.width = Math.round(map_width);
-		pt.document.getElementById(target).style.height = Math.round(map_height);
-		pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
-		pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
-
-		//pt.setMapRequest(target);		
-		pt.mb_repaintScale(target, null, null, prevscale);
-      	document.form1.map_url.value = '';
-		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-			if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
-					if(document.form1.map_url.value != ""){
-						document.form1.map_url.value += "___";
-					}         
-					document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
-				}
-			}
-		}
-		
-		//overview_url
-		var ind_overview = pt.getMapObjIndexByName('overview');
-
-		//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
-		if(pt.mb_mapObj[ind_overview].mapURL != false ){
-			document.forms[0].overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
-		}
-	}
-}
-function refreshParams(){
-	var f = document.forms[0];
-	size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
-	format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
-	
-	if(size != "" && format != ""){
-		var ind = pt.getMapObjIndexByName(target);
-		var coord = pt.mb_mapObj[ind].extent.split(",");
-		var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
-		var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
-		
-		var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
-		pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-
-		pt.mb_mapObj[ind].width = Math.round(map_width);
-		pt.mb_mapObj[ind].height = Math.round(map_height);
-		pt.document.getElementById(target).style.width = Math.round(map_width);
-		pt.document.getElementById(target).style.height = Math.round(map_height);
-		pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
-		pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
-
-		//pt.setMapRequest(target);		
-		pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
-		f.map_url.value = '';
-		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
-			if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
-					if(f.map_url.value != ""){
-						f.map_url.value += "___";
-					}         
-					f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
-				}
-			}
-		}
-		
-		//overview_url
-		var ind_overview = pt.getMapObjIndexByName('overview');
-
-		//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
-		if(pt.mb_mapObj[ind_overview].mapURL != false ){
-			f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
-		}
-	}
-
-	f.map_scale.value = pt.mb_getScale(target);
-	f.epsg.value = pt.mb_mapObj[ind].epsg;
-	
-	mod_legend_print();
-}
-	
-function printMap(){
-	if(size != "" && (format == "portrait" || format == "landscape")){
-		refreshParams();
-		if(document.form1.c1.value != comment){
-			document.form1.comment1.value = document.form1.c1.value;
-		}
-		if(document.form1.c2.value != comment){
-			document.form1.comment2.value = document.form1.c2.value;
-		}
-		if(document.form1.mylegendcheckbox.checked == 0){
-			document.form1.mylegend.value = 'false';
-		}else{
-			document.form1.mylegend.value = 'true';
-		}
-		
-		// write the measured coordinates
-		
-		if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
-			var tmp_x = '';
-			var tmp_y = '';
-			for(i = 0; i<pt.mod_measure_RX.length; i++) {
-				if(tmp_x != '') {
-					tmp_x += ','
-				}
-				tmp_x += pt.mod_measure_RX[i];
-			}
-			for(i = 0; i<pt.mod_measure_RY.length; i++) {
-				if(tmp_y != '') {
-					tmp_y += ','
-				}
-				tmp_y += pt.mod_measure_RY[i];
-			}
-			document.forms['form1'].elements['measured_x_values'].value = tmp_x;
-			document.forms['form1'].elements['measured_y_values'].value = tmp_y;
-		}
-		
-		document.form1.submit();
-	}
-	else{
-		alert("<?php echo _("No format selected.")?>");
-	}
-}
-function valCom(obj){
-	if(obj.value.length > comment_length){
-		obj.value = obj.value.substr(0,comment_length);
-	}
-}
-// -->
-</script>
-<body>
-<form name='form1' method='POST' action='../print/mod_printPDF_pdf.php?<?php echo SID; ?>' target="_blank">
-<table border='0'>
-<tr>
-	<td>
-	<select name='size' onchange='validate()'>
-<?php
-	if($a4 == true && $a3 == true){
-		echo "<option value=''>".$label_format."</option>";
-	}
-	if($a4 == true){
-		echo "<option value='A4'>".$label_format_a4."</option>";
-	}
-	if($a3 == true){
-		echo "<option value='A3'>".$label_format_a3."</option>";
-	}
-	if($a2 == true){
-		echo "<option value='A2'>".$label_format_a2."</option>";
-	}
-	if($a1 == true){
-		echo "<option value='A1'>".$label_format_a1."</option>";
-	}
-	if($a0 == true){
-		echo "<option value='A0'>".$label_format_a0."</option>";
-	}
-?>
-	</select>
-	</td>   
-</tr>
-<tr>
-	<td>
-	<select name='format' onchange='validate()'>
-	<option value=''><?php echo $label_orientation; ?></option>
-	<option value='portrait'><?php echo $label_portrait; ?></option>
-	<option value='landscape'><?php echo $label_landscape; ?></option>
-	</select>
-	</td>
-</tr>
-<?php
-if($highquality == true){
-	echo "<tr>";
-		echo "<td>";
-		echo "<select name='quality'>";
-		echo "<option value='1'>".$label_72dpi."</option>";
-		echo "<option value='2'>".$label_288dpi."</option>";
-		echo "</select>";
-		echo "</td>";
-	echo "</tr>";
-}
-?>
-<tr>
-	<td>
-		<input type='text' name='c1' value='<?php echo $label_comment; ?>' onkeydown="valCom(this)">
-	</td>
-</tr>
-<tr>
-	<td>
-		<input type='text' name='c2' value='<?php echo $label_comment; ?>' onkeydown="valCom(this)">
-	</td>
-</tr>
-<?php
-if($legend == true){
-	echo "<tr>";
-		echo "<td>";
-		echo "<div><input type='checkbox' class='mycheck' name='mylegendcheckbox' value='false'>".$label_legend."</div>";
-		echo "</td>";
-	echo "</tr>";
-}else {
-	echo "<tr>";
-	echo "<td>";
-	echo "<input type='hidden' name='mylegendcheckbox' value='false'>";
-	echo "</td>";
-	echo "</tr>";
-}
-
-
-?>
-<table>  
-<input type='hidden' name='map_url' value=''>
-<input type='hidden' name='overview_url' value=''>
-<input type='hidden' name='wms_title' value=''>
-<input type='hidden' name='wms_id' value=''>
-<input type='hidden' name='layers' value=''>
-<input type='hidden' name='legendurl' value=''>
-<input type='hidden' name='map_scale' value=''>
-<input type='hidden' name='epsg' value=''>
-<input type='button' name='print' value="<?php echo $label_button; ?>" onclick='printMap()'>
-<input type='hidden' name='conf' value='<?php echo $_REQUEST["conf"]; ?>'>
-<input type='hidden' name='comment1' value=''>
-<input type='hidden' name='comment2' value=''>
-<input type='hidden' name='mylegend' value='true'>
-<input type='hidden' name='measured_x_values' value=''>
-<input type='hidden' name='measured_y_values' value=''>
-
-</form>
-</body>
-</html>
+<?php
+# $Id: mod_printPDF.php
+# http://www.mapbender.org/index.php/mod_printPDF.php
+# 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_once(dirname(__FILE__)."/../../core/globalSettings.php");
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+	<meta http-equiv="cache-control" content="no-cache" />
+	<meta http-equiv="pragma" content="no-cache" />
+	<meta http-equiv="expires" content="0" />
+	<?php printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\" />",CHARSET);	?>
+	<title>Print PDF</title>
+
+	<?php
+	//FIXME:
+	//setlocale(LC_ALL, "de_DE.utf8");
+
+	require_once(dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
+
+	printf("
+	<script type=\"text/javascript\">
+		var target = '%s';
+		var comment1 = '%s';
+		var comment1_length = %s;
+		var comment2 = '%s';
+		var comment2_length = %s;
+		var label_button = '%s';
+		var type = '%s';
+	</script>",
+	$_REQUEST["target"],$label_comment1,$comment1_length,$label_comment2,$comment2_length,$label_button,$type
+	);
+	?>
+
+	<script type="text/javascript">
+	<!--
+	var size;
+	var format;
+	var map_width;
+	var map_height;
+
+	if(type=='window'){
+		var pt = window.opener;
+	}
+	else if(type == 'iframe'){
+		var pt = parent;
+	}
+
+	function mod_legend_print(){
+		var mod_legend_target = target;
+		var ind = pt.getMapObjIndexByName(mod_legend_target);
+		var layers;
+
+		document.forms[0].layers.value = "";
+		document.forms[0].wms_id.value = "";
+		document.forms[0].wms_title.value = "";
+		document.forms[0].legendurl.value = "";
+
+		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+			layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
+			if(layers != "" && layers){
+
+				if(i>0 && document.forms[0].wms_id.value!=''){
+				    document.forms[0].layers.value += "___";
+				    document.forms[0].wms_id.value += "___";
+				    document.forms[0].wms_title.value += "___";
+				    document.forms[0].legendurl.value += "___";
+				}
+
+				document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;
+				document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
+
+				for(var j=0; j<layers.length; j++){
+					var layer = layers[j];
+					var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
+					var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
+					if(layerStyle==false){
+						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");
+					}
+					else{
+						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
+					}
+
+					//---------- legendurl ----------
+					tmp_name = "";
+					if(j>0){
+						document.forms[0].layers.value += ",";
+					}
+						document.forms[0].layers.value += title;
+					if(j>0){
+						document.forms[0].legendurl.value += ",";
+					}
+					if (temp_legendurl!= '' || !temp_legendurl == 'true'){
+						document.forms[0].legendurl.value += temp_legendurl;
+					}else{
+						document.forms[0].legendurl.value +='0';
+					}
+				}
+			}
+			else{
+				if(i>0 && document.forms[0].wms_id.value!=''){
+				    document.forms[0].layers.value += "___";
+				    document.forms[0].wms_id.value += "___";
+				    document.forms[0].wms_title.value += "___";
+				    document.forms[0].legendurl.value += "___";
+			    }
+
+				document.forms[0].layers.value += "0";
+			    document.forms[0].wms_id.value += "0";
+			    document.forms[0].wms_title.value += "0";
+			    document.forms[0].legendurl.value += "0";
+			}
+		}//for
+		//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);
+
+	}
+
+	function validate(){
+		size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+		format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+
+		if(size != "false" && format != "false"){
+			var ind = pt.getMapObjIndexByName(target);
+			var coord = pt.mb_mapObj[ind].extent.split(",");
+			var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+			var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+			if(size == "A4" && format == "portrait"){
+				map_width = <?php echo $a4p_map_width; ?>;
+				map_height = <?php echo $a4p_map_height; ?>;
+			}
+			if(size == "A4" && format == "landscape"){
+				map_width = <?php echo $a4l_map_width; ?>;
+				map_height = <?php echo $a4l_map_height; ?>;
+			}
+			if(size == "A3" && format == "portrait"){
+				map_width = <?php echo $a3p_map_width; ?>;
+				map_height = <?php echo $a3p_map_height; ?>;
+			}
+			if(size == "A3" && format == "landscape"){
+				map_width = <?php echo $a3l_map_width; ?>;
+				map_height = <?php echo $a3l_map_height; ?>;
+			}
+			if(size == "A2" && format == "portrait"){
+				map_width = <?php echo $a2p_map_width; ?>;
+				map_height = <?php echo $a2p_map_height; ?>;
+			}
+			if(size == "A2" && format == "landscape"){
+				map_width = <?php echo $a2l_map_width; ?>;
+				map_height = <?php echo $a2l_map_height; ?>;
+			}
+			if(size == "A1" && format == "portrait"){
+				map_width = <?php echo $a1p_map_width; ?>;
+				map_height = <?php echo $a1p_map_height; ?>;
+			}
+			if(size == "A1" && format == "landscape"){
+				map_width = <?php echo $a1l_map_width; ?>;
+				map_height = <?php echo $a1l_map_height; ?>;
+			}
+			if(size == "A0" && format == "portrait"){
+				map_width = <?php echo $a0p_map_width; ?>;
+				map_height = <?php echo $a0p_map_height; ?>;
+			}
+			if(size == "A0" && format == "landscape"){
+				map_width = <?php echo $a0l_map_width; ?>;
+				map_height = <?php echo $a0l_map_height; ?>;
+			}
+			var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+			var prevscale= pt.mb_getScale(target);
+			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+
+			pt.mb_mapObj[ind].width = Math.round(map_width);
+			pt.mb_mapObj[ind].height = Math.round(map_height);
+			pt.document.getElementById(target).style.width = Math.round(map_width);
+			pt.document.getElementById(target).style.height = Math.round(map_height);
+			pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
+			pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
+
+			//pt.setMapRequest(target);
+			pt.mb_repaintScale(target, null, null, prevscale);
+		document.form1.map_url.value = '';
+			for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+				if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+					if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
+						if(document.form1.map_url.value != ""){
+							document.form1.map_url.value += "___";
+						}
+						document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+					}
+				}
+			}
+
+			//overview_url
+			var ind_overview = pt.getMapObjIndexByName('overview');
+
+			//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+			if(pt.mb_mapObj[ind_overview].mapURL != false ){
+				document.forms[0].overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+			}
+		}
+	}
+	function refreshParams(){
+		var f = document.forms[0];
+		size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
+		format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
+		
+		if(size != "" && format != ""){
+			var ind = pt.getMapObjIndexByName(target);
+			var coord = pt.mb_mapObj[ind].extent.split(",");
+			var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
+			var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
+			
+			var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+	
+			pt.mb_mapObj[ind].width = Math.round(map_width);
+			pt.mb_mapObj[ind].height = Math.round(map_height);
+			pt.document.getElementById(target).style.width = Math.round(map_width);
+			pt.document.getElementById(target).style.height = Math.round(map_height);
+			pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
+			pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
+	
+			//pt.setMapRequest(target);		
+			pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+			f.map_url.value = '';
+			for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
+				if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
+					if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
+						if(f.map_url.value != ""){
+							f.map_url.value += "___";
+						}         
+						f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
+					}
+				}
+			}
+			
+			//overview_url
+			var ind_overview = pt.getMapObjIndexByName('overview');
+	
+			//alert ("l�nge: " + length+ " - " + ind_overview + name + pt.mb_mapObj[ind_overview].wms.length);
+			if(pt.mb_mapObj[ind_overview].mapURL != false ){
+				f.overview_url.value = pt.mb_mapObj[ind_overview].mapURL;
+			}
+		}
+	
+		f.map_scale.value = pt.mb_getScale(target);
+		f.epsg.value = pt.mb_mapObj[ind].epsg;
+		
+		mod_legend_print();
+	}
+	function printMap(){
+		if(size != "false" && (format == "portrait" || format == "landscape")){
+			refreshParams();
+			if(document.form1.c1.value != comment1){
+				document.form1.comment1.value = document.form1.c1.value;
+			}
+			if(document.form1.c2.value != comment2){
+				document.form1.comment2.value = document.form1.c2.value;
+			}
+			if(document.form1.mylegendcheckbox.checked == 0){
+				document.form1.mylegend.value = 'false';
+			}else{
+				document.form1.mylegend.value = 'true';
+			}
+
+			// write the measured coordinates
+
+			if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
+				var tmp_x = '';
+				var tmp_y = '';
+				for(i = 0; i<pt.mod_measure_RX.length; i++) {
+					if(tmp_x != '') {
+						tmp_x += ','
+					}
+					tmp_x += pt.mod_measure_RX[i];
+				}
+				for(i = 0; i<pt.mod_measure_RY.length; i++) {
+					if(tmp_y != '') {
+						tmp_y += ','
+					}
+					tmp_y += pt.mod_measure_RY[i];
+				}
+				document.forms['form1'].elements['measured_x_values'].value = tmp_x;
+				document.forms['form1'].elements['measured_y_values'].value = tmp_y;
+			}
+
+			document.form1.submit();
+		}
+		else{
+			alert('<?php echo _mb("No format selected")."!"?>');
+		}
+	}
+
+	function checkCommentLength(obj,maxLength){
+		if(obj.value.length > maxLength){
+			obj.value = obj.value.substr(0,maxLength);
+		}
+	}
+	-->
+	</script>
+	<?php include("../include/dyn_css.php"); ?>
+</head>
+
+<body>
+<form name="form1" method="post" action="../print/mod_printPDF_pdf.php?<?php echo SID; ?>" target="_blank">
+<p id="container_size">
+	<label for="size"><?php echo $label_format ?></label>
+	<select id="size" name="size" onchange="validate();">
+		<option value="false">-</option>
+		<?php
+		for($i = 4; $i >= 0; $i--) {
+			if(${"a".$i}) {
+				printf("<option value=\"A%s\">%s</option>",$i,${"label_format_a".$i});
+			}
+		}
+		?>
+	</select>
+</p>
+
+<p id="container_orientation">
+	<label for="format"><?php echo $label_orientation; ?></label>
+	<select id="format" name="format" onchange="validate();">
+		<option value="portrait"><?php echo $label_portrait; ?></option>
+		<option value="landscape"><?php echo $label_landscape; ?></option>
+	</select>
+</p>
+
+<?php if($highquality === TRUE): ?>
+	<p id="container_quality">
+		<label for="quality"><?php echo $label_quality; ?></label>
+		<input type="radio" id="quality" name="quality" value="1" checked="checked" /> <?php echo $label_72dpi; ?>
+		<input type="radio" id="quality" name="quality" value="2" /> <?php echo $label_288dpi; ?>
+	</p>
+<?php endif; ?>
+
+<?php
+ini_set("error_reporting",E_ALL);
+ini_set("display_errors","on");
+	for($i = 1; $i <= 2; $i++) {
+		$max_comment_length = ${"comment".$i."_length"};
+		$label_hint         = ($max_comment_length > -1) ? sprintf(" <em>"._mb("max.")." %s)</em>",$max_comment_length) : NULL;
+		$javascript         = ($max_comment_length > -1) ? sprintf(" onblur=\"checkCommentLength(this,%s)\"",$max_comment_length) : NULL;
+
+		$html  = sprintf("<p id=\"container_comment%s\">",$i);
+		$html .= sprintf("<label for=\"c%s\">%s%s</label> ",$i,${"label_comment".$i},$label_hint);
+		$html .= sprintf("<textarea id=\"c%s\" name=\"c%s\" cols=\"20\" rows=\"2\"%s></textarea> ",$i,$i,$javascript);
+		$html .= "</p>";
+
+		echo $html;
+	}
+?>
+
+<?php if($legend === TRUE): ?>
+	<p id="container_legend">
+		<label for="mylegendcheckbox"><?php echo $label_legend; ?></label>
+		<input type="checkbox" id="mylegendcheckbox" name="mylegendcheckbox" value="false" />
+	</p>
+<?php else: ?>
+	<input type="hidden" name="mylegendcheckbox" value="false" />
+<?php endif; ?>
+
+<input type="hidden" name="map_url" />
+<input type="hidden" name="overview_url" />
+<input type="hidden" name="wms_title" />
+<input type="hidden" name="wms_id" />
+<input type="hidden" name="layers" />
+<input type="hidden" name="legendurl" />
+<input type="hidden" name="map_scale" />
+<input type="hidden" name="epsg" />
+<input type="hidden" name="conf" value="<?php echo $_REQUEST["conf"]; ?>" />
+<input type="hidden" name="comment1" />
+<input type="hidden" name="comment2" />
+<input type="hidden" name="mylegend" value="true" >
+<input type="hidden" name="measured_x_values" />
+<input type="hidden" name="measured_y_values" />
+
+<p>
+	<input type="button" id="print" name="print" value="<?php echo $label_button; ?>" onclick="printMap();" />
+</p>
+</form>
+</body>
+
+</html>

Modified: branches/noframes/http/print/mod_printPDF_pdf.php
===================================================================
--- branches/noframes/http/print/mod_printPDF_pdf.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/print/mod_printPDF_pdf.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -1,847 +1,850 @@
-<?php
-# $Id:
-# http://www.mapbender.org/index.php/mod_printPDF_pdf.php
-# 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_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-
-include (dirname(__FILE__)."/../classes/class.ezpdf.php");
-include (dirname(__FILE__)."/../classes/class_stripRequest.php");
-include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
-include (dirname(__FILE__)."/../classes/class_weldOverview2PNG.php");
-include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
-include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
-include (dirname(__FILE__)."/../print/print_functions.php");
-
-if($log == true){
-	include (dirname(__FILE__)."/../classes/class_log.php");
-}
-
-#Globals
-
-$factor = intval($_REQUEST["quality"]);
-
-#$date = date("d.m.Y",strtotime("now"));
-$linewidth_dashed = 0.5;
-$linewidth = 0.5;
-
-// DURATION TIME:
-function microtime_float(){
-   list($usec, $sec) = explode(" ", microtime());
-   return ((float)$usec + (float)$sec);
-}
-$time_start = microtime_float();
-// END DURATION TIME
-
-$time_end = microtime_float();
-$time = $time_end - $time_start;
-
-/* -------------------------------------- */
-
-$size = $_REQUEST["size"];
-$format = $_REQUEST["format"];
-$map_scale = $_REQUEST["map_scale"];
-$overview_url = $_REQUEST["overview_url"];
-$epsg = $_REQUEST["epsg"];
-
-function setscalebar($scale){
-    	$mb_resolution = 28.35;
-        
-		if($scale < 16){
-	      $value = "10";
-	      $unit = "cm";
-	      $scalefactor = 10/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 16 && $scale < 151){
-	      $value = "1";	      
-	      $unit = "Meter";
-	      $scalefactor = 100/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 151 && $scale < 1550 ){
-	      $value = "10";	      
-	      $unit = "Meter";
-	      $scalefactor = 1000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 1550 && $scale < 15050){
-	      $value = "100";	      
-	      $unit = "Meter";
-	      $scalefactor = 10000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 150050 && $scale >= 15050){
-	      $value = "1";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 100000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 1500050 && $scale >= 150050){
-	      $value = "10";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 1000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 15000050 && $scale >= 1500050){
-	      $value = "100";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 10000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale < 150000001 && $scale >= 15000001){
-	      $value = "1000";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 100000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }
-	   if($scale >= 150000001){
-	      $value = "1000";	      
-	      $unit = "Kilometer";
-	      $scalefactor = 100000000/$scale;
-	      $img_width = round($scalefactor * $mb_resolution);
-	   }   
-	   $array_scale[0] = $unit;
-	   $array_scale[1] = $img_width;
-		$array_scale[2] = $value;	   
-	   
-	   return  $array_scale; 
-}
-
-
-$border = 0.8 * $DPC;
-
-if($matching == true){
-   $urls = preg_replace($pattern,$replacement,$_REQUEST["map_url"]);  
-}
-else{
-   $urls = $_REQUEST["map_url"];
-}
-
-
-$array_urls = explode("___", $urls);
-
-$myURL = new stripRequest($array_urls[0]);
-$map_width = round($myURL->get("width"));
-$map_height = round($myURL->get("height"));
-$map_extent = $myURL->get("BBOX");
-if($factor>1){
-	for($i=0; $i<count($array_urls); $i++){
-		$m = new stripRequest($array_urls[$i]);
-		$m->set('width',(intval($m->get('width'))*4));
-		$m->set('height',(intval($m->get('height'))*4));
-		if(in_array($m->get('map'),$highqualitymapfiles)){	
-			$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));			
-		}
-		$array_urls[$i] = $m->url;
-	}
-}
-$coord = mb_split(",",$map_extent);
-
-if($overview === true){
-	// analyse overview url and draw rectangle with position
-	$o_url = new stripRequest($overview_url);
-	$overview_width = round($o_url->get("width"));
-	$overview_height = round($o_url->get("height"));
-	
-	if($factor>1){
-		$o_url->set('width',(intval($o_url->get('width'))*4));
-		$o_url->set('height',(intval($o_url->get('height'))*4));
-		if(in_array($o_url->get('map'),$highqualitymapfiles)){	
-				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
-				$overview_url = $o_url->url;	
-		}
-	}
-	
-	if($matching == true){
-		$overview_url = preg_replace($pattern,$replacement,$overview_url);  
-	}
-	
-	
-	if ($size == "A4" && $format == "portrait"){
-		$overview_left = $a4p_overviewOffset_left;
-		$overview_bottom =$a4p_overviewOffset_bottom;
-	}elseif ($size == "A4" && $format == "landscape"){
-		$overview_left = $a4l_overviewOffset_left;
-		$overview_bottom =$a4l_overviewOffset_bottom;
-	}elseif ($size == "A3" && $format == "portrait"){
-		$overview_left = $a3p_overviewOffset_left;
-		$overview_bottom =$a3p_overviewOffset_bottom;
-	}elseif ($size == "A3" && $format == "landscape"){
-		$overview_left = $a3l_overviewOffset_left;
-		$overview_bottom = $a3l_overviewOffset_bottom;
-	}elseif ($size == "A2" && $format == "portrait"){
-		$overview_left = $a2p_overviewOffset_left;
-		$overview_bottom =$a2p_overviewOffset_bottom;
-	}elseif ($size == "A2" && $format == "landscape"){
-		$overview_left = $a2l_overviewOffset_left;
-		$overview_bottom = $a2l_overviewOffset_bottom;
-	}elseif ($size == "A1" && $format == "portrait"){
-		$overview_left = $a1p_overviewOffset_left;
-		$overview_bottom =$a1p_overviewOffset_bottom;
-	}elseif ($size == "A1" && $format == "landscape"){
-		$overview_left = $a1l_overviewOffset_left;
-		$overview_bottom = $a1l_overviewOffset_bottom;
-	}elseif ($size == "A0" && $format == "portrait"){
-		$overview_left = $a0p_overviewOffset_left;
-		$overview_bottom =$a0p_overviewOffset_bottom;
-	}elseif ($size == "A0" && $format == "landscape"){
-		$overview_left = $a0l_overviewOffset_left;
-		$overview_bottom = $a0l_overviewOffset_bottom;
-	}
-	
-	$o_extent = $o_url->get("BBOX");
-	
-	$array_overview_url[0] = $overview_url;
-	if($log == true){
-		$l = new log("printPDF_overview",$array_overview_url);
-	}
-	
-	/*
-	$o_new = new stripRequest($overview_url);
-	$o_new->set('width',50);
-	$o_new->set('height',50);
-	//$o->set('BBOX',$overview_extent);
-	$o_url_new =$o_new->url;
-	$array_overview[0] = $overview_url;
-	$array_overview[1] = $o_url;
-	*/
-}	
-
-/*
- * north arrow
- */
-if($size == "A4" && $format == "portrait"){
-	$northarrow_left = $a4p_northarrow_left;
-	$northarrow_bottom = $a4p_northarrow_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
-	$northarrow_left = $a4l_northarrow_left;
-	$northarrow_bottom = $a4l_northarrow_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
-	$northarrow_left = $a3p_northarrow_left;
-	$northarrow_bottom = $a3p_northarrow_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
-	$northarrow_left = $a3l_northarrow_left;
-	$northarrow_bottom = $a3l_northarrow_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
-	$northarrow_left = $a2p_northarrow_left;
-	$northarrow_bottom = $a2p_northarrow_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
-	$northarrow_left = $a2l_northarrow_left;
-	$northarrow_bottom = $a2l_northarrow_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
-	$northarrow_left = $a1p_northarrow_left;
-	$northarrow_bottom = $a1p_northarrow_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
-	$northarrow_left = $a1l_northarrow_left;
-	$northarrow_bottom = $a1l_northarrow_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
-	$northarrow_left = $a0p_northarrow_left;
-	$northarrow_bottom = $a0p_northarrow_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
-	$northarrow_left = $a0l_northarrow_left;
-	$northarrow_bottom = $a0l_northarrow_bottom;
-}
-
-/*
- * special image
- */
-if ($size == "A4" && $format == "portrait"){
-	$specialImage_left = $a4p_special_left;
-	$specialImage_bottom = $a4p_special_bottom;
-}elseif ($size == "A4" && $format == "landscape"){
-	$specialImage_left = $a4l_special_left;
-	$specialImage_bottom = $a4l_special_bottom;
-}elseif ($size == "A3" && $format == "portrait"){
-	$specialImage_left = $a3p_special_left;
-	$specialImage_bottom = $a3p_special_bottom;
-}elseif ($size == "A3" && $format == "landscape"){
-	$specialImage_left = $a3l_special_left;
-	$specialImage_bottom = $a3l_special_bottom;
-}elseif ($size == "A2" && $format == "portrait"){
-	$specialImage_left = $a2p_special_left;
-	$specialImage_bottom = $a2p_special_bottom;
-}elseif ($size == "A2" && $format == "landscape"){
-	$specialImage_left = $a2l_special_left;
-	$specialImage_bottom = $a2l_special_bottom;
-}elseif ($size == "A1" && $format == "portrait"){
-	$specialImage_left = $a1p_special_left;
-	$specialImage_bottom = $a1p_special_bottom;
-}elseif ($size == "A1" && $format == "landscape"){
-	$specialImage_left = $a1l_special_left;
-	$specialImage_bottom = $a1l_special_bottom;
-}elseif ($size == "A0" && $format == "portrait"){
-	$specialImage_left = $a0p_special_left;
-	$specialImage_bottom = $a0p_special_bottom;
-}elseif ($size == "A0" && $format == "landscape"){
-	$specialImage_left = $a0l_special_left;
-	$specialImage_bottom = $a0l_special_bottom;
-}
-
-if($log == true){
-	$l = new log("printPDF",$array_urls);
-}
-$pdf = new Cezpdf();
-
-$pdf->Cezpdf(mb_strtolower($size),$format);
-$diff=array(196=>'Adieresis',228=>'adieresis',
-   214=>'Odieresis',246=>'odieresis',
-   220=>'Udieresis',252=>'udieresis',
-   223=>'germandbls');
-$pdf->selectFont('../classes/fonts/Helvetica.afm', array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
-if($size == "A4" && $format == "portrait"){
-	$mapOffset_left = $a4p_mapOffset_left;
-	$mapOffset_bottom = $a4p_mapOffset_bottom;
-	$header_height = $a4p_header_height;
-	$footer_height = $a4p_footer_height;
-}
-else{
-	$mapOffset_left = $a4l_mapOffset_left;
-	$mapOffset_bottom = $a4l_mapOffset_bottom;
-	$header_height = $a4l_header_height;
-	$header_width = $a4l_header_width;
-}
-session_write_close();
-$i = new weldMaps2PNG(implode("___",$array_urls),$filename);
-
-$pdf->addPngFromFile($filename, $mapOffset_left, $mapOffset_bottom, $map_width, $map_height);
-if($unlink == true){
-	unlink($filename);
-}
-
-/** ******************************************************************
-* user drawn elements
-*/
-
-$theMeasureConfigArray = array(
-   "do_fill" => FALSE,
-     "fill_color" => array(
-     "r" => 128 / 255,
-     "g" => 128 / 255,
-     "b" => 128 / 255
-   ),
-   "do_stroke" => FALSE,
-     "stroke_color" => array(
-     "r" => 254 / 255,
-     "g" => 1 / 255,
-     "b" => 1 / 255
-   ),
-   "line_style" => array(
-       "width" => 2,
-       "cap" => 'butt',
-       "join" => 'miter',
-       "dash" => array(10, 6)
-       )
-   );
-
-if ($_REQUEST["measured_x_values"]!=''){
-	addMeasuredItem($pdf, $_REQUEST["measured_x_values"], $_REQUEST["measured_y_values"], $theMeasureConfigArray);
-	hideElementsOutsideMapframe($pdf);
-}
-
-# dashed line
-$pdf->setLineStyle($linewidth_dashed, '','', array(2,2));
-$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed);
-$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
-$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed);
-$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed);
-
-
-#line
-$pdf->setLineStyle($linewidth, '', '', array());
-$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
-$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
-$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom -$border);
-$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border, $mapOffset_left - $border, $mapOffset_bottom - $border);
-
-if($epsg == "EPSG:4326"){
-
-	$text4 = "";
-}
-
-if($size == "A4" && $format == "portrait"){
-   #header:
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height);
-   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border);
-   $pdf->line( $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border + $header_height);
-   #header-text
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text1);
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text1);
-
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text2);   
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 45,$mySize,$text2);
-   
-   $length = $pdf->getTextWidth($mySize, $text3);
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 35,$mySize,$text3);
-
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text4);   
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text4);
-
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text5);   
-   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text5);
-   
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text6);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text6);
-   $length = $pdf->getTextWidth($mySize, $text7);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 50,$mySize,$text7);
-   $length = $pdf->getTextWidth($mySize, $text8);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 30,$mySize,$text8);
-   $length = $pdf->getTextWidth($mySize, $text9);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text9);
-   $length = $pdf->getTextWidth($mySize, $text10);   
-   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text10);
-   
-   //special image on the map-page
-   if ($special == true){
-   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
-   }
-   
-   #footer
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
-   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
-   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
-   
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text11);   
-   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 10,$mySize,$text11);
-   $mySize = 6;
-   $length = $pdf->getTextWidth($mySize, $text12);   
-   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 18,$mySize,$text12);
-   $length = $pdf->getTextWidth($mySize, $text13);
-   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 25,$mySize,$text13);
-}
-else{
-   $pdf->setColor(1,1,1);
-   $ll = array($mapOffset_left + $map_width - $header_width + $border - $linewidth, $mapOffset_bottom - $border + 1);
-   $pdf->filledRectangle($ll[0], $ll[1], $header_width,$header_height);
-   $pdf->line($ll[0], $ll[1], $ll[0], $ll[1] + $header_height);
-   $pdf->line($ll[0], $ll[1] + $header_height, $ll[0] + $header_width, $ll[1] + $header_height);
-
-   $pdf->line($ll[0] + 2, $ll[1] + 2, $ll[0] + 2,  $ll[1] + $header_height - 2);
-   $pdf->line($ll[0] + 2,  $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + $header_height - 2);
-   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + 2);
-   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + 2, $ll[0] + 2, $ll[1] + 2);
-   
-   $pdf->line($ll[0] + 2, $ll[1] + 110 , $ll[0] - 2 + $header_width, $ll[1] + 110);
-   $pdf->line($ll[0] + 2, $ll[1] + 40 , $ll[0] - 2 + $header_width, $ll[1] + 40);
-   
-   
-   //special image on the map-page
-   if ($special == true){
-   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
-   }
-   
-    if($epsg == "EPSG:4326"){
-
-	$text4 = "";
-	}
-	
-   $pdf->setColor(0,0,0);
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text1);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,185,$mySize,$text1);
-   
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text2);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,175,$mySize,$text2);
-   $length = $pdf->getTextWidth($mySize, $text3);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,165,$mySize,$text3);
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text4);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,155,$mySize,$text4);
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text5);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,145,$mySize,$text5);   
-   
-   $mySize = 9;
-   $length = $pdf->getTextWidth($mySize, $text6);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,125,$mySize,$text6);
-   $length = $pdf->getTextWidth($mySize, $text7);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,115,$mySize,$text7);
-   $length = $pdf->getTextWidth($mySize, $text8);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,95,$mySize,$text8);
-   $length = $pdf->getTextWidth($mySize, $text9);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,85,$mySize,$text9);
-   $length = $pdf->getTextWidth($mySize, $text10);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,75,$mySize,$text10);
-   
-   $mySize = 8;
-   $length = $pdf->getTextWidth($mySize, $text11);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,60,$mySize,$text11); 
-   $mySize = 6;
-   $length = $pdf->getTextWidth($mySize, $text14);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,53,$mySize,$text14);
-   $length = $pdf->getTextWidth($mySize, $text15);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,47,$mySize,$text15);
-   $length = $pdf->getTextWidth($mySize, $text16);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,41,$mySize,$text16);
-   $length = $pdf->getTextWidth($mySize, $text17);   
-   $pdf->addText($ll[0] + $header_width/2 - $length/2,35,$mySize,$text17);                             
-}
-#Coordinates
-$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
-$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
-$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
-$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
-
-$mySize = 9;
-$pdf->addText($mapOffset_left - 3, $mapOffset_bottom, $mySize, $myMinx, -90);
-$pdf->addText($mapOffset_left, $mapOffset_bottom  - ($pdf->getFontHeight($mySize)), $mySize, $myMiny);
-$pdf->addText($mapOffset_left  + $map_width - ($pdf->getTextWidth($mySize, $myMaxx)), $mapOffset_bottom + $map_height  + 3, $mySize, $myMaxx);
-$pdf->addText($mapOffset_left + $map_width + 3, $mapOffset_bottom + $map_height, $mySize, $myMaxy, 90);
-
-
-
-
-
-
-if ($overview==true){
-	// analyse request, draw rectancle
-	$filename = preg_replace("/map_/","overview_",$filename);
-	if($size == "A4" && $format == "portrait"){
-		$i = new weldOverview2PNG($overview_url,$array_urls[0] ,$filename);
-
-		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
-		if($unlink == true){
-			unlink($filename);
-		}
-	}
-	else{
-		$i = new weldOverview2PNG($overview_url,$array_urls[0],$filename);
-
-		//$pdf->addPngFromFile($filename, $mapOffset_left,$mapOffset_bottom, $overview_width, $overview_height);
-		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
-		if($unlink == true){
-			unlink($filename);
-		}
-	}
-}
-
-if ($northarrow==true){
-	$pdf->addPngFromFile($northarrowImage, $northarrow_left, $northarrow_bottom , $northarrowImage_width, $northarrowImage_height);
-}
-
-if($epsg == "EPSG:4326"){
-
-	$scalebar = false;
-}
-
-if($scalebar == true){
-	if ($size == "A4" && $format == "portrait"){
-		$scalebar_left = $a4p_scalebar_left;
-		$scalebar_bottom = $a4p_scalebar_bottom;
-	}elseif ($size == "A4" && $format == "landscape"){
-		$scalebar_left = $a4l_scalebar_left;
-		$scalebar_bottom = $a4l_scalebar_bottom;
-	}elseif ($size == "A3" && $format == "portrait"){
-		$scalebar_left = $a3p_scalebar_left;
-		$scalebar_bottom = $a3p_scalebar_bottom;
-	}elseif ($size == "A3" && $format == "landscape"){
-		$scalebar_left = $a3l_scalebar_left;
-		$scalebar_bottom = $a3l_scalebar_bottom;
-	}elseif ($size == "A2" && $format == "portrait"){
-		$scalebar_left = $a2p_scalebar_left;
-		$scalebar_bottom = $a2p_scalebar_bottom;
-	}elseif ($size == "A2" && $format == "landscape"){
-		$scalebar_left = $a2l_scalebar_left;
-		$scalebar_bottom = $a2l_scalebar_bottom;
-	}elseif ($size == "A1" && $format == "portrait"){
-		$scalebar_left = $a1p_scalebar_left;
-		$scalebar_bottom = $a1p_scalebar_bottom;
-	}elseif ($size == "A1" && $format == "landscape"){
-		$scalebar_left = $a1l_scalebar_left;
-		$scalebar_bottom = $a1l_scalebar_bottom;
-	}elseif ($size == "A0" && $format == "portrait"){
-		$scalebar_left = $a0p_scalebar_left;
-		$scalebar_bottom = $a0p_scalebar_bottom;
-	}elseif ($size == "A0" && $format == "landscape"){
-		$scalebar_left = $a0l_scalebar_left;
-		$scalebar_bottom = $a0l_scalebar_bottom;
-	}
-	
-	$array_scalebar = setscalebar($map_scale);
-	
-	$scalebar_left = $scalebar_left + $header_width/2 - $array_scalebar[1]/2;
-	$pdf->setLineStyle($scalebar_height, '','', array());
-   	$pdf->setColor(0,0,0);
-	#$pdf->line($scalebar_left, $scalebar_bottom , $scalebar_left - 200 + $array_scalebar[1], $scalebar_bottom);
-	$pdf->filledRectangle($scalebar_left, $scalebar_bottom, $array_scalebar[1],$scalebar_height);
-	
-	$pdf->setColor(1,1,1);
-	$pdf->filledRectangle($scalebar_left + $array_scalebar[1]/4 + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 1 ,$scalebar_height-2);	
-	$pdf->setColor(1,1,1);
-	$pdf->filledRectangle($scalebar_left + 3*($array_scalebar[1]/4) + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 2 ,$scalebar_height-2);	
-		
-		
-	#$pdf->setColor(1,0,1);
-	#$pdf->filledRectangle($scalebar_left  , $scalebar_bottom - 20, 1 * $DPC ,$scalebar_height-2);	
-	
-	
-	# value - Einheiten 
-	$pdf->setColor(0,0,0);	
-   $mySize = 8;
-   $scalebar_height_half = 0.5 * $scalebar_height;  
-    
-	$myText = 0;
-   $length = $pdf->getTextWidth($mySize, $myText);  
-   $pdf->addText($scalebar_left - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
-   
-	$myText = $array_scalebar[2]/2;
-   $length = $pdf->getTextWidth($mySize, $myText);     
-   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
-	
-	$myText = $array_scalebar[2];
-   $length = $pdf->getTextWidth($mySize, $myText);  
-   $pdf->addText($scalebar_left + $array_scalebar[1] - $length/2 - $length/4 ,$scalebar_bottom + 9 ,$mySize,$myText);
- 
-	
-	$pdf->setColor(0,0,0);	
-   $mySize = 8;
-   $scalebar_height_half = 0.5 * $scalebar_height;   
-   $myText = $array_scalebar[0];
-
-   #$pdf->addText($scalebar_left + $scalebar_width + 5,$scalebar_bottom - $scalebar_height_half ,$mySize,$myText);
-  
-
-	#units  
-   $length = $pdf->getTextWidth($mySize, $myText);
-   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom - 12 ,$mySize,$myText);
- 
-}
-
-
-/* ------------------------ 
-    new page for legend
-   ------------------------ */
-if ($legend == true && $_REQUEST["mylegend"]=='true'){
-
-	$pdf->ezNewPage();
-
-	//Pageborder (top, bottom, left, right)
-	
-	if($size == "A4" && $format == "portrait"){
-	  $pdf->ezSetMargins(50,50,80,30);
-	} else {
-	  $pdf->ezSetMargins(60,35,60,60);
-	}
-	
-	//Requests
-	if(CHARSET=="UTF-8"){
-		$new_wms_title=utf8_decode($_REQUEST["wms_title"]);
-	}else{
-		$new_wms_title=$_REQUEST["wms_title"];
-	}
-	
-	if(CHARSET=="UTF-8"){
-		$new_layers=utf8_decode($_REQUEST["layers"]);
-	}else{
-		$new_layers=$_REQUEST["layers"];
-	}
-	
-	$my_wms_id = explode("___",$_REQUEST["wms_id"]);
-	$my_wms_title = explode("___",$new_wms_title);
-	$my_layers = explode("___",$new_layers);
-	if($matching == true){
-        $my_legend = preg_replace($pattern,$replacement,$_REQUEST["legendurl"]);  
-    }
-    else{
-        $my_legend = $_REQUEST["legendurl"];
-    }
-    $my_legend = explode("___",$my_legend);
-
-	//columns
-	if($size == "A4" && $format == "portrait"){
-	  $pdf->ezColumnsStart(array ('num'=>2, 'gap'=>10));
-	} else {
-	  $pdf->ezColumnsStart(array ('num'=>3, 'gap'=>10));
-	}
-
-	//header from printPDF.conf
-	//$pdf->ezText("<b>".$titel."</b>", 13);
-	$pdf->ezText("<b><u>".$legendText."</u></b>", 13);
-
-	
-	//Seitenraender (top, bottom, left, right)
-	if($size == "A4" && $format == "portrait"){
-	  $pdf->ezSetMargins(70,35,80,30);
-	} else {
-	  $pdf->ezSetMargins(100,35,60,60);
-	}
-	
-	//generate the legend---------------------------------------------
-	
-	// Gesamthoehe Legende / height of the legend
-	$sum_legend_height = 0;
-
-
-	for($i=0; $i<count($my_wms_id); $i++){
-		if ($my_wms_id[$i] != '0'){  //wms_id not 0
-			$layer = explode(",",$my_layers[$i]);
-			$my_legendurls = explode(",",$my_legend[$i]);
-			
-			$wms_y_position = $pdf->ezText("<b>".$my_wms_title[$i]."</b>", 12, array('spacing'=>1.2));
-			$wms_zeilenhoehe   =  $pdf->getFontHeight(12);
-				 
-			// add this to the height of the legend /addiere dies zur Gesamthoehe Legende
-			$sum_legend_height += $wms_zeilenhoehe;
-			
-			//Layer
-			$l = 0;		#l temporary parameter to count the layer /Hilfvariable zum durchz�hlen der angezeigten Layer
-			for($j=0; $j<count($my_legendurls); $j++){
-				// url with grouped layers------------------
-				$temp_url = explode('*',$my_legendurls[$j]);
-				$temp_layers = explode('*',$layer[$j]);
-	
-				for ($q=0; $q <count($temp_url);$q++){  
-					if($temp_url[$q] == '1' ){			// Layertitle for the parent of grouped layers	 
-						// add this to the height of the legend /addiere dies zur Gesamth�he Legende		
-						$layer_y_position = $pdf->ezText($temp_layers[$q], 11, array('spacing'=>1.2));
-						$layer_zeilenhoehe   =  $pdf->getFontHeight(12);
-						$sum_legend_height += $layer_zeilenhoehe;
-						
-					}elseif($temp_url[$q] != '0' ){
-						$funktionsaufruf = new SaveLegend($temp_url[$q],$legendFilename);
-						$imgsize = getimagesize($legendFilename);
-						// add this to the height of the legend /addiere dies zur Gesamthoehe der Legende
-						$sum_legend_height += $imgsize[1];
-	
-						//calculate text + picture / Berechnung Groesse Schrift + Bild
-						if($l == 0){
-						       $y_position = $wms_y_position;
-						       $wms_y_position = '';
-						}else{
-							 $y_position = $pdf->ezText("", 1, array('spacing'=>1.2));
-						}
-						$layer_zeilenhoehe = $pdf->getFontHeight(11);
-						$next_position = $y_position - $layer_zeilenhoehe - $imgsize[1];
-						
-						// add this to the height of the legend / addiere dies zur Gesamth�he Legende
-						$sum_legend_height += $layer_zeilenhoehe;
-							
-						$l = $l+1;
-		
-		     			// if text + picture are smaler then the lower margin + textsize, then set a space
-						//wenn Schrift + Bild kleiner der unteren Margin + Zeilenhoehe, dann Abstand setzen
-						 if($size == "A4" && $format == "portrait" && $next_position <= 35 +$layer_zeilenhoehe){ //90 $layer_zeilenhoehe
-							$space = $layer_zeilenhoehe + $imgsize[1];
-						  $pdf->ezSetDy(-$space);
-						} 
-						if($size == "A4" && $format == "landscape" && $next_position <= 35+$layer_zeilenhoehe){//50
-							$space = $layer_zeilenhoehe + $imgsize[1];
-						  $pdf->ezSetDy(-$space);
-						}
-				
-						//write the header layername / Ueberschrift schreiben
-						$legend = $temp_layers[$q]."\n";  //$layer[$j]."\n"; 
-						$pdf->ezText($legend, 11, array('spacing'=>1.2));
-						
-						//$pdf->ezText($url, 9, array('spacing'=>1.2));
-						//print the picture / Bild schreiben
-						$pdf->ezImage($legendFilename, 0, 'width', 'none', 'left');
-						if($unlink == true){
-							unlink($legendFilename);
-						}
-						
-					} //if legendurl
-				}// for legendurl
-	
-			  	//frames (x1, y1, x2, y2)
-				if($size == "A4" && $format == "portrait"){
-					#line  
-					$pdf->setLineStyle($linewidth, '', '', array());
-					//left
-					$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
-					//right
-					$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
-					//top
-					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
-					//bottom
-					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
-					
-					if ($legendImage!=''){
-						//image on top of page
-						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border + $header_height - $legendImage_height - 4 , $legendImage_width, $legendImage_height);
-					}    
-				} else {
-				  $pdf->setLineStyle($linewidth, '', '', array());
-				  //left
-				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
-				  //right
-				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
-				  //top
-				  $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
-				   //bottom
-				   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border , $mapOffset_left - $border, $mapOffset_bottom - $border);
-				   
-					if ($legendImage!=''){
-						//image on top of page
-						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border - $legendImage_height -4 , $legendImage_width, $legendImage_height);
-						//line under legend (only landscape)
-						//$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border  - $legendImage_height - 4 , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 6);
-					}
-				}
-			}// for layers
-		} //if wms_id not 0
-	}// for wms
-	
-	/****
-    * USER POLYGON:
-    */
-   if($_REQUEST["measured_x_values"] != ""
-      && $_REQUEST["measured_y_values"] != ""
-        && is_file($legendFilenameUserPolygon)) {
-     // load image
-       $myY = $pdf->ezText("<b>temporary Object</b>", 11);
-       $pdf->ezSetDy(-15);
-       $pdf->ezImage($legendFilenameUserPolygon, 5, 17, 'none', 'left');
-       if($unlink == true){
-       		unlink($legendFilenameUserPolygon);
-       }
-       $pdf->ezSetY($myY - 7);
-       
-        $pdf->ezText("Element", 11, array("left" => 25));
-             // deletes image
-	    
-	    $pdf->ezSetDy(-15);             
-                    
-   } 
-	
-$pdf->ezText($legendFooter, 11);
-}//legend true
-/* ------------------------ 
-    end of legend  
-   ------------------------ */
-
-ob_clean();
-if($download == false){
-	$pdf->ezStream();
-}
-else{
-	$content = $pdf->ezOutput();
-
-	$fp = fopen($downloadFile,'w');
-	fwrite($fp,$content);
-	fclose($fp);
-	echo "<html><head></head><body><a href='".$downloadFile."'>".$downloadText."</a></body></html>";
-}
-?>
+<?php
+# $Id:
+# http://www.mapbender.org/index.php/mod_printPDF_pdf.php
+# 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_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+
+include (dirname(__FILE__)."/../classes/class.ezpdf.php");
+include (dirname(__FILE__)."/../classes/class_stripRequest.php");
+include (dirname(__FILE__)."/../classes/class_weldMaps2PNG.php");
+include (dirname(__FILE__)."/../classes/class_weldOverview2PNG.php");
+include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
+include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
+include (dirname(__FILE__)."/../print/print_functions.php");
+
+if($log == true){
+	include (dirname(__FILE__)."/../classes/class_log.php");
+}
+
+#Globals
+
+$factor = intval($_REQUEST["quality"]);
+
+#$date = date("d.m.Y",strtotime("now"));
+$linewidth_dashed = 0.5;
+$linewidth = 0.5;
+
+// DURATION TIME:
+function microtime_float(){
+   list($usec, $sec) = explode(" ", microtime());
+   return ((float)$usec + (float)$sec);
+}
+$time_start = microtime_float();
+// END DURATION TIME
+
+$time_end = microtime_float();
+$time = $time_end - $time_start;
+
+/* -------------------------------------- */
+
+$size = $_REQUEST["size"];
+$format = $_REQUEST["format"];
+$map_scale = $_REQUEST["map_scale"];
+$overview_url = $_REQUEST["overview_url"];
+$epsg = $_REQUEST["epsg"];
+if($overview_url=='false'){
+	$overview = false;	
+}
+
+function setscalebar($scale){
+    	$mb_resolution = 28.35;
+        
+		if($scale < 16){
+	      $value = "10";
+	      $unit = "cm";
+	      $scalefactor = 10/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 16 && $scale < 151){
+	      $value = "1";	      
+	      $unit = "Meter";
+	      $scalefactor = 100/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 151 && $scale < 1550 ){
+	      $value = "10";	      
+	      $unit = "Meter";
+	      $scalefactor = 1000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 1550 && $scale < 15050){
+	      $value = "100";	      
+	      $unit = "Meter";
+	      $scalefactor = 10000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 150050 && $scale >= 15050){
+	      $value = "1";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 100000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 1500050 && $scale >= 150050){
+	      $value = "10";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 1000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 15000050 && $scale >= 1500050){
+	      $value = "100";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 10000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale < 150000001 && $scale >= 15000001){
+	      $value = "1000";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 100000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }
+	   if($scale >= 150000001){
+	      $value = "1000";	      
+	      $unit = "Kilometer";
+	      $scalefactor = 100000000/$scale;
+	      $img_width = round($scalefactor * $mb_resolution);
+	   }   
+	   $array_scale[0] = $unit;
+	   $array_scale[1] = $img_width;
+		$array_scale[2] = $value;	   
+	   
+	   return  $array_scale; 
+}
+
+
+$border = 0.8 * $DPC;
+
+if($matching == true){
+   $urls = preg_replace($pattern,$replacement,$_REQUEST["map_url"]);  
+}
+else{
+   $urls = $_REQUEST["map_url"];
+}
+
+
+$array_urls = explode("___", $urls);
+
+$myURL = new stripRequest($array_urls[0]);
+$map_width = round($myURL->get("width"));
+$map_height = round($myURL->get("height"));
+$map_extent = $myURL->get("BBOX");
+if($factor>1){
+	for($i=0; $i<count($array_urls); $i++){
+		$m = new stripRequest($array_urls[$i]);
+		$m->set('width',(intval($m->get('width'))*4));
+		$m->set('height',(intval($m->get('height'))*4));
+		if(in_array($m->get('map'),$highqualitymapfiles)){	
+			$m->set('map',preg_replace("/\.map/","_4.map",$m->get('map')));			
+		}
+		$array_urls[$i] = $m->url;
+	}
+}
+$coord = mb_split(",",$map_extent);
+
+if($overview === true){
+	// analyse overview url and draw rectangle with position
+	$o_url = new stripRequest($overview_url);
+	$overview_width = round($o_url->get("width"));
+	$overview_height = round($o_url->get("height"));
+	
+	if($factor>1){
+		$o_url->set('width',(intval($o_url->get('width'))*4));
+		$o_url->set('height',(intval($o_url->get('height'))*4));
+		if(in_array($o_url->get('map'),$highqualitymapfiles)){	
+				$o_url->set('map',preg_replace("/\.map/","_4.map",$o_url->get('map')));		
+				$overview_url = $o_url->url;	
+		}
+	}
+	
+	if($matching == true){
+		$overview_url = preg_replace($pattern,$replacement,$overview_url);  
+	}
+	
+	
+	if ($size == "A4" && $format == "portrait"){
+		$overview_left = $a4p_overviewOffset_left;
+		$overview_bottom =$a4p_overviewOffset_bottom;
+	}elseif ($size == "A4" && $format == "landscape"){
+		$overview_left = $a4l_overviewOffset_left;
+		$overview_bottom =$a4l_overviewOffset_bottom;
+	}elseif ($size == "A3" && $format == "portrait"){
+		$overview_left = $a3p_overviewOffset_left;
+		$overview_bottom =$a3p_overviewOffset_bottom;
+	}elseif ($size == "A3" && $format == "landscape"){
+		$overview_left = $a3l_overviewOffset_left;
+		$overview_bottom = $a3l_overviewOffset_bottom;
+	}elseif ($size == "A2" && $format == "portrait"){
+		$overview_left = $a2p_overviewOffset_left;
+		$overview_bottom =$a2p_overviewOffset_bottom;
+	}elseif ($size == "A2" && $format == "landscape"){
+		$overview_left = $a2l_overviewOffset_left;
+		$overview_bottom = $a2l_overviewOffset_bottom;
+	}elseif ($size == "A1" && $format == "portrait"){
+		$overview_left = $a1p_overviewOffset_left;
+		$overview_bottom =$a1p_overviewOffset_bottom;
+	}elseif ($size == "A1" && $format == "landscape"){
+		$overview_left = $a1l_overviewOffset_left;
+		$overview_bottom = $a1l_overviewOffset_bottom;
+	}elseif ($size == "A0" && $format == "portrait"){
+		$overview_left = $a0p_overviewOffset_left;
+		$overview_bottom =$a0p_overviewOffset_bottom;
+	}elseif ($size == "A0" && $format == "landscape"){
+		$overview_left = $a0l_overviewOffset_left;
+		$overview_bottom = $a0l_overviewOffset_bottom;
+	}
+	
+	$o_extent = $o_url->get("BBOX");
+	
+	$array_overview_url[0] = $overview_url;
+	if($log == true){
+		$l = new log("printPDF_overview",$array_overview_url);
+	}
+	
+	/*
+	$o_new = new stripRequest($overview_url);
+	$o_new->set('width',50);
+	$o_new->set('height',50);
+	//$o->set('BBOX',$overview_extent);
+	$o_url_new =$o_new->url;
+	$array_overview[0] = $overview_url;
+	$array_overview[1] = $o_url;
+	*/
+}	
+
+/*
+ * north arrow
+ */
+if($size == "A4" && $format == "portrait"){
+	$northarrow_left = $a4p_northarrow_left;
+	$northarrow_bottom = $a4p_northarrow_bottom;
+}elseif ($size == "A4" && $format == "landscape"){
+	$northarrow_left = $a4l_northarrow_left;
+	$northarrow_bottom = $a4l_northarrow_bottom;
+}elseif ($size == "A3" && $format == "portrait"){
+	$northarrow_left = $a3p_northarrow_left;
+	$northarrow_bottom = $a3p_northarrow_bottom;
+}elseif ($size == "A3" && $format == "landscape"){
+	$northarrow_left = $a3l_northarrow_left;
+	$northarrow_bottom = $a3l_northarrow_bottom;
+}elseif ($size == "A2" && $format == "portrait"){
+	$northarrow_left = $a2p_northarrow_left;
+	$northarrow_bottom = $a2p_northarrow_bottom;
+}elseif ($size == "A2" && $format == "landscape"){
+	$northarrow_left = $a2l_northarrow_left;
+	$northarrow_bottom = $a2l_northarrow_bottom;
+}elseif ($size == "A1" && $format == "portrait"){
+	$northarrow_left = $a1p_northarrow_left;
+	$northarrow_bottom = $a1p_northarrow_bottom;
+}elseif ($size == "A1" && $format == "landscape"){
+	$northarrow_left = $a1l_northarrow_left;
+	$northarrow_bottom = $a1l_northarrow_bottom;
+}elseif ($size == "A0" && $format == "portrait"){
+	$northarrow_left = $a0p_northarrow_left;
+	$northarrow_bottom = $a0p_northarrow_bottom;
+}elseif ($size == "A0" && $format == "landscape"){
+	$northarrow_left = $a0l_northarrow_left;
+	$northarrow_bottom = $a0l_northarrow_bottom;
+}
+
+/*
+ * special image
+ */
+if ($size == "A4" && $format == "portrait"){
+	$specialImage_left = $a4p_special_left;
+	$specialImage_bottom = $a4p_special_bottom;
+}elseif ($size == "A4" && $format == "landscape"){
+	$specialImage_left = $a4l_special_left;
+	$specialImage_bottom = $a4l_special_bottom;
+}elseif ($size == "A3" && $format == "portrait"){
+	$specialImage_left = $a3p_special_left;
+	$specialImage_bottom = $a3p_special_bottom;
+}elseif ($size == "A3" && $format == "landscape"){
+	$specialImage_left = $a3l_special_left;
+	$specialImage_bottom = $a3l_special_bottom;
+}elseif ($size == "A2" && $format == "portrait"){
+	$specialImage_left = $a2p_special_left;
+	$specialImage_bottom = $a2p_special_bottom;
+}elseif ($size == "A2" && $format == "landscape"){
+	$specialImage_left = $a2l_special_left;
+	$specialImage_bottom = $a2l_special_bottom;
+}elseif ($size == "A1" && $format == "portrait"){
+	$specialImage_left = $a1p_special_left;
+	$specialImage_bottom = $a1p_special_bottom;
+}elseif ($size == "A1" && $format == "landscape"){
+	$specialImage_left = $a1l_special_left;
+	$specialImage_bottom = $a1l_special_bottom;
+}elseif ($size == "A0" && $format == "portrait"){
+	$specialImage_left = $a0p_special_left;
+	$specialImage_bottom = $a0p_special_bottom;
+}elseif ($size == "A0" && $format == "landscape"){
+	$specialImage_left = $a0l_special_left;
+	$specialImage_bottom = $a0l_special_bottom;
+}
+
+if($log == true){
+	$l = new log("printPDF",$array_urls);
+}
+$pdf = new Cezpdf();
+
+$pdf->Cezpdf(mb_strtolower($size),$format);
+$diff=array(196=>'Adieresis',228=>'adieresis',
+   214=>'Odieresis',246=>'odieresis',
+   220=>'Udieresis',252=>'udieresis',
+   223=>'germandbls');
+$pdf->selectFont('../classes/fonts/Helvetica.afm', array('encoding'=>'WinAnsiEncoding','differences'=>$diff));
+if($size == "A4" && $format == "portrait"){
+	$mapOffset_left = $a4p_mapOffset_left;
+	$mapOffset_bottom = $a4p_mapOffset_bottom;
+	$header_height = $a4p_header_height;
+	$footer_height = $a4p_footer_height;
+}
+else{
+	$mapOffset_left = $a4l_mapOffset_left;
+	$mapOffset_bottom = $a4l_mapOffset_bottom;
+	$header_height = $a4l_header_height;
+	$header_width = $a4l_header_width;
+}
+session_write_close();
+$i = new weldMaps2PNG(implode("___",$array_urls),$filename);
+
+$pdf->addPngFromFile($filename, $mapOffset_left, $mapOffset_bottom, $map_width, $map_height);
+if($unlink == true){
+	unlink($filename);
+}
+
+/** ******************************************************************
+* user drawn elements
+*/
+
+$theMeasureConfigArray = array(
+   "do_fill" => FALSE,
+     "fill_color" => array(
+     "r" => 128 / 255,
+     "g" => 128 / 255,
+     "b" => 128 / 255
+   ),
+   "do_stroke" => FALSE,
+     "stroke_color" => array(
+     "r" => 254 / 255,
+     "g" => 1 / 255,
+     "b" => 1 / 255
+   ),
+   "line_style" => array(
+       "width" => 2,
+       "cap" => 'butt',
+       "join" => 'miter',
+       "dash" => array(10, 6)
+       )
+   );
+
+if ($_REQUEST["measured_x_values"]!=''){
+	addMeasuredItem($pdf, $_REQUEST["measured_x_values"], $_REQUEST["measured_y_values"], $theMeasureConfigArray);
+	hideElementsOutsideMapframe($pdf);
+}
+
+# dashed line
+$pdf->setLineStyle($linewidth_dashed, '','', array(2,2));
+$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed);
+$pdf->line($mapOffset_left - $linewidth_dashed, $mapOffset_bottom  + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed);
+$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom + $map_height + $linewidth_dashed, $mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed);
+$pdf->line($mapOffset_left + $map_width + $linewidth_dashed, $mapOffset_bottom -$linewidth_dashed, $mapOffset_left - $linewidth_dashed, $mapOffset_bottom - $linewidth_dashed);
+
+
+#line
+$pdf->setLineStyle($linewidth, '', '', array());
+$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
+$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border, $mapOffset_left + $map_width + $border, $mapOffset_bottom -$border);
+$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border, $mapOffset_left - $border, $mapOffset_bottom - $border);
+
+if($epsg == "EPSG:4326"){
+
+	$text4 = "";
+}
+
+if($size == "A4" && $format == "portrait"){
+   #header:
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height);
+   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom  + $map_height + $border);
+   $pdf->line( $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border, $mapOffset_left + $map_width/2, $mapOffset_bottom  + $map_height + $border + $header_height);
+   #header-text
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text1);
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text1);
+
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text2);   
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 45,$mySize,$text2);
+   
+   $length = $pdf->getTextWidth($mySize, $text3);
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 35,$mySize,$text3);
+
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text4);   
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text4);
+
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text5);   
+   $pdf->addText($mapOffset_left - ($border/2) + ($map_width/4) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text5);
+   
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text6);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 60,$mySize,$text6);
+   $length = $pdf->getTextWidth($mySize, $text7);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 50,$mySize,$text7);
+   $length = $pdf->getTextWidth($mySize, $text8);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 30,$mySize,$text8);
+   $length = $pdf->getTextWidth($mySize, $text9);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 20,$mySize,$text9);
+   $length = $pdf->getTextWidth($mySize, $text10);   
+   $pdf->addText($mapOffset_left + ($border/2) + ($map_width/4*3) - ($length/2),$mapOffset_bottom + $map_height + $border + 10,$mySize,$text10);
+   
+   //special image on the map-page
+   if ($special == true){
+   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
+   }
+   
+   #footer
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
+   $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
+   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
+   
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text11);   
+   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 10,$mySize,$text11);
+   $mySize = 6;
+   $length = $pdf->getTextWidth($mySize, $text12);   
+   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 18,$mySize,$text12);
+   $length = $pdf->getTextWidth($mySize, $text13);
+   $pdf->addText( $mapOffset_left + $map_width/2 - ($length/2),$mapOffset_bottom - $border - 25,$mySize,$text13);
+}
+else{
+   $pdf->setColor(1,1,1);
+   $ll = array($mapOffset_left + $map_width - $header_width + $border - $linewidth, $mapOffset_bottom - $border + 1);
+   $pdf->filledRectangle($ll[0], $ll[1], $header_width,$header_height);
+   $pdf->line($ll[0], $ll[1], $ll[0], $ll[1] + $header_height);
+   $pdf->line($ll[0], $ll[1] + $header_height, $ll[0] + $header_width, $ll[1] + $header_height);
+
+   $pdf->line($ll[0] + 2, $ll[1] + 2, $ll[0] + 2,  $ll[1] + $header_height - 2);
+   $pdf->line($ll[0] + 2,  $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + $header_height - 2);
+   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + $header_height - 2, $ll[0] - 2 + $header_width, $ll[1] + 2);
+   $pdf->line($ll[0] - 2 + $header_width, $ll[1] + 2, $ll[0] + 2, $ll[1] + 2);
+   
+   $pdf->line($ll[0] + 2, $ll[1] + 110 , $ll[0] - 2 + $header_width, $ll[1] + 110);
+   $pdf->line($ll[0] + 2, $ll[1] + 40 , $ll[0] - 2 + $header_width, $ll[1] + 40);
+   
+   
+   //special image on the map-page
+   if ($special == true){
+   	$pdf->addPngFromFile($specialImage, $specialImage_left, $specialImage_bottom , $specialImage_width, $specialImage_height);
+   }
+   
+    if($epsg == "EPSG:4326"){
+
+	$text4 = "";
+	}
+	
+   $pdf->setColor(0,0,0);
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text1);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,185,$mySize,$text1);
+   
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text2);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,175,$mySize,$text2);
+   $length = $pdf->getTextWidth($mySize, $text3);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,165,$mySize,$text3);
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text4);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,155,$mySize,$text4);
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text5);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,145,$mySize,$text5);   
+   
+   $mySize = 9;
+   $length = $pdf->getTextWidth($mySize, $text6);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,125,$mySize,$text6);
+   $length = $pdf->getTextWidth($mySize, $text7);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,115,$mySize,$text7);
+   $length = $pdf->getTextWidth($mySize, $text8);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,95,$mySize,$text8);
+   $length = $pdf->getTextWidth($mySize, $text9);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,85,$mySize,$text9);
+   $length = $pdf->getTextWidth($mySize, $text10);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,75,$mySize,$text10);
+   
+   $mySize = 8;
+   $length = $pdf->getTextWidth($mySize, $text11);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,60,$mySize,$text11); 
+   $mySize = 6;
+   $length = $pdf->getTextWidth($mySize, $text14);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,53,$mySize,$text14);
+   $length = $pdf->getTextWidth($mySize, $text15);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,47,$mySize,$text15);
+   $length = $pdf->getTextWidth($mySize, $text16);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,41,$mySize,$text16);
+   $length = $pdf->getTextWidth($mySize, $text17);   
+   $pdf->addText($ll[0] + $header_width/2 - $length/2,35,$mySize,$text17);                             
+}
+#Coordinates
+$myMinx = "R ".substr(round($coord[0]), 0, 4)." ".substr(round($coord[0]), 4, 3)."";
+$myMiny = "H ".substr(round($coord[1]), 0, 4)." ".substr(round($coord[1]), 4, 3)."";
+$myMaxx = "R ".substr(round($coord[2]), 0, 4)." ".substr(round($coord[2]), 4, 3)."";
+$myMaxy = "H ".substr(round($coord[3]), 0, 4)." ".substr(round($coord[3]), 4, 3)."";
+
+$mySize = 9;
+$pdf->addText($mapOffset_left - 3, $mapOffset_bottom, $mySize, $myMinx, -90);
+$pdf->addText($mapOffset_left, $mapOffset_bottom  - ($pdf->getFontHeight($mySize)), $mySize, $myMiny);
+$pdf->addText($mapOffset_left  + $map_width - ($pdf->getTextWidth($mySize, $myMaxx)), $mapOffset_bottom + $map_height  + 3, $mySize, $myMaxx);
+$pdf->addText($mapOffset_left + $map_width + 3, $mapOffset_bottom + $map_height, $mySize, $myMaxy, 90);
+
+
+
+
+
+
+if ($overview==true){
+	// analyse request, draw rectancle
+	$filename = preg_replace("/map_/","overview_",$filename);
+	if($size == "A4" && $format == "portrait"){
+		$i = new weldOverview2PNG($overview_url,$array_urls[0] ,$filename);
+
+		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
+		if($unlink == true){
+			unlink($filename);
+		}
+	}
+	else{
+		$i = new weldOverview2PNG($overview_url,$array_urls[0],$filename);
+
+		//$pdf->addPngFromFile($filename, $mapOffset_left,$mapOffset_bottom, $overview_width, $overview_height);
+		$pdf->addPngFromFile($filename, $overview_left,$overview_bottom, $overview_width, $overview_height);
+		if($unlink == true){
+			unlink($filename);
+		}
+	}
+}
+
+if ($northarrow==true){
+	$pdf->addPngFromFile($northarrowImage, $northarrow_left, $northarrow_bottom , $northarrowImage_width, $northarrowImage_height);
+}
+
+if($epsg == "EPSG:4326"){
+
+	$scalebar = false;
+}
+
+if($scalebar == true){
+	if ($size == "A4" && $format == "portrait"){
+		$scalebar_left = $a4p_scalebar_left;
+		$scalebar_bottom = $a4p_scalebar_bottom;
+	}elseif ($size == "A4" && $format == "landscape"){
+		$scalebar_left = $a4l_scalebar_left;
+		$scalebar_bottom = $a4l_scalebar_bottom;
+	}elseif ($size == "A3" && $format == "portrait"){
+		$scalebar_left = $a3p_scalebar_left;
+		$scalebar_bottom = $a3p_scalebar_bottom;
+	}elseif ($size == "A3" && $format == "landscape"){
+		$scalebar_left = $a3l_scalebar_left;
+		$scalebar_bottom = $a3l_scalebar_bottom;
+	}elseif ($size == "A2" && $format == "portrait"){
+		$scalebar_left = $a2p_scalebar_left;
+		$scalebar_bottom = $a2p_scalebar_bottom;
+	}elseif ($size == "A2" && $format == "landscape"){
+		$scalebar_left = $a2l_scalebar_left;
+		$scalebar_bottom = $a2l_scalebar_bottom;
+	}elseif ($size == "A1" && $format == "portrait"){
+		$scalebar_left = $a1p_scalebar_left;
+		$scalebar_bottom = $a1p_scalebar_bottom;
+	}elseif ($size == "A1" && $format == "landscape"){
+		$scalebar_left = $a1l_scalebar_left;
+		$scalebar_bottom = $a1l_scalebar_bottom;
+	}elseif ($size == "A0" && $format == "portrait"){
+		$scalebar_left = $a0p_scalebar_left;
+		$scalebar_bottom = $a0p_scalebar_bottom;
+	}elseif ($size == "A0" && $format == "landscape"){
+		$scalebar_left = $a0l_scalebar_left;
+		$scalebar_bottom = $a0l_scalebar_bottom;
+	}
+	
+	$array_scalebar = setscalebar($map_scale);
+	
+	$scalebar_left = $scalebar_left + $header_width/2 - $array_scalebar[1]/2;
+	$pdf->setLineStyle($scalebar_height, '','', array());
+   	$pdf->setColor(0,0,0);
+	#$pdf->line($scalebar_left, $scalebar_bottom , $scalebar_left - 200 + $array_scalebar[1], $scalebar_bottom);
+	$pdf->filledRectangle($scalebar_left, $scalebar_bottom, $array_scalebar[1],$scalebar_height);
+	
+	$pdf->setColor(1,1,1);
+	$pdf->filledRectangle($scalebar_left + $array_scalebar[1]/4 + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 1 ,$scalebar_height-2);	
+	$pdf->setColor(1,1,1);
+	$pdf->filledRectangle($scalebar_left + 3*($array_scalebar[1]/4) + 1 , $scalebar_bottom + 1, $array_scalebar[1]/4 - 2 ,$scalebar_height-2);	
+		
+		
+	#$pdf->setColor(1,0,1);
+	#$pdf->filledRectangle($scalebar_left  , $scalebar_bottom - 20, 1 * $DPC ,$scalebar_height-2);	
+	
+	
+	# value - Einheiten 
+	$pdf->setColor(0,0,0);	
+   $mySize = 8;
+   $scalebar_height_half = 0.5 * $scalebar_height;  
+    
+	$myText = 0;
+   $length = $pdf->getTextWidth($mySize, $myText);  
+   $pdf->addText($scalebar_left - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
+   
+	$myText = $array_scalebar[2]/2;
+   $length = $pdf->getTextWidth($mySize, $myText);     
+   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom + 9 ,$mySize,$myText);
+	
+	$myText = $array_scalebar[2];
+   $length = $pdf->getTextWidth($mySize, $myText);  
+   $pdf->addText($scalebar_left + $array_scalebar[1] - $length/2 - $length/4 ,$scalebar_bottom + 9 ,$mySize,$myText);
+ 
+	
+	$pdf->setColor(0,0,0);	
+   $mySize = 8;
+   $scalebar_height_half = 0.5 * $scalebar_height;   
+   $myText = $array_scalebar[0];
+
+   #$pdf->addText($scalebar_left + $scalebar_width + 5,$scalebar_bottom - $scalebar_height_half ,$mySize,$myText);
+  
+
+	#units  
+   $length = $pdf->getTextWidth($mySize, $myText);
+   $pdf->addText($scalebar_left + $array_scalebar[1]/2 - $length/2 ,$scalebar_bottom - 12 ,$mySize,$myText);
+ 
+}
+
+
+/* ------------------------ 
+    new page for legend
+   ------------------------ */
+if ($legend == true && $_REQUEST["mylegend"]=='true'){
+
+	$pdf->ezNewPage();
+
+	//Pageborder (top, bottom, left, right)
+	
+	if($size == "A4" && $format == "portrait"){
+	  $pdf->ezSetMargins(50,50,80,30);
+	} else {
+	  $pdf->ezSetMargins(60,35,60,60);
+	}
+	
+	//Requests
+	if(CHARSET=="UTF-8"){
+		$new_wms_title=utf8_decode($_REQUEST["wms_title"]);
+	}else{
+		$new_wms_title=$_REQUEST["wms_title"];
+	}
+	
+	if(CHARSET=="UTF-8"){
+		$new_layers=utf8_decode($_REQUEST["layers"]);
+	}else{
+		$new_layers=$_REQUEST["layers"];
+	}
+	
+	$my_wms_id = explode("___",$_REQUEST["wms_id"]);
+	$my_wms_title = explode("___",$new_wms_title);
+	$my_layers = explode("___",$new_layers);
+	if($matching == true){
+        $my_legend = preg_replace($pattern,$replacement,$_REQUEST["legendurl"]);  
+    }
+    else{
+        $my_legend = $_REQUEST["legendurl"];
+    }
+    $my_legend = explode("___",$my_legend);
+
+	//columns
+	if($size == "A4" && $format == "portrait"){
+	  $pdf->ezColumnsStart(array ('num'=>2, 'gap'=>10));
+	} else {
+	  $pdf->ezColumnsStart(array ('num'=>3, 'gap'=>10));
+	}
+
+	//header from printPDF.conf
+	//$pdf->ezText("<b>".$titel."</b>", 13);
+	$pdf->ezText("<b><u>".$legendText."</u></b>", 13);
+
+	
+	//Seitenraender (top, bottom, left, right)
+	if($size == "A4" && $format == "portrait"){
+	  $pdf->ezSetMargins(70,35,80,30);
+	} else {
+	  $pdf->ezSetMargins(100,35,60,60);
+	}
+	
+	//generate the legend---------------------------------------------
+	
+	// Gesamthoehe Legende / height of the legend
+	$sum_legend_height = 0;
+
+
+	for($i=0; $i<count($my_wms_id); $i++){
+		if ($my_wms_id[$i] != '0'){  //wms_id not 0
+			$layer = explode(",",$my_layers[$i]);
+			$my_legendurls = explode(",",$my_legend[$i]);
+			
+			$wms_y_position = $pdf->ezText("<b>".$my_wms_title[$i]."</b>", 12, array('spacing'=>1.2));
+			$wms_zeilenhoehe   =  $pdf->getFontHeight(12);
+				 
+			// add this to the height of the legend /addiere dies zur Gesamthoehe Legende
+			$sum_legend_height += $wms_zeilenhoehe;
+			
+			//Layer
+			$l = 0;		#l temporary parameter to count the layer /Hilfvariable zum durchz�hlen der angezeigten Layer
+			for($j=0; $j<count($my_legendurls); $j++){
+				// url with grouped layers------------------
+				$temp_url = explode('*',$my_legendurls[$j]);
+				$temp_layers = explode('*',$layer[$j]);
+	
+				for ($q=0; $q <count($temp_url);$q++){  
+					if($temp_url[$q] == '1' ){			// Layertitle for the parent of grouped layers	 
+						// add this to the height of the legend /addiere dies zur Gesamth�he Legende		
+						$layer_y_position = $pdf->ezText($temp_layers[$q], 11, array('spacing'=>1.2));
+						$layer_zeilenhoehe   =  $pdf->getFontHeight(12);
+						$sum_legend_height += $layer_zeilenhoehe;
+						
+					}elseif($temp_url[$q] != '0' ){
+						$funktionsaufruf = new SaveLegend($temp_url[$q],$legendFilename);
+						$imgsize = getimagesize($legendFilename);
+						// add this to the height of the legend /addiere dies zur Gesamthoehe der Legende
+						$sum_legend_height += $imgsize[1];
+	
+						//calculate text + picture / Berechnung Groesse Schrift + Bild
+						if($l == 0){
+						       $y_position = $wms_y_position;
+						       $wms_y_position = '';
+						}else{
+							 $y_position = $pdf->ezText("", 1, array('spacing'=>1.2));
+						}
+						$layer_zeilenhoehe = $pdf->getFontHeight(11);
+						$next_position = $y_position - $layer_zeilenhoehe - $imgsize[1];
+						
+						// add this to the height of the legend / addiere dies zur Gesamth�he Legende
+						$sum_legend_height += $layer_zeilenhoehe;
+							
+						$l = $l+1;
+		
+		     			// if text + picture are smaler then the lower margin + textsize, then set a space
+						//wenn Schrift + Bild kleiner der unteren Margin + Zeilenhoehe, dann Abstand setzen
+						 if($size == "A4" && $format == "portrait" && $next_position <= 35 +$layer_zeilenhoehe){ //90 $layer_zeilenhoehe
+							$space = $layer_zeilenhoehe + $imgsize[1];
+						  $pdf->ezSetDy(-$space);
+						} 
+						if($size == "A4" && $format == "landscape" && $next_position <= 35+$layer_zeilenhoehe){//50
+							$space = $layer_zeilenhoehe + $imgsize[1];
+						  $pdf->ezSetDy(-$space);
+						}
+				
+						//write the header layername / Ueberschrift schreiben
+						$legend = $temp_layers[$q]."\n";  //$layer[$j]."\n"; 
+						$pdf->ezText($legend, 11, array('spacing'=>1.2));
+						
+						//$pdf->ezText($url, 9, array('spacing'=>1.2));
+						//print the picture / Bild schreiben
+						$pdf->ezImage($legendFilename, 0, 'width', 'none', 'left');
+						if($unlink == true){
+							unlink($legendFilename);
+						}
+						
+					} //if legendurl
+				}// for legendurl
+	
+			  	//frames (x1, y1, x2, y2)
+				if($size == "A4" && $format == "portrait"){
+					#line  
+					$pdf->setLineStyle($linewidth, '', '', array());
+					//left
+					$pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height);
+					//right
+					$pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height);
+					//top
+					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border + $header_height, $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border - $footer_height);
+					//bottom
+					$pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border - $footer_height, $mapOffset_left - $border, $mapOffset_bottom - $border - $footer_height);
+					
+					if ($legendImage!=''){
+						//image on top of page
+						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border + $header_height - $legendImage_height - 4 , $legendImage_width, $legendImage_height);
+					}    
+				} else {
+				  $pdf->setLineStyle($linewidth, '', '', array());
+				  //left
+				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom - $border, $mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border);
+				  //right
+				  $pdf->line($mapOffset_left - $border, $mapOffset_bottom  + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border);
+				  //top
+				  $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border , $mapOffset_left + $map_width + $border, $mapOffset_bottom - $border);
+				   //bottom
+				   $pdf->line($mapOffset_left + $map_width + $border, $mapOffset_bottom -$border , $mapOffset_left - $border, $mapOffset_bottom - $border);
+				   
+					if ($legendImage!=''){
+						//image on top of page
+						$pdf->addPngFromFile($legendImage, $mapOffset_left + $map_width + $border - $legendImage_width -6, $mapOffset_bottom + $map_height + $border - $legendImage_height -4 , $legendImage_width, $legendImage_height);
+						//line under legend (only landscape)
+						//$pdf->line($mapOffset_left - $border, $mapOffset_bottom + $map_height + $border  - $legendImage_height - 4 , $mapOffset_left + $map_width + $border, $mapOffset_bottom + $map_height + $border - $legendImage_height - 6);
+					}
+				}
+			}// for layers
+		} //if wms_id not 0
+	}// for wms
+	
+	/****
+    * USER POLYGON:
+    */
+   if($_REQUEST["measured_x_values"] != ""
+      && $_REQUEST["measured_y_values"] != ""
+        && is_file($legendFilenameUserPolygon)) {
+     // load image
+       $myY = $pdf->ezText("<b>temporary Object</b>", 11);
+       $pdf->ezSetDy(-15);
+       $pdf->ezImage($legendFilenameUserPolygon, 5, 17, 'none', 'left');
+       if($unlink == true){
+       		unlink($legendFilenameUserPolygon);
+       }
+       $pdf->ezSetY($myY - 7);
+       
+        $pdf->ezText("Element", 11, array("left" => 25));
+             // deletes image
+	    
+	    $pdf->ezSetDy(-15);             
+                    
+   } 
+	
+$pdf->ezText($legendFooter, 11);
+}//legend true
+/* ------------------------ 
+    end of legend  
+   ------------------------ */
+
+ob_clean();
+if($download == false){
+	$pdf->ezStream();
+}
+else{
+	$content = $pdf->ezOutput();
+
+	$fp = fopen($downloadFile,'w');
+	fwrite($fp,$content);
+	fclose($fp);
+	echo "<html><head></head><body><a href='".$downloadFile."'>".$downloadText."</a></body></html>";
+}
+?>

Modified: branches/noframes/http/tools/mod_monitorCapabilities_read.php
===================================================================
--- branches/noframes/http/tools/mod_monitorCapabilities_read.php	2008-10-02 15:29:23 UTC (rev 3099)
+++ branches/noframes/http/tools/mod_monitorCapabilities_read.php	2008-10-03 08:42:59 UTC (rev 3100)
@@ -237,11 +237,11 @@
 	$str .= "</tr></table></td>";
 	
 #	$str .= "\n\t\t\t<td><a href='output_".$wms_id[$k]."_".$max.".txt' target=_blank>log</a></td>";
-	$str .= "\n\t\t<td><input type=button value='details' onclick=\"var newWindow = window.open('../php/mod_monitorCapabilities_read_single.php?wmsid=".$wms_id[$k]."','wms','width=500,height=700,scrollbars');newWindow.href.location='test.php'\"></td></tr>";
+	$str .= "\n\t\t<td><input type=button value='details' onclick=\"var newWindow = window.open('../tools/mod_monitorCapabilities_read_single.php?wmsid=".$wms_id[$k]."','wms','width=500,height=700,scrollbars');newWindow.href.location='test.php'\"></td></tr>";
 	$cnt++;
 }
 $str .= "\n\t</table>\n\t<br/><input type=hidden name=cbs value='".$cnt."'>\n</form>";
 echo $str;
 
 ?>
-</body></html>
\ No newline at end of file
+</body></html>



More information about the Mapbender_commits mailing list