Exemple #1
0
<?php

include_once 'constants.php';
include_once LIB_PATH . 'moods.php';
include_once LIB_PATH . 'display.php';
$fb = get_fb();
if (!($user = $fb->get_loggedin_user())) {
    $user = $fb->get_canvas_user();
}
$prefill_user = null;
if (isset($_GET['to_user']) && $_GET['to_user'] != $user) {
    // you can't send a smiley to yourself
    $prefill_user = $_GET['to_user'];
}
echo render_header('Send');
if (!$prefill_user) {
    $ret = '<h2>Send a friend a smiley</h2>';
    $ret .= '<form fbtype="multiFeedStory" action="' . ROOT_LOCATION . '/handlers/multiFeedHandler.php">';
    $ret .= '<div class="input_row"> <fb:multi-friend-input /></div>';
    $ret .= render_emoticon_grid(get_other_moods());
    $ret .= '<input type="hidden" id="picked" name="picked" value="-1">' . '<div id="centerbutton" class="buttons"><input type="submit" id="mood" label="Send Smiley"></div>' . '<div id="emoticon"></div>' . '</form></div>';
} else {
    $ret = '<h2>Send <fb:name uid="' . $prefill_user . '" firstnameonly=1 /> a smiley</h2>';
    $ret .= '<form fbtype="multiFeedStory" action="' . ROOT_LOCATION . '/handlers/multiFeedHandler.php">';
    $ret .= render_emoticon_grid(get_other_moods());
    $ret .= '<input type="hidden" id="picked" name="picked" value="-1">' . '<div id="centerbutton" class="buttons"><input type="submit" fbuid="' . $prefill_user . '" id="mood" label="Send Smiley to %n"></div>' . '<div id="emoticon"></div>' . '</form></div>';
}
echo $ret;
Exemple #2
0
<?php

/*
 * newsmiley.php - Create a new feed story
 *
 */
include_once 'constants.php';
include_once LIB_PATH . 'moods.php';
include_once LIB_PATH . 'display.php';
echo render_header('New');
$moods = get_moods();
echo '<h2>' . 'What\'s your mood today?' . '</h2>';
$fb = get_fb();
$set_count = $fb->api_client->data_getUserPreference(2);
if ($set_count > 0) {
    echo "<h3>You've set your mood {$set_count} time" . ($set_count > 1 ? 's' : '') . " in the past.</h3>";
}
$feed_handler = ROOT_LOCATION . '/handlers/feedHandler.php';
echo '<form fbtype="feedStory" action="' . $feed_handler . '">';
$js = 'final(' . FEED_STORY_1 . ',\'' . IMAGE_LOCATION . '\', \'http://apps.new.facebook.com/' . APP_SUFFIX . '\', \'' . ROOT_LOCATION . '\',';
echo render_emoticon_grid(get_moods(), $js);
echo '<input type="hidden" id="picked" name="picked" value="-1">' . '<div id="emoticon"></div>' . '</form></div>';
echo render_footer();
<?php

/*
 * otherPublishHandler.php -  Handler for the publish interface on friends feed
 *
 */
include_once '../constants.php';
include_once LIB_PATH . 'moods.php';
include_once LIB_PATH . 'display.php';
$moods = get_other_moods();
if ($_POST['method'] == 'publisher_getFeedStory') {
    $picked = $_POST['app_params']['picked'];
    $image = IMAGE_LOCATION . '/smile' . $picked . '.jpg';
    $images = array(array('src' => $image, 'href' => 'http://apps.facebook.com/' . APP_SUFFIX));
    $feed = array('template_id' => FEED_STORY_2, 'template_data' => array('emote' => $moods[$picked][1], 'emoteaction' => $moods[$picked][0]));
    // The response to publisher_getFeedStory
    $data = array('method' => 'publisher_getFeedStory', 'content' => array('feed' => $feed));
} else {
    array_pop($moods);
    $ret = render_handler_css();
    $ret .= render_handler_js();
    $ret .= '<form >' . render_emoticon_grid($moods) . '<input type="hidden" id="picked" name="picked" value="-1">' . '</form>';
    // The reponse to publisher_getInterface
    $data = array('content' => array('fbml' => $ret, 'publishEnabled' => false, 'commentEnabled' => false), 'method' => 'publisher_getInterface');
}
echo json_encode($data);