--- core/filter_api.php 2006/08/17 13:23:33 +++ core/filter_api.php 2006/08/02 12:25:25 @@ -341,47 +341,16 @@ $t_desired_statuses[] = $t_this_status; } } else { - # advanced filtering: same as simple above except that 'show_status' may be - # set to a list of statuses + # advanced filtering: ignore the hide $t_any_found = false; foreach( $t_filter['show_status'] as $t_this_status ) { $t_desired_statuses[] = $t_this_status; if ( ( META_FILTER_ANY == $t_this_status ) || ( is_blank( $t_this_status ) ) || ( 0 === $t_this_status ) ) { $t_any_found = true; - break; } } - if( $t_any_found ) { + if ( $t_any_found ) { $t_desired_statuses = array(); - - # Filter by 'hide_status' list, if necessary. - if( count($t_filter['hide_status']) > 0 && !in_array(META_FILTER_NONE, $t_filter['hide_status']) ) { - if( count($t_filter['hide_status']) > 1 ) { - # Specifically filter out these ones. - foreach( $t_available_statuses as $t_this_available_status ) { - if( !in_array($t_this_available_status, $t_filter['hide_status']) ) { - $t_desired_statuses[] = $t_this_available_status; - } - } - } else { - # Filter out anything >= the single status listed. - $t_status_cutoff = $t_filter['hide_status'][0]; - foreach( $t_available_statuses as $t_this_available_status ) { - if( $t_this_available_status < $t_status_cutoff ) { - $t_desired_statuses[] = $t_this_available_status; - } - } - } - - # If this filters out all statuses then ensure we don't - # end up showing everything below. While this is - # technically user error, it would probably just be more - # confusing for this case to be equivalent to where - # show_status=any and hide_status=none. - if( !count($t_desired_statuses) ) { - $t_desired_statuses[] = META_FILTER_NONE; - } - } } } @@ -1380,7 +1349,9 @@ : - : + + : + : @@ -1444,39 +1415,41 @@ - - '; - } else { - $t_first_flag = false; - } - $t_output = $t_output . $t_this_string; - } - $t_hide_status_post = ''; - if ( count( $t_filter['hide_status'] ) == 1 ) { - $t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')'; - } - if ( true == $t_none_found ) { - PRINT lang_get( 'none' ); - } else { - PRINT $t_output . $t_hide_status_post; - } - } + if ( 'simple' == $t_view_type ) { + $t_output = ''; + $t_none_found = false; + if ( count( $t_filter['hide_status'] ) == 0 ) { + PRINT lang_get( 'none' ); + } else { + $t_first_flag = true; + foreach( $t_filter['hide_status'] as $t_current ) { + ?> + + '; + } else { + $t_first_flag = false; + } + $t_output = $t_output . $t_this_string; + } + $t_hide_status_post = ''; + if ( count( $t_filter['hide_status'] ) == 1 ) { + $t_hide_status_post = ' (' . lang_get( 'and_above' ) . ')'; + } + if ( true == $t_none_found ) { + PRINT lang_get( 'none' ); + } else { + PRINT $t_output . $t_hide_status_post; + } + } + } ?> @@ -2364,19 +2337,9 @@ if ( substr( config_get( 'cookie_version' ), 1 ) > $t_cookie_vers ) { # if the version is old, update it $p_filter_arr['_version'] = config_get( 'cookie_version' ); } - - $t_view_filters_setting = config_get( 'view_filters' ); - $t_default_view_type = ( ADVANCED_ONLY == $t_view_filters_setting || ADVANCED_DEFAULT == $t_view_filters_setting ? 'advanced' : 'simple' ); - # If config restricts view type to a particular one, just force that - # in all cases. - if( ADVANCED_ONLY == $t_view_filters_setting || SIMPLE_ONLY == $t_view_filters_setting ) { - $p_filter_arr['_view_type'] = $t_default_view_type; - } - # Otherwise just set to default if not already set. - elseif( !isset( $p_filter_arr['_view_type'] ) ) { - $p_filter_arr['_view_type'] = gpc_get_string( 'view_type', $t_default_view_type ); + if ( !isset( $p_filter_arr['_view_type'] ) ) { + $p_filter_arr['_view_type'] = gpc_get_string( 'view_type', 'simple' ); } - if ( !isset( $p_filter_arr['per_page'] ) ) { $p_filter_arr['per_page'] = gpc_get_int( 'per_page', config_get( 'default_limit_view' ) ); } @@ -2554,23 +2517,6 @@ } } } - - # Deal with conflicting settings for 'show status' and 'hide status'. - # The former takes priority and if it's set to anything except 'any' - # then 'hide status' can't be used. - $t_show_status_is_any = false; - $t_num_to_check = ( 'simple' == $p_filter_arr['_view_type'] ? 1 : count($p_filter_arr['show_status']) ); - for( $i = 0; $i < $t_num_to_check; $i++ ) { - $t_this_status = $p_filter_arr['show_status'][$i]; - if( META_FILTER_ANY == $t_this_status || is_blank($t_this_status) || 0 === $t_this_status ) { - $t_show_status_is_any = true; - break; - } - } - if( !$t_show_status_is_any ) { - $p_filter_arr['hide_status'] = array( META_FILTER_NONE ); - } - # all of our filter values are now guaranteed to be there, and correct. return $p_filter_arr; }