예제 #1
0
include "include/init.php";
loadlib("flickr_users");
loadlib("flickr_photos");
loadlib("flickr_faves");
loadlib("flickr_urls");
loadlib("flickr_dates");
#
$viewer = $GLOBALS['cfg']['user'];
$flickr_user = flickr_users_get_by_url();
$owner = users_get_by_id($flickr_user['user_id']);
$is_own = $owner['id'] == $viewer['id'] ? 1 : 0;
$GLOBALS['smarty']->assign("is_own", $is_own);
#
$more = array('viewer_id' => $viewer['id'], 'page' => get_int32("page"));
if ($by_alias = get_str("by_alias")) {
    if ($by_flickr_user = flickr_users_get_by_path_alias($by_alias)) {
        $more['by_owner'] = users_get_by_id($by_flickr_user['user_id']);
    }
} else {
    if ($by_nsid = get_str("by_nsid")) {
        if ($by_flickr_user = flickr_users_get_by_nsid($by_nsid)) {
            $more['by_owner'] = users_get_by_id($by_flickr_user['user_id']);
        }
    } else {
    }
}
$by_owner = isset($more['by_owner']) ? $more['by_owner'] : null;
$faves = flickr_faves_for_user($owner, $more);
$photos = array();
foreach ($faves['rows'] as $f) {
    $photo = flickr_photos_get_by_id($f['photo_id']);
<?php

include "include/init.php";
loadlib("flickr_photos_archives");
loadlib("flickr_photos_utils");
loadlib("dates_utils");
$year = get_int32("year");
if (!$year) {
    error_404();
}
if ($path = get_str("path")) {
    $flickr_user = flickr_users_get_by_path_alias($path);
} else {
    if ($nsid = get_str("nsid")) {
        $flickr_user = flickr_users_get_by_nsid($nsid);
    }
}
if (!$flickr_user) {
    error_404();
}
$owner = users_get_by_id($flickr_user['user_id']);
$is_own = $owner['id'] == $GLOBALS['cfg']['user']['id'] ? 1 : 0;
$GLOBALS['smarty']->assign_by_ref("owner", $owner);
$GLOBALS['smarty']->assign("is_own", $is_own);
$more = array('viewer_id' => $GLOBALS['cfg']['user']['id'], 'page' => get_int32("page"));
$user_context = get_str("context");
$user_context = $user_context == 'posted' ? 'posted' : 'taken';
$GLOBALS['smarty']->assign("context", $user_context);
$more['context'] = $user_context;
$rsp = flickr_photos_archives_for_user_and_year($owner, $year, $more);
$photos = $rsp['rows'];
예제 #3
0
function flickr_users_get_by_url($error_404 = 1)
{
    $path = get_str("path");
    $nsid = get_str("nsid");
    if ($path && $GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
        loadlib("flickr_users_path_aliases");
        $alias = flickr_users_path_aliases_get_by_alias($path);
        if ($alias && $alias['redirect_to']) {
            $new_path = urlencode($alias['redirect_to']);
            $redir = str_replace($path, $new_path, $_SERVER['REQUEST_URI']);
            header("location: {$redir}");
        }
    }
    if ($path) {
        $flickr_user = flickr_users_get_by_path_alias($path);
        # see also: notes in flickr_users_create_user()
        # see also: inc_path_alias_conflict.txt
        if ($flickr_user && $GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
            $other_flickr_user = _flickr_users_get_by_path_alias($path);
            $other_user = users_get_by_id($other_flickr_user['user_id']);
            $GLOBALS['smarty']->assign("path_alias_conflict", 1);
            $GLOBALS['smarty']->assign_by_ref("path_alias_other_user", $other_user);
            $GLOBALS['smarty']->assign_by_ref("path_alias_other_flickr_user", $other_flickr_user);
        }
    } else {
        if ($nsid) {
            $flickr_user = flickr_users_get_by_nsid($nsid);
        }
    }
    if (!$flickr_user && $error_404) {
        error_404();
    }
    return $flickr_user;
}