/
flickr_photos_user_archives_day.php
98 lines (69 loc) · 2.5 KB
/
flickr_photos_user_archives_day.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
include("include/init.php");
loadlib("flickr_photos_archives");
loadlib("flickr_photos_utils");
$year = get_int32("year");
$month = get_str("month");
$day = get_str("day");
if ((! $year) || (! $month) || (! $day)){
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_day($owner, $year, $month, $day, $more);
$photos = $rsp['rows'];
$months = dates_utils_months();
$GLOBALS['smarty']->assign_by_ref("months", $months);
flickr_photos_utils_assign_can_view_geo($photos, $GLOBALS['cfg']['user']['id']);
$user_days = flickr_photos_archives_days_for_user($owner, $year, $month, $more);
$count_days = count($user_days);
for ($i=0; $i < $count_days; $i++){
if ($user_days[$i] != $day){
continue;
}
$next_day = $user_days[$i+1];
$previous_day = $user_days[$i-1];
break;
}
$GLOBALS['smarty']->assign("next_day", $next_day);
$GLOBALS['smarty']->assign("previous_day", $previous_day);
$ymd = implode("-", array($year, $month, $day));
if (! $previous_day){
if ($previous_ymd = flickr_photos_archives_previous_date_for_user($owner, $ymd, $more)){
$GLOBALS['smarty']->assign("previous", explode("-", $previous_ymd));
}
}
if (! $next_day){
if ($next_ymd = flickr_photos_archives_next_date_for_user($owner, $ymd, $more)){
$GLOBALS['smarty']->assign("next", explode("-", $next_ymd));
}
}
$GLOBALS['smarty']->assign_by_ref("photos", $photos);
$pagination_url = flickr_urls_photos_user_archives($owner, $user_context);
$pagination_url .= "{$year}/{$month}/{$day}/";
$GLOBALS['smarty']->assign("pagination_url", $pagination_url);
$GLOBALS['smarty']->assign("year", $year);
$GLOBALS['smarty']->assign("month", $month);
$GLOBALS['smarty']->assign("day", $day);
$GLOBALS['smarty']->display("page_flickr_photos_user_archives_day.txt");
exit();
?>