function api_flickr_photos_geo_possibleCorrections() { $photo_id = get_int64("photo_id"); $photo = _api_flickr_photos_geo_get_photo($photo_id); $type = get_str("place_type"); if (!$type) { api_output_error(999, "Missing place type"); } if (!flickr_places_is_valid_placetype($type)) { api_output_error(999, "Invalid place type"); } # TO DO: calculate based on $type $radius = 1.5; $bbox = geo_utils_bbox_from_point($photo['latitude'], $photo['longitude'], $radius, 'km'); $bbox = implode(",", array($bbox[1], $bbox[0], $bbox[3], $bbox[2])); $method = 'flickr.places.placesForBoundingBox'; $args = array('bbox' => $bbox, 'place_type' => $type); $rsp = flickr_api_call($method, $args); if (!$rsp['ok']) { api_output_error(999, "Flickr API error"); } $possible = array(); if ($rsp['rsp']['places']['total']) { foreach ($rsp['rsp']['places']['place'] as $place) { $possible[] = array('woeid' => $place['woeid'], 'placetype' => $place['place_type'], 'name' => $place['_content']); } } $parent = flickr_places_parent_placetype($type); $out = array('place_type' => $type, 'parent_place_type' => $parent, 'places' => $possible); return api_output_ok($out); }
<?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;
<?php include "include/init.php"; loadlib("flickr_photos"); loadlib("flickr_photos_metadata"); loadlib("flickr_photos_permissions"); loadlib("flickr_geo_permissions"); loadlib("flickr_users"); loadlib("flickr_urls"); loadlib("flickr_places"); $photo_id = get_int64("id"); if (!$photo_id) { error_404(); } $photo = flickr_photos_get_by_id($photo_id); if (!$photo['id']) { error_404(); } # This is two things. One, a quick and dirty hack to ensure # that we display a notice if the path alias (on Flickr) has # been taken by a local user. See notes in flickr_users_get_by_url # and note that we are explicitly setting the "do not 404" flag # here. Two, make sure the photo is actually owned by the user # pointed to by the path alias or NSID. (20111203/straup) $flickr_user = flickr_users_get_by_url(0); if ($flickr_user['user_id'] != $photo['user_id']) { error_404(); } if ($photo['deleted']) { $GLOBALS['smarty']->display("page_photo_deleted.txt"); exit;
<?php # # $Id$ # include "include/init.php"; loadlib("export"); loadlib("export_cache"); loadlib("formats"); ################################################################# # # Ensure the user, the sheet and perms # $owner = users_ensure_valid_user_from_url(); $sheet_id = get_int64('sheet_id'); if (!$sheet_id) { error_404(); } $sheet = sheets_get_sheet($sheet_id, $GLOBALS['cfg']['user']['id'], array('load_extent' => 1)); if (!$sheet) { error_404(); } if (!sheets_can_view_sheet($sheet, $GLOBALS['cfg']['user']['id'])) { error_403(); } $is_own = $sheet['user_id'] == $GLOBALS['cfg']['user']['id'] ? 1 : 0; # # Ensure that this is something we can export # $format = get_str('format'); if (!$format) {
<?php # # $Id$ # ################################################################# include "include/init.php"; loadlib("geo_geocode"); ################################################################# $owner = users_ensure_valid_user_from_url(); $more = array('page' => get_int64('page')); $dots = dots_get_dots_for_user($owner, $GLOBALS['cfg']['user']['id'], $more); $smarty->assign_by_ref('owner', $owner); $smarty->assign_by_ref('dots', $dots); // create a simplfied object for js $json_fields = array("id", "sheet_id", "created", "details", "geohash", "is_interactive", "latitude", "longitude", "user_id", "perms", "sheet_id"); if ($dots) { $to_json = array(); foreach ($dots as $dot) { $tmp = array(); foreach ($json_fields as $fi) { if (isset($dot[$fi])) { if ($fi == "details") { $_details = array(); foreach ($dot[$fi] as $de) { $_details[] = array('label' => $de[0]['label'], 'value' => $de[0]['value']); } $tmp[$fi] = $_details; } else { $tmp[$fi] = $dot[$fi]; }
function users_ensure_valid_user_from_url($method = '') { if (strtolower($method) == 'post') { $user_id = post_int64('user_id'); } else { $user_id = get_int64('user_id'); } if (!$user_id) { error_404(); } $user = users_get_by_id($user_id); if (!$user || $user['deleted']) { error_404(); } return $user; }
<?php # # $Id$ # include "include/init.php"; loadlib("geo_geocode"); $owner = users_ensure_valid_user_from_url(); $dot_id = get_int64('dot_id'); if (!$dot_id) { error_404(); } $dot = dots_get_dot($dot_id, $GLOBALS['cfg']['user']['id']); if (!$dot) { error_404(); } if ($dot['deleted']) { $smarty->display("page_dot_deleted.txt"); exit; } if ($dot['user_id'] != $owner['id']) { error_404(); } if (!dots_can_view_dot($dot, $GLOBALS['cfg']['user']['id'])) { error_403(); } $dot['bookends'] = dots_get_bookends_for_dot($dot, $GLOBALS['cfg']['user']['id']); // quickly determine if dot is a magical one $smarty->assign("dot_is_flickr", isset($dot['details']['flickr:id']) && !empty($dot['details']['flickr:id']) ? true : false); $smarty->assign("dot_is_youtube", isset($dot['details']['youtube:id']) && !empty($dot['details']['youtube:id']) ? true : false); $smarty->assign("dot_is_vimeo", isset($dot['details']['vimeo:id']) && !empty($dot['details']['vimeo:id']) ? true : false);
<?php # # $Id$ # include "include/init.php"; loadlib("search_facets"); if (!$GLOBALS['cfg']['enable_feature_search_facets']) { $GLOBALS['smarty']->display("page_search_facets_disabled.txt"); exit; } $user_id = get_int64("u"); $page = get_int32('page'); $more = array('user_id' => $user_id, 'page' => $page); if ($name = get_str('name')) { $values = search_facets_extras_values_by_name($name, $GLOBALS['cfg']['user']['id'], $more); $GLOBALS['smarty']->assign_by_ref("values", $values['rows']); $GLOBALS['smarty']->assign("name", $name); } else { $names = search_facets_by_extras_name($GLOBALS['cfg']['user']['id'], $more); $GLOBALS['smarty']->assign_by_ref("names", $names['rows']); } $GLOBALS['smarty']->display("page_search_facets.txt"); exit;