1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | category.php | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | application : PhpWebGallery <http://phpwebgallery.net> | |
---|
6 | // | branch : BSF (Best So Far) | |
---|
7 | // +-----------------------------------------------------------------------+ |
---|
8 | // | file : $RCSfile$ |
---|
9 | // | last update : $Date: 2004-02-19 00:31:09 +0000 (Thu, 19 Feb 2004) $ |
---|
10 | // | last modifier : $Author: gweltas $ |
---|
11 | // | revision : $Revision: 364 $ |
---|
12 | // +-----------------------------------------------------------------------+ |
---|
13 | // | This program is free software; you can redistribute it and/or modify | |
---|
14 | // | it under the terms of the GNU General Public License as published by | |
---|
15 | // | the Free Software Foundation | |
---|
16 | // | | |
---|
17 | // | This program is distributed in the hope that it will be useful, but | |
---|
18 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
19 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
20 | // | General Public License for more details. | |
---|
21 | // | | |
---|
22 | // | You should have received a copy of the GNU General Public License | |
---|
23 | // | along with this program; if not, write to the Free Software | |
---|
24 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
25 | // | USA. | |
---|
26 | // +-----------------------------------------------------------------------+ |
---|
27 | |
---|
28 | //--------------------------------------------------------------------- include |
---|
29 | define('PHPWG_ROOT_PATH','./'); |
---|
30 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
31 | //---------------------------------------------------------------------- logout |
---|
32 | if ( isset( $_GET['act'] ) |
---|
33 | and $_GET['act'] == 'logout' |
---|
34 | and isset( $_COOKIE['id'] ) ) |
---|
35 | { |
---|
36 | // cookie deletion if exists |
---|
37 | setcookie( 'id', '', 0, cookie_path() ); |
---|
38 | $url = 'category.php'; |
---|
39 | header( 'Request-URI: '.$url ); |
---|
40 | header( 'Content-Location: '.$url ); |
---|
41 | header( 'Location: '.$url ); |
---|
42 | exit(); |
---|
43 | } |
---|
44 | //-------------------------------------------------- access authorization check |
---|
45 | if ( isset( $_GET['cat'] ) ) check_cat_id( $_GET['cat'] ); |
---|
46 | check_login_authorization(); |
---|
47 | if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) |
---|
48 | { |
---|
49 | check_restrictions( $page['cat'] ); |
---|
50 | } |
---|
51 | //-------------------------------------------------------------- initialization |
---|
52 | // detection of the start picture to display |
---|
53 | if ( !isset( $_GET['start'] ) |
---|
54 | or !is_numeric( $_GET['start'] ) |
---|
55 | or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) ) |
---|
56 | $page['start'] = 0; |
---|
57 | else |
---|
58 | $page['start'] = $_GET['start']; |
---|
59 | |
---|
60 | initialize_category(); |
---|
61 | |
---|
62 | // creation of the array containing the cat ids to expand in the menu |
---|
63 | // $page['tab_expand'] contains an array with the category ids |
---|
64 | // $page['expand'] contains the string to display in URL with comma |
---|
65 | $page['tab_expand'] = array(); |
---|
66 | if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' ) |
---|
67 | { |
---|
68 | $tab_expand = explode( ',', $_GET['expand'] ); |
---|
69 | foreach ( $tab_expand as $id ) { |
---|
70 | if ( is_numeric( $id ) ) array_push( $page['tab_expand'], $id ); |
---|
71 | } |
---|
72 | } |
---|
73 | if ( isset($page['cat']) && is_numeric( $page['cat'] ) ) |
---|
74 | { |
---|
75 | // the category displayed (in the URL cat=23) must be seen in the menu -> |
---|
76 | // parent categories must be expanded |
---|
77 | $uppercats = explode( ',', $page['uppercats'] ); |
---|
78 | foreach ( $uppercats as $uppercat ) { |
---|
79 | array_push( $page['tab_expand'], $uppercat ); |
---|
80 | } |
---|
81 | } |
---|
82 | $page['tab_expand'] = array_unique( $page['tab_expand'] ); |
---|
83 | $page['expand'] = implode( ',', $page['tab_expand'] ); |
---|
84 | // in case of expanding all authorized cats |
---|
85 | // The $page['expand'] equals 'all' and |
---|
86 | // $page['tab_expand'] contains all the authorized cat ids |
---|
87 | if ( $user['expand'] |
---|
88 | or ( isset( $_GET['expand'] ) and $_GET['expand'] == 'all' ) ) |
---|
89 | { |
---|
90 | $page['tab_expand'] = array(); |
---|
91 | $page['expand'] = 'all'; |
---|
92 | } |
---|
93 | // Sometimes, a "num" is provided in the URL. It is the number |
---|
94 | // of the picture to show. This picture must be in the thumbnails page. |
---|
95 | // We have to find the right $page['start'] that show the num picture |
---|
96 | // in this category |
---|
97 | if ( isset( $_GET['num'] ) |
---|
98 | and is_numeric( $_GET['num'] ) |
---|
99 | and $_GET['num'] >= 0 ) |
---|
100 | { |
---|
101 | $page['start'] = floor( $_GET['num'] / $user['nb_image_page'] ); |
---|
102 | $page['start']*= $user['nb_image_page']; |
---|
103 | } |
---|
104 | // creating the structure of the categories (useful for displaying the menu) |
---|
105 | // creating the plain structure : array of all the available categories and |
---|
106 | // their relative informations, see the definition of the function |
---|
107 | // get_user_plain_structure for further details. |
---|
108 | $page['plain_structure'] = get_user_plain_structure(); |
---|
109 | $page['structure'] = create_user_structure( '' ); |
---|
110 | $page['structure'] = update_structure( $page['structure'] ); |
---|
111 | |
---|
112 | //----------------------------------------------------- template initialization |
---|
113 | |
---|
114 | // |
---|
115 | // Start output of page |
---|
116 | // |
---|
117 | $title = $page['title']; |
---|
118 | include('include/page_header.php'); |
---|
119 | |
---|
120 | $template->set_filenames( array('category'=>'category.tpl') ); |
---|
121 | initialize_template(); |
---|
122 | |
---|
123 | //-------------------------------------------------------------- category title |
---|
124 | $cat_title = $lang['no_category']; |
---|
125 | if ( isset ( $page['cat'] ) ) |
---|
126 | { |
---|
127 | if ( is_numeric( $page['cat'] ) ) |
---|
128 | { |
---|
129 | $cat_title = get_cat_display_name( $page['cat_name'], '<br />', |
---|
130 | 'font-style:italic;' ); |
---|
131 | } |
---|
132 | else |
---|
133 | { |
---|
134 | if ( $page['cat'] == 'search' ) |
---|
135 | { |
---|
136 | $page['title'].= ' : <span style="font-style:italic;">'; |
---|
137 | $page['title'].= $_GET['search']."</span>"; |
---|
138 | } |
---|
139 | $page['title'] = replace_space( $page['title'] ); |
---|
140 | } |
---|
141 | } |
---|
142 | |
---|
143 | $template->assign_vars(array( |
---|
144 | 'NB_PICTURE' => count_user_total_images(), |
---|
145 | 'TITLE' => $cat_title, |
---|
146 | 'USERNAME' => $user['username'], |
---|
147 | |
---|
148 | 'S_TOP'=>$conf['top_number'], |
---|
149 | 'S_SHORT_PERIOD'=>$user['short_period'], |
---|
150 | 'S_LONG_PERIOD'=>$user['long_period'], |
---|
151 | 'S_WEBMASTER'=>$conf['webmaster'], |
---|
152 | 'S_MAIL'=>$conf['mail_webmaster'], |
---|
153 | |
---|
154 | 'L_CATEGORIES' => $lang['categories'], |
---|
155 | 'L_HINT_CATEGORY' => $lang['hint_category'], |
---|
156 | 'L_SUBCAT' => $lang['sub-cat'], |
---|
157 | 'L_IMG_AVAILABLE' => $lang['images_available'], |
---|
158 | 'L_TOTAL' => $lang['total'], |
---|
159 | 'L_FAVORITE_HINT' => $lang['favorite_cat_hint'], |
---|
160 | 'L_FAVORITE' => $lang['favorite_cat'], |
---|
161 | 'L_STATS' => $lang['stats'], |
---|
162 | 'L_MOST_VISITED_HINT' => $lang['most_visited_cat_hint'], |
---|
163 | 'L_MOST_VISITED' => $lang['most_visited_cat'], |
---|
164 | 'L_RECENT_HINT' => $lang['recent_cat_hint'], |
---|
165 | 'L_RECENT' => $lang['recent_cat'], |
---|
166 | 'L_SUMMARY' => $lang['title_menu'], |
---|
167 | 'L_UPLOAD' => $lang['upload_picture'], |
---|
168 | 'L_COMMENT' => $lang['comments'], |
---|
169 | 'L_NB_IMG' => $lang['nb_image_category'], |
---|
170 | 'L_USER' => $lang['connected_user'], |
---|
171 | 'L_RECENT_IMAGE' => $lang['recent_image'], |
---|
172 | 'L_DAYS' => $lang['days'], |
---|
173 | 'L_SEND_MAIL' => $lang['send_mail'], |
---|
174 | 'L_TITLE_MAIL' => $lang['title_send_mail'], |
---|
175 | |
---|
176 | 'T_COLLAPSED' => $user['lien_collapsed'], |
---|
177 | 'T_SHORT'=>get_icon( time() ), |
---|
178 | 'T_LONG'=>get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) ), |
---|
179 | |
---|
180 | 'U_HOME' => add_session_id( 'category.php' ), |
---|
181 | 'U_FAVORITE' => add_session_id( './category.php?cat=fav&expand='.$page['expand'] ), |
---|
182 | 'U_MOST_VISITED'=>add_session_id( './category.php?cat=most_visited&expand='.$page['expand'] ), |
---|
183 | 'U_RECENT'=>add_session_id( './category.php?cat=recent&expand='.$page['expand'] ) |
---|
184 | ) |
---|
185 | ); |
---|
186 | |
---|
187 | foreach ( $page['structure'] as $category ) { |
---|
188 | // display category is a function relative to the template |
---|
189 | display_category( $category, ' '); |
---|
190 | } |
---|
191 | |
---|
192 | // authentification mode management |
---|
193 | if ( !$user['is_the_guest'] ) |
---|
194 | { |
---|
195 | // searching the number of favorite picture |
---|
196 | $query = 'SELECT COUNT(*) AS count'; |
---|
197 | $query.= ' FROM '.FAVORITES_TABLE.' WHERE user_id = '.$user['id'].';'; |
---|
198 | $result = mysql_query( $query ); |
---|
199 | $row = mysql_fetch_array( $result ); |
---|
200 | $template->assign_block_vars('favorites', array ('NB_FAV'=>$row['count']) ); |
---|
201 | $template->assign_block_vars('username', array()); |
---|
202 | } |
---|
203 | //--------------------------------------------------------------------- summary |
---|
204 | $sum_title = ''; |
---|
205 | $sum_name=''; |
---|
206 | $sum_url = ''; |
---|
207 | if ( !$user['is_the_guest'] ) |
---|
208 | { |
---|
209 | $sum_name=replace_space($lang['logout']); |
---|
210 | $sum_url = 'category.php?act=logout'; |
---|
211 | } |
---|
212 | else |
---|
213 | { |
---|
214 | $sum_title = $lang['hint_login']; |
---|
215 | $sum_name=replace_space( $lang['menu_login']); |
---|
216 | $sum_url = 'identification.php'; |
---|
217 | } |
---|
218 | $template->assign_block_vars('summary', array( |
---|
219 | 'TITLE'=>$sum_title, |
---|
220 | 'NAME'=>$sum_name, |
---|
221 | 'U_SUMMARY'=>add_session_id( $sum_url ), |
---|
222 | ) |
---|
223 | ); |
---|
224 | |
---|
225 | // customization link |
---|
226 | if ( !$user['is_the_guest'] ) |
---|
227 | { |
---|
228 | $template->assign_block_vars('summary', array( |
---|
229 | 'TITLE'=>$lang['hint_customize'], |
---|
230 | 'NAME'=>$lang['customize'], |
---|
231 | 'U_SUMMARY'=>add_session_id('profile.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] )), |
---|
232 | )); |
---|
233 | } |
---|
234 | |
---|
235 | // search link |
---|
236 | $template->assign_block_vars('summary', array( |
---|
237 | 'TITLE'=>$lang['hint_search'], |
---|
238 | 'NAME'=>$lang['search'], |
---|
239 | 'U_SUMMARY'=>add_session_id( 'search.php' ), |
---|
240 | )); |
---|
241 | |
---|
242 | // comments link |
---|
243 | $template->assign_block_vars('summary', array( |
---|
244 | 'TITLE'=>$lang['hint_comments'], |
---|
245 | 'NAME'=>$lang['comments'], |
---|
246 | 'U_SUMMARY'=>add_session_id( 'comments.php' ), |
---|
247 | )); |
---|
248 | |
---|
249 | // about link |
---|
250 | $template->assign_block_vars('summary', array( |
---|
251 | 'TITLE'=>$lang['hint_about'], |
---|
252 | 'NAME'=>$lang['about'], |
---|
253 | 'U_SUMMARY'=>add_session_id( 'about.php?'.str_replace( '&', '&', $_SERVER['QUERY_STRING'] ) ) |
---|
254 | )); |
---|
255 | |
---|
256 | // administration link |
---|
257 | if ( $user['status'] == 'admin' ) |
---|
258 | { |
---|
259 | $template->assign_block_vars('summary', array( |
---|
260 | 'TITLE'=>$lang['hint_admin'], |
---|
261 | 'NAME'=>$lang['admin'], |
---|
262 | 'U_SUMMARY'=>add_session_id( 'admin.php' ) |
---|
263 | )); |
---|
264 | } |
---|
265 | |
---|
266 | //------------------------------------------------------------------ thumbnails |
---|
267 | if ( isset( $page['cat'] ) && $page['cat_nb_images'] != 0 ) |
---|
268 | { |
---|
269 | $array_cat_directories = array(); |
---|
270 | |
---|
271 | $query = 'SELECT distinct(id),file,date_available,tn_ext,name,filesize'; |
---|
272 | $query.= ',storage_category_id'; |
---|
273 | $query.= ' FROM '.IMAGES_TABLE.' AS i'; |
---|
274 | $query.=' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id'; |
---|
275 | $query.= $page['where']; |
---|
276 | $query.= $conf['order_by']; |
---|
277 | $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page']; |
---|
278 | $query.= ';'; |
---|
279 | $result = mysql_query( $query ); |
---|
280 | |
---|
281 | $template->assign_block_vars('thumbnails', array()); |
---|
282 | |
---|
283 | // iteration counter to use a new <tr> every "$nb_image_line" pictures |
---|
284 | $cell_number = 0; |
---|
285 | // iteration counter to be sure not to create too much lines in the table |
---|
286 | $line_number = 0; |
---|
287 | |
---|
288 | while ( $row = mysql_fetch_array( $result ) ) |
---|
289 | { |
---|
290 | // retrieving the storage dir of the picture |
---|
291 | if ( !isset($array_cat_directories[$row['storage_category_id']])) |
---|
292 | { |
---|
293 | $array_cat_directories[$row['storage_category_id']] = |
---|
294 | get_complete_dir( $row['storage_category_id'] ); |
---|
295 | } |
---|
296 | $cat_directory = $array_cat_directories[$row['storage_category_id']]; |
---|
297 | |
---|
298 | $file = get_filename_wo_extension( $row['file'] ); |
---|
299 | // name of the picture |
---|
300 | if ( isset( $row['name'] ) and $row['name'] != '' ) $name = $row['name']; |
---|
301 | else $name = str_replace( '_', ' ', $file ); |
---|
302 | |
---|
303 | if ( $page['cat'] == 'search' ) |
---|
304 | { |
---|
305 | $name = replace_search( $name, $_GET['search'] ); |
---|
306 | } |
---|
307 | // thumbnail url |
---|
308 | $thumbnail_url = $cat_directory; |
---|
309 | $thumbnail_url.= 'thumbnail/'.$conf['prefix_thumbnail']; |
---|
310 | $thumbnail_url.= $file.'.'.$row['tn_ext']; |
---|
311 | // message in title for the thumbnail |
---|
312 | $thumbnail_title = $row['file']; |
---|
313 | if ( $row['filesize'] == '' ) |
---|
314 | $poids = floor( filesize( $cat_directory.$row['file'] ) / 1024 ); |
---|
315 | else |
---|
316 | $poids = $row['filesize']; |
---|
317 | $thumbnail_title .= ' : '.$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'].'&mode='.$_GET['mode']; |
---|
324 | } |
---|
325 | // date of availability for creation icon |
---|
326 | list( $year,$month,$day ) = explode( '-', $row['date_available'] ); |
---|
327 | $date = mktime( 0, 0, 0, $month, $day, $year ); |
---|
328 | |
---|
329 | // sending vars to display |
---|
330 | if (!$cell_number && ( $line_number< $user['nb_line_page'])) |
---|
331 | { |
---|
332 | $template->assign_block_vars('thumbnails.line', array()); |
---|
333 | $cell_number = 0; |
---|
334 | $line_number++; |
---|
335 | } |
---|
336 | if ( $cell_number++ == $user['nb_image_line'] -1) $cell_number = 0; |
---|
337 | |
---|
338 | $template->assign_block_vars('thumbnails.line.thumbnail', array( |
---|
339 | 'IMAGE'=>$thumbnail_url, |
---|
340 | 'IMAGE_ALT'=>$row['file'], |
---|
341 | 'IMAGE_TITLE'=>$thumbnail_title, |
---|
342 | 'IMAGE_NAME'=>$name, |
---|
343 | 'IMAGE_TS'=>get_icon( $date ), |
---|
344 | |
---|
345 | 'U_IMG_LINK'=>add_session_id( $url_link ) |
---|
346 | )); |
---|
347 | |
---|
348 | if ( $conf['show_comments'] && $user['show_nb_comments'] ) |
---|
349 | { |
---|
350 | $vtp->addSession( $handle, 'nb_comments' ); |
---|
351 | $query = 'SELECT COUNT(*) AS nb_comments'; |
---|
352 | $query.= ' FROM '.COMMENTS_TABLE.' WHERE image_id = '.$row['id']; |
---|
353 | $query.= " AND validated = 'true'"; |
---|
354 | $query.= ';'; |
---|
355 | $row = mysql_fetch_array( mysql_query( $query ) ); |
---|
356 | $vtp->setVar( $handle, 'nb_comments.nb', $row['nb_comments'] ); |
---|
357 | $vtp->closeSession( $handle, 'nb_comments' ); |
---|
358 | } |
---|
359 | } |
---|
360 | } |
---|
361 | //-------------------------------------------------------------- empty category |
---|
362 | else |
---|
363 | { |
---|
364 | $subcats=array(); |
---|
365 | if (isset($page['cat'])) $subcats = get_non_empty_subcat_ids( $page['cat'] ); |
---|
366 | else $subcats = get_non_empty_subcat_ids( '' ); |
---|
367 | $cell_number = 0; |
---|
368 | $i = 0; |
---|
369 | |
---|
370 | $template->assign_block_vars('thumbnails', array()); |
---|
371 | |
---|
372 | foreach ( $subcats as $subcat_id => $non_empty_id ) |
---|
373 | { |
---|
374 | $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"'; |
---|
375 | $name.= ' alt=">"/> '; |
---|
376 | $name.= '[ <span style="font-weight:bold;">'; |
---|
377 | $name.= $page['plain_structure'][$subcat_id]['name']; |
---|
378 | $name.= '</span> ]'; |
---|
379 | |
---|
380 | // searching the representative picture of the category |
---|
381 | $query = 'SELECT representative_picture_id'; |
---|
382 | $query.= ' FROM '.CATEGORIES_TABLE.' 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 '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE; |
---|
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 | if (!$cell_number && $i < count( $subcats )) |
---|
425 | { |
---|
426 | $template->assign_block_vars('thumbnails.line', array()); |
---|
427 | $cell_number = 0; |
---|
428 | $i++; |
---|
429 | } |
---|
430 | if ( $cell_number++ == $user['nb_image_line'] -1) $cell_number = 0; |
---|
431 | |
---|
432 | $template->assign_block_vars('thumbnails.line.thumbnail', array( |
---|
433 | 'IMAGE'=>$thumbnail_link, |
---|
434 | 'IMAGE_ALT'=>$image_row['file'], |
---|
435 | 'IMAGE_TITLE'=>$thumbnail_title, |
---|
436 | 'IMAGE_NAME'=>$name, |
---|
437 | 'IMAGE_TS'=>get_icon( $date ), |
---|
438 | |
---|
439 | 'U_IMG_LINK'=>add_session_id( $url_link ) |
---|
440 | )); |
---|
441 | } |
---|
442 | } |
---|
443 | //------------------------------------------------------- category informations |
---|
444 | if ( isset ( $page['cat'] ) ) |
---|
445 | { |
---|
446 | $cat_name=''; |
---|
447 | // total number of pictures in the category |
---|
448 | if ( is_numeric( $page['cat'] ) ) |
---|
449 | { |
---|
450 | $cat_name=get_cat_display_name( $page['cat_name'],' - ','font-style:italic;' ); |
---|
451 | // upload a picture in the category |
---|
452 | if ( $page['cat_site_id'] == 1 |
---|
453 | and $conf['upload_available'] |
---|
454 | and $page['cat_uploadable'] ) |
---|
455 | { |
---|
456 | $url = './upload.php?cat='.$page['cat'].'&expand='.$page['expand']; |
---|
457 | $template->assign_block_vars('upload',array('U_UPLOAD'=>add_session_id( $url ))); |
---|
458 | } |
---|
459 | } |
---|
460 | else |
---|
461 | { |
---|
462 | $cat_name= $page['title']; |
---|
463 | } |
---|
464 | $template->assign_block_vars('cat_infos',array( |
---|
465 | 'CAT_NAME'=>$cat_name, |
---|
466 | 'NB_IMG_CAT' => $page['cat_nb_images'] |
---|
467 | )); |
---|
468 | |
---|
469 | // navigation bar |
---|
470 | if ( $page['navigation_bar'] != '' ) |
---|
471 | { |
---|
472 | $template->assign_block_vars('cat_infos.navigation',array('NAV_BAR' => $page['navigation_bar'])); |
---|
473 | } |
---|
474 | // category comment |
---|
475 | if ( isset( $page['comment'] ) and $page['comment'] != '' ) |
---|
476 | { |
---|
477 | $template->assign_block_vars('cat_infos.navigation',array('COMMENTS' => $page['cat_comment'])); |
---|
478 | } |
---|
479 | } |
---|
480 | //------------------------------------------------------------ log informations |
---|
481 | pwg_log( 'category', $page['title'] ); |
---|
482 | mysql_close(); |
---|
483 | |
---|
484 | $template->pparse('category'); |
---|
485 | include('include/page_tail.php'); |
---|
486 | ?> |
---|