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]);
18 if ($rpc->serverban()->delete($ban, $type))
19 Message
::Success("$type has been removed for $ban");
21 Message::Fail("Unable to remove
$type on
$ban: $rpc->error
");
25 else if (!($iphost = $_POST['tkl_add']))
26 Message::Fail("No user was specified
");
27 else if (!($bantype = (isset($_POST['bantype'])) ? $_POST['bantype'] : false))
29 Message::Fail("Unable to add Server Ban
: No ban type selected
");
35 $bantype == "gline
" ||
36 $bantype == "gzline
" ||
39 ) && strpos($iphost, "@") == false) // doesn't have full mask
40 $iphost = "*@" . $iphost;
42 $soft = ($_POST['soft']) ? true : false;
45 $iphost = "%
" . $iphost;
46 /* duplicate code for now [= */
47 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
48 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
49 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
51 if (!$banlen_d && !$banlen_h && !$banlen_w)
57 $duration .= $banlen_w;
59 $duration .= $banlen_d;
61 $duration .= $banlen_h;
63 $msg_msg = ($duration == "0" || $duration == "0w0d0h
") ? "permanently
" : "for ".rpc_convert_duration_string($duration);
64 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason
";
65 if ($bantype == "qline
")
67 if ($rpc->nameban()->add($iphost, $reason, $duration))
68 Message::Success("Name Ban set against \"
$iphost\": $reason");
70 Message
::Fail("Name Ban could not be set against \"$iphost\": $rpc->error");
72 elseif ($bantype == "except")
74 if ($rpc->exception()->add($iphost, "", $duration, $reason))
75 Message
::Success("Exception set for \"$iphost\": $reason");
77 Message::Fail("Exception could not be set \"
$iphost\": $rpc->error
");
79 else if ($rpc->serverban()->add($iphost, $bantype, $duration, $reason))
81 Message::Success("Host
/ IP
: $iphost has been
$bantype" . "d $msg_msg: $reason");
84 Message::Fail("The
$bantype against \"
$iphost\" could not be added
: $rpc->error
");
88 $tkl = $rpc->serverban()->getAll();
89 foreach ($rpc->nameban()->getAll() as $v)
92 <h4>Server Bans Overview</h4><br>
93 <p><button type="button
" class="btn btn
-primary
" data-toggle="modal
" data-target="#myModal">
96 <div
class="modal fade" id
="myModal" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
97 <div
class="modal-dialog modal-dialog-centered" role
="document">
98 <div
class="modal-content">
99 <div
class="modal-header">
100 <h5
class="modal-title" id
="myModalLabel">Add
new Server Ban
</h5
>
101 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
102 <span aria
-hidden
="true">×
;</span
>
105 <div
class="modal-body">
108 <div
class="align_label">IP
/ Host
: </div
> <input
class="curvy" type
="text" id
="tkl_add" name
="tkl_add"><br
>
109 <div
class="align_label">Ban Type
: </div
> <select
class="curvy" name
="bantype" id
="bantype">
110 <option value
=""></option
>
111 <optgroup label
="Bans">
112 <option value
="kline">Kill
Line (KLine
)</option
>
113 <option value
="gline">Global Kill
Line (GLine
)</option
>
114 <option value
="zline">Zap
Line (ZLine
)</option
>
115 <option value
="gzline">Global Zap
Line (GZLine
)</option
>
118 <optgroup label
="Restrictions">
119 <option value
="local-qline">Reserve Nick
Locally(QLine
)</option
>
120 <option value
="qline">Reserve Nick
Globally (QLine
)</option
>
121 <option value
="shun">Shun
</option
>
124 <optgroup label
="Settings">
125 <option value
="except">Global Exception (ELine
)</option
>
126 <option value
="local-exception">Local
Exception (ELine
)</option
>
129 <div
class="align_label"><label
for="banlen_w">Duration
: </label
></div
>
130 <select
class="curvy" name
="banlen_w" id
="banlen_w">
132 for ($i = 0; $i <= 56; $i++
)
135 echo "<option value=\"0w\"></option>";
138 $w = ($i == 1) ? "week" : "weeks";
139 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
144 <select
class="curvy" name
="banlen_d" id
="banlen_d">
146 for ($i = 0; $i <= 31; $i++
)
149 echo "<option value=\"0d\"></option>";
152 $d = ($i == 1) ? "day" : "days";
153 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
158 <select
class="curvy" name
="banlen_h" id
="banlen_h">
160 for ($i = 0; $i <= 24; $i++
)
163 echo "<option value=\"0d\"></option>";
166 $h = ($i == 1) ? "hour" : "hours";
167 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
172 <br
><div
class="align_label"><label
for="ban_reason">Reason
: </label
></div
>
173 <input
class="curvy input_text" type
="text" id
="ban_reason" name
="ban_reason"><br
>
174 <input
class="curvy input_text" type
="checkbox" id
="soft" name
="soft">Don
't affect logged-in users (soft)
178 <div class="modal-footer">
179 <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
180 <button type="submit" action="post" class="btn btn-danger">Add Ban</button>
187 <table class="table table-responsive caption-top table-striped">
188 <thead class="table-primary">
190 <th><input type="checkbox" label='selectall
' onClick="toggle_tkl(this)" /></th>
201 foreach($tkl as $tkl)
204 echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl->name).",".base64_encode($tkl->type) . "' name=\"tklch[]\"></td>";
205 echo "<td>".$tkl->name."</td>";
206 echo "<td>".$tkl->type_string."</td>";
207 echo "<td>".$tkl->duration_string."</td>";
208 echo "<td>".$tkl->reason."</td>";
209 $set_by = ($tkl->set_by == "-config-") ? "<span class=\"badge-pill badge-secondary\">Config</span>" : show_nick_only($tkl->set_by);
210 echo "<td>".$set_by."</td>";
211 echo "<td>".$tkl->set_at_string."</td>";
212 echo "<td>".$tkl->expire_at_string."</td>";
214 ?></table><p><button type="button" class="btn btn-danger" data-toggle="modal" data-target="#myModal2">
217 <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="confirmModalCenterTitle" aria-hidden="true">
218 <div class="modal-dialog modal-dialog-centered" role="document">
219 <div class="modal-content">
220 <div class="modal-header">
221 <h5 class="modal-title" id="myModalLabel">Confirm deletion</h5>
222 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
223 <span aria-hidden="true">×</span>
226 <div class="modal-body">
227 Are you sure you want to do this?<br>
228 This cannot be undone.
230 <div class="modal-footer">
231 <button id="CloseButton" type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
232 <button type="submit" action="post" class="btn btn-danger">Delete</button>
237 </div></form></div></div>
239 <?php require_once 'footer
.php
'; ?>