]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
add timestamp to avatar filenames to prevent overlap
[quix0rs-gnu-social.git] / lib / action.php
index 8d4a0b7ab53134a0deb4c395dd2243440f060b9c..67eaf9ed7a65fbaad400a16794687a600fb37215 100644 (file)
@@ -34,10 +34,28 @@ class Action { // lawsuit
                }
        }
 
+       function trimmed($key) {
+               $arg = $this->arg($key);
+               return (is_string($arg)) ? trim($arg) : $arg;
+       }
+       
        function handle($argarray) {
+               $strip = get_magic_quotes_gpc();
                $this->args = array();
                foreach ($argarray as $k => $v) {
-                       $this->args[$k] = $v;
+                       $this->args[$k] = ($strip) ? stripslashes($v) : $v;
                }
        }
+       
+       function boolean($key, $def=false) {
+               $arg = $this->arg($key);
+               return (is_null($arg)) ? $def : 
+               (strcasecmp($arg, 'true')) ? true :
+               (strcasecmp($arg, 'yes')) ? true : 
+               (strcasecmp($arg, '1')) ? true :
+               (strcasecmp($arg, 'false')) ? false :
+               (strcasecmp($arg, 'no')) ? false : 
+               (strcasecmp($arg, '0')) ? false :
+               $def;
+       }
 }