forked from MightyGorgon/icy_phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalbum.php
More file actions
260 lines (225 loc) · 7.93 KB
/
album.php
File metadata and controls
260 lines (225 loc) · 7.93 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*
* @Extra credits for this file
* Smartor (smartor_xp@hotmail.com)
*
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
// Get general album information
include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);
// ------------------------------------
// Check $album_user_id
// ------------------------------------
$album_user_id = request_var('user_id', 0);
if (empty($album_user_id))
{
// if no user_id was supplied then we aren't going to show a personal gallery category
$album_user_id = ALBUM_PUBLIC_GALLERY;
}
if ($album_user_id != ALBUM_PUBLIC_GALLERY)
{
$mode = request_var('mode', '', true);
$album_view_mode = strtolower($mode);
// make sure that it only contains some valid value
switch ($album_view_mode)
{
case ALBUM_VIEW_ALL:
$album_view_mode = ALBUM_VIEW_ALL;
break;
case ALBUM_VIEW_LIST:
$album_view_mode = ALBUM_VIEW_LIST;
break;
default:
$album_view_mode = '';
}
$cat_id = request_var('cat_id', 0);
if ($cat_id <= 0)
{
$cat_id = ALBUM_ROOT_CATEGORY;
}
if ($album_user_id < 1)
{
if (!$user->data['session_logged_in'])
{
redirect(append_sid(album_append_uid(CMS_PAGE_LOGIN . '?redirect=album.' . PHP_EXT, true)));
}
else
{
$album_user_id = $user->data['user_id'];
redirect(append_sid(album_append_uid('album.' . PHP_EXT, true)));
}
}
if (($cat_id != ALBUM_ROOT_CATEGORY) && ($cat_id != album_get_personal_root_id($album_user_id)))
{
redirect(append_sid(album_append_uid('album_cat.' . PHP_EXT . album_build_url_parameters($_GET), false)));
}
}
$catrows = array();
$options = ($album_view_mode == ALBUM_VIEW_LIST) ? ALBUM_READ_ALL_CATEGORIES | ALBUM_AUTH_VIEW : ALBUM_AUTH_VIEW;
$catrows = album_read_tree($album_user_id, $options);
// Mighty Gorgon: is this really needed? Maybe not... let's keep it commented until someone complains!!!
//album_read_tree($album_user_id);
$album_nav_cat_desc = album_make_nav_tree($cat_id, 'album_cat.' . PHP_EXT, 'nav' , $album_user_id);
if ($album_nav_cat_desc != '')
{
$nav_server_url = create_server_url();
$album_nav_cat_desc = ALBUM_NAV_ARROW . $album_nav_cat_desc;
$breadcrumbs['address'] = ALBUM_NAV_ARROW . '<a href="' . $nav_server_url . append_sid('album.' . PHP_EXT) . '">' . $lang['Album'] . '</a>' . $album_nav_cat_desc;
}
// --------------------------------
// Build allowed category-list (for recent pics after here)
// $catrows array now stores all categories which this user can view.
// --------------------------------
$allowed_cat = ''; // For Recent Public Pics below
for ($i = 0; $i < sizeof($catrows); $i++)
{
// --------------------------------
// build list of allowd category id's
// --------------------------------
$allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
}
//
// END of Categories Index
//
// ------------------------------------
// Build the sort method and sort order
// information
// ------------------------------------
$start = request_var('start', 0);
$start = ($start < 0) ? 0 : $start;
$sort_method = request_var('sort_method', $album_config['sort_method']);
$sort_method = check_var_value($sort_method, array('pic_time', 'pic_title', 'username', 'pic_view_count', 'rating', 'comments', 'new_comment'));
$sort_order = request_var('sort_order', $album_config['sort_order']);
$sort_order = check_var_value($sort_order, array('DESC', 'ASC'));
$sort_append = '&sort_method=' . $sort_method . '&sort_order=' . $sort_order;
// ------------------------------------
// additional sorting options
// ------------------------------------
if ($album_user_id != ALBUM_PUBLIC_GALLERY)
{
$sort_rating_option = '';
$sort_comments_option = '';
$sort_new_comment_option = '';
if ($album_config['rate'] == 1)
{
$sort_rating_option = '<option value="rating" ';
$sort_rating_option .= ($sort_method == 'rating') ? 'selected="selected"' : '';
$sort_rating_option .= '>' . $lang['Rating'] . '</option>';
}
if ($album_config['comment'] == 1)
{
$sort_comments_option = '<option value="comments" ';
$sort_comments_option .= ($sort_method == 'comments') ? 'selected="selected"' : '';
$sort_comments_option .= '>' . $lang['Comments'] . '</option>';
$sort_new_comment_option = '<option value="new_comment" ';
$sort_new_comment_option .= ($sort_method == 'new_comment') ? 'selected="selected"' : '';
$sort_new_comment_option .= '>' . $lang['New_Comment'] . '</option>';
}
}
/*
+----------------------------------------------------------
| Start output the page
+----------------------------------------------------------
*/
$meta_content['page_title'] = $lang['Album'];
$meta_content['description'] = '';
$meta_content['keywords'] = '';
// is it a public gallery ?
if ($album_user_id == ALBUM_PUBLIC_GALLERY)
{
$template_to_parse = 'album_index_body.tpl';
$cols = ($album_config['img_cols'] == 0 ? 4 : $album_config['img_cols']);
$cols_width = (100 / $cols) . '%';
// Last Comments
if ($album_config['show_last_comments'] == 1)
{
album_build_last_comments_info($allowed_cat);
}
// Recent Public Pics
if ($album_config['disp_late'] == 1)
{
album_build_recent_pics($allowed_cat);
}
// Highest Rated Pics
if ($album_config['disp_high'] == 1)
{
album_build_highest_rated_pics($allowed_cat);
}
// Most Viewed Pics
if ($album_config['disp_mostv'] == 1)
{
album_build_most_viewed_pics($allowed_cat);
}
//Random Pics
if ($album_config['disp_rand'] == 1)
{
album_build_random_pics($allowed_cat);
}
$template->assign_vars(array(
'BREADCRUMBS_ADDRESS' => (empty($breadcrumbs['address']) ? (($meta_content['page_title_clean'] != $config['sitename']) ? ($lang['Nav_Separator'] . '<a href="#" class="nav-current">' . $meta_content['page_title_clean'] . '</a>') : '') : $breadcrumbs['address']),
'ALBUM_NAV' => $album_nav_cat_desc,
'S_COLS' => $cols,
'S_COL_WIDTH' => $cols_width,
'S_THUMBNAIL_SIZE' => $album_config['thumbnail_size'],
'TARGET_BLANK' => ($album_config['fullpic_popup']) ? 'target="_blank"' : '',
'L_RAND_PICS' => $lang['Random_Pictures'],
'L_HI_RATINGS' => $lang['Highest_Rated_Pictures'],
'L_RECENT_PUBLIC_PICS' => $lang['Recent_Public_Pics'],
'L_MOST_VIEWED' => $lang['Most_Viewed_Pictures'],
'L_NO_PICS' => $lang['No_Pics'],
'L_PIC_TITLE' => $lang['Pic_Image'],
'L_PIC_ID' => $lang['Pic_ID'],
'L_VIEW' => $lang['View'],
'L_POSTER' => $lang['Pic_Poster'],
'L_POSTED' => $lang['Posted'],
'L_ALBUM_ALLPICS' => $lang['All_Picture_List_Of_User'],
'L_ALBUM_OTF' => $lang['Pic_Gallery'],
'L_ALBUM_HON' => $lang['Hot_Or_Not'],
'L_ALBUM_RDF' => $lang['Pic_RDF'],
'L_ALBUM_RSS' => $lang['Pic_RSS'],
'U_ALBUM_ALLPICS' => append_sid(album_append_uid('album_allpics.' . PHP_EXT)),
'U_ALBUM_OTF' => append_sid(album_append_uid('album_otf.' . PHP_EXT)),
'U_ALBUM_HON' => append_sid(album_append_uid('album_hotornot.' . PHP_EXT)),
'U_ALBUM_RDF' => append_sid(album_append_uid('album_rdf.' . PHP_EXT)),
'U_ALBUM_RSS' => append_sid(album_append_uid('album_rss.' . PHP_EXT)),
)
);
}
// it's a personal gallery, and in the root folder
else
{
if ($album_view_mode == ALBUM_VIEW_LIST)
{
include(ALBUM_MOD_PATH . 'album_memberlist.' . PHP_EXT);
}
else
{
// include our special personal gallery files
// this file holds all the code to handle personal galleries
// except moderation and management of personal gallery categories.
include(ALBUM_MOD_PATH . 'album_personal.' . PHP_EXT);
}
}
if (empty($album_view_mode))
{
album_display_index($album_user_id, ALBUM_ROOT_CATEGORY, true, true, true);
}
full_page_generation($template_to_parse, $meta_content['page_title'], $meta_content['description'], $meta_content['keywords']);
?>