示例#1
0
 function fromFacebook($facebook)
 {
     try {
         $data = $facebook->api('/' . $this->id);
     } catch (FacebookApiException $e) {
         return false;
     }
     $this->name = $data['name'];
     $this->imageurl = $data['picture'];
     $this->latitude = $data['location']['latitude'];
     $this->longitude = $data['location']['longitude'];
     if (!$this->imageurl) {
         $this->imageurl = AppInfo::getUrl('/images/unknown.gif');
     }
     return true;
 }
require_once 'facebook/src/facebook.php';
// Load our own libraries.
require 'pat-fb/PATFacebookUser.class.php';
require 'pat-fb/PATIncident.class.php';
require 'pat-fb/template_functions.inc.php';
$FB = new Facebook(array('appId' => AppInfo::appID(), 'secret' => AppInfo::appSecret(), 'trustForwarded' => true));
$user_id = $FB->getUser();
if ($user_id) {
    try {
        // Fetch the viewer's basic information
        $me = new PATFacebookUser($FB);
        $me->loadFriends('id,name,gender,picture.type(square),bio,installed');
        $my_prefs = $me->getPreferences();
        date_default_timezone_set($my_prefs['user_timezone_name']);
    } catch (FacebookApiException $e) {
        error_log('Failed to set global variable $me.');
        error_log(serialize($e));
        // If the call fails we check if we still have a user. The user will be
        // cleared if the error is because of an invalid accesstoken
        if (!$FB->getAccessToken()) {
            header('Location: ' . AppInfo::getUrl($_SERVER['REQUEST_URI']));
            exit;
        }
    }
}
// Some global variables.
$FBApp = new AppInfo($FB->api('/' . AppInfo::appID()));
$db = new PATFacebookDatabase();
$db->connect(psqlConnectionStringFromDatabaseUrl());
// Links to "help" screens.
define('DOCUMENTATION_URL_BASE', 'https://github.com/meitar/pat-facebook/wiki');
示例#3
0
  </head>
  <body>
    <div id="fb-root" style="display: none;"></div>
	<script type="text/javascript">
		if (typeof PCOM == 'undefined') var PCOM = {};
		window.fbAsyncInit = function() {

			PCOM.share = function(data, extra) {
				var args = {
					method: 'feed',
					name: 'Silver Rhapsody Jewelry Design Giveaway',
					description: "I entered the @SilverRhapsodyDesigns Giveaway to win a TBD.",
					link: 'http://www.facebook.com/SilverRhapsodyDesigns',
					picture: '<?php 
echo AppInfo::getUrl('/images/fbthumb.jpg');
?>
'
				};

				FB.ui(args, null);
			};

			FB.init({
				appId: '<?php 
echo AppInfo::appID();
?>
',
				channelUrl: '//<?php 
echo $_SERVER["HTTP_HOST"];
?>
            $result = pg_query_params($db->getHandle(), 'SELECT DISTINCT reporter_id FROM incidents WHERE reportee_id = $1 AND reporter_id <> $2', array($report->reportee_id, $report->reporter_id));
            // Check those other people's notification preference.
            while ($row = pg_fetch_assoc($result)) {
                $usr = new PATFacebookUser($FB, $row['reporter_id']);
                $prefs = $usr->getPreferences();
                // If their notification preference is on,
                if ($prefs['notify_on_same_reportee']) {
                    $report->setReader($usr);
                    if ($report->isVisible()) {
                        // send each of them a notification.
                        $FB->setAccessToken(getFacebookAppToken());
                        $FB->api("/{$usr->getId()}/notifications", 'post', array('template' => 'More information was shared about someone you previously shared about; click here to read the statement.', 'href' => "reports.php?action=lookup&id={$rid}"));
                    }
                }
            }
            header('Location: ' . AppInfo::getUrl($_SERVER['PHP_SELF'] . "?action=lookup&id={$rid}"));
            exit;
        }
    }
}
?>
<section id="MainContent">
    <h1>Share</h1>
    <?php 
