]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Allow add_meta() with a value of false/null/int.
authorBram Matthys <redacted>
Sat, 13 May 2023 13:40:32 +0000 (15:40 +0200)
committerBram Matthys <redacted>
Sat, 13 May 2023 13:43:21 +0000 (15:43 +0200)
Actually we could just as well drop the value type requirement
since we accept array now and thus indirectly accept everything
since the values within the array go unchecked, but.. whatever :P

This also removes the !$value check, which added similar restrictions.

Classes/class-paneluser.php

index e9abb9b31ae4cd8c86213da22e9e70ae47e844c8..32bd16afa3ea798eef3927e75f50158c6c174b08 100644 (file)
@@ -103,21 +103,22 @@ class PanelUser
         * Add user meta data
         * You may use arrays or strings but both parameter types must match
         * @param array|string $key
-        * @param array|string $value
+        * @param array|string|int|bool|null $value
         */
-       function add_meta(array|string $key, array|string $value)
+       function add_meta(array|string $key, array|string|int|bool|null $value)
        {
                
-               if (!$key || !$value)
+               if (!$key)
                        return false;
 
-               if (is_string($key) && is_string($value))
-                       $arr[$key] = $value;
-
-               else
+               if (is_array($key))
+               {
                        foreach ($key as $i => $k)
                                $arr[$k] = $value[$i];
-               
+               } else {
+                       $arr[$key] = $value;
+               }
+
                foreach($arr as $k => $v)
                {
                        $meta = [