Repository navigation
Expand file tree
/
Copy pathgpsmap.php
More file actions
108 lines (92 loc) · 5.11 KB
/
Copy pathgpsmap.php
File metadata and controls
108 lines (92 loc) · 5.11 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
102
103
104
105
106
107
108
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2009-2013 Andrew Aloia |
| Copyright (C) 2014 Wixiweb |
| Copyright (C) 2004-2026 The Cacti Group |
| |
| 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 the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program 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 General Public License for more details. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
chdir('../../');
require('./include/auth.php');
require_once('./plugins/gpsmap/gpsmap_security.php');
require_once('./plugins/gpsmap/includes/setup/show.php');
require_once('./plugins/gpsmap/includes/setup/gpsmapinitial.php');
$body = '';
general_header();
// set headers to NOT cache a page
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');
// decide what needs to be shown
switch ($show) {
// selected nodes
case 'setup':
$body = __('Please make sure to properly configure Maps first under Settings > Maps', 'gpsmap');
break;
default:
if (!$parameter) {
$parameter = 'all';
}
/* Reject any parameter that contains directory traversal sequences or
* characters outside the safe set. basename() alone does not strip
* embedded ../ so we validate the whole value first. */
if (!gpsmap_artifact_parameter_is_valid($parameter)) {
$parameter = 'all';
}
$fileLocation = './plugins/gpsmap/XML/' . $parameter . '-top.html';
if (file_exists($fileLocation)) {
print file_get_contents($fileLocation);
}
break;
}
// ---------------------------------------------------------------
if ($show != 'setup') { ?>
<script type='text/javascript' <?php print plugin_gpsmap_csp_nonce(); ?>>
var initialLat = <?php print is_finite((float) $initialLat) ? json_encode((float) $initialLat) : '0'; ?>;
var initialLng = <?php print is_finite((float) $initialLong) ? json_encode((float) $initialLong) : '0'; ?>;
var initialZoom = <?php print json_encode((int) $initialzoom); ?>;
</script>
<script type='text/javascript' <?php print plugin_gpsmap_csp_nonce(); ?>>
gpsmap.refreshMap = <?php print json_encode((string) $refreshMap, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.initialLat = <?php print is_finite((float) $initialLat) ? json_encode((float) $initialLat) : '0'; ?>;
gpsmap.initialLng = <?php print is_finite((float) $initialLong) ? json_encode((float) $initialLong) : '0'; ?>;
gpsmap.initialZoom = <?php print json_encode((int) $initialzoom); ?>;
gpsmap.initialized = false;
gpsmap.liColor = <?php print json_encode((string) $liColor, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.liWidth = <?php print json_encode((string) $liWidth, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.liOpa = <?php print json_encode((string) $liOpa, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.fillColor = <?php print json_encode((string) $fillColor, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.fillOpa = <?php print json_encode((string) $fillOpa, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.circleQuality = <?php print json_encode((string) $circleQuality, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.enableWeather = <?php print json_encode((string) $enableWeather, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.coverageOverlay = <?php print json_encode((string) $coverageMap, JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.markerArray = [];
gpsmap.downloadURL = <?php print json_encode($config['url_path'] . 'plugins/gpsmap/XML/' . $parameter . '.xml', JSON_THROW_ON_ERROR | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES); ?>;
gpsmap.t_error = <?php print is_finite((float) $terror) ? json_encode((float) $terror) : '0'; ?>;
<?php require_once('plugins/gpsmap/includes/icons.php'); ?>
<?php require_once('plugins/gpsmap/includes/customicons.php'); ?>
window.onresize = gpsmap.resize;
$(function() {
gpsmap.loader();
});
</script>
<?php
}
$body .= '
<div id="mouse-position"></div>
<div id="map"></div>
';
print $body;
bottom_footer();