[Mapbender-commits] r1567 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Aug 2 09:05:25 EDT 2007
Author: christoph
Date: 2007-08-02 09:05:25 -0400 (Thu, 02 Aug 2007)
New Revision: 1567
Modified:
trunk/mapbender/http/php/mod_wfsrequest.php
Log:
added filter parameter to wfs request
Modified: trunk/mapbender/http/php/mod_wfsrequest.php
===================================================================
--- trunk/mapbender/http/php/mod_wfsrequest.php 2007-08-02 11:15:01 UTC (rev 1566)
+++ trunk/mapbender/http/php/mod_wfsrequest.php 2007-08-02 13:05:25 UTC (rev 1567)
@@ -1,7 +1,7 @@
<?php
# $Id$
-# http://www.mapbender.org/index.php/Administration
-# Copyright (C) 2002 CCGIS
+# $Header: /cvsroot/mapbender/mapbender/http/php/mod_wfsrequest.php,v 1.3 2005/11/04 11:08:57 uli_rothstein 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
@@ -17,7 +17,17 @@
# 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__)."/../../conf/mapbender.conf");
+# ur # echo urldecode(stripslashes(utf8_decode($_REQUEST["filter"])));
+# ur # die;
+function checkInput($s){
+ if(!preg_match('/[^\s\d\w\-\.öüäßÄÖÜ]|--/',$s)){
+ return addslashes($s);
+ }
+ else{
+ die('Unzulässige Eingabe');
+ }
+}
+require_once("../../conf/mapbender.conf");
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db($DB,$con);
if(isset($_REQUEST["backlink"]) && $_REQUEST["backlink"] == 'parent'){
@@ -29,24 +39,21 @@
/* wfs_conf */
$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";
+$sql .= "WHERE wfs_conf.wfs_conf_id = ".$_REQUEST['wfs_conf_id'];
-$v = array($_REQUEST['wfs_conf_id']);
-$t = array('i');
-$res = db_prep_query($sql,$v,$t);
+$res = db_query($sql);
if($row = db_fetch_array($res)){
$g_res_style = $row["g_res_style"];
-
+
}else{die("wfs_conf 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 .= "WHERE wfs_conf_element.fkey_wfs_conf_id = ".$_REQUEST['wfs_conf_id']." ";
$sql .= "AND wfs_conf_element.f_show = 1 ORDER BY wfs_conf_element.f_respos;";
-$v = array($_REQUEST['wfs_conf_id']);
-$t = array('i');
-$res = db_prep_query($sql,$v,$t);
+
+$res = db_query($sql);
$col = array();
$cnt = 0;
while($row = db_fetch_array($res)){
@@ -55,19 +62,45 @@
}
if($cnt == 0){die("wfs_conf_element data not available");}
-$req = urldecode($_REQUEST["url"]).urlencode(stripslashes($_REQUEST["filter"]));
-#echo $req; die;
+$f = '<ogc:Filter xmlns:ogc="http://ogc.org" xmlns:gml="http://www.opengis.net/gml">';
+if($_REQUEST["objekttyp_id"] != '0'){
+ $f .= "<And>";
+}
+$f .= "<ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>";
+$f .= '<ogc:PropertyName>ud_id</ogc:PropertyName>';
+$f .= '<ogc:Literal>*'.$_REQUEST['AstUdNr'].'</ogc:Literal>';
+$f .= "</ogc:PropertyIsLike>";
+if($_REQUEST["objekttyp_id"] != '0'){
+ $f .= "<ogc:PropertyIsEqualTo>";
+ $f .= '<ogc:PropertyName>objekttyp_id</ogc:PropertyName>';
+ $f .= '<ogc:Literal>'.checkInput($_REQUEST["objekttyp_id"]).'</ogc:Literal>';
+ $f .= "</ogc:PropertyIsEqualTo>";
+ $f .= "</And>";
+}
+
+$f .= '</ogc:Filter>';
+
+$req = urldecode($_REQUEST["url"]).urlencode($f);
$gml = 'off';
if(isset($_REQUEST['gml'])){
$gml = $_REQUEST['gml'];
}
if($gml == 'on'){
- header("Location: ".$req);
+// header("Location: ".$req);
+readfile($req);
}
+
+else if($_REQUEST["export"] == 'shape'){
+ include(dirname(__FILE__)."/../classes/class_gml2.php");
+ include(dirname(__FILE__)."/../classes/class_gml2shape.php");
+ $my = new gml2();
+ $mygml = $my->getGml($req);
+ $s = new gml2shape($mygml);
+}
else{
echo "<html><head><style type='text/css'>".$g_res_style."</style></head><body>";
- include(dirname(__FILE__)."/../classes/class_gml2.php");
+ include("../classes/class_gml2.php");
$mygml = new gml2();
$mygml->parsegml($req);
$c = $mygml->getMemberCount();
@@ -84,15 +117,16 @@
echo " onmouseover='".$p.".setResult(\"".$geomtype."\",\"over\",\"".$mygeom."\")' ";
echo " onmouseout='".$p.".setResult(\"".$geomtype."\",\"out\",\"false\")' ";
echo " onclick='".$p.".setResult(\"".$geomtype."\",\"click\",\"".$mygeom."\")'>";
- for($j=0; $j<count($col); $j++){
- echo $mygml->getValueBySeparatedKey($i,$col[$j]) . " ";
- }
+// for($j=0; $j<count($col); $j++){
+ echo $mygml->getValueBySeparatedKey($i,$col[0]);
+ if($_REQUEST["objekttyp_id"] == '0'){
+ echo " (".$mygml->getValueBySeparatedKey($i,"objekttyp_name").")";
+ }
+// }
echo "</div>";
}
if($i == 0){ echo "Kein Ergebnis...";}
echo "</body></html>";
}
-
-
?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list