From: Valerie Pond Date: Sat, 4 Feb 2023 18:47:13 +0000 (+0000) Subject: Allow updating the channel topic from channels/details.php X-Git-Tag: 0.9~361 X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/commitdiff_plain/b3c83a048746cf52545ae753edd0a15c05072dff?hp=31ef838cadbb4c55b17dcc67870dee9bdc69b846 Allow updating the channel topic from channels/details.php --- diff --git a/channels/details.php b/channels/details.php index 7c9f216..23d08e5 100644 --- a/channels/details.php +++ b/channels/details.php @@ -7,6 +7,7 @@ $title = "Channel Lookup"; $channel = ""; $channame = ""; $nick = NULL; +$channelObj = NULL; do_log($_GET); do_log($_POST); if (isset($_GET['chan'])) @@ -23,6 +24,34 @@ if (isset($_GET['chan'])) do_log($channelObj); } } +$topicset = false; +if (isset($_POST)) +{ + if (isset($_POST['update_topic']) && isset($_POST['set_topic'])) + { + if (isset($channelObj)) + { + if (isset($channelObj->topic)) // if the set topic is different + { + if (strcmp($channelObj->topic,$_POST['set_topic'])) + { + $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username : NULL; + $topicset = $rpc->channel()->set_topic($channelObj->name, $_POST['set_topic'], $user); + $channelObj->topic = $_POST['set_topic']; + } + } + else + { + $user = (function_exists('unreal_get_current_user') && $u = unreal_get_current_user()) ? $u->username : NULL; + $topicset = $rpc->channel()->set_topic($channelObj->name, $_POST['set_topic'], $user); + $channelObj->topic = $_POST['set_topic']; + } + } + } + if ($topicset) + Message::Success("The topic for $channelObj->name has been updated to be: \"$channelObj->topic\""); +} + ?> <?php echo $title; ?>

@@ -31,7 +60,7 @@ if (isset($_GET['chan']))
- +

@@ -42,6 +71,14 @@ if (isset($_GET['chan'])) +
+

+ Topic:

+ + "> + + +


@@ -107,13 +144,16 @@ if (isset($_GET['chan']))
+ + +