Changeset 67 for trunk/include/functions_category.inc.php
- Timestamp:
- Sep 6, 2003, 9:22:59 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_category.inc.php
r64 r67 128 128 { 129 129 global $page; 130 131 if ( !isset( $page['plain_structure'] ) ) 132 $page['plain_structure'] = get_plain_structure(); 130 133 131 134 $structure = array(); … … 303 306 304 307 $cat['name'] = array(); 308 309 if ( !isset( $page['plain_structure'] ) ) 310 $page['plain_structure'] = get_plain_structure(); 311 305 312 array_push( $cat['name'], $page['plain_structure'][$id]['name'] ); 306 313 while ( $page['plain_structure'][$id]['id_uppercat'] != '' ) … … 330 337 global $page; 331 338 339 if ( !isset( $page['plain_structure'] ) ) 340 $page['plain_structure'] = get_plain_structure(); 341 332 342 // creating the local path : "root_cat/sub_cat/sub_sub_cat/" 333 343 $dir = $page['plain_structure'][$category_id]['dir'].'/'; … … 345 355 { 346 356 global $page; 357 358 if ( !isset( $page['plain_structure'] ) ) 359 $page['plain_structure'] = get_plain_structure(); 347 360 348 361 $query = 'SELECT galleries_url'; … … 434 447 // we must not show pictures of a forbidden category 435 448 $restricted_cats = get_all_restrictions( $user['id'],$user['status'] ); 436 foreach ( $restricted_cats as $restricted_cat ) { 437 $where_append.= ' AND category_id != '.$restricted_cat; 449 if ( count( $restricted_cats ) > 0 ) 450 { 451 $where_append.= ' AND category_id NOT IN ('; 452 foreach ( $restricted_cats as $i => $restricted_cat ) { 453 if ( $i > 0 ) $where_append.= ','; 454 $where_append.= $restricted_cat; 455 } 456 $where_append.= ')'; 438 457 } 439 458 } … … 482 501 $page['where'].= $where_append; 483 502 484 $query = 'SELECT COUNT( *) AS nb_total_images';503 $query = 'SELECT COUNT(DISTINCT(id)) AS nb_total_images'; 485 504 $query.= ' FROM '.PREFIX_TABLE.'images'; 505 $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic'; 506 $query.= ' ON id = ic.image_id'; 486 507 $query.= $page['where']; 487 508 $query.= ';'; … … 514 535 $page['where'].= $where_append; 515 536 516 $query = 'SELECT COUNT( *) AS nb_total_images';537 $query = 'SELECT COUNT(DISTINCT(id)) AS nb_total_images'; 517 538 $query.= ' FROM '.PREFIX_TABLE.'images'; 539 $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic'; 540 $query.= ' ON id = ic.image_id'; 518 541 $query.= $page['where']; 519 542 $query.= ';'; … … 531 554 } 532 555 } 533 556 534 557 if ( $query != '' ) 535 558 { 559 echo $query; 536 560 $result = mysql_query( $query ); 537 561 $row = mysql_fetch_array( $result );
Note: See TracChangeset
for help on using the changeset viewer.