[Mapbender-commits] r4866 - branches/2.4.5/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Oct 27 12:35:48 EDT 2009
Author: christoph
Date: 2009-10-27 12:35:47 -0400 (Tue, 27 Oct 2009)
New Revision: 4866
Modified:
branches/2.4.5/http/javascripts/mod_poi.php
Log:
Modified: branches/2.4.5/http/javascripts/mod_poi.php
===================================================================
--- branches/2.4.5/http/javascripts/mod_poi.php 2009-10-27 13:34:27 UTC (rev 4865)
+++ branches/2.4.5/http/javascripts/mod_poi.php 2009-10-27 16:35:47 UTC (rev 4866)
@@ -94,14 +94,49 @@
#$language = parse_ini_file("../language/".$lingo.".txt");
echo "<script type='text/javascript'>";
-echo "var conffile = '".$_REQUEST["conf_file"]."';";
-echo "var lingo = '".$_REQUEST["lingo"]."';";
-echo "var backlink = '".$_REQUEST["backlink"]."';";
+$queryString = $_REQUEST["search"];
+if (!preg_match("/^[a-zA-Z0-9_- \*]+$/", $search)) {
+
+ $errorMessage = _mb("Invalid search term");
+ echo htmlentities($errorMessage, ENT_QUOTES, CHARSET);
+ $e = new mb_exception($errorMessage);
+ $queryString = "";
+}
+
+$backlink = $_REQUEST["backlink"];
+
+if ($backlink !== "parent") {
+ $backlink = false;
+}
+echo "var backlink = '".$backlink."';";
+
$lingo = $_REQUEST["lingo"];
+if (!preg_match("/^[a-zA-Z]+$/", $lingo)) {
+
+ $errorMessage = _mb("Invalid language") . ": " . $lingo;
+ echo htmlentities($errorMessage, ENT_QUOTES, CHARSET);
+ $e = new mb_exception($errorMessage);
+ die;
+}
+echo "var lingo = '".$lingo."';";
+
+
$title = "layername_".$lingo;
-require_once("../../conf/".$_REQUEST["conf_file"]);
+$confFile = basename($_REQUEST["conf_file"]);
+if (!preg_match("/^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9]+)$/", $confFile) ||
+ !file_exists($confFile)) {
+
+ $errorMessage = _mb("Invalid configuration file") . ": " . $confFile;
+ echo htmlentities($errorMessage, ENT_QUOTES, CHARSET);
+ $e = new mb_exception($errorMessage);
+ die;
+}
+echo "var conffile = '".$confFile."';";
+
+require_once(dirname(__FILE__) . "/../../conf/".$confFile);
+
echo "</script>";
?>
<script type="text/javascript">
@@ -110,7 +145,7 @@
function validate(){
if(document.form1.search.value.length < 1){
- alert("Bitte vervollst�ndigen Sie die Angaben!");
+ alert("Bitte vervollständigen Sie die Angaben!");
document.form1.search.focus();
return false;
}
@@ -194,7 +229,7 @@
<body leftmargin="2" topmargin="0" bgcolor="#ffffff">
<?php
-if(!isset($_REQUEST["search"]) || $_REQUEST["search"] == ""){
+if(!isset($queryString) || $queryString == ""){
echo "<form name='form1' target='result' onsubmit='return validate();'>";
echo "Suchen: <input class='textfield' name='search' type='text'> ";
echo "<input class='sbutton' type='submit' name='send' value='ok'>";
@@ -202,8 +237,8 @@
echo "</form>";
}
else{
- if(preg_match("/\*/",$_REQUEST["search"])){
- $search = trim(preg_replace("/\*/i","", $_REQUEST["search"]));
+ if(preg_match("/\*/",$queryString)){
+ $search = trim(preg_replace("/\*/i","", $queryString));
}
$con = pg_connect ($con_string) or die ("Error while connecting database $dbname");
@@ -219,7 +254,7 @@
$md_fileidentifier[$cnt] = pg_result($res,$cnt,"md_fileidentifier"); # Layername
$layername[$cnt] = pg_result($res,$cnt,"md_fileidentifier"); # Layername in der Mapdatei
$result_title[$cnt] = pg_result($res,$cnt,"\"".$title."\""); # layer_deutsch Ergebnisname
- $search_columns[$cnt] = pg_result($res,$cnt,"search_columns"); # Suchspalten, Trennung �ber ,
+ $search_columns[$cnt] = pg_result($res,$cnt,"search_columns"); # Suchspalten, Trennung über ,
$search_result[$cnt] = pg_result($res,$cnt,"search_result"); # Ergebnisspalte
$search_keywords[$cnt] = pg_result($res,$cnt,"search_keywords"); # Ergebnisspalte
$wms_title[$cnt] = pg_result($res,$cnt,"wms_title"); # WMS tile
@@ -229,7 +264,7 @@
$array_search_keywords = explode(",", $search_keywords[$cnt]);
$all[$cnt] = false;
for ($p=0 ; $p<count($array_search_keywords);$p++){
- $hit = preg_match("/".$_REQUEST["search"]."/i",$array_search_keywords[$p]);
+ $hit = preg_match("/".$queryString."/i",$array_search_keywords[$p]);
if ($hit >0){
$all[$cnt] = true;
}
@@ -276,7 +311,7 @@
};
$field_has_parent = true;
$sql1 .= pg_field_name($res,$j) ." ILIKE ";
- $sql1 .= "'%".$_REQUEST["search"]."%'";
+ $sql1 .= "'%".$queryString."%'";
}
}
$field_has_parent = false;
@@ -297,7 +332,7 @@
$title = "layername_".$lingo;
echo "<div class='header'>".$result_title[$i]. "</div>";
}
- if($_REQUEST["backlink"]=='parent'){
+ if($backlink=='parent'){
echo "<nobr><a href='javascript:hideHighlight();parent.parent.mb_repaintScale(\"mapframe1\"," .pg_result($res1,$cnt,"x"). ",".pg_result($res1,$cnt,"y"). ",$scale);'";
}
else{
More information about the Mapbender_commits
mailing list