From 8618b064e226e7a2ff16627eaa2a76906ac64176 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 19 Nov 2009 15:02:25 -0800 Subject: Added a user admin panel --- lib/adminpanelaction.php | 3 +++ lib/router.php | 2 ++ 2 files changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php index 89a129db1..7997eb2b1 100644 --- a/lib/adminpanelaction.php +++ b/lib/adminpanelaction.php @@ -302,6 +302,9 @@ class AdminPanelNav extends Widget $this->out->menuItem(common_local_url('designadminpanel'), _('Design'), _('Design configuration'), $action_name == 'designadminpanel', 'nav_design_admin_panel'); + $this->out->menuItem(common_local_url('useradminpanel'), _('User'), + _('Paths configuration'), $action_name == 'useradminpanel', 'nav_design_admin_panel'); + $this->out->menuItem(common_local_url('pathsadminpanel'), _('Paths'), _('Paths configuration'), $action_name == 'pathsadminpanel', 'nav_design_admin_panel'); diff --git a/lib/router.php b/lib/router.php index afe36f712..d5101826f 100644 --- a/lib/router.php +++ b/lib/router.php @@ -590,9 +590,11 @@ class Router $m->connect('admin/site', array('action' => 'siteadminpanel')); $m->connect('admin/design', array('action' => 'designadminpanel')); + $m->connect('admin/user', array('action' => 'useradminpanel')); $m->connect('admin/paths', array('action' => 'pathsadminpanel')); + $m->connect('getfile/:filename', array('action' => 'getfile'), array('filename' => '[A-Za-z0-9._-]+')); -- cgit v1.2.3-54-g00ecf From 288d875b79684f84d0fb1da5291de94ddf099a74 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 19 Nov 2009 15:17:24 -0800 Subject: Added validation to fields in user admin panel --- actions/useradminpanel.php | 27 ++++++++++++++++++++++++++- lib/router.php | 2 -- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'lib') 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(); diff --git a/lib/router.php b/lib/router.php index d5101826f..b22185126 100644 --- a/lib/router.php +++ b/lib/router.php @@ -593,8 +593,6 @@ class Router $m->connect('admin/user', array('action' => 'useradminpanel')); $m->connect('admin/paths', array('action' => 'pathsadminpanel')); - - $m->connect('getfile/:filename', array('action' => 'getfile'), array('filename' => '[A-Za-z0-9._-]+')); -- cgit v1.2.3-54-g00ecf