/** * The filters have been changed so the field names are the same as the database * field names. This updates any filters stored in the database to use the correct * keys. The 'and_not_assigned' field is no longer used as it is replaced by the meta * filter None. This removes it from all filters. */ function install_stored_filter_migrate() { # Disable query logging even if enabled in config, due to possibility of mass spam $t_log_queries = install_set_log_queries(); require_api('filter_api.php'); $t_cookie_version = config_get('cookie_version'); # convert filters to use the same value for the filter key and the form field $t_filter_fields['show_category'] = 'category_id'; $t_filter_fields['show_severity'] = 'severity'; $t_filter_fields['show_status'] = 'status'; $t_filter_fields['show_priority'] = 'priority'; $t_filter_fields['show_resolution'] = 'resolution'; $t_filter_fields['show_build'] = 'build'; $t_filter_fields['show_version'] = 'version'; $t_filter_fields['user_monitor'] = 'monitor_user_id'; $t_filter_fields['show_profile'] = 'profile_id'; $t_filter_fields['do_filter_by_date'] = 'filter_by_date'; $t_filter_fields['and_not_assigned'] = null; $t_filter_fields['sticky_issues'] = 'sticky'; $t_filters_table = db_get_table('filters'); $t_query = "SELECT * FROM {$t_filters_table}"; $t_result = db_query_bound($t_query); while ($t_row = db_fetch_array($t_result)) { $t_filter_arr = filter_deserialize($t_row['filter_string']); foreach ($t_filter_fields as $t_old => $t_new) { if (isset($t_filter_arr[$t_old])) { $t_value = $t_filter_arr[$t_old]; unset($t_filter_arr[$t_old]); if (!is_null($t_new)) { $t_filter_arr[$t_new] = $t_value; } } } $t_filter_serialized = serialize($t_filter_arr); $t_filter_string = $t_cookie_version . '#' . $t_filter_serialized; $t_update_query = "UPDATE {$t_filters_table} SET filter_string=" . db_param() . ' WHERE id=' . db_param(); $t_update_result = db_query_bound($t_update_query, array($t_filter_string, $t_row['id'])); } # Re-enable query logging if we disabled it install_set_log_queries($t_log_queries); # Return 2 because that's what ADOdb/DataDict does when things happen properly return 2; }
log_event(LOG_FILTERING, 'view_all_set.php: Set the sort order and direction.'); # We only need to set those fields that we are overriding $t_setting_arr[FILTER_PROPERTY_SORT_FIELD_NAME] = $f_sort; $t_setting_arr[FILTER_PROPERTY_SORT_DIRECTION] = $f_dir; break; # This is when we want to copy another query from the # database over the top of our current one # This is when we want to copy another query from the # database over the top of our current one case '3': log_event(LOG_FILTERING, 'view_all_set.php: Copy another query from database'); $t_filter_string = filter_db_get_filter($f_source_query_id); # If we can use the query that we've requested, # grab it. We will overwrite the current one at the # bottom of this page $t_setting_arr = filter_deserialize($t_filter_string); if (false === $t_setting_arr) { # couldn't deserialize, if we were trying to use the filter, clear it and reload gpc_clear_cookie('view_all_cookie'); error_proceed_url('view_all_set.php?type=0'); trigger_error(ERROR_FILTER_TOO_OLD, ERROR); exit; # stop here } break; # Generalise the filter # Generalise the filter case '4': log_event(LOG_FILTERING, 'view_all_set.php: Generalise the filter'); $t_setting_arr[FILTER_PROPERTY_CATEGORY] = array(META_FILTER_ANY); $t_setting_arr[FILTER_PROPERTY_REPORTER_ID] = array(META_FILTER_ANY);
if ($f_username !== null) { $t_user_id = user_get_id_by_name($f_username); } else { $t_user_id = user_get_id_by_name(config_get('anonymous_account')); } $t_show_sticky = null; if ($f_filter_id == 0) { $t_custom_filter = filter_get_default(); $t_custom_filter['sort'] = $c_sort_field; } else { # null will be returned if the user doesn't have access right to access the filter. $t_custom_filter = filter_db_get_filter($f_filter_id, $t_user_id); if (null === $t_custom_filter) { access_denied(); } $t_custom_filter = filter_deserialize($t_custom_filter); } $t_issues = filter_get_bug_rows($t_page_number, $t_issues_per_page, $t_page_count, $t_issues_count, $t_custom_filter, $t_project_id, $t_user_id, $t_show_sticky); $t_issues_count = count($t_issues); # Loop through results for ($i = 0; $i < $t_issues_count; $i++) { $t_bug = $t_issues[$i]; $about = $link = $t_path . "view.php?id=" . $t_bug->id; $title = bug_format_id($t_bug->id) . ': ' . $t_bug->summary; if ($t_bug->view_state == VS_PRIVATE) { $title .= ' [' . lang_get('private') . ']'; } $description = string_rss_links($t_bug->description); # subject is category. $subject = category_full_name($t_bug->category_id, false); # optional DC value
/** * requires date_api */ require_once 'date_api.php'; /** * requires icon_api */ require_once 'icon_api.php'; $t_filter = current_user_get_bug_filter(); if ($t_filter === false) { $t_filter = filter_get_default(); } $t_sort = $t_filter['sort']; $t_dir = $t_filter['dir']; $t_icon_path = config_get('icon_path'); $t_filter = filter_deserialize(filter_db_get_filter($t_box_id)); $rows = filter_get_bug_rows($f_page_number, $t_per_page, $t_page_count, $t_bug_count, $t_filter); $t_fields = config_get('bug_view_page_fields'); $t_fields = columns_filter_disabled($t_fields); # Improve performance by caching category data in one pass if (helper_get_current_project() == 0) { $t_categories = array(); foreach ($rows as $t_row) { $t_categories[] = $t_row->category_id; } category_cache_array_rows(array_unique($t_categories)); } //$t_filter = array_merge( $c_filter[$t_box_title], $t_filter ); # -- ====================== BUG LIST ========================= -- ?>