- Timestamp:
- Mar 5, 2004, 11:54:53 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/category.php
r375 r386 53 53 function display_category( $category, $indent ) 54 54 { 55 global $user,$lang,$template, $handle; 56 57 $style=''; 55 global $user,$template,$page; 56 58 57 $url = './category.php?cat='.$category['id']; 59 $url.= '&expand='.$category['expand_string']; 58 59 $style = ''; 60 if ( isset( $page['cat'] ) 61 and is_numeric( $page['cat'] ) 62 and $category['id'] == $page['cat'] ) 63 { 64 $style = 'font-weight:normal;color:yellow;'; 65 } 66 60 67 $name = $category['name']; 61 68 if ( $name == '' ) $name = str_replace( '_', ' ', $category['dir'] ); 62 if ( $category['id_uppercat'] == '' ) 63 { 64 $style = 'font-weight:bold;'; 65 } 66 67 $template->assign_block_vars('category', array( 68 'LINK_NAME' => $name, 69 'INDENT' => $indent, 70 'NB_SUBCATS'=>$category['nb_sub_categories'], 71 'TOTAL_CAT'=>$category['nb_images'], 72 'CAT_ICON'=>get_icon($category['date_last']), 73 74 'T_NAME'=>$style, 75 'U_LINK' => add_session_id($url))); 76 69 70 $template->assign_block_vars( 71 'category', 72 array( 73 'T_NAME' => $style, 74 'LINK_NAME' => $name, 75 'INDENT' => $indent, 76 'NB_SUBCATS'=>$category['nb_sub_categories'], 77 'TOTAL_CAT'=>$category['nb_images'], 78 'CAT_ICON'=>get_icon($category['date_last']), 79 80 'U_LINK' => add_session_id($url)) 81 ); 82 77 83 if ( $user['expand'] or $category['nb_sub_categories'] == 0 ) 78 84 { 79 $template->assign_block_vars('category.bulletnolink', array('BULLET_IMAGE' => $user['lien_collapsed'])); 85 $template->assign_block_vars( 86 'category.bulletnolink', 87 array('BULLET_IMAGE' => $user['lien_collapsed']) 88 ); 80 89 } 81 90 else 82 91 { 83 $url = './category.php'; 84 if (isset($page['cat'])) 85 { 86 $url .='?cat='.$page['cat']; 87 $url.= '&expand='.$category['expand_string']; 88 } 89 else if ($category['expand_string']<>'') 90 { 91 $url.= '?expand='.$category['expand_string']; 92 } 93 94 if ( $category['expanded'] ) 92 $url = './category.php'; 93 if (isset($page['cat'])) 94 { 95 $url .='?cat='.$page['cat']; 96 } 97 98 if ( $category['expanded'] ) 95 99 { 96 100 $img=$user['lien_expanded']; … … 100 104 $img=$user['lien_collapsed']; 101 105 } 102 103 $template->assign_block_vars('category.bulletlink', array( 104 'BULLET_IMAGE' => $img, 105 'U_BULLET_LINK'=> add_session_id($url) 106 )); 107 } 108 106 107 $template->assign_block_vars( 108 'category.bulletlink', 109 array( 110 'BULLET_IMAGE' => $img, 111 'U_BULLET_LINK'=> add_session_id($url)) 112 ); 113 } 114 109 115 // recursive call 110 116 if ( $category['expanded'] ) 111 117 { 112 118 foreach ( $category['subcats'] as $subcat ) { 113 119 $template->assign_block_vars('category.subcat', array()); 114 120 display_category( $subcat, $indent.str_repeat( ' ', 2 )); 115 121 } … … 131 137 // $page['expand'] contains the string to display in URL with comma 132 138 $page['tab_expand'] = array(); 133 if ( isset ( $_GET['expand'] ) and $_GET['expand'] != 'all' ) 134 { 135 $tab_expand = explode( ',', $_GET['expand'] ); 136 foreach ( $tab_expand as $id ) { 137 if ( is_numeric( $id ) ) array_push( $page['tab_expand'], $id ); 138 } 139 } 140 if ( isset($page['cat']) && is_numeric( $page['cat'] ) ) 139 if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) ) 141 140 { 142 141 // the category displayed (in the URL cat=23) must be seen in the menu -> … … 147 146 } 148 147 } 149 $page['tab_expand'] = array_unique( $page['tab_expand'] ); 150 $page['expand'] = implode( ',', $page['tab_expand'] ); 151 // in case of expanding all authorized cats 152 // The $page['expand'] equals 'all' and 153 // $page['tab_expand'] contains all the authorized cat ids 154 if ( $user['expand'] 155 or ( isset( $_GET['expand'] ) and $_GET['expand'] == 'all' ) ) 148 // in case of expanding all authorized cats $page['tab_expand'] is empty 149 if ( $user['expand'] ) 156 150 { 157 151 $page['tab_expand'] = array(); 158 $page['expand'] = 'all'; 159 } 152 } 153 160 154 // Sometimes, a "num" is provided in the URL. It is the number 161 155 // of the picture to show. This picture must be in the thumbnails page. … … 247 241 248 242 'U_HOME' => add_session_id( PHPWG_ROOT_PATH.'category.php' ), 249 'U_FAVORITE' => add_session_id( PHPWG_ROOT_PATH.'category.php?cat=fav &expand='.$page['expand']),250 'U_MOST_VISITED'=>add_session_id( PHPWG_ROOT_PATH.'category.php?cat=most_visited &expand='.$page['expand']),251 'U_RECENT'=>add_session_id( PHPWG_ROOT_PATH.'category.php?cat=recent &expand='.$page['expand']),243 'U_FAVORITE' => add_session_id( PHPWG_ROOT_PATH.'category.php?cat=fav' ), 244 'U_MOST_VISITED'=>add_session_id( PHPWG_ROOT_PATH.'category.php?cat=most_visited' ), 245 'U_RECENT'=>add_session_id( PHPWG_ROOT_PATH.'category.php?cat=recent' ), 252 246 'U_LOGOUT' => add_session_id( PHPWG_ROOT_PATH.'category.php?act=logout' ), 253 247 'U_ADMIN'=>add_session_id( PHPWG_ROOT_PATH.'admin.php' ), … … 363 357 // url link on picture.php page 364 358 $url_link = './picture.php?cat='.$page['cat']; 365 $url_link.= '&image_id='.$row['id'] .'&expand='.$page['expand'];359 $url_link.= '&image_id='.$row['id']; 366 360 if ( $page['cat'] == 'search' ) 367 361 { … … 454 448 455 449 $url_link = './category.php?cat='.$subcat_id; 456 if ( isset($page['cat'])&& !in_array( $page['cat'], $page['tab_expand'] ) )457 {458 array_push( $page['tab_expand'], $page['cat'] );459 $page['expand'] = implode( ',', $page['tab_expand'] );460 }461 $url_link.= '&expand='.$page['expand'];462 // we add the category to explore in the expand list463 if ( $page['expand'] != '' ) $url_link.= ',';464 $url_link.= $subcat_id;465 450 466 451 $date = $page['plain_structure'][$subcat_id]['date_last']; … … 499 484 and $page['cat_uploadable'] ) 500 485 { 501 $url = './upload.php?cat='.$page['cat'] .'&expand='.$page['expand'];486 $url = './upload.php?cat='.$page['cat']; 502 487 $template->assign_block_vars('upload',array('U_UPLOAD'=>add_session_id( $url ))); 503 488 }
Note: See TracChangeset
for help on using the changeset viewer.