]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/oauthconnectionssettings.php
OAuth widgets separated into their own files
[quix0rs-gnu-social.git] / actions / oauthconnectionssettings.php
index e95a4a5cf5c1c0488595566e19c55f9c8d62b6cc..a3ba7eda3930a05510d262c35c86fb456b68dc26 100644 (file)
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET') && !defined('LACONICA')) {
-    exit(1);
-}
-
-require_once INSTALLDIR . '/lib/connectsettingsaction.php';
-require_once INSTALLDIR . '/lib/applicationlist.php';
-require_once INSTALLDIR . '/lib/apioauthstore.php';
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * Show connected OAuth applications
@@ -46,7 +40,7 @@ require_once INSTALLDIR . '/lib/apioauthstore.php';
  *
  * @see      SettingsAction
  */
-class OauthconnectionssettingsAction extends ConnectSettingsAction
+class OauthconnectionssettingsAction extends SettingsAction
 {
     var $page        = null;
     var $oauth_token = null;
@@ -133,6 +127,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
 
         $token = $this->trimmed('token');
         if (!$token || $token != common_session_token()) {
+            // TRANS: Client error displayed when the session token does not match or is not given.
             $this->showForm(_('There was a problem with your session token. '.
                               'Try again, please.'));
             return;
@@ -143,7 +138,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
         } else {
             // TRANS: Client error when submitting a form with unexpected information.
             $this->clientError(_('Unexpected form submission.'), 401);
-            return false;
         }
     }
 
@@ -164,12 +158,11 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
         if (empty($appUser)) {
             // TRANS: Client error when trying to revoke access for an application while not being a user of it.
             $this->clientError(_('You are not a user of that application.'), 401);
-            return false;
         }
 
-        $app = Oauth_application::staticGet('id', $appUser->application_id);
+        $app = Oauth_application::getKV('id', $appUser->application_id);
 
-        $datastore = new ApiStatusNetOAuthDataStore();
+        $datastore = new ApiGNUsocialOAuthDataStore();
         $datastore->revoke_token($appUser->token, 1);
 
         $result = $appUser->delete();
@@ -179,7 +172,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
             // TRANS: Client error when revoking access has failed for some reason.
             // TRANS: %s is the application ID revoking access failed for.
             $this->clientError(sprintf(_('Unable to revoke access for application: %s.'), $app->id));
-            return false;
         }
 
         $msg = 'API OAuth - user %s (id: %d) revoked access token %s for app id %d';