Ejemplo n.º 1
0
    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;
            # Flickr will fail. Since we're already
            # disabling these topics at the template layer I
            # am less inclined to also check here. If
            # someone is passing args that means they're
            # just doofing around and well, you know,
            # whatever... (20120612/straup)
            $sub = array('user_id' => $owner['id'], 'topic_id' => $topic_id);
            $rsp = flickr_push_subscriptions_register_subscription($sub);
            $GLOBALS['smarty']->assign_by_ref("create_sub", $rsp);
        }
    }
}
$more = array();
if ($page = get_int32("page")) {
    $more['page'] = $page;
}
if ($owner) {
    $rsp = flickr_push_subscriptions_get_subscriptions_for_user($owner, $more);
} else {
    $rsp = flickr_push_subscriptions_get_subscriptions($more);
}
$subs = array();
foreach ($rsp['rows'] as $row) {
    $row['owner'] = users_get_by_id($row['user_id']);
    $row['str_topic'] = $topic_map[$row['topic_id']]['label'];
    $row['is_push_backup'] = flickr_push_subscriptions_is_push_backup($row);
    $subs[] = $row;
}
$GLOBALS['smarty']->assign_by_ref("subscriptions", $subs);
$GLOBALS['smarty']->display("page_god_push_subscriptions.txt");
exit;