Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -1,887 +1,93 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Patches (Matt Mecham - Invision Power Services - mmecham@invisionpower.com - May 2010)
|
||||
* - added verify peer for IIS/Windows CURL
|
||||
* - added non-curl fall back method in makeRequest
|
||||
*/
|
||||
|
||||
if (!function_exists('json_decode')) {
|
||||
throw new Exception('Facebook needs the JSON PHP extension.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown when an API call returns an exception.
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* @author Naitik Shah <naitik@facebook.com>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License. You may obtain
|
||||
* a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
class FacebookApiException extends Exception
|
||||
|
||||
require_once "base_facebook.php";/*noLibHook*/
|
||||
|
||||
/**
|
||||
* Extends the BaseFacebook class with the intent of using
|
||||
* PHP sessions to store user ids and access tokens.
|
||||
*/
|
||||
class Facebook extends BaseFacebook
|
||||
{
|
||||
/**
|
||||
* The result from the API server that represents the exception information.
|
||||
*/
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
* Make a new API Exception with the given result.
|
||||
* Identical to the parent constructor, except that
|
||||
* we start a PHP session to store the user ID and
|
||||
* access token if during the course of execution
|
||||
* we discover them.
|
||||
*
|
||||
* @param Array $result the result from the API server
|
||||
*/
|
||||
public function __construct($result) {
|
||||
$this->result = $result;
|
||||
|
||||
$code = isset($result['error_code']) ? $result['error_code'] : 0;
|
||||
$msg = isset($result['error'])
|
||||
? $result['error']['message'] : $result['error_msg'];
|
||||
parent::__construct($msg, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated result object returned by the API server.
|
||||
*
|
||||
* @returns Array the result from the API server
|
||||
*/
|
||||
public function getResult() {
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the associated type for the error. This will default to
|
||||
* 'Exception' when a type is not available.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getType() {
|
||||
return
|
||||
isset($this->result['error']) && isset($this->result['error']['type'])
|
||||
? $this->result['error']['type']
|
||||
: 'Exception';
|
||||
}
|
||||
|
||||
/**
|
||||
* To make debugging easier.
|
||||
*
|
||||
* @returns String the string representation of the error
|
||||
*/
|
||||
public function __toString() {
|
||||
$str = $this->getType() . ': ';
|
||||
if ($this->code != 0) {
|
||||
$str .= $this->code . ': ';
|
||||
}
|
||||
return $str . $this->message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides access to the Facebook Platform.
|
||||
*
|
||||
* @author Naitik Shah <naitik@facebook.com>
|
||||
*/
|
||||
class Facebook
|
||||
{
|
||||
/**
|
||||
* Version.
|
||||
*/
|
||||
const VERSION = '2.0.3';
|
||||
|
||||
/**
|
||||
* Default options for curl.
|
||||
*/
|
||||
public static $CURL_OPTS = array(
|
||||
CURLOPT_CONNECTTIMEOUT => 10,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
CURLOPT_USERAGENT => 'facebook-php-2.0',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of query parameters that get automatically dropped when rebuilding
|
||||
* the current URL.
|
||||
*/
|
||||
protected static $DROP_QUERY_PARAMS = array(
|
||||
'session',
|
||||
);
|
||||
|
||||
/**
|
||||
* Maps aliases to Facebook domains.
|
||||
*/
|
||||
public static $DOMAIN_MAP = array(
|
||||
'api' => 'https://api.facebook.com/',
|
||||
'api_read' => 'https://api-read.facebook.com/',
|
||||
'graph' => 'https://graph.facebook.com/',
|
||||
'www' => 'https://www.facebook.com/',
|
||||
);
|
||||
|
||||
/**
|
||||
* The Application ID.
|
||||
*/
|
||||
protected $appId;
|
||||
|
||||
/**
|
||||
* The Application API Secret.
|
||||
*/
|
||||
protected $apiSecret;
|
||||
|
||||
/**
|
||||
* The active user session, if one is available.
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* Indicates that we already loaded the session as best as we could.
|
||||
*/
|
||||
protected $sessionLoaded = false;
|
||||
|
||||
/**
|
||||
* Indicates if Cookie support should be enabled.
|
||||
*/
|
||||
protected $cookieSupport = false;
|
||||
|
||||
/**
|
||||
* Base domain for the Cookie.
|
||||
*/
|
||||
protected $baseDomain = '';
|
||||
|
||||
/**
|
||||
* Initialize a Facebook Application.
|
||||
*
|
||||
* The configuration:
|
||||
* - appId: the application ID
|
||||
* - secret: the application secret
|
||||
* - cookie: (optional) boolean true to enable cookie support
|
||||
* - domain: (optional) domain for the cookie
|
||||
*
|
||||
* @param Array $config the application configuration
|
||||
* @param Array $config the application configuration.
|
||||
* @see BaseFacebook::__construct in facebook.php
|
||||
*/
|
||||
public function __construct($config) {
|
||||
$this->setAppId($config['appId']);
|
||||
$this->setApiSecret($config['secret']);
|
||||
if (isset($config['cookie'])) {
|
||||
$this->setCookieSupport($config['cookie']);
|
||||
}
|
||||
if (isset($config['domain'])) {
|
||||
$this->setBaseDomain($config['domain']);
|
||||
if (!session_id()) {
|
||||
session_start();
|
||||
}
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Application ID.
|
||||
*
|
||||
* @param String $appId the Application ID
|
||||
*/
|
||||
public function setAppId($appId) {
|
||||
$this->appId = $appId;
|
||||
return $this;
|
||||
}
|
||||
protected static $kSupportedKeys =
|
||||
array('state', 'code', 'access_token', 'user_id');
|
||||
|
||||
/**
|
||||
* Get the Application ID.
|
||||
*
|
||||
* @return String the Application ID
|
||||
* Provides the implementations of the inherited abstract
|
||||
* methods. The implementation uses PHP sessions to maintain
|
||||
* a store for authorization codes, user ids, CSRF states, and
|
||||
* access tokens.
|
||||
*/
|
||||
public function getAppId() {
|
||||
return $this->appId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API Secret.
|
||||
*
|
||||
* @param String $appId the API Secret
|
||||
*/
|
||||
public function setApiSecret($apiSecret) {
|
||||
$this->apiSecret = $apiSecret;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API Secret.
|
||||
*
|
||||
* @return String the API Secret
|
||||
*/
|
||||
public function getApiSecret() {
|
||||
return $this->apiSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Cookie Support status.
|
||||
*
|
||||
* @param Boolean $cookieSupport the Cookie Support status
|
||||
*/
|
||||
public function setCookieSupport($cookieSupport) {
|
||||
$this->cookieSupport = $cookieSupport;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Cookie Support status.
|
||||
*
|
||||
* @return Boolean the Cookie Support status
|
||||
*/
|
||||
public function useCookieSupport() {
|
||||
return $this->cookieSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base domain for the Cookie.
|
||||
*
|
||||
* @param String $domain the base domain
|
||||
*/
|
||||
public function setBaseDomain($domain) {
|
||||
$this->baseDomain = $domain;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base domain for the Cookie.
|
||||
*
|
||||
* @return String the base domain
|
||||
*/
|
||||
public function getBaseDomain() {
|
||||
return $this->baseDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Session.
|
||||
*
|
||||
* @param Array $session the session
|
||||
* @param Boolean $write_cookie indicate if a cookie should be written. this
|
||||
* value is ignored if cookie support has been disabled.
|
||||
*/
|
||||
public function setSession($session=null, $write_cookie=true) {
|
||||
$session = $this->validateSessionObject($session);
|
||||
$this->sessionLoaded = true;
|
||||
$this->session = $session;
|
||||
if ($write_cookie) {
|
||||
$this->setCookieFromSession($session);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the session object. This will automatically look for a signed session
|
||||
* sent via the Cookie or Query Parameters if needed.
|
||||
*
|
||||
* @return Array the session
|
||||
*/
|
||||
public function getSession() {
|
||||
if (!$this->sessionLoaded) {
|
||||
$session = null;
|
||||
$write_cookie = true;
|
||||
|
||||
// try loading session from $_REQUEST
|
||||
if (isset($_REQUEST['session'])) {
|
||||
$session = json_decode(
|
||||
get_magic_quotes_gpc()
|
||||
? stripslashes($_REQUEST['session'])
|
||||
: $_REQUEST['session'],
|
||||
true
|
||||
);
|
||||
$session = $this->validateSessionObject($session);
|
||||
}
|
||||
|
||||
// try loading session from cookie if necessary
|
||||
if (!$session && $this->useCookieSupport()) {
|
||||
$cookieName = $this->getSessionCookieName();
|
||||
if (isset($_COOKIE[$cookieName])) {
|
||||
$session = array();
|
||||
parse_str(trim(
|
||||
get_magic_quotes_gpc()
|
||||
? stripslashes($_COOKIE[$cookieName])
|
||||
: $_COOKIE[$cookieName],
|
||||
'"'
|
||||
), $session);
|
||||
$session = $this->validateSessionObject($session);
|
||||
// write only if we need to delete a invalid session cookie
|
||||
$write_cookie = empty($session);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setSession($session, $write_cookie);
|
||||
}
|
||||
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UID from the session.
|
||||
*
|
||||
* @return String the UID if available
|
||||
*/
|
||||
public function getUser() {
|
||||
$session = $this->getSession();
|
||||
return $session ? $session['uid'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Login URL for use with redirects. By default, full page redirect is
|
||||
* assumed. If you are using the generated URL with a window.open() call in
|
||||
* JavaScript, you can pass in display=popup as part of the $params.
|
||||
*
|
||||
* The parameters:
|
||||
* - next: the url to go to after a successful login
|
||||
* - cancel_url: the url to go to after the user cancels
|
||||
* - req_perms: comma separated list of requested extended perms
|
||||
* - display: can be "page" (default, full page) or "popup"
|
||||
*
|
||||
* @param Array $params provide custom parameters
|
||||
* @return String the URL for the login flow
|
||||
*/
|
||||
public function getLoginUrl($params=array()) {
|
||||
$currentUrl = $this->getCurrentUrl();
|
||||
return $this->getUrl(
|
||||
'www',
|
||||
'login.php',
|
||||
array_merge(array(
|
||||
'api_key' => $this->getAppId(),
|
||||
'cancel_url' => $currentUrl,
|
||||
'display' => 'page',
|
||||
'fbconnect' => 1,
|
||||
'next' => $currentUrl,
|
||||
'return_session' => 1,
|
||||
'session_version' => 3,
|
||||
'v' => '1.0',
|
||||
), $params)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Logout URL suitable for use with redirects.
|
||||
*
|
||||
* The parameters:
|
||||
* - next: the url to go to after a successful logout
|
||||
*
|
||||
* @param Array $params provide custom parameters
|
||||
* @return String the URL for the logout flow
|
||||
*/
|
||||
public function getLogoutUrl($params=array()) {
|
||||
$session = $this->getSession();
|
||||
return $this->getUrl(
|
||||
'www',
|
||||
'logout.php',
|
||||
array_merge(array(
|
||||
'api_key' => $this->getAppId(),
|
||||
'next' => $this->getCurrentUrl(),
|
||||
'session_key' => $session['session_key'],
|
||||
), $params)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a login status URL to fetch the status from facebook.
|
||||
*
|
||||
* The parameters:
|
||||
* - ok_session: the URL to go to if a session is found
|
||||
* - no_session: the URL to go to if the user is not connected
|
||||
* - no_user: the URL to go to if the user is not signed into facebook
|
||||
*
|
||||
* @param Array $params provide custom parameters
|
||||
* @return String the URL for the logout flow
|
||||
*/
|
||||
public function getLoginStatusUrl($params=array()) {
|
||||
return $this->getUrl(
|
||||
'www',
|
||||
'extern/login_status.php',
|
||||
array_merge(array(
|
||||
'api_key' => $this->getAppId(),
|
||||
'no_session' => $this->getCurrentUrl(),
|
||||
'no_user' => $this->getCurrentUrl(),
|
||||
'ok_session' => $this->getCurrentUrl(),
|
||||
'session_version' => 3,
|
||||
), $params)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an API call.
|
||||
*
|
||||
* @param Array $params the API call parameters
|
||||
* @return the decoded response
|
||||
*/
|
||||
public function api(/* polymorphic */) {
|
||||
$args = func_get_args();
|
||||
if (is_array($args[0])) {
|
||||
return $this->_restserver($args[0]);
|
||||
} else {
|
||||
return call_user_func_array(array($this, '_graph'), $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the old restserver.php endpoint.
|
||||
*
|
||||
* @param Array $params method call object
|
||||
* @return the decoded response object
|
||||
* @throws FacebookApiException
|
||||
*/
|
||||
protected function _restserver($params) {
|
||||
// generic application level parameters
|
||||
$params['api_key'] = $this->getAppId();
|
||||
$params['format'] = 'json-strings';
|
||||
|
||||
$result = json_decode($this->_oauthRequest(
|
||||
$this->getApiUrl($params['method']),
|
||||
$params
|
||||
), true);
|
||||
|
||||
// results are returned, errors are thrown
|
||||
if (is_array($result) && isset($result['error_code'])) {
|
||||
throw new FacebookApiException($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the Graph API.
|
||||
*
|
||||
* @param String $path the path (required)
|
||||
* @param String $method the http method (default 'GET')
|
||||
* @param Array $params the query/post data
|
||||
* @return the decoded response object
|
||||
* @throws FacebookApiException
|
||||
*/
|
||||
protected function _graph($path, $method='GET', $params=array()) {
|
||||
if (is_array($method) && empty($params)) {
|
||||
$params = $method;
|
||||
$method = 'GET';
|
||||
}
|
||||
$params['method'] = $method; // method override as we always do a POST
|
||||
|
||||
$result = json_decode($this->_oauthRequest(
|
||||
$this->getUrl('graph', $path),
|
||||
$params
|
||||
), true);
|
||||
|
||||
// results are returned, errors are thrown
|
||||
if (is_array($result) && isset($result['error'])) {
|
||||
$e = new FacebookApiException($result);
|
||||
if ($e->getType() === 'OAuthException') {
|
||||
$this->setSession(null);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a OAuth Request
|
||||
*
|
||||
* @param String $path the path (required)
|
||||
* @param Array $params the query/post data
|
||||
* @return the decoded response object
|
||||
* @throws FacebookApiException
|
||||
*/
|
||||
protected function _oauthRequest($url, $params) {
|
||||
if (!isset($params['access_token'])) {
|
||||
$session = $this->getSession();
|
||||
// either user session signed, or app signed
|
||||
if ($session) {
|
||||
$params['access_token'] = $session['access_token'];
|
||||
} else {
|
||||
$params['access_token'] = $this->getAppId() .'|'. $this->getApiSecret();
|
||||
}
|
||||
}
|
||||
|
||||
// json_encode all params values that are not strings
|
||||
foreach ($params as $key => $value) {
|
||||
if (!is_string($value)) {
|
||||
$params[$key] = json_encode($value);
|
||||
}
|
||||
}
|
||||
return $this->makeRequest($url, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an HTTP request. This method can be overriden by subclasses if
|
||||
* developers want to do fancier things or use something other than curl to
|
||||
* make the request.
|
||||
*
|
||||
* @param String $url the URL to make the request to
|
||||
* @param Array $params the parameters to use for the POST body
|
||||
* @param CurlHandler $ch optional initialized curl handle
|
||||
* @return String the response text
|
||||
*/
|
||||
protected function makeRequest($url, $params, $ch=null) {
|
||||
if ( function_exists( 'curl_init' ) AND function_exists("curl_exec") AND function_exists('curl_setopt_array') )
|
||||
{
|
||||
if (!$ch) {
|
||||
$ch = curl_init();
|
||||
}
|
||||
$opts = self::$CURL_OPTS;
|
||||
$opts[CURLOPT_POSTFIELDS] = $params;
|
||||
$opts[CURLOPT_URL] = $url;
|
||||
|
||||
// stops cURL from doing a Expect: 100-continue
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
curl_setopt_array($ch, $opts);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
|
||||
if (curl_errno($ch) == 60 || curl_errno( $ch ) == 77)
|
||||
{ // CURLE_SSL_CACERT
|
||||
if ( defined('CA_BUNDLE_PATH') )
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_CAINFO, CA_BUNDLE_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
}
|
||||
|
||||
$result = curl_exec($ch);
|
||||
}
|
||||
// name lookup timed out / DNS issues
|
||||
else if ( curl_errno( $ch ) == 6 )
|
||||
{
|
||||
$url_parts = @parse_url($url);
|
||||
$ip = @gethostbyname( $url_parts['host'] );
|
||||
|
||||
if ( $ip and preg_match( "#^\d{1,3}\.#", $ip ) )
|
||||
{
|
||||
// Turn of verify SSL as the IP will not match domain of cert
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_URL, $url_parts['scheme'] . '://' . $ip . '/' . $url_parts['path'] );
|
||||
$result = curl_exec($ch);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === false)
|
||||
{
|
||||
$e = new FacebookApiException(array(
|
||||
'error_code' => curl_errno($ch),
|
||||
'error' => array(
|
||||
'message' => curl_error($ch),
|
||||
'type' => 'CurlException',
|
||||
),
|
||||
));
|
||||
curl_close($ch);
|
||||
throw $e;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_parts = @parse_url($url);
|
||||
$postfields = http_build_query( $params );
|
||||
|
||||
if ( ! $postfields )
|
||||
{
|
||||
$postfields = $url_parts['query'];
|
||||
}
|
||||
|
||||
$postfields = str_replace( '&', '&', $postfields );
|
||||
|
||||
/* Use SSL rather than https */
|
||||
$url_parts['scheme'] = ( $url_parts['scheme'] == 'https' ) ? 'ssl' : $url_parts['scheme'];
|
||||
|
||||
$host = $url_parts['scheme'] . '://' . $url_parts['host'];
|
||||
$port = ( isset($url_parts['port']) ) ? $url_parts['port'] : ( $url_parts['scheme'] == 'https' || $url_parts['scheme'] == 'ssl' ? 443 : 80 );
|
||||
|
||||
if ( !empty( $url_parts["path"] ) )
|
||||
{
|
||||
$path = $url_parts["path"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = "/";
|
||||
}
|
||||
|
||||
$header = "POST {$path} HTTP/1.0\r\n";
|
||||
$header .= "Host: " . str_replace( array( 'http://', 'https://', 'ssl://' ), '', $host ) . "\r\n";
|
||||
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
$header .= "Content-Length: " . strlen($postfields) . "\r\n\r\n";
|
||||
|
||||
if ( $fp = fsockopen( $host, $port, $errno, $errstr, 60 ) )
|
||||
{
|
||||
socket_set_timeout($fp, 60);
|
||||
|
||||
fwrite($fp, $header . $postfields);
|
||||
|
||||
while( ! feof($fp) && ! $status['timed_out'] )
|
||||
{
|
||||
$data .= fgets ($fp,8192);
|
||||
$status = stream_get_meta_data($fp);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/* Strip headers HTTP/1.1 ### ABCD */
|
||||
$httpCode = substr( $data, 9, 3 );
|
||||
$lastApiCall = $url;
|
||||
|
||||
/* Chuncked? */
|
||||
|
||||
$_chunked = false;
|
||||
|
||||
if( preg_match( "/Transfer\-Encoding:\s*chunked/i", $data ) )
|
||||
{
|
||||
$_chunked = true;
|
||||
}
|
||||
|
||||
$tmp = explode("\r\n\r\n", $data, 2);
|
||||
$data = trim($tmp[1]);
|
||||
|
||||
if ( $_chunked )
|
||||
{
|
||||
$lines = explode( "\n", $data );
|
||||
array_pop($lines);
|
||||
array_shift($lines);
|
||||
$data = implode( "\n", $lines );
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the Cookie that contains the session.
|
||||
*
|
||||
* @return String the cookie name
|
||||
*/
|
||||
protected function getSessionCookieName() {
|
||||
return 'fbs_' . $this->getAppId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a JS Cookie based on the _passed in_ session. It does not use the
|
||||
* currently stored session -- you need to explicitly pass it in.
|
||||
*
|
||||
* @param Array $session the session to use for setting the cookie
|
||||
*/
|
||||
protected function setCookieFromSession($session=null) {
|
||||
if (!$this->useCookieSupport()) {
|
||||
protected function setPersistentData($key, $value) {
|
||||
if (!in_array($key, self::$kSupportedKeys)) {
|
||||
self::errorLog('Unsupported key passed to setPersistentData.');
|
||||
return;
|
||||
}
|
||||
|
||||
$cookieName = $this->getSessionCookieName();
|
||||
$value = 'deleted';
|
||||
$expires = time() - 3600;
|
||||
$domain = $this->getBaseDomain();
|
||||
if ($session) {
|
||||
$value = '"' . http_build_query($session, null, '&') . '"';
|
||||
if (isset($session['base_domain'])) {
|
||||
$domain = $session['base_domain'];
|
||||
}
|
||||
$expires = $session['expires'];
|
||||
$session_var_name = $this->constructSessionVariableName($key);
|
||||
$_SESSION[$session_var_name] = $value;
|
||||
}
|
||||
|
||||
protected function getPersistentData($key, $default = false) {
|
||||
if (!in_array($key, self::$kSupportedKeys)) {
|
||||
self::errorLog('Unsupported key passed to getPersistentData.');
|
||||
return $default;
|
||||
}
|
||||
|
||||
// prepend dot if a domain is found
|
||||
if ($domain) {
|
||||
$domain = '.' . $domain;
|
||||
}
|
||||
$session_var_name = $this->constructSessionVariableName($key);
|
||||
return isset($_SESSION[$session_var_name]) ?
|
||||
$_SESSION[$session_var_name] : $default;
|
||||
}
|
||||
|
||||
// if an existing cookie is not set, we dont need to delete it
|
||||
if ($value == 'deleted' && empty($_COOKIE[$cookieName])) {
|
||||
protected function clearPersistentData($key) {
|
||||
if (!in_array($key, self::$kSupportedKeys)) {
|
||||
self::errorLog('Unsupported key passed to clearPersistentData.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (headers_sent()) {
|
||||
// disable error log if we are running in a CLI environment
|
||||
// @codeCoverageIgnoreStart
|
||||
if (php_sapi_name() != 'cli') {
|
||||
error_log('Could not set cookie. Headers already sent.');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
// ignore for code coverage as we will never be able to setcookie in a CLI
|
||||
// environment
|
||||
// @codeCoverageIgnoreStart
|
||||
} else {
|
||||
setcookie($cookieName, $value, $expires, '/', $domain);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
$session_var_name = $this->constructSessionVariableName($key);
|
||||
unset($_SESSION[$session_var_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a session_version=3 style session object.
|
||||
*
|
||||
* @param Array $session the session object
|
||||
* @return Array the session object if it validates, null otherwise
|
||||
*/
|
||||
protected function validateSessionObject($session) {
|
||||
// make sure some essential fields exist
|
||||
if (is_array($session) &&
|
||||
isset($session['uid']) &&
|
||||
isset($session['session_key']) &&
|
||||
isset($session['secret']) &&
|
||||
isset($session['access_token']) &&
|
||||
isset($session['sig'])) {
|
||||
// validate the signature
|
||||
$session_without_sig = $session;
|
||||
unset($session_without_sig['sig']);
|
||||
$expected_sig = self::generateSignature(
|
||||
$session_without_sig,
|
||||
$this->getApiSecret()
|
||||
);
|
||||
if ($session['sig'] != $expected_sig) {
|
||||
// disable error log if we are running in a CLI environment
|
||||
// @codeCoverageIgnoreStart
|
||||
if (php_sapi_name() != 'cli') {
|
||||
error_log('Got invalid session signature in cookie.');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
$session = null;
|
||||
}
|
||||
// check expiry time
|
||||
} else {
|
||||
$session = null;
|
||||
protected function clearAllPersistentData() {
|
||||
foreach (self::$kSupportedKeys as $key) {
|
||||
$this->clearPersistentData($key);
|
||||
}
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the URL for api given parameters.
|
||||
*
|
||||
* @param $method String the method name.
|
||||
* @return String the URL for the given parameters
|
||||
*/
|
||||
protected function getApiUrl($method) {
|
||||
static $READ_ONLY_CALLS =
|
||||
array('admin.getallocation' => 1,
|
||||
'admin.getappproperties' => 1,
|
||||
'admin.getbannedusers' => 1,
|
||||
'admin.getlivestreamvialink' => 1,
|
||||
'admin.getmetrics' => 1,
|
||||
'admin.getrestrictioninfo' => 1,
|
||||
'application.getpublicinfo' => 1,
|
||||
'auth.getapppublickey' => 1,
|
||||
'auth.getsession' => 1,
|
||||
'auth.getsignedpublicsessiondata' => 1,
|
||||
'comments.get' => 1,
|
||||
'connect.getunconnectedfriendscount' => 1,
|
||||
'dashboard.getactivity' => 1,
|
||||
'dashboard.getcount' => 1,
|
||||
'dashboard.getglobalnews' => 1,
|
||||
'dashboard.getnews' => 1,
|
||||
'dashboard.multigetcount' => 1,
|
||||
'dashboard.multigetnews' => 1,
|
||||
'data.getcookies' => 1,
|
||||
'events.get' => 1,
|
||||
'events.getmembers' => 1,
|
||||
'fbml.getcustomtags' => 1,
|
||||
'feed.getappfriendstories' => 1,
|
||||
'feed.getregisteredtemplatebundlebyid' => 1,
|
||||
'feed.getregisteredtemplatebundles' => 1,
|
||||
'fql.multiquery' => 1,
|
||||
'fql.query' => 1,
|
||||
'friends.arefriends' => 1,
|
||||
'friends.get' => 1,
|
||||
'friends.getappusers' => 1,
|
||||
'friends.getlists' => 1,
|
||||
'friends.getmutualfriends' => 1,
|
||||
'gifts.get' => 1,
|
||||
'groups.get' => 1,
|
||||
'groups.getmembers' => 1,
|
||||
'intl.gettranslations' => 1,
|
||||
'links.get' => 1,
|
||||
'notes.get' => 1,
|
||||
'notifications.get' => 1,
|
||||
'pages.getinfo' => 1,
|
||||
'pages.isadmin' => 1,
|
||||
'pages.isappadded' => 1,
|
||||
'pages.isfan' => 1,
|
||||
'permissions.checkavailableapiaccess' => 1,
|
||||
'permissions.checkgrantedapiaccess' => 1,
|
||||
'photos.get' => 1,
|
||||
'photos.getalbums' => 1,
|
||||
'photos.gettags' => 1,
|
||||
'profile.getinfo' => 1,
|
||||
'profile.getinfooptions' => 1,
|
||||
'stream.get' => 1,
|
||||
'stream.getcomments' => 1,
|
||||
'stream.getfilters' => 1,
|
||||
'users.getinfo' => 1,
|
||||
'users.getloggedinuser' => 1,
|
||||
'users.getstandardinfo' => 1,
|
||||
'users.hasapppermission' => 1,
|
||||
'users.isappuser' => 1,
|
||||
'users.isverified' => 1,
|
||||
'video.getuploadlimits' => 1);
|
||||
$name = 'api';
|
||||
if (isset($READ_ONLY_CALLS[strtolower($method)])) {
|
||||
$name = 'api_read';
|
||||
}
|
||||
return self::getUrl($name, 'restserver.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the URL for given domain alias, path and parameters.
|
||||
*
|
||||
* @param $name String the name of the domain
|
||||
* @param $path String optional path (without a leading slash)
|
||||
* @param $params Array optional query parameters
|
||||
* @return String the URL for the given parameters
|
||||
*/
|
||||
protected function getUrl($name, $path='', $params=array()) {
|
||||
$url = self::$DOMAIN_MAP[$name];
|
||||
if ($path) {
|
||||
if ($path[0] === '/') {
|
||||
$path = substr($path, 1);
|
||||
}
|
||||
$url .= $path;
|
||||
}
|
||||
if ($params) {
|
||||
$url .= '?' . http_build_query($params);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Current URL, stripping it of known FB parameters that should
|
||||
* not persist.
|
||||
*
|
||||
* @return String the current URL
|
||||
*/
|
||||
protected function getCurrentUrl() {
|
||||
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
|
||||
? 'https://'
|
||||
: 'http://';
|
||||
$currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$parts = parse_url($currentUrl);
|
||||
|
||||
// drop known fb params
|
||||
$query = '';
|
||||
if (!empty($parts['query'])) {
|
||||
$params = array();
|
||||
parse_str($parts['query'], $params);
|
||||
foreach(self::$DROP_QUERY_PARAMS as $key) {
|
||||
unset($params[$key]);
|
||||
}
|
||||
if (!empty($params)) {
|
||||
$query = '?' . http_build_query($params);
|
||||
}
|
||||
}
|
||||
|
||||
// use port if non default
|
||||
$port =
|
||||
isset($parts['port']) &&
|
||||
(($protocol === 'http://' && $parts['port'] !== 80) ||
|
||||
($protocol === 'https://' && $parts['port'] !== 443))
|
||||
? ':' . $parts['port'] : '';
|
||||
|
||||
// rebuild
|
||||
return $protocol . $parts['host'] . $port . $parts['path'] . $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a signature for the given params and secret.
|
||||
*
|
||||
* @param Array $params the parameters to sign
|
||||
* @param String $secret the secret to sign with
|
||||
* @return String the generated signature
|
||||
*/
|
||||
protected static function generateSignature($params, $secret) {
|
||||
// work with sorted data
|
||||
ksort($params);
|
||||
|
||||
// generate the base string
|
||||
$base_string = '';
|
||||
foreach($params as $key => $value) {
|
||||
$base_string .= $key . '=' . $value;
|
||||
}
|
||||
$base_string .= $secret;
|
||||
|
||||
return md5($base_string);
|
||||
protected function constructSessionVariableName($key) {
|
||||
return implode('_', array('fb',
|
||||
$this->getAppId(),
|
||||
$key));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,887 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Patches (Matt Mecham - Invision Power Services - May 2010)
|
||||
* - added verify peer for IIS/Windows CURL
|
||||
* - added non-curl fall back method in makeRequest
|
||||
*/
|
||||
|
||||
if (!function_exists('json_decode')) {
|
||||
throw new Exception('Facebook needs the JSON PHP extension.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Thrown when an API call returns an exception.
|
||||
*
|
||||
* @author Naitik Shah <naitik@facebook.com>
|
||||
*/
|
||||
class FacebookApiException extends Exception
|
||||
{
|
||||
/**
|
||||
* The result from the API server that represents the exception information.
|
||||
*/
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
* Make a new API Exception with the given result.
|
||||
*
|
||||
* @param Array $result the result from the API server
|
||||
*/
|
||||
public function __construct($result) {
|
||||
$this->result = $result;
|
||||
|
||||
$code = isset($result['error_code']) ? $result['error_code'] : 0;
|
||||
$msg = isset($result['error'])
|
||||
? $result['error']['message'] : $result['error_msg'];
|
||||
parent::__construct($msg, $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated result object returned by the API server.
|
||||
*
|
||||
* @returns Array the result from the API server
|
||||
*/
|
||||
public function getResult() {
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the associated type for the error. This will default to
|
||||
* 'Exception' when a type is not available.
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getType() {
|
||||
return
|
||||
isset($this->result['error']) && isset($this->result['error']['type'])
|
||||
? $this->result['error']['type']
|
||||
: 'Exception';
|
||||
}
|
||||
|
||||
/**
|
||||
* To make debugging easier.
|
||||
*
|
||||
* @returns String the string representation of the error
|
||||
*/
|
||||
public function __toString() {
|
||||
$str = $this->getType() . ': ';
|
||||
if ($this->code != 0) {
|
||||
$str .= $this->code . ': ';
|
||||
}
|
||||
return $str . $this->message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides access to the Facebook Platform.
|
||||
*
|
||||
* @author Naitik Shah <naitik@facebook.com>
|
||||
*/
|
||||
class Facebook
|
||||
{
|
||||
/**
|
||||
* Version.
|
||||
*/
|
||||
const VERSION = '2.0.3';
|
||||
|
||||
/**
|
||||
* Default options for curl.
|
||||
*/
|
||||
public static $CURL_OPTS = array(
|
||||
CURLOPT_CONNECTTIMEOUT => 10,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
CURLOPT_USERAGENT => 'facebook-php-2.0',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of query parameters that get automatically dropped when rebuilding
|
||||
* the current URL.
|
||||
*/
|
||||
protected static $DROP_QUERY_PARAMS = array(
|
||||
'session',
|
||||
);
|
||||
|
||||
/**
|
||||
* Maps aliases to Facebook domains.
|
||||
*/
|
||||
public static $DOMAIN_MAP = array(
|
||||
'api' => 'https://api.facebook.com/',
|
||||
'api_read' => 'https://api-read.facebook.com/',
|
||||
'graph' => 'https://graph.facebook.com/',
|
||||
'www' => 'https://www.facebook.com/',
|
||||
);
|
||||
|
||||
/**
|
||||
* The Application ID.
|
||||
*/
|
||||
protected $appId;
|
||||
|
||||
/**
|
||||
* The Application API Secret.
|
||||
*/
|
||||
protected $apiSecret;
|
||||
|
||||
/**
|
||||
* The active user session, if one is available.
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* Indicates that we already loaded the session as best as we could.
|
||||
*/
|
||||
protected $sessionLoaded = false;
|
||||
|
||||
/**
|
||||
* Indicates if Cookie support should be enabled.
|
||||
*/
|
||||
protected $cookieSupport = false;
|
||||
|
||||
/**
|
||||
* Base domain for the Cookie.
|
||||
*/
|
||||
protected $baseDomain = '';
|
||||
|
||||
/**
|
||||
* Initialize a Facebook Application.
|
||||
*
|
||||
* The configuration:
|
||||
* - appId: the application ID
|
||||
* - secret: the application secret
|
||||
* - cookie: (optional) boolean true to enable cookie support
|
||||
* - domain: (optional) domain for the cookie
|
||||
*
|
||||
* @param Array $config the application configuration
|
||||
*/
|
||||
public function __construct($config) {
|
||||
$this->setAppId($config['appId']);
|
||||
$this->setApiSecret($config['secret']);
|
||||
if (isset($config['cookie'])) {
|
||||
$this->setCookieSupport($config['cookie']);
|
||||
}
|
||||
if (isset($config['domain'])) {
|
||||
$this->setBaseDomain($config['domain']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Application ID.
|
||||
*
|
||||
* @param String $appId the Application ID
|
||||
*/
|
||||
public function setAppId($appId) {
|
||||
$this->appId = $appId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Application ID.
|
||||
*
|
||||
* @return String the Application ID
|
||||
*/
|
||||
public function getAppId() {
|
||||
return $this->appId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the API Secret.
|
||||
*
|
||||
* @param String $appId the API Secret
|
||||
*/
|
||||
public function setApiSecret($apiSecret) {
|
||||
$this->apiSecret = $apiSecret;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the API Secret.
|
||||
*
|
||||
* @return String the API Secret
|
||||
*/
|
||||
public function getApiSecret() {
|
||||
return $this->apiSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Cookie Support status.
|
||||
*
|
||||
* @param Boolean $cookieSupport the Cookie Support status
|
||||
*/
|
||||
public function setCookieSupport($cookieSupport) {
|
||||
$this->cookieSupport = $cookieSupport;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Cookie Support status.
|
||||
*
|
||||
* @return Boolean the Cookie Support status
|
||||
*/
|
||||
public function useCookieSupport() {
|
||||
return $this->cookieSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the base domain for the Cookie.
|
||||
*
|
||||
* @param String $domain the base domain
|
||||
*/
|
||||
public function setBaseDomain($domain) {
|
||||
$this->baseDomain = $domain;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base domain for the Cookie.
|
||||
*
|
||||
* @return String the base domain
|
||||
*/
|
||||
public function getBaseDomain() {
|
||||
return $this->baseDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Session.
|
||||
*
|
||||
* @param Array $session the session
|
||||
* @param Boolean $write_cookie indicate if a cookie should be written. this
|
||||
* value is ignored if cookie support has been disabled.
|
||||
*/
|
||||
public function setSession($session=null, $write_cookie=true) {
|
||||
$session = $this->validateSessionObject($session);
|
||||
$this->sessionLoaded = true;
|
||||
$this->session = $session;
|
||||
if ($write_cookie) {
|
||||
$this->setCookieFromSession($session);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the session object. This will automatically look for a signed session
|
||||
* sent via the Cookie or Query Parameters if needed.
|
||||
*
|
||||
* @return Array the session
|
||||
*/
|
||||
public function getSession() {
|
||||
if (!$this->sessionLoaded) {
|
||||
$session = null;
|
||||
$write_cookie = true;
|
||||
|
||||
// try loading session from $_REQUEST
|
||||
if (isset($_REQUEST['session'])) {
|
||||
$session = json_decode(
|
||||
get_magic_quotes_gpc()
|
||||
? stripslashes($_REQUEST['session'])
|
||||
: $_REQUEST['session'],
|
||||
true
|
||||
);
|
||||
$session = $this->validateSessionObject($session);
|
||||
}
|
||||
|
||||
// try loading session from cookie if necessary
|
||||
if (!$session && $this->useCookieSupport()) {
|
||||
$cookieName = $this->getSessionCookieName();
|
||||
if (isset($_COOKIE[$cookieName])) {
|
||||
$session = array();
|
||||
parse_str(trim(
|
||||
get_magic_quotes_gpc()
|
||||
? stripslashes($_COOKIE[$cookieName])
|
||||
: $_COOKIE[$cookieName],
|
||||
'"'
|
||||
), $session);
|
||||
$session = $this->validateSessionObject($session);
|
||||
// write only if we need to delete a invalid session cookie
|
||||
$write_cookie = empty($session);
|
||||
}
|
||||
}
|
||||
|
||||
$this->setSession($session, $write_cookie);
|
||||
}
|
||||
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UID from the session.
|
||||
*
|
||||
* @return String the UID if available
|
||||
*/
|
||||
public function getUser() {
|
||||
$session = $this->getSession();
|
||||
return $session ? $session['uid'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Login URL for use with redirects. By default, full page redirect is
|
||||
* assumed. If you are using the generated URL with a window.open() call in
|
||||
* JavaScript, you can pass in display=popup as part of the $params.
|
||||
*
|
||||
* The parameters:
|
||||
* - next: the url to go to after a successful login
|
||||
* - cancel_url: the url to go to after the user cancels
|
||||
* - req_perms: comma separated list of requested extended perms
|
||||
* - display: can be "page" (default, full page) or "popup"
|
||||
*
|
||||
* @param Array $params provide custom parameters
|
||||
* @return String the URL for the login flow
|
||||
*/
|
||||
public function getLoginUrl($params=array()) {
|
||||
$currentUrl = $this->getCurrentUrl();
|
||||
return $this->getUrl(
|
||||
'www',
|
||||
'login.php',
|
||||
array_merge(array(
|
||||
'api_key' => $this->getAppId(),
|
||||
'cancel_url' => $currentUrl,
|
||||
'display' => 'page',
|
||||
'fbconnect' => 1,
|
||||
'next' => $currentUrl,
|
||||
'return_session' => 1,
|
||||
'session_version' => 3,
|
||||
'v' => '1.0',
|
||||
), $params)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Logout URL suitable for use with redirects.
|
||||
*
|
||||
* The parameters:
|
||||
* - next: the url to go to after a successful logout
|
||||
*
|
||||
* @param Array $params provide custom parameters
|
||||
* @return String the URL for the logout flow
|
||||
*/
|
||||
public function getLogoutUrl($params=array()) {
|
||||
$session = $this->getSession();
|
||||
return $this->getUrl(
|
||||
'www',
|
||||
'logout.php',
|
||||
array_merge(array(
|
||||
'api_key' => $this->getAppId(),
|
||||
'next' => $this->getCurrentUrl(),
|
||||
'session_key' => $session['session_key'],
|
||||
), $params)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a login status URL to fetch the status from facebook.
|
||||
*
|
||||
* The parameters:
|
||||
* - ok_session: the URL to go to if a session is found
|
||||
* - no_session: the URL to go to if the user is not connected
|
||||
* - no_user: the URL to go to if the user is not signed into facebook
|
||||
*
|
||||
* @param Array $params provide custom parameters
|
||||
* @return String the URL for the logout flow
|
||||
*/
|
||||
public function getLoginStatusUrl($params=array()) {
|
||||
return $this->getUrl(
|
||||
'www',
|
||||
'extern/login_status.php',
|
||||
array_merge(array(
|
||||
'api_key' => $this->getAppId(),
|
||||
'no_session' => $this->getCurrentUrl(),
|
||||
'no_user' => $this->getCurrentUrl(),
|
||||
'ok_session' => $this->getCurrentUrl(),
|
||||
'session_version' => 3,
|
||||
), $params)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an API call.
|
||||
*
|
||||
* @param Array $params the API call parameters
|
||||
* @return the decoded response
|
||||
*/
|
||||
public function api(/* polymorphic */) {
|
||||
$args = func_get_args();
|
||||
if (is_array($args[0])) {
|
||||
return $this->_restserver($args[0]);
|
||||
} else {
|
||||
return call_user_func_array(array($this, '_graph'), $args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the old restserver.php endpoint.
|
||||
*
|
||||
* @param Array $params method call object
|
||||
* @return the decoded response object
|
||||
* @throws FacebookApiException
|
||||
*/
|
||||
protected function _restserver($params) {
|
||||
// generic application level parameters
|
||||
$params['api_key'] = $this->getAppId();
|
||||
$params['format'] = 'json-strings';
|
||||
|
||||
$result = json_decode($this->_oauthRequest(
|
||||
$this->getApiUrl($params['method']),
|
||||
$params
|
||||
), true);
|
||||
|
||||
// results are returned, errors are thrown
|
||||
if (is_array($result) && isset($result['error_code'])) {
|
||||
throw new FacebookApiException($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke the Graph API.
|
||||
*
|
||||
* @param String $path the path (required)
|
||||
* @param String $method the http method (default 'GET')
|
||||
* @param Array $params the query/post data
|
||||
* @return the decoded response object
|
||||
* @throws FacebookApiException
|
||||
*/
|
||||
protected function _graph($path, $method='GET', $params=array()) {
|
||||
if (is_array($method) && empty($params)) {
|
||||
$params = $method;
|
||||
$method = 'GET';
|
||||
}
|
||||
$params['method'] = $method; // method override as we always do a POST
|
||||
|
||||
$result = json_decode($this->_oauthRequest(
|
||||
$this->getUrl('graph', $path),
|
||||
$params
|
||||
), true);
|
||||
|
||||
// results are returned, errors are thrown
|
||||
if (is_array($result) && isset($result['error'])) {
|
||||
$e = new FacebookApiException($result);
|
||||
if ($e->getType() === 'OAuthException') {
|
||||
$this->setSession(null);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a OAuth Request
|
||||
*
|
||||
* @param String $path the path (required)
|
||||
* @param Array $params the query/post data
|
||||
* @return the decoded response object
|
||||
* @throws FacebookApiException
|
||||
*/
|
||||
protected function _oauthRequest($url, $params) {
|
||||
if (!isset($params['access_token'])) {
|
||||
$session = $this->getSession();
|
||||
// either user session signed, or app signed
|
||||
if ($session) {
|
||||
$params['access_token'] = $session['access_token'];
|
||||
} else {
|
||||
$params['access_token'] = $this->getAppId() .'|'. $this->getApiSecret();
|
||||
}
|
||||
}
|
||||
|
||||
// json_encode all params values that are not strings
|
||||
foreach ($params as $key => $value) {
|
||||
if (!is_string($value)) {
|
||||
$params[$key] = json_encode($value);
|
||||
}
|
||||
}
|
||||
return $this->makeRequest($url, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an HTTP request. This method can be overriden by subclasses if
|
||||
* developers want to do fancier things or use something other than curl to
|
||||
* make the request.
|
||||
*
|
||||
* @param String $url the URL to make the request to
|
||||
* @param Array $params the parameters to use for the POST body
|
||||
* @param CurlHandler $ch optional initialized curl handle
|
||||
* @return String the response text
|
||||
*/
|
||||
protected function makeRequest($url, $params, $ch=null) {
|
||||
if ( function_exists( 'curl_init' ) AND function_exists("curl_exec") AND function_exists('curl_setopt_array') )
|
||||
{
|
||||
if (!$ch) {
|
||||
$ch = curl_init();
|
||||
}
|
||||
$opts = self::$CURL_OPTS;
|
||||
$opts[CURLOPT_POSTFIELDS] = $params;
|
||||
$opts[CURLOPT_URL] = $url;
|
||||
|
||||
// stops cURL from doing a Expect: 100-continue
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
|
||||
curl_setopt_array($ch, $opts);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
|
||||
if (curl_errno($ch) == 60 || curl_errno( $ch ) == 77)
|
||||
{ // CURLE_SSL_CACERT
|
||||
if ( defined('CA_BUNDLE_PATH') )
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_CAINFO, CA_BUNDLE_PATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
}
|
||||
|
||||
$result = curl_exec($ch);
|
||||
}
|
||||
// name lookup timed out / DNS issues
|
||||
else if ( curl_errno( $ch ) == 6 )
|
||||
{
|
||||
$url_parts = @parse_url($url);
|
||||
$ip = @gethostbyname( $url_parts['host'] );
|
||||
|
||||
if ( $ip and preg_match( "#^\d{1,3}\.#", $ip ) )
|
||||
{
|
||||
// Turn of verify SSL as the IP will not match domain of cert
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_URL, $url_parts['scheme'] . '://' . $ip . '/' . $url_parts['path'] );
|
||||
$result = curl_exec($ch);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === false)
|
||||
{
|
||||
$e = new FacebookApiException(array(
|
||||
'error_code' => curl_errno($ch),
|
||||
'error' => array(
|
||||
'message' => curl_error($ch),
|
||||
'type' => 'CurlException',
|
||||
),
|
||||
));
|
||||
curl_close($ch);
|
||||
throw $e;
|
||||
}
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url_parts = @parse_url($url);
|
||||
$postfields = http_build_query( $params );
|
||||
|
||||
if ( ! $postfields )
|
||||
{
|
||||
$postfields = $url_parts['query'];
|
||||
}
|
||||
|
||||
$postfields = str_replace( '&', '&', $postfields );
|
||||
|
||||
/* Use SSL rather than https */
|
||||
$url_parts['scheme'] = ( $url_parts['scheme'] == 'https' ) ? 'ssl' : $url_parts['scheme'];
|
||||
|
||||
$host = $url_parts['scheme'] . '://' . $url_parts['host'];
|
||||
$port = ( isset($url_parts['port']) ) ? $url_parts['port'] : ( $url_parts['scheme'] == 'https' || $url_parts['scheme'] == 'ssl' ? 443 : 80 );
|
||||
|
||||
if ( !empty( $url_parts["path"] ) )
|
||||
{
|
||||
$path = $url_parts["path"];
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = "/";
|
||||
}
|
||||
|
||||
$header = "POST {$path} HTTP/1.0\r\n";
|
||||
$header .= "Host: " . str_replace( array( 'http://', 'https://', 'ssl://' ), '', $host ) . "\r\n";
|
||||
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
$header .= "Content-Length: " . strlen($postfields) . "\r\n\r\n";
|
||||
|
||||
if ( $fp = fsockopen( $host, $port, $errno, $errstr, 60 ) )
|
||||
{
|
||||
socket_set_timeout($fp, 60);
|
||||
|
||||
fwrite($fp, $header . $postfields);
|
||||
|
||||
while( ! feof($fp) && ! $status['timed_out'] )
|
||||
{
|
||||
$data .= fgets ($fp,8192);
|
||||
$status = stream_get_meta_data($fp);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/* Strip headers HTTP/1.1 ### ABCD */
|
||||
$httpCode = substr( $data, 9, 3 );
|
||||
$lastApiCall = $url;
|
||||
|
||||
/* Chuncked? */
|
||||
|
||||
$_chunked = false;
|
||||
|
||||
if( preg_match( "/Transfer\-Encoding:\s*chunked/i", $data ) )
|
||||
{
|
||||
$_chunked = true;
|
||||
}
|
||||
|
||||
$tmp = explode("\r\n\r\n", $data, 2);
|
||||
$data = trim($tmp[1]);
|
||||
|
||||
if ( $_chunked )
|
||||
{
|
||||
$lines = explode( "\n", $data );
|
||||
array_pop($lines);
|
||||
array_shift($lines);
|
||||
$data = implode( "\n", $lines );
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the Cookie that contains the session.
|
||||
*
|
||||
* @return String the cookie name
|
||||
*/
|
||||
protected function getSessionCookieName() {
|
||||
return 'fbs_' . $this->getAppId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a JS Cookie based on the _passed in_ session. It does not use the
|
||||
* currently stored session -- you need to explicitly pass it in.
|
||||
*
|
||||
* @param Array $session the session to use for setting the cookie
|
||||
*/
|
||||
protected function setCookieFromSession($session=null) {
|
||||
if (!$this->useCookieSupport()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cookieName = $this->getSessionCookieName();
|
||||
$value = 'deleted';
|
||||
$expires = time() - 3600;
|
||||
$domain = $this->getBaseDomain();
|
||||
if ($session) {
|
||||
$value = '"' . http_build_query($session, null, '&') . '"';
|
||||
if (isset($session['base_domain'])) {
|
||||
$domain = $session['base_domain'];
|
||||
}
|
||||
$expires = $session['expires'];
|
||||
}
|
||||
|
||||
// prepend dot if a domain is found
|
||||
if ($domain) {
|
||||
$domain = '.' . $domain;
|
||||
}
|
||||
|
||||
// if an existing cookie is not set, we dont need to delete it
|
||||
if ($value == 'deleted' && empty($_COOKIE[$cookieName])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (headers_sent()) {
|
||||
// disable error log if we are running in a CLI environment
|
||||
// @codeCoverageIgnoreStart
|
||||
if (php_sapi_name() != 'cli') {
|
||||
error_log('Could not set cookie. Headers already sent.');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
// ignore for code coverage as we will never be able to setcookie in a CLI
|
||||
// environment
|
||||
// @codeCoverageIgnoreStart
|
||||
} else {
|
||||
setcookie($cookieName, $value, $expires, '/', $domain);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a session_version=3 style session object.
|
||||
*
|
||||
* @param Array $session the session object
|
||||
* @return Array the session object if it validates, null otherwise
|
||||
*/
|
||||
protected function validateSessionObject($session) {
|
||||
// make sure some essential fields exist
|
||||
if (is_array($session) &&
|
||||
isset($session['uid']) &&
|
||||
isset($session['session_key']) &&
|
||||
isset($session['secret']) &&
|
||||
isset($session['access_token']) &&
|
||||
isset($session['sig'])) {
|
||||
// validate the signature
|
||||
$session_without_sig = $session;
|
||||
unset($session_without_sig['sig']);
|
||||
$expected_sig = self::generateSignature(
|
||||
$session_without_sig,
|
||||
$this->getApiSecret()
|
||||
);
|
||||
if ($session['sig'] != $expected_sig) {
|
||||
// disable error log if we are running in a CLI environment
|
||||
// @codeCoverageIgnoreStart
|
||||
if (php_sapi_name() != 'cli') {
|
||||
error_log('Got invalid session signature in cookie.');
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
$session = null;
|
||||
}
|
||||
// check expiry time
|
||||
} else {
|
||||
$session = null;
|
||||
}
|
||||
return $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the URL for api given parameters.
|
||||
*
|
||||
* @param $method String the method name.
|
||||
* @return String the URL for the given parameters
|
||||
*/
|
||||
protected function getApiUrl($method) {
|
||||
static $READ_ONLY_CALLS =
|
||||
array('admin.getallocation' => 1,
|
||||
'admin.getappproperties' => 1,
|
||||
'admin.getbannedusers' => 1,
|
||||
'admin.getlivestreamvialink' => 1,
|
||||
'admin.getmetrics' => 1,
|
||||
'admin.getrestrictioninfo' => 1,
|
||||
'application.getpublicinfo' => 1,
|
||||
'auth.getapppublickey' => 1,
|
||||
'auth.getsession' => 1,
|
||||
'auth.getsignedpublicsessiondata' => 1,
|
||||
'comments.get' => 1,
|
||||
'connect.getunconnectedfriendscount' => 1,
|
||||
'dashboard.getactivity' => 1,
|
||||
'dashboard.getcount' => 1,
|
||||
'dashboard.getglobalnews' => 1,
|
||||
'dashboard.getnews' => 1,
|
||||
'dashboard.multigetcount' => 1,
|
||||
'dashboard.multigetnews' => 1,
|
||||
'data.getcookies' => 1,
|
||||
'events.get' => 1,
|
||||
'events.getmembers' => 1,
|
||||
'fbml.getcustomtags' => 1,
|
||||
'feed.getappfriendstories' => 1,
|
||||
'feed.getregisteredtemplatebundlebyid' => 1,
|
||||
'feed.getregisteredtemplatebundles' => 1,
|
||||
'fql.multiquery' => 1,
|
||||
'fql.query' => 1,
|
||||
'friends.arefriends' => 1,
|
||||
'friends.get' => 1,
|
||||
'friends.getappusers' => 1,
|
||||
'friends.getlists' => 1,
|
||||
'friends.getmutualfriends' => 1,
|
||||
'gifts.get' => 1,
|
||||
'groups.get' => 1,
|
||||
'groups.getmembers' => 1,
|
||||
'intl.gettranslations' => 1,
|
||||
'links.get' => 1,
|
||||
'notes.get' => 1,
|
||||
'notifications.get' => 1,
|
||||
'pages.getinfo' => 1,
|
||||
'pages.isadmin' => 1,
|
||||
'pages.isappadded' => 1,
|
||||
'pages.isfan' => 1,
|
||||
'permissions.checkavailableapiaccess' => 1,
|
||||
'permissions.checkgrantedapiaccess' => 1,
|
||||
'photos.get' => 1,
|
||||
'photos.getalbums' => 1,
|
||||
'photos.gettags' => 1,
|
||||
'profile.getinfo' => 1,
|
||||
'profile.getinfooptions' => 1,
|
||||
'stream.get' => 1,
|
||||
'stream.getcomments' => 1,
|
||||
'stream.getfilters' => 1,
|
||||
'users.getinfo' => 1,
|
||||
'users.getloggedinuser' => 1,
|
||||
'users.getstandardinfo' => 1,
|
||||
'users.hasapppermission' => 1,
|
||||
'users.isappuser' => 1,
|
||||
'users.isverified' => 1,
|
||||
'video.getuploadlimits' => 1);
|
||||
$name = 'api';
|
||||
if (isset($READ_ONLY_CALLS[strtolower($method)])) {
|
||||
$name = 'api_read';
|
||||
}
|
||||
return self::getUrl($name, 'restserver.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the URL for given domain alias, path and parameters.
|
||||
*
|
||||
* @param $name String the name of the domain
|
||||
* @param $path String optional path (without a leading slash)
|
||||
* @param $params Array optional query parameters
|
||||
* @return String the URL for the given parameters
|
||||
*/
|
||||
protected function getUrl($name, $path='', $params=array()) {
|
||||
$url = self::$DOMAIN_MAP[$name];
|
||||
if ($path) {
|
||||
if ($path[0] === '/') {
|
||||
$path = substr($path, 1);
|
||||
}
|
||||
$url .= $path;
|
||||
}
|
||||
if ($params) {
|
||||
$url .= '?' . http_build_query($params);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Current URL, stripping it of known FB parameters that should
|
||||
* not persist.
|
||||
*
|
||||
* @return String the current URL
|
||||
*/
|
||||
protected function getCurrentUrl() {
|
||||
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'
|
||||
? 'https://'
|
||||
: 'http://';
|
||||
$currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$parts = parse_url($currentUrl);
|
||||
|
||||
// drop known fb params
|
||||
$query = '';
|
||||
if (!empty($parts['query'])) {
|
||||
$params = array();
|
||||
parse_str($parts['query'], $params);
|
||||
foreach(self::$DROP_QUERY_PARAMS as $key) {
|
||||
unset($params[$key]);
|
||||
}
|
||||
if (!empty($params)) {
|
||||
$query = '?' . http_build_query($params);
|
||||
}
|
||||
}
|
||||
|
||||
// use port if non default
|
||||
$port =
|
||||
isset($parts['port']) &&
|
||||
(($protocol === 'http://' && $parts['port'] !== 80) ||
|
||||
($protocol === 'https://' && $parts['port'] !== 443))
|
||||
? ':' . $parts['port'] : '';
|
||||
|
||||
// rebuild
|
||||
return $protocol . $parts['host'] . $port . $parts['path'] . $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a signature for the given params and secret.
|
||||
*
|
||||
* @param Array $params the parameters to sign
|
||||
* @param String $secret the secret to sign with
|
||||
* @return String the generated signature
|
||||
*/
|
||||
protected static function generateSignature($params, $secret) {
|
||||
// work with sorted data
|
||||
ksort($params);
|
||||
|
||||
// generate the base string
|
||||
$base_string = '';
|
||||
foreach($params as $key => $value) {
|
||||
$base_string .= $key . '=' . $value;
|
||||
}
|
||||
$base_string .= $secret;
|
||||
|
||||
return md5($base_string);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* Simple oAuth wrapper for Facebook
|
||||
* Designed to stream line log in and token exchange
|
||||
* By Matt Mecham (Invision Power Services, Inc)
|
||||
* http://www.invisionpower.com
|
||||
* http://hatynka.in
|
||||
* April 2010
|
||||
*
|
||||
* Version 0.1
|
||||
@@ -15,40 +15,40 @@ class FacebookOAuth
|
||||
/**
|
||||
* Facebook Application ID
|
||||
* @var int
|
||||
* @access private
|
||||
* @access protected
|
||||
*/
|
||||
private $_appId;
|
||||
protected $_appId;
|
||||
|
||||
/**
|
||||
* Facebook Application Secret
|
||||
* @var string
|
||||
* @access private
|
||||
* @access protected
|
||||
*/
|
||||
private $_appSecret;
|
||||
protected $_appSecret;
|
||||
|
||||
/**
|
||||
* Call back URL
|
||||
* URL to redirect oAuth requests to after processing at Facebook
|
||||
* @var string
|
||||
* @access private
|
||||
* @access protected
|
||||
*/
|
||||
private $_callBackUrl;
|
||||
protected $_callBackUrl;
|
||||
|
||||
/**
|
||||
* Permissions scope
|
||||
* Array containing required permissions
|
||||
* @var array
|
||||
* @access private
|
||||
* @access protected
|
||||
*/
|
||||
private $_permsScope = array();
|
||||
protected $_permsScope = array();
|
||||
|
||||
/**
|
||||
* Form Factor
|
||||
* @link http://developers.facebook.com/docs/authentication/
|
||||
* @var string
|
||||
* @access private
|
||||
* @access protected
|
||||
*/
|
||||
private $_formFactor = '';
|
||||
protected $_formFactor = '';
|
||||
|
||||
/**
|
||||
* Last http code (200, 403, etc)
|
||||
@@ -211,13 +211,13 @@ class FacebookOAuth
|
||||
/**
|
||||
* Make an HTTP request
|
||||
*
|
||||
* @param private
|
||||
* @param protected
|
||||
* @param string URL
|
||||
* @param string Method (post or get)
|
||||
* @param array Post data to send
|
||||
* @return API results
|
||||
*/
|
||||
private function _send($url, $method='POST', $postfields=NULL)
|
||||
protected function _send($url, $method='POST', $postfields=NULL)
|
||||
{
|
||||
/* Compress post fields */
|
||||
if ( is_array( $postfields ) AND count( $postfields ) )
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFgjCCBGqgAwIBAgIQDKKbZcnESGaLDuEaVk6fQjANBgkqhkiG9w0BAQUFADBm
|
||||
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||
d3cuZGlnaWNlcnQuY29tMSUwIwYDVQQDExxEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
|
||||
ZSBDQS0zMB4XDTEwMDExMzAwMDAwMFoXDTEzMDQxMTIzNTk1OVowaDELMAkGA1UE
|
||||
BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEX
|
||||
MBUGA1UEChMORmFjZWJvb2ssIEluYy4xFzAVBgNVBAMUDiouZmFjZWJvb2suY29t
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9rzj7QIuLM3sdHu1HcI1VcR3g
|
||||
b5FExKNV646agxSle1aQ/sJev1mh/u91ynwqd2BQmM0brZ1Hc3QrfYyAaiGGgEkp
|
||||
xbhezyfeYhAyO0TKAYxPnm2cTjB5HICzk6xEIwFbA7SBJ2fSyW1CFhYZyo3tIBjj
|
||||
19VjKyBfpRaPkzLmRwIDAQABo4ICrDCCAqgwHwYDVR0jBBgwFoAUUOpzidsp+xCP
|
||||
nuUBINTeeZlIg/cwHQYDVR0OBBYEFPp+tsFBozkjrHlEnZ9J4cFj2eM0MA4G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CeARy
|
||||
wlDtxULGOFRyGIZZPmbV2eNq5xdU/g3IuBEhL722mTpAye9FU/J8Wsnw54/gANyO
|
||||
Gzkewigua8ip8Lbs9Cht399yAfbfhUP1DrAm/xEcnHrzPr3cdCtOyJaM6SRPpRqH
|
||||
ITK5Nc06tat9lXVosSinT3KqydzxBYua9gCFFiR3x3DgZfvXkC6KDdUlDrNcJUub
|
||||
a1BHnLLP4mxTHL6faAXYd05IxNn/IA==
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIGVTCCBT2gAwIBAgIQCFH5WYFBRcq94CTiEsnCDjANBgkqhkiG9w0BAQUFADBs
|
||||
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||
d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
|
||||
ZSBFViBSb290IENBMB4XDTA3MDQwMzAwMDAwMFoXDTIyMDQwMzAwMDAwMFowZjEL
|
||||
MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
|
||||
LmRpZ2ljZXJ0LmNvbTElMCMGA1UEAxMcRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
|
||||
Q0EtMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9hCikQH17+NDdR
|
||||
CPge+yLtYb4LDXBMUGMmdRW5QYiXtvCgFbsIYOBC6AUpEIc2iihlqO8xB3RtNpcv
|
||||
KEZmBMcqeSZ6mdWOw21PoF6tvD2Rwll7XjZswFPPAAgyPhBkWBATaccM7pxCUQD5
|
||||
BUTuJM56H+2MEb0SqPMV9Bx6MWkBG6fmXcCabH4JnudSREoQOiPkm7YDr6ictFuf
|
||||
1EutkozOtREqqjcYjbTCuNhcBoz4/yO9NV7UfD5+gw6RlgWYw7If48hl66l7XaAs
|
||||
zPw82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HwSCARAwggEMMIHeoIHb
|
||||
oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5
|
||||
BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p
|
||||
dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk
|
||||
MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp
|
||||
b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu
|
||||
dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0
|
||||
MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi
|
||||
E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa
|
||||
MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI
|
||||
hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN
|
||||
95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd
|
||||
2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user