Truncate long away messages

* long away message fix

* Use mbstring functions, better variable names
pull/88/head
Nerdox 7 years ago committed by Wruczek
parent 1681be0a49
commit d7677243b2

@ -66,12 +66,20 @@ function getAdminList() {
$offlineClients[] = '<p><span class="label label-primary iconspacer">' . htmlspecialchars($userInfo['client_nickname']) . '</span><span class="label label-danger pull-right">' . translate($lang["adminlist"]["status"]["offline"]) . '</span></p>'; $offlineClients[] = '<p><span class="label label-primary iconspacer">' . htmlspecialchars($userInfo['client_nickname']) . '</span><span class="label label-danger pull-right">' . translate($lang["adminlist"]["status"]["offline"]) . '</span></p>';
continue; continue;
} }
$userAwayTitle = '';
if(!$user["client_away_message"]) { if(!$user["client_away_message"]) {
$userAway = translate($lang["adminlist"]["status"]["away"]); $userAway = translate($lang["adminlist"]["status"]["away"]);
} else { } else {
$userAway = htmlspecialchars($user["client_away_message"]); $userAway = htmlspecialchars($user["client_away_message"]);
if (mb_strlen($userAway) > 23) {
$userAwayTitle = 'title="' . $userAway . '"';
$userAway = mb_substr($userAway, 0, 23) . "...";
} }
$onlineClients[] = '<p><img src="lib/ts3phpframework/images/viewer/' . $user->getIcon() . '.png" alt="User status">' . '<span class="label label-primary">' . htmlspecialchars($user) . '</span>' . ($user['client_away'] ? '<span class="label label-warning pull-right">' . $userAway . '</span>' : '<span class="label label-success pull-right">' . translate($lang["adminlist"]["status"]["online"]) . '</span>') . '</p>'; }
$onlineClients[] = '<p><img src="lib/ts3phpframework/images/viewer/' . $user->getIcon() . '.png" alt="User status">' . '<span class="label label-primary">' . htmlspecialchars($user) . '</span>' . ($user['client_away'] ? '<span class="label label-warning pull-right" ' . $userAwayTitle . '>' . $userAway . '</span>' : '<span class="label label-success pull-right">' . translate($lang["adminlist"]["status"]["online"]) . '</span>') . '</p>';
} }
foreach (array_merge($onlineClients, $offlineClients) as $str) foreach (array_merge($onlineClients, $offlineClients) as $str)

Loading…
Cancel
Save