From: Mischa POSLAWSKY Date: Sat, 7 Jul 2018 19:55:04 +0000 (+0200) Subject: login/list: profile class to access user data X-Git-Tag: v3.4~11 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/4d1e7d2a60e51c8afa6fcf7c34359e6a1982733f login/list: profile class to access user data Common object currently identical to array setup, but allowing for more complex features such as delayed setup. --- diff --git a/auth.inc.php b/auth.inc.php index 030a394..e4e8bb9 100644 --- a/auth.inc.php +++ b/auth.inc.php @@ -1,6 +1,15 @@ dir = $dir; + $this->login = basename($dir); + } +} + function login_password_verify($input, $test) { if (substr($test, 0, 1) != '$') { diff --git a/login/list.php b/login/list.php index 4c8f4f0..86e8daf 100644 --- a/login/list.php +++ b/login/list.php @@ -5,22 +5,20 @@ $users = glob("$basepath/*/"); if (!$users) return; foreach ($users as $col => $userdir) { - $users[$col] = [ - 'dir' => $userdir, - 'login' => basename($userdir), - 'name' => @file_get_contents("$userdir/name.txt"), - ]; + $user = new User($userdir); + $user->name = @file_get_contents("{$user->dir}/name.txt"); + $users[$col] = $user; } print '