1 | <?php |
---|
2 | /*************************************************************************** |
---|
3 | * category.php * |
---|
4 | * ------------------- * |
---|
5 | * application : PhpWebGallery 1.3 <http://phpwebgallery.net> * |
---|
6 | * author : Pierrick LE GALL <pierrick@z0rglub.com> * |
---|
7 | * * |
---|
8 | * $Id: category.php 376 2004-02-27 17:36:55Z z0rglub $ |
---|
9 | * * |
---|
10 | ***************************************************************************/ |
---|
11 | |
---|
12 | /*************************************************************************** |
---|
13 | * * |
---|
14 | * This program is free software; you can redistribute it and/or modify * |
---|
15 | * it under the terms of the GNU General Public License as published by * |
---|
16 | * the Free Software Foundation; * |
---|
17 | * * |
---|
18 | ***************************************************************************/ |
---|
19 | //----------------------------------------------------------- personnal include |
---|
20 | include_once( './include/init.inc.php' ); |
---|
21 | //---------------------------------------------------------------------- logout |
---|
22 | if ( isset( $_GET['act'] ) |
---|
23 | and $_GET['act'] == 'logout' |
---|
24 | and isset( $_COOKIE['id'] ) ) |
---|
25 | { |
---|
26 | // cookie deletion if exists |
---|
27 | setcookie( 'id', '', 0, cookie_path() ); |
---|
28 | $url = 'category.php'; |
---|
29 | header( 'Request-URI: '.$url ); |
---|
30 | header( 'Content-Location: '.$url ); |
---|
31 | header( 'Location: '.$url ); |
---|
32 | exit(); |
---|
33 | } |
---|
34 | //-------------------------------------------------- access authorization check |
---|
35 | if ( isset( $_GET['cat'] ) ) check_cat_id( $_GET['cat'] ); |
---|
36 | check_login_authorization(); |
---|
37 | if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) |
---|
38 | { |
---|
39 | check_restrictions( $page['cat'] ); |
---|
40 | } |
---|
41 | //-------------------------------------------------------------- initialization |
---|
42 | // detection of the start picture to display |
---|
43 | if ( !isset( $_GET['start'] ) |
---|
44 | or !is_numeric( $_GET['start'] ) |
---|
45 | or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) ) |
---|
46 | $page['start'] = 0; |
---|
47 | else |
---|
48 | $page['start'] = $_GET['start']; |
---|
49 | // Sometimes, a "num" is provided in the URL. It is the number |
---|
50 | // of the picture to show. This picture must be in the thumbnails page. |
---|
51 | // We have to find the right $page['start'] that show the num picture |
---|
52 | // in this category |
---|
53 | if ( isset( $_GET['num'] ) |
---|
54 | and is_numeric( $_GET['num'] ) |
---|
55 | and $_GET['num'] >= 0 ) |
---|
56 | { |
---|
57 | $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] ); |
---|
58 | $page['start']*= $user['nb_image_page']; |
---|
59 | } |
---|
60 | |
---|
61 | initialize_category(); |
---|
62 | |
---|
63 | // creation of the array containing the cat ids to expand in the menu |
---|
64 | // $page['tab_expand'] contains an array with the category ids |
---|
65 | // $page['expand'] contains the string to display in URL with comma |
---|
66 | $page['tab_expand'] = array(); |
---|
67 | if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' ) |
---|
68 | { |
---|
69 | $tab_expand = explode( ',', $_GET['expand'] ); |
---|
70 | foreach ( $tab_expand as $id ) { |
---|
71 | if ( is_numeric( $id ) ) array_push( $page['tab_expand'], $id ); |
---|
72 | } |
---|
73 | } |
---|
74 | if ( isset($page['cat']) && is_numeric( $page['cat'] ) ) |
---|
75 | { |
---|
76 | // the category displayed (in the URL cat=23) must be seen in the menu -> |
---|
77 | // parent categories must be expanded |
---|
78 | $uppercats = explode( ',', $page['uppercats'] ); |
---|
79 | foreach ( $uppercats as $uppercat ) { |
---|
80 | array_push( $page['tab_expand'], $uppercat ); |
---|
81 | } |
---|
82 | } |
---|
83 | $page['tab_expand'] = array_unique( $page['tab_expand'] ); |
---|
84 | $page['expand'] = implode( ',', $page['tab_expand'] ); |
---|
85 | // in case of expanding all authorized cats |
---|
86 | // The $page['expand'] equals 'all' and |
---|
87 | // $page['tab_expand'] contains all the authorized cat ids |
---|
88 | if ( $user['expand'] |
---|
89 | or ( isset( $_GET['expand'] ) and $_GET['expand'] == 'all' ) ) |
---|
90 | { |
---|
91 | $page['tab_expand'] = array(); |
---|
92 | $page['expand'] = 'all'; |
---|
93 | } |
---|
94 | // creating the structure of the categories (useful for displaying the menu) |
---|
95 | // creating the plain structure : array of all the available categories and |
---|
96 | // their relative informations, see the definition of the function |
---|
97 | // get_user_plain_structure for further details. |
---|
98 | $page['plain_structure'] = get_user_plain_structure(); |
---|
99 | $page['structure'] = create_user_structure( '' ); |
---|
100 | $page['structure'] = update_structure( $page['structure'] ); |
---|
101 | |
---|
102 | //----------------------------------------------------- template initialization |
---|
103 | |
---|
104 | // |
---|
105 | // Start output of page |
---|
106 | // |
---|
107 | $title = $page['title']; |
---|
108 | include('include/page_header.php'); |
---|
109 | |
---|
110 | $handle = $vtp->Open( './template/'.$user['template'].'/category.vtp' ); |
---|
111 | initialize_template(); |
---|
112 | $tpl = array( |
---|
113 | 'categories','hint_category','sub-cat','images_available','total', |
---|
114 | 'title_menu','nb_image_category','send_mail','title_send_mail', |
---|
115 | 'connected_user','recent_image','days', |
---|
116 | 'favorite_cat_hint','favorite_cat','stats','most_visited_cat_hint', |
---|
117 | 'most_visited_cat','recent_cat','recent_cat_hint','upload_picture', |
---|
118 | 'comments' ); |
---|
119 | templatize_array( $tpl, 'lang', $handle ); |
---|
120 | |
---|
121 | $tpl = array( 'mail_webmaster','webmaster','top_number'); |
---|
122 | templatize_array( $tpl, 'conf', $handle ); |
---|
123 | |
---|
124 | $tpl = array( 'short_period','long_period','lien_collapsed', 'username' ); |
---|
125 | templatize_array( $tpl, 'user', $handle ); |
---|
126 | |
---|
127 | $tpl = array( 'navigation_bar','cat_comment','cat_nb_images' ); |
---|
128 | templatize_array( $tpl, 'page', $handle ); |
---|
129 | |
---|
130 | // special global template vars |
---|
131 | $vtp->setGlobalVar( $handle, 'icon_short', get_icon( time() ) ); |
---|
132 | $icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) ); |
---|
133 | $vtp->setGlobalVar( $handle, 'icon_long', $icon_long ); |
---|
134 | $nb_total_pictures = count_user_total_images(); |
---|
135 | $vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures ); |
---|
136 | |
---|
137 | //------------------------------------------------------------- categories menu |
---|
138 | $vtp->setVar( $handle, 'home_url', add_session_id( 'category.php' ) ); |
---|
139 | // normal categories |
---|
140 | foreach ( $page['structure'] as $category ) { |
---|
141 | // display category is a function relative to the template |
---|
142 | display_category( $category, ' ', $handle ); |
---|
143 | } |
---|
144 | // favorites cat |
---|
145 | if ( !$user['is_the_guest'] ) |
---|
146 | { |
---|
147 | $vtp->addSession( $handle, 'favorites' ); |
---|
148 | $url = './category.php?cat=fav&expand='.$page['expand']; |
---|
149 | $vtp->setVar( $handle, 'favorites.url', add_session_id( $url ) ); |
---|
150 | // searching the number of favorite picture |
---|
151 | $query = 'SELECT COUNT(*) AS count'; |
---|
152 | $query.= ' FROM '.PREFIX_TABLE.'favorites'; |
---|
153 | $query.= ' WHERE user_id = '.$user['id'].';'; |
---|
154 | $result = mysql_query( $query ); |
---|
155 | $row = mysql_fetch_array( $result ); |
---|
156 | $vtp->setVar( $handle, 'favorites.nb_favorites', $row['count'] ); |
---|
157 | $vtp->closeSession( $handle, 'favorites' ); |
---|
158 | } |
---|
159 | // most visited pictures category |
---|
160 | $url = './category.php?cat=most_visited&expand='.$page['expand']; |
---|
161 | $vtp->setGlobalVar( $handle, 'most_visited_url', add_session_id( $url ) ); |
---|
162 | // recent pictures |
---|
163 | $url = './category.php?cat=recent&expand='.$page['expand']; |
---|
164 | $vtp->setGlobalVar( $handle, 'recent_url', add_session_id( $url ) ); |
---|
165 | //--------------------------------------------------------------------- summary |
---|
166 | $vtp->addSession( $handle, 'summary' ); |
---|
167 | $vtp->setVar( $handle, 'summary.url', './identification.php' ); |
---|
168 | if ( !$user['is_the_guest'] ) |
---|
169 | { |
---|
170 | $vtp->setVar( $handle, 'summary.title', '' ); |
---|
171 | $vtp->setVar( $handle, 'summary.name',replace_space($lang['change_login'])); |
---|
172 | } |
---|
173 | else |
---|
174 | { |
---|
175 | $vtp->setVar( $handle, 'summary.title', $lang['hint_login'] ); |
---|
176 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['menu_login'])); |
---|
177 | } |
---|
178 | $vtp->closeSession( $handle, 'summary' ); |
---|
179 | // links for registered users |
---|
180 | if ( !$user['is_the_guest'] ) |
---|
181 | { |
---|
182 | // logout link |
---|
183 | $vtp->addSession( $handle, 'summary' ); |
---|
184 | $vtp->setVar( $handle, 'summary.url', './category.php?act=logout' ); |
---|
185 | $vtp->setVar( $handle, 'summary.title', '' ); |
---|
186 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['logout'] ) ); |
---|
187 | $vtp->closeSession( $handle, 'summary' ); |
---|
188 | // customization link |
---|
189 | $vtp->addSession( $handle, 'summary' ); |
---|
190 | $url = './profile.php'; |
---|
191 | if (isset($page['cat']) && isset($page['expand'])) |
---|
192 | $url.='?cat='.$page['cat'].'&expand='.$page['expand']; |
---|
193 | if ( isset($page['cat']) && $page['cat'] == 'search' ) |
---|
194 | { |
---|
195 | $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; |
---|
196 | } |
---|
197 | $vtp->setVar( $handle, 'summary.url', add_session_id( $url ) ); |
---|
198 | $vtp->setVar( $handle, 'summary.title', $lang['hint_customize'] ); |
---|
199 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['customize'] ) ); |
---|
200 | $vtp->closeSession( $handle, 'summary' ); |
---|
201 | } |
---|
202 | // search link |
---|
203 | $vtp->addSession( $handle, 'summary' ); |
---|
204 | $vtp->setVar( $handle, 'summary.url', add_session_id( './search.php' ) ); |
---|
205 | $vtp->setVar( $handle, 'summary.title', $lang['hint_search'] ); |
---|
206 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['search'] ) ); |
---|
207 | $vtp->closeSession( $handle, 'summary' ); |
---|
208 | // comments link |
---|
209 | $vtp->addSession( $handle, 'summary' ); |
---|
210 | $vtp->setVar( $handle, 'summary.url', add_session_id( './comments.php' ) ); |
---|
211 | $vtp->setVar( $handle, 'summary.title', $lang['hint_comments'] ); |
---|
212 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['comments'] ) ); |
---|
213 | $vtp->closeSession( $handle, 'summary' ); |
---|
214 | // about link |
---|
215 | $vtp->addSession( $handle, 'summary' ); |
---|
216 | $vtp->setVar( $handle, 'summary.url', './about.php?'. |
---|
217 | str_replace( '&', '&', $_SERVER['QUERY_STRING'] ) ); |
---|
218 | $vtp->setVar( $handle, 'summary.title', $lang['hint_about'] ); |
---|
219 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) ); |
---|
220 | $vtp->closeSession( $handle, 'summary' ); |
---|
221 | // administration link |
---|
222 | if ( $user['status'] == 'admin' ) |
---|
223 | { |
---|
224 | $vtp->addSession( $handle, 'summary' ); |
---|
225 | $vtp->setVar( $handle, 'summary.url', |
---|
226 | add_session_id( './admin/admin.php' ) ); |
---|
227 | $vtp->setVar( $handle, 'summary.title', $lang['hint_admin'] ); |
---|
228 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['admin'] ) ); |
---|
229 | $vtp->closeSession( $handle, 'summary' ); |
---|
230 | } |
---|
231 | //-------------------------------------------------------------- category title |
---|
232 | if ( isset ( $page['cat'] ) ) |
---|
233 | { |
---|
234 | if ( is_numeric( $page['cat'] ) ) |
---|
235 | { |
---|
236 | $cat_title = get_cat_display_name( $page['cat_name'], '<br />', |
---|
237 | 'font-style:italic;' ); |
---|
238 | $vtp->setGlobalVar( $handle, "cat_title", $cat_title ); |
---|
239 | } |
---|
240 | else |
---|
241 | { |
---|
242 | if ( $page['cat'] == 'search' ) |
---|
243 | { |
---|
244 | $page['title'].= ' : <span style="font-style:italic;">'; |
---|
245 | $page['title'].= $_GET['search']."</span>"; |
---|
246 | } |
---|
247 | $page['title'] = replace_space( $page['title'] ); |
---|
248 | $vtp->setGlobalVar( $handle, "cat_title", $page['title'] ); |
---|
249 | } |
---|
250 | } |
---|
251 | else |
---|
252 | { |
---|
253 | $vtp->setGlobalVar( $handle, "cat_title", |
---|
254 | replace_space( $lang['no_category'] ) ); |
---|
255 | } |
---|
256 | //------------------------------------------------------------------ thumbnails |
---|
257 | if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 ) |
---|
258 | { |
---|
259 | $array_cat_directories = array(); |
---|
260 | |
---|
261 | $query = 'SELECT distinct(id),file,date_available,tn_ext,name,filesize'; |
---|
262 | $query.= ',storage_category_id'; |
---|
263 | $query.= ' FROM '.PREFIX_TABLE.'images AS i'; |
---|
264 | $query.=' INNER JOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id'; |
---|
265 | $query.= $page['where']; |
---|
266 | $query.= $conf['order_by']; |
---|
267 | $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page']; |
---|
268 | $query.= ';'; |
---|
269 | $result = mysql_query( $query ); |
---|
270 | |
---|
271 | $vtp->addSession( $handle, 'thumbnails' ); |
---|
272 | $vtp->addSession( $handle, 'line' ); |
---|
273 | // iteration counter to use a new <tr> every "$nb_image_line" pictures |
---|
274 | $cell_number = 1; |
---|
275 | // iteration counter to be sure not to create too much lines in the table |
---|
276 | $line_number = 1; |
---|
277 | while ( $row = mysql_fetch_array( $result ) ) |
---|
278 | { |
---|
279 | // retrieving the storage dir of the picture |
---|
280 | if ( !isset($array_cat_directories[$row['storage_category_id']])) |
---|
281 | { |
---|
282 | $array_cat_directories[$row['storage_category_id']] = |
---|
283 | get_complete_dir( $row['storage_category_id'] ); |
---|
284 | } |
---|
285 | $cat_directory = $array_cat_directories[$row['storage_category_id']]; |
---|
286 | |
---|
287 | $file = get_filename_wo_extension( $row['file'] ); |
---|
288 | // name of the picture |
---|
289 | if ( isset( $row['name'] ) and $row['name'] != '' ) $name = $row['name']; |
---|
290 | else $name = str_replace( '_', ' ', $file ); |
---|
291 | |
---|
292 | if ( $page['cat'] == 'search' ) |
---|
293 | { |
---|
294 | $name = replace_search( $name, $_GET['search'] ); |
---|
295 | } |
---|
296 | // thumbnail url |
---|
297 | $thumbnail_url = $cat_directory; |
---|
298 | $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail']; |
---|
299 | $thumbnail_url.= $file.'.'.$row['tn_ext']; |
---|
300 | // message in title for the thumbnail |
---|
301 | $thumbnail_title = $row['file']; |
---|
302 | if ( $row['filesize'] == '' ) |
---|
303 | $poids = floor( filesize( $cat_directory.$row['file'] ) / 1024 ); |
---|
304 | else |
---|
305 | $poids = $row['filesize']; |
---|
306 | $thumbnail_title .= ' : '.$poids.' KB'; |
---|
307 | // url link on picture.php page |
---|
308 | $url_link = './picture.php?cat='.$page['cat']; |
---|
309 | $url_link.= '&image_id='.$row['id'].'&expand='.$page['expand']; |
---|
310 | if ( $page['cat'] == 'search' ) |
---|
311 | { |
---|
312 | $url_link.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; |
---|
313 | } |
---|
314 | // date of availability for creation icon |
---|
315 | list( $year,$month,$day ) = explode( '-', $row['date_available'] ); |
---|
316 | $date = mktime( 0, 0, 0, $month, $day, $year ); |
---|
317 | // sending vars to display |
---|
318 | $vtp->addSession( $handle, 'thumbnail' ); |
---|
319 | $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) ); |
---|
320 | $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_url ); |
---|
321 | $vtp->setVar( $handle, 'thumbnail.alt', $row['file'] ); |
---|
322 | $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title ); |
---|
323 | $vtp->setVar( $handle, 'thumbnail.name', $name ); |
---|
324 | $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) ); |
---|
325 | |
---|
326 | if ( $conf['show_comments'] and $user['show_nb_comments'] ) |
---|
327 | { |
---|
328 | $vtp->addSession( $handle, 'nb_comments' ); |
---|
329 | $query = 'SELECT COUNT(*) AS nb_comments'; |
---|
330 | $query.= ' FROM '.PREFIX_TABLE.'comments'; |
---|
331 | $query.= ' WHERE image_id = '.$row['id']; |
---|
332 | $query.= " AND validated = 'true'"; |
---|
333 | $query.= ';'; |
---|
334 | $row = mysql_fetch_array( mysql_query( $query ) ); |
---|
335 | $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] ); |
---|
336 | $vtp->closeSession( $handle, 'nb_comments' ); |
---|
337 | } |
---|
338 | |
---|
339 | $vtp->closeSession( $handle, 'thumbnail' ); |
---|
340 | |
---|
341 | if ( $cell_number++ == $user['nb_image_line'] ) |
---|
342 | { |
---|
343 | // creating a new line |
---|
344 | $vtp->closeSession( $handle, 'line' ); |
---|
345 | // the number of the next cell is 1 |
---|
346 | $cell_number = 1; |
---|
347 | // we only create a new line if it does not exceed the maximum line |
---|
348 | // per page for the logged user |
---|
349 | if ( $line_number++ < $user['nb_line_page'] ) |
---|
350 | { |
---|
351 | $vtp->addSession( $handle, 'line' ); |
---|
352 | } |
---|
353 | } |
---|
354 | } |
---|
355 | $vtp->closeSession( $handle, 'thumbnails' ); |
---|
356 | } |
---|
357 | //-------------------------------------------------------------- empty category |
---|
358 | elseif ( ( isset( $page['cat'] ) |
---|
359 | and is_numeric( $page['cat'] ) |
---|
360 | and $page['cat_nb_images'] == 0 |
---|
361 | and $page['plain_structure'][$page['cat']]['nb_sub_categories'] > 0) |
---|
362 | or (!isset($_GET['cat']))) |
---|
363 | { |
---|
364 | $vtp->addSession( $handle, 'thumbnails' ); |
---|
365 | $vtp->addSession( $handle, 'line' ); |
---|
366 | |
---|
367 | $subcats=array(); |
---|
368 | if (isset($page['cat'])) $subcats = get_non_empty_subcat_ids( $page['cat'] ); |
---|
369 | else $subcats = get_non_empty_subcat_ids( '' ); |
---|
370 | $cell_number = 1; |
---|
371 | $i = 0; |
---|
372 | foreach ( $subcats as $subcat_id => $non_empty_id ) { |
---|
373 | $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"'; |
---|
374 | $name.= ' alt=">"/> '; |
---|
375 | $name.= '[ <span style="font-weight:bold;">'; |
---|
376 | $name.= $page['plain_structure'][$subcat_id]['name']; |
---|
377 | $name.= '</span> ]'; |
---|
378 | |
---|
379 | // searching the representative picture of the category |
---|
380 | $query = 'SELECT representative_picture_id'; |
---|
381 | $query.= ' FROM '.PREFIX_TABLE.'categories'; |
---|
382 | $query.= ' WHERE id = '.$non_empty_id; |
---|
383 | $query.= ';'; |
---|
384 | $row = mysql_fetch_array( mysql_query( $query ) ); |
---|
385 | |
---|
386 | $query = 'SELECT file,tn_ext,storage_category_id'; |
---|
387 | $query.= ' FROM '.PREFIX_TABLE.'images, '.PREFIX_TABLE.'image_category'; |
---|
388 | $query.= ' WHERE category_id = '.$non_empty_id; |
---|
389 | $query.= ' AND id = image_id'; |
---|
390 | // if the category has a representative picture, this is its thumbnail |
---|
391 | // that will be displayed ! |
---|
392 | if ( isset( $row['representative_picture_id'] ) ) |
---|
393 | $query.= ' AND id = '.$row['representative_picture_id']; |
---|
394 | else |
---|
395 | $query.= ' ORDER BY RAND()'; |
---|
396 | $query.= ' LIMIT 0,1'; |
---|
397 | $query.= ';'; |
---|
398 | $image_result = mysql_query( $query ); |
---|
399 | $image_row = mysql_fetch_array( $image_result ); |
---|
400 | |
---|
401 | $file = get_filename_wo_extension( $image_row['file'] ); |
---|
402 | |
---|
403 | // creating links for thumbnail and associated category |
---|
404 | $thumbnail_link = get_complete_dir( $image_row['storage_category_id'] ); |
---|
405 | $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; |
---|
406 | $thumbnail_link.= $file.'.'.$image_row['tn_ext']; |
---|
407 | |
---|
408 | $thumbnail_title = $lang['hint_category']; |
---|
409 | |
---|
410 | $url_link = './category.php?cat='.$subcat_id; |
---|
411 | if ( isset($page['cat'])&& !in_array( $page['cat'], $page['tab_expand'] ) ) |
---|
412 | { |
---|
413 | array_push( $page['tab_expand'], $page['cat'] ); |
---|
414 | $page['expand'] = implode( ',', $page['tab_expand'] ); |
---|
415 | } |
---|
416 | $url_link.= '&expand='.$page['expand']; |
---|
417 | // we add the category to explore in the expand list |
---|
418 | if ( $page['expand'] != '' ) $url_link.= ','; |
---|
419 | $url_link.= $subcat_id; |
---|
420 | |
---|
421 | $date = $page['plain_structure'][$subcat_id]['date_last']; |
---|
422 | |
---|
423 | // sending vars to display |
---|
424 | $vtp->addSession( $handle, 'thumbnail' ); |
---|
425 | $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) ); |
---|
426 | $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_link ); |
---|
427 | $vtp->setVar( $handle, 'thumbnail.alt', $image_row['file'] ); |
---|
428 | $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title ); |
---|
429 | $vtp->setVar( $handle, 'thumbnail.name', $name ); |
---|
430 | $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) ); |
---|
431 | $vtp->closeSession( $handle, 'thumbnail' ); |
---|
432 | |
---|
433 | if ( $cell_number++ == $user['nb_image_line'] ) |
---|
434 | { |
---|
435 | $vtp->closeSession( $handle, 'line' ); |
---|
436 | $cell_number = 1; |
---|
437 | // we open a new line if the subcat was not the last one |
---|
438 | if ( $i++ < count( $subcats ) - 1 ) |
---|
439 | { |
---|
440 | $vtp->addSession( $handle, 'line' ); |
---|
441 | } |
---|
442 | } |
---|
443 | } |
---|
444 | if ( $i < count( $subcats ) - 1 ) |
---|
445 | { |
---|
446 | $vtp->closeSession( $handle, 'line' ); |
---|
447 | } |
---|
448 | $vtp->closeSession( $handle, 'thumbnails' ); |
---|
449 | } |
---|
450 | //------------------------------------------------------- category informations |
---|
451 | if ( isset ( $page['cat'] ) ) |
---|
452 | { |
---|
453 | $vtp->addSession( $handle, 'cat_infos' ); |
---|
454 | // navigation bar |
---|
455 | if ( $page['navigation_bar'] != '' ) |
---|
456 | { |
---|
457 | $vtp->addSession( $handle, 'navigation' ); |
---|
458 | $vtp->closeSession( $handle, 'navigation' ); |
---|
459 | } |
---|
460 | // category comment |
---|
461 | if ( isset( $page['comment'] ) and $page['comment'] != '' ) |
---|
462 | { |
---|
463 | $vtp->addSession( $handle, 'comment' ); |
---|
464 | $vtp->setVar( $handle, 'comment.cat_comment', $page['comment'] ); |
---|
465 | $vtp->closeSession( $handle, 'comment' ); |
---|
466 | } |
---|
467 | // total number of pictures in the category |
---|
468 | if ( is_numeric( $page['cat'] ) ) |
---|
469 | { |
---|
470 | $vtp->setVar( $handle, 'cat_infos.cat_name', |
---|
471 | get_cat_display_name( $page['cat_name'], ' - ', |
---|
472 | 'font-style:italic;' ) ); |
---|
473 | // upload a picture in the category |
---|
474 | if ( $page['cat_site_id'] == 1 |
---|
475 | and $conf['upload_available'] |
---|
476 | and $page['cat_uploadable'] ) |
---|
477 | { |
---|
478 | $vtp->addSession( $handle, 'upload' ); |
---|
479 | $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand']; |
---|
480 | $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) ); |
---|
481 | $vtp->closeSession( $handle, 'upload' ); |
---|
482 | } |
---|
483 | } |
---|
484 | else |
---|
485 | { |
---|
486 | $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] ); |
---|
487 | } |
---|
488 | |
---|
489 | $vtp->closeSession( $handle, 'cat_infos' ); |
---|
490 | } |
---|
491 | //------------------------------------------------------------ log informations |
---|
492 | pwg_log( 'category', $page['title'] ); |
---|
493 | mysql_close(); |
---|
494 | //----------------------------------------------------------- html code display |
---|
495 | $output.= $vtp->Display( $handle, 0 ); |
---|
496 | |
---|
497 | include('include/page_tail.php'); |
---|
498 | ?> |
---|