]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - index.php
Allow deletion of entries in server bans list and spamfilter list
[irc/unrealircd/unrealircd-webpanel.git] / index.php
index d0453d164044b5374b3e77d6e2991e66376bc8b8..044775f4de88e67cc5fd9407b4aeedd828c36eba 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<link href="/css/unrealircd-admin.css" rel="stylesheet">
+<link href="css/unrealircd-admin.css" rel="stylesheet">
 <body>
 <div id="headerContainer">
 <h2>UnrealIRCd <small>Administration Panel</small></h2><br>
 define('UPATH', true);
 include "Classes/class-rpc.php";
 
+if (!empty($_POST['tklch']))
+       foreach ($_POST as $key => $value)
+       {
+               foreach ($value as $tok)
+               {
+                       $tok = explode(",",$tok);
+                       rpc_tkl_del(base64_decode($tok[0]), base64_decode($tok[1]));
+               }
+       }
+
 rpc_pop_lists(); // populate our static lists (users, channels, tkl, spamfilter)
 ?>
 
 <div class="tab-content\">
 <div id="overview" data-tab-content class="active">
-       <p>Your shiny IRC overview</p>
        <table class='unrealircd_overview'>
        <th>Chat Overview</th><th></th>
                <tr><td><b>Users</b></td><td><?php echo count(RPC_List::$user); ?></td></tr>
@@ -45,13 +54,13 @@ rpc_pop_lists(); // populate our static lists (users, channels, tkl, spamfilter)
                <tr><td><b>Spamfilter entries</b></td><td><?php echo count(RPC_List::$spamfilter); ?></td></tr></th>
        </table></div></div>
 
-<div class="tab-content\">
-<div id="Users" data-tab-content>
+       <div class="tab-content\">
+       <div id="Users" data-tab-content>
        <p></p>
        <table class='users_overview'>
        <th>Nick</th>
        <th>UID</th>
-       <th>IP/Host</th>
+       <th>Host / IP</th>
        <th>Account</th>
        <th>Usermodes</th>
        <th>Oper</th>
@@ -66,7 +75,7 @@ rpc_pop_lists(); // populate our static lists (users, channels, tkl, spamfilter)
                        echo "<td>".$user['name']."</td>";
                        echo "<td>".$user['id']."</td>";
                        echo "<td>".$user['hostname']." (".$user['ip'].")</td>";
-                       $account = (isset($user['account'])) ? $user['account'] : "";
+                       $account = (isset($user['user']['account'])) ? $user['user']['account'] : "";
                        echo "<td>".$account."</td>";
                        $modes = (isset($user['user']['modes'])) ? "+" . $user['user']['modes'] : "<none>";
                        echo "<td>".$modes."</td>";
@@ -77,8 +86,128 @@ rpc_pop_lists(); // populate our static lists (users, channels, tkl, spamfilter)
                        echo "<td>".$user['user']['servername']."</td>";
                        echo "<td>".$user['user']['reputation']."</td>";
                }
