X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/43a6787a1955308ab82d57bcab5535b36d3ef6e1..f849e0c715b70742a92d1312c2a8eac6cc4336c4:/channels/details.php diff --git a/channels/details.php b/channels/details.php index 8fb37f5..46d3321 100644 --- a/channels/details.php +++ b/channels/details.php @@ -1,6 +1,7 @@ server()->get()) IRCList::setmodes($uplink->server->features->chanmodes); @@ -9,6 +10,8 @@ $channel = ""; $channame = ""; $nick = NULL; $channelObj = NULL; + +$can_edit = current_user_can(PERMISSION_EDIT_CHANNEL); do_log($_GET); do_log($_POST); if (isset($_GET['chan'])) @@ -153,6 +156,51 @@ if (!empty($_POST)) Message::Success($msgbox_str); } } + + if (isset($_POST['newmodes']) && isset($_POST['paramed_modes']) && $can_edit) + { + $m = $_POST['newmodes']; + $p = $_POST['paramed_modes']; + + do_log($p,$m); + $addmodestring = "+"; + $addparamstring = ""; + $delmodestring = "-"; + $delparamstring = ""; + foreach ($m as $mode) + { + strcat($addmodestring, $mode); + if (isset($p[$mode]) && strlen($p[$mode])) + strcat($addparamstring, $p[$mode]." "); + } + + $fmodes = $channelObj->modes; + $tok = split($fmodes); + $modes = $tok[0]; + $params = rparv($fmodes); + $paramed_modes = sort_paramed_modes($modes, $params); + for ($i = 0; isset($modes[$i]) && $mode = $modes[$i]; $i++) + { + if (!strstr($addmodestring, $mode)) + { + $req = IRCList::lookup($mode)['requires']; + if ($req == "Server") + continue; + strcat($delmodestring, $mode); + $grp = get_chmode_group($mode); + if ($grp == 2) + strcat($delparamstring, $paramed_modes[$mode]." "); + } + + } + + + if ($rpc->channel()->set_mode($channel, $delmodestring.$addmodestring, $delparamstring." ".$addparamstring)) + Message::Success("Channel settings have been successfully updated"); + else + Message::Fail("Could not change channel settings: $rpc->error"); + } + /* Re-grab the channel because of updates */ $channelObj = $rpc->channel()->get($channel, 4); } @@ -160,21 +208,22 @@ if (!empty($_POST)) ?> <?php echo $title; ?>
-
-
-
+
-
+{ + require_once("../inc/footer.php"); + return; +} +?>
-