From a2f79eb2e1ff74e7d2403bf194a52b41cc7f3c0c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 14 Jun 2015 09:49:17 +0200 Subject: Refactor code for printing account links Signed-off-by: Lukas Fleischer --- web/lib/aur.inc.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'web/lib/aur.inc.php') diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index c4a1705..2d06fc8 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -181,10 +181,19 @@ function username_from_sid($sid="") { * * @param string $username The user name to format * - * @return void + * @return string The generated HTML code for the account link */ function html_format_username($username) { - return $username ? htmlspecialchars($username) : __("None"); + $username_fmt = $username ? htmlspecialchars($username, ENT_QUOTES) : __("None"); + + if ($username && $_COOKIE["AURSID"]) { + $link = '' . $username_fmt . ''; + return $link; + } else { + return $username_fmt; + } } /** -- cgit v1.2.3-54-g00ecf