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)
223 require_once("../inc
/footer
.php
");
228 <!-- Modal for Add Ban -->
229 <div class="modal fade
" id="ban
" tabindex="-1" role="dialog
" aria-labelledby="confirmModalCenterTitle
" aria-hidden="true">
230 <div class="modal
-dialog modal
-lg modal
-dialog
-centered
" role="document
">
231 <div class="modal
-content
">
232 <div class="modal
-header
">
233 <h5 class="modal
-title
" id="myModalLabel
">Add New Channel Ban</h5>
234 <div type="button
" class="close
" data-dismiss="modal
" aria-label="Close
">
235 <span aria-hidden="true">×</span>
238 <div class="modal
-body
">
240 <div class="input
-group mb
-3">
241 <label for="ban_nick
">Mask
242 <a href="https
://www.unrealircd.org/docs/Extended_bans" target="__blank"><i class="fa fa-info-circle" aria-hidden="true"
243 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"
245 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
246 placeholder
="nick!user@host or something else"
250 <div
class="input-group mb-3">
251 <label
for="bantype_action">Ban Action
252 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
254 <option
>Quiet (Mute
)</option
>
255 <option
>Nick
-change
</option
>
256 <option
>Join
</option
>
260 <div
class="input-group mb-3">
261 <label
for="bantype_sel_type">Ban Type
<small
>Leave this blank
for a
"normal" ban
</small
>
262 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
264 <option
>Match Account
</option
>
265 <option
>Match Channel
</option
>
266 <option
>Match Country
</option
>
267 <option
>Match OperClass
</option
>
268 <option
>Match RealName
/ GECOS
</option
>
269 <option
>Match Security Group
</option
>
270 <option
>Match Certificate Fingerprint
</option
>
274 <div
class="input-group mb-3">
275 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
276 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
280 <div
class="modal-footer">
281 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
282 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
283 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
291 <!-- Modal
for Add Invite
-->
292 <div
class="modal fade" id
="invite" tabindex
="-1" role
="dialog" aria
-labelledby
="add_invite_modal" aria
-hidden
="true">
293 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
294 <div
class="modal-content">
295 <div
class="modal-header">
296 <h5
class="modal-title" id
="add_invite_modal">Add
New Channel Invite
</h5
>
297 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
298 <span aria
-hidden
="true">×
;</span
>
301 <div
class="modal-body">
303 <div
class="input-group mb-3">
304 <label
for="ban_nick">Mask
305 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
306 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"
308 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
309 placeholder
="nick!user@host or something else"
313 <div
class="input-group mb-3">
314 <label
for="bantype_sel_type">Invite Type
315 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
317 <option
>Match Account
</option
>
318 <option
>Match Channel
</option
>
319 <option
>Match Country
</option
>
320 <option
>Match OperClass
</option
>
321 <option
>Match RealName
/ GECOS
</option
>
322 <option
>Match Security Group
</option
>
323 <option
>Match Certificate Fingerprint
</option
>
327 <div
class="input-group mb-3">
328 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
329 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
333 <div
class="modal-footer">
334 <input type
="hidden" name
="add_chinv" value
="I"></input
>
335 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
336 <button type
="submit" action
="post" class="btn btn-danger">Add Invite
</button
>
343 <!-- Modal
for Add Ban Exceptions
-->
344 <div
class="modal fade" id
="except" tabindex
="-1" role
="dialog" aria
-labelledby
="except" aria
-hidden
="true">
345 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
346 <div
class="modal-content">
347 <div
class="modal-header">
348 <h5
class="modal-title" >Add
New Channel Ban Exception
</h5
>
349 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
350 <span aria
-hidden
="true">×
;</span
>
353 <div
class="modal-body">
355 <div
class="input-group mb-3">
356 <label
for="ban_nick">Mask
357 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
358 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"
360 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
361 placeholder
="nick!user@host or something else"
365 <div
class="input-group mb-3">
366 <label
for="bantype_sel_type">Ban Type
367 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
369 <option
>Match Account
</option
>
370 <option
>Match Channel
</option
>
371 <option
>Match Country
</option
>
372 <option
>Match OperClass
</option
>
373 <option
>Match RealName
/ GECOS
</option
>
374 <option
>Match Security Group
</option
>
375 <option
>Match Certificate Fingerprint
</option
>
379 <div
class="input-group mb-3">
380 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
381 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
385 <div
class="modal-footer">
386 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
387 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
388 <button type
="submit" action
="post" class="btn btn-danger">Add Exception
</button
>
395 <!-- Modal
for Edit Channel Modes
-->
396 <div
class="modal fade" id
="editchmodes" tabindex
="-1" role
="dialog" aria
-labelledby
="editchmodes" aria
-hidden
="true">
397 <div
class="modal-dialog modal-dialog-centered" role
="document">
398 <div
class="modal-content">
399 <div
class="modal-header">
400 <h5
class="modal-title" id
="editchmodes">Edit Channel Modes
</h5
>
401 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
402 <span aria
-hidden
="true">×
;</span
>
405 <div
class="modal-body">
407 <?php
generate_edit_chmodes($channelObj); ?>
408 <input type
="hidden" id
="server" name
="add_chex" value
="e"></input
>
409 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
410 <button type
="submit" action
="post" class="btn btn-danger">Update
</button
>
420 <form method
="post" action
="details.php?chan=<?php echo urlencode($channelObj->name); ?>">
421 <div
class="input-group">
422 <input maxlength
="360" type
="text" class="input-group form-control" name
="set_topic" value
="<?php echo (isset($channelObj->topic)) ? htmlspecialchars($channelObj->topic) : ""; ?>">
423 <div
class="input-group-append"><button type
="submit" name
="update_topic" value
="true" class="btn btn-info">Update Topic
</button
></div
></div
>
427 Message
::Success("The topic for $channelObj->name has been updated to be: \"".htmlspecialchars($channelObj->topic
)."\"");
431 <!-- Modal
for User Action
-->
432 <div
class="modal fade" id
="useraction" tabindex
="-1" role
="dialog" aria
-labelledby
="confirmModalCenterTitle" aria
-hidden
="true">
433 <div
class="modal-dialog modal-lg modal-dialog-centered" role
="document">
434 <div
class="modal-content">
435 <div
class="modal-header">
436 <h5
class="modal-title" id
="myModalLabel">Add
New Channel Ban
</h5
>
437 <div type
="button" class="close" data
-dismiss
="modal" aria
-label
="Close">
438 <span aria
-hidden
="true">×
;</span
>
441 <div
class="modal-body">
443 <div
class="input-group mb-3">
444 <label
for="ban_nick">Mask
445 <a href
="https://www.unrealircd.org/docs/Extended_bans" target
="__blank"><i
class="fa fa-info-circle" aria
-hidden
="true"
446 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"
448 <input style
="width: 170%;" name
="ban_nick" id
="ban_nick" class="form-control curvy" type
="text"
449 placeholder
="nick!user@host or something else"
453 <div
class="input-group mb-3">
454 <label
for="bantype_action">Ban Action
455 <select
class="form-control" name
="bantype_sel_action" id
="bantype_sel">
457 <option
>Quiet (Mute
)</option
>
458 <option
>Nick
-change
</option
>
459 <option
>Join
</option
>
463 <div
class="input-group mb-3">
464 <label
for="bantype_sel_type">Ban Type
465 <select
class="form-control" name
="bantype_sel_type" id
="bantype_sel_type">
467 <option
>Match Account
</option
>
468 <option
>Match Channel
</option
>
469 <option
>Match Country
</option
>
470 <option
>Match OperClass
</option
>
471 <option
>Match RealName
/ GECOS
</option
>
472 <option
>Match Security Group
</option
>
473 <option
>Match Certificate Fingerprint
</option
>
477 <div
class="input-group mb-3">
478 <label
for="bantype_sel_ex">Expiry Date
-Time
<br
><small
>Leave blank to mean
"Permanent"</small
>
479 <input type
="datetime-local" name
="bantype_sel_ex" id
="bantype_sel_ex" class="form-control">
483 <div
class="modal-footer">
484 <input type
="hidden" id
="server" name
="add_chban" value
="b"></input
>
485 <button id
="CloseButton" type
="button" class="btn btn-secondary" data
-dismiss
="modal">Cancel
</button
>
486 <button type
="submit" action
="post" class="btn btn-danger">Add Channel Ban
</button
>
493 <div
class="container-xxl">
495 <div
class="col-sm-4">
497 <div
class="card-body">
498 <h6
class="card-title">User
List</h6
>
499 <p
class="card-text"><?php
generate_chan_occupants_table($channelObj); ?></p
>
503 <div
class="col-sm-8">
505 <div
class="card-body">
506 <h6
class="card-title">Channel Settings
</h6
>
507 <ul
class="nav nav-tabs" role
="tablist">
508 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanmodes" aria
-controls
="chanmodes" role
="tab" data
-toggle
="tab">Settings
/ Modes
</a
></li
>
509 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanbans" aria
-controls
="chanbans" role
="tab" data
-toggle
="tab">Bans
</a
></li
>
510 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chaninv" aria
-controls
="chaninv" role
="tab" data
-toggle
="tab">Invites
</a
></li
>
511 <li
class="nav-item" role
="presentation"><a
class="nav-link" href
="#chanex" aria
-controls
="chanex" role
="tab" data
-toggle
="tab">Excepts
</a
></li
>
514 <div
class="tab-content">
516 <div
class="tab-pane fade in" id
="chanmodes">
517 <button id
="editlol" class="btn btn-sm btn-primary" <?php
echo ($can_edit) ? "" : "disabled"; ?>>Change Settings
</button
>
518 <p
class="card-text"><?php
generate_html_chansettings($channelObj); ?></p
>
519 </div
><form id
="editchanmodes" method
="post" name
="editchanmodes">
520 <div
class="tab-pane" style
="display: none" id
="chanmodes_edit">
522 <div
class="btn btn-sm btn-secondary" id
="editchmodesbk">Go back
</div
>
523 <button type
="submit" class="btn btn-sm btn-primary">Save Changes
</button
>
524 <p
class="card-text"><?php
generate_edit_chmodes($channelObj); ?></p
>
528 <div
class="tab-pane fade in" id
="chanbans">
529 <p
class="card-text"><?php
generate_chanbans_table($channelObj); ?></p
>
531 <div
class="tab-pane fade in" id
="chaninv">
532 <p
class="card-text"><?php
generate_chaninvites_table($channelObj); ?></p
>
534 <div
class="tab-pane fade in" id
="chanex">
535 <p
class="card-text"><?php
generate_chanexcepts_table($channelObj); ?></p
>
537 <div
class="tab-pane fade in" id
="chanmodes_edit">
538 <p
class="card-text"><?php
/* insert hacks here */ ?></p
>
547 const toggleBtn
= document
.getElementById('editlol');
548 const staticInfo
= document
.getElementById('chanmodes');
549 const options
= document
.getElementById('chanmodes_edit');
550 const backBtn
= document
.getElementById('editchmodesbk');
552 backBtn
.addEventListener('click', function() {
553 staticInfo
.style
.display
= '';
554 options
.style
.display
= 'none';
556 toggleBtn
.addEventListener('click', function() {
557 staticInfo
.style
.display
= 'none';
558 options
.style
.display
= '';
561 // show dat first tab
562 $
('.nav-tabs a[href="#chanmodes"]').tab('show')
565 require_once("../inc/footer.php");