X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/c06c1713af2db485d55a91073bbc5b63b6aa8c0b..20d2aa3421da71c96892c926d3fafe39c0b66f16:/server-bans/index.php diff --git a/server-bans/index.php b/server-bans/index.php index fc2dee7..cdb5bf7 100644 --- a/server-bans/index.php +++ b/server-bans/index.php @@ -1,12 +1,12 @@ serverban()->add($ban_host, $ban_type, $ban_duration, $ban_reason)) + { + Message::Success("Ban added on ".htmlspecialchars($ban_host)); + } else { + $success = false; + if (($rpc->errno == -1001) && !empty($_POST['edit_existing'])) + { + // existing one = del + add + // and yeah we do this after add() fails because then we now + // at least the syntax and fields and everything are OK. + // This so we don't accidentally remove a ban and the add fails + // causing the edit to result in a deletion. + $e = explode(":", $_POST['edit_existing'], 2); + if (count($e) == 2) + { + if ($rpc->serverban()->delete($e[1], $e[0])) + { + /* Good, now try the add operation */ + if ($rpc->serverban()->add($ban_host, $ban_type, $ban_duration, $ban_reason)) + { + Message::Success("Ban successfully modified: ".htmlspecialchars($ban_host)); + $success = true; + } + } + } + } + if (!$success) + Message::Fail("The ".htmlspecialchars($ban_type)." on ".htmlspecialchars($ban_host)." could not be added: $rpc->error / $rpc->errno"); } - $msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for " . rpc_convert_duration_string($duration); - $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason"; - if ($bantype == "qline") { - if ($rpc->nameban()->add($iphost, $reason, $duration)) - Message::Success("Name Ban set against \"$iphost\": $reason"); - else - Message::Fail("Name Ban could not be set against \"$iphost\": $rpc->error"); - } elseif ($bantype == "except") { - if ($rpc->serverbanexception()->add($iphost, "", $duration, $reason)) - Message::Success("Exception set for \"$iphost\": $reason"); - else - Message::Fail("Exception could not be set \"$iphost\": $rpc->error"); - } else if ($rpc->serverban()->add($iphost, $bantype, $duration, $reason)) { - Message::Success("Host / IP: $iphost has been $bantype" . "d $msg_msg: $reason"); - } else - Message::Fail("The $bantype against \"$iphost\" could not be added: $rpc->error"); } } } @@ -102,127 +93,86 @@ if (!empty($_POST)) } } -$tkl = $rpc->serverban()->getAll(); ?>

Server Bans Overview

Here are all your network bans, from K-Lines to G-Lines, it's all here.

-

- + +