Changeset 1722
- Timestamp:
- Jan 15, 2007, 1:09:14 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_cats.inc.php
r1719 r1722 175 175 { 176 176 // Update filtered data 177 update_cats_with_filtered_data($categories); 177 if (function_exists('update_cats_with_filtered_data')) 178 { 179 update_cats_with_filtered_data($categories); 180 } 178 181 179 182 if ($conf['subcatify']) -
trunk/include/common.inc.php
r1699 r1722 232 232 } 233 233 234 if (! defined('IN_ADMIN') or !IN_ADMIN)234 if (!empty($conf['filter_pages']) and get_filter_page_value('used')) 235 235 { 236 236 include(PHPWG_ROOT_PATH.'include/functions_filter.inc.php'); 237 237 include(PHPWG_ROOT_PATH.'include/filter.inc.php'); 238 } 239 else 240 { 241 // global variable for filter 242 $filter = array(); 243 $filter['enabled'] = false; 238 244 } 239 245 -
trunk/include/config_default.inc.php
r1715 r1722 569 569 // | Filter | 570 570 // +-----------------------------------------------------------------------+ 571 // Pages where filter is enabled 572 // Other pages cancel current filter 573 // Array of basename without file extention 571 // $conf['filter_pages'] contains configuration for each pages 572 // o If values are not defined for a specific page, default value are used 573 // o Array is composed by the basename of each page without extention 574 // o List of value names: 575 // - used: filter function are used 576 // (if false nothing is done [start, cancel, stop, ...] 577 // - cancel: cancel current started filter 578 // - add_notes: add notes about current started filter on the header 579 // o Empty configuration in order to disable completely filter functions 580 // No filter, No icon,... 581 // $conf['filter_pages'] = array(); 574 582 $conf['filter_pages'] = array 575 583 ( 576 'about', 'action', 'admin', 'comments', 577 'index', 'picture', 'popuphelp', 'profile', 578 'qsearch', 'random', 'register', 'search', 579 'search_rules', 'tags', 'upload' 584 // Default page 585 'default' => array( 586 'used' => true, 'cancel' => false, 'add_notes' => false), 587 // Real pages 588 'index' => array('add_notes' => true), 589 'tags' => array('add_notes' => true), 590 'search' => array('add_notes' => true), 591 'comments' => array('add_notes' => true), 592 'admin' => array('used' => false), 593 'feed' => array('used' => false), 594 'notification' => array('used' => false), 595 'nbm' => array('used' => false), 596 'popuphelp' => array('used' => false), 597 'profile' => array('used' => false), 598 'web_service' => array('used' => false), 599 'ws' => array('used' => false), 600 'identification' => array('cancel' => true), 601 'install' => array('cancel' => true), 602 'password' => array('cancel' => true), 603 'register' => array('cancel' => true), 604 'upgrade_feed' => array('cancel' => true), 580 605 ); 581 606 -
trunk/include/filter.inc.php
r1715 r1722 29 29 30 30 // $filter['enabled']: Filter is enabled 31 // $filter['check_key']: Check key to valitade computed filter data 32 // $filter['recent_period']: Recent period used to computed filter data 31 33 // $filter['categories']: Computed data of filtered categories 32 // $filter['visible_categories']: List of visible categories (count(visible) < count(forbidden) more often) 34 // $filter['visible_categories']: 35 // List of visible categories (count(visible) < count(forbidden) more often) 33 36 // $filter['visible_images']: List of visible images 34 37 35 if ( in_array(script_basename(), $conf['filter_pages']))38 if (!get_filter_page_value('cancel')) 36 39 { 37 40 if (isset($_GET['filter'])) 38 41 { 39 $filter['enabled'] = ($_GET['filter'] == 'start'); 42 $filter['matches'] = array(); 43 $filter['enabled'] = 44 preg_match('/^start-(\d+)/', $_GET['filter'], $filter['matches']) === 1; 40 45 } 41 46 else … … 51 56 if ($filter['enabled']) 52 57 { 58 if (isset($filter['matches'])) 59 { 60 $filter['recent_period'] = $filter['matches'][1]; 61 } 62 else 63 { 64 $filter['recent_period'] = pwg_get_session_var('filter_recent_period', $user['recent_period']); 65 } 66 53 67 if ( 54 68 // New filter … … 62 76 // Need to compute dats 63 77 $filter['check_key'] = get_filter_check_key(); 64 $filter['categories'] = get_computed_categories($user['id'], $user['forbidden_categories'], true, $ user['recent_period']);78 $filter['categories'] = get_computed_categories($user['id'], $user['forbidden_categories'], true, $filter['recent_period']); 65 79 66 80 $filter['visible_categories'] = implode(',', array_keys($filter['categories'])); … … 84 98 $query.= ' 85 99 date_available > SUBDATE( 86 CURRENT_DATE,INTERVAL '.$ user['recent_period'].' DAY)';100 CURRENT_DATE,INTERVAL '.$filter['recent_period'].' DAY)'; 87 101 88 102 $filter['visible_images'] = implode(',', array_from_query($query, 'image_id')); … … 97 111 pwg_set_session_var('filter_enabled', $filter['enabled']); 98 112 pwg_set_session_var('filter_check_key', $filter['check_key']); 113 pwg_set_session_var('filter_recent_period', $filter['recent_period']); 99 114 pwg_set_session_var('filter_categories', serialize($filter['categories'])); 100 115 pwg_set_session_var('filter_visible_categories', $filter['visible_categories']); … … 111 126 } 112 127 113 $header_notes[] = l10n_dec('note_filter_day', 'note_filter_days', $user['recent_period']); 128 if (get_filter_page_value('add_notes')) 129 { 130 $header_notes[] = l10n_dec('note_filter_day', 'note_filter_days', $filter['recent_period']); 131 } 114 132 } 115 133 else … … 119 137 pwg_unset_session_var('filter_enabled'); 120 138 pwg_unset_session_var('filter_check_key'); 139 pwg_unset_session_var('filter_recent_period'); 121 140 pwg_unset_session_var('filter_categories'); 122 141 pwg_unset_session_var('filter_visible_categories'); -
trunk/include/functions.inc.php
r1717 r1722 1105 1105 } 1106 1106 1107 /** 1108 * Return value for the current page define on $conf['filter_pages'] 1109 * Îf value is not defined, default value are returned 1110 * 1111 * @param value name 1112 * 1113 * @return filter page value 1114 */ 1115 function get_filter_page_value($value_name) 1116 { 1117 global $conf; 1118 1119 $page_name = script_basename(); 1120 1121 if (isset($conf['filter_pages'][$page_name][$value_name])) 1122 { 1123 return $conf['filter_pages'][$page_name][$value_name]; 1124 } 1125 else if (isset($conf['filter_pages']['default'][$value_name])) 1126 { 1127 return $conf['filter_pages']['default'][$value_name]; 1128 } 1129 else 1130 { 1131 return null; 1132 } 1133 } 1134 1107 1135 ?> -
trunk/include/functions_category.inc.php
r1677 r1722 108 108 109 109 // Update filtered data 110 update_cats_with_filtered_data($cats); 110 if (function_exists('update_cats_with_filtered_data')) 111 { 112 update_cats_with_filtered_data($cats); 113 } 111 114 112 115 return get_html_menu_category($cats); -
trunk/include/functions_filter.inc.php
r1677 r1722 35 35 function get_filter_check_key() 36 36 { 37 global $user ;38 39 return $user['id'].$ user['recent_period'].date('Ymd');37 global $user, $filter; 38 39 return $user['id'].$filter['recent_period'].date('Ymd'); 40 40 } 41 41 -
trunk/include/functions_url.inc.php
r1678 r1722 265 265 } 266 266 267 if (isset($params['flat_ recent_cat']) and $params['flat_recent_cat'] > 0)268 { 269 $url.= '/flat_ recent_cat-'.$params['flat_recent_cat'];267 if (isset($params['flat_cat'])) 268 { 269 $url.= '/flat_cat'; 270 270 } 271 271 -
trunk/include/menubar.inc.php
r1703 r1722 66 66 67 67 //------------------------------------------------------------------------ filter 68 if ($filter['enabled']) 69 { 70 $template->assign_block_vars( 71 'stop_filter', 72 array( 73 'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop')) 74 ) 75 ); 76 } 77 else 78 { 79 $template->assign_block_vars( 80 'start_filter', 81 array( 82 'URL' => add_url_params(make_index_url(array()), array('filter' => 'start')) 83 ) 84 ); 85 } 86 68 if (!empty($conf['filter_pages']) and get_filter_page_value('used')) 69 { 70 if ($filter['enabled']) 71 { 72 $template->assign_block_vars( 73 'stop_filter', 74 array( 75 'URL' => add_url_params(make_index_url(array()), array('filter' => 'stop')) 76 ) 77 ); 78 } 79 else 80 { 81 $template->assign_block_vars( 82 'start_filter', 83 array( 84 'URL' => add_url_params(make_index_url(array()), array('filter' => 'start-'.$user['recent_period'])) 85 ) 86 ); 87 } 88 } 87 89 88 90 //------------------------------------------------------------------------ tags -
trunk/include/section_init.inc.php
r1711 r1722 279 279 } 280 280 281 if ('categories' ==$page['section'] and282 preg_match('/^flat_recent_cat-(\d+)/', $tokens[$i], $matches))281 if ('categories' == $page['section'] and 282 'flat_cat' == $tokens[$i]) 283 283 { 284 284 // indicate a special list of images 285 $page['flat_ recent_cat'] = $matches[1];285 $page['flat_cat'] = true; 286 286 } 287 287 … … 365 365 get_cat_display_name($result['name'], '', false), 366 366 'thumbnails_include' => 367 (($result['nb_images'] > 0) or (isset($page['flat_ recent_cat'])))367 (($result['nb_images'] > 0) or (isset($page['flat_cat']))) 368 368 ? 'include/category_default.inc.php' 369 369 : 'include/category_cats.inc.php' … … 375 375 $page['title'] = $lang['no_category']; 376 376 $page['thumbnails_include'] = 377 (isset($page['flat_ recent_cat']))377 (isset($page['flat_cat'])) 378 378 ? 'include/category_default.inc.php' 379 379 : 'include/category_cats.inc.php'; 380 380 } 381 381 382 if (isset($page['flat_ recent_cat']))382 if (isset($page['flat_cat'])) 383 383 { 384 384 $page['title'] = $lang['recent_pics_cat'].' : '.$page['title'] ; … … 390 390 ( 391 391 (isset($page['category'])) or 392 (isset($page['flat_ recent_cat']))392 (isset($page['flat_cat'])) 393 393 ) 394 394 ) … … 399 399 } 400 400 401 if (isset($page['flat_ recent_cat']))401 if (isset($page['flat_cat'])) 402 402 { 403 403 // flat recent categories mode … … 409 409 INNER JOIN '.CATEGORIES_TABLE.' AS c ON ic.category_id = c.id 410 410 WHERE 411 date_available > SUBDATE( 412 CURRENT_DATE,INTERVAL '.$page['flat_recent_cat'].' DAY)'. 413 (isset($page['category']) ? ' 414 AND uppercats REGEXP \'(^|,)'.$page['category'].'(,|$)\'' : '' ).' 411 '.(isset($page['category']) ? ' 412 uppercats REGEXP \'(^|,)'.$page['category'].'(,|$)\'' : '1=1' ).' 415 413 '.$forbidden.' 416 414 ;'; … … 713 711 // add meta robots noindex, nofollow to avoid unnecesary robot crawls 714 712 $page['meta_robots']=array(); 715 if ( isset($page['chronology_field']) or isset($page['flat_ recent_cat'])713 if ( isset($page['chronology_field']) or isset($page['flat_cat']) 716 714 or 'list'==$page['section'] or 'recent_pics'==$page['section'] ) 717 715 { -
trunk/index.php
r1711 r1722 107 107 } 108 108 109 if (isset($page['flat_ recent_cat']) or isset($page['chronology_field']))109 if (isset($page['flat_cat']) or isset($page['chronology_field'])) 110 110 { 111 111 $template->assign_block_vars( 112 112 'mode_normal', 113 113 array( 114 'URL' => duplicate_index_url( array(), array('chronology_field', 'start', 'flat_ recent_cat') )115 ) 116 ); 117 } 118 119 if (!isset($page['flat_ recent_cat']) and 'categories'==$page['section'])120 { 121 $template->assign_block_vars( 122 'flat_ recent_cat',123 array( 124 'URL' => duplicate_index_url(array('flat_ recent_cat' => $user['recent_period']), array('start', 'chronology_field'))114 'URL' => duplicate_index_url( array(), array('chronology_field', 'start', 'flat_cat') ) 115 ) 116 ); 117 } 118 119 if (!isset($page['flat_cat']) and 'categories' == $page['section']) 120 { 121 $template->assign_block_vars( 122 'flat_cat', 123 array( 124 'URL' => duplicate_index_url(array('flat_cat' => ''), array('start', 'chronology_field')) 125 125 ) 126 126 ); … … 138 138 'mode_created', 139 139 array( 140 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_ recent_cat') )140 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_cat') ) 141 141 ) 142 142 ); … … 146 146 'mode_posted', 147 147 array( 148 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_ recent_cat') )148 'URL' => duplicate_index_url( $chronology_params, array('start', 'flat_cat') ) 149 149 ) 150 150 ); … … 162 162 $url = duplicate_index_url( 163 163 array('chronology_field'=>$chronology_field ), 164 array('chronology_date', 'start', 'flat_ recent_cat')164 array('chronology_date', 'start', 'flat_cat') 165 165 ); 166 166 $template->assign_block_vars( -
trunk/language/en_UK.iso-8859-1/common.lang.php
r1678 r1722 491 491 $lang['maxwidth'] = 'Maximum width of the pictures'; 492 492 $lang['maxwidth_error'] = 'Maximum width must be a number superior to 50'; 493 $lang['flat_ recent_cat_hint'] = 'display recentelements of categories and sub-categories';493 $lang['flat_cat_hint'] = 'flat display elements of categories and sub-categories'; 494 494 $lang['start_filter_hint'] = 'displays only recent elements'; 495 495 $lang['stop_filter_hint'] = 'return to display all elements'; -
trunk/language/fr_FR.iso-8859-1/common.lang.php
r1677 r1722 491 491 $lang['maxwidth'] = 'Largeur maximum des images'; 492 492 $lang['maxwidth_error'] = 'La largeur des images doit être supérieure à 50'; 493 $lang['flat_ recent_cat_hint'] = 'affiche les éléments récents des catégories et des sous-catégories';493 $lang['flat_cat_hint'] = 'affiche à plat les éléments des catégories et des sous-catégories'; 494 494 $lang['start_filter_hint'] = 'afficher que les éléments récents'; 495 495 $lang['stop_filter_hint'] = 'retourner à l\'affichage de tous les éléments'; -
trunk/template/yoga/index.tpl
r1703 r1722 32 32 <!-- END mode_normal --> 33 33 34 <!-- BEGIN flat_ recent_cat -->35 <li><a href="{flat_ recent_cat.URL}" title="{lang:flat_recent_cat_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/flat_recent_cat.png" class="button" alt="{lang:flat_recent_cat_hint}"></a></li>36 <!-- END flat_ recent_cat -->34 <!-- BEGIN flat_cat --> 35 <li><a href="{flat_cat.URL}" title="{lang:flat_cat_hint}" rel="nofollow"><img src="{pwg_root}{themeconf:icon_dir}/flat_cat.png" class="button" alt="{lang:flat_cat_hint}"></a></li> 36 <!-- END flat_cat --> 37 37 38 38 <!-- BEGIN mode_posted -->
Note: See TracChangeset
for help on using the changeset viewer.