<?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;
*/
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);
*/
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);
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
{
$r = dba::select('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp], ['limit' => 1]);
-
+
if (DBM::is_result($r)) {
return new \OAuthToken($r['id'], $r['secret']);
}
*/
public function new_request_token($consumer, $callback = null)
{
- logger(__function__.":".$consumer.", ". $callback);
+ logger(__function__ . ":" . $consumer . ", " . $callback);
$key = self::genToken();
$sec = self::genToken();
*/
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
// 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(
}
}
-
dba::delete('tokens', array('id' => $token->key));
-
if (!is_null($ret) && !is_null($uverifier)) {
Config::delete("oauth", $verifier);
}