<?php if (!defined('VB_ENTRY')) die('Access denied.'); class vB_Api_Facebook extends vB_Api { protected $disableFalseReturnOnly = array('isFacebookEnabled', 'userIsLoggedIn', 'getLoggedInFbUserId'); public function isFacebookEnabled() { return vB_Library::instance('facebook')->isFacebookEnabled(); } public function userIsLoggedIn($ping = false) { return vB_Library::instance('facebook')->userIsLoggedIn($ping); } public function getLoggedInFbUserId() { return vB_Library::instance('facebook')->getLoggedInFbUserId(); } public function getVbUseridFromFbUserid() { return vB_Library::instance('facebook')->getVbUseridFromFbUserid(); } public function getFbProfileUrl() { return vB_Library::instance('facebook')->getFbProfileUrl(); } public function getFbProfilePicUrl() { return vB_Library::instance('facebook')->getFbProfilePicUrl(); } public function clearSession() { vB_Library::instance('facebook')->clearSession(); return array('success' => true); } public function getFbUserInfo() { return vB_Library::instance('facebook')->getFbUserInfo(); } public function getAllUserInfo() { $fblib = vB_Library::instance('facebook'); $result = array(); $result['profileurl'] = $fblib->getFbProfileUrl(); $result['profilepicurl'] = $fblib->getFbProfilePicUrl(); $result['vbuserid'] = $fblib->getVbUseridFromFbUserid(); $result['user'] = $fblib->getFbUserInfo(); return $result; } public function disconnectUser($userid) { $userid = intval($userid); if (($userid != vB::getCurrentSession()->get('userid')) AND !vB::getUserContext()->hasAdminPermission('canadminpermissions')) { throw new vB_Exception_Api('no_permission'); } vB_Library::instance('facebook')->disconnectUser($userid); return array('success' => true); } public function connectCurrentUser($accessToken=null) { vB_Library::instance('facebook')->connectCurrentUser($accessToken); return array('success' => true); } } 