if (!isset($_REQUEST['submit']) && !isset($_REQUEST['submit_clarification']) || isset($_REQUEST['submit_clarification']) && $reportee_id || isset($report)) {
    ?>
    <form id="pat-report-form" method="post" action="<?php 
    print "{$_SERVER['PHP_SELF']}?{$_SERVER['QUERY_STRING']}";
    ?>
">
        <fieldset><legend>Details (<a href="<?php 
示例#5
0
    echo he(idx($basic, 'name'));
    ?>
</strong></h1>
        <p class="tagline">
        Applikasi <a href="<?php 
    echo he(idx($app_info, 'link'));
    ?>
" target="_top"><?php 
    echo he($app_name);
    ?>
</a> di Facebook
		 <div id="share-app">
          <ul>
            <li>
              <a href="#" class="facebook-button" id="postToWall" data-url="<?php 
    echo AppInfo::getUrl();
    ?>
">
                <span class="plus">Share ke dinding</span>
              </a>
            </li>
            <li>
              <a href="#" class="facebook-button apprequests" id="sendRequest" data-message="Test this awesome app">
                <span class="apprequests">Ajakin Teman</span>
              </a>
            </li>
          </ul>
        </div>
		
        </p>
示例#6
0
    <!-- These are Open Graph tags.  They add meta data to your  -->
    <!-- site that facebook uses when your content is shared     -->
    <!-- over facebook.  You should fill these tags in with      -->
    <!-- your data.  To learn more about Open Graph, visit       -->
    <!-- 'https://developers.facebook.com/docs/opengraph/'       -->
    <meta property="og:title" content="<?php 
echo he($app_name);
?>
" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="<?php 
echo AppInfo::getUrl();
?>
" />
    <meta property="og:image" content="<?php 
echo AppInfo::getUrl('/logo.png');
?>
" />
    <meta property="og:site_name" content="<?php 
echo he($app_name);
?>
" />
    <meta property="og:description" content="My first app" />
    <meta property="fb:app_id" content="<?php 
echo AppInfo::appID();
?>
" />

    <script type="text/javascript" src="/javascript/jquery-1.7.1.min.js"></script>

    <script type="text/javascript">
function reportListItem($report)
{
    $title = $report->report_title ? $report->report_title : 'untitled story';
    ?>
        <li><img alt="" src="https://graph.facebook.com/<?php 
    print he($report->reportee_id);
    ?>
/picture" /><a rel="bookmark" href="<?php 
    print he(AppInfo::getUrl('/reports.php') . "?action=lookup&id={$report->id}");
    ?>
">"<span class="pat-report-title"><?php 
    print he($title);
    ?>
</span>", shared on <?php 
    print he(date('F j, Y', strtotime($report->report_date)));
    ?>
</a>.</li>
<?php 
}
                ?>
">
        <input type="hidden" name="reportee_name" value="<?php 
                print he($_REQUEST['reportee_name']);
                ?>
" />
        <?php 
                clarifyReportee($search_results, array('description' => "Please clarify who you're trying to find stories about.", 'next' => $next_search_results_url));
                ?>
    </form>
    <?php 
            } else {
                if ($_REQUEST['submit'] || $_REQUEST['submit_clarification']) {
                    ?>
    <p>No information on this person could be found. Would you like to <a href="<?php 
                    print he(AppInfo::getUrl("/reports.php?action=new&reportee_id={$reportee_id}"));
                    ?>
">share some</a>?</p>
    <?php 
                }
            }
        }
    }
}
?>
    <form id="pat-find-report-form" method="post" action="<?php 
print "{$_SERVER['PHP_SELF']}?action=lookup";
?>
">
        <fieldset><legend>Reportee details</legend>
            <?php 
<?php

require_once 'lib/pat-fb-init.php';
if (!$me) {
    header('Location: ' . AppInfo::getUrl());
    exit;
}
$prefs = $me->getPreferences();
if ($_REQUEST['submit']) {
    $new_prefs = array('notify_on_same_reportee' => $_REQUEST['notify_on_same_reportee'] ? true : false, 'notify_on_friend_reported' => $_REQUEST['notify_on_friend_reported'] ? true : false, 'user_timezone_name' => in_array($_REQUEST['user_timezone_name'], DateTimeZone::listIdentifiers()) ? $_REQUEST['user_timezone_name'] : 'UTC');
    if ($me->savePreferences($new_prefs)) {
        $prefs = $new_prefs;
    }
}
include 'templates/header.php';
?>
<section id="MainContent">
    <form>
        <?php 
if ($prefs === $new_prefs) {
    ?>
<div class="FlashMessage"><p>Your preferences have been saved.</p></div><?php 
}
?>
        <p>Customize how <?php 
print he($FBApp->getAppName());
?>
 behaves for you.</p>
        <fieldset><legend>Notification preferences</legend>
            <p><strong>Send me a Facebook notification whenever&hellip;</strong></p>
            <p><label><input type="checkbox" id="" name="notify_on_same_reportee"
示例#10
0
  <head>
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>projectile » Open Source HTML5 space shooter</title>
    <meta name="description" content="Play this old-school action space shooter right in your browser and see how much you can score!" />
    <meta property="og:title" content="<?php 
echo he($app_name);
?>
" />
    <meta property="og:type" content="game" />
    <meta property="og:url" content="<?php 
echo AppInfo::getUrl();
?>
" />
    <meta property="og:image" content="<?php 
echo AppInfo::getUrl('/assets/images/logo75x75.png');
?>
" />
    <meta property="og:site_name" content="<?php 
echo he($app_name);
?>
" />
    <meta property="og:description" content="Play this old-school action space shooter right in your browser and see how much you can score!" />
    <meta property="fb:app_id" content="<?php 
echo AppInfo::appID();
?>
" />
    <link href="assets/css/default.css" rel="stylesheet" type="text/css">
    <link href="assets/css/facebook.css" rel="stylesheet" type="text/css">
  </head>
  <body>
示例#11
0
		<script src="https://maps.googleapis.com/maps/api/js?key=<?php 
echo AppInfo::mapsKey();
?>
&amp;sensor=false"></script>
	</head>
	<body>
		<div id="fb-root"></div>
		<script>
			window.fbAsyncInit = function() {
				FB.init({
					appId      : '<?php 
echo AppInfo::appID();
?>
',
					channelUrl : '<?php 
echo AppInfo::getUrl('/channel.php');
?>
',
					status     : true,
					cookie     : true,
					xfbml      : true
				});
				FB.Canvas.setAutoGrow();
			};
			(function(d, s, id) {
			  var js, fjs = d.getElementsByTagName(s)[0];
			  if (d.getElementById(id)) return;
			  js = d.createElement(s); js.id = id;
			  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=<?php 
echo AppInfo::appID();
?>