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