From ae6f8a065aa433337311d74bc81cb05526246f88 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 7 Jul 2018 22:50:59 +0200 Subject: [PATCH] login/list: option to order by seen date Feature parity with login/visits. --- auth.inc.php | 5 +++++ login/list.php | 6 ++++++ 2 files changed, 11 insertions(+) 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 '