This msg appears on my site and nothing else. I do not understand code...at all. Please let me know how to fix it and where exactly I need to enter any new code. Thank you in advance!
Fatal error: Class 'Facebook' not found in /home/sphynxm1/public_html/components/com_jfbconnect/helpers/facebookhelper.php on line 144
my facebookhelper.php code
getSetting('facebook_api_key');
echo JHTML::_('behavior.mootools');
echo
"\n".
"\n".
" window.addEvent('domready', function()\n".
" {FB_RequireFeatures([\"XFBML\"],\n".
" function() {\n".
" FB.Facebook.init(\"".$facebookApiKey."\", \"".self::getXDReceiverLink()."\");\n".
" });\n".
" })\n;".
"\n";
# check for logged in user and set session fbUid if it's not already set
self::$initFbApiCalled = true;
}
}
function init()
{
self::addNamespace();
self::initFbApi();
}
static $_FbClient = null;
function getFbClient($getNew = false)
{
if ($getNew)
{
#echo "Destroying current lib";
self::$_FbRoot = null;
}
$fbLib = self::getFbLib();
if (self::$_FbClient == null)
{
self::$_FbClient = $fbLib->api_client;
#ensure that client and root user id's are ==. Should only be different if guest Joomla user
self::$_FbClient->set_user(self::$_FbRoot->user);
$jUser =& JFactory::getUser();
#echo "JUser = ".$jUser->get('id')."";
#echo "FBUser = ".self::$_FbClient->user."";
# check session if user is logged in.
# This is dumb, but there's no way to validate a session, so we have to call
# a function which will throw an exception if not valid. If it does, we invalidate the session
if (self::$_FbClient->user)
{
if (self::_getUserName(self::$_FbClient->user) == null)
{
#echo "SESSION EXPIRED! Setting user to null";
self::$_FbRoot->user = null;
self::$_FbClient->set_user(null);
}
}
}
return self::$_FbClient;
}
static $_FbRoot = null;
static $_OrigFbUser = null;
static $_OrigFbSessionKey = null;
function getFbLib()
{
if (self::$_FbRoot == null)
{
include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_jfbconnect'.DS.'assets'.DS.'facebook-api'.DS.'facebook.php');
$configModel = self::getConfigModel();
$facebookApiKey = $configModel->getSetting('facebook_api_key');
$facebookSecretKey = $configModel->getSetting('facebook_secret_key');
#echo "FBH. pre root user : ".self::$_OrigFbUser."";
self::$_FbRoot = new Facebook($facebookApiKey, $facebookSecretKey);
self::$_OrigFbUser = self::$_FbRoot->user;
#echo "Key: ".self::$_FbRoot->api_client->session_key;
self::$_OrigFbSessionKey = self::$_FbRoot->api_client->session_key;
#echo "FBH. post root user : ".self::$_OrigFbUser."";
}
return self::$_FbRoot;
}
function _getUserName($fbUserId)
{
$fbClient = self::getFbClient(false);
$userProfile = array();
$fields = array(0=>'first_name', 1=>'last_name', 2=>'status');
try
{
$userProfile = $fbClient->users_getInfo($fbUserId, $fields);
#echo "printing profile";
#print_r($userProfile);
}
catch (FacebookRestClientException $e)
{
$userProfile[0] = null;
}
if (!isset($userProfile[0]))
$userProfile[0] = null;
return $userProfile[0];
}
function getUserProfile($fbUserId, $fields)
{
$fbClient = self::getFbClient(false);
$userProfile = array();
try
{
$userProfile = $fbClient->users_getInfo($fbUserId, $fields);
}
catch (FacebookRestClientException $e)
{
$userProfile[0] = null;
}
if (!isset($userProfile[0]))
$userProfile[0] = null;
return $userProfile[0];
}
function logoutFacebookUser()
{
$fbLib = self::getFbLib();
$fbLib->expire_session();
}
function setFacebookMessage($message)
{
$configModel = self::getConfigModel();
$facebookUpdateStatusMessage = $configModel->getSetting('facebook_update_status_msg');
if($facebookUpdateStatusMessage && $message)
{
try
{
$fbClient = self::getFbClient(false);
if($fbClient->users_hasAppPermission("status_update"))
{
$fbClient->users_setStatus($message);
}
}
catch (FacebookRestClientException $e)
{
/*
Fatal error: Uncaught exception 'FacebookRestClientException' with message
'Updating status requires the extended permission status_update' in
.../com_jfbconnect/assets/facebook-api/facebookapi_php5_restlib.php:3007
*/
}
}
}
function setFacebookNewUserMessage()
{
$configModel = self::getConfigModel();
$message = $configModel->getSetting('facebook_new_user_status_msg');
self::setFacebookMessage($message);
}
function setFacebookLoginMessage()
{
$configModel = self::getConfigModel();
$message = $configModel->getSetting('facebook_login_status_msg');
self::setFacebookMessage($message);
}
}