This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
forked from lirantal/daloradius
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgis-editmap.php
200 lines (145 loc) · 5.05 KB
/
gis-editmap.php
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
include ("library/checklogin.php");
$operator = $_SESSION['operator_user'];
include('library/check_operator_perm.php');
if (isset($_REQUEST['type']))
$type = $_REQUEST['type'];
else
$type = "";
include_once('library/config_read.php');
$log = "visited page: ";
include 'library/opendb.php';
$logDebugSQL = "";
if ($type == "add") {
(isset($_REQUEST['hotspotname'])) ? $hotspot_name = $_REQUEST['hotspotname'] : $hotspot_name = " ";
(isset($_REQUEST['hotspotmac'])) ? $hotspot_mac = $_REQUEST['hotspotmac'] : $hotspot_mac = " ";
(isset($_REQUEST['hotspotgeo'])) ? $hotspot_geo = $_REQUEST['hotspotgeo'] : $hotspot_geo = " ";
$hotspot_geo = substr($hotspot_geo, 1);
$hotspot_geo = substr($hotspot_geo, 0, strlen($hotspot_geo)-1);
$sql = "INSERT INTO ".$configValues['CONFIG_DB_TBL_DALOHOTSPOTS']." (id, name, mac, geocode) ".
" VALUES (0, '".$dbSocket->escapeSimple($hotspot_name)."', '".$dbSocket->escapeSimple($hotspot_mac)."', ".
" '".$dbSocket->escapeSimple($hotspot_geo)."');";
$res = $dbSocket->query($sql);
$logDebugSQL .= $sql . "\n";
$successMsg = "Added new Hotspot's Geo-Location information for hotspot: <b> $hotspot_name </b>";
}
if ($type == "del") {
(isset($_REQUEST['hotspotname'])) ? $hotspot_name = $_REQUEST['hotspotname'] : $hotspot_name = " ";
$sql = "DELETE FROM ".$configValues['CONFIG_DB_TBL_DALOHOTSPOTS'].
" WHERE name='".$dbSocket->escapeSimple($hotspot_name)."'";
$res = $dbSocket->query($sql);
$logDebugSQL .= $sql . "\n";
$successMsg = "Deleted Hotspot's Geo-Location information for hotspot: <b> $hotspot_name </b>";
}
include 'library/closedb.php';
?>
<?php
include ("menu-gis.php");
?>
<div id="contentnorightbar">
<h2 id="Intro"><a href="#" onclick="javascript:toggleShowDiv('helpPage')"><? echo $l['Intro']['giseditmap.php']; ?>
<h144>+</h144></a></h2>
<div id="helpPage" style="display:none;visibility:visible" >
<?php echo $l['helpPage']['giseditmap'] ?>
<br/>
</div>
<?php
include_once('include/management/actionMessages.php');
?>
<div id="map" style="width: 800px; height: 600px"></div>
<?php
include 'library/opendb.php';
?>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl());
map.addControl(new GScaleControl());
map.addControl(new GOverviewMapControl());
map.enableDoubleClickZoom();
map.enableContinuousZoom();
//map.setCenter(new GLatLng(35.460669951495305, -81.5625), 13, G_HYBRID_MAP);
map.setCenter(new GLatLng(0,0), 1, G_HYBRID_MAP);
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
map.setCenter(point, 16);
marker.openInfoWindowHtml(html);
});
return marker;
}
map.openInfoWindow(map.getCenter(), document.createTextNode("<?echo $l['messages']['gisedit1']; ?>"));
GEvent.addListener(map, "click", function(marker, point) {
var geopoint = point;
if (marker) {
var remove_val=confirm("<? echo $l['messages']['gisedit2']; ?>")
if (remove_val==true) {
var hotspot_name=prompt("<? echo $l['messages']['gisedit3']; ?>","")
if (hotspot_name!=null && hotspot_name!="") {
map.removeOverlay(marker);
document.editmaps.type.value = "del";
document.editmaps.hotspotname.value = hotspot_name;
document.editmaps.submit();
}
}
} else {
var add_val=confirm("<? echo $l['messages']['gisedit4']; ?>" + " Geocode: " + geopoint)
if (add_val==true) {
var hotspot_name=prompt("<? echo $l['messages']['gisedit5']; ?>","")
if (hotspot_name!=null && hotspot_name!="") {
var hotspot_mac=prompt("<? echo $l['messages']['gisedit6'] ; ?>","")
if (hotspot_mac!=null && hotspot_mac!="") {
map.addOverlay(new GMarker(point));
document.editmaps.type.value = "add";
document.editmaps.hotspotname.value = hotspot_name;
document.editmaps.hotspotgeo.value = geopoint;
document.editmaps.hotspotmac.value = hotspot_mac;
document.editmaps.submit();
}
}
}
}
});
<?php
$sql = "SELECT * FROM ".$configValues['CONFIG_DB_TBL_DALOHOTSPOTS']." WHERE geocode > ''";
$res = $dbSocket->query($sql);
$logDebugSQL .= $sql . "\n";
while($row = $res->fetchRow()) {
echo "
var point_$row[0] = new GLatLng($row[3]);
var marker_$row[0] = createMarker(point_$row[0], '$row[1]');
map.addOverlay(marker_$row[0]);
";
}
?>
var add = new GLatLng();
map.addOverlay(new GMarker(point_cus, icon));
}
}
//]]>
</script>
<?php
include 'library/closedb.php';
?>
<form name="editmaps" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="type" value="">
<input type="hidden" name="hotspotname" value="">
<input type="hidden" name="hotspotmac" value="">
<input type="hidden" name="hotspotgeo" value="">
</form>
<?php
include('include/config/logging.php');
?>
</div>
<div id="footer">
<?php
include 'page-footer.php';
?>
</div>
</div>
</div>
</body>
</html>