aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth/provider/oauth/token_storage.php
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-08-24 22:00:16 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-08-24 22:04:04 -0400
commita8ffbce99f9ea99bd1fdca0e009001026e2d6950 (patch)
tree1cae1d43fee4c417eedd8303f581eb3109d083ab /phpBB/phpbb/auth/provider/oauth/token_storage.php
parent310caec5d92d58453d1eee40e9b5a7f0157bd5ea (diff)
downloadforums-a8ffbce99f9ea99bd1fdca0e009001026e2d6950.tar
forums-a8ffbce99f9ea99bd1fdca0e009001026e2d6950.tar.gz
forums-a8ffbce99f9ea99bd1fdca0e009001026e2d6950.tar.bz2
forums-a8ffbce99f9ea99bd1fdca0e009001026e2d6950.tar.xz
forums-a8ffbce99f9ea99bd1fdca0e009001026e2d6950.zip
[feature/oauth] Changes due to code review
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth/provider/oauth/token_storage.php')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/token_storage.php35
1 files changed, 15 insertions, 20 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php
index b31ffcd1ab..05e308d192 100644
--- a/phpBB/phpbb/auth/provider/oauth/token_storage.php
+++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php
@@ -83,7 +83,8 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
*/
public function retrieveAccessToken()
{
- if( $this->cachedToken instanceOf TokenInterface ) {
+ if ($this->cachedToken instanceOf TokenInterface)
+ {
return $this->cachedToken;
}
@@ -92,7 +93,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
'provider' => $this->service_name,
);
- if ($this->user->data['user_id'] == ANONYMOUS)
+ if ($this->user->data['user_id'] === ANONYMOUS)
{
$data['session_id'] = $this->user->data['session_id'];
}
@@ -124,7 +125,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
*/
public function hasAccessToken()
{
- if( $this->cachedToken ) {
+ if ($this->cachedToken) {
return true;
}
@@ -133,7 +134,7 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
'provider' => $this->service_name,
);
- if ($this->user->data['user_id'] == ANONYMOUS)
+ if ($this->user->data['user_id'] === ANONYMOUS)
{
$data['session_id'] = $this->user->data['session_id'];
}
@@ -149,12 +150,12 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
$this->cachedToken = null;
$sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . '
- WHERE user_id = ' . $this->user->data['user_id'] . '
- AND provider = \'' . $this->db->sql_escape($this->service_name) . '\'';
+ WHERE user_id = ' . $this->user->data['user_id'] . "
+ AND provider = '" . $this->db->sql_escape($this->service_name) . "'";
- if ($this->user->data['user_id'] == ANONYMOUS)
+ if ($this->user->data['user_id'] === ANONYMOUS)
{
- $sql .= ' AND session_id = \'' . $this->user->data['session_id'] . '\'';
+ $sql .= " AND session_id = '" . $this->user->data['session_id'] . "'";
}
$this->db->sql_query($sql);
@@ -176,8 +177,8 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
SET ' . $this->db->sql_build_array('UPDATE', array(
'user_id' => (int) $user_id
)) . '
- WHERE user_id = ' . $this->user->data['user_id'] . '
- AND session_id = \'' . $this->user->data['session_id'] . '\'';
+ WHERE user_id = ' . $this->user->data['user_id'] . "
+ AND session_id = '" . $this->user->data['session_id'] . "'";
$this->db->sql_query($sql);
}
@@ -188,7 +189,8 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
*/
public function has_access_token_by_session()
{
- if( $this->cachedToken ) {
+ if ($this->cachedToken)
+ {
return true;
}
@@ -208,19 +210,12 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
*/
protected function _has_acess_token($data)
{
- $row = $this->get_access_token_row($data);
-
- if (!$row)
- {
- return false;
- }
-
- return true;
+ return (bool) $this->get_access_token_row($data);
}
public function retrieve_access_token_by_session()
{
- if( $this->cachedToken instanceOf TokenInterface ) {
+ if ($this->cachedToken instanceOf TokenInterface) {
return $this->cachedToken;
}