2016-04-30 19:33:41 +02:00
|
|
|
<?php
|
|
|
|
function format_time($seconds) {
|
|
|
|
$secs = intval($seconds % 60);
|
|
|
|
$mins = intval($seconds / 60 % 60);
|
|
|
|
$hours = intval($seconds / 3600 % 24);
|
|
|
|
$days = intval($seconds / 86400);
|
|
|
|
$uptimeString = "";
|
|
|
|
|
|
|
|
if ($days > 0) {
|
|
|
|
$uptimeString .= $days;
|
|
|
|
$uptimeString .= (($days == 1) ? " day" : " days");
|
|
|
|
}
|
|
|
|
if ($hours > 0) {
|
|
|
|
$uptimeString .= (($days > 0) ? ", " : "") . $hours;
|
2016-05-09 15:46:49 +02:00
|
|
|
$uptimeString .= (($hours == 1) ? " hr" : " hrs");
|
2016-04-30 19:33:41 +02:00
|
|
|
}
|
|
|
|
if ($mins > 0) {
|
|
|
|
$uptimeString .= (($days > 0 || $hours > 0) ? ", " : "") . $mins;
|
2016-05-09 15:46:49 +02:00
|
|
|
$uptimeString .= (($mins == 1) ? " min" : " mins");
|
2016-04-30 19:33:41 +02:00
|
|
|
}
|
|
|
|
if ($secs > 0) {
|
|
|
|
$uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs;
|
2016-05-09 15:46:49 +02:00
|
|
|
$uptimeString .= (($secs == 1) ? " s" : " s");
|
2016-04-30 19:33:41 +02:00
|
|
|
}
|
|
|
|
return $uptimeString;
|
|
|
|
}
|
2016-05-01 22:53:23 +02:00
|
|
|
|
|
|
|
function startsWith($haystack, $needle) {
|
|
|
|
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
|
|
|
|
}
|
2016-05-12 15:55:02 +02:00
|
|
|
|
|
|
|
function getMHZ($freq) {
|
|
|
|
return substr($freq,0,3) . "." . substr($freq,3,3) . "." . substr($freq,6) . " Mhz";
|
|
|
|
}
|
|
|
|
|
2016-05-15 23:03:52 +02:00
|
|
|
function isProcessRunning($processname) {
|
|
|
|
exec("pgrep " . $processname, $pids);
|
|
|
|
if(empty($pids)) {
|
|
|
|
// process not running!
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
// process running!
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-20 14:16:33 +02:00
|
|
|
function createConfigLines() {
|
|
|
|
$out ="";
|
|
|
|
foreach($_GET as $key=>$val) {
|
|
|
|
if($key != "cmd") {
|
|
|
|
$out .= "define(\"$key\", \"$val\");"."\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $out;
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkSetup() {
|
2016-05-25 17:08:36 +02:00
|
|
|
if (null == DISTRIBUTION) {
|
2016-05-20 14:16:33 +02:00
|
|
|
?>
|
2016-05-25 17:08:36 +02:00
|
|
|
<div class="alert alert-danger" role="alert">You are using an old config.php. Please configure your Dashboard by calling <a href="setup.php">setup.php</a>!</div>
|
2016-05-20 14:16:33 +02:00
|
|
|
<?php
|
2016-05-25 17:08:36 +02:00
|
|
|
|
|
|
|
} else {
|
|
|
|
if (file_exists ("setup.php")) {
|
|
|
|
?>
|
|
|
|
<div class="alert alert-danger" role="alert">You forgot to remove setup.php in root-directory of your dashboard or you forgot to configure it! Please delete the file or configure your Dashboard by calling <a href="setup.php">setup.php</a>!</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
2016-05-20 14:16:33 +02:00
|
|
|
}
|
2016-04-30 19:33:41 +02:00
|
|
|
?>
|