Ejemplo n.º 1
0
include "../include/init.php";
loadlib("god");
features_ensure_enabled("flickr_push");
loadlib("flickr_push");
loadlib("flickr_backups");
loadlib("flickr_push_photos");
loadlib("flickr_push_subscriptions");
$id = get_int32("id");
$sub = flickr_push_subscriptions_get_by_id($id);
if (!$sub) {
    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");
function flickr_push_subscriptions_remove_subscription($subscription, $force = 0)
{
    $flickr_rsp = flickr_push_unsubscribe($subscription);
    if (!$flickr_rsp['ok'] && !$force) {
        return $flickr_rsp;
    }
    $rsp = flickr_push_subscriptions_delete($subscription);
    if ($rsp['ok']) {
        _flickr_push_subscriptions_purge_cache_keys($subscription);
    }
    return $rsp;
}