fix checking boolean parameters

darcs-hash:20080529151602-84dde-f6bc3c41846d92c94008f721fa5115907fd9a7d3.gz
This commit is contained in:
Evan Prodromou 2008-05-29 11:16:02 -04:00
parent 9bb55af26f
commit b153ac5b1b
2 changed files with 6 additions and 7 deletions

View File

@ -34,7 +34,6 @@ class RegisterAction extends Action {
}
function try_register() {
print_r($this->args);
$nickname = $this->trimmed('nickname');
$email = $this->trimmed('email');

View File

@ -50,12 +50,12 @@ class Action { // lawsuit
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 :
(strcasecmp($arg, 'true') == 0) ? true :
(strcasecmp($arg, 'yes') == 0) ? true :
(strcasecmp($arg, '1') == 0) ? true :
(strcasecmp($arg, 'false') == 0) ? false :
(strcasecmp($arg, 'no') == 0) ? false :
(strcasecmp($arg, '0') == 0) ? false :
$def;
}
}