diff options
author | Zach Copley <zach@status.net> | 2009-11-19 15:17:24 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-11-19 15:17:24 -0800 |
commit | 288d875b79684f84d0fb1da5291de94ddf099a74 (patch) | |
tree | abe1cfbe1c1aa438f447b77823df03b90e1ab3b9 /actions | |
parent | 8618b064e226e7a2ff16627eaa2a76906ac64176 (diff) |
Added validation to fields in user admin panel
Diffstat (limited to 'actions')
-rw-r--r-- | actions/useradminpanel.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/actions/useradminpanel.php b/actions/useradminpanel.php index 968f2a247..e65769212 100644 --- a/actions/useradminpanel.php +++ b/actions/useradminpanel.php @@ -143,6 +143,31 @@ class UseradminpanelAction extends AdminPanelAction function validate(&$values) { + // Validate biolimit + + if (!Validate::number($values['profile']['biolimit'])) { + $this->clientError(_("Invalid bio limit. Must be numeric.")); + } + + // Validate welcome text + + if (mb_strlen($values['newuser']['welcome']) > 255) { + $this->clientError(_("Invalid welcome text. Max length is 255 characters.")); + } + + // Validate default subscription + + if (!empty($values['newuser']['default'])) { + $defuser = User::staticGet('nickname', trim($values['newuser']['default'])); + if (empty($defuser)) { + $this->clientError( + sprintf( + _('Invalid default subscripton: \'%1$s\' is not user.'), + $values['newuser']['default'] + ) + ); + } + } } } @@ -208,7 +233,7 @@ class UserAdminPanelForm extends AdminForm $this->li(); $this->input('welcome', _('New user welcome'), - _('Welcome text for new users.'), + _('Welcome text for new users (Max 255 chars).'), 'newuser'); $this->unli(); |