]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blobdiff - Classes/class-rpc.php
Merge branch 'main' of https://github.com/ValwareIRC/unrealircd-webpanel
[irc/unrealircd/unrealircd-webpanel.git] / Classes / class-rpc.php
index 3823db630a9e3ebeec911800cd2a0ee42479b5d1..7e2b80dd0582f4a98c216a8aa751e0de3940ce65 100644 (file)
@@ -1,9 +1,9 @@
 <?php
-
 /**
  * RPC Functionality for UnrealIRCd Admin Webpanel
  * License: GPLv3 or later
- * Author: Valware
+ * Author: ValwareIRC
+ * GitHub URI: ValwareIRC/unrealircd-webpanel
  * 2023
  */
 
@@ -84,6 +84,9 @@ class RPC
                );
                curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
 
+               if (UNREALIRCD_DEBUG)
+                       do_log("SENDING JSON:", $this->content['body']);
+
                curl_setopt($curl, CURLOPT_POSTFIELDS, $this->content['body']);
 
                //for debug only!
@@ -140,6 +143,7 @@ function rpc_pop_lists()
                if ($key == "result")
                        foreach($value['list'] as $r)
                        {
+                               
                                RPC_List::$user[] = $r;
                                if (strpos($r['user']['modes'],"o") !== false && strpos($r['user']['modes'],"S") == false)
                                        RPC_List::$opercount++;
@@ -261,7 +265,20 @@ function rpc_sf_del($name, $mtype, $targets, $action) : bool
        else
        {
                $r = $result['result']['tkl']; 
-               Message::Success($r['name']." [type: ".$r['match_type']."] [targets: ".$r['spamfilter_targets']. "] [action: ".$r['ban_action']."] [reason: ".$r['reason']."] [set by: ".$r['set_by']."]");
+               Message::Success("Deleted spamfilter entry: ".$r['name']." [type: ".$r['match_type']."] [targets: ".$r['spamfilter_targets']. "] [action: ".$r['ban_action']."] [reason: ".$r['reason']."] [set by: ".$r['set_by']."]");
        }
        return true;
+}
+
+/** Convert the duration_string */
+function rpc_convert_duration_string($str)
+{
+       $tok = explode("w", $str);
+       $weeks = $tok[0];
+       $tok = explode("d", $tok[1]);
+       $days = $tok[0];
+       $tok = explode("h", $tok[1]);
+       $hours = $tok[0];
+       return "$weeks weeks, $days days and $hours hours";
+       
 }
\ No newline at end of file