X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/14333f2dd829593a0d3c578ccdd23693ab04a3ef..801b58dafc2722ee8d8959649e6a1b77b28bf53e:/auth.inc.php diff --git a/auth.inc.php b/auth.inc.php index af02ec3..65b7f72 100644 --- a/auth.inc.php +++ b/auth.inc.php @@ -5,6 +5,9 @@ class User { function __construct($dir) { + if (!file_exists($dir)) { + throw new Exception("Gebruiker niet gevonden in $dir"); + } $this->dir = $dir; $this->login = basename($dir); } @@ -14,9 +17,24 @@ class User return $this->$col = $this->$col(); # run method and cache } + function rawname() + { + return rtrim(@file_get_contents("{$this->dir}/name.txt")); + } + function name() { - return @file_get_contents("{$this->dir}/name.txt"); + return htmlspecialchars(implode(' & ', explode("\n", $this->rawname))); + } + + function admin() + { + return @file_exists("{$this->dir}/.admin"); + } + + function seen() + { + return @filemtime("{$this->dir}/last.log"); } }