]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/adminpanelaction.php
MessageCommand moved to DirectMessage plugin
[quix0rs-gnu-social.git] / lib / adminpanelaction.php
index d43ea76984df4eb9f651a920638c28603a1f087a..2ac92cb5c6522a38f8b6e6d789e9b21c20a0b890 100644 (file)
@@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
  *
  * @todo Find some commonalities with SettingsAction and combine
  */
-
 class AdminPanelAction extends Action
 {
     var $success = true;
@@ -61,7 +60,6 @@ class AdminPanelAction extends Action
      *
      * @return boolean success flag
      */
-
     function prepare($args)
     {
         parent::prepare($args);
@@ -69,8 +67,8 @@ class AdminPanelAction extends Action
         // User must be logged in.
 
         if (!common_logged_in()) {
+            // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
             $this->clientError(_('Not logged in.'));
-            return false;
         }
 
         $user = common_current_user();
@@ -93,8 +91,8 @@ class AdminPanelAction extends Action
         // User must have the right to change admin settings
 
         if (!$user->hasRight(Right::CONFIGURESITE)) {
+            // TRANS: Client error message thrown when a user tries to change admin settings but has no access rights.
             $this->clientError(_('You cannot make changes to this site.'));
-            return false;
         }
 
         // This panel must be enabled
@@ -104,8 +102,8 @@ class AdminPanelAction extends Action
         $name = mb_substr($name, 0, -10);
 
         if (!self::canAdmin($name)) {
+            // TRANS: Client error message throw when a certain panel's settings cannot be changed.
             $this->clientError(_('Changes to that panel are not allowed.'), 403);
-            return false;
         }
 
         return true;
@@ -121,7 +119,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function handle($args)
     {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -134,6 +131,7 @@ class AdminPanelAction extends Action
                 Config::loadSettings();
 
                 $this->success = true;
+                // TRANS: Message after successful saving of administrative settings.
                 $this->msg     = _('Settings saved.');
             } catch (Exception $e) {
                 $this->success = false;
@@ -151,7 +149,6 @@ class AdminPanelAction extends Action
      * @return void
      * @see AdminPanelNav
      */
-
     function showLocalNav()
     {
         $nav = new AdminPanelNav($this);
@@ -165,7 +162,6 @@ class AdminPanelAction extends Action
      *
      * @return void.
      */
-
     function showContent()
     {
         $this->showForm();
@@ -195,7 +191,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function showPageNotice()
     {
         if ($this->msg) {
@@ -218,11 +213,10 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function showForm()
     {
+        // TRANS: Client error message.
         $this->clientError(_('showForm() not implemented.'));
-        return;
     }
 
     /**
@@ -234,7 +228,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function getInstructions()
     {
         return '';
@@ -247,38 +240,10 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function saveSettings()
     {
+        // TRANS: Client error message
         $this->clientError(_('saveSettings() not implemented.'));
-        return;
-    }
-
-    /**
-     * Delete a design setting
-     *
-     * // XXX: Maybe this should go in Design? --Z
-     *
-     * @return mixed $result false if something didn't work
-     */
-
-    function deleteSetting($section, $setting)
-    {
-        $config = new Config();
-
-        $config->section = $section;
-        $config->setting = $setting;
-
-        if ($config->find(true)) {
-            $result = $config->delete();
-            if (!$result) {
-                common_log_db_error($config, 'DELETE', __FILE__);
-                $this->clientError(_("Unable to delete design setting."));
-                return null;
-            }
-        }
-
-        return $result;
     }
 
     function canAdmin($name)
@@ -291,94 +256,8 @@ class AdminPanelAction extends Action
 
         return $isOK;
     }
-}
-
-/**
- * Menu for public group of actions
- *
- * @category Output
- * @package  StatusNet
- * @author   Evan Prodromou <evan@status.net>
- * @author   Sarven Capadisli <csarven@status.net>
- * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://status.net/
- *
- * @see      Widget
- */
-
-class AdminPanelNav extends Widget
-{
-    var $action = null;
 
-    /**
-     * Construction
-     *
-     * @param Action $action current action, used for output
-     */
-
-    function __construct($action=null)
+    function showProfileBlock()
     {
-        parent::__construct($action);
-        $this->action = $action;
     }
-
-    /**
-     * Show the menu
-     *
-     * @return void
-     */
-
-    function show()
-    {
-        $action_name = $this->action->trimmed('action');
-
-        $this->action->elementStart('ul', array('class' => 'nav'));
-
-        if (Event::handle('StartAdminPanelNav', array($this))) {
-
-            if (AdminPanelAction::canAdmin('site')) {
-                $this->out->menuItem(common_local_url('siteadminpanel'), _('Site'),
-                                     _('Basic site configuration'), $action_name == 'siteadminpanel', 'nav_site_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('design')) {
-                $this->out->menuItem(common_local_url('designadminpanel'), _('Design'),
-                                     _('Design configuration'), $action_name == 'designadminpanel', 'nav_design_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('user')) {
-                $this->out->menuItem(common_local_url('useradminpanel'), _('User'),
-                                     _('User configuration'), $action_name == 'useradminpanel', 'nav_user_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('access')) {
-                $this->out->menuItem(common_local_url('accessadminpanel'), _('Access'),
-                                     _('Access configuration'), $action_name == 'accessadminpanel', 'nav_access_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('paths')) {
-                $this->out->menuItem(common_local_url('pathsadminpanel'), _('Paths'),
-                                    _('Paths configuration'), $action_name == 'pathsadminpanel', 'nav_paths_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('sessions')) {
-                $this->out->menuItem(common_local_url('sessionsadminpanel'), _('Sessions'),
-                                     _('Sessions configuration'), $action_name == 'sessionsadminpanel', 'nav_sessions_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('sitenotice')) {
-                $this->out->menuItem(common_local_url('sitenoticeadminpanel'), _('Site notice'),
-                                     _('Edit site notice'), $action_name == 'sitenoticeadminpanel', 'nav_sitenotice_admin_panel');
-            }
-
-            if (AdminPanelAction::canAdmin('snapshot')) {
-                $this->out->menuItem(common_local_url('snapshotadminpanel'), _('Snapshots'),
-                                     _('Snapshots configuration'), $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
-            }
-
-            Event::handle('EndAdminPanelNav', array($this));
-        }
-        $this->action->elementEnd('ul');
-    }
-
 }