forked from M17-Project/ref-dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
158 lines (140 loc) · 6.84 KB
/
index.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
<?php
/*
* This dashboard is developed by KC1AWV for the mrefd M17
* reflector system. It is derived from the XLX dashboard
* originally developed by the DVBrazil team.
*
* version 1.1.2
*/
if (file_exists("./include/functions.php")) {
require_once("./include/functions.php");
} else {
die("functions.php does not exist.");
}
if (file_exists("./include/config.inc.php")) {
require_once("./include/config.inc.php");
} else {
die("config.inc.php does not exist. Be sure to copy /include/config.inc.php.dist to /include/config.inc.php and edit the file accordingly.");
}
if (!class_exists('ParseXML')) require_once("./include/class.parsexml.php");
if (!class_exists('Node')) require_once("./include/class.node.php");
if (!class_exists('xReflector')) require_once("./include/class.reflector.php");
if (!class_exists('Station')) require_once("./include/class.station.php");
if (!class_exists('Peer')) require_once("./include/class.peer.php");
if (!class_exists('Interlink')) require_once("./include/class.interlink.php");
$Reflector = new xReflector();
$Reflector->SetFlagFile("./include/country.csv");
$Reflector->SetPIDFile($Service['PIDFile']);
$Reflector->SetXMLFile($Service['XMLFile']);
$Reflector->LoadXML();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?php echo $PageOptions['MetaDescription']; ?>"/>
<meta name="keywords" content="<?php echo $PageOptions['MetaKeywords']; ?>"/>
<meta name="author" content="<?php echo $PageOptions['MetaAuthor']; ?>"/>
<meta name="revisit" content="<?php echo $PageOptions['MetaRevisit']; ?>"/>
<meta name="robots" content="<?php echo $PageOptions['MetaAuthor']; ?>"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title><?php echo $Reflector->GetReflectorName(); ?> Reflector Dashboard</title>
<link rel="icon" type="image/png" href="/images/icons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="/images/icons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/images/icons/favicon-96x96.png" sizes="96x96">
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/dashboard.css" rel="stylesheet">
<link href="css/navbar-top-fixed.css" rel="stylesheet">
<?php
if ($PageOptions['PageRefreshActive']) {
echo '
<script src="./js/jquery-1.12.4.min.js"></script>
<script>
var PageRefresh;
function ReloadPage() {
$.get("./index.php'.(isset($_GET['show'])?'?show='.$_GET['show']:'').'", function(data) {
var BodyStart = data.indexOf("<bo"+"dy");
var BodyEnd = data.indexOf("</bo"+"dy>");
if ((BodyStart >= 0) && (BodyEnd > BodyStart)) {
BodyStart = data.indexOf(">", BodyStart)+1;
$("body").html(data.substring(BodyStart, BodyEnd));
}
})
.always(function() {
PageRefresh = setTimeout(ReloadPage, '.$PageOptions['PageRefreshDelay'].');
});
}';
if (!isset($_GET['show']) || (($_GET['show'] != 'liveircddb') && ($_GET['show'] != 'reflectors') && ($_GET['show'] != 'interlinks') && ($_GET['show'] != 'livequadnet'))) {
echo '
PageRefresh = setTimeout(ReloadPage, ' . $PageOptions['PageRefreshDelay'] . ');';
}
echo '
function SuspendPageRefresh() {
clearTimeout(PageRefresh);
}
</script>';
}
if (!isset($_GET['show'])) $_GET['show'] = "";
?>
</head>
<body>
<?php if (file_exists("./tracking.php")) {
include_once("tracking.php");
} ?>
<nav class="navbar navbar-expand-lg navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#"><?php echo $Reflector->GetReflectorName(); ?> Reflector</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto">
<li<?php echo (($_GET['show'] == "users") || ($_GET['show'] == "")) ? ' class="nav-item active"' : ''; ?>><a class="nav-link" href="./index.php">Last Heard</a></li>
<li<?php echo ($_GET['show'] == "links") ? ' class="nav-item active"' : ''; ?>><a class="nav-link" href="./index.php?show=links">Links (<?php echo $Reflector->NodeCount(); ?>)</a></li>
<li<?php echo ($_GET['show'] == "peers") ? ' class="nav-item active"' : ''; ?>><a class="nav-link" href="./index.php?show=peers">Peers (<?php echo $Reflector->PeerCount(); ?>)</a></li>
</ul>
<span class="navbar-text px-2">mrefd v<?php echo $Reflector->GetVersion(); ?> - Dashboard v1.3.0 <?php echo $PageOptions['LocalModification']; ?></span>
<span class="navbar-text px-2">Service uptime: <?php echo FormatSeconds($Reflector->GetServiceUptime()); ?></span>
</div>
</nav>
<main role="main">
<div class="container-fluid">
<div class="row">
<?php
switch ($_GET['show']) {
case 'users' :
require_once("./include/users.php");
break;
case 'links' :
require_once("./include/links.php");
break;
case 'peers' :
require_once("./include/peers.php");
break;
default :
require_once("./include/users.php");
}
?>
</div>
</div>
</main>
<footer class="container-fluid">
<nav class="navbar navbar-expand-lg navbar-light fixed-bottom" style="background-color: #e3f2fd;">
<div id="navbarCollapse" class="collapse navbar-collapse">
<span class="navbar-text px-2">IPv4: <?php echo $PageOptions['IPV4']; ?></span>
<span class="navbar-text px-2">IPv6: <?php echo $PageOptions['IPV6']; ?></span>
</div>
<span class="navbar-text px-2"><a href="mailto:<?php echo $PageOptions['ContactEmail']; ?>">Sysop Email: <?php echo $PageOptions['ContactEmail']; ?></a></span>
</nav>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="js/bootstrap.bundle.min.js"></script>
</body>
</html>