From: Michael J. Rubinsky Date: Thu, 5 Mar 2009 01:29:50 +0000 (-0500) Subject: Fix logic in setUser for not setting cookies X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1a9669f51e8b75926f2a7a20a837eb80afda78f2;p=horde.git Fix logic in setUser for not setting cookies Move getLoggedInUser() method to the Auth class even though it calls the 'Users.getLoggedInUsers' api method. Makes more sense as an Auth method. --- diff --git a/framework/Service_Facebook/lib/Horde/Service/Facebook/Auth.php b/framework/Service_Facebook/lib/Horde/Service/Facebook/Auth.php index cccfb131a..6a1bbc7c2 100644 --- a/framework/Service_Facebook/lib/Horde/Service/Facebook/Auth.php +++ b/framework/Service_Facebook/lib/Horde/Service/Facebook/Auth.php @@ -421,8 +421,8 @@ class Horde_Service_Facebook_Auth */ public function setUser($user, $sessionKey, $expires = null, $no_cookie = false) { - if ($no_cookie || !$this->_request->getCookie($this->_facebook->apiKey . '_user') || - $this->_request->getCookie($this->_facebook->apiKey . '_user') != $user) { + if (!$no_cookie && (!$this->_request->getCookie($this->_facebook->apiKey . '_user') || + $this->_request->getCookie($this->_facebook->apiKey . '_user') != $user)) { $this->setCookies($user, $sessionKey, $expires); } @@ -470,4 +470,22 @@ class Horde_Service_Facebook_Auth $this->expireSession(); } + + /** + * Returns the user corresponding to the current session object. + * + * @throws Horde_Service_Facebook_Exception + * @return integer User id + */ + public function &getLoggedInUser() + { + if (!$this->getSessionKey()) { + throw new Horde_Service_Facebook_Exception('users.getLoggedInUser requires a session_key', + Horde_Service_Facebook_ErrorCodes::API_EC_PARAM_SESSION_KEY); + } + + return $this->_facebook->callMethod('facebook.users.getLoggedInUser', + array('session_key' => $this->getSessionKey())); + } + } \ No newline at end of file diff --git a/framework/Service_Facebook/lib/Horde/Service/Facebook/Users.php b/framework/Service_Facebook/lib/Horde/Service/Facebook/Users.php index 9fb9ab961..b441f4a8d 100644 --- a/framework/Service_Facebook/lib/Horde/Service/Facebook/Users.php +++ b/framework/Service_Facebook/lib/Horde/Service/Facebook/Users.php @@ -48,23 +48,6 @@ class Horde_Service_Facebook_Users extends Horde_Service_Facebook_Base } /** - * Returns the user corresponding to the current session object. - * - * @throws Horde_Service_Facebook_Exception - * @return integer User id - */ - public function &getLoggedInUser() - { - if (!$this->_facebook->auth->getSessionKey()) { - throw new Horde_Service_Facebook_Exception('users.getLoggedInUser requires a session_key', - Horde_Service_Facebook_ErrorCodes::API_EC_PARAM_SESSION_KEY); - } - - return $this->_facebook->callMethod('facebook.users.getLoggedInUser', - array('session_key' => $this->_facebook->auth->getSessionKey())); - } - - /** * Returns 1 if the user has the specified permission, 0 otherwise. * http://wiki.developers.facebook.com/index.php/Users.hasAppPermission *