mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Refactor code for printing account links
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
19ee268935
commit
a2f79eb2e1
4 changed files with 12 additions and 39 deletions
|
@ -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 = '<a href="' . get_uri('/account/') . $username_fmt;
|
||||
$link .= '" title="' . __('View account information for %s', $username_fmt);
|
||||
$link .= '">' . $username_fmt . '</a>';
|
||||
return $link;
|
||||
} else {
|
||||
return $username_fmt;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue