1 | <?php |
---|
2 | /*************************************************************************** |
---|
3 | * category.php * |
---|
4 | * ------------------- * |
---|
5 | * application : PhpWebGallery 1.3 * |
---|
6 | * author : Pierrick LE GALL <pierrick@z0rglub.com> * |
---|
7 | * * |
---|
8 | ***************************************************************************/ |
---|
9 | |
---|
10 | /*************************************************************************** |
---|
11 | * * |
---|
12 | * This program is free software; you can redistribute it and/or modify * |
---|
13 | * it under the terms of the GNU General Public License as published by * |
---|
14 | * the Free Software Foundation; * |
---|
15 | * * |
---|
16 | ***************************************************************************/ |
---|
17 | // determine the initial instant to indicate the generation time of this page |
---|
18 | $t1 = explode( ' ', microtime() ); |
---|
19 | $t2 = explode( '.', $t1[0] ); |
---|
20 | $t2 = $t1[1].'.'.$t2[1]; |
---|
21 | //----------------------------------------------------------- personnal include |
---|
22 | include_once( './include/init.inc.php' ); |
---|
23 | //-------------------------------------------------- access authorization check |
---|
24 | check_cat_id( $_GET['cat'] ); |
---|
25 | check_login_authorization(); |
---|
26 | if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) |
---|
27 | { |
---|
28 | check_restrictions( $page['cat'] ); |
---|
29 | } |
---|
30 | //-------------------------------------------------------------- initialization |
---|
31 | // creation of the array containing the cat ids to expand in the menu |
---|
32 | // $page['tab_expand'] contains an array with the category ids |
---|
33 | // $page['expand'] contains the string to display in URL with comma |
---|
34 | $page['tab_expand'] = array(); |
---|
35 | if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' ) |
---|
36 | { |
---|
37 | $j = 0; |
---|
38 | $tab_expand = explode( ",", $_GET['expand'] ); |
---|
39 | $size = sizeof( $tab_expand ); |
---|
40 | for ( $i = 0; $i < $size; $i++ ) |
---|
41 | { |
---|
42 | if ( is_numeric( $tab_expand[$i] ) ) |
---|
43 | { |
---|
44 | $page['tab_expand'][$j++] = $tab_expand[$i]; |
---|
45 | } |
---|
46 | } |
---|
47 | $page['expand'] = implode( ',', $page['tab_expand'] ); |
---|
48 | } |
---|
49 | // in case of expanding all authorized cats |
---|
50 | // The $page['expand'] equals 'all' and |
---|
51 | // $page['tab_expand'] contains all the authorized cat ids |
---|
52 | if ( $user['expand'] == 'true' or $_GET['expand'] == 'all' ) |
---|
53 | { |
---|
54 | $page['tab_expand'] = array(); |
---|
55 | $query = 'select id'; |
---|
56 | $query.= ' from '.$prefixeTable.'categories'; |
---|
57 | $query.= ' where id_uppercat is null;'; |
---|
58 | $result = mysql_query( $query ); |
---|
59 | $i = 0; |
---|
60 | while ( $row = mysql_fetch_array( $result ) ) |
---|
61 | { |
---|
62 | $page['tab_expand'][$i++] = $row['id']; |
---|
63 | } |
---|
64 | $page['expand'] = 'all'; |
---|
65 | } |
---|
66 | // detection of the start picture to display |
---|
67 | if ( !isset( $_GET['start'] ) |
---|
68 | or !is_numeric( $_GET['start'] ) |
---|
69 | or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) ) |
---|
70 | { |
---|
71 | $page['start'] = 0; |
---|
72 | } |
---|
73 | else |
---|
74 | { |
---|
75 | $page['start'] = $_GET['start']; |
---|
76 | } |
---|
77 | // Sometimes, a "num" is provided in the URL. It is the number |
---|
78 | // of the picture to show. This picture must be in the thumbnails page. |
---|
79 | // We have to find the right $page['start'] that show the num picture |
---|
80 | // in this category |
---|
81 | if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 ) |
---|
82 | { |
---|
83 | $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] ); |
---|
84 | $page['start']*= $user['nb_image_page']; |
---|
85 | } |
---|
86 | initialize_category(); |
---|
87 | //----------------------------------------------------- template initialization |
---|
88 | $vtp = new VTemplate; |
---|
89 | $handle = $vtp->Open( './template/'.$user['template'].'/category.vtp' ); |
---|
90 | initialize_template(); |
---|
91 | |
---|
92 | $tpl = array( 'categories','hint_category','sub-cat','images_available', |
---|
93 | 'total','title_menu','nb_image_category','send_mail', |
---|
94 | 'title_send_mail','generation_time','upload_name', |
---|
95 | 'connected_user','recent_image','days','generation_time', |
---|
96 | 'favorite_cat_hint','favorite_cat','stats', |
---|
97 | 'most_visited_cat_hint','most_visited_cat','recent_cat', |
---|
98 | 'recent_cat_hint' ); |
---|
99 | templatize_array( $tpl, 'lang' ); |
---|
100 | |
---|
101 | $tpl = array( 'mail_webmaster','webmaster','top_number','version','site_url' ); |
---|
102 | templatize_array( $tpl, 'conf' ); |
---|
103 | |
---|
104 | $tpl = array( 'short_period','long_period','style','lien_collapsed','pseudo' ); |
---|
105 | templatize_array( $tpl, 'user' ); |
---|
106 | |
---|
107 | $tpl = array( 'title','navigation_bar','cat_comment','cat_nb_images' ); |
---|
108 | templatize_array( $tpl, 'page' ); |
---|
109 | |
---|
110 | // special global template vars |
---|
111 | $vtp->setGlobalVar( $handle, 'icon_short', get_icon( time() ) ); |
---|
112 | $icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) ); |
---|
113 | $vtp->setGlobalVar( $handle, 'icon_long', $icon_long ); |
---|
114 | $nb_total_pictures = get_total_image( "", $user['restrictions'] ); |
---|
115 | $vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures ); |
---|
116 | //------------------------------------------------------------- categories menu |
---|
117 | // normal categories |
---|
118 | display_cat( '', ' ', $user['restrictions'], $page['tab_expand'] ); |
---|
119 | // favorites cat |
---|
120 | if ( !$user['is_the_guest'] ) |
---|
121 | { |
---|
122 | $vtp->addSession( $handle, 'favorites' ); |
---|
123 | $url = add_session_id('./category.php?cat=fav&expand='.$page['expand'] ); |
---|
124 | $vtp->setVar( $handle, 'favorites.url', $url ); |
---|
125 | // searching the number of favorite picture |
---|
126 | $query = 'select count(*) as count'; |
---|
127 | $query.= ' from '.$prefixeTable.'favorites'; |
---|
128 | $query.= ' where user_id = '.$user['id'].';'; |
---|
129 | $result = mysql_query( $query ); |
---|
130 | $row = mysql_fetch_array( $result ); |
---|
131 | $vtp->setVar( $handle, 'favorites.nb_favorites', $row['count'] ); |
---|
132 | $vtp->closeSession( $handle, 'favorites' ); |
---|
133 | } |
---|
134 | // most visited pictures category |
---|
135 | $url = add_session_id( './category.php?cat=most_visited'. |
---|
136 | '&expand='.$page['expand'] ); |
---|
137 | $vtp->setGlobalVar( $handle, 'most_visited_url', $url ); |
---|
138 | // recent pictures |
---|
139 | $url = add_session_id( './category.php?cat=recent'. |
---|
140 | '&expand='.$page['expand'] ); |
---|
141 | $vtp->setGlobalVar( $handle, 'recent_url', $url ); |
---|
142 | //--------------------------------------------------------------------- summary |
---|
143 | $vtp->addSession( $handle, 'summary' ); |
---|
144 | $vtp->setVar( $handle, 'summary.url', './identification.php' ); |
---|
145 | if ( !$user['is_the_guest'] ) |
---|
146 | { |
---|
147 | $vtp->setVar( $handle, 'summary.title', '' ); |
---|
148 | $vtp->setVar( $handle, 'summary.name', |
---|
149 | replace_space( $lang['change_login'] ) ); |
---|
150 | } |
---|
151 | else |
---|
152 | { |
---|
153 | $vtp->setVar( $handle, 'summary.title', $lang['hint_login'] ); |
---|
154 | $vtp->setVar( $handle, 'summary.name', |
---|
155 | replace_space( $lang['login'] ) ); |
---|
156 | } |
---|
157 | $vtp->closeSession( $handle, 'summary' ); |
---|
158 | // links for registered users |
---|
159 | if ( !$user['is_the_guest'] ) |
---|
160 | { |
---|
161 | // logout link |
---|
162 | $vtp->addSession( $handle, 'summary' ); |
---|
163 | $vtp->setVar( $handle, 'summary.url', './category.php?cat='.$page['cat'] ); |
---|
164 | $vtp->setVar( $handle, 'summary.title', '' ); |
---|
165 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['logout'] ) ); |
---|
166 | $vtp->closeSession( $handle, 'summary' ); |
---|
167 | // customization link |
---|
168 | $vtp->addSession( $handle, 'summary' ); |
---|
169 | $url = './profile.php?cat='.$page['cat']; |
---|
170 | $url.= '&expand='.$page['expand']; |
---|
171 | if ( $page['cat'] == 'search' ) |
---|
172 | { |
---|
173 | $url.= '&search='.$_GET['search']; |
---|
174 | } |
---|
175 | $vtp->setVar( $handle, 'summary.url', add_session_id( $url ) ); |
---|
176 | $vtp->setVar( $handle, 'summary.title', $lang['hint_customize'] ); |
---|
177 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['customize'] ) ); |
---|
178 | $vtp->closeSession( $handle, 'summary' ); |
---|
179 | } |
---|
180 | // search link |
---|
181 | $vtp->addSession( $handle, 'summary' ); |
---|
182 | $vtp->setVar( $handle, 'summary.url', add_session_id( './search.php' ) ); |
---|
183 | $vtp->setVar( $handle, 'summary.title', $lang['hint_search'] ); |
---|
184 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['search'] ) ); |
---|
185 | $vtp->closeSession( $handle, 'summary' ); |
---|
186 | // about link |
---|
187 | $vtp->addSession( $handle, 'summary' ); |
---|
188 | $vtp->setVar( $handle, 'summary.url', |
---|
189 | add_session_id( './about.php?expand='.$page['expand'] ) ); |
---|
190 | $vtp->setVar( $handle, 'summary.title', $lang['hint_about'] ); |
---|
191 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['about'] ) ); |
---|
192 | $vtp->closeSession( $handle, 'summary' ); |
---|
193 | // administration link |
---|
194 | if ( $user['status'] == 'admin' ) |
---|
195 | { |
---|
196 | $vtp->addSession( $handle, 'summary' ); |
---|
197 | $vtp->setVar( $handle, 'summary.url', |
---|
198 | add_session_id( './admin/admin.php' ) ); |
---|
199 | $vtp->setVar( $handle, 'summary.title', $lang['hint_admin'] ); |
---|
200 | $vtp->setVar( $handle, 'summary.name', replace_space( $lang['admin'] ) ); |
---|
201 | $vtp->closeSession( $handle, 'summary' ); |
---|
202 | } |
---|
203 | //-------------------------------------------------------------- category title |
---|
204 | if ( isset ( $page['cat'] ) ) |
---|
205 | { |
---|
206 | if ( is_numeric( $page['cat'] ) ) |
---|
207 | { |
---|
208 | $cat_title = get_cat_display_name( $page['cat_name'], '<br />', |
---|
209 | 'font-style:italic;' ); |
---|
210 | $vtp->setGlobalVar( $handle, "cat_title", $cat_title ); |
---|
211 | } |
---|
212 | else |
---|
213 | { |
---|
214 | if ( $page['cat'] == 'search' ) |
---|
215 | { |
---|
216 | $page['title'].= ' : <span style="font-style:italic;">'; |
---|
217 | $page['title'].= $_GET['search']."</span>"; |
---|
218 | } |
---|
219 | $page['title'] = replace_space( $page['title'] ); |
---|
220 | $vtp->setGlobalVar( $handle, "cat_title", $page['title'] ); |
---|
221 | } |
---|
222 | } |
---|
223 | else |
---|
224 | { |
---|
225 | $vtp->setGlobalVar( $handle, "cat_title", |
---|
226 | replace_space( $lang['no_category'] ) ); |
---|
227 | } |
---|
228 | //------------------------------------------------------------------ thumbnails |
---|
229 | if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 ) |
---|
230 | { |
---|
231 | if ( is_numeric( $page['cat'] ) ) |
---|
232 | { |
---|
233 | $cat_directory = $page['cat_dir']; |
---|
234 | } |
---|
235 | else if ( $page['cat'] == 'search' or $page['cat'] == 'fav' ) |
---|
236 | { |
---|
237 | $array_cat_directories = array(); |
---|
238 | } |
---|
239 | |
---|
240 | $query = 'select id,file,date_available,comment,'; |
---|
241 | $query.= ' author,tn_ext,name,filesize,width,height,cat_id'; |
---|
242 | $query.= ' from '.$prefixeTable.'images'; |
---|
243 | $query.= $page['where']; |
---|
244 | $query.= $conf['order_by']; |
---|
245 | $query.= ' limit '.$page['start'].','.$page['nb_image_page']; |
---|
246 | $query.= ';'; |
---|
247 | $result = mysql_query( $query ); |
---|
248 | |
---|
249 | $vtp->addSession( $handle, 'thumbnails' ); |
---|
250 | $vtp->addSession( $handle, 'line' ); |
---|
251 | // compteur d'itération pour aller à la ligne |
---|
252 | // toutes les "$nb_image_ligne" images |
---|
253 | $i = 1; |
---|
254 | while ( $row = mysql_fetch_array( $result ) ) |
---|
255 | { |
---|
256 | if ( !is_numeric( $page['cat'] ) ) |
---|
257 | { |
---|
258 | if ( $array_cat_directories[$row['cat_id']] == '' ) |
---|
259 | { |
---|
260 | $cat_result = get_cat_info( $row['cat_id'] ); |
---|
261 | $array_cat_directories[$row['cat_id']] = $cat_result['dir']; |
---|
262 | } |
---|
263 | $cat_directory = $array_cat_directories[$row['cat_id']]; |
---|
264 | } |
---|
265 | // filename without extension |
---|
266 | $file = substr ( $row['file'], 0, strrpos ( $row['file'], '.' ) ); |
---|
267 | // name of the picture |
---|
268 | if ( $row['name'] != '' ) |
---|
269 | { |
---|
270 | $name = $row['name']; |
---|
271 | } |
---|
272 | else |
---|
273 | { |
---|
274 | $name = str_replace( '_', ' ', $file ); |
---|
275 | } |
---|
276 | if ( $page['cat'] == 'search' ) |
---|
277 | { |
---|
278 | $name = replace_search( $name, $_GET['search'] ); |
---|
279 | } |
---|
280 | // thumbnail url |
---|
281 | $thumbnail_url = $cat_directory; |
---|
282 | $thumbnail_url.= 'thumbnail/'.$conf['prefixe_thumbnail']; |
---|
283 | $thumbnail_url.= $file.'.'.$row['tn_ext']; |
---|
284 | // message in title for the thumbnail |
---|
285 | $tab_date = explode( '-', $row['date_available'] ); |
---|
286 | $thumbnail_title = $lang['registration_date']; |
---|
287 | $thumbnail_title.= ' '.$tab_date[2].'/'.$tab_date[1].'/'.$tab_date[0]; |
---|
288 | if ( $row['comment'] != '' ) |
---|
289 | { |
---|
290 | $thumbnail_title .= "\n".$lang['comment'].' : '.$row['comment']; |
---|
291 | } |
---|
292 | if ( $row['author'] != '' ) |
---|
293 | { |
---|
294 | $thumbnail_title .= "\n".$lang['author'].' : '.$row['author']; |
---|
295 | } |
---|
296 | if ( $row['width'] == '' ) |
---|
297 | { |
---|
298 | $taille_image = @getimagesize( $lien_image ); |
---|
299 | $width = $taille_image[0]; |
---|
300 | $height = $taille_image[1]; |
---|
301 | } |
---|
302 | else |
---|
303 | { |
---|
304 | $width = $row['width']; |
---|
305 | $height = $row['height']; |
---|
306 | } |
---|
307 | $thumbnail_title .= "\n".$lang['size'].' : '.$width.'*'.$height; |
---|
308 | $thumbnail_title .= "\n".$lang['file'].' : '.$row['file']; |
---|
309 | if ( $row['filesize'] == '' ) |
---|
310 | { |
---|
311 | $poids = floor( filesize( $lien_image ) / 1024 ); |
---|
312 | } |
---|
313 | else |
---|
314 | { |
---|
315 | $poids = $row['filesize']; |
---|
316 | } |
---|
317 | $thumbnail_title .= "\n".$lang['filesize'].' : '.$poids.' KB'; |
---|
318 | // url link on picture.php page |
---|
319 | $url_link = './picture.php?cat='.$page['cat']; |
---|
320 | $url_link.= '&image_id='.$row['id'].'&expand='.$page['expand']; |
---|
321 | if ( $page['cat'] == 'search' ) |
---|
322 | { |
---|
323 | $url_link.= '&search='.$_GET['search']; |
---|
324 | } |
---|
325 | // date of availability for creation icon |
---|
326 | $date = explode( '-', $row['date_available'] ); |
---|
327 | $date = mktime( 0, 0, 0, $date[1], $date[2], $date[0] ); |
---|
328 | // sending vars to display |
---|
329 | $vtp->addSession( $handle, 'thumbnail' ); |
---|
330 | $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) ); |
---|
331 | $vtp->setVar( $handle, 'thumbnail.src', $thumbnail_url ); |
---|
332 | $vtp->setVar( $handle, 'thumbnail.alt', $row['file'] ); |
---|
333 | $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title ); |
---|
334 | $vtp->setVar( $handle, 'thumbnail.name', $name ); |
---|
335 | $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) ); |
---|
336 | |
---|
337 | if ( $conf['show_comments'] and $user['show_nb_comments'] ) |
---|
338 | { |
---|
339 | $vtp->addSession( $handle, 'nb_comments' ); |
---|
340 | $query = 'select count(*) as nb_comments'; |
---|
341 | $query.= ' from '.$prefixeTable.'comments'; |
---|
342 | $query.= ' where image_id = '.$row['id']; |
---|
343 | $query.= ';'; |
---|
344 | $row = mysql_fetch_array( mysql_query( $query ) ); |
---|
345 | $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] ); |
---|
346 | $vtp->closeSession( $handle, 'nb_comments' ); |
---|
347 | } |
---|
348 | |
---|
349 | $vtp->closeSession( $handle, 'thumbnail' ); |
---|
350 | |
---|
351 | if ( $i == $user['nb_image_line'] ) |
---|
352 | { |
---|
353 | $vtp->closeSession( $handle, 'line' ); |
---|
354 | $vtp->addSession( $handle, 'line' ); |
---|
355 | $i = 1; |
---|
356 | } |
---|
357 | else |
---|
358 | { |
---|
359 | $i++; |
---|
360 | } |
---|
361 | } |
---|
362 | if ( $i < $user['nb_image_line'] ) |
---|
363 | { |
---|
364 | $vtp->closeSession( $handle, 'line' ); |
---|
365 | } |
---|
366 | $vtp->closeSession( $handle, 'thumbnails' ); |
---|
367 | } |
---|
368 | elseif ( isset( $page['cat'] ) |
---|
369 | and is_numeric( $page['cat'] ) |
---|
370 | and $page['cat_nb_images'] == 0 ) |
---|
371 | { |
---|
372 | $vtp->addSession( $handle, 'thumbnails' ); |
---|
373 | |
---|
374 | $query = 'select id,name,dir,date_dernier'; |
---|
375 | $query.= ' from '.$prefixeTable.'categories'; |
---|
376 | $query.= ' where id_uppercat = '.$page['cat']; |
---|
377 | $query.= ' order by rank;'; |
---|
378 | $cat_result = mysql_query( $query ); |
---|
379 | $i = 1; |
---|
380 | $vtp->addSession( $handle, 'line' ); |
---|
381 | while ( $cat_row = mysql_fetch_array( $cat_result ) ) |
---|
382 | { |
---|
383 | $result = get_cat_info( $cat_row['id'] ); |
---|
384 | $cat_directory = $result['dir']; |
---|
385 | |
---|
386 | $name = '[ <span style="font-weight:bold;">'; |
---|
387 | if ( $cat_row['name'] != '' ) |
---|
388 | { |
---|
389 | $name.= $cat_row['name']; |
---|
390 | } |
---|
391 | else |
---|
392 | { |
---|
393 | $name.= $cat_row['dir']; |
---|
394 | } |
---|
395 | $name.= '</span> ]'; |
---|
396 | $name = replace_space( $name ); |
---|
397 | |
---|
398 | $query = 'select file,tn_ext'; |
---|
399 | $query.= ' from '.$prefixeTable.'images'; |
---|
400 | $query.= ' where cat_id = '.$cat_row['id']; |
---|
401 | $query.= ' order by rand()'; |
---|
402 | $query.= ' limit 0,1'; |
---|
403 | $query.= ';'; |
---|
404 | $image_result = mysql_query( $query ); |
---|
405 | $image_row = mysql_fetch_array( $image_result ); |
---|
406 | |
---|
407 | $file = substr ( $image_row['file'], 0, |
---|
408 | strrpos ( $image_row['file'], '.' ) ); |
---|
409 | |
---|
410 | // creating links for thumbnail and associated category |
---|
411 | $lien_image = $cat_directory; |
---|
412 | $lien_thumbnail = $lien_image; |
---|
413 | $lien_thumbnail.= 'thumbnail/'.$conf['prefixe_thumbnail']; |
---|
414 | $lien_thumbnail.= $file.'.'.$image_row['tn_ext']; |
---|
415 | $lien_image.= $image_row['file']; |
---|
416 | |
---|
417 | $thumbnail_title = ''; |
---|
418 | |
---|
419 | $url_link = './category.php?cat='.$cat_row['id']; |
---|
420 | if ( !in_array( $page['cat'], $page['tab_expand'] ) ) |
---|
421 | { |
---|
422 | $page['tab_expand'][sizeof( $page['tab_expand'] )] = $page['cat']; |
---|
423 | $page['expand'] = implode( ',', $page['tab_expand'] ); |
---|
424 | } |
---|
425 | $url_link.= '&expand='.$page['expand']; |
---|
426 | |
---|
427 | // sending vars to display |
---|
428 | $vtp->addSession( $handle, 'thumbnail' ); |
---|
429 | $vtp->setVar( $handle, 'thumbnail.url', add_session_id( $url_link ) ); |
---|
430 | $vtp->setVar( $handle, 'thumbnail.src', $lien_thumbnail ); |
---|
431 | $vtp->setVar( $handle, 'thumbnail.alt', $image_row['file'] ); |
---|
432 | $vtp->setVar( $handle, 'thumbnail.title', $thumbnail_title ); |
---|
433 | $vtp->setVar( $handle, 'thumbnail.name', $name ); |
---|
434 | |
---|
435 | $date = explode( '-', $cat_row['date_dernier'] ); |
---|
436 | $date = mktime( 0, 0, 0, $date[1], $date[2], $date[0] ); |
---|
437 | $vtp->setVar( $handle, 'thumbnail.icon', get_icon( $date ) ); |
---|
438 | |
---|
439 | $vtp->closeSession( $handle, 'thumbnail' ); |
---|
440 | |
---|
441 | if ( $i == $user['nb_image_line'] ) |
---|
442 | { |
---|
443 | $vtp->closeSession( $handle, 'line' ); |
---|
444 | $vtp->addSession( $handle, 'line' ); |
---|
445 | $i = 1; |
---|
446 | } |
---|
447 | else |
---|
448 | { |
---|
449 | $i++; |
---|
450 | } |
---|
451 | } |
---|
452 | $vtp->closeSession( $handle, 'thumbnails' ); |
---|
453 | } |
---|
454 | //------------------------------------------------------- category informations |
---|
455 | if ( isset ( $page['cat'] ) ) |
---|
456 | { |
---|
457 | $vtp->addSession( $handle, 'cat_infos' ); |
---|
458 | // navigation bar |
---|
459 | if ( $page['navigation_bar'] != '' ) |
---|
460 | { |
---|
461 | $vtp->addSession( $handle, 'navigation' ); |
---|
462 | $vtp->closeSession( $handle, 'navigation' ); |
---|
463 | } |
---|
464 | // category comment |
---|
465 | if ( isset( $page['comment'] ) and $page['comment'] != '' ) |
---|
466 | { |
---|
467 | $vtp->addSession( $handle, 'cat_comment' ); |
---|
468 | $vtp->closeSession( $handle, 'cat_navigation' ); |
---|
469 | } |
---|
470 | // total number of pictures in the category |
---|
471 | if ( is_numeric( $page['cat'] ) ) |
---|
472 | { |
---|
473 | $vtp->setVar( $handle, 'cat_infos.cat_name', |
---|
474 | get_cat_display_name( $page['cat_name'], ' - ', |
---|
475 | 'font-style:italic;' ) ); |
---|
476 | } |
---|
477 | else |
---|
478 | { |
---|
479 | $vtp->setVar( $handle, 'cat_infos.cat_name', $page['title'] ); |
---|
480 | } |
---|
481 | // upload a picture in the category |
---|
482 | if ( $page['cat_site_id'] == 1 and $conf['upload_available'] ) |
---|
483 | { |
---|
484 | $vtp->addSession( $handle, 'upload' ); |
---|
485 | $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand']; |
---|
486 | $vtp->setVar( $handle, 'upload.url', add_session_id( $url ) ); |
---|
487 | $vtp->closeSession( $handle, 'upload' ); |
---|
488 | } |
---|
489 | $vtp->closeSession( $handle, 'cat_infos' ); |
---|
490 | } |
---|
491 | //------------------------------------------------------------ log informations |
---|
492 | pwg_log( 'category', $page['title'] ); |
---|
493 | mysql_close(); |
---|
494 | //------------------------------------------------------------- generation time |
---|
495 | $time = get_elapsed_time( $t2, get_moment() ); |
---|
496 | $vtp->setGlobalVar( $handle, 'time', $time ); |
---|
497 | //----------------------------------------------------------- html code display |
---|
498 | $code = $vtp->Display( $handle, 0 ); |
---|
499 | echo $code; |
---|
500 | ?> |
---|