예제 #1
0
$use_theme = 'Beta';
$login_required = FALSE;
include "../includes/page.php";
require_once "{$path_prefix}/api/Cache/Cache.php";
require_once "{$path_prefix}/web/Flickrclient.php";
session_write_close();
// close session and release lock, so other scripts can run at the same time as this one
$flickr_id = $_GET['flickr_id'];
// hold any errors we get
$flickr_errors = array();
// get links from cache if possible, otherwise fetch and store
$cache_key = "flickr_pics:{$flickr_id}";
$pics = Cache::getExtCache(0, $cache_key);
if ($pics === NULL) {
    $flickr = new Flickrclient();
    // first, see if we know the user's nsid.
    $cache_nsid_key = "flickr_nsid:{$flickr_id}";
    $nsid = Cache::getExtCache(0, $cache_nsid_key);
    if ($nsid === NULL) {
        $user_errors = array();
        // don't have it.  first see if $flickr_id is an e-mail address.
        if (strpos($flickr_id, "@") !== FALSE) {
            // it could possibly be an e-mail address, so pass it to flickr and try to get the nsid.
            try {
                $nsid = $flickr->people_findByEmail($flickr_id);
            } catch (PAException $e) {
                if ($e->getCode() != REMOTE_ERROR) {
                    throw $e;
                }
                $user_errors[] = "<b>By e-mail address</b>: " . htmlspecialchars($e->getMessage());
예제 #2
0
<?php

/*
This script has the sole purpose of generating
a current Flickt Auth URL, cmplete with frob etc
*/
require_once dirname(__FILE__) . '/../../config.inc';
require_once "{$path_prefix}/web/Flickrclient.php";
$client = new Flickrclient();
$frob = $client->auth_getFrob();
$flickr_auth_url = $client->make_auth_url($frob, "write");
header("Location: {$flickr_auth_url}");
exit(0);