[Mapbender-commits] r3618 - in trunk/mapbender/http: classes php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Mar 2 09:58:45 EST 2009
Author: christoph
Date: 2009-03-02 09:58:45 -0500 (Mon, 02 Mar 2009)
New Revision: 3618
Modified:
trunk/mapbender/http/classes/class_gml_factory.php
trunk/mapbender/http/php/mod_wfs_gazetteer_server.php
Log:
bug fixes
Modified: trunk/mapbender/http/classes/class_gml_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_gml_factory.php 2009-03-02 14:48:04 UTC (rev 3617)
+++ trunk/mapbender/http/classes/class_gml_factory.php 2009-03-02 14:58:45 UTC (rev 3618)
@@ -184,6 +184,9 @@
// used in this WFS configuration
$wfsFactory = new UniversalWfsFactory();
$myWfs = $wfsFactory->createFromDb($wfsConf->wfsId);
+ if (is_null($myWfs)) {
+ return null;
+ }
$featureType = $myWfs->findFeatureTypeById($wfsConf->featureTypeId);
// register namespace of feature type
Modified: trunk/mapbender/http/php/mod_wfs_gazetteer_server.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs_gazetteer_server.php 2009-03-02 14:48:04 UTC (rev 3617)
+++ trunk/mapbender/http/php/mod_wfs_gazetteer_server.php 2009-03-02 14:58:45 UTC (rev 3618)
@@ -23,6 +23,7 @@
require_once(dirname(__FILE__)."/../classes/class_wfs_conf.php");
require_once(dirname(__FILE__)."/../classes/class_universal_wfs_factory.php");
require_once(dirname(__FILE__)."/../classes/class_universal_gml_factory.php");
+require_once(dirname(__FILE__)."/../classes/class_wfs_configuration.php");
$command = $_REQUEST["command"];
@@ -107,60 +108,26 @@
$url = $_REQUEST["url"];
$typename = $_REQUEST["typename"];
- /* wfs_conf */
- $sql = "SELECT * FROM wfs_conf JOIN wfs ON wfs_conf.fkey_wfs_id = wfs.wfs_id ";
- $sql .= "WHERE wfs_conf.wfs_conf_id = $1";
- $v = array($wfs_conf_id);
- $t = array('i');
-
- $res = db_prep_query($sql,$v,$t);
- if ($row = db_fetch_array($res)) {
- $g_res_style = $row["g_res_style"];
+ $wfsConf = WfsConfiguration::createFromDb($wfs_conf_id);
+ if (is_null($wfsConf)) {
+ sendErrorMessage("Invalid WFS conf: " . $wfs_conf_id);
}
- else {
- die("wfs_conf " . $wfs_conf_id . "data not available");
- }
- /* wfs_conf_element */
- $sql = "SELECT * FROM wfs_conf_element ";
- $sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
- $sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = $1 ";
- $sql .= "AND wfs_conf_element.f_show = 1 ORDER BY wfs_conf_element.f_respos;";
- $v = array($wfs_conf_id);
- $t = array('i');
-
- $res = db_prep_query($sql,$v,$t);
- $col = array();
- while ($row = db_fetch_array($res)) {
- array_push($col, $row["element_name"]);
- }
- if (count($col) == 0) {
- die("wfs_conf_element data not available");
- }
-
- // append authorisation condition to filter
- $filter = checkAccessConstraint($filter, $wfs_conf_id);
-
$admin = new administration();
$filter = $admin->char_decode(stripslashes($filter));
- $sql = "SELECT fkey_wfs_id FROM wfs_conf WHERE wfs_conf_id = $1";
- $v = array($wfs_conf_id);
- $t = array('i');
- $res = db_prep_query($sql, $v, $t);
- $row = db_fetch_array($res);
- $wfsId = $row["fkey_wfs_id"];
+ $wfsId = $wfsConf->wfsId;
$myWfsFactory = new UniversalWfsFactory();
$myWfs = $myWfsFactory->createFromDb($wfsId);
$data = $myWfs->getFeature($typename, $filter);
if ($data === null) die('{}');
- $geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id);
+// $geomColumn = WfsConf::getGeomColumnNameByConfId($wfs_conf_id);
$gmlFactory = new UniversalGmlFactory();
- $myGml = $gmlFactory->createFromXml($data);
+ $myGml = $gmlFactory->createFromXml($data, $wfsConf);
$geoJson = $myGml->toGeoJSON();
header("Content-type:application/x-json; charset=utf-8");
More information about the Mapbender_commits
mailing list