diff options
author | Ermal <eri@pfsense.org> | 2013-01-05 16:58:30 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-01-05 16:58:30 +0000 |
commit | e294adedc7b08f57371d95577fcc71c8d89e1643 (patch) | |
tree | 9d46d5686440e31454910b64910d26d9f18c429c /etc/inc/config.lib.inc | |
parent | 184847b5d144abcdad2f1d75d641c6d94235b75f (diff) | |
download | pfsense-e294adedc7b08f57371d95577fcc71c8d89e1643.zip pfsense-e294adedc7b08f57371d95577fcc71c8d89e1643.tar.gz |
Make the logic a bit more robust and readble
Diffstat (limited to 'etc/inc/config.lib.inc')
-rw-r--r-- | etc/inc/config.lib.inc | 9 |
1 files changed, 8 insertions, 1 deletions
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']; |