]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Don't call channel.get() twice for simple GET requests.
authorBram Matthys <redacted>
Mon, 27 Mar 2023 08:56:52 +0000 (10:56 +0200)
committerBram Matthys <redacted>
Mon, 27 Mar 2023 08:57:20 +0000 (10:57 +0200)
$_POST always exists even for GET requests, so isset() always
returned 1 and then... yeah...

Also, prepare to fetch more details...

channels/details.php

index 3e22fd3dfc9d4b4ad501f869eae36ef90dcf855b..115d24289797b71bcf4afd44f32eb74c72b1a186 100644 (file)
@@ -13,7 +13,7 @@ do_log($_POST);
 if (isset($_GET['chan']))
 {
        $channel = $_GET['chan'];
-       $channelObj = $rpc->channel()->get($channel);
+       $channelObj = $rpc->channel()->get($channel, 4);
        if (!$channelObj && strlen($channel))
        {
                Message::Fail("Could not find channel: \"$channel\"");
@@ -31,7 +31,7 @@ $del_ban = false;
 $checkboxes = [];
 
 $chanban_errors = [];
-if (isset($_POST))
+if (!empty($_POST))
 {
        if (isset($_POST['update_topic']) && isset($_POST['set_topic']))
        {
@@ -152,9 +152,8 @@ if (isset($_POST))
                        Message::Success($msgbox_str);
                }
        }
-       /* and finally re-grab the channel because updates lol */
-       $channelObj = $rpc->channel()->get($channel);
-
+       /* Re-grab the channel because of updates */
+       $channelObj = $rpc->channel()->get($channel, 4);
 }
 
 ?>