2 require_once "../common.php";
3 require_once "../header.php";
4 require_once "../misc/channel-lookup-misc.php";
6 $title = "Channel Lookup";
13 if (isset($_GET['chan']))
15 $channel = $_GET['chan'];
16 $channelObj = $rpc->channel()->get($channel, 4);
17 if (!$channelObj && strlen($channel))
19 Message
::Fail("Could not find channel: \"$channel\"");
20 } elseif (strlen($channel)) {
22 $channame = $channelObj->name
;
23 $title .= " for \"" . $channame . "\"";
36 if (isset($_POST['update_topic']) && isset($_POST['set_topic']))
38 if (isset($channelObj))
40 if (!isset($channelObj->topic
) || strcmp($channelObj->topic
,$_POST['set_topic'])) // if the set topic is different
42 $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username
: NULL;
43 $topicset = $rpc->channel()->set_topic($channelObj->name
, $_POST['set_topic'], $user);
44 $channelObj->topic
= $_POST['set_topic'];
48 $checkboxes = (isset($_POST['ban_checkboxes'])) ? $_POST['ban_checkboxes'] : [];
49 if (isset($_POST['delete_sel_ex']))
51 foreach($_POST['ce_checkboxes'] as $c)
53 do_delete_chanex($channelObj, $checkboxes);
55 if (isset($_POST['delete_sel_inv']))
57 foreach($_POST['ci_checkboxes'] as $c)
59 do_delete_invite($channelObj, $checkboxes);
61 else if (isset($_POST['delete_sel_ban']))
63 foreach($_POST['cb_checkboxes'] as $c)
65 do_delete_chanban($channelObj, $checkboxes);
67 if (isset($_POST['add_chban']) || isset($_POST['add_chinv']) || isset($_POST['add_chex']))
70 if (isset($_POST['add_chban']))
71 $mode = $_POST['add_chban'];
73 $mode = (isset($_POST['add_chinv'])) ? $_POST['add_chinv'] : $_POST['add_chex'];
75 $nick = (strlen($_POST['ban_nick'])) ? $_POST['ban_nick'] : false;
76 $action_string = (isset($_POST['bantype_sel_action']) && strlen($_POST['bantype_sel_action'])) ? $_POST['bantype_sel_action'] : false;
78 $type_string = (strlen($_POST['bantype_sel_type'])) ? $_POST['bantype_sel_type'] : false;
80 $expiry = (strlen($_POST['bantype_sel_ex'])) ? $_POST['bantype_sel_ex'] : false;
84 $chanban_errors[] = "You did not specify a nick/mask";
88 if (strstr($action_string,"Quiet"))
90 elseif (strstr($action_string,"Nick-change"))
91 $action = "~nickchange:";
92 elseif (strstr($action_string,"Join"))
97 if (strstr($type_string,"Account"))
99 elseif (strstr($type_string,"Channel"))
101 elseif (strstr($type_string,"Country"))
103 elseif (strstr($type_string,"OperClass"))
104 $type = "~operclass:";
105 elseif (strstr($type_string,"GECOS"))
106 $type = "~realname:";
107 elseif (strstr($type_string,"Security"))
108 $type = "~security-group:";
109 elseif (strstr($type_string,"Certificate"))
114 $future = strtotime($expiry);
115 $now = strtotime(date("Y-m-d h:i:s"));
116 $ts = ($future - $now) / 60;
118 $time = "~time:$ts:";
119 if ($ts > 9999 || $ts < 1)
120 $chanban_errors[] = "Cannot set expiry more than ".(9999 / 60)." hours (".(9999 / 1440)." days) in the future, or in the past";
122 if (empty($chanban_errors))
123 if ($rpc->channel()->set_mode($channel, "$mode", "$time$action$type$nick"))
124 Message
::Success("The mode was set successfully: $mode $time$action$type$nick");
127 foreach($chanban_errors as $err)
130 if ((isset($_POST['kickban']) || isset($_POST['muteban'])) && current_user_can(PERMISSION_EDIT_CHANNEL_USER))
132 $mute = (isset($_POST['muteban'])) ? true : false;
133 $mutestr = ($mute) ? "~quiet
:" : "";
134 $user = (!$mute) ? $_POST['kickban'] : $_POST['muteban'];
136 $kbuser = $rpc->user()->get($user);
139 Message::Fail("Could not kickban user
: User does not exist
");
142 $rpc->channel()->set_mode($channelObj->name, "+b
", "~time
:".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME.":".$mutestr."*!*@".$kbuser->user->cloakedhost);
144 $rpc->channel()->kick($channelObj->name, $kbuser->name, DEFAULT_CHAN_DETAIL_QUICK_BAN_REASON);
146 $msgbox_str = ($mute)
148 "User \"
$kbuser->name\" has been muted
for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes
."
150 "User \"
$kbuser->name\" has been banned
for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes
."
152 Message::Success($msgbox_str);
155 /* Re-grab the channel because of updates */
156 $channelObj = $rpc->channel()->get($channel, 4);
160 <title><?php echo $title; ?></title>
161 <h6><?php echo $title; ?></h6>
165 <div class="container
-xl
">
166 <form method="get
" action="details
.php
">
167 <div class="text
-left input
-group
">
168 <input class="form
-control
" id="chan
" name="chan
" type="text
" value="<?php
echo $channame; ?>">
169 <div class="input
-group
-append
">
170 <button type="submit
" class="btn btn
-primary
">Go</button>
175 <?php if (!$channelObj)
178 <!-- Modal for Add Ban -->
179 <div class="modal fade
" id="ban
" tabindex="-1" role="dialog
" aria-labelledby="confirmModalCenterTitle
" aria-hidden="true">
180 <div class="modal
-dialog modal
-lg modal
-dialog
-centered
" role="document
">
181 <div class="modal
-content
">
182 <div class="modal
-header
">
183 <h5 class="modal
-title
" id="myModalLabel
">Add New Channel Ban</h5>
184 <div type="button
" class="close
" data-dismiss="modal
" aria-label="Close
">
185 <span aria-hidden="true">×</span>
188 <div class="modal
-body
">
190 <div class="input
-group mb
-3">
191 <label for="ban_nick
">Mask
192 <a href="https
://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true"
193 title
="The mask or other value. For example if you are matching a country in 'Ban Type' then you would put the country code as this value. Click to view more information on Extended Bans"
195 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
196 placeholder
="nick!user@host or something else"
200 <div
class="input-group mb-3">
201 <label
for="bantype_action">Ban Action
202 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
204 <option
>Quiet (Mute
)</option
>
205 <option
>Nick
-change
</option
>
206 <option
>Join
</option
>
210 <div
class="input-group mb-3">
211 <label
for="bantype_sel_type">Ban Type
212 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
214 <option
>Match Account
</option
>
215 <option
>Match Channel
</option
>
216 <option
>Match Country
</option
>
217 <option
>Match OperClass
</option
>
218 <option
>Match RealName
/ GECOS
</option
>
219 <option
>Match Security Group
</option
>
220 <option
>Match Certificate Fingerprint
</option
>
224 <div
class="input-group mb-3">
225 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
226 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
230 <div
class="modal-footer">
231 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
232 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
233 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
241 <!-- Modal
for Add Invite
-->
242 <div
class="modal fade" id
="invite" tabindex
="-1" role
="dialog" aria
-labelledby
="add_invite_modal" aria
-hidden
="true">
243 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
244 <div
class="modal-content">
245 <div
class="modal-header">
246 <h5
class="modal-title" id
="add_invite_modal">Add
New Channel Invite
</h5
>
247 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
248 <span aria
-hidden
="true">×
;</span
>
251 <div
class="modal-body">
253 <div
class="input-group mb-3">
254 <label
for="ban_nick">Mask
255 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
256 title
="The mask or other value. For example if you are matching a country in 'Invite Type' then you would put the country code as this value. Click to view more information on Extended Bans"
258 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
259 placeholder
="nick!user@host or something else"
263 <div
class="input-group mb-3">
264 <label
for="bantype_sel_type">Invite Type
265 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
267 <option
>Match Account
</option
>
268 <option
>Match Channel
</option
>
269 <option
>Match Country
</option
>
270 <option
>Match OperClass
</option
>
271 <option
>Match RealName
/ GECOS
</option
>
272 <option
>Match Security Group
</option
>
273 <option
>Match Certificate Fingerprint
</option
>
277 <div
class="input-group mb-3">
278 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
279 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
283 <div
class="modal-footer">
284 <input type
="hidden" name
="add_chinv" value
="I"></input
>
285 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
286 <button type
="submit" action
="post" class="btn btn-danger">Add Invite
</button
>
293 <!-- Modal
for Add Ban Exceptions
-->
294 <div
class="modal fade" id
="except" tabindex
="-1" role
="dialog" aria
-labelledby
="add_except_modal" aria
-hidden
="true">
295 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
296 <div
class="modal-content">
297 <div
class="modal-header">
298 <h5
class="modal-title" id
="add_except_modal">Add
New Channel Ban Exception
</h5
>
299 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
300 <span aria
-hidden
="true">×
;</span
>
303 <div
class="modal-body">
305 <div
class="input-group mb-3">
306 <label
for="ban_nick">Mask
307 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
308 title
="The mask or other value. For example if you are matching a country in 'Ban Type' then you would put the country code as this value. Click to view more information on Extended Bans"
310 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
311 placeholder
="nick!user@host or something else"
315 <div
class="input-group mb-3">
316 <label
for="bantype_sel_type">Ban Type
317 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
319 <option
>Match Account
</option
>
320 <option
>Match Channel
</option
>
321 <option
>Match Country
</option
>
322 <option
>Match OperClass
</option
>
323 <option
>Match RealName
/ GECOS
</option
>
324 <option
>Match Security Group
</option
>
325 <option
>Match Certificate Fingerprint
</option
>
329 <div
class="input-group mb-3">
330 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
331 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
335 <div
class="modal-footer">
336 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
337 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
338 <button type
="submit" action
="post" class="btn btn-danger">Add Exception
</button
>
348 <form method
="post" action
="details.php?chan=<?php echo urlencode($channelObj->name); ?>">
349 <div
class="input-group">
350 <input maxlength
="360" type
="text" class="input-group form-control" name
="set_topic" value
="<?php echo (isset($channelObj->topic)) ? htmlspecialchars($channelObj->topic) : ""; ?>">
351 <div
class="input-group-append"><button type
="submit" name
="update_topic" value
="true" class="btn btn-info">Update Topic
</button
></div
></div
>
355 Message
::Success("The topic for $channelObj->name has been updated to be: \"".htmlspecialchars($channelObj->topic
)."\"");
359 <!-- Modal
for User Action
-->
360 <div
class="modal fade" id
="useraction" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
361 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
362 <div
class="modal-content">
363 <div
class="modal-header">
364 <h5
class="modal-title" id
="myModalLabel">Add
New Channel Ban
</h5
>
365 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
366 <span aria
-hidden
="true">×
;</span
>
369 <div
class="modal-body">
371 <div
class="input-group mb-3">
372 <label
for="ban_nick">Mask
373 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
374 title
="The mask or other value. For example if you are matching a country in 'Ban Type' then you would put the country code as this value. Click to view more information on Extended Bans"
376 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
377 placeholder
="nick!user@host or something else"
381 <div
class="input-group mb-3">
382 <label
for="bantype_action">Ban Action
383 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
385 <option
>Quiet (Mute
)</option
>
386 <option
>Nick
-change
</option
>
387 <option
>Join
</option
>
391 <div
class="input-group mb-3">
392 <label
for="bantype_sel_type">Ban Type
393 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
395 <option
>Match Account
</option
>
396 <option
>Match Channel
</option
>
397 <option
>Match Country
</option
>
398 <option
>Match OperClass
</option
>
399 <option
>Match RealName
/ GECOS
</option
>
400 <option
>Match Security Group
</option
>
401 <option
>Match Certificate Fingerprint
</option
>
405 <div
class="input-group mb-3">
406 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
407 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
411 <div
class="modal-footer">
412 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
413 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
414 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
421 <div
class="container-xxl">
423 <div
class="col-sm-4">
425 <div
class="card-body">
426 <h6
class="card-title">User
List</h6
>
427 <p
class="card-text"><?php
generate_chan_occupants_table($channelObj); ?></p
>
431 <div
class="col-sm-8">
433 <div
class="card-body">
434 <h6
class="card-title">Channel Settings
</h6
>
435 <ul
class="nav nav-tabs" role
="tablist">
436 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanmodes" aria
-controls
="chanmodes" role
="tab" data
-toggle
="tab">Settings
/ Modes
</a
></li
>
437 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanbans" aria
-controls
="chanbans" role
="tab" data
-toggle
="tab">Bans
</a
></li
>
438 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chaninv" aria
-controls
="chaninv" role
="tab" data
-toggle
="tab">Invites
</a
></li
>
439 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanex" aria
-controls
="chanex" role
="tab" data
-toggle
="tab">Excepts
</a
></li
>
442 <div
class="tab-content">
444 <div role
="tabpanel" class="tab-pane fade in" id
="chanmodes">
445 <p
class="card-text"><?php
generate_html_chansettings($channelObj); ?></p
>
448 <div role
="tabpanel" class="tab-pane fade in" id
="chanbans">
449 <p
class="card-text"><?php
generate_chanbans_table($channelObj); ?></p
>
451 <div role
="tabpanel" class="tab-pane fade in" id
="chaninv">
452 <p
class="card-text"><?php
generate_chaninvites_table($channelObj); ?></p
>
454 <div role
="tabpanel" class="tab-pane fade in" id
="chanex">
455 <p
class="card-text"><?php
generate_chanexcepts_table($channelObj); ?></p
>
464 // show dat first tab
465 $
('.nav-tabs a[href="#chanmodes"]').tab('show')
468 require_once("../footer.php");