-
Notifications
You must be signed in to change notification settings - Fork 120
/
index.php
executable file
·363 lines (344 loc) · 16.8 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
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<?php
require_once('config/version.php');
require_once('config/ircddblocal.php');
require_once('config/language.php');
$configs = array();
if ($configfile = fopen($gatewayConfigPath,'r')) {
while ($line = fgets($configfile)) {
list($key,$value) = preg_split('/=/',$line);
$value = trim(str_replace('"','',$value));
if ($key != 'ircddbPassword' && strlen($value) > 0)
$configs[$key] = $value;
}
}
$progname = basename($_SERVER['SCRIPT_FILENAME'],".php");
$rev=$version;
//$MYCALL=strtoupper($callsign);
$MYCALL=strtoupper($configs['gatewayCallsign']);
// Check if the config file exists
if (file_exists('/etc/pistar-css.ini')) {
$piStarCssFile = '/etc/pistar-css.ini';
if (fopen($piStarCssFile,'r')) { $piStarCss = parse_ini_file($piStarCssFile, true); }
if ($piStarCss['BannerH1']['Enabled']) {
$piStarCssBannerH1 = $piStarCss['BannerH1']['Text'];
}
if ($piStarCss['BannerExtText']['Enabled']) {
$piStarCssBannerExtTxt = $piStarCss['BannerExtText']['Text'];
}
}
//Load the Pi-Star Release file
$pistarReleaseConfig = '/etc/pistar-release';
$configPistarRelease = array();
$configPistarRelease = parse_ini_file($pistarReleaseConfig, true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" lang="en">
<head>
<meta name="robots" content="index" />
<meta name="robots" content="follow" />
<meta name="language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php echo "<meta name=\"generator\" content=\"$progname $rev\" />\n"; ?>
<meta name="Author" content="Hans-J. Barthen (DL5DI), Kim Huebel (DG9VH) and Andy Taylor (MW0MWZ)" />
<meta name="Description" content="Pi-Star Dashboard" />
<meta name="KeyWords" content="MW0MWZ,MMDVMHost,ircDDBGateway,D-Star,ircDDB,Pi-Star,Blackwood,Wales,DL5DI,DG9VH" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="css/nice-select.min.css?ver=<?php echo $configPistarRelease['Pi-Star']['Version']; ?>" />
<title><?php echo "$MYCALL"." - ".$lang['digital_voice']." ".$lang['dashboard'];?></title>
<?php include_once "config/browserdetect.php"; ?>
<script type="text/javascript" src="/jquery.min.js"></script>
<script type="text/javascript" src="/functions.js"></script>
<script type="text/javascript">
$.ajaxSetup({ cache: false });
</script>
</head>
<body>
<?php
if ( ($_SERVER["PHP_SELF"] == "/admin/index.php") && ($configPistarRelease['Pi-Star']['Version'] < 4.1) && ($configPistarRelease['Pi-Star']['Hardware'] == "RPi") ) {
?>
<div>
<table align="center" width="760px" style="margin: 0px 0px 10px 0px; width: 100%;">
<tr>
<td align="center" valign="top" style="background-color: #ffff90; color: #906000;">Alert: You are running an outdated version of Pi-Star, please upgrade.<br />
New versions are available from the here: <a href="http://www.pistar.uk/downloads/" alt="Pi-Star Downloads">http://www.pistar.uk/downloads/</a>.</td>
</tr>
</table>
</div>
<?php }
if ( ($_SERVER["PHP_SELF"] == "/admin/index.php") && ($configPistarRelease['Pi-Star']['Version'] >= "4.1") && ($configPistarRelease['Pi-Star']['Version'] < "4.1.6") ) {
?>
<div>
<table align="center" width="760px" style="margin: 0px 0px 10px 0px; width: 100%;">
<tr>
<td align="center" valign="top" style="background-color: #ffff90; color: #906000;">Alert: An upgrade to Pi-Star has been released, click here to upgrade now: <a href="/admin/expert/upgrade.php" alt="Upgrade Pi-Star">Upgrade Pi-Star</a>.</td>
</tr>
</table>
</div>
<?php } ?>
<div class="container">
<div class="header">
<div style="font-size: 8px; text-align: left; padding-left: 8px; float: left;">Hostname: <?php echo exec('cat /etc/hostname'); ?></div><div style="font-size: 8px; text-align: right; padding-right: 8px;">Pi-Star:<?php echo $configPistarRelease['Pi-Star']['Version']?> / <?php echo $lang['dashboard'].": ".$version; ?></div>
<h1>Pi-Star <?php echo $lang['digital_voice']." ".$lang['dashboard_for']." ".$MYCALL; ?></h1>
<?php if (isset($piStarCssBannerH1)) { echo "<h1>".$piStarCssBannerH1."</h1>\n"; } ?>
<?php if (isset($piStarCssBannerExtTxt)) { echo "<p style=\"text-align: center; color: #ffffff;\">".$piStarCssBannerExtTxt."</p>\n"; }?>
<p style="padding-right: 5px; text-align: right; color: #ffffff;">
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> |
<?php if ($_SERVER["PHP_SELF"] == "/admin/index.php") {
echo ' <a href="/admin/live_modem_log.php" style="color: #ffffff;">'.$lang['live_logs'].'</a> |'."\n";
echo ' <a href="/admin/power.php" style="color: #ffffff;">'.$lang['power'].'</a> |'."\n";
echo ' <a href="/admin/update.php" style="color: #ffffff;">'.$lang['update'].'</a> |'."\n";
} ?>
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p>
</div>
<?php
// Output some default features
if ($_SERVER["PHP_SELF"] == "/admin/index.php") {
echo '<div class="contentwide">'."\n";
echo '<script type="text/javascript">'."\n";
echo 'function reloadSysInfo(){'."\n";
echo ' $("#sysInfo").load("/dstarrepeater/system.php",function(){ setTimeout(reloadSysInfo,15000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadSysInfo,15000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="sysInfo">'."\n";
include 'dstarrepeater/system.php'; // Basic System Info
echo '</div>'."\n";
echo '</div>'."\n";
}
// First lets figure out if we are in MMDVMHost mode, or dstarrepeater mode;
if (file_exists('/etc/dstar-radio.mmdvmhost')) {
include 'config/config.php'; // MMDVMDash Config
include_once 'mmdvmhost/tools.php'; // MMDVMDash Tools
function getMMDVMConfigFileContent() {
// loads /etc/mmdvmhost into array for further use
$conf = array();
if ($configs = @fopen('/etc/mmdvmhost', 'r')) {
while ($config = fgets($configs)) {
array_push($conf, trim ( $config, " \t\n\r\0\x0B"));
}
fclose($configs);
}
return $conf;
}
$mmdvmconfigfile = getMMDVMConfigFileContent();
echo '<div class="nav">'."\n"; // Start the Side Menu
echo '<script type="text/javascript">'."\n";
echo 'function reloadRepeaterInfo(){'."\n";
echo ' $("#repeaterInfo").load("/mmdvmhost/repeaterinfo.php",function(){ setTimeout(reloadRepeaterInfo,1000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadRepeaterInfo,1000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="repeaterInfo">'."\n";
include 'mmdvmhost/repeaterinfo.php'; // MMDVMDash Repeater Info
echo '</div>'."\n";
echo '</div>'."\n";
echo '<div class="content">'."\n";
$testMMDVModeDSTARnet = getConfigItem("D-Star Network", "Enable", $mmdvmconfigs);
if ( $testMMDVModeDSTARnet == 1 ) { // If D-Star network is enabled, add these extra features.
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
echo '<script type="text/javascript">'."\n";
echo 'function reloadrefLinks(){'."\n";
echo ' $("#refLinks").load("/dstarrepeater/active_reflector_links.php",function(){ setTimeout(reloadrefLinks,15000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadrefLinks,15000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="refLinks">'."\n";
include 'dstarrepeater/active_reflector_links.php'; // dstarrepeater gateway config
echo '</div>'."\n";
echo '<br />'."\n";
include 'dstarrepeater/link_manager.php'; // D-Star Link Manager
echo "<br />\n";
}
echo '<script type="text/javascript">'."\n";
echo 'function reloadcssConnections(){'."\n";
echo ' $("#cssConnects").load("/dstarrepeater/css_connections.php",function(){ setTimeout(reloadcssConnections,15000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadcssConnections,15000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="cssConnects">'."\n";
include 'dstarrepeater/css_connections.php'; // dstarrepeater gateway config
echo '</div>'."\n";
}
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
echo '<script type="text/javascript">'."\n";
echo 'function reloadbmConnections(){'."\n";
echo ' $("#bmConnects").load("/mmdvmhost/bm_links.php",function(){ setTimeout(reloadbmConnections,180000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadbmConnections,180000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="bmConnects">'."\n";
include 'mmdvmhost/bm_links.php'; // BM Links
echo '</div>'."\n";
}
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Options
include 'mmdvmhost/bm_manager.php'; // BM DMR Link Manager
}
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
echo '<script type="text/javascript">'."\n";
echo 'function reloadtgifConnections(){'."\n";
echo ' $("#tgifConnects").load("/mmdvmhost/tgif_links.php",function(){ setTimeout(reloadtgifConnections,180000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadtgifConnections,180000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="tgifConnects">'."\n";
include 'mmdvmhost/tgif_links.php'; // TGIF Links
echo '</div>'."\n";
}
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Options
include 'mmdvmhost/tgif_manager.php'; // TGIF DMR Link Manager
}
$testMMDVModeYSFnet = getConfigItem("System Fusion Network", "Enable", $mmdvmconfigs);
if ( $testMMDVModeYSFnet == 1 ) { // If YSF network is enabled, add these extra features.
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
include 'mmdvmhost/ysf_manager.php'; // YSF Links
}
}
$testMMDVModeP25net = getConfigItem("P25 Network", "Enable", $mmdvmconfigs);
if ( $testMMDVModeP25net == 1 ) { // If P25 network is enabled, add these extra features.
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
include 'mmdvmhost/p25_manager.php'; // P25 Links
}
}
$testMMDVModeNXDNnet = getConfigItem("NXDN Network", "Enable", $mmdvmconfigs);
if ( $testMMDVModeNXDNnet == 1 ) { // If NXDN network is enabled, add these extra features.
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
include 'mmdvmhost/nxdn_manager.php'; // NXDN Links
}
}
$testMMDVModeM17net = getConfigItem("M17 Network", "Enable", $mmdvmconfigs);
if ( $testMMDVModeM17net == 1 ) { // If NXDN network is enabled, add these extra features.
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Option
include 'mmdvmhost/m17_manager.php'; // M17 Links
}
}
echo '<script type="text/javascript">'."\n";
echo 'function reloadLocalTx(){'."\n";
echo ' $("#localTxs").load("/mmdvmhost/localtx.php",function(){ setTimeout(reloadLocalTx,1500) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadLocalTx,1500);'."\n";
echo 'function reloadLastHerd(){'."\n";
echo ' $("#lastHerd").load("/mmdvmhost/lh.php",function(){ setTimeout(reloadLastHerd,1500) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadLastHerd,1500);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="lastHerd">'."\n";
include 'mmdvmhost/lh.php'; // MMDVMDash Last Herd
echo '</div>'."\n";
echo "<br />\n";
echo '<div id="localTxs">'."\n";
include 'mmdvmhost/localtx.php'; // MMDVMDash Local Trasmissions
echo '</div>'."\n";
// If POCSAG is enabled, show the information pannel
$testMMDVModePOCSAG = getConfigItem("POCSAG Network", "Enable", $mmdvmconfigfile);
if ( $testMMDVModePOCSAG == 1 ) {
echo '<script type="text/javascript">'."\n";
echo 'function reloadPages(){'."\n";
echo ' $("#Pages").load("/mmdvmhost/pages.php",function(){ setTimeout(reloadPages,5000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadPages,5000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo "<br />\n";
echo '<div id="Pages">'."\n";
include 'mmdvmhost/pages.php'; // POCSAG Messages
echo '</div>'."\n";
}
} elseif (file_exists('/etc/dstar-radio.dstarrepeater')) {
echo '<div class="contentwide">'."\n";
include 'dstarrepeater/gateway_software_config.php'; // dstarrepeater gateway config
echo '<script type="text/javascript">'."\n";
echo 'function reloadrefLinks(){'."\n";
echo ' $("#refLinks").load("/dstarrepeater/active_reflector_links.php",function(){ setTimeout(reloadrefLinks,15000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadrefLinks,15000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<br />'."\n";
echo '<div id="refLinks">'."\n";
include 'dstarrepeater/active_reflector_links.php'; // dstarrepeater gateway config
echo '</div>'."\n";
echo '<br />'."\n";
if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Admin Only Options
include 'dstarrepeater/link_manager.php'; // D-Star Link Manager
echo "<br />\n";
}
echo '<script type="text/javascript">'."\n";
echo 'function reloadcssConnections(){'."\n";
echo ' $("#cssConnects").load("/dstarrepeater/css_connections.php",function(){ setTimeout(reloadcssConnections,15000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadcssConnections,15000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="cssConnects">'."\n";
include 'dstarrepeater/css_connections.php'; // dstarrepeater gateway config
echo '</div>'."\n";
echo '<script type="text/javascript">'."\n";
echo 'function reloadLocalTx(){'."\n";
echo ' $("#localTx").load("/dstarrepeater/local_tx.php",function(){ setTimeout(reloadLocalTx,3000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadLocalTx,3000);'."\n";
echo 'function reloadLastHerd(){'."\n";
echo ' $("#lh").load("/dstarrepeater/last_herd.php",function(){ setTimeout(reloadLastHerd,3000) });'."\n";
echo '}'."\n";
echo 'setTimeout(reloadLastHerd,3000);'."\n";
echo '$(window).trigger(\'resize\');'."\n";
echo '</script>'."\n";
echo '<div id="lh">'."\n";
include 'dstarrepeater/last_herd.php'; //dstarrepeater Last Herd
echo '</div>'."\n";
echo "<br />\n";
echo '<div id="localTx">'."\n";
include 'dstarrepeater/local_tx.php'; //dstarrepeater Local Transmissions
echo '</div>'."\n";
echo '<br />'."\n";
} else {
echo '<div class="contentwide">'."\n";
//We dont know what mode we are in - fail...
echo "<H1>No Mode Defined...</H1>\n";
echo "<p>I don't know what mode I am in, you probably just need to configure me.</p>\n";
echo "<p>You will be re-directed to the configuration portal in 10 secs</p>\n";
echo "<p>In the meantime, you might want to register on the support<br />\n";
echo "page here: <a href=\"https://www.facebook.com/groups/pistarusergroup/\" target=\"_new\">https://www.facebook.com/groups/pistarusergroup/</a><br />\n";
echo "or the Support forum here: <a href=\"https://forum.pistar.uk/\" target=\"_new\">https://forum.pistar.uk/</a></p>\n";
echo '<script type="text/javascript">setTimeout(function() { window.location="/admin/configure.php";},10000);</script>'."\n";
}
?>
</div>
<div class="footer">
Pi-Star / Pi-Star Dashboard, © Andy Taylor (MW0MWZ) 2014-<?php echo date("Y"); ?>.<br />
ircDDBGateway Dashboard by Hans-J. Barthen (DL5DI),<br />
MMDVMDash developed by Kim Huebel (DG9VH), <br />
Need help? Click <a style="color: #ffffff;" href="https://www.facebook.com/groups/pistarusergroup/" target="_new">here for the Facebook Group</a><br />
or Click <a style="color: #ffffff;" href="https://forum.pistar.uk/" target="_new">here to join the Support Forum</a><br />
Get your copy of Pi-Star from <a style="color: #ffffff;" href="http://www.pistar.uk/downloads/" target="_new">here</a>.<br />
</div>
</div>
</body>
<script type="text/javascript" src="/nice-select.min.js"></script>
<script type="text/javascript">
var selectize = document.querySelectorAll('select')
var options = {searchable: true};
selectize.forEach(function(select){
if( select.length > 30 && null === select.onchange ) {
select.classList.add("small", "selectize");
tabletd = select.closest('td');
tabletd.style.cssText = 'overflow-x:unset';
NiceSelect.bind(select, options);
}
});
</script>
</html>