Example #1
0
 function get_user_events($criteria = array())
 {
     $id = $criteria['id'];
     $connection = 'events';
     $content = parent::get_fb_api_results(array('object' => $id, 'connection' => $connection));
     $content = $this->format_fb_events($content);
     return $content;
 }
Example #2
0
 function getUsersListByBirthday()
 {
     $f1 = new Fb_ypbox();
     $data = $f1->get_fb_api_results(array('object' => 'me', 'connection' => 'friends?fields=id,name,username,birthday,gender'));
     $users_list = $this->formatBirthdays($data);
     //Get array of next birthdays
     //Returned values: user_id => next birthday timestamp
     if (count($users_list) > 0) {
         $i = 0;
         foreach ($users_list as $value) {
             $birthday = strtotime(date('Y') . '/' . $value['month'] . '/' . $value['day']);
             $now = time() - 36000;
             //echo date('Y-m-d H:i:s', $now);
             if ($now >= $birthday) {
                 $birthday = strtotime(date('Y') + 1 . '/' . $value['month'] . '/' . $value['day']);
                 $coming_birthdays[$value['id']] = $birthday;
             } else {
                 $coming_birthdays[$value['id']] = $birthday;
             }
         }
     }
     asort($coming_birthdays);
     //Get array of all the birthdays of the year
     //Returned values: user_id => birthday timestamp
     if (count($users_list) > 0) {
         $i = 0;
         foreach ($users_list as $value) {
             $birthday = strtotime(date('Y') . '-' . $value['month'] . '-' . $value['day']);
             $ordered_birthdays[$value['id']] = $birthday;
         }
     }
     asort($ordered_birthdays);
     //print_r($coming_birthdays);
     //Order users list by birthday date (January to December)
     if (count($ordered_birthdays) > 0) {
         foreach ($ordered_birthdays as $ind => $value) {
             $tmpTab[$ind] = $users_list[$ind];
         }
     }
     $users_list = $tmpTab;
     $data['users_list'] = $users_list;
     $data['coming_birthdays'] = $coming_birthdays;
     $data['users_by_month_birthday'] = $this->getUsersByMonthBirthday($users_list);
     return $data;
 }
Example #3
0
 function get_gallery_images($criteria = array())
 {
     $gallery_id = $criteria['gallery_id'];
     $token = $criteria['token'];
     $limit = $criteria['limit'];
     if ($gallery_id != '') {
         $results = parent::get_fb_api_results(array('connection' => 'photos', 'object' => $gallery_id, 'token' => $token, 'limit' => $limit));
     }
     return $results;
 }
Example #4
0
<?php

