Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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">
		</div>
		<div style="clear: both;"/>
		</div>
		<?php 
}
?>
<fb:else>

	<div style="padding: 10px;">
	<h2>
	Hi <fb:name firstnameonly="true" uid="<?php 
echo $user_fb;
?>
" useyou="false"/>, welcome to the TripTracker application.
	</h2>
	<br/><br/>
	If you've got a TripTracker login then <a href="<?php 
echo $facebook->get_add_url();
?>
">add</a> this application to your profile now!
	<br/><br/>
	Once you have linked your TripTracker account into your profile you will be able to select from your GPS tracked journeys to display them directly in your profile page and more. 
	<br/><br/>
	For more info on TripTracker visit their <a href="http://triptracker.net/">site</a>.
	<br/><br/>
	</div>

</fb:if-user-has-added-app>


Ejemplo n.º 4
0
    echo "<h2><a href=\"" . $fbDomain . "/\">Click here to return to " . $appName . "</a>.</h2></center>";
} else {
    // Retrieve array of friends who've already authorized the app.
    $fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=' . $user_id . ') AND is_app_user = 1';
    $_friends = $facebook->api_client->fql_query($fql);
    // Extract the user ID's returned in the FQL request into a new array.
    $friendsExclude = array();
    if (is_array($_friends) && count($_friends)) {
        foreach ($_friends as $friend) {
            $friendsExclude[] = $friend['uid'];
        }
    }
    // Convert the array of friends into a comma-delimeted string.
    $friendsExclude = implode(',', $friendsExclude);
    // Prepare the invitation text that all invited users will receive.
    $content = "<fb:name uid=\"" . $user_id . "\" firstnameonly=\"true\" shownetwork=\"false\"/> has started using <a href=\"" . $fbDomain . "/\">" . $appName . "</a>, a revolutionary new way to see how your friends know each other. Try it now. Its really easy.\n" . "<fb:req-choice url=\"" . $facebook->get_add_url() . "\" label=\"Check out " . $appName . "\"/>";
    ?>
 

<fb:request-form 
	action="<?php 
    echo $invite_url;
    ?>
" 
	method="post" type="<?php 
    echo $appName;
    ?>
" 
	content="<?php 
    echo htmlentities($content, ENT_COMPAT, 'UTF-8');
    ?>
Ejemplo n.º 5
0
$pageData->fcount = sizeof($_POST["ids"]);
if (!isset($_POST["ids"])) {
    // Retrieve array of friends who've already added the app.
    $fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=' . $user . ') AND is_app_user = 1';
    $_friends = $facebook->api_client->fql_query($fql);
    // Extract the user ID's returned in the FQL request into a new array.
    $friends = array();
    if (is_array($_friends) && count($_friends)) {
        foreach ($_friends as $friend) {
            $friends[] = $friend['uid'];
        }
    }
    // Convert the array of friends into a comma-delimeted string.
    $friends = implode(',', $friends);
    // Prepare the invitation text that all invited users will receive.
    $content = "<fb:name uid=\"" . $user . "\" firstnameonly=\"true\" shownetwork=\"false\"/> has started using <a href=\"http://apps.facebook.com/" . $appurl . "/\">" . $appname . "</a>. See how many of the IMDB Top 250 you have seen so you can brag about your high score.</u>!\n" . "<fb:req-choice url=\"" . $facebook->get_add_url() . "\" label=\"Add " . $appname . " to your profile\"/>";
}
// Template
if ($pageData->sentmsg) {
    ?>
	<center>
		Thank you for inviting <?php 
    $pageData->fcount;
    ?>
 of your friends on 
		<b><a href=\"http://apps.facebook.com/<?php 
    $appurl;
    ?>
/"><?php 
    $appname;
    ?>