2 require_once "../inc/common.php";
3 require_once "../inc/connection.php";
4 require_once "../inc/header.php";
6 if ($uplink = $rpc->server()->get())
7 IRCList
::setmodes($uplink->server
->features
->chanmodes
);
8 $title = "Channel Lookup";
14 $can_edit = current_user_can(PERMISSION_EDIT_CHANNEL
);
17 if (isset($_GET['chan']))
19 $channel = $_GET['chan'];
20 $channelObj = $rpc->channel()->get($channel, 4);
21 if (!$channelObj && strlen($channel))
23 Message
::Fail("Could not find channel: \"$channel\"");
24 } elseif (strlen($channel)) {
26 $channame = $channelObj->name
;
27 $title .= " for \"" . $channame . "\"";
40 if (isset($_POST['update_topic']) && isset($_POST['set_topic']))
42 if (isset($channelObj))
44 if (!isset($channelObj->topic
) || strcmp($channelObj->topic
,$_POST['set_topic'])) // if the set topic is different
46 $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username
: NULL;
47 $topicset = $rpc->channel()->set_topic($channelObj->name
, $_POST['set_topic'], $user);
48 $channelObj->topic
= $_POST['set_topic'];
52 $checkboxes = (isset($_POST['ban_checkboxes'])) ? $_POST['ban_checkboxes'] : [];
53 if (isset($_POST['delete_sel_ex']))
55 foreach($_POST['ce_checkboxes'] as $c)
57 do_delete_chanex($channelObj, $checkboxes);
59 if (isset($_POST['delete_sel_inv']))
61 foreach($_POST['ci_checkboxes'] as $c)
63 do_delete_invite($channelObj, $checkboxes);
65 else if (isset($_POST['delete_sel_ban']))
67 foreach($_POST['cb_checkboxes'] as $c)
69 do_delete_chanban($channelObj, $checkboxes);
71 if (isset($_POST['add_chban']) || isset($_POST['add_chinv']) || isset($_POST['add_chex']))
74 if (isset($_POST['add_chban']))
75 $mode = $_POST['add_chban'];
77 $mode = (isset($_POST['add_chinv'])) ? $_POST['add_chinv'] : $_POST['add_chex'];
79 $nick = (strlen($_POST['ban_nick'])) ? $_POST['ban_nick'] : false;
80 $action_string = (isset($_POST['bantype_sel_action']) && strlen($_POST['bantype_sel_action'])) ? $_POST['bantype_sel_action'] : false;
82 $type_string = (strlen($_POST['bantype_sel_type'])) ? $_POST['bantype_sel_type'] : false;
84 $expiry = (strlen($_POST['bantype_sel_ex'])) ? $_POST['bantype_sel_ex'] : false;
88 $chanban_errors[] = "You did not specify a nick/mask";
92 if (strstr($action_string,"Quiet"))
94 elseif (strstr($action_string,"Nick-change"))
95 $action = "~nickchange:";
96 elseif (strstr($action_string,"Join"))
101 if (strstr($type_string,"Account"))
103 elseif (strstr($type_string,"Channel"))
105 elseif (strstr($type_string,"Country"))
107 elseif (strstr($type_string,"OperClass"))
108 $type = "~operclass:";
109 elseif (strstr($type_string,"GECOS"))
110 $type = "~realname:";
111 elseif (strstr($type_string,"Security"))
112 $type = "~security-group:";
113 elseif (strstr($type_string,"Certificate"))
118 $future = strtotime($expiry);
119 $now = strtotime(date("Y-m-d h:i:s"));
120 $ts = ($future - $now) / 60;
122 $time = "~time:$ts:";
123 if ($ts > 9999 || $ts < 1)
124 $chanban_errors[] = "Cannot set expiry more than ".(9999 / 60)." hours (".(9999 / 1440)." days) in the future, or in the past";
126 if (empty($chanban_errors))
127 if ($rpc->channel()->set_mode($channel, "$mode", "$time$action$type$nick"))
128 Message
::Success("The mode was set successfully: $mode $time$action$type$nick");
131 foreach($chanban_errors as $err)
134 if ((isset($_POST['kickban']) || isset($_POST['muteban'])) && current_user_can(PERMISSION_EDIT_CHANNEL_USER))
136 $mute = (isset($_POST['muteban'])) ? true : false;
137 $mutestr = ($mute) ? "~quiet
:" : "";
138 $user = (!$mute) ? $_POST['kickban'] : $_POST['muteban'];
140 $kbuser = $rpc->user()->get($user);
143 Message::Fail("Could not kickban user
: User does not exist
");
146 $rpc->channel()->set_mode($channelObj->name, "+b
", "~time
:".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME.":".$mutestr."*!*@".$kbuser->user->cloakedhost);
148 $rpc->channel()->kick($channelObj->name, $kbuser->name, DEFAULT_CHAN_DETAIL_QUICK_BAN_REASON);
150 $msgbox_str = ($mute)
152 "User \"
$kbuser->name\" has been muted
for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes
."
154 "User \"
$kbuser->name\" has been banned
for ".DEFAULT_CHAN_DETAIL_QUICK_ACTION_TIME." minutes
."
156 Message::Success($msgbox_str);
160 if (isset($_POST['newmodes']) && isset($_POST['paramed_modes']) && $can_edit)
162 $m = $_POST['newmodes'];
163 $p = $_POST['paramed_modes'];
166 $addmodestring = "+
";
167 $addparamstring = "";
168 $delmodestring = "-";
169 $delparamstring = "";
170 foreach ($m as $mode)
172 strcat($addmodestring, $mode);
173 if (isset($p[$mode]) && strlen($p[$mode]))
174 strcat($addparamstring, $p[$mode]." ");
177 $fmodes = $channelObj->modes;
178 $tok = split($fmodes);
180 $params = rparv($fmodes);
181 $paramed_modes = sort_paramed_modes($modes, $params);
182 for ($i = 0; isset($modes[$i]) && $mode = $modes[$i]; $i++)
184 if (!strstr($addmodestring, $mode))
186 $req = IRCList::lookup($mode)['requires'];
187 if ($req == "Server
")
189 strcat($delmodestring, $mode);
190 $grp = get_chmode_group($mode);
192 strcat($delparamstring, $paramed_modes[$mode]." ");
198 if ($rpc->channel()->set_mode($channel, $delmodestring.$addmodestring, $delparamstring." ".$addparamstring))
199 Message::Success("Channel settings have been successfully updated
");
201 Message::Fail("Could not change channel settings
: $rpc->error
");
204 /* Re-grab the channel because of updates */
205 $channelObj = $rpc->channel()->get($channel, 4);
209 <title><?php echo $title; ?></title>
210 <h6><?php echo $title; ?></h6>
213 <form method="get
" action="details
.php
">
214 <div class="text
-left input
-group
" style="width
: 35%
;">
215 <input class="form
-control
" id="chan
" name="chan
" type="text
" value="<?php
echo $channame; ?>">
216 <div class="input
-group
-append
">
217 <button type="submit
" class="btn btn
-primary
">Go</button>
221 <?php if (!$channelObj)
224 <!-- Modal for Add Ban -->
225 <div class="modal fade
" id="ban
" tabindex="-1" role="dialog
" aria-labelledby="confirmModalCenterTitle
" aria-hidden="true">
226 <div class="modal
-dialog modal
-lg modal
-dialog
-centered
" role="document
">
227 <div class="modal
-content
">
228 <div class="modal
-header
">
229 <h5 class="modal
-title
" id="myModalLabel
">Add New Channel Ban</h5>
230 <div type="button
" class="close
" data-dismiss="modal
" aria-label="Close
">
231 <span aria-hidden="true">×</span>
234 <div class="modal
-body
">
236 <div class="input
-group mb
-3">
237 <label for="ban_nick
">Mask
238 <a href="https
://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true"
239 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"
241 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
242 placeholder
="nick!user@host or something else"
246 <div
class="input-group mb-3">
247 <label
for="bantype_action">Ban Action
248 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
250 <option
>Quiet (Mute
)</option
>
251 <option
>Nick
-change
</option
>
252 <option
>Join
</option
>
256 <div
class="input-group mb-3">
257 <label
for="bantype_sel_type">Ban Type
<small
>Leave this blank
for a
"normal" ban
</small
>
258 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
260 <option
>Match Account
</option
>
261 <option
>Match Channel
</option
>
262 <option
>Match Country
</option
>
263 <option
>Match OperClass
</option
>
264 <option
>Match RealName
/ GECOS
</option
>
265 <option
>Match Security Group
</option
>
266 <option
>Match Certificate Fingerprint
</option
>
270 <div
class="input-group mb-3">
271 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
272 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
276 <div
class="modal-footer">
277 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
278 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
279 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
287 <!-- Modal
for Add Invite
-->
288 <div
class="modal fade" id
="invite" tabindex
="-1" role
="dialog" aria
-labelledby
="add_invite_modal" aria
-hidden
="true">
289 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
290 <div
class="modal-content">
291 <div
class="modal-header">
292 <h5
class="modal-title" id
="add_invite_modal">Add
New Channel Invite
</h5
>
293 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
294 <span aria
-hidden
="true">×
;</span
>
297 <div
class="modal-body">
299 <div
class="input-group mb-3">
300 <label
for="ban_nick">Mask
301 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
302 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"
304 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
305 placeholder
="nick!user@host or something else"
309 <div
class="input-group mb-3">
310 <label
for="bantype_sel_type">Invite Type
311 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
313 <option
>Match Account
</option
>
314 <option
>Match Channel
</option
>
315 <option
>Match Country
</option
>
316 <option
>Match OperClass
</option
>
317 <option
>Match RealName
/ GECOS
</option
>
318 <option
>Match Security Group
</option
>
319 <option
>Match Certificate Fingerprint
</option
>
323 <div
class="input-group mb-3">
324 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
325 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
329 <div
class="modal-footer">
330 <input type
="hidden" name
="add_chinv" value
="I"></input
>
331 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
332 <button type
="submit" action
="post" class="btn btn-danger">Add Invite
</button
>
339 <!-- Modal
for Add Ban Exceptions
-->
340 <div
class="modal fade" id
="except" tabindex
="-1" role
="dialog" aria
-labelledby
="except" aria
-hidden
="true">
341 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
342 <div
class="modal-content">
343 <div
class="modal-header">
344 <h5
class="modal-title" >Add
New Channel Ban Exception
</h5
>
345 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
346 <span aria
-hidden
="true">×
;</span
>
349 <div
class="modal-body">
351 <div
class="input-group mb-3">
352 <label
for="ban_nick">Mask
353 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
354 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"
356 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
357 placeholder
="nick!user@host or something else"
361 <div
class="input-group mb-3">
362 <label
for="bantype_sel_type">Ban Type
363 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
365 <option
>Match Account
</option
>
366 <option
>Match Channel
</option
>
367 <option
>Match Country
</option
>
368 <option
>Match OperClass
</option
>
369 <option
>Match RealName
/ GECOS
</option
>
370 <option
>Match Security Group
</option
>
371 <option
>Match Certificate Fingerprint
</option
>
375 <div
class="input-group mb-3">
376 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
377 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
381 <div
class="modal-footer">
382 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
383 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
384 <button type
="submit" action
="post" class="btn btn-danger">Add Exception
</button
>
391 <!-- Modal
for Edit Channel Modes
-->
392 <div
class="modal fade" id
="editchmodes" tabindex
="-1" role
="dialog" aria
-labelledby
="editchmodes" aria
-hidden
="true">
393 <div
class="modal-dialog modal-dialog-centered" role
="document">
394 <div
class="modal-content">
395 <div
class="modal-header">
396 <h5
class="modal-title" id
="editchmodes">Edit Channel Modes
</h5
>
397 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
398 <span aria
-hidden
="true">×
;</span
>
401 <div
class="modal-body">
403 <?php
generate_edit_chmodes($channelObj); ?>
404 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
405 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
406 <button type
="submit" action
="post" class="btn btn-danger">Update
</button
>
416 <form method
="post" action
="details.php?chan=<?php echo urlencode($channelObj->name); ?>">
417 <div
class="input-group">
418 <input maxlength
="360" type
="text" class="input-group form-control" name
="set_topic" value
="<?php echo (isset($channelObj->topic)) ? htmlspecialchars($channelObj->topic) : ""; ?>">
419 <div
class="input-group-append"><button type
="submit" name
="update_topic" value
="true" class="btn btn-info">Update Topic
</button
></div
></div
>
423 Message
::Success("The topic for $channelObj->name has been updated to be: \"".htmlspecialchars($channelObj->topic
)."\"");
427 <!-- Modal
for User Action
-->
428 <div
class="modal fade" id
="useraction" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
429 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
430 <div
class="modal-content">
431 <div
class="modal-header">
432 <h5
class="modal-title" id
="myModalLabel">Add
New Channel Ban
</h5
>
433 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
434 <span aria
-hidden
="true">×
;</span
>
437 <div
class="modal-body">
439 <div
class="input-group mb-3">
440 <label
for="ban_nick">Mask
441 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
442 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"
444 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
445 placeholder
="nick!user@host or something else"
449 <div
class="input-group mb-3">
450 <label
for="bantype_action">Ban Action
451 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
453 <option
>Quiet (Mute
)</option
>
454 <option
>Nick
-change
</option
>
455 <option
>Join
</option
>
459 <div
class="input-group mb-3">
460 <label
for="bantype_sel_type">Ban Type
461 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
463 <option
>Match Account
</option
>
464 <option
>Match Channel
</option
>
465 <option
>Match Country
</option
>
466 <option
>Match OperClass
</option
>
467 <option
>Match RealName
/ GECOS
</option
>
468 <option
>Match Security Group
</option
>
469 <option
>Match Certificate Fingerprint
</option
>
473 <div
class="input-group mb-3">
474 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
475 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
479 <div
class="modal-footer">
480 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
481 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
482 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
489 <div
class="container-xxl">
491 <div
class="col-sm-4">
493 <div
class="card-body">
494 <h6
class="card-title">User
List</h6
>
495 <p
class="card-text"><?php
generate_chan_occupants_table($channelObj); ?></p
>
499 <div
class="col-sm-8">
501 <div
class="card-body">
502 <h6
class="card-title">Channel Settings
</h6
>
503 <ul
class="nav nav-tabs" role
="tablist">
504 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanmodes" aria
-controls
="chanmodes" role
="tab" data
-toggle
="tab">Settings
/ Modes
</a
></li
>
505 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanbans" aria
-controls
="chanbans" role
="tab" data
-toggle
="tab">Bans
</a
></li
>
506 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chaninv" aria
-controls
="chaninv" role
="tab" data
-toggle
="tab">Invites
</a
></li
>
507 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanex" aria
-controls
="chanex" role
="tab" data
-toggle
="tab">Excepts
</a
></li
>
510 <div
class="tab-content">
512 <div
class="tab-pane fade in" id
="chanmodes">
513 <button id
="editlol" class="btn btn-sm btn-primary" <?php
echo ($can_edit) ? "" : "disabled"; ?>>Change Settings
</button
>
514 <p
class="card-text"><?php
generate_html_chansettings($channelObj); ?></p
>
515 </div
><form id
="editchanmodes" method
="post" name
="editchanmodes">
516 <div
class="tab-pane" style
="display: none" id
="chanmodes_edit">
518 <div
class="btn btn-sm btn-secondary" id
="editchmodesbk">Go back
</div
>
519 <button type
="submit" class="btn btn-sm btn-primary">Save Changes
</button
>
520 <p
class="card-text"><?php
generate_edit_chmodes($channelObj); ?></p
>
524 <div
class="tab-pane fade in" id
="chanbans">
525 <p
class="card-text"><?php
generate_chanbans_table($channelObj); ?></p
>
527 <div
class="tab-pane fade in" id
="chaninv">
528 <p
class="card-text"><?php
generate_chaninvites_table($channelObj); ?></p
>
530 <div
class="tab-pane fade in" id
="chanex">
531 <p
class="card-text"><?php
generate_chanexcepts_table($channelObj); ?></p
>
533 <div
class="tab-pane fade in" id
="chanmodes_edit">
534 <p
class="card-text"><?php
/* insert hacks here */ ?></p
>
543 const toggleBtn
= document
.getElementById('editlol');
544 const staticInfo
= document
.getElementById('chanmodes');
545 const options
= document
.getElementById('chanmodes_edit');
546 const backBtn
= document
.getElementById('editchmodesbk');
548 backBtn
.addEventListener('click', function() {
549 staticInfo
.style
.display
= '';
550 options
.style
.display
= 'none';
552 toggleBtn
.addEventListener('click', function() {
553 staticInfo
.style
.display
= 'none';
554 options
.style
.display
= '';
557 // show dat first tab
558 $
('.nav-tabs a[href="#chanmodes"]').tab('show')
561 require_once("../inc/footer.php");