}
$msg_msg = ($duration == "0" || $duration == "0w0d0h") ? "permanently" : "for ".rpc_convert_duration_string($duration);
$reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason";
- if ($rpc->serverban()->add($iphost, $bantype, $duration, $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->exception()->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");
}
}
$tkl = $rpc->serverban()->getAll();
+foreach ($rpc->nameban()->getAll() as $v)
+ $tkl[] = $v;
?>
-<div class="tkl_add_boxheader">
- Add Server Ban
- </div>
- <div class="tkl_add_form">
+<h4>Server Bans Overview</h4><br>
+<p><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
+ Add entry
+ </button></p></table>
+ <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
+ <div class="modal-dialog modal-dialog-centered" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="myModalLabel">Add new Server Ban</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
<form action="tkl.php" method="post">
- <div class="align_label">IP / Host:</div><input class="input_text" type="text" id="tkl_add" name="tkl_add"><br>
- <div class="align_label">Ban Type:</div><select name="bantype" id="bantype">
+ <div class="align_label">IP / Host: </div> <input class="curvy" type="text" id="tkl_add" name="tkl_add"><br>
+ <div class="align_label">Ban Type: </div> <select class="curvy" name="bantype" id="bantype">
<option value=""></option>
<optgroup label="Bans">
<option value="kline">Kill Line (KLine)</option>
</optgroup>
</select><br>
<div class="align_label"><label for="banlen_w">Duration: </label></div>
- <select name="banlen_w" id="banlen_w">
+ <select class="curvy" name="banlen_w" id="banlen_w">
<?php
for ($i = 0; $i <= 56; $i++)
{
}
?>
</select>
- <select name="banlen_d" id="banlen_d">
+ <select class="curvy" name="banlen_d" id="banlen_d">
<?php
for ($i = 0; $i <= 31; $i++)
{
}
?>
</select>
- <select name="banlen_h" id="banlen_h">
+ <select class="curvy" name="banlen_h" id="banlen_h">
<?php
for ($i = 0; $i <= 24; $i++)
{
?>
</select>
<br><div class="align_label"><label for="ban_reason">Reason: </label></div>
- <input class="input_text" type="text" id="ban_reason" name="ban_reason"><br>
- <input class="input_text" type="checkbox" id="soft" name="soft">Don't affect logged-in users (soft)
- <div class="align_right_button_tkl_add"><input class="cute_button" type="submit" id="submit" value="Submit"></div>
- </form>
+ <input class="curvy input_text" type="text" id="ban_reason" name="ban_reason"><br>
+ <input class="curvy input_text" type="checkbox" id="soft" name="soft">Don't affect logged-in users (soft)
+
+ </div>
+
+ <div class="modal-footer">
+ <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
+ <button type="submit" action="post" class="btn btn-danger">Add Ban</button>
+ </form>
+ </div>
+ </div>
+ </div>
</div>
- <table class='users_overview'>
- <form action="" method="post">
+
+ <table class="table table-responsive caption-top table-striped">
+ <thead class="table-primary">
+ <form action="tkl.php" method="post">
<th><input type="checkbox" label='selectall' onClick="toggle_tkl(this)" />Select all</th>
<th>Mask</th>
<th>Type</th>
<th>Expires</th>
<th>Duration</th>
<th>Reason</th>
+ </thead>
<?php
foreach($tkl as $tkl)
echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl->name).",".base64_encode($tkl->type) . "' name=\"tklch[]\"></td>";
echo "<td>".$tkl->name."</td>";
echo "<td>".$tkl->type_string."</td>";
- echo "<td>".$tkl->set_by."</td>";
+ $set_by = ($tkl->set_by == "-config-") ? "<span class=\"badge-pill badge-secondary\">Config</span>" : $tkl->set_by;
+ echo "<td>".$set_by."</td>";
echo "<td>".$tkl->set_at_string."</td>";
echo "<td>".$tkl->expire_at_string."</td>";
echo "<td>".$tkl->duration_string."</td>";
echo "<td>".$tkl->reason."</td>";
}
- ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
+ ?></table><p><button type="button" class="btn btn-danger" data-toggle="modal" data-target="#myModal2">
+ Delete selected
+ </button></p>
+ <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
+ <div class="modal-dialog modal-dialog-centered" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="myModalLabel">Confirm deletion</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ Are you sure you want to do this?<br>
+ This cannot be undone.
+ </div>
+ <div class="modal-footer">
+ <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
+ <button type="submit" action="post" class="btn btn-danger">Delete</button>
+
+ </div>
+ </div>
+ </div>
+ </div></form></div></div>
<?php require_once 'footer.php'; ?>