diff --git a/Update.bat b/Update.bat index 1f6f20d..fb4f943 100644 --- a/Update.bat +++ b/Update.bat @@ -372,6 +372,25 @@ findstr "mediawidget2" config.php >nul 2>&1 goto END :END + rem uptime episodes +findstr "uptimevisible" config.php >nul 2>&1 + if errorlevel 1 goto ONE + if errorlevel 0 goto ZERO + goto END + :ZERO + echo Server Uptime Already Updated + goto END + :ONE + echo ^>config.php + echo //// server uptime >> config.php + echo $uptimevisible = "1"; >> config.php + echo //// >> config.php + echo ^?^> >> config.php + echo Server Uptime Widget Updated + goto END + :END + + rem Update Version @@ -394,8 +413,8 @@ findstr "localversion" config.php >nul 2>&1 goto END :END :ONE - cscript replace.vbs "config.php" "2.3" "2.4" - echo Version Updated to 2.4 + cscript replace.vbs "config.php" "2.4" "2.5" + echo Version Updated to 2.5 goto END :END diff --git a/WindowsUptime.class.php b/WindowsUptime.class.php new file mode 100644 index 0000000..72de28d --- /dev/null +++ b/WindowsUptime.class.php @@ -0,0 +1,67 @@ +file = $file; + } + + + public function uptime($rawOutput = false) { + $uptime = (time() - filemtime($this->file)); + + if (!$rawOutput) { + $days = floor($uptime / (24 * 3600)); + $uptime = $uptime - ($days * (24 * 3600)); + $hours = floor($uptime / (3600)); + $uptime = $uptime - ($hours * (3600)); + $minutes = floor($uptime / (60)); + $uptime = $uptime - ($minutes * 60); + $seconds = $uptime; + + $days = $days.' day'.($days != 1 ? 's' : ''); + $hours = $hours.' hour'.($hours != 1 ? 's' : ''); + $minutes = $minutes.' minute'.($minutes != 1 ? 's' : ''); + $seconds = $seconds.' second'.($seconds != 1 ? 's' : ''); + + $uptime = $days.' '.$hours.' '.$minutes; + } + + return $uptime; + } + + + public function upSince($dateFormat = self::DEFAULT_DATE_FORMAT) { + return date($dateFormat, filemtime($this->file)); + } + + + public function getFile() { + return $this->file; + } + + + public function setFile($file) { + $this->file = $file; + } + +} + +?> + \ No newline at end of file diff --git a/clock.php b/clock.php index 266c44a..330764f 100644 --- a/clock.php +++ b/clock.php @@ -44,7 +44,7 @@ GetClock(); setInterval(GetClock,1000); } -
+
diff --git a/config/set1.php b/config/set1.php index 9986498..3a664d4 100644 --- a/config/set1.php +++ b/config/set1.php @@ -30,6 +30,7 @@ Clock Widget Enabled: "0") echo "checked=checked; "; ?> />
KKnowledge Widget Enabled: "0") echo "checked=checked; "; ?> />
Klips Widget Enabled: "0") echo "checked=checked; "; ?> />
+ Server Uptime Widget Enabled: "0") echo "checked=checked; "; ?> />
Coming Episodes Widget Enabled: "0") echo "checked=checked; "; ?> /> - Week View: "0") echo "checked=checked; "; ?> />

