diff options
author | Joecowboy <i7wasn7m3@gmail.com> | 2012-01-05 17:56:17 -0600 |
---|---|---|
committer | Joecowboy <i7wasn7m3@gmail.com> | 2012-01-05 17:56:17 -0600 |
commit | 54f818b16f18c73b0b2689239a94abbce337cd13 (patch) | |
tree | d13dd78609aff74dc67042f50387b85410eecd04 | |
parent | 9a296f50e8a7cd9d1379c8be04bacb9b31d7bb78 (diff) | |
download | pfsense-54f818b16f18c73b0b2689239a94abbce337cd13.zip pfsense-54f818b16f18c73b0b2689239a94abbce337cd13.tar.gz |
Changed the output of function get_uptime() to display: 00 Hours 00 Minutes 00 Seconds
Added code function get_temp() to get the OID values for temperature.
-rw-r--r-- | usr/local/www/includes/functions.inc.php | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/usr/local/www/includes/functions.inc.php b/usr/local/www/includes/functions.inc.php index 6769d0e..041fd55 100644 --- a/usr/local/www/includes/functions.inc.php +++ b/usr/local/www/includes/functions.inc.php @@ -86,13 +86,31 @@ function get_uptime() { $uphours = (int)($uptime / 3600); $uptime %= 3600; $upmins = (int)($uptime / 60); + $uptime %= 60; + $upsecs = (int)($uptime); $uptimestr = ""; if ($updays > 1) - $uptimestr .= "$updays days, "; + $uptimestr .= "$updays Days "; else if ($updays > 0) - $uptimestr .= "1 day, "; - $uptimestr .= sprintf("%02d:%02d", $uphours, $upmins); + $uptimestr .= "1 Day "; + + if ($uphours > 1) + $hours = "Hours"; + else if ($uphours > 0) + $hours = "Hour"; + + if ($upmins > 1) + $minutes = "Minutes"; + else if ($uphours > 0) + $minutes = "Minute"; + + if ($upmins > 1) + $seconds = "Seconds"; + else if ($uphours > 0) + $seconds = "Second"; + + $uptimestr .= sprintf("%02d $hours %02d $minutes %02d $seconds", $uphours, $upmins, $upsecs); return $uptimestr; } @@ -148,12 +166,22 @@ function get_hwtype() { } function get_temp() { - switch(get_hwtype()) { + /*switch(get_hwtype()) { default: return; } - return $ret; + return $ret; */ + + $temp_out = ""; + exec("/sbin/sysctl dev.cpu.0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout); + $temp_out = trim($dfout[0]); + if ($temp_out == "") { + exec("/sbin/sysctl hw.acpi.thermal.tz0.temperature | /usr/bin/awk '{ print $2 }' | /usr/bin/cut -d 'C' -f 1", $dfout); + $temp_out = trim($dfout[0]); + } + + return $temp_out; } function disk_usage() @@ -264,4 +292,4 @@ function get_interfacestatus() { return $data; } -?> +?>
\ No newline at end of file |