From 9bdd4cbf85e7cec51dac14459deb5e750ea194d4 Mon Sep 17 00:00:00 2001 From: Karl Hudgell Date: Wed, 23 Mar 2016 16:03:43 +0000 Subject: [PATCH] uptime/css fix for update --- Update.bat | 23 ++++++++- WindowsUptime.class.php | 67 ++++++++++++++++++++++++++ clock.php | 2 +- config/set1.php | 1 + config/write1.php | 7 +++ css/black.css | 5 ++ css/blue.css | 5 ++ css/custom.php | 5 ++ css/red.css | 5 ++ css/static.php | 3 -- css/white.css | 4 ++ feeds/uptime.php | 19 ++++++++ left.php | 1 + main.php | 2 + right.php | 9 +++- uptime.exe | Bin 0 -> 13312 bytes uptime.php | 7 +++ version.txt | 2 +- winuptime.php | 104 ++++++++++++++++++++++++++++++++++++++++ 19 files changed, 263 insertions(+), 8 deletions(-) create mode 100644 WindowsUptime.class.php create mode 100644 feeds/uptime.php create mode 100644 uptime.exe create mode 100644 uptime.php create mode 100644 winuptime.php 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 0000000000000000000000000000000000000000..65c32309098ebca9917016f45ef5cbcd62a44cf7 GIT binary patch literal 13312 zcmeHN4Rjn=b-r(QwYyr|!YkRbRm;v;vXiwfttI*YN3mqdKe8>`Sh7t(#UAaBq$RsE z>zP^EN)BQjr#T5WG=}^EF~o)dfs>X{O8y8jNjPABd_o&2Npn(zX$Z-I1VUR%+oa!p zGqbz09UAEA;n0(}n)}|p@4fr(z3;v|@4Zp)J8z}{5e4zQ{yNbE$T@XL_`5*?)m4{0 zR7GE^{O;Tb#J2Cw?H@_oYR)o;EiJ1iHN!9+bx>EWyrHHIwR=aOnl)2;V#<{0JdgFx z4Mf{SkftpAudV)Q=SUHgM1)8MWvWXZUx%FW4m=E0WQr>{N>YB#=`K7_=G`A6=+*HT zl7Zv_;PLV@ZcQ!VD+k_B6rUtX6G4G!GE+K;>N$V2NhN{?#S{U)xrh-Z9Q}|3{QAoP zP$wUrgtDX(?N8V#&C!T%WO@f4=uE!xP~_A>bUI<#RuW~Y!+sQ4=*#hxr4B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7j#N}s{1X}pxq+kJoFT6Tti+k`4A5s_UAc?<5BT+;1P1YAo#%FFP#c* zWGWO0B|P{s3E=eU)1bUA|M(wiQNn{ClNkJO)4>TT7wn#pazPAIO22*!FBtT?tNW9bv6DV&2 z5xhp-hpnTKs!o+w;++8g2XU&4@jk$R)xZ4kqife4%4SsW9=5#!2c8BMm(yknhl%!v z-TfPzS2n2p{VAp4+@ZHOjOlj6x+|wd*J|Fyv-QJM5jMa8>1UGbcbJqW;*PJx7 zt2H~D7;SA(vzn0}(rw4P5p+ibD^)Er>%rFw2Um#`B;rF@gKFT5Lwm!7uc8Spmupz; za&WA?jZ5hv^G(Xr)*$;~Y+Fy}@x5ov!$Gn119`})r*>NDQJl<&b^A?nUE*_9kxG1U zW=Q7wLUEfus%O*;!}bQv?lDI3KfqRlnooBo@#Pj~9Kz>8-BU_3S$qj;e9;$AkbUjq kq7l$w?P7n1fV>I+`BQF!jof6&Us(62ti)Tg|DhK6Z@Yq-p#T5? literal 0 HcmV?d00001 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); +?> + + + + + + + +
+ + +