コード例 #1
0
ファイル: lib.php プロジェクト: kaseya-university/efront
function do_step($from, $to)
{
    global $facebook;
    $conn = get_db_conn();
    mysql_query('INSERT INTO footprints SET `from`=' . $from . ', `time`=' . time() . ', `to`=' . $to, $conn);
    $prints = get_prints($to);
    try {
        // Set Profile FBML
        $fbml = render_profile_action($to, count($prints)) . render_profile_box($to, $prints);
        // start batch operation
        $facebook->api_client->begin_batch();
        $facebook->api_client->profile_setFBML($fbml, $to);
        // Send notification
        // Notice the use of reference '&'
        $result =& $facebook->api_client->notifications_send($to, ' stepped on you.  ' . '<a href="http://apps.facebook.com/footprints/">See all your Footprints</a>.');
        // Publish feed story
        $feed_title = '<fb:userlink uid="' . $from . '" shownetwork="false"/> stepped on <fb:name uid="' . $to . '"/>.';
        $feed_body = 'Check out <a href="http://apps.facebook.com/footprints/?to=' . $to . '">' . '<fb:name uid="' . $to . '" firstnameonly="true" possessive="true"/> Footprints</a>.';
        $facebook->api_client->feed_publishActionOfUser($feed_title, $feed_body);
        // End batch operation. This will actually send queued API call to Facebook in
        // a single HTTP request
        $facebook->api_client->end_batch();
    } catch (Exception $e) {
        error_log($e->getMessage());
    }
    return $prints;
}
コード例 #2
0
ファイル: lib.php プロジェクト: jkinner/ringside
function do_step($from, $to)
{
    global $facebook;
    global $canvas_url;
    $conn = get_db_conn();
    mysql_query('INSERT INTO footprints SET `from`=' . $from . ', `time`=' . time() . ', `to`=' . $to, $conn);
    $prints = get_prints($to);
    try {
        // Set Profile FBML
        $fbml = render_profile_action($to, count($prints)) . render_profile_box($to, $prints);
        $facebook->api_client->profile_setFBML($fbml, $to);
        // Send notification email
        $send_email_url = $facebook->api_client->notifications_send($to, '&nbsp;stepped on you.  ' . '<a href="' . $canvas_url . '/footprints/">See all your Footprints</a>.', '<fb:notif-subject>You have been stepped on...</fb:notif-subject>' . ' stepped on you.  <a href="' . $canvas_url . '/footprints/">See all your Footprints</a>.');
        // Publish feed story
        $feed_title = '<fb:userlink uid="' . $from . '" shownetwork="false"/>&nbsp;stepped on&nbsp;<fb:name uid="' . $to . '"/>.';
        $feed_body = 'Check out <a href="' . $canvas_url . '/footprints/?to=' . $to . '">' . '<fb:name uid="' . $to . '" firstnameonly="true" possessive="true"/> Footprints</a>.';
        $facebook->api_client->feed_publishActionOfUser($feed_title, $feed_body);
    } catch (Exception $e) {
        error_log($e->getMessage());
    }
    if (isset($send_email_url) && $send_email_url) {
        $facebook->redirect($send_email_url . '&next=' . urlencode('?to=' . $to) . '&canvas');
    }
    return $prints;
}
コード例 #3
0
ファイル: index.php プロジェクト: luxurymask/platform
include_once 'lib.php';
// this defines some of your basic setup
include_once 'config.php';
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login();
if (isset($_POST['to'])) {
    $prints_id = (int) $_POST['to'];
    $prints = do_step($user, $prints_id);
} else {
    if (isset($_GET['to'])) {
        $prints_id = (int) $_GET['to'];
    } else {
        $prints_id = $user;
    }
    $prints = get_prints($prints_id);
}
?>
<div style="padding: 10px;">
  <h2>Hi <fb:name firstnameonly="true" uid="<?php 
echo $user;
?>
" useyou="false"/>!</h2><br/>
  <a href="<?php 
echo $facebook->get_add_url();
?>
">Put Footprints in your profile</a>, if you haven't already!
    <form method="post" >
<?php 
if ($prints_id != $user) {
    echo 'Do you want to step on <fb:name uid="' . $prints_id . '"/>?';
コード例 #4
0
ファイル: atlas.php プロジェクト: ndpgroup/fp-legacy
        $i++;
    }
}
$context->sm->assign('print', $print);
$context->sm->assign('isosm', $isOSM);
$context->sm->assign('clone_child', $clone_child);
$context->sm->assign('refresh_child', $refresh_child);
$context->sm->assign('clone_parent', $clone_parent);
$context->sm->assign('refresh_parent', $refresh_parent);
if ($print['selected_page']) {
    $context->sm->assign('pages', array($print['selected_page']));
} else {
    $context->sm->assign('pages', $pages);
}
$query = array("place" => $print['place_woeid']);
$nearby_prints = get_prints($context->db, $context->user, $query, 200);
$nearby_prints = $nearby_prints[0];
if ($nearby_prints) {
    //print var_dump($nearby_prints);
    $rdm_keys = array_rand($nearby_prints, $num_req = 6);
    $rdm_nearby = array();
    foreach ($rdm_keys as $key => $val) {
        $rdm_nearby[] = $nearby_prints[$val];
    }
    $context->sm->assign('nearby_prints', $rdm_nearby);
}
$context->sm->assign('nearby_prints_json', json_encode($nearby_prints));
$context->sm->assign('zoom', $pages[0]['zoom']);
$context->sm->assign('activity', get_print_activity($context->db, $print_id, true));
$context->sm->assign('providers', get_map_providers());
if ($context->type == 'text/html') {
コード例 #5
0
ファイル: atlases.php プロジェクト: ndpgroup/fp-legacy
require_once '../lib/lib.everything.php';
enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']);
$context = default_context(True);
/**** ... ****/
$print_args = array('date' => preg_match('#^\\d{4}-\\d\\d-\\d\\d$#', $_GET['date']) ? $_GET['date'] : null, 'month' => preg_match('#^\\d{4}-\\d\\d$#', $_GET['month']) ? $_GET['month'] : null, 'place' => is_numeric($_GET['place']) ? $_GET['place'] : null, 'user' => preg_match('/^\\w+$/', $_GET['user']) ? $_GET['user'] : null);
// set intial pagination request params
// TODO: globalize prints_per_page
$prints_per_page = 50;
$page_num = 1;
if (isset($_GET['page'])) {
    $page_num = intval($_GET['page']);
}
$pagination_args = array('perpage' => $prints_per_page, 'page' => $page_num);
$title = get_args_title($context->db, $print_args);
// get prints array and pagination object used by get_prints query
list($prints, $pagination_results, $where_clauses) = get_prints($context->db, $context->user, $print_args, $pagination_args);
// get total count of prints
// passing in $print_args array to keep count in sync
$prints_total = get_prints_count($context->db, $where_clauses);
// update pagination results
$pagination_results = get_prints_pagination_display_obj($pagination_results, $prints_total, $print_args);
$users = array();
foreach ($prints as $i => $print) {
    $user_id = $print['user_id'];
    if ($users[$user_id] == null && $user_id != null) {
        $users[$user_id] = get_user($context->db, $user_id);
    }
    $pages = get_print_pages($context->db, $print['id']);
    $prints[$i]['number_of_pages'] = count($pages);
    $prints[$i]['user'] = $users[$user_id];
}
コード例 #6
0
function is_print($record)
{
    $prints = get_prints();
    foreach ($prints as $print) {
        if (strstr(strtolower($record['type']), $print)) {
            return true;
        }
    }
    return false;
}