From d7677243b271f0c91508a1cb32b6fde97781a68e Mon Sep 17 00:00:00 2001 From: Nerdox Date: Sat, 19 May 2018 01:48:20 +0200 Subject: [PATCH] Truncate long away messages * long away message fix * Use mbstring functions, better variable names --- include/adminlist.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/adminlist.php b/include/adminlist.php index 3470eaa..e7599d8 100644 --- a/include/adminlist.php +++ b/include/adminlist.php @@ -66,12 +66,20 @@ function getAdminList() { $offlineClients[] = '

' . htmlspecialchars($userInfo['client_nickname']) . '' . translate($lang["adminlist"]["status"]["offline"]) . '

'; continue; } + + $userAwayTitle = ''; + if(!$user["client_away_message"]) { $userAway = translate($lang["adminlist"]["status"]["away"]); - }else{ + } else { $userAway = htmlspecialchars($user["client_away_message"]); + if (mb_strlen($userAway) > 23) { + $userAwayTitle = 'title="' . $userAway . '"'; + $userAway = mb_substr($userAway, 0, 23) . "..."; + } } - $onlineClients[] = '

User status' . '' . htmlspecialchars($user) . '' . ($user['client_away'] ? '' . $userAway . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '

'; + + $onlineClients[] = '

User status' . '' . htmlspecialchars($user) . '' . ($user['client_away'] ? '' . $userAway . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '

'; } foreach (array_merge($onlineClients, $offlineClients) as $str)