From fdfa88667de91d49a803684f8a532bcc3fda76fb Mon Sep 17 00:00:00 2001 From: Mathieu Boillat Date: Wed, 29 Jan 2014 23:51:40 +0100 Subject: [PATCH 1/8] Check if session is really active If you started and stopped a PHP session then session_id won't be empty (but session is closed). If you use session_status you can get the real state of a PHP session. --- src/facebook.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/facebook.php b/src/facebook.php index 51de333b..7907c6af 100644 --- a/src/facebook.php +++ b/src/facebook.php @@ -55,8 +55,14 @@ class Facebook extends BaseFacebook * @see BaseFacebook::__construct */ public function __construct($config) { - if (!session_id()) { - session_start(); + if (function_exists('session_status')) { + if (session_status() !== PHP_SESSION_ACTIVE) { + session_start(); + } + } else { + if (!session_id()) { + session_start(); + } } parent::__construct($config); if (!empty($config['sharedSession'])) { From ae71cdee05256c691f7507259eac1cd4a4fa4257 Mon Sep 17 00:00:00 2001 From: Mathieu Boillat Date: Fri, 21 Feb 2014 11:19:09 +0100 Subject: [PATCH 2/8] Update facebook.php --- src/facebook.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/facebook.php b/src/facebook.php index 7907c6af..b6b827dc 100644 --- a/src/facebook.php +++ b/src/facebook.php @@ -55,14 +55,9 @@ class Facebook extends BaseFacebook * @see BaseFacebook::__construct */ public function __construct($config) { - if (function_exists('session_status')) { - if (session_status() !== PHP_SESSION_ACTIVE) { - session_start(); - } - } else { - if (!session_id()) { - session_start(); - } + if ((function_exists('session_status') + && session_status() !== PHP_SESSION_ACTIVE) || !session_id()) { + session_start(); } parent::__construct($config); if (!empty($config['sharedSession'])) { From e553dc576d2a34d416e74628a27dd5b9af745fbc Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Tue, 11 Mar 2014 11:11:51 -0700 Subject: [PATCH 3/8] Removed deprecated getLoginStatusUrl --- src/base_facebook.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/base_facebook.php b/src/base_facebook.php index b9d403ef..95e18fb1 100644 --- a/src/base_facebook.php +++ b/src/base_facebook.php @@ -659,21 +659,6 @@ public function getLogoutUrl($params=array()) { ); } - /** - * Get a login status URL to fetch the status from Facebook. - * - * @param array $params Provide custom parameters - * @return string The URL for the logout flow - */ - public function getLoginStatusUrl($params=array()) { - return $this->getLoginUrl( - array_merge(array( - 'response_type' => 'code', - 'display' => 'none', - ), $params) - ); - } - /** * Make an API call. * From 8a992afce97122556c4e42b0f1c1d60b9d49276d Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Thu, 3 Apr 2014 19:27:38 -0700 Subject: [PATCH 4/8] Removed getLoginStatusUrl tests: --- tests/tests.php | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/tests/tests.php b/tests/tests.php index b28a3f18..fa1d83a7 100644 --- a/tests/tests.php +++ b/tests/tests.php @@ -761,37 +761,6 @@ public function testLogoutURLDefaults() { $this->assertFalse(strpos($facebook->getLogoutUrl(), self::SECRET)); } - public function testLoginStatusURLDefaults() { - $_SERVER['HTTP_HOST'] = 'fbrell.com'; - $_SERVER['REQUEST_URI'] = '/examples'; - $facebook = new TransientFacebook(array( - 'appId' => self::APP_ID, - 'secret' => self::SECRET, - )); - $encodedUrl = rawurlencode('http://fbrell.com/examples'); - $this->assertNotNull(strpos($facebook->getLoginStatusUrl(), $encodedUrl), - 'Expect the current url to exist.'); - } - - public function testLoginStatusURLCustom() { - $_SERVER['HTTP_HOST'] = 'fbrell.com'; - $_SERVER['REQUEST_URI'] = '/examples'; - $facebook = new TransientFacebook(array( - 'appId' => self::APP_ID, - 'secret' => self::SECRET, - )); - $encodedUrl1 = rawurlencode('http://fbrell.com/examples'); - $okUrl = 'http://fbrell.com/here1'; - $encodedUrl2 = rawurlencode($okUrl); - $loginStatusUrl = $facebook->getLoginStatusUrl(array( - 'ok_session' => $okUrl, - )); - $this->assertNotNull(strpos($loginStatusUrl, $encodedUrl1), - 'Expect the current url to exist.'); - $this->assertNotNull(strpos($loginStatusUrl, $encodedUrl2), - 'Expect the custom url to exist.'); - } - public function testNonDefaultPort() { $_SERVER['HTTP_HOST'] = 'fbrell.com:8080'; $_SERVER['REQUEST_URI'] = '/examples'; From 52394114509e627bdb79faab9069c9a553784e98 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Wed, 30 Apr 2014 07:56:06 -0700 Subject: [PATCH 5/8] Updated readme to point to new repository. --- readme.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/readme.md b/readme.md index ecbfffe3..22f4cc59 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,14 @@ +### New SDK Released + +We've released version 4 of the Facebook SDK for PHP here: [https://github +.com/facebook/facebook-php-sdk-v4](https://github +.com/facebook/facebook-php-sdk-v4) +Please use the new repository for new projects and contributions. +See the [Facebook Developers](https://developers.facebook.com/docs/php/) site + for documentation. + +----- + Facebook PHP SDK (v.3.2.3) The [Facebook Platform](http://developers.facebook.com/) is From b31c5a7911773a0684e89c7d1d84b0ca575e6cc8 Mon Sep 17 00:00:00 2001 From: Naitik Shah Date: Wed, 30 Apr 2014 21:58:13 -0700 Subject: [PATCH 6/8] fix link to new sdk repo --- readme.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 22f4cc59..e85bee89 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,6 @@ ### New SDK Released -We've released version 4 of the Facebook SDK for PHP here: [https://github -.com/facebook/facebook-php-sdk-v4](https://github -.com/facebook/facebook-php-sdk-v4) +We've released version 4 of the Facebook SDK for PHP here: [https://github.com/facebook/facebook-php-sdk-v4](https://github.com/facebook/facebook-php-sdk-v4) Please use the new repository for new projects and contributions. See the [Facebook Developers](https://developers.facebook.com/docs/php/) site for documentation. From 4821853f6ea4681e8acacfa1eee54f19e76fdb3e Mon Sep 17 00:00:00 2001 From: Stanislav Chistenko Date: Wed, 7 May 2014 13:55:10 +0700 Subject: [PATCH 7/8] Update example.php: remove getLoginStatusUrl usage --- examples/example.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/examples/example.php b/examples/example.php index 4c22fa96..cd0b378c 100644 --- a/examples/example.php +++ b/examples/example.php @@ -46,7 +46,6 @@ if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { - $statusUrl = $facebook->getLoginStatusUrl(); $loginUrl = $facebook->getLoginUrl(); } @@ -77,10 +76,6 @@ Logout -
- Check the login status using OAuth 2.0 handled by the PHP SDK: - Check the login status -
Login using OAuth 2.0 handled by the PHP SDK: Login with Facebook From 8e7e7951e99d86b68ce1135537d559663d759af0 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Tue, 13 Jan 2015 11:27:37 -0800 Subject: [PATCH 8/8] This SDK is deprecated. Use v4, see readme for link. --- examples/example.php | 5 +++++ readme.md | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/example.php b/examples/example.php index cd0b378c..645adf2b 100644 --- a/examples/example.php +++ b/examples/example.php @@ -1,4 +1,9 @@