Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Session Checking & Readme #55

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -15,7 +15,7 @@ Usage
The [examples][examples] are a good place to start. The minimal you'll need to
have is:

require 'facebook-php-sdk/src/facebook.php';
require_once 'facebook-php-sdk/src/facebook.php';

$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
Expand Down
12 changes: 10 additions & 2 deletions src/base_facebook.php
Expand Up @@ -130,7 +130,7 @@ abstract class BaseFacebook
/**
* Default options for curl.
*/
public static $CURL_OPTS = array(
public $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
Expand All @@ -150,7 +150,7 @@ abstract class BaseFacebook
/**
* Maps aliases to Facebook domains.
*/
public static $DOMAIN_MAP = array(
public $DOMAIN_MAP = array(
'api' => 'https://api.facebook.com/',
'api_video' => 'https://api-video.facebook.com/',
'api_read' => 'https://api-read.facebook.com/',
Expand Down Expand Up @@ -231,6 +231,14 @@ public function __construct($config) {
if (isset($config['trustForwarded']) && $config['trustForwarded']) {
$this->trustForwarded = true;
}
if(isset($config['useragent'])) {
$CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => $config['useragent'],
);
}
$state = $this->getPersistentData('state');
if (!empty($state)) {
$this->state = $state;
Expand Down
2 changes: 1 addition & 1 deletion src/facebook.php
Expand Up @@ -45,7 +45,7 @@ class Facebook extends BaseFacebook
* @see BaseFacebook::__construct in facebook.php
*/
public function __construct($config) {
if (!session_id()) {
if (strlen(session_id()) > 1) {
session_start();
}
parent::__construct($config);
Expand Down