$token = $_POST['token'];
$url = $_POST['url'];
if ($url != '') {
    $f1 = new Fb_ypbox();
    $data = $f1->getDataFromUrl($url);
    $data = json_decode($data, true);
} else {
    $f1 = new Fb_ypbox();
    $data = $f1->get_fb_api_results(array('object' => $id, 'connection' => 'taggable_friends', 'token' => $token));
}
//print_r($data);
$friends = $data['data'];
if ($url == '' && count($friends) > 0) {
    echo '<div><h3>' . count($friends) . ' friends</h3></div>';
}
for ($i = 0; $i < count($friends); $i++) {
    $id = $friends[$i]['id'];
    $name = $friends[$i]['name'];
    $image = $friends[$i]['picture']['data']['url'];
    echo '<div style="position:relative; overflow:hidden;">';
    echo '<img src="' . $image . '" style="margin-right:10px; margin-bottom:10px; float:left;">';
    echo '<div>' . $name . '</div>';
    echo '<span style="position:absolute; right:0px; top:15px;">';
    echo '</span>';
    echo '</div>';
    echo '<hr style="margin-top:0px; margin-bottom:5px;">';
}
if ($data['paging']['next'] != '') {
    echo '<div id="displayMoreFriendsBox"><a href="#" class="loadMoreFriendsBtn btn" data-url="' . $data['paging']['next'] . '" class="btn">Load more</a></div>';
Example #5
0
$fb_ids = $_POST['fb_ids'];
$twt_ids = $_POST['twt_ids'];
$status = $_POST['status'];
$link = $_POST['link'];
$image = $_POST['image'];
$twt_status = $_POST['twt_status'];
$created = date('Y-m-d H:i:s');
if (is_admin() && $GLOBALS['demo_mode'] != 1) {
    if ($fb_ids != '') {
        $users = getUsers(array('type_id' => 1));
        $tokensTab = array();
        for ($i = 0; $i < count($users); $i++) {
            $tokensTab[$users[$i]['user_id']]['token'] = $users[$i]['token'];
            $tokensTab[$users[$i]['user_id']]['name'] = $users[$i]['name'];
        }
        $f1 = new Fb_ypbox();
        $fb_idsTab = explode(',', $fb_ids);
        $nb_fb_updates = 0;
        for ($i = 0; $i < count($fb_idsTab); $i++) {
            $fb_user_id = $fb_idsTab[$i];
            $token = $tokensTab[$fb_user_id]['token'];
            $name = $tokensTab[$fb_user_id]['name'];
            //update
            if ($token != '') {
                $result = $f1->updateFacebookStatus(array('fb_id' => $fb_user_id, 'message' => $status, 'link' => $link, 'picture' => $image), $token);
                $result = json_decode($result, true);
            }
            if ($result['id'] != '') {
                $message = '';
                $message_id = $result['id'];
                $nb_fb_updates++;
Example #6
0
<?php

$post_id = $_POST['post_id'];
$comment = $_POST['comment'];
$user_id = $_POST['user_id'];
$name = $_POST['name'];
$token = $_POST['token'];
$created = date('Y-m-d') . 'T' . date('H:i:s') . 'Z';
//$pos = strpos($post_id, '_');
//$post_id = substr($post_id, ($pos+1));
$f1 = new Fb_ypbox();
$postParms = 'access_token=' . $token . '&message=' . $comment;
$url = 'https://graph.facebook.com/' . $post_id . '/comments';
$results = $f1->postDataToURL($url, $postParms);
$results = json_decode($results, true);
if ($results['id'] != '') {
    $d1 = new Fb_ypbox_display();
    $criteria2['userid'] = $user_id;
    $criteria2['name'] = $name;
    $criteria2['comment'] = $comment;
    $criteria2['created'] = $created;
    $display = $d1->displaySingleComment($criteria2);
    echo $display;
} else {
    echo '<div>The Facebook API didn\'t allow adding this comment to this post</div>';
}
Example #7
0
<?php

$id = $_POST['id'];
$feed = $_POST['feed'];
$token = $_POST['token'];
$url = $_POST['url'];
$connected_user_id = $_POST['connected_user_id'];
//tell if a user is connected or no
$f1 = new Fb_ypbox();
if ($url != '') {
    $data = $f1->getDataFromUrl($url);
    $data = json_decode($data, true);
} else {
    $data = $f1->get_fb_api_results(array('object' => $id, 'connection' => $feed, 'token' => $token));
}
/*
$page_data = $f1->get_fb_api_results(array('object'=>$id, 'token'=>$token));	
echo 'Likes: <b>'.$page_data['likes'].'</b><br>';
echo 'Talking about this: <b>'.$page_data['talking_about_count'].'</b><br>';
echo 'New likes: <b>'.$page_data['new_like_count'].'</b><br>';
if($page_data['description']!='') echo 'Description: '.$page_data['description'].'<br>';
//print_r($page_data);
*/
$d1 = new Fb_ypbox_display();
$posts = $d1->formatFacebookPosts($data);
$d1->displayTimeline(array('posts' => $posts, 'user_id' => $id, 'connected_user_id' => $connected_user_id));
if ($data['paging']['next'] != '') {
    echo '<a href="#" id="loadMorePosts" data-url="' . $data['paging']['next'] . '" class="btn btn-primary">Load more</a>';
}
<?php

$token = $_POST['token'];
$f1 = new Fb_ypbox();
$data = $f1->get_fb_api_results(array('object' => 'me', 'connection' => 'friends?fields=id,name,username,birthday', 'token' => $token));
//echo count($data['data']).'<br>';
$data = formatBirthdays($data);
print_r($data);
Example #9
0
<?php

$post_id = $_POST['post_id'];
$url = $_POST['url'];
$token = $_POST['token'];
if ($url != '') {
    $f1 = new Fb_ypbox();
    $data = $f1->getDataFromUrl($url);
    $data = json_decode($data, true);
} else {
    $f1 = new Fb_ypbox();
    $data = $f1->get_fb_api_results(array('object' => $post_id, 'connection' => 'comments', 'token' => $token));
}
//print_r($data);
if (count($data['data']) > 0) {
    $d1 = new Fb_ypbox_display();
    $comments = $d1->displayComments(array('comments' => $data['data'], 'post_id' => $post_id));
    echo $comments;
    if ($data['paging']['next'] != '') {
        echo '<div style="background: #f5f5f5; padding:5px; margin:3px;" class="moreCommentsBox">';
        echo '<a href="#" class="loadMoreCommentsBtn" data-url="' . $data['paging']['next'] . '" class="btn">Load more comments</a>';
        echo '</div>';
    }
}
Example #10
0
<script type="text/javascript" src="include/js/json2.js"></script>

<script> 
jQuery(document).ready(function() {
	<?php 
echo $jsOnReady;
?>
})
</script>

</head>

<body>

<?php 
$f1 = new Fb_ypbox();
$f1->loadJsSDK();
$f1->load_js_functions();
?>

<div class="container">
	<h1 style="margin-bottom:5px;">Social Publisher</h1>
	<span style="color: #666;">Save time and manage your different social accounts from one place!</span>
	<hr>
	
	<?php 
if ($GLOBALS['demo_mode'] == 1) {
    ?>
		<div class="yellowBox">
			Please note that the delete / add account / and publishing features has been <b>disabled in this demo</b>
		</div>