kmlserver.class.php
2.73 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Mapserver wrapper to KML/KMZ data
*
* Returns KML or KMZ representation of common OGC requests
*
* <pre>
* accepted parameters (case insensitive):
* - request = string - request type (OGC WFS like), can be kml (default), kmz, icon
* - map = string - path to mapfile
* - typename = string - (can be a csv list) - layer name(s)
* - filter = string - filter encoding
* - bbox = string - (csv) - bounding box csv
*
*
* </pre>
*
* @author Alessandro Pasotti
* @copyright 2007 ItOpen.it - All rights reserved
* @package KMLMAPSERVER
This file is part of KMLMAPSERVER.
KMLMAPSERVER is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
KMLMAPSERVER 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with KMLMAPSERVER; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
if(function_exists("dl")){
if (!function_exists('ms_GetVersion'))
{dl( 'php_mapscript.'.PHP_SHLIB_SUFFIX );}
}
if (!function_exists('ms_GetVersion'))
{echo "Nao foi possivel carregar php_mapscript";}
/**
* Main server class, wraps real kml or icon servers
*/
class KmlServer {
/** server instance */
var $service;
/** request */
var $request;
/** debug flag */
var $_debug = false;
/**
* Initialize
*
*/
function KmlServer(){
$this->get_request();
if($this->service == 'icon'){
include 'symbolserver.class.php';
$this->service = new SymbolServer();
$this->service->run();
} else {
include 'layerserver.class.php';
$this->service = new LayerServer();
$this->service->run();
}
}
/**
* Get all request parameters
*/
function get_request(){
$this->service = $this->load_parm('service');
if(!$this->service){
$this->service= 'kml';
}
}
/**
* Get a request parameter
* @param string $name
* @return string the parameter value or empty string if null
*/
function load_parm($name){
if(!isset($_REQUEST[$name])) return '';
$value = $_REQUEST[$name];
if(get_magic_quotes_gpc() != 1) $value = addslashes($value);
//$value = escapeshellcmd($value);
return $value;
}
}
?>