bans.php - dont pass null into Utils::escape

This commit is contained in:
Wruczek 2020-10-06 04:26:04 +02:00
parent d0d9c91ab2
commit 9848c096e6
1 changed files with 13 additions and 9 deletions

View File

@ -33,10 +33,14 @@ if ($banlist !== null) {
// will just show the UID, IP or MyTSID // will just show the UID, IP or MyTSID
$target = "(unknown)"; $target = "(unknown)";
$lastNickname = Utils::escape($ban["lastnickname"]); $lastNickname = null;
$filter = ""; $filter = "";
$abbreviation = null; $abbreviation = null;
if ($ban["lastnickname"] !== null) {
$lastNickname = Utils::escape($ban["lastnickname"]);
}
if ($ban["ip"]) { if ($ban["ip"]) {
$ip = str_replace("\\", "", (string) $ban["ip"]); $ip = str_replace("\\", "", (string) $ban["ip"]);
@ -44,7 +48,7 @@ if ($banlist !== null) {
$ip = Utils::censorIpAddress($ip); $ip = Utils::censorIpAddress($ip);
} catch (\Exception $e) {} } catch (\Exception $e) {}
if ($lastNickname) { if ($lastNickname !== null) {
$abbreviation = [$ip, "IP"]; $abbreviation = [$ip, "IP"];
} else { } else {
$target = $ip; $target = $ip;
@ -57,7 +61,7 @@ if ($banlist !== null) {
]; ];
} }
} else if ($ban["uid"]) { } else if ($ban["uid"]) {
if ($lastNickname) { if ($lastNickname !== null) {
$abbreviation = [$ban["uid"], "UID"]; $abbreviation = [$ban["uid"], "UID"];
} else { } else {
$target = new Html("<code>" . $ban["uid"] . "</code>"); $target = new Html("<code>" . $ban["uid"] . "</code>");
@ -65,7 +69,7 @@ if ($banlist !== null) {
} else if ($ban["name"]) { } else if ($ban["name"]) {
$target = $ban["name"]; $target = $ban["name"];
} else if (!empty($ban["mytsid"])) { // empty, older TS servers dont have MYTS bans, so the key might not exist } else if (!empty($ban["mytsid"])) { // empty, older TS servers dont have MYTS bans, so the key might not exist
if ($lastNickname) { if ($lastNickname !== null) {
$abbreviation = [$ban["mytsid"], "MyTSID"]; $abbreviation = [$ban["mytsid"], "MyTSID"];
} else { } else {
$target = new Html("<code>" . $ban["mytsid"] . "</code>"); $target = new Html("<code>" . $ban["mytsid"] . "</code>");