vB_Library_Facebook
extends vB_Library
in package
vB_Library_Facebook
Tags
Table of Contents
- FBVERSION = 'v3.3'
- $facebookInitialized : mixed
- $failureReason : mixed
- $fb_session : mixed
- $fb_session_tried : mixed
- $fb_userinfo : mixed
- $instance : mixed
- $sdk_failed : mixed
- $vb_userid : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- clearCache() : mixed
- clearSession() : none
- Clear all stored information for the current user from vB This will not log the user out of either vB or Facebook (but is is expected that this will be called as part of logging the user out of the vBulletin)
- connectCurrentUser() : none
- Connects the currently logged in user to the currently logged in Facebook user
- createSessionForLogin() : mixed
- Associate a vb account with a facebook sesssion
- disconnectUser() : none
- Disconnect the user's account from facebook
- getContentInstance() : mixed
- getFbProfilePicUrl() : string|false
- Get the logged in user's profile picture url.
- getFbProfileUrl() : string|false
- Get the logged in user's profile url.
- getFbUserInfo() : mixed
- Grabs logged in user info from faceboook if user is logged in
- getInitializeFailureMessage() : string
- Get the reason why facebook failed to initialize
- getLoggedInFbUserId() : mixed
- Checks for a currrently logged in user through facebook api
- getVbUseridFromFbUserid() : mixed
- Checks if current facebook user is associated with a vb user, and returns vb userid if so
- instance() : vB_PageCache
- Returns singleton instance of self.
- isFacebookEnabled() : bool
- Is facebook enabled on this site.
- isValidAuthToken() : mixed
- Verifies that the current session auth token is still valid with facebook - performs a Facebook roundtrip
- monitorWords() : mixed
- Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
- reinitialize() : bool
- Reintialize the facebook application
- userIsLoggedIn() : bool
- Checks if the current user is logged into facebook
- __construct() : mixed
- Constructor
- apiGet() : mixed
- apiPost() : mixed
- getLibraryClassNameInternal() : mixed
- handleFacebookException() : mixed
- Handles facebook exceptions (expose the exception if in debug mode)
- checkInitialized() : none
- Throws an exception if the a function needing the facebook system is called without it being initialized. The caller *should* call isFacebookEnabled to ensure that this never happens.
- getAuthFromPHPSession() : mixed
- getSession() : mixed
- setSession() : mixed
- setSessionFromSignedRequest() : bool
- Sets the session information from a signed request
- startSession() : mixed
- storeInPHPSession() : mixed
Constants
FBVERSION
public
mixed
FBVERSION
= 'v3.3'
Properties
$facebookInitialized
protected
mixed
$facebookInitialized
= alse
$failureReason
protected
mixed
$failureReason
= ""
$fb_session
protected
mixed
$fb_session
=
ull
$fb_session_tried
protected
mixed
$fb_session_tried
= alse
$fb_userinfo
protected
mixed
$fb_userinfo
= array()
$instance
protected
static mixed
$instance
= array()
$sdk_failed
protected
static mixed
$sdk_failed
= alse
$vb_userid
protected
mixed
$vb_userid
=
ull
Methods
__serialize()
public
__serialize() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —__unserialize()
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —clearCache()
public
static clearCache() : mixed
Return values
mixed —clearSession()
Clear all stored information for the current user from vB This will not log the user out of either vB or Facebook (but is is expected that this will be called as part of logging the user out of the vBulletin)
public
clearSession() : none
Will do nothing if facebook is not initialized.
Return values
none —connectCurrentUser()
Connects the currently logged in user to the currently logged in Facebook user
public
connectCurrentUser([mixed $accessToken = null ]) : none
Note that we don't allow connection of a non logged in account because we need to validate the FB login. Connecting somebody else's account to a FB just doesn't make sense as an action.
Parameters
- $accessToken : mixed = null
Return values
none —createSessionForLogin()
Associate a vb account with a facebook sesssion
public
createSessionForLogin(mixed $info) : mixed
Parameters
- $info : mixed
Return values
mixed —disconnectUser()
Disconnect the user's account from facebook
public
disconnectUser(int $userid) : none
Unlike previous behavior do not require that the user be logged in to facebook This causes a situation where if the user mucks with the association on the FB end they can screw it up to the point where it doesn't work. And they can't just reassociate the account because they can't log in to disconnect.
Parameters
- $userid : int
-
the userid to be disconnected.
Return values
none —getContentInstance()
public
static getContentInstance(mixed $contenttypeid) : mixed
Parameters
- $contenttypeid : mixed
Return values
mixed —getFbProfilePicUrl()
Get the logged in user's profile picture url.
public
getFbProfilePicUrl() : string|false
Return values
string|false —facebook profile picture url or false on failure (forex, there is no logged in FB user)
getFbProfileUrl()
Get the logged in user's profile url.
public
getFbProfileUrl() : string|false
Return values
string|false —facebook profile url or false on failure (forex, there is no logged in FB user)
getFbUserInfo()
Grabs logged in user info from faceboook if user is logged in
public
getFbUserInfo([mixed $force_reload = false ]) : mixed
Parameters
- $force_reload : mixed = false
Return values
mixed —getInitializeFailureMessage()
Get the reason why facebook failed to initialize
public
getInitializeFailureMessage() : string
Return values
string —Reason why initialization failed
getLoggedInFbUserId()
Checks for a currrently logged in user through facebook api
public
getLoggedInFbUserId() : mixed
Return values
mixed —getVbUseridFromFbUserid()
Checks if current facebook user is associated with a vb user, and returns vb userid if so
public
getVbUseridFromFbUserid([mixed $fb_userid = false ]) : mixed
Parameters
- $fb_userid : mixed = false
Return values
mixed —instance()
Returns singleton instance of self.
public
static instance(mixed $class) : vB_PageCache
Parameters
- $class : mixed
Return values
vB_PageCache —- Reference to singleton instance of the cache handler
isFacebookEnabled()
Is facebook enabled on this site.
public
isFacebookEnabled() : bool
Return values
bool —true if the facebook system initialized properly, false otherwise note that if we get an error this may be false even if facebook is configured in the admincp.
isValidAuthToken()
Verifies that the current session auth token is still valid with facebook - performs a Facebook roundtrip
public
isValidAuthToken() : mixed
Return values
mixed —monitorWords()
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
public
monitorWords(mixed $text, mixed $type, mixed $nodeid[, mixed $userid = null ][, mixed $insertNotifications = true ], mixed $currentuserid) : mixed
Parameters
- $text : mixed
- $type : mixed
- $nodeid : mixed
- $userid : mixed = null
- $insertNotifications : mixed = true
- $currentuserid : mixed
Return values
mixed —reinitialize()
Reintialize the facebook application
public
reinitialize() : bool
If for some reason the FB status changes during a script run (for example you enable it in the vb option) this will force an attempt to recheck its status. Otherwise we will store the status based on the first attempt.
If the intiailization fails, the reason can be determeined via vB_Library_Facebook::getInitializeFailureMessage();
Return values
bool —false if it failed, true if not
userIsLoggedIn()
Checks if the current user is logged into facebook
public
userIsLoggedIn([bool $ping = false ]) : bool
Parameters
- $ping : bool = false
-
Whether to ping Facebook (unused)
Return values
bool —__construct()
Constructor
protected
__construct() : mixed
Return values
mixed —apiGet()
protected
apiGet(mixed $call[, mixed $type = 'Facebook\GraphObject' ][, mixed $data = null ]) : mixed
Parameters
- $call : mixed
- $type : mixed = 'Facebook\GraphObject'
- $data : mixed = null
Return values
mixed —apiPost()
protected
apiPost(mixed $call, mixed $data[, mixed $type = 'Facebook\GraphObject' ]) : mixed
Parameters
- $call : mixed
- $data : mixed
- $type : mixed = 'Facebook\GraphObject'
Return values
mixed —getLibraryClassNameInternal()
protected
static getLibraryClassNameInternal(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —handleFacebookException()
Handles facebook exceptions (expose the exception if in debug mode)
protected
handleFacebookException(Exception $e) : mixed
Parameters
- $e : Exception
Return values
mixed —checkInitialized()
Throws an exception if the a function needing the facebook system is called without it being initialized. The caller *should* call isFacebookEnabled to ensure that this never happens.
private
checkInitialized() : none
Return values
none —-- Either throws an exception or returns normally.
getAuthFromPHPSession()
private
getAuthFromPHPSession() : mixed
Return values
mixed —getSession()
private
getSession() : mixed
Return values
mixed —setSession()
private
setSession(mixed $authToken) : mixed
Parameters
- $authToken : mixed
Return values
mixed —setSessionFromSignedRequest()
Sets the session information from a signed request
private
setSessionFromSignedRequest(string $sr) : bool
This will "use up" the signed request by fetching the authtoken
Parameters
- $sr : string
-
-- the signed request token from facebook
Return values
bool —startSession()
private
startSession() : mixed
Return values
mixed —storeInPHPSession()
private
storeInPHPSession(mixed $authToken) : mixed
Parameters
- $authToken : mixed