Changeset 252 for branches/release-1_3/category.php
- Timestamp:
- Jan 3, 2004, 10:20:53 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/release-1_3/category.php
r193 r252 35 35 } 36 36 //-------------------------------------------------- access authorization check 37 // creating the plain structure : array of all the available categories and38 // their relative informations, see the definition of the function39 // get_plain_structure for further details.40 $page['plain_structure'] = get_plain_structure();41 42 37 check_cat_id( $_GET['cat'] ); 43 38 check_login_authorization(); … … 47 42 } 48 43 //-------------------------------------------------------------- initialization 44 // detection of the start picture to display 45 if ( !isset( $_GET['start'] ) 46 or !is_numeric( $_GET['start'] ) 47 or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) ) 48 $page['start'] = 0; 49 else 50 $page['start'] = $_GET['start']; 51 52 initialize_category(); 53 49 54 // creation of the array containing the cat ids to expand in the menu 50 55 // $page['tab_expand'] contains an array with the category ids … … 57 62 if ( is_numeric( $id ) ) array_push( $page['tab_expand'], $id ); 58 63 } 59 if ( is_numeric( $page['cat'] ) ) 60 { 61 // the category displayed (in the URL cat=23) must be seen in the menu -> 62 // parent categories must be expanded 63 $parent = $page['plain_structure'][$page['cat']]['id_uppercat']; 64 while ( $parent != '' ) 65 { 66 array_push( $page['tab_expand'], $parent ); 67 $parent = $page['plain_structure'][$parent]['id_uppercat']; 68 } 69 } 70 $page['expand'] = implode( ',', $page['tab_expand'] ); 71 } 64 } 65 if ( is_numeric( $page['cat'] ) ) 66 { 67 // the category displayed (in the URL cat=23) must be seen in the menu -> 68 // parent categories must be expanded 69 $uppercats = explode( ',', $page['uppercats'] ); 70 foreach ( $uppercats as $uppercat ) { 71 array_push( $page['tab_expand'], $uppercat ); 72 } 73 } 74 $page['tab_expand'] = array_unique( $page['tab_expand'] ); 75 $page['expand'] = implode( ',', $page['tab_expand'] ); 72 76 // in case of expanding all authorized cats 73 77 // The $page['expand'] equals 'all' and … … 77 81 $page['tab_expand'] = array(); 78 82 $page['expand'] = 'all'; 79 }80 // detection of the start picture to display81 if ( !isset( $_GET['start'] )82 or !is_numeric( $_GET['start'] )83 or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )84 {85 $page['start'] = 0;86 }87 else88 {89 $page['start'] = $_GET['start'];90 83 } 91 84 // Sometimes, a "num" is provided in the URL. It is the number … … 99 92 } 100 93 // creating the structure of the categories (useful for displaying the menu) 101 $page['structure'] = create_structure( '', $user['restrictions'] ); 94 // creating the plain structure : array of all the available categories and 95 // their relative informations, see the definition of the function 96 // get_user_plain_structure for further details. 97 $page['plain_structure'] = get_user_plain_structure(); 98 $page['structure'] = create_user_structure( '' ); 102 99 $page['structure'] = update_structure( $page['structure'] ); 103 initialize_category();104 100 //----------------------------------------------------- template initialization 105 101 $vtp = new VTemplate; … … 128 124 $icon_long = get_icon( time() - ( $user['short_period'] * 24 * 60 * 60 + 1 ) ); 129 125 $vtp->setGlobalVar( $handle, 'icon_long', $icon_long ); 130 $nb_total_pictures = count_ images( $page['structure']);126 $nb_total_pictures = count_user_total_images(); 131 127 $vtp->setGlobalVar( $handle, 'nb_total_pictures',$nb_total_pictures ); 128 132 129 //------------------------------------------------------------- categories menu 133 130 // normal categories … … 255 252 $query.= ',storage_category_id'; 256 253 $query.= ' FROM '.PREFIX_TABLE.'images AS i'; 257 $query.= ' LEFTJOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id';254 $query.=' INNER JOIN '.PREFIX_TABLE.'image_category AS ic ON id=ic.image_id'; 258 255 $query.= $page['where']; 259 256 $query.= $conf['order_by']; … … 351 348 elseif ( ( isset( $page['cat'] ) 352 349 and is_numeric( $page['cat'] ) 353 and $page['cat_nb_images'] == 0 ) 350 and $page['cat_nb_images'] == 0 351 and $page['plain_structure'][$page['cat']]['nb_sub_categories'] > 0) 354 352 or $_GET['cat'] == '' ) 355 353 { … … 371 369 $query.= ' FROM '.PREFIX_TABLE.'categories'; 372 370 $query.= ' WHERE id = '.$non_empty_id; 371 $query.= ';'; 373 372 $row = mysql_fetch_array( mysql_query( $query ) ); 374 373 375 374 $query = 'SELECT file,tn_ext,storage_category_id'; 376 $query.= ' FROM '.PREFIX_TABLE.'images'; 377 $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id'; 375 $query.= ' FROM '.PREFIX_TABLE.'images, '.PREFIX_TABLE.'image_category'; 378 376 $query.= ' WHERE category_id = '.$non_empty_id; 377 $query.= ' AND id = image_id'; 379 378 // if the category has a representative picture, this is its thumbnail 380 379 // tha will be displayed !
Note: See TracChangeset
for help on using the changeset viewer.