Changeset 1722 for trunk/include/filter.inc.php
- Timestamp:
- Jan 15, 2007, 1:09:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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');
Note: See TracChangeset
for help on using the changeset viewer.