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 +++++++++++-- web/template/pkg_details.php | 18 ------------------ web/template/pkgbase_details.php | 18 ------------------ web/template/tu_last_votes_list.php | 2 +- 4 files changed, 12 insertions(+), 39 deletions(-) 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; + } } /** diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index cc2f055..7b75210 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -289,33 +289,15 @@ if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))): - - - - - - - - - - - - - - - - - - diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index 2522f34..2ceb35f 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -148,33 +148,15 @@ if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))): - - - - - - - - - - - - - - - - - - diff --git a/web/template/tu_last_votes_list.php b/web/template/tu_last_votes_list.php index f7b07bc..5cff248 100644 --- a/web/template/tu_last_votes_list.php +++ b/web/template/tu_last_votes_list.php @@ -21,7 +21,7 @@ ?> - + -- cgit v1.2.3-70-g09d2