From: Mischa POSLAWSKY Date: Sat, 7 Jul 2018 20:50:59 +0000 (+0200) Subject: login/list: option to order by seen date X-Git-Tag: v3.4~6 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/ae6f8a065aa433337311d74bc81cb05526246f88 login/list: option to order by seen date Feature parity with login/visits. --- diff --git a/auth.inc.php b/auth.inc.php index fc30ccf..c8b6b31 100644 --- a/auth.inc.php +++ b/auth.inc.php @@ -23,6 +23,11 @@ class User { return @file_exists("{$this->dir}/.admin"); } + + function seen() + { + return @filemtime("{$this->dir}/last.log"); + } } function login_password_verify($input, $test) diff --git a/login/list.php b/login/list.php index cae89f0..d3b1f17 100644 --- a/login/list.php +++ b/login/list.php @@ -8,6 +8,12 @@ foreach ($users as $col => $userdir) { $users[$col] = new User($userdir); } +if (@$Place['order'] == 'seen') { + $order = array_map(function ($col) { return $col->seen; }, $users); +# $order = array_column($users, 'seen'); #TODO php7 simplification + array_multisort($order, SORT_DESC, SORT_NUMERIC, $users); +} + print '