2 require_once "../inc/common.php";
3 require_once "../inc/header.php";
4 require_once "../inc/connection.php";
5 require_once "../misc/ban-exceptions-misc.php";
11 if (isset($_POST['tklch']) && !empty($_POST['tklch'])) // User has asked to delete these tkls
13 if (!current_user_can(PERMISSION_BAN_EXCEPTION_DEL
))
14 Message
::Fail("Could not delete ban exception(s): Permission denied");
16 foreach ($_POST['tklch'] as $key => $value)
18 $tok = split($value, ",");
19 $iphost = base64_decode($tok[0]);
21 $success = $rpc->serverbanexception()->delete($iphost);
25 Message
::Success("Ban Exception has been removed for $iphost");
27 Message::Fail("Unable to remove Ban Exception on
$iphost: $rpc->error
");
30 elseif (isset($_POST['tkl_add']) && !empty($_POST['tkl_add']))
32 if (!current_user_can(PERMISSION_BAN_EXCEPTION_ADD))
33 Message::Fail("Could not add ban
exception(s
): Permission denied
");
36 if (!($iphost = $_POST['tkl_add']))
37 Message::Fail("No mask was specified
");
39 $bantypes = isset($_POST['bantype']) ? $_POST['bantype'] : "";
41 if (!empty($bantypes))
42 foreach ($bantypes as $bt)
44 $bantypes = $bantypes_dup;
45 /* duplicate code for now [= */
46 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
47 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
48 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
50 if (!$banlen_d && !$banlen_h && !$banlen_w)
54 $duration .= $banlen_w;
56 $duration .= $banlen_d;
58 $duration .= $banlen_h;
60 $msg_msg = ($duration == "0" || $duration == "0w0d0h
") ? "permanently
" : "for " . rpc_convert_duration_string($duration);
61 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason
";
63 if (isset($_POST['soft']))
65 if ($rpc->serverbanexception()->add($iphost, $bantypes, $reason, (($user = unreal_get_current_user())) ? $user->username
: NULL, $duration))
66 Message
::Success("Ban Exception set against \"$iphost\": $reason");
68 Message::Fail("Ban Exception could not be set against \"
$iphost\": $rpc->error
");
72 elseif (isset($_POST['search_types']) && !empty($_POST['search_types']))
78 $ban_exceptions = $rpc->serverbanexception()->getAll();
81 <h4>Ban Exceptions Overview</h4>
82 Here is where you can make an exception to bans, that is, to make it so that the target mask is exempt from the ban types you specify.<br>
84 <p><button type="button
" class="btn btn
-primary
" data-toggle="modal
" data-target="#myModal" <?php echo (current_user_can(PERMISSION_BAN_EXCEPTION_ADD)) ? "" : "disabled"; ?>>
87 <div
class="modal fade" id
="myModal" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
88 <div
class="modal-dialog modal-dialog-centered" role
="document">
89 <div
class="modal-content">
90 <div
class="modal-header">
91 <h5
class="modal-title" id
="myModalLabel">Add
new Ban Exception
</h5
>
92 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
93 <span aria
-hidden
="true">×
;</span
>
96 <div
class="modal-body">
99 <div
class="align_label">IP
/ Mask
</div
> <input
class="curvy" type
="text" id
="tkl_add" name
="tkl_add"><br
>
100 <div
class="align_label">Exception Type
: </div
> <select multiple name
="bantype[]" id
="bantype" data
-live
-search
="true">
101 <option value
=""></option
>
103 <option value
="k">Kill
Line (KLine
)</option
>
104 <option value
="G">Global Kill
Line (GLine
)</option
>
105 <option value
="z">Zap
Line (ZLine
)</option
>
106 <option value
="Z">Global Zap
Line (GZLine
)</option
>
107 <option value
="Q">Reserve Nick
Globally (QLine
)</option
>
108 <option value
="s">Shun
</option
>
109 <option value
="F">Spamfilter
</option
>
110 <option value
="b">Blacklist
</option
>
111 <option value
="c">Connect Flood
</option
>
112 <option value
="d">Handshake Flood
</option
>
113 <option value
="m">Max Per IP
</option
>
114 <option value
="r">Anti
-Random
</option
>
115 <option value
="8">Anti
-Mixed-UTF8
</option
>
116 <option value
="v">Versions
</option
>
118 <div
class="align_label"><label
for="banlen_w">Duration
: </label
></div
>
119 <select
class="curvy" name
="banlen_w" id
="banlen_w">
121 for ($i = 0; $i <= 56; $i++
)
124 echo "<option value=\"0w\"></option>";
127 $w = ($i == 1) ? "week" : "weeks";
128 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
133 <select
class="curvy" name
="banlen_d" id
="banlen_d">
135 for ($i = 0; $i <= 31; $i++
)
138 echo "<option value=\"0d\"></option>";
141 $d = ($i == 1) ? "day" : "days";
142 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
147 <select
class="curvy" name
="banlen_h" id
="banlen_h">
149 for ($i = 0; $i <= 24; $i++
)
152 echo "<option value=\"0d\"></option>";
155 $h = ($i == 1) ? "hour" : "hours";
156 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
161 <br
><div
class="align_label"><label
for="ban_reason">Reason
: </label
></div
>
162 <input
class="curvy input_text" type
="text" id
="ban_reason" name
="ban_reason">
166 <div
class="modal-footer">
167 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
168 <button type
="submit" action
="post" class="btn btn-danger">Add Ban Exception
</button
>
175 <table
class="container-xxl table table-sm table-responsive caption-top table-striped">
176 <thead
class="table-primary">
178 <th scope
="col"><input type
="checkbox" label
='selectall' onClick
="toggle_tkl(this)" /></th
>
179 <th scope
="col">Mask
</th
>
180 <th scope
="col">Duration
</th
>
181 <th scope
="col">Type
</th
>
182 <th scope
="col">Exception Types
</th
>
183 <th scope
="col">Reason
</th
>
184 <th scope
="col">Set By
</th
>
185 <th scope
="col">Set On
</th
>
186 <th scope
="col">Expires
</th
>
190 foreach($ban_exceptions as $ban_exceptions)
192 $set_in_config = ((isset($ban_exceptions->set_in_config
) && $ban_exceptions->set_in_config
) || ($ban_exceptions->set_by
== "-config-")) ? true : false;
193 echo "<tr scope='col'>";
195 echo "<td scope=\"col\"></td>";
197 echo "<td scope=\"col\"><input type=\"checkbox\" value='" . base64_encode($ban_exceptions->name
).",".base64_encode($ban_exceptions->type
) . "' name=\"tklch[]\"></td>";
198 echo "<td scope=\"col\">".$ban_exceptions->name
."</td>";
199 echo "<td scope=\"col\">".$ban_exceptions->duration_string
."</td>";
200 echo "<td scope=\"col\"><span class=\"badge badge-pill badge-primary\">".$ban_exceptions->type
."</span></td>";
201 echo "<td scope=\"col\">".convert_exceptiontypes_to_badges($ban_exceptions->exception_types
)."</td>";
202 echo "<td scope=\"col\">".$ban_exceptions->reason
."</td>";
203 $set_by = $set_in_config ? "<span class=\"badge rounded-pill badge-secondary\">Config</span>" : show_nick_only($ban_exceptions->set_by
);
204 echo "<td scope=\"col\">".$set_by."</td>";
205 echo "<td scope=\"col\">".$ban_exceptions->set_at_string
."</td>";
206 echo "<td scope=\"col\">".$ban_exceptions->expire_at_string
."</td>";
209 ?></tbody
></table
><p
><button type
="button" class="btn btn-danger" data
-toggle
="modal" data
-target
="#myModal2" <?php
echo (current_user_can(PERMISSION_BAN_EXCEPTION_DEL
)) ? "" : "disabled"; ?>>
212 <div
class="modal fade" id
="myModal2" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
213 <div
class="modal-dialog modal-dialog-centered" role
="document">
214 <div
class="modal-content">
215 <div
class="modal-header">
216 <h5
class="modal-title" id
="myModalLabel">Confirm deletion
</h5
>
217 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
218 <span aria
-hidden
="true">×
;</span
>
221 <div
class="modal-body">
222 Are you sure you want to
do this
?<br
>
223 This cannot be undone
.
225 <div
class="modal-footer">
226 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
227 <button type
="submit" action
="post" class="btn btn-danger">Delete
</button
>
232 </div
></form
></div
></div
>
234 <?php
require_once '../inc/footer.php'; ?>