-       ?>
+       ?></table></div></div>
+
+       <div class="tab-content\">
+       <div id="Channels" data-tab-content>
+       <p></p>
+       <table class='users_overview'>
+       <th>Name</th>
+       <th>Created</th>
+       <th>User count</th>
+       <th>Topic</th>
+       <th>Topic Set</th>
+       <th>Modes</th>
+       
+       <?php
+               foreach(RPC_List::$channel as $channel)
+               {
+                       echo "<tr>";
+                       echo "<td>".$channel['name']."</td>";
+                       echo "<td>".$channel['creation_time']."</td>";
+                       echo "<td>".$channel['num_users']."</td>";
+                       $topic = (isset($channel['topic'])) ? $channel['topic'] : "";
+                       echo "<td>".$topic."</td>";
+                       $setby = (isset($channel['topic'])) ? "By ".$channel['topic_set_by'] .", at ".$channel['topic_set_at'] : "";
+                       echo "<td>".$setby."</td>";
+                       $modes = (isset($channel['modes'])) ? "+" . $channel['modes'] : "<none>";
+                       echo "<td>".$modes."</td>";
+               }
+       ?></table></div></div>
+
+
+       <div class="tab-content\">
+       <div id="TKL" data-tab-content>
+       
+       <table class='users_overview'>
+       <form action="" method="post">
+       <th><input type="checkbox" label='selectall' onClick="toggle(this)" />Select all</th>
+       <th>Mask</th>
+       <th>Type</th>
+       <th>Set By</th>
+       <th>Set On</th>
+       <th>Expires</th>
+       <th>Duration</th>
+       <th>Reason</th>
+       
+       <?php
+               foreach(RPC_List::$tkl as $tkl)
+               {
+                       echo "<tr>";
+                       echo "<td><input type=\"checkbox\" value='" . base64_encode($tkl['name']).",".base64_encode($tkl['type']) . "' name=\"tklch[]\"></td>";
+                       echo "<td>".$tkl['name']."</td>";
+                       echo "<td>".$tkl['type_string']."</td>";
+                       echo "<td>".$tkl['set_by']."</td>";
+                       echo "<td>".$tkl['set_at_string']."</td>";
+                       echo "<td>".$tkl['expire_at_string']."</td>";
+                       echo "<td>".$tkl['duration_string']."</td>";
+                       echo "<td>".$tkl['reason']."</td>";
+               }
+       ?></table><p><input class="cute_button" type="submit" value="Delete selected"></p></form></div></div>
+       
+
+       <div class="tab-content\">
+       <div id="Spamfilter" data-tab-content>
+       <p></p>
+       <table class='users_overview'>
+       <th>Mask</th>
+       <th>Type</th>
+       <th>Set By</th>
+       <th>Set On</th>
+       <th>Expires</th>
+       <th>Duration</th>
+       <th>Match Type</th>
+       <th>Action</th>
+       <th>Action Duration</th>
+       <th>Target</th>
+       <th>Reason</th>
+       
+       <?php
+               foreach(RPC_List::$spamfilter as $sf)
+               {
+                       echo "<tr>";
+                       echo "<td>".$sf['name']."</td>";
+                       echo "<td>".$sf['type_string']."</td>";
+                       echo "<td>".$sf['set_by']."</td>";
+                       echo "<td>".$sf['set_at_string']."</td>";
+                       echo "<td>".$sf['expire_at_string']."</td>";
+                       echo "<td>".$sf['duration_string']."</td>";
+                       echo "<td>".$sf['match_type']."</td>";
+                       echo "<td>".$sf['ban_action']."</td>";
+                       echo "<td>".$sf['ban_duration_string']."</td>";
+                       for ($i = 0, $targs = ""; ($c = $sf['spamfilter_targets'][$i]); $i++)
+                       {
+                               if ($c == "c")
+                                       $targs .= "Channel, ";
+                               else if ($c == "p")
+                                       $targs .= "Private,";
+                               else if ($c == "n")
+                                       $targs .= "Notice, ";
+                               else if ($c == "N")
+                                       $targs .= "Channel notice, ";
+                               else if ($c == "P")
+                                       $targs .= "Part message, ";
+                               else if ($c == "q")
+                                       $targs .= "Quit message, ";
+                               else if ($c == "d")
+                                       $targs .= "DCC filename, ";
+                               else if ($c == "a")
+                                       $targs .= "Away message, ";
+                               else if ($c == "t")
+                                       $targs .= "Channel topic, ";
+                               else if ($c == "T")
+                                       $targs .= "MessageTag, ";
+                               else if ($c == "u")
+                                       $targs .= "Usermask, ";
 
+                               $targs = rtrim($targs,", ");
+                       }
+                       echo "<td>".$targs."</td>";
+                       echo "<td>".$sf['reason']."</td>";
+                       
+               }
+       ?></table></div></div>
+       
 </body>
 
-<div class="footer"><p>Copyright 2022 © <a href="https://unrealircd.org/">UnrealIRCd</a></p></div>
\ No newline at end of file
+<div class="footer"><p>Copyright 2022-2023 © <a href="https://unrealircd.org/">UnrealIRCd</a></p></div>
\ No newline at end of file