예제 #1
0
 public function __construct()
 {
     $facebook = new Facebook(OpfApplicationConfig::SITE_API_KEY, OpfApplicationConfig::SITE_API_SECRET);
     $this->facebook = $facebook;
     $facebook->require_frame();
     $this->userId = $facebook->require_login();
     try {
         $this->addUrl = $facebook->get_add_url();
         $this->isAppAdded = $facebook->api_client->users_isAppAdded();
     } catch (Exception $e) {
         $facebook->set_user(null, null);
         $facebook->redirect(OpfApplicationConfig::APP_CALLBACK_URL);
     }
 }
예제 #2
0
$facebook = new Facebook($appapikey, $appsecret);
//$profileId = $facebook->get_loggedin_user(); // If the user is logged in and looks at their own wordans app this is the way to get their profile id
$linkFromFBBanner = $_GET['linkFromFBBanner'];
//If the facebook user hasn't installed the wordans app we still want them to see it in a public canvas page
if ($linkFromFBBanner == 'true') {
    //public canvas page
    $user = $facebook->get_loggedin_user();
} else {
    //do a login and configuration or show them the app if they have already installed it
    $user = $facebook->require_login();
    $appcallbackurl = 'http://www.wordans.com/wordans_flash/facebook_callback';
    // catch the exception that gets thrown if the cookie has
    // an invalid session_key in it
    try {
        if (!$facebook->api_client->users_isAppAdded()) {
            $facebook->redirect($facebook->get_add_url());
        }
    } catch (Exception $ex) {
        // this will clear cookies for your application and
        // redirect them to a login prompt
        $facebook->set_user(null, null);
        $facebook->redirect($appcallbackurl);
    }
}
?>
<!--<fb:swf swfsrc='http://www.wordans.com.com/flash/facebook/loader.swf?version="1" ' imgsrc='http://www.skeeker.com/sites/facebook/wordans/clickhere.jpg' width='185' height='280' flashvars='asset_path=http://www.skeeker.com/sites/facebook/wordans/' />-->



<script type="text/javascript" src="swfobject.js"></script>
<style type="text/css">
예제 #3
0
    <title>FriendExport</title>
    <link rel="stylesheet" type="text/css" href="assets/css/fb.css">
  </head>
  <body>
<?php 
require_once '.' . DIRECTORY_SEPARATOR . 'global.php';
require_once INCLUDE_DIR . 'facebook.php';
// Workarounds for new fb rules re. iframe apps
$_COOKIE = array();
$secret = FB_API_SECRET;
$facebook = new Facebook(FB_API_KEY, FB_API_SECRET);
$user = $facebook->get_loggedin_user();
if (!$user) {
    $user = $_REQUEST['uid'];
    if (!$user) {
        $facebook->redirect($facebook->get_login_url(FB_APP_URL, 1));
    }
    $key = $_REQUEST['key'];
    $token = $_REQUEST['token'];
    $check = md5($user . $secret);
    if ($check != $token) {
        die("Invalid Signature");
    }
    $facebook->set_user($user, $key);
}
$key = $facebook->api_client->session_key;
$token = md5($user . $secret);
// This is used to append to internal links
$params = "uid={$user}&key={$key}&token={$token}";
?>
    <div class="fbgreybox" style="width: 500px;">Welcome to FriendExport.</div>