X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fadminpanelaction.php;h=af6e11a511487805f7c5aaf337c584f2d270fcd4;hb=77d780a59e45701839f77a7d15996c90a07b2bd5;hp=d1aab3dfcbadc8e4dad3d5c24d78a174b178c96a;hpb=62d5f1addb1b710a387f7732ace1dd33bd1b86c1;p=quix0rs-gnu-social.git diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php index d1aab3dfcb..af6e11a511 100644 --- a/lib/adminpanelaction.php +++ b/lib/adminpanelaction.php @@ -44,7 +44,6 @@ if (!defined('STATUSNET')) { * * @todo Find some commonalities with SettingsAction and combine */ - class AdminPanelAction extends Action { var $success = true; @@ -61,16 +60,15 @@ class AdminPanelAction extends Action * * @return boolean success flag */ - - function prepare($args) + function prepare(array $args=array()) { parent::prepare($args); // 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,8 +119,7 @@ class AdminPanelAction extends Action * * @return void */ - - function handle($args) + function handle(array $args=array()) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->checkSessionToken(); @@ -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(); @@ -189,23 +185,12 @@ class AdminPanelAction extends Action $this->elementEnd('div'); } - /** - * There is no data for aside, so, we don't output - * - * @return nothing - */ - function showAside() - { - - } - /** * show human-readable instructions for the page, or * a success/failure on save. * * @return void */ - function showPageNotice() { if ($this->msg) { @@ -228,11 +213,10 @@ class AdminPanelAction extends Action * * @return void */ - function showForm() { + // TRANS: Client error message. $this->clientError(_('showForm() not implemented.')); - return; } /** @@ -244,7 +228,6 @@ class AdminPanelAction extends Action * * @return void */ - function getInstructions() { return ''; @@ -257,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) @@ -301,94 +256,8 @@ class AdminPanelAction extends Action return $isOK; } -} -/** - * Menu for public group of actions - * - * @category Output - * @package StatusNet - * @author Evan Prodromou - * @author Sarven Capadisli - * @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'); - } - }