Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Session Checking & Readme #55

Closed
wants to merge 5 commits into from

1 participant

Fosco Marotto
Deleted user

When having a session_start() in your own code the session_start() in facebook.php would fire again, which would result in sending the headers again. This gives warnings in the logs, this code fixes the if statement.

I also updated the readme file, it says 'require' which could better be changed to require_once to prevent multiple inclusions. It's small detail however..

Swen Kooij and others added some commits
Swen Kooij added require_once to prevent multiple inclusions. 098f9bb
Swen Kooij Fixed checking for active session
It was broken and did not work.
d287608
Swen Kooij Added useragent to config array in the construtor
You can now specify a custom useragent in the $config array in the constructor.
d6b3805
Swen Kooij Made $CURL_OPTS non-static 9adfc2d
Swen Kooij Updated readme.md
It's recommend to use require_once instead of require. To prevent
multiple inclusions.
e806a95
Fosco Marotto
Collaborator

Sorry it took this long to respond to this. We're tracking several issues to be corrected soon, many of which include the CURL options. I'm going to close this and it will be addressed along with some other issues in a future commit. Related PRs: 16, 18, 36, 52, and we'll look into the session_start issue as well. Thanks for your feedback.

Fosco Marotto gfosco closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 5 unique commits by 2 authors.

Dec 19, 2012
Swen Kooij added require_once to prevent multiple inclusions. 098f9bb
Swen Kooij Fixed checking for active session
It was broken and did not work.
d287608
Swen Kooij Added useragent to config array in the construtor
You can now specify a custom useragent in the $config array in the constructor.
d6b3805
Swen Kooij Made $CURL_OPTS non-static 9adfc2d
Swen Kooij Updated readme.md
It's recommend to use require_once instead of require. To prevent
multiple inclusions.
e806a95
This page is out of date. Refresh to see the latest.
BIN  .DS_Store
Binary file not shown
2  readme.md
Source Rendered
@@ -15,7 +15,7 @@ Usage
15 15 The [examples][examples] are a good place to start. The minimal you'll need to
16 16 have is:
17 17
18   - require 'facebook-php-sdk/src/facebook.php';
  18 + require_once 'facebook-php-sdk/src/facebook.php';
19 19
20 20 $facebook = new Facebook(array(
21 21 'appId' => 'YOUR_APP_ID',
12 src/base_facebook.php
@@ -130,7 +130,7 @@ public function __toString() {
130 130 /**
131 131 * Default options for curl.
132 132 */
133   - public static $CURL_OPTS = array(
  133 + public $CURL_OPTS = array(
134 134 CURLOPT_CONNECTTIMEOUT => 10,
135 135 CURLOPT_RETURNTRANSFER => true,
136 136 CURLOPT_TIMEOUT => 60,
@@ -150,7 +150,7 @@ public function __toString() {
150 150 /**
151 151 * Maps aliases to Facebook domains.
152 152 */
153   - public static $DOMAIN_MAP = array(
  153 + public $DOMAIN_MAP = array(
154 154 'api' => 'https://api.facebook.com/',
155 155 'api_video' => 'https://api-video.facebook.com/',
156 156 'api_read' => 'https://api-read.facebook.com/',
@@ -231,6 +231,14 @@ public function __construct($config) {
231 231 if (isset($config['trustForwarded']) && $config['trustForwarded']) {
232 232 $this->trustForwarded = true;
233 233 }
  234 + if(isset($config['useragent'])) {
  235 + $CURL_OPTS = array(
  236 + CURLOPT_CONNECTTIMEOUT => 10,
  237 + CURLOPT_RETURNTRANSFER => true,
  238 + CURLOPT_TIMEOUT => 60,
  239 + CURLOPT_USERAGENT => $config['useragent'],
  240 + );
  241 + }
234 242 $state = $this->getPersistentData('state');
235 243 if (!empty($state)) {
236 244 $this->state = $state;
2  src/facebook.php
@@ -45,7 +45,7 @@ class Facebook extends BaseFacebook
45 45 * @see BaseFacebook::__construct in facebook.php
46 46 */
47 47 public function __construct($config) {
48   - if (!session_id()) {
  48 + if (strlen(session_id()) > 1) {
49 49 session_start();
50 50 }
51 51 parent::__construct($config);

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.