function api_flickr_photos_friends_faves()
{
    if (!$GLOBALS['cfg']['enable_feature_flickr_push']) {
        api_output_error(999, "disabled");
    }
    if (!$GLOBALS['cfg']['flickr_push_enable_photos_friends_faves']) {
        api_output_error(999, "disabled");
    }
    $topic_map = flickr_push_topic_map("string keys");
    $topic_id = $topic_map["contacts_faves"];
    $sub = flickr_push_subscriptions_get_by_user_and_topic($GLOBALS['cfg']['user'], $topic_id);
    if (!$sub) {
        api_output_error(999, "no subscription");
    }
    $older_than = get_int32("older_than");
    $rsp = flickr_push_photos_for_subscription($sub, $older_than);
    if (!$rsp['ok']) {
        api_output_error(999, $rsp['error']);
    }
    $out = array('photos' => $rsp['rows']);
    $more = array('inline' => 1);
    api_output_ok($out, $more);
}
    error_404();
}
$crumb_key = "delete_feed";
$GLOBALS['smarty']->assign("crumb_key", $crumb_key);
if (post_str("delete") && crumb_check($crumb_key)) {
    $feed_rsp = flickr_push_unsubscribe($sub);
    $GLOBALS['smarty']->assign("delete_feed", $feed_rsp);
    if ($feed_rsp['ok']) {
        $sub_rsp = flickr_push_subscriptions_delete($sub);
        $GLOBALS['smarty']->assign("delete_sub", $sub_rsp);
        if ($sub_rsp['ok']) {
            $redir = "{$GLOBALS['cfg']['abs_root_url']}god/push/subscriptions/{$sub['user_id']}/";
            header("location: {$redir}");
            exit;
        }
    }
}
$topic_map = flickr_push_topic_map();
$sub['str_topic'] = $topic_map[$sub['topic_id']];
if ($sub['last_update_details']) {
    $sub['last_update_details'] = json_decode($sub['last_update_details'], "as hash");
}
$owner = users_get_by_id($sub['user_id']);
$sub['owner'] = $owner;
$photos = flickr_push_photos_for_subscription($sub);
$is_push_backup = flickr_push_subscriptions_is_push_backup($sub);
$GLOBALS['smarty']->assign("is_push_backup", $is_push_backup);
$GLOBALS['smarty']->assign_by_ref("subscription", $sub);
$GLOBALS['smarty']->assign_by_ref("photos", $photos['rows']);
$GLOBALS['smarty']->display("page_god_push_subscription.txt");
exit;
error_disabled();
if (!$GLOBALS['cfg']['enable_feature_flickr_push']) {
    error_disabled();
}
if (!$GLOBALS['cfg']['flickr_push_enable_recent_activity']) {
    error_disabled();
}
$topic_map = flickr_push_topic_map("string keys");
$topic_id = $topic_map["my_photos"];
$topic_args = array('update_type' => 'comments,faves,tags,notes');
$sub = flickr_push_subscriptions_get_by_user_and_topic($GLOBALS['cfg']['user'], $topic_id, $topic_args);
$GLOBALS['smarty']->assign_by_ref("subscription", $sub);
dumper($sub);
if (!$sub) {
    if (!$GLOBALS['cfg']['flickr_push_enable_registrations']) {
        error_disabled();
    }
    $sub = array('user_id' => $GLOBALS['cfg']['user']['id'], 'topic_id' => $topic_id, 'topic_args' => $topic_args);
    $rsp = flickr_push_subscriptions_register_subscription($sub);
    dumper($rsp);
    $GLOBALS['smarty']->assign("new_subscription", $rsp['ok']);
    $GLOBALS['smarty']->assign("subscription_ok", $rsp['ok']);
} else {
    $now = time();
    $offset_hours = 24;
    $older_than = $now - 60 * 60 * $offset_hours;
    $rsp = flickr_push_photos_for_subscription($sub, $older_than);
    dumper($rsp);
}
$GLOBALS['smarty']->display("page_flickr_photos_user_recent_activity.txt");
exit;
include "include/init.php";
loadlib("flickr_users");
loadlib("flickr_push");
loadlib("flickr_push_subscriptions");
loadlib("flickr_push_photos");
login_ensure_loggedin("/photos/friends/faves/");
if (!$GLOBALS['cfg']['enable_feature_flickr_push']) {
    error_disabled();
}
if (!$GLOBALS['cfg']['flickr_push_enable_photos_friends_faves']) {
    error_disabled();
}
$topic_map = flickr_push_topic_map("string keys");
$topic_id = $topic_map["contacts_faves"];
$sub = flickr_push_subscriptions_get_by_user_and_topic($GLOBALS['cfg']['user'], $topic_id);
$GLOBALS['smarty']->assign_by_ref("subscription", $sub);
if (!$sub) {
    if (!$GLOBALS['cfg']['flickr_push_enable_photos_registrations']) {
        error_disabled();
    }
    $sub = array('user_id' => $GLOBALS['cfg']['user']['id'], 'topic_id' => $topic_id);
    $rsp = flickr_push_subscriptions_register_subscription($sub);
    $GLOBALS['smarty']->assign("new_subscription", $rsp['ok']);
    $GLOBALS['smarty']->assign("subscription_ok", $rsp['ok']);
} else {
    $rsp = flickr_push_photos_for_subscription($sub, $limit);
    $GLOBALS['smarty']->assign_by_ref("photos", $rsp['rows']);
}
$GLOBALS['smarty']->display("page_flickr_photos_friends_faves.txt");
exit;