summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorShevAbam <shevabam@gmail.com>2015-07-13 09:43:34 +0200
committerShevAbam <shevabam@gmail.com>2015-07-13 09:43:34 +0200
commitb330d193bbd0170b6caabd604d30fc64c7b1d2d3 (patch)
treeec4957900b62c93610457993960a22660a37c747 /libs
parent9970343fe5c8226f25234addc6b80836c092fe1f (diff)
Add option to add custom title in header (esm:custom_title)
Last login : add option to enable or not Disk : add filesystem Disk : values are centered
Diffstat (limited to 'libs')
-rw-r--r--libs/disk.php6
-rw-r--r--libs/last_login.php33
2 files changed, 22 insertions, 17 deletions
diff --git a/libs/disk.php b/libs/disk.php
index f3da378..ed04934 100644
--- a/libs/disk.php
+++ b/libs/disk.php
@@ -4,7 +4,7 @@ $Config = new Config();
$datas = array();
-if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $1}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6}\'', $df)))
+if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{print $2}\'` \'{print substr($0,c);}\' | tail -n +2 | awk \'{print $1","$2","$3","$4","$5","$6","$7}\'', $df)))
{
$datas[] = array(
'total' => 'N.A',
@@ -12,6 +12,7 @@ if (!(exec('/bin/df -T | awk -v c=`/bin/df -T | grep -bo "Type" | awk -F: \'{pri
'free' => 'N.A',
'percent_used' => 0,
'mount' => 'N.A',
+ 'filesystem' => 'N.A',
);
}
else
@@ -20,7 +21,7 @@ else
foreach ($df as $mounted)
{
- list($type, $total, $used, $free, $percent, $mount) = explode(',', $mounted);
+ list($filesystem, $type, $total, $used, $free, $percent, $mount) = explode(',', $mounted);
if (strpos($type, 'tmpfs') !== false && $Config->get('disk:show_tmpfs') === false)
continue;
@@ -35,6 +36,7 @@ else
'free' => Misc::getSize($free * 1024),
'percent_used' => trim($percent, '%'),
'mount' => $mount,
+ 'filesystem' => $filesystem,
);
}
}
diff --git a/libs/last_login.php b/libs/last_login.php
index 2063731..4596e44 100644
--- a/libs/last_login.php
+++ b/libs/last_login.php
@@ -5,26 +5,29 @@ $Config = new Config();
$datas = array();
-if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1";"$5, $4, $8, $6}\'', $users)))
+if ($Config->get('last_login:enable'))
{
- $datas[] = array(
- 'user' => 'N.A',
- 'date' => 'N.A',
- );
-}
-else
-{
- $max = $Config->get('last_login:max');
-
- for ($i = 1; $i < count($users) && $i <= $max; $i++)
+ if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1";"$5, $4, $8, $6}\'', $users)))
{
- list($user, $date) = explode(';', $users[$i]);
-
$datas[] = array(
- 'user' => $user,
- 'date' => $date,
+ 'user' => 'N.A',
+ 'date' => 'N.A',
);
}
+ else
+ {
+ $max = $Config->get('last_login:max');
+
+ for ($i = 1; $i < count($users) && $i <= $max; $i++)
+ {
+ list($user, $date) = explode(';', $users[$i]);
+
+ $datas[] = array(
+ 'user' => $user,
+ 'date' => $date,
+ );
+ }
+ }
}
echo json_encode($datas); \ No newline at end of file