]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/adminpanelaction.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / lib / adminpanelaction.php
index a927e23336f73b80ab78bc0a98aafbf95778e286..8dd16e9d0ce6a2b1d1e8b2abdd6f712257c1561c 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,7 +67,7 @@ class AdminPanelAction extends Action
         // User must be logged in.
 
         if (!common_logged_in()) {
-            // TRANS: Client error message
+            // TRANS: Client error message thrown when trying to access the admin panel while not logged in.
             $this->clientError(_('Not logged in.'));
             return false;
         }
@@ -94,7 +92,7 @@ class AdminPanelAction extends Action
         // User must have the right to change admin settings
 
         if (!$user->hasRight(Right::CONFIGURESITE)) {
-            // TRANS: Client error message
+            // 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;
         }
@@ -106,7 +104,7 @@ class AdminPanelAction extends Action
         $name = mb_substr($name, 0, -10);
 
         if (!self::canAdmin($name)) {
-            // TRANS: Client error message
+            // 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;
         }
@@ -124,7 +122,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function handle($args)
     {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -155,7 +152,6 @@ class AdminPanelAction extends Action
      * @return void
      * @see AdminPanelNav
      */
-
     function showLocalNav()
     {
         $nav = new AdminPanelNav($this);
@@ -169,7 +165,6 @@ class AdminPanelAction extends Action
      *
      * @return void.
      */
-
     function showContent()
     {
         $this->showForm();
@@ -199,7 +194,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function showPageNotice()
     {
         if ($this->msg) {
@@ -222,10 +216,9 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function showForm()
     {
-        // TRANS: Client error message
+        // TRANS: Client error message.
         $this->clientError(_('showForm() not implemented.'));
         return;
     }
@@ -239,7 +232,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function getInstructions()
     {
         return '';
@@ -252,7 +244,6 @@ class AdminPanelAction extends Action
      *
      * @return void
      */
-
     function saveSettings()
     {
         // TRANS: Client error message
@@ -267,7 +258,6 @@ class AdminPanelAction extends Action
      *
      * @return mixed $result false if something didn't work
      */
-
     function deleteSetting($section, $setting)
     {
         $config = new Config();
@@ -279,13 +269,15 @@ class AdminPanelAction extends Action
             $result = $config->delete();
             if (!$result) {
                 common_log_db_error($config, 'DELETE', __FILE__);
-                // TRANS: Client error message
+                // TRANS: Client error message thrown if design settings could not be deleted in
+                // TRANS: the admin panel Design.
                 $this->clientError(_("Unable to delete design setting."));
                 return null;
             }
+            return $result;
         }
 
-        return $result;
+        return null;
     }
 
     function canAdmin($name)
@@ -312,7 +304,6 @@ class AdminPanelAction extends Action
  *
  * @see      Widget
  */
-
 class AdminPanelNav extends Widget
 {
     var $action = null;
@@ -322,7 +313,6 @@ class AdminPanelNav extends Widget
      *
      * @param Action $action current action, used for output
      */
-
     function __construct($action=null)
     {
         parent::__construct($action);
@@ -334,7 +324,6 @@ class AdminPanelNav extends Widget
      *
      * @return void
      */
-
     function show()
     {
         $action_name = $this->action->trimmed('action');
@@ -407,9 +396,24 @@ class AdminPanelNav extends Widget
                                      $menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
             }
 
+            if (AdminPanelAction::canAdmin('license')) {
+                // TRANS: Menu item title/tooltip
+                $menu_title = _('Set site license');
+                // TRANS: Menu item for site administration
+                $this->out->menuItem(common_local_url('licenseadminpanel'), _('License'),
+                                     $menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
+            }
+
+            if (AdminPanelAction::canAdmin('plugins')) {
+                // TRANS: Menu item title/tooltip
+                $menu_title = _('Plugins configuration');
+                // TRANS: Menu item for site administration
+                $this->out->menuItem(common_local_url('pluginsadminpanel'), _('Plugins'),
+                                     $menu_title, $action_name == 'pluginsadminpanel', 'nav_design_admin_panel');
+            }
+
             Event::handle('EndAdminPanelNav', array($this));
         }
         $this->action->elementEnd('ul');
     }
-
 }