本文整理汇总了PHP中Facebook::getLogoutUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::getLogoutUrl方法的具体用法?PHP Facebook::getLogoutUrl怎么用?PHP Facebook::getLogoutUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook
的用法示例。
在下文中一共展示了Facebook::getLogoutUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
/**
* @param string $logoutUrl
*/
public function logout($logoutUrl = '')
{
if (empty($logoutUrl)) {
$logoutUrl = self::$object->getLogoutUrl(array('next' => self::getRedirectUrl() . '#postJobs'));
}
self::$object->setAccessToken('');
self::$object->destroySession();
SJB_HelperFunctions::redirect($logoutUrl);
}
示例2: getInput
public function getInput()
{
if ($this->fb->getUser()) {
$user = $this->fb->getUser();
$profile = $this->fb->api("/me?fields=id,name,picture");
$label = "<img src='" . $profile['picture']['data']['url'] . "' />" . $profile['name'];
$logout = $this->fb->getLogoutUrl(array('next' => JURI::base()));
return $label . "<br /><a href='" . $logout . "'>Log out of Facebook</a>";
} else {
// Not logged in - display a login link
$uri = JURI::current();
$loginUrl = $this->fb->getLoginUrl(array('redirect_uri' => "http://aquinas.dphin.co.uk/login/profile?layout=edit"));
return "<a href='" . $loginUrl . "'>Connect your Facebook account</a>";
}
}
示例3: getFacebookLogoutUrl
public static function getFacebookLogoutUrl()
{
if (is_object(self::$object) && self::$object instanceof Facebook) {
return self::$object->getLogoutUrl();
}
return false;
}
示例4: postar
public function postar($dados, $usuario)
{
require 'complements/facebook/Facebook.php';
$facebook = new Facebook(array('appId' => '1651517385125370', 'secret' => '84b4334e3cfe153b5a4348407709cbf0'));
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
echo "teste";
exit;
$page_id = $usuario;
$page_info = $facebook->api("/{$page_id}?fields=access_token");
if (!empty($page_info['access_token'])) {
$args = array('access_token' => $page_info['access_token'], 'message' => $dados[texto]);
$post_id = $facebook->api("/{$page_id}/feed", "post", $args);
} else {
$permissions = $facebook->api("/me/permissions");
if (!array_key_exists('publish_stream', $permissions['data'][0]) || !array_key_exists('manage_pages', $permissions['data'][0])) {
// We don't have one of the permissions
// Alert the admin or ask for the permission!
header("Location: " . $facebook->getLoginUrl(array("scope" => "publish_stream, manage_pages")));
}
}
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl(array('scope' => 'manage_pages,publish_stream'));
}
}
示例5: call
public function call()
{
//echo $this->_fbLoginRedirectUrl;exit;
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array('appId' => $this->_fbAppId, 'secret' => $this->_fbAppSecret, 'cookie' => false));
// Get User ID
$this->_fbUser = $facebook->getUser();
// We may or may not have this data based on whether the user is logged in.
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
if ($this->_fbUser) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$this->_fbUserProfile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$this->_fbUser = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($this->_fbUser) {
$this->_fbLogoutUrl = $facebook->getLogoutUrl(array("next" => $this->_fbLogoutRedirectUrl));
} else {
$this->_fbLoginUrl = $facebook->getLoginUrl(array('redirect_uri' => $this->_fbLoginRedirectUrl));
//echo $this->_fbLoginUrl;exit;
}
}
示例6: face
private function face($access_token, $dataConfig)
{
require_once 'php-sdk/src/facebook.php';
$facebook = new Facebook($dataConfig);
$facebook->setAccessToken($access_token);
Zend_Debug::dump($user = $facebook->getUser());
if ($user) {
$this->view->faceUrl = $facebook->getLogoutUrl();
} else {
$this->view->faceUrl = $facebook->getLoginUrl();
}
Zend_Debug::dump($_REQUEST);
Zend_Debug::dump($naitik = $facebook->api('/100000874886897'));
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
print_r($user_profile);
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
$this->view->user = $naitik;
}
示例7: getLogoutUrl
/**
*
* @var array
*/
public function getLogoutUrl($params = array())
{
if (!isset($params['next'])) {
$params['next'] = \Config::get('facebook-connect::next');
}
return parent::getLogoutUrl($params);
}
示例8: update_facebook_wall
function update_facebook_wall($text)
{
$appId = '101183239949229';
$appSecret = 'fd040afd3af84cc13b6a70ea602b4ca6';
$srcPageId = '116587918401126';
//Use Evan Hsu's access token because he is one of the Page Admins
//**** The access Token will need to be updated whenever Evan changes his Facebook password
$accessToken = 'AAABcBo8TC60BAOJGsdKapdUYfvbBOJm9jc9EHZBZBpD45mAN2poo9t7nfxtII3I7XZAxH9RMuI1AOD2BjWUEyso17nTkNVR2aEGaZC287Vqe8932fjQ9';
$config = array('appId' => $appId, 'secret' => $appSecret);
$facebook = new Facebook($config);
$args = array('access_token' => $accessToken, 'message' => $text);
try {
$post_id = $facebook->api("/{$srcPageId}/feed", "post", $args);
} catch (FacebookApiException $e) {
//If post failed, do nothing. Permission check happens below.
}
if (!$post_id) {
// If the accessToken is no longer valid (Evan changed his password or revoked permissions),
// then someone with admin access to the Siskiyou facebook page will need to be logged in.
$user = $facebook->getUser();
if ($user) {
try {
$page_info = $facebook->api("/{$srcPageId}?fields=access_token");
if (!empty($page_info['access_token'])) {
$args = array('access_token' => $page_info['access_token'], 'message' => $text);
$post_id = $facebook->api("/{$srcPageId}/feed", "post", $args);
//echo "Access Token: ".$page_info['access_token'];
} else {
$permissions = $facebook->api("/me/permissions");
if (!array_key_exists('publish_stream', $permissions['data'][0]) || !array_key_exists('manage_pages', $permissions['data'][0])) {
// We don't have one of the permissions
// Alert the admin or ask for the permission!
header("Location: " . $facebook->getLoginUrl(array("scope" => "publish_stream, manage_pages, offline_access")));
}
}
} catch (FacebookApiException $e) {
//error_log($e);
$user = null;
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl(array('scope' => 'manage_pages,publish_stream,offline_access'));
header("Location: " . $loginUrl);
}
}
// END if(!$post_id)
if ($post_id != "") {
header('location: http://www.siskiyourappellers.com/current.php');
}
}
示例9: trustExternal
function trustExternal($user, $pass, $sticky = true)
{
global $USERINFO;
global $conf;
$sticky ? $sticky = true : ($sticky = false);
//sanity check
if ($conf['plugin']['fblogin']['applicationID'] && $conf['plugin']['fblogin']['applicationSecret']) {
$facebook = new Facebook(array('appId' => $conf['plugin']['fblogin']['applicationID'], 'secret' => $conf['plugin']['fblogin']['applicationSecret'], 'cookie' => true));
$fbsession = $facebook->getUser();
if ($_REQUEST['do'] == 'logout') {
$logoutUrl = $facebook->getLogoutUrl(array('next' => $_SERVER['HTTP_REFERER']));
unset($fbsession);
# unset($_SESSION[DOKU_COOKIE]['auth']['user']);
# unset($_SESSION[DOKU_COOKIE]['auth']['buid']);
# unset($_SESSION[DOKU_COOKIE]['auth']['pass']);
# unset($_SESSION[DOKU_COOKIE]['auth']['info']);
session_destroy();
error_log('fblogin : authenticated user redirected for logout to ' . $logoutUrl);
header("Location: " . $logoutUrl);
exit;
}
if ($fbsession) {
try {
$me = $facebook->api('/me');
# $friends = $facebook->api('/me/friends'); // for future usage
} catch (FacebookApiException $e) {
error_log($e);
}
if ($me) {
$conf['superuser'] = $conf['plugin']['fblogin']['superuser'];
$USERINFO['name'] = $me['name'];
$USERINFO['mail'] = $me['email'];
$USERINFO['grps'] = array('user');
$user = $me['id'];
$pass = '';
$_SERVER['REMOTE_USER'] = $user;
$_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
$_SESSION[DOKU_COOKIE]['auth']['pass'] = $pass;
$_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
}
//me
}
// FB session
if ($_REQUEST['do'] == 'login') {
$loginUrl = $facebook->getLoginUrl(array('next' => $_SERVER['HTTP_REFERER'], 'redirect_uri' => $conf['baseurl'], 'canvas' => 0, 'fbconnect' => 1));
header("Location: " . $loginUrl);
exit;
}
}
return true;
}
示例10: fblogin
function fblogin()
{
$base_url = $this->config->item('base_url');
//Read the baseurl from the config.php file
//get the Facebook appId and app secret from facebook.php which located in config directory for the creating the object for Facebook class
$facebook = new Facebook(array('appId' => $this->config->item('appID'), 'secret' => $this->config->item('appSecret')));
$user = $facebook->getUser();
// Get the facebook user id
if ($user) {
try {
$user_profile = $facebook->api('/me');
//Get the facebook user profile data
//print_r($user_profile);die();
$email = $user_profile['email'];
$userId = $user_profile['id'];
//$response = $this->home->auth();
$response = $this->home->userauth($userId, $email);
if ($response == 1) {
$this->home->set_online_status(1);
if ($this->session->userdata('is_login')) {
if ($this->session->userdata('is_alumni')) {
redirect(base_url('alumni'));
} elseif ($this->session->userdata('is_prospective')) {
redirect(base_url('parents'));
} elseif ($this->session->userdata('is_seeker')) {
redirect(base_url('seeker'));
} else {
redirect(base_url('home'));
}
}
} else {
redirect(base_url('home'));
}
//$params = array('next' => $base_url.'fbci/logout');
$ses_user = array('User' => $user_profile, 'logout' => $facebook->getLogoutUrl($params));
$this->session->set_userdata($ses_user);
header('Location: ' . $base_url);
} catch (FacebookApiException $e) {
error_log($e);
$user = NULL;
}
}
$this->data['view_file'] = 'index';
echo Modules::run('template/home', $this->data);
}
示例11: fblogin
function fblogin()
{
$base_url = $this->config->item('base_url');
$facebook = new Facebook(array('appId' => $this->config->item('appID'), 'secret' => $this->config->item('appSecret')));
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
$params = array('next' => $base_url . 'login/logout');
$ses_user = array('User' => $user_profile, 'logout' => $facebook->getLogoutUrl($params));
$this->session->set_userdata($ses_user);
header('Location: ' . $base_url);
} catch (FacebookApiException $e) {
error_log($e);
$user = NULL;
}
}
}
示例12: checkfacebook
function checkfacebook()
{
require './fb/facebook.php';
$facebook = new Facebook(array('appId' => '430750040324017', 'secret' => '9270d721dd3ace32a18e0548a1aee947', 'cookie' => true));
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
echo "<br>{$user_profile['id']}<br>{$user_profile['username']}";
$fbuser = $user_profile['username'];
$fbpw = $user_profile['id'];
$fbfname = $user_profile['first_name'];
$fblname = $user_profile['last_name'];
$datetime = date('Y-m-d H:i:s', time());
if (checklogin($fbuser, $fbpw)) {
echo "Welcome back";
} else {
$postsql = "INSERT INTO `userinfo` VALUES (NULL, '{$fbuser}','{$fbfname}','{$fblname}', '{$fbpw}', 1, '{$datetime}', 0);";
include 'uploadinformation.php';
postthing($postsql);
}
$_SESSION['email'] = $fbuser;
$_SESSION['pass'] = $fbpw;
$_SESSION['facebook'] = 1;
header("Location: http://localhost/givemebook/index.php");
} else {
$loginUrl = $facebook->getLoginUrl();
echo "{$loginUrl}";
header("Location: {$loginUrl}");
}
}
示例13: fblogin
function fblogin()
{
$base_url = $this->config->item('base_url');
//Read the baseurl from the config.php file
//get the Facebook appId and app secret from facebook.php which located in config directory for the creating the object for Facebook class
$facebook = new Facebook(array('appId' => $this->config->item('appID'), 'secret' => $this->config->item('appSecret')));
$user = $facebook->getUser();
// Get the facebook user id
if ($user) {
try {
$user_profile = $facebook->api('/me');
//Get the facebook user profile data
$params = array('next' => $base_url . 'fbci/logout');
$ses_user = array('User' => $user_profile, 'logout' => $facebook->getLogoutUrl($params));
$this->session->set_userdata($ses_user);
header('Location: ' . $base_url);
} catch (FacebookApiException $e) {
error_log($e);
$user = NULL;
}
}
$this->load->view('main');
}
示例14: RemoveFacebook
/**
* remove connection to facebook
* TO DO: remove links
* TO DO: FB session
* @param HTTPRequest
*/
public function RemoveFacebook($request)
{
//security check
//
$m = $this->CurrentMember();
if ($m) {
$m->FacebookID = 0;
$m->FacebookURL = "";
$m->FacebookPicture = "";
$m->FacebookName = "";
$m->FacebookEmail = "";
$m->FacebookFirstName = "";
$m->FacebookMiddleName = "";
$m->FacebookLastName = "";
$m->FacebookUsername = "";
$m->write();
}
$facebook = new Facebook(array('appId' => self::$facebook_id, 'secret' => self::$facebook_secret));
//do we need to encode URL ????
$url = $facebook->getLogoutUrl(array("next" => $this->returnURL(true)));
$this->redirect($url);
}
示例15: getLogout
public static function getLogout($redirectLocation)
{
$myparams = JComponentHelper::getParams('com_fbconnct');
$mainframe = JFactory::getApplication();
$getappid = $myparams->get('appid');
$getappsec = $myparams->get('appsecret');
$facebook = new Facebook(array('appId' => $getappid, 'secret' => $getappsec));
$fbuser = $facebook->getUser();
if ($fbuser) {
$me = $facebook->api('/me');
return $facebook->getLogoutUrl(array('next' => $redirectLocation));
} else {
return false;
}
}