uptime/css fix for update

This commit is contained in:
Karl Hudgell 2016-03-23 16:03:43 +00:00
parent 3c40fd70f5
commit 9bdd4cbf85
19 changed files with 263 additions and 8 deletions

View File

@ -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 ^<?php >>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

67
WindowsUptime.class.php Normal file
View File

@ -0,0 +1,67 @@
<?php
/**
* Windows Uptime Class
*
* http://pmav.eu/stuff/php-windows-uptime/
*
* v1.0 - 17/Oct/2008
* v1.1 - 10/Sep/2009
*/
class WindowsUptime {
const DEFAULT_FILE = 'c:\pagefile.sys';
const DEFAULT_DATE_FORMAT = 'd/M/Y @ H:i';
const RAW_OUTPUT = true;
private $file;
function __construct($file = self::DEFAULT_FILE) {
$this->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;
}
}
?>

View File

@ -44,7 +44,7 @@ GetClock();
setInterval(GetClock,1000);
}
</script>
<div id="clockbox" style="font:12pt Arial; color:#0066FF;"></div>
<div id="clockbox" style="font:11pt Arial; color:#0066FF;"></div>
</select>
</form>
</td>

View File

@ -30,6 +30,7 @@
Clock Widget Enabled: <input name="clockvisible" id="id" type="checkbox" <?php if($clockvisible > "0") echo "checked=checked; "; ?> /><br />
KKnowledge Widget Enabled: <input name="kknowledgefeedvisible" id="id" type="checkbox" <?php if($kknowledgefeedvisible > "0") echo "checked=checked; "; ?> /><br />
Klips Widget Enabled: <input name="webclipfeedvisible" id="id" type="checkbox" <?php if($webclipfeedvisible > "0") echo "checked=checked; "; ?> /><br />
Server Uptime Widget Enabled: <input name="uptimevisible" id="id" type="checkbox" <?php if($uptimevisible > "0") echo "checked=checked; "; ?> /><br />
Coming Episodes Widget Enabled: <input name="mediawidget" id="id" type="checkbox" <?php if($mediawidget > "0") echo "checked=checked; "; ?> /> - Week View: <input name="mediawidget2" id="id" type="checkbox" <?php if($mediawidget2 > "0") echo "checked=checked; "; ?> /><br /><br />
</div>
<div style="float:right; width:50%; ">

View File

@ -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);

View File

@ -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; }

View File

@ -132,4 +132,9 @@ div.head {
font-size: 16pt;
color: white;
}
div.UpdateNotify {
color: Red;
font-size: 12pt;
}
</style>

View File

@ -136,4 +136,9 @@ iframe {
background: <?php echo $custombackground; ?>; /* this is just to make the frames easier to see */
}
div.UpdateNotify {
color: Red;
font-size: 12pt;
}
</style>

View File

@ -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; }

View File

@ -38,9 +38,6 @@ iframe {
border: none;
}
div.UpdateNotify {
color: Red;
}
</style>

View File

@ -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; }

19
feeds/uptime.php Normal file
View File

@ -0,0 +1,19 @@
<body>
<table width='275' cellspacing='0' cellpadding='1'>
<tr onclick="toggleNextRow(this)">
<th style='text-align: left;'><font color='white'>Server Up Time</font></th>
</tr>
<tr>
<td BGCOLOR='#FFFFFF'>
<div id="Uptime" style="font:11pt Arial; color:#0066FF;">
<?php
require_once ('WindowsUptime.class.php');
$windowsUptime = new WindowsUptime();
echo $windowsUptime->uptime(); // Default output format
?>
</div>
</select>
</form>
</td>
</table>

View File

@ -65,6 +65,7 @@ if ($drivespacevisible > "0") {
}
?>
</div>
</div>
</body>

View File

@ -197,6 +197,8 @@ if ($localversion != $remoteversion) {
?>
</div>
<div id="stats">
<?php
if ($MStatusEnabled > "0") {

View File

@ -47,12 +47,19 @@ indicateSelected(formref.switchcontrol)
<?php include 'config.php';?>
<div id="style">
<div class="innertube">
<?php
if ($clockvisible > "0") {
require "clock.php";
} else {
}
?>
</p>
<?php
if ($uptimevisible > "0") {
require "/feeds/uptime.php";
} else {
}
?>
</p>

BIN
uptime.exe Normal file

Binary file not shown.

7
uptime.php Normal file
View File

@ -0,0 +1,7 @@
<?php
require_once ('WindowsUptime.class.php');
$windowsUptime = new WindowsUptime();
echo "Server Uptime - ";
echo $windowsUptime->uptime(); // Default output format
?>

View File

@ -1,4 +1,4 @@
<?php
//// KLANDING VERSION
$remoteversion = "2.4"; //
$remoteversion = "2.5"; //
?>

104
winuptime.php Normal file
View File

@ -0,0 +1,104 @@
<?php
/**********************************************************************
Dynamic Uptime Script (shell_exec version)
in PHP / JavaScript / DHTML for Windows
Written by Tony Bhimani
September 17, 2005
http://www.xenocafe.com/
This code is free for use by anyone that finds it useful and
all I ask in return is some credit if you use it.
This script is much like the one I wrote for Linux, but works for
Microsoft Windows platforms. It issues "net statistics server"
to get information about the running OS. Within that information
is when Windows started up. That date & time is stripped out using
a regular expressions, converted to a Unix timestamp, and the total
uptime in seconds is calculated by subtracting the current time.
The rest of the code is identical to my Linux uptime script.
***********************************************************************/
// format the uptime in case the browser doesn't support dhtml/javascript
// static uptime string
function format_uptime($seconds) {
$secs = intval($seconds % 60);
$mins = intval($seconds / 60 % 60);
$hours = intval($seconds / 3600 % 24);
$days = intval($seconds / 86400);
if ($days > 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);
?>
<html>
<head>
<script language="javascript">
<!--
var upSeconds=<?php echo $uptimeSecs; ?>;
function doUptime() {
var uptimeString = "Server Uptime: ";
var secs = parseInt(upSeconds % 60);
var mins = parseInt(upSeconds / 60 % 60);
var hours = parseInt(upSeconds / 3600 % 24);
var days = parseInt(upSeconds / 86400);
if (days > 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");
}
var span_el = document.getElementById("uptime");
var replaceWith = document.createTextNode(uptimeString);
span_el.replaceChild(replaceWith, span_el.childNodes[0]);
upSeconds++;
setTimeout("doUptime()",1000);
}
// -->
</script>
</head>
<body onLoad="doUptime();">
<!-- Uses the DIV tag, but SPAN can be used as well -->
<div id="uptime" style="font-weight:bold;"><?php echo $staticUptime; ?></div>
</body>
</html>