]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/useradminpanel.php
Beginnings of a new Facebook integration plugin
[quix0rs-gnu-social.git] / actions / useradminpanel.php
index 968f2a24752c61e9c8d043907b9ef94fc7b39c95..04e0ca3e757bc17ed96c30bdc0256d77755674e5 100644 (file)
@@ -12,6 +12,7 @@
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
+ *
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU Affero General Public License for more details.
@@ -24,7 +25,7 @@
  * @author    Evan Prodromou <evan@status.net>
  * @author    Zach Copley <zach@status.net>
  * @author    Sarven Capadisli <csarven@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -55,7 +56,8 @@ class UseradminpanelAction extends AdminPanelAction
 
     function title()
     {
-        return _('User');
+        // TRANS: User admin panel title
+        return _m('TITLE', 'User');
     }
 
     /**
@@ -66,7 +68,7 @@ class UseradminpanelAction extends AdminPanelAction
 
     function getInstructions()
     {
-        return _('User settings for this StatusNet site.');
+        return _('User settings for this StatusNet site');
     }
 
     /**
@@ -96,7 +98,6 @@ class UseradminpanelAction extends AdminPanelAction
         );
 
         static $booleans = array(
-            'sessions' => array('handle', 'debug'),
             'invite' => array('enabled')
         );
 
@@ -143,6 +144,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 +234,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();
 
@@ -236,26 +262,7 @@ class UserAdminPanelForm extends AdminForm
         $this->out->elementEnd('ul');
         $this->out->elementEnd('fieldset');
 
-        $this->out->elementStart('fieldset', array('id' => 'settings_user_sessions'));
-        $this->out->element('legend', null, _('Sessions'));
-
-        $this->out->elementStart('ul');
 
-        $this->li();
-        $this->out->checkbox('sessions-handle', _('Handle sessions'),
-                              (bool) $this->value('handle', 'sessions'),
-                              _('Whether to handle sessions ourselves.'));
-        $this->unli();
-
-        $this->li();
-        $this->out->checkbox('sessions-debug', _('Session debugging'),
-                              (bool) $this->value('debug', 'sessions'),
-                              _('Turn on debugging output for sessions.'));
-        $this->unli();
-
-        $this->out->elementEnd('ul');
-
-        $this->out->elementEnd('fieldset');
 
     }
 
@@ -285,6 +292,6 @@ class UserAdminPanelForm extends AdminForm
 
     function formActions()
     {
-        $this->out->submit('submit', _('Save'), 'submit', null, _('Save site settings'));
+        $this->out->submit('submit', _('Save'), 'submit', null, _('Save user settings'));
     }
 }