From e294adedc7b08f57371d95577fcc71c8d89e1643 Mon Sep 17 00:00:00 2001 From: Ermal Date: Sat, 5 Jan 2013 16:58:30 +0000 Subject: Make the logic a bit more robust and readble --- etc/inc/config.lib.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'etc/inc/config.lib.inc') diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index d4f4b5e..4d939f7 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -509,7 +509,14 @@ function write_config($desc="Unknown", $backup = true) { } } - $username = !empty($_SESSION["Username"]) ? $_SESSION['Username'] : empty($_ENV['USER']) ? "(system)" : $_ENV['USER']; + if (empty($_SESSION["Username"])) { + if (empty($_ENV['USER']) || $_ENV['USER'] == "root") + $username = "(system)"; + else + $username = $_ENV['USER']; + } else + $username = $_SESSION["Username"]; + if (!empty($_SERVER['REMOTE_ADDR'])) $username .= '@' . $_SERVER['REMOTE_ADDR']; -- cgit v1.1