From 4d1e7d2a60e51c8afa6fcf7c34359e6a1982733f Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 7 Jul 2018 21:55:04 +0200 Subject: [PATCH] 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. --- auth.inc.php | 9 +++++++++ login/list.php | 18 ++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) 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 '