[Mapbender-commits] r1845 - branches/mapbender_sld/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Nov 23 09:07:56 EST 2007
Author: christoph
Date: 2007-11-23 09:07:56 -0500 (Fri, 23 Nov 2007)
New Revision: 1845
Modified:
branches/mapbender_sld/http/classes/class_wms.php
Log:
merge
Modified: branches/mapbender_sld/http/classes/class_wms.php
===================================================================
--- branches/mapbender_sld/http/classes/class_wms.php 2007-11-23 13:55:47 UTC (rev 1844)
+++ branches/mapbender_sld/http/classes/class_wms.php 2007-11-23 14:07:56 UTC (rev 1845)
@@ -19,6 +19,8 @@
include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
require_once(dirname(__FILE__)."/class_connector.php");
+require_once(dirname(__FILE__)."/class_mb_exception.php");
+require_once(dirname(__FILE__)."/class_administration.php");
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
@@ -56,16 +58,16 @@
var $data_type = array();
var $data_format = array();
var $objLayer = array();
-
- var $wms_supportsld;
- var $wms_userlayer;
- var $wms_userstyle;
- var $wms_remotewfs;
+
+ var $wms_supportsld;
+ var $wms_userlayer;
+ var $wms_userstyle;
+ var $wms_remotewfs;
var $gui_wms_mapformat;
var $gui_wms_featureinfoformat;
var $gui_wms_exceptionformat;
- var $gui_wms_epsg;
+ var $gui_wms_epsg;
var $gui_wms_sldurl;
var $default_epsg = 0;
@@ -89,15 +91,23 @@
$values = null;
$tags = null;
- $this->wms_getcapabilities_doc = $this->char_encode($data);
+ $admin = new administration();
+ $this->wms_getcapabilities_doc = $admin->char_encode($data);
$this->wms_upload_url = $url;
- $this->wms_id = "";
- $parser = xml_parser_create(CHARSET);
+ $this->wms_id = "";
+ $parser = xml_parser_create("");
xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
- xml_parse_into_struct($parser,$data,$values,$tags);
+ xml_parse_into_struct($parser,$this->wms_getcapabilities_doc,$values,$tags);
+
+ $code = xml_get_error_code($parser);
+ if ($code) {
+ $line = xml_get_current_line_number($parser);
+ $mb_exception = new mb_exception(xml_error_string($code) . " in line " . $line);
+ }
+
xml_parser_free($parser);
$section = null;
@@ -111,207 +121,207 @@
$cnt_styles = -1;
foreach ($values as $element) {
- if(strtoupper($element[tag]) == "WMT_MS_CAPABILITIES" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "WMT_MS_CAPABILITIES" && $element[type] == "open"){
$this->wms_version = $element[attributes][version];
}
- if(strtoupper($element[tag]) == "TITLE" && $element[level] == '3'){
+ if(mb_strtoupper($element[tag]) == "TITLE" && $element[level] == '3'){
$this->wms_title = $this->stripEndlineAndCarriageReturn($element[value]);
}
- if(strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
+ if(mb_strtoupper($element[tag]) == "ABSTRACT" && $element[level] == '3'){
$this->wms_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
}
- if(strtolower($element[tag]) == "fees"){
+ if(mb_strtolower($element[tag]) == "fees"){
$this->fees = $element[value];
}
- if(strtolower($element[tag]) == "accessconstraints"){
+ if(mb_strtolower($element[tag]) == "accessconstraints"){
$this->accessconstraints = $element[value];
}
- if(strtolower($element[tag]) == "contactperson"){
+ if(mb_strtolower($element[tag]) == "contactperson"){
$this->contactperson = $element[value];
}
- if(strtolower($element[tag]) == "contactposition"){
+ if(mb_strtolower($element[tag]) == "contactposition"){
$this->contactposition = $element[value];
}
- if(strtolower($element[tag]) == "contactorganization"){
+ if(mb_strtolower($element[tag]) == "contactorganization"){
$this->contactorganization = $element[value];
}
- if(strtolower($element[tag]) == "address"){
+ if(mb_strtolower($element[tag]) == "address"){
$this->address = $element[value];
}
- if(strtolower($element[tag]) == "city"){
+ if(mb_strtolower($element[tag]) == "city"){
$this->city = $element[value];
}
- if(strtolower($element[tag]) == "stateorprovince"){
+ if(mb_strtolower($element[tag]) == "stateorprovince"){
$this->stateorprovince = $element[value];
}
- if(strtolower($element[tag]) == "postcode"){
+ if(mb_strtolower($element[tag]) == "postcode"){
$this->postcode = $element[value];
}
- if(strtolower($element[tag]) == "country"){
+ if(mb_strtolower($element[tag]) == "country"){
$this->country = $element[value];
}
- if(strtolower($element[tag]) == "contactvoicetelephone"){
+ if(mb_strtolower($element[tag]) == "contactvoicetelephone"){
$this->contactvoicetelephone = $element[value];
}
- if(strtolower($element[tag]) == "contactfacsimiletelephone"){
+ if(mb_strtolower($element[tag]) == "contactfacsimiletelephone"){
$this->contactfacsimiletelephone = $element[value];
}
- if(strtolower($element[tag]) == "contactelectronicmailaddress"){
+ if(mb_strtolower($element[tag]) == "contactelectronicmailaddress"){
$this->contactelectronicmailaddress = $element[value];
}
- if(strtolower($element[tag]) == "keyword" && $section != 'layer'){
+ if(mb_strtolower($element[tag]) == "keyword" && $section != 'layer'){
$this->wms_keyword[count($this->wms_keyword)] = $element[value];
}
/*map section*/
if($this->wms_version == "1.0.0"){
- if(strtoupper($element[tag]) == "MAP" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "open"){
$section = "map";
}
- if($section == "map" && strtoupper($element[tag]) == "GET"){
+ if($section == "map" && mb_strtoupper($element[tag]) == "GET"){
$this->wms_getmap = $element[attributes][onlineResource];
}
- if($section == "map" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+ if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
$format = "map";
}
- if(strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
+ if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "map" && $format == "map"){
$this->data_type[$cnt_format] = "map";
$this->data_format[$cnt_format] = trim($element[tag]);
$cnt_format++;
}
- if(strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
$format = "";
}
- if(strtoupper($element[tag]) == "MAP" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "MAP" && $element[type] == "close"){
$section = "";
}
}
else{
- if(strtoupper($element[tag]) == "GETMAP" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "open"){
$section = "map";
}
- if($section == "map" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
$request = "get";
}
- if($section == "map" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($section == "map" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->wms_getmap = $element[attributes]["xlink:href"];
}
- if($section == "map" && strtoupper($element[tag]) == "FORMAT"){
+ if($section == "map" && mb_strtoupper($element[tag]) == "FORMAT"){
$this->data_type[$cnt_format] = "map";
$this->data_format[$cnt_format] = trim($element[value]);
$cnt_format++;
}
- if($section == "map" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ if($section == "map" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
$request = "";
}
- if(strtoupper($element[tag]) == "GETMAP" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "GETMAP" && $element[type] == "close"){
$section = "";
}
}
/*capabilities section*/
if($this->wms_version == "1.0.0"){
- if(strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "open"){
$section = "capabilities";
}
- if($section == "capabilities" && strtoupper($element[tag]) == "GET"){
+ if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET"){
$this->wms_getcapabilities = $element[attributes][onlineResource];
}
- if(strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "CAPABILITIES" && $element[type] == "close"){
$section = "";
}
}
else{
- if(strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "open"){
$section = "capabilities";
}
- if($section == "capabilities" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
$request = "get";
}
- if($section == "capabilities" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($section == "capabilities" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->wms_getcapabilities = $element[attributes]["xlink:href"];
}
- if($section == "capabilities" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ if($section == "capabilities" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
$request = "";
}
- if(strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "GETCAPABILITIES" && $element[type] == "close"){
$section = "";
}
}
/*featureInfo section*/
if($this->wms_version == "1.0.0"){
- if(strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "open"){
$section = "featureinfo";
}
- if($section == "featureinfo" && strtoupper($element[tag]) == "GET"){
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET"){
$this->wms_getfeatureinfo = $element[attributes][onlineResource];
}
- if($section == "featureinfo" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
$format = "featureinfo";
}
- if(strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
+ if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "featureinfo" && $format == "featureinfo"){
$this->data_type[$cnt_format] = "featureinfo";
$this->data_format[$cnt_format] = trim($element[tag]);
$cnt_format++;
}
- if(strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
$format = "";
}
- if(strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "FEATUREINFO" && $element[type] == "close"){
$section = "";
}
}
else{
- if(strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "open"){
$section = "featureinfo";
}
- if($section == "featureinfo" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
$request = "get";
}
- if($section == "featureinfo" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($section == "featureinfo" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->wms_getfeatureinfo = $element[attributes]["xlink:href"];
}
- if($section == "featureinfo" && strtoupper($element[tag]) == "FORMAT"){
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "FORMAT"){
$this->data_type[$cnt_format] = "featureinfo";
$this->data_format[$cnt_format] = trim($element[value]);
$cnt_format++;
}
- if($section == "featureinfo" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ if($section == "featureinfo" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
$request = "";
}
- if(strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "GETFEATUREINFO" && $element[type] == "close"){
$section = "";
}
}
/*exception section*/
if($this->wms_version == "1.0.0"){
- if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
$section = "exception";
}
- if($section == "exception" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
+ if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "open"){
$format = "exception";
}
- if(strtoupper($element[tag]) != "FORMAT" && $section == "exception" && $format == "exception"){
+ if(mb_strtoupper($element[tag]) != "FORMAT" && $section == "exception" && $format == "exception"){
$this->data_type[$cnt_format] = "exception";
$this->data_format[$cnt_format] = trim($element[tag]);
$cnt_format++;
}
- if($section == "exception" && strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
+ if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT" && $element[type] == "close"){
$format = "";
}
- if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
$section = "";
}
}
else{
- if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "open"){
$section = "exception";
}
- if($section == "exception" && strtoupper($element[tag]) == "FORMAT"){
+ if($section == "exception" && mb_strtoupper($element[tag]) == "FORMAT"){
$this->data_type[$cnt_format] = "exception";
$this->data_format[$cnt_format] = trim($element[value]);
$cnt_format++;
}
- if(strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "EXCEPTION" && $element[type] == "close"){
$section = "";
}
}
@@ -320,33 +330,32 @@
}
else{
- if(strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "open"){
$section = "legend";
}
- if($section == "legend" && strtoupper($element[tag]) == "GET" && $element[type] == "open"){
+ if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "open"){
$request = "get";
}
- if($section == "legend" && $request == "get" && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($section == "legend" && $request == "get" && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->wms_getlegendurl = $element[attributes]["xlink:href"];
}
- if($section == "legend" && strtoupper($element[tag]) == "GET" && $element[type] == "close"){
+ if($section == "legend" && mb_strtoupper($element[tag]) == "GET" && $element[type] == "close"){
$request = "";
}
- if(strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "GETLEGENDGRAPHIC" && $element[type] == "close"){
$section = "";
}
}
-
- /* sld section */
- if(strtoupper($element[tag]) == "USERDEFINEDSYMBOLIZATION" && $element[type] == "complete"){
- $this->wms_supportsld = $element[attributes]["SupportSLD"];
- $this->wms_userlayer = $element[attributes]["UserLayer"];
- $this->wms_userstyle = $element[attributes]["UserStyle"];
- $this->wms_remotewfs = $element[attributes]["RemoteWFS"];
- }
-
+ /* sld section */
+ if(mb_strtoupper($element[tag]) == "USERDEFINEDSYMBOLIZATION" && $element[type] == "complete"){
+ $this->wms_supportsld = $element[attributes]["SupportSLD"];
+ $this->wms_userlayer = $element[attributes]["UserLayer"];
+ $this->wms_userstyle = $element[attributes]["UserStyle"];
+ $this->wms_remotewfs = $element[attributes]["RemoteWFS"];
+ }
+
/*layer section*/
- if(strtoupper($element[tag]) == "LAYER"){
+ if(mb_strtoupper($element[tag]) == "LAYER"){
$section = "layer";
if ($element[type] == "open") {
$cnt_epsg = -1;
@@ -361,7 +370,7 @@
}
}
/* attribution */
- if(strtoupper($element[tag]) == "ATTRIBUTION"){
+ if(mb_strtoupper($element[tag]) == "ATTRIBUTION"){
if ($element[type] == "open") {
$section = "attribution";
}
@@ -370,7 +379,7 @@
}
}
/* styles */
- if(strtoupper($element[tag]) == "STYLE"){
+ if(mb_strtoupper($element[tag]) == "STYLE"){
$section = "style";
if($cnt_layer != $layer_style){
$layer_style = $cnt_layer;
@@ -384,64 +393,65 @@
}
}
if($section == "style"){
- if(strtoupper($element[tag]) == "NAME"){
+ if(mb_strtoupper($element[tag]) == "NAME"){
$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["name"] = $element[value];
}
- if(strtoupper($element[tag]) == "TITLE"){
+ if(mb_strtoupper($element[tag]) == "TITLE"){
$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["title"] = $element[value];
}
- if(strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "open"){
$legendurl = true;
}
- if($legendurl && strtoupper($element[tag]) == "FORMAT"){
+ if($legendurl && mb_strtoupper($element[tag]) == "FORMAT"){
$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurlformat"] = $element[value];
}
- if($legendurl && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($legendurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->objLayer[$cnt_layer]->layer_style[$cnt_styles]["legendurl"] = $element[attributes]["xlink:href"];
}
- if(strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "LEGENDURL" && $element[type] == "close"){
$legendurl = false;
}
}
/* end of styles */
if($section == "layer"){
- if(strtoupper($element[tag]) == "NAME"){
+ if(mb_strtoupper($element[tag]) == "NAME"){
$this->objLayer[$cnt_layer]->layer_name = $element[value];
}
- if(strtoupper($element[tag]) == "TITLE"){
+ if(mb_strtoupper($element[tag]) == "TITLE"){
$this->objLayer[$cnt_layer]->layer_title = $this->stripEndlineAndCarriageReturn($element[value]);
}
- if(strtoupper($element[tag]) == "ABSTRACT"){
+ if(mb_strtoupper($element[tag]) == "ABSTRACT"){
$this->objLayer[$cnt_layer]->layer_abstract = $this->stripEndlineAndCarriageReturn($element[value]);
}
- if(strtoupper($element[tag]) == "KEYWORD"){
- $this->objLayer[$cnt_layer]->layer_keyword[count($this->objLayer[$cnt_layer]->layer_keyword)] = $element[value];
+ if(mb_strtoupper($element[tag]) == "KEYWORD"){
+ array_push($this->objLayer[$cnt_layer]->layer_keyword, trim($element[value]));
}
- if(strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "open"){
$dataurl = true;
}
- if($dataurl && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($dataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->objLayer[$cnt_layer]->layer_dataurl_href = $element[attributes]["xlink:href"];
}
- if(strtoupper($element[tag]) == "DATAURL" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "DATAURL" && $element[type] == "close"){
$dataurl = false;
}
- if(strtoupper($element[tag]) == "METADATAURL" && $element[type] == "open"){
+ if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "open"){
$metadataurl = true;
}
- if($metadataurl && strtoupper($element[tag]) == "ONLINERESOURCE"){
+ if($metadataurl && mb_strtoupper($element[tag]) == "ONLINERESOURCE"){
$this->objLayer[$cnt_layer]->layer_metadataurl = $element[attributes]["xlink:href"];
}
- if(strtoupper($element[tag]) == "METADATAURL" && $element[type] == "close"){
+ if(mb_strtoupper($element[tag]) == "METADATAURL" && $element[type] == "close"){
$metadataurl = false;
}
- if(strtoupper($element[tag]) == "SRS"){
+ if(mb_strtoupper($element[tag]) == "SRS"){
$this->objLayer[$cnt_layer]->wms_srs1 = $element[value];
- $this->wms_srs = explode (" ", $this->objLayer[0]->wms_srs1);
+ // unique srs only, see http://www.mapbender.org/index.php/Arrays_with_unique_entries
+ $this->wms_srs = array_keys(array_flip(explode(" ", $this->objLayer[0]->wms_srs1)));
}
- if(strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
+ if(mb_strtoupper($element[tag]) == "LATLONBOUNDINGBOX"){
$cnt_epsg++;
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = "EPSG:4326";
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
@@ -449,7 +459,7 @@
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
}
- if(strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
+ if(mb_strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
$cnt_epsg++;
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = $element[attributes][SRS];
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
@@ -457,11 +467,11 @@
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
// a default epsg for mapbender
- if($cnt_layer == 0 && $this->default_epsg == 0 && strlen(trim($element[attributes][SRS]))>= 10){
+ if($cnt_layer == 0 && $this->default_epsg == 0 && mb_strlen(trim($element[attributes][SRS]))>= 10){
$this->default_epsg = $cnt_epsg;
}
}
- if(strtoupper($element[tag]) == "SCALEHINT"){
+ if(mb_strtoupper($element[tag]) == "SCALEHINT"){
if($element[attributes][max]>1000) $max = 0; else $max = $element[attributes][max];
if($element[attributes][min]>1000) $min = 0; else $min = $element[attributes][min];
$this->objLayer[$cnt_layer]->layer_minscale = round(($min * 2004.3976484406788493955738891127));
@@ -475,11 +485,13 @@
if(!$this->wms_title || $this->wms_title == "" || !$this->wms_getmap || $this->wms_getmap == ""){
$this->wms_status = false;
$this->optimizeWMS();
+
return false;
}
else{
$this->wms_status = true;
$this->optimizeWMS();
+
return true;
}
}
@@ -532,7 +544,9 @@
}
if(!is_int($this->objLayer[$i]->layer_parent)){
$this->objLayer[$i]->layer_abstract = $this->wms_abstract;
- $this->objLayer[$i]->layer_keyword = $this->wms_keyword;
+ for ($r = 0; $r < count($this->wms_keyword); $r++) {
+ array_push($this->objLayer[$i]->layer_keyword, trim($this->wms_keyword[$r]));
+ }
}
if($this->objLayer[$i]->layer_name == ""){
$this->objLayer[$i]->layer_name = $this->objLayer[$i]->layer_title;
@@ -550,32 +564,32 @@
$this->objLayer[$i]->gui_layer_maxscale = $this->objLayer[$i]->layer_maxscale;
}
for($i=0;$i<count($this->data_format);$i++){
- if(strtolower($this->data_type[$i]) == 'map' && strtoupper($this->data_format[$i]) == strtoupper($map_default)){
- $this->gui_wms_mapformat = strtolower($map_default);
+ if(mb_strtolower($this->data_type[$i]) == 'map' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($map_default)){
+ $this->gui_wms_mapformat = mb_strtolower($map_default);
$map_default_ok = true;
}
- if(strtolower($this->data_type[$i]) == 'featureinfo' && strtoupper($this->data_format[$i]) == strtoupper($featureinfo_default)){
- $this->gui_wms_featureinfoformat = strtolower($featureinfo_default);
+ if(mb_strtolower($this->data_type[$i]) == 'featureinfo' && mb_strtoupper($this->data_format[$i]) == mb_strtoupper($featureinfo_default)){
+ $this->gui_wms_featureinfoformat = mb_strtolower($featureinfo_default);
$featureinfo_default_ok = true;
}
- if(strtolower($this->data_type[$i]) == 'exception' && strtolower($this->data_format[$i]) == strtolower($exception_default)){
- $this->gui_wms_exceptionformat = strtolower($exception_default);
+ if(mb_strtolower($this->data_type[$i]) == 'exception' && mb_strtolower($this->data_format[$i]) == mb_strtolower($exception_default)){
+ $this->gui_wms_exceptionformat = mb_strtolower($exception_default);
$exception_default_ok = true;
}
}
if($map_default_ok == false){
for($i=0;$i<count($this->data_format);$i++){
- if(strtolower($this->data_type[$i]) == "map" ){$this->gui_wms_mapformat = $this->data_format[$i]; break;}
+ if(mb_strtolower($this->data_type[$i]) == "map" ){$this->gui_wms_mapformat = $this->data_format[$i]; break;}
}
}
if($featureinfo_default_ok == false){
for($i=0;$i<count($this->data_format);$i++){
- if(strtolower($this->data_type[$i]) == "featureinfo" ){$this->gui_wms_featureinfoformat = $this->data_format[$i]; break;}
+ if(mb_strtolower($this->data_type[$i]) == "featureinfo" ){$this->gui_wms_featureinfoformat = $this->data_format[$i]; break;}
}
}
if($exception_default_ok == false){
for($i=0;$i<count($this->data_format);$i++){
- if(strtolower($this->data_type[$i]) == "exception" ){$this->gui_wms_exceptionformat = $this->data_format[$i]; break;}
+ if(mb_strtolower($this->data_type[$i]) == "exception" ){$this->gui_wms_exceptionformat = $this->data_format[$i]; break;}
}
}
@@ -596,23 +610,23 @@
}
for($i=0; $i<count($this->objLayer); $i++){
$this->objLayer[$i]->layer_pos=$i;
- }
-
- /* fill sld variables when empty */
- if($this->wms_supportsld == ""){
- $this->wms_supportsld = 0;
- }
- if($this->wms_userlayer == ""){
- $this->wms_userlayer = 0;
- }
- if($this->wms_userstyle == ""){
- $this->wms_userstyle = 0;
- }
- if($this->wms_remotewfs == ""){
- $this->wms_remotewfs = 0;
}
- }
-
+
+ /* fill sld variables when empty */
+ if($this->wms_supportsld == ""){
+ $this->wms_supportsld = 0;
+ }
+ if($this->wms_userlayer == ""){
+ $this->wms_userlayer = 0;
+ }
+ if($this->wms_userstyle == ""){
+ $this->wms_userstyle = 0;
+ }
+ if($this->wms_remotewfs == ""){
+ $this->wms_remotewfs = 0;
+ }
+ }
+
function displayWMS(){
echo "<br>id: " . $this->wms_id . " <br>";
echo "version: " . $this->wms_version . " <br>";
@@ -626,7 +640,7 @@
echo "gui_wms_exceptionformat: " . $this->gui_wms_exceptionformat . " <br>";
echo "gui_wms_epsg: " . $this->gui_wms_epsg . " <br>";
echo "wms_srs: " . $this->objLayer[0]->wms_srs1 . " <br>";
- echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
+ echo "gui_wms_visible: " . $this->gui_wms_visible . " <br>";
echo "support_sld: " . $this->wms_supportsld . " <br>";
for($i=0; $i<count($this->data_type);$i++){
@@ -663,7 +677,7 @@
* private function
*/
function stripEndlineAndCarriageReturn($string) {
- return str_replace(chr(13), "", str_replace(chr(10), " ", $string));
+ return preg_replace("/\n/", "", preg_replace("/\r/", " ", $string));
}
function createJsObjFromWMS($parent=0){
if(!$this->wms_title || $this->wms_title == ""){
@@ -689,7 +703,7 @@
"'" . $this->gui_wms_featureinfoformat . "'," .
"'" . $this->gui_wms_exceptionformat . "'," .
"'" . $this->gui_wms_epsg ."'," .
- "'" . $this->gui_wms_visible ."'," .
+ "'" . $this->gui_wms_visible ."'," .
"'" . $this->gui_wms_sldurl ."" .
"');";
echo $add_wms_string;
@@ -716,7 +730,8 @@
$this->objLayer[$i]->layer_maxscale ."','".
$this->objLayer[$i]->layer_metadataurl ."','".
$this->objLayer[$i]->gui_layer_wms_id ."','".
- $this->objLayer[$i]->gui_layer_status ."','".
+ $this->objLayer[$i]->gui_layer_status ."','".
+ $this->objLayer[$i]->gui_layer_style ."','".
$this->objLayer[$i]->gui_layer_selectable ."','".
$this->objLayer[$i]->gui_layer_visible ."','".
$this->objLayer[$i]->gui_layer_queryable ."','".
@@ -769,8 +784,8 @@
print("add_wms('".
$this->wms_id ."','".
$this->wms_version ."','".
- str_replace("'", "", $this->wms_title) ."','".
- str_replace("'", "", $this->wms_abstract) ."','".
+ preg_replace("/'/", "", $this->wms_title) ."','".
+ preg_replace("/'/", "", $this->wms_abstract) ."','".
$this->wms_getmap ."','" .
$this->wms_getfeatureinfo ."','".
$this->wms_getlegendurl ."','".
@@ -779,7 +794,7 @@
$this->gui_wms_featureinfoformat ."','".
$this->gui_wms_exceptionformat . "','".
$this->gui_wms_epsg ."','".
- $this->gui_wms_visible ."','".
+ $this->gui_wms_visible ."','".
$this->gui_wms_sldurl ."');\n");
for($i=0;$i<count($this->data_format);$i++){
@@ -806,7 +821,8 @@
$this->objLayer[$i]->layer_maxscale ."','".
$this->objLayer[$i]->layer_metadataurl ."','".
$this->objLayer[$i]->gui_layer_wms_id ."','".
- $this->objLayer[$i]->gui_layer_status ."','".
+ $this->objLayer[$i]->gui_layer_status ."','".
+ $this->objLayer[$i]->gui_layer_style ."','".
$this->objLayer[$i]->gui_layer_selectable ."','".
$this->objLayer[$i]->gui_layer_visible ."','".
$this->objLayer[$i]->gui_layer_queryable ."','".
@@ -854,7 +870,7 @@
*/
function writeObjInDB($gui_id){
global $con;
-
+
$this->checkObj();
db_begin();
@@ -863,7 +879,7 @@
$sql.= "wms_getfeatureinfo, wms_getlegendurl, wms_getcapabilities_doc, wms_upload_url, fees, ";
$sql .= "accessconstraints, contactperson, contactposition, contactorganization, address, city, ";
$sql .= "stateorprovince, postcode, country, contactvoicetelephone, contactfacsimiletelephone, contactelectronicmailaddress, ";
- $sql .= "wms_owner,wms_timestamp, ";
+ $sql .= "wms_owner,wms_timestamp, ";
$sql .= "wms_supportsld, wms_userlayer, wms_userstyle, wms_remotewfs) ";
$sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28)";
$v = array($this->wms_version,$this->wms_title,$this->wms_abstract,$this->wms_getcapabilities,
@@ -871,7 +887,7 @@
$this->wms_upload_url,$this->fees,$this->accessconstraints,$this->contactperson,$this->contactposition,
$this->contactorganization,$this->address,$this->city,$this->stateorprovince,$this->postcode,$this->country,
$this->contactvoicetelephone,$this->contactfacsimiletelephone,$this->contactelectronicmailaddress,
- $_SESSION['mb_user_id'],strtotime("now"),
+ $_SESSION['mb_user_id'],strtotime("now"),
$this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs );
$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i','i','s','s','s','s');
$res = db_prep_query($sql,$v,$t);
@@ -945,16 +961,18 @@
if(!$res){
db_rollback();
}
+ else {
+ # save the id of each layer: set param2 true
+ $this->objLayer[$i]->db_id = db_insert_id($con, 'layer','layer_id');
+ $this->insertLayerEPSG($i);
+
+ # TABLE layer_style for each layer
+ $this->insertLayerStyle($i);
+
+ # insert Keywords
+ $this->insertLayerKeyword($i);
- # save the id of each layer: set param2 true
- $this->objLayer[$i]->db_id = db_insert_id($con, 'layer','layer_id');
- $this->insertLayerEPSG($i);
-
- # TABLE layer_style for each layer
- $this->insertLayerStyle($i);
-
- # insert Keywords
- $this->insertLayerKeyword($i);
+ }
}
function updateLayer($i,$myWMS){
$sql = "SELECT layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_name = $2";
@@ -1012,15 +1030,17 @@
if(!$res){
db_rollback();
}
-
- # save the id of each layer: set param2 true
- $this->objLayer[$i]->db_id = $l_id;
- $this->insertLayerEPSG($i);
-
- # TABLE layer_style for each layer
- $this->insertLayerStyle($i);
- if($this->overwrite == true){
- $this->insertLayerKeyword($i);
+ else {
+
+ # save the id of each layer: set param2 true
+ $this->objLayer[$i]->db_id = $l_id;
+ $this->insertLayerEPSG($i);
+
+ # TABLE layer_style for each layer
+ $this->insertLayerStyle($i);
+ if($this->overwrite == true){
+ $this->insertLayerKeyword($i);
+ }
}
}
function insertGuiLayer($i,$myWMS,$gui_id){
@@ -1028,14 +1048,21 @@
$sql = "INSERT INTO gui_layer (fkey_gui_id, fkey_layer_id, gui_layer_wms_id, ";
$sql .= "gui_layer_status, gui_layer_selectable, gui_layer_visible, gui_layer_queryable, ";
- $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)";
+ $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority, gui_layer_style) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
+ if(count($this->objLayer[$i]->layer_style)>0){
+ $layer_style_name = $this->objLayer[$i]->layer_style[0]["name"];
+ }
+ else{
+ $layer_style_name = NULL;
+ }
$v = array($gui_id,$this->objLayer[$i]->db_id,$myWMS,1,1,1,$this->objLayer[$i]->layer_queryable,
- $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i);
- $t = array('s','i','i','i','i','i','i','i','i','i','i');
+ $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i,$layer_style_name);
+ $t = array('s','i','i','i','i','i','i','i','i','i','i','s');
$res = db_prep_query($sql,$v,$t);
+ #$e = new mb_exception("name des insert styles und fkey_layer_id: ".$layer_style_name." --- ".$this->objLayer[$i]->db_id);
if(!$res){
- db_rollback();
+ ////db_rollback();
}
}
function appendGuiLayer($i,$myWMS,$gui_id){
@@ -1043,11 +1070,17 @@
$sql = "INSERT INTO gui_layer (fkey_gui_id, fkey_layer_id, gui_layer_wms_id, ";
$sql .= "gui_layer_status, gui_layer_selectable, gui_layer_visible, gui_layer_queryable, ";
- $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority) ";
- $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)";
+ $sql .= "gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale, gui_layer_priority, gui_layer_style) ";
+ $sql .= "VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)";
+ if(count($this->objLayer[$i]->layer_style)>0){
+ $layer_style_name = $this->objLayer[$i]->layer_style[0]["name"];
+ }
+ else{
+ $layer_style_name = NULL;
+ }
$v = array($gui_id,$this->objLayer[$i]->db_id,$myWMS,0,0,0,$this->objLayer[$i]->layer_queryable,
- $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i);
- $t = array('s','i','i','i','i','i','i','i','i','i','i');
+ $this->objLayer[$i]->layer_queryable,$this->objLayer[$i]->layer_minscale,$this->objLayer[$i]->layer_maxscale,$i,$layer_style_name);
+ $t = array('s','i','i','i','i','i','i','i','i','i','i','s');
$res = db_prep_query($sql,$v,$t);
if(!$res){
db_rollback();
@@ -1056,7 +1089,7 @@
function insertSRS($myWMS){
for($i=0; $i<count($this->wms_srs);$i++){
$sql ="INSERT INTO wms_srs (fkey_wms_id, wms_srs) values($1,$2)";
- $v = array($myWMS,strtoupper($this->wms_srs[$i]));
+ $v = array($myWMS,mb_strtoupper($this->wms_srs[$i]));
$t = array('i','s');
$res = db_prep_query($sql,$v,$t);
if(!$res){
@@ -1121,17 +1154,19 @@
$t = array('i');
$res = db_prep_query($sql,$v,$t);
-
+// var_dump($this);
$k = $this->objLayer[$i]->layer_keyword;
+// var_dump($k);
for($j=0; $j<count($k); $j++){
$keyword_id = "";
while ($keyword_id == "") {
- $sql = "SELECT keyword_id FROM keyword WHERE keyword = $1";
+ $sql = "SELECT keyword_id FROM keyword WHERE UPPER(keyword) = UPPER($1)";
$v = array($k[$j]);
$t = array('s');
$res = db_prep_query($sql,$v,$t);
$row = db_fetch_array($res);
+ //print_r($row);
if ($row) {
$keyword_id = $row["keyword_id"];
}
@@ -1153,6 +1188,7 @@
$t = array('i', 'i');
$res_layerKeywordExists = db_prep_query($sql_layerKeywordExists, $v, $t);
$row = db_fetch_array($res_layerKeywordExists);
+ //print_r($row);
if (!$row) {
$sql1 = "INSERT INTO layer_keyword (fkey_keyword_id,fkey_layer_id)";
$sql1 .= "VALUES ($1,$2)";
@@ -1177,16 +1213,16 @@
$sql .= "wms_getcapabilities_doc = $6 ,";
$sql .= "wms_upload_url = $7, ";
$sql .= "wms_owner = $8, ";
- $sql .= "wms_timestamp = $9, ";
- $sql .= "wms_supportsld = $10, ";
- $sql .= "wms_userlayer = $11, ";
- $sql .= "wms_userstyle = $12, ";
+ $sql .= "wms_timestamp = $9, ";
+ $sql .= "wms_supportsld = $10, ";
+ $sql .= "wms_userlayer = $11, ";
+ $sql .= "wms_userstyle = $12, ";
$sql .= "wms_remotewfs = $13 ";
$sql .= " WHERE wms_id = $14";
$v = array($this->wms_version,$this->wms_getcapabilities,
$this->wms_getmap,$this->wms_getfeatureinfo,$this->wms_getlegendurl,
- $this->wms_getcapabilities_doc,$this->wms_upload_url,$_SESSION["mb_user_id"],strtotime("now"),
+ $this->wms_getcapabilities_doc,$this->wms_upload_url,$_SESSION["mb_user_id"],strtotime("now"),
$this->wms_supportsld,$this->wms_userlayer,$this->wms_userstyle,$this->wms_remotewfs,$myWMS);
$t = array('s','s','s','s','s','s','s','i','i','s','s','s','s','i');
@@ -1330,7 +1366,10 @@
$v = array($l_id,$gui_id);
$t = array('i','s');
$res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){db_rollback();}
+ if(!$res1){
+
+ db_rollback();
+ }
}
if($this->objLayer[$i]->layer_queryable == 1){
$sql1 = "UPDATE gui_layer set gui_layer_queryable = 1 ";
@@ -1338,7 +1377,10 @@
$v = array($l_id,$gui_id);
$t = array('i','s');
$res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){db_rollback();}
+ if(!$res1){
+
+ db_rollback();
+ }
}
if($row["gui_layer_minscale"] < $this->objLayer[$i]->layer_minscale){
$sql1 = "UPDATE gui_layer set gui_layer_minscale = $1 ";
@@ -1346,7 +1388,8 @@
$v = array($this->objLayer[$i]->layer_minscale,$l_id,$gui_id);
$t = array('i','i','s');
$res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){db_rollback();}
+ if(!$res1){db_rollback();
+ }
}
if($row["gui_layer_maxscale"] > $this->objLayer[$i]->layer_maxscale){
$sql1 = "UPDATE gui_layer set gui_layer_maxscale = $1 ";
@@ -1354,7 +1397,8 @@
$v = array($this->objLayer[$i]->layer_maxscale,$l_id,$gui_id);
$t = array('i','i','s');
$res1 = db_prep_query($sql1,$v,$t);
- if(!$res1){db_rollback();}
+ if(!$res1){db_rollback();
+ }
}
}
}
@@ -1371,15 +1415,15 @@
$sql = "UPDATE gui_wms SET ";
for($i=0; $i<count($this->data_type); $i++){
# gui_wms_mapformat
- if(strtolower($this->data_type[$i]) == "map" && strtolower($this->data_format[$i]) == strtolower($row["gui_wms_mapformat"])){
+ if(mb_strtolower($this->data_type[$i]) == "map" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_mapformat"])){
$myMapFormat = true;
}
# gui_wms_featureinfoformat
- if(strtolower($this->data_type[$i]) == "featureinfo" && strtolower($this->data_format[$i]) == strtolower($row["gui_wms_featureinfoformat"])){
+ if(mb_strtolower($this->data_type[$i]) == "featureinfo" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_featureinfoformat"])){
$myFeatureInfoFormat = true;
}
# gui_wms_exceptionformat
- if(strtolower($this->data_type[$i]) == "exception" && strtolower($this->data_format[$i]) == strtolower($row["gui_wms_exceptionformat"])){
+ if(mb_strtolower($this->data_type[$i]) == "exception" && mb_strtolower($this->data_format[$i]) == mb_strtolower($row["gui_wms_exceptionformat"])){
$myExceptionFormat = true;
}
}
@@ -1400,7 +1444,7 @@
# gui_wms_epsg
for($j=0; $j<count($this->objLayer[0]->layer_epsg);$j++){
- if($this->objLayer[0]->layer_epsg[$j][epsg] == strtoupper($row["gui_wms_epsg"])){
+ if($this->objLayer[0]->layer_epsg[$j][epsg] == mb_strtoupper($row["gui_wms_epsg"])){
$myGUI_EPSG = true;
}
}
@@ -1467,7 +1511,7 @@
$this->gui_wms_featureinfoformat=$row["gui_wms_featureinfoformat"];
$this->gui_wms_exceptionformat=$row["gui_wms_exceptionformat"];
$this->gui_wms_epsg=$row["gui_wms_epsg"];
- $this->gui_wms_visible = $row["gui_wms_visible"];
+ $this->gui_wms_visible = $row["gui_wms_visible"];
$this->gui_wms_sldurl = $row["gui_wms_sldurl"];
$sql = "Select * from wms where wms_id = $1 ";
@@ -1480,24 +1524,28 @@
$this->wms_version = $row2["wms_version"];
$this->wms_title = $this->stripEndlineAndCarriageReturn($row2["wms_title"]);
$this->wms_abstract = $this->stripEndlineAndCarriageReturn($row2["wms_abstract"]);
- if($row2["wms_owsproxy"] != ""){
- $t = OWSPROXY."/".session_id()."/".$row2["wms_owsproxy"]."?";
- $this->wms_getmap = $t;
- $this->wms_getcapabilities = $t;
- $this->wms_getfeatureinfo = $t;
+ $wmsowsproxy = $row2["wms_owsproxy"];
+ #$wmsowsproxy = "test";
+ if($wmsowsproxy != ""){
+ $owsproxyurl = OWSPROXY."/".session_id()."/".$wmsowsproxy."?";
+ $this->wms_getmap = $owsproxyurl;
+ $this->wms_getcapabilities = $owsproxyurl;
+ $this->wms_getfeatureinfo = $owsproxyurl;
+ $this->wms_getlegendurl = $owsproxyurl;
}
else{
$this->wms_getmap = $row2["wms_getmap"];
$this->wms_getcapabilities = $row2["wms_getcapabilities"];
$this->wms_getfeatureinfo = $row2["wms_getfeatureinfo"];
+ $this->wms_getlegendurl = $row2["wms_getlegendurl"];
}
$this->wms_getcapabilities_doc = $row2["wms_getcapabilities_doc"];
- $this->wms_getlegendurl = $row2["wms_getlegendurl"];
- $this->wms_filter = $row2["wms_filter"];
- $this->wms_supportsld = $row2["wms_supportsld"];
- $this->wms_userlayer = $row2["wms_userlayer"];
- $this->wms_userstyle = $row2["wms_userstyle"];
+ $this->wms_filter = $row2["wms_filter"];
+ $this->wms_supportsld = $row2["wms_supportsld"];
+ $this->wms_userlayer = $row2["wms_userlayer"];
+ $this->wms_userstyle = $row2["wms_userstyle"];
$this->wms_remotewfs = $row2["wms_remotewfs"];
+
$count_wms++;
}
@@ -1553,6 +1601,7 @@
$this->objLayer[$layer_cnt]->gui_layer_querylayer = $row["gui_layer_querylayer"];
$this->objLayer[$layer_cnt]->gui_layer_minscale = $row["gui_layer_minscale"];
$this->objLayer[$layer_cnt]->gui_layer_maxscale = $row["gui_layer_maxscale"];
+ $this->objLayer[$layer_cnt]->gui_layer_style = $row["gui_layer_style"];
$this->objLayer[$layer_cnt]->gui_layer_wfs_featuretype = $row["gui_layer_wfs_featuretype"];
$sql = "Select * from layer_epsg where fkey_layer_id = $1 ORDER BY fkey_layer_id";
@@ -1579,11 +1628,22 @@
while($row2 = db_fetch_array($res_style)){
$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["name"]=$row2["name"];
$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["title"]=$row2["title"];
- $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
+ if($wmsowsproxy != ""){
+ if($row2["legendurl"]!=''){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$owsproxyurl.
+ "REQUEST=getlegendgraphic&VERSION=".$this->wms_version."&LAYER=".$this->objLayer[$layer_cnt]->layer_name."&FORMAT=".$row2["legendurlformat"].
+ "&STYLE=".$row2["name"];
+ }
+ }
+ else{
+ if($row2["legendurl"]!=''){
+ $this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]=$row2["legendurl"];
+ #$e = new mb_exception("legendurl = ".$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurl"]);
+ }
+ }
$this->objLayer[$layer_cnt]->layer_style[$count_layer_style]["legendurlformat"]=$row2["legendurlformat"];
$count_layer_style++;
}
-
$count++;
}
}
@@ -1687,17 +1747,19 @@
var $gui_layer_selectable = 1;
var $gui_layer_visible = 0;
var $gui_layer_queryable = 0;
- var $gui_layer_querylayer = 0;
+ var $gui_layer_querylayer = 0;
+ var $gui_layer_style = NULL;
- function layer($id,$parent){
- $this->layer_id = $id;
- $this->layer_parent = $parent;
- }
function char_encode($s){
if(CHARSET == 'UTF-8'){
$s = utf8_encode($s);
}
return $s;
}
+ function layer($id,$parent){
+ $this->layer_id = $id;
+ $this->layer_parent = $parent;
+ //var_dump($this);
+ }
}
?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list