diff --git a/config/write1.php b/config/write1.php index 61940de..c6df1da 100644 --- a/config/write1.php +++ b/config/write1.php @@ -22,6 +22,7 @@ $mediawidget1 = $_POST['mediawidget']; $mediawidget21 = $_POST['mediawidget2']; $mediastatscolour1 = $_POST['mediastatscolour']; $mediastatstextcolour1 = $_POST['mediastatstextcolour']; +$uptimevisible1 = $_POST['uptimevisible']; // $fl='../config.php'; @@ -68,6 +69,12 @@ $content = preg_replace( '/\$widgetcolour = \"(.*?)\";/', '$widgetcolour = "#' } else { $content = preg_replace( '/\$konvosvisible = \"(.*?)\";/', '$konvosvisible = "1";', $content); } + // server uptime Settings + if (empty($uptimevisible1)) { + $content = preg_replace( '/\$uptimevisible = \"(.*?)\";/', '$uptimevisible = "0";', $content); + } else { + $content = preg_replace( '/\$uptimevisible = \"(.*?)\";/', '$uptimevisible = "1";', $content); + } // konvoschat Settings if (empty($konvoschat1)) { $content = preg_replace( '/\$konvoschat = \"(.*?)\";/', '$konvoschat = "0";', $content); diff --git a/css/black.css b/css/black.css index 931d8c2..c730162 100644 --- a/css/black.css +++ b/css/black.css @@ -128,6 +128,11 @@ font-size: 16pt; color: white; } +div.UpdateNotify { + color: Red; + font-size: 12pt; +} + div#config a:link { color: black; } div#config a:visited { color: black; } div#config a:hover { color: black; } diff --git a/css/blue.css b/css/blue.css index 6e83508..9cb340d 100644 --- a/css/blue.css +++ b/css/blue.css @@ -132,4 +132,9 @@ div.head { font-size: 16pt; color: white; } + +div.UpdateNotify { + color: Red; + font-size: 12pt; +} \ No newline at end of file diff --git a/css/custom.php b/css/custom.php index 4532d18..2690e87 100644 --- a/css/custom.php +++ b/css/custom.php @@ -136,4 +136,9 @@ iframe { background: ; /* this is just to make the frames easier to see */ } + div.UpdateNotify { + color: Red; + font-size: 12pt; +} + \ No newline at end of file diff --git a/css/red.css b/css/red.css index 726dffd..95d6e48 100644 --- a/css/red.css +++ b/css/red.css @@ -120,6 +120,11 @@ font-size: 16pt; text-align: right; color: red; } + + div.UpdateNotify { + color: Black; + font-size: 12pt; +} div#config a:link { color: red; } div#config a:visited { color: red; } div#config a:hover { color: red; } diff --git a/css/static.php b/css/static.php index 597927e..ca296f3 100644 --- a/css/static.php +++ b/css/static.php @@ -38,9 +38,6 @@ iframe { border: none; } -div.UpdateNotify { - color: Red; -} diff --git a/css/white.css b/css/white.css index ea82a97..5f227f1 100644 --- a/css/white.css +++ b/css/white.css @@ -121,6 +121,10 @@ div.head { font-size: 16pt; color: black; } +div.UpdateNotify { + color: Red; + font-size: 12pt; +} div#config a:link { color: white; } div#config a:visited { color: white; } diff --git a/feeds/uptime.php b/feeds/uptime.php new file mode 100644 index 0000000..efab0fe --- /dev/null +++ b/feeds/uptime.php @@ -0,0 +1,19 @@ + + + + + + + +
Server Up Time
+
+uptime(); // Default output format +?> +
+ + +
\ No newline at end of file diff --git a/left.php b/left.php index 3bcacf6..34ded63 100644 --- a/left.php +++ b/left.php @@ -65,6 +65,7 @@ if ($drivespacevisible > "0") { } ?> +
diff --git a/main.php b/main.php index 364cccf..a013f70 100644 --- a/main.php +++ b/main.php @@ -197,6 +197,8 @@ if ($localversion != $remoteversion) { ?> + +
"0") { diff --git a/right.php b/right.php index 76e0919..311e8a8 100644 --- a/right.php +++ b/right.php @@ -47,12 +47,19 @@ indicateSelected(formref.switchcontrol)
- "0") { require "clock.php"; } else { +} +?> +

+ "0") { + require "/feeds/uptime.php"; +} else { + } ?>

diff --git a/uptime.exe b/uptime.exe new file mode 100644 index 0000000..65c3230 Binary files /dev/null and b/uptime.exe differ diff --git a/uptime.php b/uptime.php new file mode 100644 index 0000000..7d5ae89 --- /dev/null +++ b/uptime.php @@ -0,0 +1,7 @@ +uptime(); // Default output format +?> \ No newline at end of file diff --git a/version.txt b/version.txt index 6de1228..9266364 100644 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/winuptime.php b/winuptime.php new file mode 100644 index 0000000..3f99997 --- /dev/null +++ b/winuptime.php @@ -0,0 +1,104 @@ + 0) { + $uptimeString .= $days; + $uptimeString .= (($days == 1) ? " day" : " days"); + } + if ($hours > 0) { + $uptimeString .= (($days > 0) ? ", " : "") . $hours; + $uptimeString .= ((hours == 1) ? " hour" : " hours"); + } + if ($mins > 0) { + $uptimeString .= (($days > 0 || $hours > 0) ? ", " : "") . $mins; + $uptimeString .= (($mins == 1) ? " minute" : " minutes"); + } + if ($secs > 0) { + $uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? ", " : "") . $secs; + $uptimeString .= (($secs == 1) ? " second" : " seconds"); + } + return $uptimeString; +} + +// get the server statistics with "net statistics server" by shell_exec +$winstats = shell_exec("net statistics server"); + +// grab the date & time the server started up +preg_match("(\d{1,2}/\d{1,2}/\d{4}\s+\d{1,2}\:\d{2}\s+\w{2})", $winstats, $matches); + +// convert the readable date & time to a timestamp and deduct it from the current timestamp +// thus giving us the total uptime in seconds +$uptimeSecs = time() - strtotime($matches[0]); + +// get the static uptime +$staticUptime = "Server Uptime: ".format_uptime($uptimeSecs); +?> + + + + + + + +
+ + +