Beispiel #1
0
function get_post($time, $type, $postid, $userid)
{
    global $db, $current_user, $events, $last_timestamp, $foo_link, $max_items;
    $event = $db->get_row("select user_login, post_user_id, post_content from posts, users where post_id = {$postid} and user_id={$userid}");
    if (!$event) {
        return;
    }
    // Dont show her notes if the user ignored
    if ($type == 'post' && friend_exists($current_user->user_id, $userid) < 0) {
        return;
    }
    $json['link'] = post_get_base_url($event->user_login) . "/{$postid}";
    $json['ts'] = $time;
    $json['type'] = $type;
    $json['who'] = addslashes($event->user_login);
    $json['status'] = _('nótame');
    $json['title'] = addslashes(text_to_summary($event->post_content, 130));
    $json['votes'] = 0;
    $json['com'] = 0;
    $json['uid'] = $userid;
    $json['id'] = $postid;
    if ($userid > 0) {
        $json['icon'] = get_avatar_url($userid, -1, 20);
    }
    $key = $time . ':' . $type . ':' . $postid;
    $events[$key] = json_encode_single($json);
    if ($time > $last_timestamp) {
        $last_timestamp = $time;
    }
}
Beispiel #2
0
function friend_teaser($from, $to)
{
    if ($from == $to) {
        return '';
    }
    switch (friend_exists($from, $to)) {
        case 0:
            return FRIEND_NO;
        case 1:
            return FRIEND_YES;
        case -1:
            return FRIEND_IGNORE;
    }
}