2 require_once "common.php";
4 require_once "header.php";
11 if (!empty($_POST['tklch'])) // User has asked to delete these tkls
13 foreach ($_POST as $key => $value) {
14 foreach ($value as $tok) {
15 $tok = explode(",", $tok);
16 $ban = base64_decode($tok[0]);
17 $type = base64_decode($tok[1]);
19 if ($type == "except")
20 $success = $rpc->serverbanexception()->delete($ban);
21 else if ($type == "qline" || $type == "local-qline")
22 $success = $rpc->nameban()->delete($ban);
24 $success = $rpc->serverban()->delete($ban, $type);
28 Message
::Success("$type has been removed for $ban");
30 Message::Fail("Unable to remove
$type on
$ban: $rpc->error
");
34 else if (!($iphost = $_POST['tkl_add']))
35 Message::Fail("No user was specified
");
36 else if (!($bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : false))
38 Message::Fail("Unable to add Server Ban
: No ban type selected
");
44 $bantype == "gline
" ||
45 $bantype == "gzline
" ||
48 ) && strpos($iphost, "@") == false) // doesn't have full mask
49 $iphost = "*@" . $iphost;
51 $soft = ($_POST['soft']) ? true : false;
54 $iphost = "%
" . $iphost;
55 /* duplicate code for now [= */
56 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
57 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
58 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
60 if (!$banlen_d && !$banlen_h && !$banlen_w)
66 $duration .= $banlen_w;
68 $duration .= $banlen_d;
70 $duration .= $banlen_h;
72 $msg_msg = ($duration == "0" || $duration == "0w0d0h
") ? "permanently
" : "for ".rpc_convert_duration_string($duration);
73 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason
";
74 if ($bantype == "qline
")
76 if ($rpc->nameban()->add($iphost, $reason, $duration))
77 Message::Success("Name Ban set against \"
$iphost\": $reason");
79 Message
::Fail("Name Ban could not be set against \"$iphost\": $rpc->error");
81 elseif ($bantype == "except")
83 if ($rpc->serverbanexception()->add($iphost, "", $duration, $reason))
84 Message
::Success("Exception set for \"$iphost\": $reason");
86 Message::Fail("Exception could not be set \"
$iphost\": $rpc->error
");
88 else if ($rpc->serverban()->add($iphost, $bantype, $duration, $reason))
90 Message::Success("Host
/ IP
: $iphost has been
$bantype" . "d $msg_msg: $reason");
93 Message::Fail("The
$bantype against \"
$iphost\" could not be added
: $rpc->error
");
97 $tkl = $rpc->serverban()->getAll();
98 foreach ($rpc->nameban()->getAll() as $v)
100 foreach ($rpc->serverbanexception()->getAll() as $v)
103 <h4>Server Bans Overview</h4><br>
104 <p><button type="button
" class="btn btn
-primary
" data-toggle="modal
" data-target="#myModal">
106 </button
></p
></table
>
107 <div
class="modal fade" id
="myModal" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
108 <div
class="modal-dialog modal-dialog-centered" role
="document">
109 <div
class="modal-content">
110 <div
class="modal-header">
111 <h5
class="modal-title" id
="myModalLabel">Add
new Server Ban
</h5
>
112 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
113 <span aria
-hidden
="true">×
;</span
>
116 <div
class="modal-body">
119 <div
class="align_label">IP
/ Host
: </div
> <input
class="curvy" type
="text" id
="tkl_add" name
="tkl_add"><br
>
120 <div
class="align_label">Ban Type
: </div
> <select
class="curvy" name
="bantype" id
="bantype">
121 <option value
=""></option
>
122 <optgroup label
="Bans">
123 <option value
="kline">Kill
Line (KLine
)</option
>
124 <option value
="gline">Global Kill
Line (GLine
)</option
>
125 <option value
="zline">Zap
Line (ZLine
)</option
>
126 <option value
="gzline">Global Zap
Line (GZLine
)</option
>
129 <optgroup label
="Restrictions">
130 <option value
="local-qline">Reserve Nick
Locally(QLine
)</option
>
131 <option value
="qline">Reserve Nick
Globally (QLine
)</option
>
132 <option value
="shun">Shun
</option
>
135 <optgroup label
="Settings">
136 <option value
="except">Global Exception (ELine
)</option
>
137 <option value
="local-exception">Local
Exception (ELine
)</option
>
140 <div
class="align_label"><label
for="banlen_w">Duration
: </label
></div
>
141 <select
class="curvy" name
="banlen_w" id
="banlen_w">
143 for ($i = 0; $i <= 56; $i++
)
146 echo "<option value=\"0w\"></option>";
149 $w = ($i == 1) ? "week" : "weeks";
150 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
155 <select
class="curvy" name
="banlen_d" id
="banlen_d">
157 for ($i = 0; $i <= 31; $i++
)
160 echo "<option value=\"0d\"></option>";
163 $d = ($i == 1) ? "day" : "days";
164 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
169 <select
class="curvy" name
="banlen_h" id
="banlen_h">
171 for ($i = 0; $i <= 24; $i++
)
174 echo "<option value=\"0d\"></option>";
177 $h = ($i == 1) ? "hour" : "hours";
178 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
183 <br
><div
class="align_label"><label
for="ban_reason">Reason
: </label
></div
>
184 <input
class="curvy input_text" type
="text" id
="ban_reason" name
="ban_reason"><br
>
185 <input
class="curvy input_text" type
="checkbox" id
="soft" name
="soft">Don
't affect logged-in users (soft)
189 <div class="modal-footer">
190 <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
191 <button type="submit" action="post" class="btn btn-danger">Add Ban</button>
198 <table class="table table-responsive caption-top table-striped">
199 <thead class="table-primary">
201 <th><input type="checkbox" label='selectall
' onClick="toggle_tkl(this)" /></th>
212 foreach($tkl as $tkl)
215 echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl->name).",".base64_encode($tkl->type) . "' name=\"tklch[]\"></td>";
216 echo "<td>".$tkl->name."</td>";
217 echo "<td>".$tkl->type_string."</td>";
218 echo "<td>".$tkl->duration_string."</td>";
219 echo "<td>".$tkl->reason."</td>";
220 $set_by = ($tkl->set_by == "-config-") ? "<span class=\"badge-pill badge-secondary\">Config</span>" : show_nick_only($tkl->set_by);
221 echo "<td>".$set_by."</td>";
222 echo "<td>".$tkl->set_at_string."</td>";
223 echo "<td>".$tkl->expire_at_string."</td>";
225 ?></table><p><button type="button" class="btn btn-danger" data-toggle="modal" data-target="#myModal2">
228 <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
229 <div class="modal-dialog modal-dialog-centered" role="document">
230 <div class="modal-content">
231 <div class="modal-header">
232 <h5 class="modal-title" id="myModalLabel">Confirm deletion</h5>
233 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
234 <span aria-hidden="true">×</span>
237 <div class="modal-body">
238 Are you sure you want to do this?<br>
239 This cannot be undone.
241 <div class="modal-footer">
242 <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
243 <button type="submit" action="post" class="btn btn-danger">Delete</button>
248 </div></form></div></div>
250 <?php require_once 'footer
.php
'; ?>