2 require_once "../common.php";
4 require_once "../header.php";
11 if (isset($_POST['tklch']) && !empty($_POST['tklch'])) // User has asked to delete these tkls
13 foreach ($_POST['tklch'] as $key => $value)
15 $tok = base64_decode($value);
17 $success = $rpc->nameban()->delete($tok);
21 Message
::Success("Name Ban has been removed for $tok");
23 Message::Fail("Unable to remove Name Ban on
$tok: $rpc->error
");
26 elseif (isset($_POST['tkl_add']) && !empty($_POST['tkl_add']))
28 if (!($iphost = $_POST['tkl_add']))
29 Message::Fail("No mask was specified
");
31 /* duplicate code for now [= */
32 $banlen_w = (isset($_POST['banlen_w'])) ? $_POST['banlen_w'] : NULL;
33 $banlen_d = (isset($_POST['banlen_d'])) ? $_POST['banlen_d'] : NULL;
34 $banlen_h = (isset($_POST['banlen_h'])) ? $_POST['banlen_h'] : NULL;
36 if (!$banlen_d && !$banlen_h && !$banlen_w)
40 $duration .= $banlen_w;
42 $duration .= $banlen_d;
44 $duration .= $banlen_h;
46 $msg_msg = ($duration == "0" || $duration == "0w0d0h
") ? "permanently
" : "for " . rpc_convert_duration_string($duration);
47 $reason = (isset($_POST['ban_reason'])) ? $_POST['ban_reason'] : "No reason
";
49 if ($rpc->nameban()->add($iphost, $reason, $duration))
50 Message::Success("Name Ban set against \"
$iphost\": $reason");
52 Message
::Fail("Name Ban could not be set against \"$iphost\": $rpc->error");
55 elseif (isset($_POST['search_types']) && !empty($_POST['search_types']))
62 $name_bans = $rpc->nameban()->getAll();
65 <h4
>Name Bans Overview
</h4
>
66 Here you can essentially forbid the
use of a nick
or channel name
. This is useful to reserve services nicks so they cannot be used by normal users
.<br
>
67 You can also forbid the
use of channel names
. This is useful in such cases where an admin might need to close a channel
for reasons relating to their own policy
.<br
>
69 <p
><button type
="button" class="btn btn-primary" data
-toggle
="modal" data
-target
="#myModal">
72 <div
class="modal fade" id
="myModal" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
73 <div
class="modal-dialog modal-dialog-centered" role
="document">
74 <div
class="modal-content">
75 <div
class="modal-header">
76 <h5
class="modal-title" id
="myModalLabel">Add
new Name Ban
</h5
>
77 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
78 <span aria
-hidden
="true">×
;</span
>
81 <div
class="modal-body">
84 <div
class="align_label">Nick
/ Channel
</div
> <input
class="curvy" type
="text" id
="tkl_add" name
="tkl_add"><br
>
86 <div
class="align_label"><label
for="banlen_w">Duration
: </label
></div
>
87 <select
class="curvy" name
="banlen_w" id
="banlen_w">
89 for ($i = 0; $i <= 56; $i++
)
92 echo "<option value=\"0w\"></option>";
95 $w = ($i == 1) ? "week" : "weeks";
96 echo "<option value=\"$i" . "w\"
>$i $w" . "</option>";
101 <select
class="curvy" name
="banlen_d" id
="banlen_d">
103 for ($i = 0; $i <= 31; $i++
)
106 echo "<option value=\"0d\"></option>";
109 $d = ($i == 1) ? "day" : "days";
110 echo "<option value=\"$i" . "d\"
>$i $d" . "</option>";
115 <select
class="curvy" name
="banlen_h" id
="banlen_h">
117 for ($i = 0; $i <= 24; $i++
)
120 echo "<option value=\"0d\"></option>";
123 $h = ($i == 1) ? "hour" : "hours";
124 echo "<option value=\"$i" . "h\"
>$i $h" . "</option>";
129 <br
><div
class="align_label"><label
for="ban_reason">Reason
: </label
></div
>
130 <input
class="curvy input_text" type
="text" id
="ban_reason" name
="ban_reason"><br
>
134 <div
class="modal-footer">
135 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
136 <button type
="submit" action
="post" class="btn btn-danger">Add Ban
</button
>
143 <table
class="container-xxl table table-sm table-responsive caption-top table-striped">
144 <thead
class="table-primary">
145 <form method
="post" action
="name-bans.php">
146 <th scope
="col"><input type
="checkbox" label
='selectall' onClick
="toggle_tkl(this)" /></th
>
147 <th scope
="col">Mask
</th
>
148 <th scope
="col">Duration
</th
>
149 <th scope
="col">Reason
</th
>
150 <th scope
="col">Set By
</th
>
151 <th scope
="col">Set On
</th
>
152 <th scope
="col">Expires
</th
>
156 foreach($name_bans as $name_bans)
158 $set_in_config = ((isset($name_bans->set_in_config
) && $name_bans->set_in_config
) || ($name_bans->set_by
== "-config-")) ? true : false;
159 echo "<tr scope='col'>";
161 echo "<td scope=\"col\"></td>";
163 echo "<td scope=\"col\"><input type=\"checkbox\" value='" . base64_encode($name_bans->name
)."' name=\"tklch[]\"></td>";
164 echo "<td scope=\"col\">".$name_bans->name
."</td>";
165 echo "<td scope=\"col\">".$name_bans->duration_string
."</td>";
166 echo "<td scope=\"col\">".$name_bans->reason
."</td>";
167 $set_by = $set_in_config ? "<span class=\"badge rounded-pill badge-secondary\">Config</span>" : show_nick_only($name_bans->set_by
);
168 echo "<td scope=\"col\">".$set_by."</td>";
169 echo "<td scope=\"col\">".$name_bans->set_at_string
."</td>";
170 echo "<td scope=\"col\">".$name_bans->expire_at_string
."</td>";
173 ?></tbody
></table
><p
><button type
="button" class="btn btn-danger" data
-toggle
="modal" data
-target
="#myModal2">
176 <div
class="modal fade" id
="myModal2" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
177 <div
class="modal-dialog modal-dialog-centered" role
="document">
178 <div
class="modal-content">
179 <div
class="modal-header">
180 <h5
class="modal-title" id
="myModalLabel">Confirm deletion
</h5
>
181 <button type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
182 <span aria
-hidden
="true">×
;</span
>
185 <div
class="modal-body">
186 Are you sure you want to
do this
?<br
>
187 This cannot be undone
.
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">Delete
</button
>
196 </div
></form
></div
></div
>
198 <?php
require_once '../footer.php'; ?>