X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Foauthappssettings.php;h=43e9b33663ac62c6da1ee94e5694fb71d19221af;hb=9e89a177c76741f7e696f09d778bd8b151f84d3f;hp=6c0670b17bfecc31605fd9316a6aa5394eda2a3d;hpb=536170d7884a58d279a01e5ed5fbc267840a17ba;p=quix0rs-gnu-social.git diff --git a/actions/oauthappssettings.php b/actions/oauthappssettings.php index 6c0670b17b..43e9b33663 100644 --- a/actions/oauthappssettings.php +++ b/actions/oauthappssettings.php @@ -27,12 +27,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR . '/lib/settingsaction.php'; -require_once INSTALLDIR . '/lib/applicationlist.php'; +if (!defined('GNUSOCIAL')) { exit(1); } /** * Show a user's registered OAuth applications @@ -48,19 +43,11 @@ require_once INSTALLDIR . '/lib/applicationlist.php'; class OauthappssettingsAction extends SettingsAction { - var $page = 0; + protected $page = null; - function prepare($args) + protected function doPreparation() { - parent::prepare($args); - $this->page = ($this->arg('page')) ? ($this->arg('page') + 0) : 1; - - if (!common_logged_in()) { - $this->clientError(_('You must be logged in to list your applications.')); - return false; - } - - return true; + $this->page = $this->int('page') ?: 1; } /** @@ -71,6 +58,7 @@ class OauthappssettingsAction extends SettingsAction function title() { + // TRANS: Page title for OAuth applications return _('OAuth applications'); } @@ -82,24 +70,18 @@ class OauthappssettingsAction extends SettingsAction function getInstructions() { + // TRANS: Page instructions for OAuth applications return _('Applications you have registered'); } - /** - * Content area of the page - * - * @return void - */ - function showContent() { - $user = common_current_user(); - $offset = ($this->page - 1) * APPS_PER_PAGE; $limit = APPS_PER_PAGE + 1; $application = new Oauth_application(); - $application->owner = $user->id; + $application->owner = $this->scoped->getID(); + $application->whereAdd("name != 'anonymous'"); $application->limit($offset, $limit); $application->orderBy('created DESC'); $application->find(); @@ -107,7 +89,7 @@ class OauthappssettingsAction extends SettingsAction $cnt = 0; if ($application) { - $al = new ApplicationList($application, $user, $this); + $al = new ApplicationList($application, $this->scoped, $this); $cnt = $al->show(); if (0 == $cnt) { $this->showEmptyListMessage(); @@ -119,6 +101,7 @@ class OauthappssettingsAction extends SettingsAction array('href' => common_local_url('newapplication'), 'class' => 'more' ), + // TRANS: Link description to add a new OAuth application. 'Register a new application'); $this->elementEnd('p'); @@ -132,35 +115,11 @@ class OauthappssettingsAction extends SettingsAction function showEmptyListMessage() { + // TRANS: Empty list message on page with OAuth applications. Markup allowed $message = sprintf(_('You have not registered any applications yet.')); $this->elementStart('div', 'guide'); $this->raw(common_markup_to_html($message)); $this->elementEnd('div'); } - - /** - * Handle posts to this form - * - * Based on the button that was pressed, muxes out to other functions - * to do the actual task requested. - * - * All sub-functions reload the form with a message -- success or failure. - * - * @return void - */ - - function handlePost() - { - // CSRF protection - - $token = $this->trimmed('token'); - if (!$token || $token != common_session_token()) { - $this->showForm(_('There was a problem with your session token. '. - 'Try again, please.')); - return; - } - - } - }