mirror of
https://github.com/friendica/friendica
synced 2024-12-23 13:20:21 +00:00
Fix coding standards
This commit is contained in:
parent
126e281165
commit
ca5e0eaaea
1 changed files with 14 additions and 7 deletions
|
@ -120,8 +120,10 @@ class OAuth
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$bearer = trim(substr($authorization, 7));
|
$bearer = trim(substr($authorization, 7));
|
||||||
|
|
||||||
$condition = ['access_token' => $bearer];
|
$condition = ['access_token' => $bearer];
|
||||||
|
|
||||||
$token = DBA::selectFirst('application-view', ['uid', 'id', 'name', 'website', 'created_at', 'read', 'write', 'follow', 'push'], $condition);
|
$token = DBA::selectFirst('application-view', ['uid', 'id', 'name', 'website', 'created_at', 'read', 'write', 'follow', 'push'], $condition);
|
||||||
if (!DBA::isResult($token)) {
|
if (!DBA::isResult($token)) {
|
||||||
Logger::warning('Token not found', $condition);
|
Logger::warning('Token not found', $condition);
|
||||||
|
@ -194,12 +196,17 @@ class OAuth
|
||||||
$code = bin2hex(random_bytes(32));
|
$code = bin2hex(random_bytes(32));
|
||||||
$access_token = bin2hex(random_bytes(32));
|
$access_token = bin2hex(random_bytes(32));
|
||||||
|
|
||||||
$fields = ['application-id' => $application['id'], 'uid' => $uid, 'code' => $code, 'access_token' => $access_token, 'scopes' => $scope,
|
$fields = [
|
||||||
'read' => (stripos($scope, self::SCOPE_READ) !== false),
|
'application-id' => $application['id'],
|
||||||
'write' => (stripos($scope, self::SCOPE_WRITE) !== false),
|
'uid' => $uid,
|
||||||
'follow' => (stripos($scope, self::SCOPE_FOLLOW) !== false),
|
'code' => $code,
|
||||||
'push' => (stripos($scope, self::SCOPE_PUSH) !== false),
|
'access_token' => $access_token,
|
||||||
'created_at' => DateTimeFormat::utcNow(DateTimeFormat::MYSQL)];
|
'scopes' => $scope,
|
||||||
|
'read' => (stripos($scope, self::SCOPE_READ) !== false),
|
||||||
|
'write' => (stripos($scope, self::SCOPE_WRITE) !== false),
|
||||||
|
'follow' => (stripos($scope, self::SCOPE_FOLLOW) !== false),
|
||||||
|
'push' => (stripos($scope, self::SCOPE_PUSH) !== false),
|
||||||
|
'created_at' => DateTimeFormat::utcNow(DateTimeFormat::MYSQL)];
|
||||||
|
|
||||||
foreach ([self::SCOPE_READ, self::SCOPE_WRITE, self::SCOPE_WRITE, self::SCOPE_PUSH] as $scope) {
|
foreach ([self::SCOPE_READ, self::SCOPE_WRITE, self::SCOPE_WRITE, self::SCOPE_PUSH] as $scope) {
|
||||||
if ($fields[$scope] && !$application[$scope]) {
|
if ($fields[$scope] && !$application[$scope]) {
|
||||||
|
|
Loading…
Reference in a new issue