Changeset 18165 for trunk/include
- Timestamp:
- Sep 23, 2012, 1:19:26 PM (12 years ago)
- Location:
- trunk/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_cats.inc.php
r12930 r18165 23 23 24 24 /** 25 * This file is included by the main page to show thumbnails fora category26 * that have only subcategories or to show recent categories25 * This file is included by the main page to show subcategories of a category 26 * or to show recent categories or main page categories list 27 27 * 28 28 */ 29 30 $selection = array_slice( 31 $page['categories'], 32 $page['starta'], 33 $conf['nb_categories_page'] 34 ); 35 36 $selection = trigger_event('loc_index_categories_selection', $selection); 29 37 30 38 // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE … … 39 47 count_categories 40 48 FROM '.CATEGORIES_TABLE.' c 41 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ucc ON id = cat_id AND user_id = '.$user['id']; 42 43 if ('recent_cats' == $page['section']) 44 { 45 $query.= ' 46 WHERE date_last >= '.pwg_db_get_recent_period_expression($user['recent_period']); 47 } 48 else 49 { 50 $query.= ' 51 WHERE id_uppercat '.(!isset($page['category']) ? 'is NULL' : '= '.$page['category']['id']); 52 } 53 54 $query.= ' 55 '.get_sql_condition_FandF( 56 array( 57 'visible_categories' => 'id', 58 ), 59 'AND' 60 ); 61 49 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ucc 50 ON id = cat_id 51 AND user_id = '.$user['id'].' 52 WHERE c.id IN('.implode(',', $selection).')'; 53 62 54 if ('recent_cats' != $page['section']) 63 55 { -
trunk/include/functions.inc.php
r18164 r18165 1430 1430 * return an array which will be sent to template to display navigation bar 1431 1431 */ 1432 function create_navigation_bar($url, $nb_element, $start, $nb_element_page, $clean_url = false )1432 function create_navigation_bar($url, $nb_element, $start, $nb_element_page, $clean_url = false, $param_name='start') 1433 1433 { 1434 1434 global $conf; … … 1436 1436 $navbar = array(); 1437 1437 $pages_around = $conf['paginate_pages_around']; 1438 $start_str = $clean_url ? '/ start-' : (strpos($url, '?')===false ? '?':'&').'start=';1438 $start_str = $clean_url ? '/'.$param_name.'-' : (strpos($url, '?')===false ? '?':'&').$param_name.'='; 1439 1439 1440 1440 if (!isset($start) or !is_numeric($start) or (is_numeric($start) and $start < 0)) -
trunk/include/functions_url.inc.php
r15383 r18165 459 459 and strpos($tokens[$current_token], 'posted-')!==0 460 460 and strpos($tokens[$next_token], 'start-')!==0 461 and strpos($tokens[$next_token], 'starta-')!==0 461 462 and $tokens[$current_token] != 'flat') 462 463 { … … 652 653 $page['start'] = $matches[1]; 653 654 } 655 elseif (preg_match('/^starta-(\d+)/', $tokens[$i], $matches)) 656 { 657 $page['starta'] = $matches[1]; 658 } 654 659 $i++; 655 660 } -
trunk/include/section_init.inc.php
r13872 r18165 42 42 // ); 43 43 44 $page['items'] = array(); 44 // exemple of dynamic nb_categories_page (%2 for nice display) 45 // $conf['nb_categories_page'] = 2*round($user['nb_image_page']/4); 46 47 $page['items'] = $page['categories'] = array(); 48 $page['start'] = $page['starta'] = 0; 45 49 46 50 // some ISPs set PATH_INFO to empty string or to SCRIPT_FILENAME while in the … … 247 251 $page['title'] = ''; // will be set later 248 252 253 254 // GET IMAGES LIST 249 255 if 250 256 ( 257 $page['starta'] == 0 and 251 258 (!isset($page['chronology_field'])) and 252 259 ( … … 311 318 $page['items'] = array_from_query($query, 'image_id'); 312 319 } //otherwise the calendar will requery all subitems 320 321 // GET CATEGORIES LIST 322 if ( 0==$page['start'] 323 and !isset($page['flat']) 324 and !isset($page['chronology_field']) 325 and ('recent_cats'==$page['section'] or 'categories'==$page['section']) 326 and (!isset($page['category']['count_categories']) or $page['category']['count_categories']>0 ) 327 ) 328 { 329 $query = ' 330 SELECT c.id 331 FROM '.CATEGORIES_TABLE.' c 332 INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' ucc 333 ON id = cat_id 334 AND user_id = '.$user['id']; 335 336 if ('recent_cats' == $page['section']) 337 { 338 $query.= ' 339 WHERE date_last >= '.pwg_db_get_recent_period_expression($user['recent_period']); 340 } 341 else 342 { 343 $query.= ' 344 WHERE id_uppercat '.(!isset($page['category']) ? 'is NULL' : '= '.$page['category']['id']); 345 } 346 347 $query.= ' 348 '.get_sql_condition_FandF( 349 array('visible_categories' => 'id'), 350 'AND' 351 ); 352 353 $query.= ' 354 ;'; 355 356 $page['categories'] = array_from_query($query, 'id'); 357 } 313 358 } 314 359 // special sections
Note: See TracChangeset
for help on using the changeset viewer.