Menu

[r10367]: / experimental / smarty / www / index.php  Maximize  Restore  History

Download this file

70 lines (59 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
$pgtitle = array("FreeNAS webGUI");
require_once("guicore.inc");
require_once("util.inc");
$webgui->assign("page_title", "");
$webgui->assign("hostname", "{$config['system']['hostname']}.{$config['system']['domain']}");
$webgui->assign("version", get_product_version());
$webgui->assign("buildtime", get_product_buildtime());
exec("/sbin/sysctl -n kern.ostype", $ostype);
exec("/sbin/sysctl -n kern.osrelease", $osrelease);
exec("/sbin/sysctl -n kern.osrevision", $osrevision);
$webgui->assign("osversion", "$ostype[0] $osrelease[0] (revison $osrevision[0])");
$platform = htmlspecialchars($g['fullplatform']);
exec("/sbin/sysctl -n hw.model", $cputype);
foreach ($cputype as $cputypel) $platform .= " on " . htmlspecialchars($cputypel);
exec("/sbin/sysctl -n hw.clockrate", $clockrate);
$platform .= " running at $clockrate[0] MHz";
$webgui->assign("platform", $platform);
exec("/sbin/sysctl -n kern.boottime", $boottime);
preg_match("/sec = (\d+)/", $boottime[0], $matches);
$boottime = $matches[1];
$uptime = time() - $boottime;
if ($uptime > 60)$uptime += 30;
$updays = (int)($uptime / 86400);
$uptime %= 86400;
$uphours = (int)($uptime / 3600);
$uptime %= 3600;
$upmins = (int)($uptime / 60);
$uptimestr = "";
if ($updays > 1)
$uptimestr .= "$updays ".gettext("days").", ";
else if ($updays > 0)
$uptimestr .= "1 ".gettext("day").", ";
$uptimestr .= sprintf("%02d:%02d", $uphours, $upmins);
$webgui->assign("uptime", htmlspecialchars($uptimestr));
if ($config['lastchange']) {
$webgui->assign("lastchange", htmlspecialchars(date("D M j G:i:s T Y", $config['lastchange'])));
}
/* Get RAM informations. */
$raminfo = get_ram_info();
$memusage['percentage'] = round(($raminfo['used'] * 100) / $raminfo['total'], 0);
$memusage['caption'] = $memusage['percentage'] . "% of " . round($raminfo['physical'] / 1024 / 1024) . "MB";
$webgui->assign("memusage", $memusage);
exec("uptime", $result);
$webgui->assign("loadaverages", substr(strrchr($result[0], "load averages:"),15)." <SMALL>[<A href='status_process.php'>".gettext("show process information")."</A></SMALL>]");
$diskuse = get_mount_use();
$diskusage = array();
if (is_array($diskuse)) {
foreach ($diskuse as $diskusek => $diskusev) {
$percent_used = rtrim($diskusev['capacity'],"%");
$disk['name'] = htmlspecialchars($diskusek);
$disk['percentage'] = intval(rtrim($diskusev['capacity'],"%"));
$disk['caption'] = $disk['percentage'] . "% of " . $diskusev['size'] . "B";
$diskusage[] = $disk;
}
}
$webgui->assign("diskusage", $diskusage);
$webgui->display('index.tpl');
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.