function flickr_push_subscriptions_is_push_backup(&$subscription) { loadlib("flickr_backups"); $owner = users_get_by_id($subscription['user_id']); if (!flickr_backups_is_registered_user($owner)) { return 0; } if (!flickr_backups_is_registered_subscription($subscription)) { return 0; } return 1; }
<?php include "include/init.php"; loadlib("flickr_users"); loadlib("flickr_photos"); loadlib("flickr_backups"); loadlib("flickr_photos_utils"); loadlib("flickr_urls"); loadlib("flickr_dates"); # $flickr_user = flickr_users_get_by_url(); $owner = users_get_by_id($flickr_user['user_id']); $is_own = $owner['id'] == $GLOBALS['cfg']['user']['id'] ? 1 : 0; $GLOBALS['smarty']->assign("is_own", $is_own); $is_registered = flickr_backups_is_registered_user($owner); $GLOBALS['smarty']->assign("is_registered", $is_registered); # $more = array('page' => get_int32("page"), 'viewer_id' => $GLOBALS['cfg']['user']['id']); $with = get_int64('with'); if ($with) { $more['with'] = $with; } $rsp = flickr_photos_for_user($owner, $more); $photos = $rsp['rows']; flickr_photos_utils_assign_can_view_geo($photos, $GLOBALS['cfg']['user']['id']); $GLOBALS['smarty']->assign_by_ref("owner", $owner); $GLOBALS['smarty']->assign_by_ref("photos", $photos); $pagination_url = flickr_urls_photos_user($owner); $GLOBALS['smarty']->assign("pagination_url", $pagination_url); $GLOBALS['smarty']->display("page_flickr_photos_user.txt"); exit;
} else { error_404(); } } echo get_str("challenge"); exit; } # TO DO: check $subscription['topic_id'] here against # the 'flickr_push_enable_*' flags (20111203/straup) $xml = file_get_contents('php://input'); $atom = syndication_atom_parse_str($xml); $user = users_get_by_id($subscription['user_id']); $flickr_user = flickr_users_get_by_user_id($user['id']); $do_push_backups = features_is_enabled("flickr_push_backups"); $is_push_backup = flickr_push_subscriptions_is_push_backup($subscription); $is_backup_user = flickr_backups_is_registered_user($user, "ensure enabled"); $to_backup = array(); $new = 0; foreach ($atom->items as $e) { # for debugging... # $fh = fopen("/tmp/wtf.json", "w"); # fwrite($fh, json_encode($e)); # fclose($fh); # TO DO: check $subscription['topic_id'] here because # at some point if we start to use the push stuff to # track things we're backing we'll need to store the # data in another table (20111203/straup) if (!preg_match("!.*/(\\d+)\$!", $e['id'], $m)) { continue; } $photo_id = $m[1];
include "../include/init.php"; loadlib("god"); features_ensure_enabled("flickr_push"); loadlib("flickr_backups"); loadlib("flickr_push"); loadlib("flickr_push_subscriptions"); $topic_map = flickr_push_subscriptions_topic_map(); $GLOBALS['smarty']->assign_by_ref("topic_map", $topic_map); if ($user_id = get_int32("user_id")) { $owner = users_get_by_id($user_id); if (!$owner) { error_404(); } $GLOBALS['smarty']->assign_by_ref("owner", $owner); } $is_backup_user = $owner && flickr_backups_is_registered_user($owner) ? 1 : 0; $GLOBALS['smarty']->assign("is_backup_user", $is_backup_user); if ($is_backup_user) { $crumb_key = "create_feed"; $GLOBALS['smarty']->assign("crumb_key", $crumb_key); if (post_str("create") && crumb_check($crumb_key)) { $topic_id = post_int32("topic_id"); if (flickr_push_subscriptions_is_valid_topic_id($topic_id)) { # HEY LOOK! THIS STILL DOESN'T DEAL WITH FEEDS THAT # NEED OR HAVE TOPIC ARGS (20120605/straup) # As a practical matter that just means that the # API call to register a subscription with # 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