1
1
Fork 0

Formatting FKOauthDataStore

This commit is contained in:
Hypolite Petovan 2017-12-17 15:34:29 -05:00
parent 2978b1eef0
commit 910d3f7b5f

View file

@ -1,10 +1,12 @@
<?php
/**
* @file src/Protocol/FKOAuthDataStore.php
* OAuth server
* Based on oauth2-php <http://code.google.com/p/oauth2-php/>
*
*/
namespace Friendica\Network;
use Friendica\App;
@ -41,7 +43,7 @@ class FKOAuthDataStore extends OAuthDataStore
*/
public function lookup_consumer($consumer_key)
{
logger(__function__.":".$consumer_key);
logger(__function__ . ":" . $consumer_key);
$s = dba::select('clients', array('client_id', 'pw', 'redirect_uri'), array('client_id' => $consumer_key));
$r = dba::inArray($s);
@ -61,7 +63,7 @@ class FKOAuthDataStore extends OAuthDataStore
*/
public function lookup_token($consumer, $token_type, $token)
{
logger(__function__.":".$consumer.", ". $token_type.", ".$token);
logger(__function__ . ":" . $consumer . ", " . $token_type . ", " . $token);
$s = dba::select('tokens', array('id', 'secret', 'scope', 'expires', 'uid'), array('client_id' => $consumer->key, 'scope' => $token_type, 'id' => $token));
$r = dba::inArray($s);
@ -102,7 +104,7 @@ class FKOAuthDataStore extends OAuthDataStore
*/
public function new_request_token($consumer, $callback = null)
{
logger(__function__.":".$consumer.", ". $callback);
logger(__function__ . ":" . $consumer . ", " . $callback);
$key = self::genToken();
$sec = self::genToken();
@ -137,7 +139,7 @@ class FKOAuthDataStore extends OAuthDataStore
*/
public function new_access_token($token, $consumer, $verifier = null)
{
logger(__function__.":".$token.", ". $consumer.", ". $verifier);
logger(__function__ . ":" . $token . ", " . $consumer . ", " . $verifier);
// return a new access token attached to this consumer
// for the user associated with this token if the request token
@ -148,9 +150,9 @@ class FKOAuthDataStore extends OAuthDataStore
// get user for this verifier
$uverifier = Config::get("oauth", $verifier);
logger(__function__.":".$verifier.",".$uverifier);
logger(__function__ . ":" . $verifier . "," . $uverifier);
if (is_null($verifier) || ($uverifier!==false)) {
if (is_null($verifier) || ($uverifier !== false)) {
$key = self::genToken();
$sec = self::genToken();
$r = dba::insert(
@ -169,10 +171,8 @@ class FKOAuthDataStore extends OAuthDataStore
}
}
dba::delete('tokens', array('id' => $token->key));
if (!is_null($ret) && !is_null($uverifier)) {
Config::delete("oauth", $verifier);
}