123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- require_once INSTALLDIR . '/lib/applicationlist.php';
- class OauthappssettingsAction extends SettingsAction
- {
- var $page = 0;
- function prepare($args)
- {
- 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 true;
- }
-
- function title()
- {
-
- return _('OAuth applications');
- }
-
- function getInstructions()
- {
-
- return _('Applications you have registered');
- }
-
- 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->whereAdd("name != 'anonymous'");
- $application->limit($offset, $limit);
- $application->orderBy('created DESC');
- $application->find();
- $cnt = 0;
- if ($application) {
- $al = new ApplicationList($application, $user, $this);
- $cnt = $al->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- }
- }
- $this->elementStart('p', array('id' => 'application_register'));
- $this->element('a',
- array('href' => common_local_url('newapplication'),
- 'class' => 'more'
- ),
-
- 'Register a new application');
- $this->elementEnd('p');
- $this->pagination(
- $this->page > 1,
- $cnt > APPS_PER_PAGE,
- $this->page,
- 'oauthappssettings'
- );
- }
- function showEmptyListMessage()
- {
-
- $message = sprintf(_('You have not registered any applications yet.'));
- $this->elementStart('div', 'guide');
- $this->raw(common_markup_to_html($message));
- $this->elementEnd('div');
- }
-
- function handlePost()
- {
-
- $token = $this->trimmed('token');
- if (!$token || $token != common_session_token()) {
- $this->showForm(_('There was a problem with your session token. '.
- 'Try again, please.'));
- return;
- }
- }
- }
|