function import_flickr_url($url, $more = array())
{
    list($type, $uid) = import_flickr_url_type($url);
    # photosets
    if ($type == "set") {
        $rows = import_flickr_photoset($uid, $more);
        return array('ok' => 1, 'data' => $rows);
    }
    # groups
    if ($type == "group") {
        $group_id = $uid;
        if (!preg_match("!\\@N\\d+\$!", $group_id)) {
            $group_id = flickr_lookup_group_id_by_url($url);
        }
        if (!$group_id) {
            return array('ok' => 0, 'error' => 'Invalid group ID');
        }
        $rows = import_flickr_group_pool($group_id, $more);
        return array('ok' => 1, 'data' => $rows);
    }
    # individual users
    if ($type == "user") {
        $user_id = $uid;
        if (!preg_match("!\\@N\\d+\$!", $user_id)) {
            $user_id = flickr_lookup_user_id_by_url($url);
        }
        if (!$user_id) {
            return array('ok' => 0, 'error' => 'Invalid user ID');
        }
        $rows = import_flickr_user($user_id, $more);
        return array('ok' => 1, 'data' => $rows);
    }
    # for example:
    # http://api.flickr.com/services/feeds/geo/?id=35034348999@N01&lang=en-us
    if ($type == "feed") {
        $more = array('assume_mime_type' => 'application/rss+xml');
        $upload = import_fetch_uri($url, $more);
        if ($upload['ok']) {
            $upload = import_process_file($upload);
        }
        return $upload;
    }
    # yahoo says no
    return array('ok' => 0, 'error' => 'Failed to parse URL');
}
Example #2
0
 #
 $more = array();
 if ($mime_type = post_str('mime_type')) {
     $more['assume_mime_type'] = $mime_type;
 }
 if ($is_flickr) {
     $upload = import_flickr_url($url, $more);
     if ($upload['ok'] && !count($upload['data'])) {
         $upload = array('ok' => 0, 'error' => 'Dotspotting was unable to retrieve any geotagged photos from Flickr!');
     }
 } else {
     if ($is_google) {
         $more['assume_mime_type'] = 'application/vnd.google-earth.kml+xml';
         $upload = import_fetch_uri($url, $more);
     } else {
         $upload = import_fetch_uri($url, $more);
     }
 }
 if (!$upload['ok']) {
     $GLOBALS['error']['upload_by_url_error'] = 1;
     $GLOBALS['error']['details'] = $upload['error'];
     $GLOBALS['smarty']->display('page_upload3.txt');
     exit;
 }
 #
 # Okay, now process the file
 #
 if ($is_flickr) {
     // not entirely sure about this, there are many flickr cases (seanc | 07072011)
     $upload = import_preprocess_address_fields($upload);
     $pre_process = $upload;
Example #3
0
function import_import_uri(&$user, $uri, $more = array())
{
    $upload = import_fetch_uri($uri, $more);
    if (!$upload['ok']) {
        return $upload;
    }
    return import_import_file($user, $upload, $more);
}