class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
{
-
function lookup_consumer($consumer_key)
{
$con = Consumer::staticGet('consumer_key', $consumer_key);
function getAppByRequestToken($token_key)
{
// Look up the full req tokenx
-
$req_token = $this->lookup_token(null,
'request',
$token_key);
}
// Look up the full Token
-
$token = new Token();
$token->tok = $req_token->key;
$result = $token->find(true);
}
// Okay, good
-
return new OAuthToken($at->tok, $at->secret);
}
-
} else {
return null;
}
}
-}
+ /**
+ * Revoke specified access token
+ *
+ * Revokes the token specified by $token_key.
+ * Throws exceptions in case of error.
+ *
+ * @param string $token_key the token to be revoked
+ * @param int $type type of token (0 = req, 1 = access)
+ *
+ * @access public
+ *
+ * @return void
+ */
+ public function revoke_token($token_key, $type = 0) {
+ $rt = new Token();
+ $rt->tok = $token_key;
+ $rt->type = $type;
+ $rt->state = 0;
+
+ if (!$rt->find(true)) {
+ // TRANS: Exception thrown when an attempt is made to revoke an unknown token.
+ throw new Exception(_('Tried to revoke unknown token.'));
+ }
+ if (!$rt->delete()) {
+ // TRANS: Exception thrown when an attempt is made to remove a revoked token.
+ throw new Exception(_('Failed to delete revoked token.'));
+ }
+ }
+}