Changeset 61 for trunk/category.php
- Timestamp:
- Aug 30, 2003, 5:54:37 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/category.php
r57 r61 232 232 if ( isset( $page['cat'] ) and $page['cat_nb_images'] != 0 ) 233 233 { 234 if ( is_numeric( $page['cat'] ) ) 235 { 236 $cat_directory = $page['cat_dir']; 237 } 238 else if ( $page['cat'] == 'search' or $page['cat'] == 'fav' ) 239 { 240 $array_cat_directories = array(); 241 } 234 $array_cat_directories = array(); 242 235 243 $query = 'SELECT id,file,date_available,tn_ext,name,filesize,cat_id'; 236 $query = 'SELECT id,file,date_available,tn_ext,name,filesize'; 237 $query.= ',storage_category_id,category_id'; 244 238 $query.= ' FROM '.PREFIX_TABLE.'images'; 239 $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id'; 245 240 $query.= $page['where']; 246 241 $query.= $conf['order_by']; 247 242 $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page']; 248 243 $query.= ';'; 249 echo $query;250 244 $result = mysql_query( $query ); 251 245 … … 258 252 while ( $row = mysql_fetch_array( $result ) ) 259 253 { 260 if ( !is_numeric( $page['cat'] ) ) 261 { 262 if ( $array_cat_directories[$row['cat_id']] == '' ) 263 { 264 $cat_result = get_cat_info( $row['cat_id'] ); 265 $array_cat_directories[$row['cat_id']] = $cat_result['dir']; 266 } 267 $cat_directory = $array_cat_directories[$row['cat_id']]; 268 } 254 if ( $array_cat_directories[$row['storage_category_id']] == '' ) 255 { 256 $array_cat_directories[$row['storage_category_id']] = 257 get_complete_dir( $row['storage_category_id'] ); 258 } 259 $cat_directory = $array_cat_directories[$row['storage_category_id']]; 260 269 261 $file = get_filename_wo_extension( $row['file'] ); 270 262 // name of the picture 271 if ( $row['name'] != '' ) 272 { 273 $name = $row['name']; 274 } 275 else 276 { 277 $name = str_replace( '_', ' ', $file ); 278 } 263 if ( $row['name'] != '' ) $name = $row['name']; 264 else $name = str_replace( '_', ' ', $file ); 265 279 266 if ( $page['cat'] == 'search' ) 280 267 { … … 359 346 $i = 0; 360 347 foreach ( $subcats as $subcat_id => $non_empty_id ) { 361 $subcat_infos = get_cat_info( $subcat_id ); 362 $non_empty_infos = get_cat_info( $non_empty_id ); 348 $subcat_infos = get_cat_info( $subcat_id ); 363 349 364 350 $name ='[ <span style="font-weight:bold;">'; 365 351 $name.= $subcat_infos['name'][0]; 366 352 $name.= '</span> ]'; 367 368 $query = 'SELECT file,tn_ext ';353 354 $query = 'SELECT file,tn_ext,storage_category_id'; 369 355 $query.= ' FROM '.PREFIX_TABLE.'images'; 370 $query.= ' WHERE cat_id = '.$non_empty_id; 356 $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id'; 357 $query.= ' WHERE category_id = '.$non_empty_id; 371 358 $query.= ' ORDER BY RAND()'; 372 359 $query.= ' LIMIT 0,1'; … … 378 365 379 366 // creating links for thumbnail and associated category 380 $thumbnail_link = $non_empty_infos['dir'];367 $thumbnail_link = get_complete_dir( $image_row['storage_category_id'] ); 381 368 $thumbnail_link.= 'thumbnail/'.$conf['prefix_thumbnail']; 382 369 $thumbnail_link.= $file.'.'.$image_row['tn_ext'];
Note: See TracChangeset
for help on using the changeset viewer.