X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Faction.php;h=67eaf9ed7a65fbaad400a16794687a600fb37215;hb=de56ccca07e19c5163792c210ff5f6130e91d892;hp=8d4a0b7ab53134a0deb4c395dd2243440f060b9c;hpb=52600ce0b063e68e622b19699841e41b5ddbf2d1;p=quix0rs-gnu-social.git diff --git a/lib/action.php b/lib/action.php index 8d4a0b7ab5..67eaf9ed7a 100644 --- a/lib/action.php +++ b/lib/action.php @@ -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; + } }