Beispiel #1
0
	</center></td></tr>

	<!-- move database project files to disk -->
	<tr bgcolor="#ffffff"><td>Move project files stored in database schema to disk.</td><td><center>
	<?php 
html_button('move_db2disk.php', 'Move Project Files to Disk', array('doc' => 'project'));
?>
	</center></td></tr>

	<!-- move custom field content to standard field -->
	<tr bgcolor="#ffffff"><td>Copy Custom Field to Standard Field.</td><td><center>
	<form method="post" action="copy_field.php">
	   From
		<SELECT name="source_id">
			<?php 
$t_custom_ids = custom_field_get_ids();
foreach ($t_custom_ids as $t_id) {
    printf("<OPTION VALUE=\"%d\">%s", $t_id, custom_field_get_field($t_id, 'name'));
}
?>
		</SELECT> to
		<SELECT name="dest_id">
			<?php 
# @@@ should be expanded and configurable
# list matches exact field name from database
$t_dest_ids = array('fixed_in_version');
foreach ($t_dest_ids as $t_id) {
    printf("<OPTION VALUE=\"%s\">%s", $t_id, $t_id);
}
?>
		</SELECT>
Beispiel #2
0
/**
 * Make sure that our filters are entirely correct and complete (it is possible that they are not).
 * We need to do this to cover cases where we don't have complete control over the filters given.
 * @param array $p_filter_arr A Filter definition.
 * @return array
 * @todo function needs to be abstracted
 */
function filter_ensure_valid_filter(array $p_filter_arr)
{
    # extend current filter to add information passed via POST
    if (!isset($p_filter_arr['_version'])) {
        $p_filter_arr['_version'] = FILTER_VERSION;
    }
    $t_cookie_vers = (int) substr($p_filter_arr['_version'], 1);
    if (substr(FILTER_VERSION, 1) > $t_cookie_vers) {
        # if the version is old, update it
        $p_filter_arr['_version'] = FILTER_VERSION;
    }
    if (!isset($p_filter_arr['_view_type'])) {
        $p_filter_arr['_view_type'] = gpc_get_string('view_type', 'simple');
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE])) {
        $p_filter_arr[FILTER_PROPERTY_ISSUES_PER_PAGE] = gpc_get_int(FILTER_PROPERTY_ISSUES_PER_PAGE, config_get('default_limit_view'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED])) {
        $p_filter_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED] = config_get('default_show_changed');
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_STICKY])) {
        $p_filter_arr[FILTER_PROPERTY_STICKY] = gpc_string_to_bool(config_get('show_sticky_issues'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_SORT_FIELD_NAME])) {
        $p_filter_arr[FILTER_PROPERTY_SORT_FIELD_NAME] = 'last_updated';
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_SORT_DIRECTION])) {
        $p_filter_arr[FILTER_PROPERTY_SORT_DIRECTION] = 'DESC';
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_PLATFORM])) {
        $p_filter_arr[FILTER_PROPERTY_PLATFORM] = array(0 => (string) META_FILTER_ANY);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_OS])) {
        $p_filter_arr[FILTER_PROPERTY_OS] = array(0 => (string) META_FILTER_ANY);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_OS_BUILD])) {
        $p_filter_arr[FILTER_PROPERTY_OS_BUILD] = array(0 => (string) META_FILTER_ANY);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_PROJECT_ID])) {
        $p_filter_arr[FILTER_PROPERTY_PROJECT_ID] = array(0 => META_FILTER_CURRENT);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_START_MONTH])) {
        $p_filter_arr[FILTER_PROPERTY_START_MONTH] = gpc_get_string(FILTER_PROPERTY_START_MONTH, date('m'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_START_DAY])) {
        $p_filter_arr[FILTER_PROPERTY_START_DAY] = gpc_get_string(FILTER_PROPERTY_START_DAY, 1);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_START_YEAR])) {
        $p_filter_arr[FILTER_PROPERTY_START_YEAR] = gpc_get_string(FILTER_PROPERTY_START_YEAR, date('Y'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_END_MONTH])) {
        $p_filter_arr[FILTER_PROPERTY_END_MONTH] = gpc_get_string(FILTER_PROPERTY_END_MONTH, date('m'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_END_DAY])) {
        $p_filter_arr[FILTER_PROPERTY_END_DAY] = gpc_get_string(FILTER_PROPERTY_END_DAY, date('d'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_END_YEAR])) {
        $p_filter_arr[FILTER_PROPERTY_END_YEAR] = gpc_get_string(FILTER_PROPERTY_END_YEAR, date('Y'));
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_SEARCH])) {
        $p_filter_arr[FILTER_PROPERTY_SEARCH] = '';
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_FILTER_BY_DATE])) {
        $p_filter_arr[FILTER_PROPERTY_FILTER_BY_DATE] = gpc_get_bool(FILTER_PROPERTY_FILTER_BY_DATE, false);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_VIEW_STATE])) {
        $p_filter_arr[FILTER_PROPERTY_VIEW_STATE] = gpc_get(FILTER_PROPERTY_VIEW_STATE, META_FILTER_ANY);
    } else {
        if (filter_field_is_any($p_filter_arr[FILTER_PROPERTY_VIEW_STATE])) {
            $p_filter_arr[FILTER_PROPERTY_VIEW_STATE] = META_FILTER_ANY;
        }
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_TYPE])) {
        $p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_TYPE] = gpc_get_int(FILTER_PROPERTY_RELATIONSHIP_TYPE, -1);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_BUG])) {
        $p_filter_arr[FILTER_PROPERTY_RELATIONSHIP_BUG] = gpc_get_int(FILTER_PROPERTY_RELATIONSHIP_BUG, 0);
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_TARGET_VERSION])) {
        $p_filter_arr[FILTER_PROPERTY_TARGET_VERSION] = (string) META_FILTER_ANY;
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_TAG_STRING])) {
        $p_filter_arr[FILTER_PROPERTY_TAG_STRING] = gpc_get_string(FILTER_PROPERTY_TAG_STRING, '');
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_TAG_SELECT])) {
        $p_filter_arr[FILTER_PROPERTY_TAG_SELECT] = gpc_get_string(FILTER_PROPERTY_TAG_SELECT, '');
    }
    if (!isset($p_filter_arr[FILTER_PROPERTY_MATCH_TYPE])) {
        $p_filter_arr[FILTER_PROPERTY_MATCH_TYPE] = gpc_get_int(FILTER_PROPERTY_MATCH_TYPE, FILTER_MATCH_ALL);
    }
    # initialize plugin filters
    $t_plugin_filters = filter_get_plugin_filters();
    foreach ($t_plugin_filters as $t_field_name => $t_filter_object) {
        if (!isset($p_filter_arr[$t_field_name])) {
            switch ($t_filter_object->type) {
                case FILTER_TYPE_STRING:
                    $p_filter_arr[$t_field_name] = gpc_get_string($t_field_name, $t_filter_object->default);
                    break;
                case FILTER_TYPE_INT:
                    $p_filter_arr[$t_field_name] = gpc_get_int($t_field_name, (int) $t_filter_object->default);
                    break;
                case FILTER_TYPE_BOOLEAN:
                    $p_filter_arr[$t_field_name] = gpc_get_bool($t_field_name, (bool) $t_filter_object->default);
                    break;
                case FILTER_TYPE_MULTI_STRING:
                    $p_filter_arr[$t_field_name] = gpc_get_string_array($t_field_name, array(0 => (string) META_FILTER_ANY));
                    break;
                case FILTER_TYPE_MULTI_INT:
                    $p_filter_arr[$t_field_name] = gpc_get_int_array($t_field_name, array(0 => META_FILTER_ANY));
                    break;
                default:
                    $p_filter_arr[$t_field_name] = (string) META_FILTER_ANY;
            }
        }
        if (!$t_filter_object->validate($p_filter_arr[$t_field_name])) {
            $p_filter_arr[$t_field_name] = $t_filter_object->default;
        }
    }
    $t_custom_fields = custom_field_get_ids();
    # @@@ (thraxisp) This should really be the linked ids, but we don't know the project
    $f_custom_fields_data = array();
    if (is_array($t_custom_fields) && count($t_custom_fields) > 0) {
        foreach ($t_custom_fields as $t_cfid) {
            if (is_array(gpc_get('custom_field_' . $t_cfid, null))) {
                $f_custom_fields_data[$t_cfid] = gpc_get_string_array('custom_field_' . $t_cfid, array(META_FILTER_ANY));
            } else {
                $f_custom_fields_data[$t_cfid] = gpc_get_string('custom_field_' . $t_cfid, (string) META_FILTER_ANY);
                $f_custom_fields_data[$t_cfid] = array($f_custom_fields_data[$t_cfid]);
            }
        }
    }
    # validate sorting
    $t_fields = helper_get_columns_to_view();
    $t_n_fields = count($t_fields);
    for ($i = 0; $i < $t_n_fields; $i++) {
        if (isset($t_fields[$i]) && in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment_count'))) {
            unset($t_fields[$i]);
        }
    }
    # Make sure array is no longer than 2 elements
    $t_sort_fields = explode(',', $p_filter_arr['sort']);
    if (count($t_sort_fields) > 2) {
        $t_sort_fields = array_slice($t_sort_fields, 0, 2);
    }
    # Make sure array is no longer than 2 elements
    $t_dir_fields = explode(',', $p_filter_arr['dir']);
    if (count($t_dir_fields) > 2) {
        $t_dir_fields = array_slice($t_dir_fields, 0, 2);
    }
    # Validate the max of two segments for $t_sort_fields and $t_dir_fields
    for ($i = 0; $i < 2; $i++) {
        if (isset($t_sort_fields[$i])) {
            $t_drop = false;
            $t_sort = $t_sort_fields[$i];
            if (strpos($t_sort, 'custom_') === 0) {
                if (false === custom_field_get_id_from_name(utf8_substr($t_sort, utf8_strlen('custom_')))) {
                    $t_drop = true;
                }
            } else {
                if (!in_array($t_sort, $t_fields)) {
                    $t_drop = true;
                }
            }
            if (!in_array($t_dir_fields[$i], array('ASC', 'DESC'))) {
                $t_drop = true;
            }
            if ($t_drop) {
                unset($t_sort_fields[$i]);
                unset($t_dir_fields[$i]);
            }
        }
    }
    if (count($t_sort_fields) > 0) {
        $p_filter_arr['sort'] = implode(',', $t_sort_fields);
        $p_filter_arr['dir'] = implode(',', $t_dir_fields);
    } else {
        $p_filter_arr['sort'] = 'last_updated';
        $p_filter_arr['dir'] = 'DESC';
    }
    # validate or filter junk from other fields
    $t_multi_select_list = array(FILTER_PROPERTY_CATEGORY_ID => 'string', FILTER_PROPERTY_SEVERITY => 'int', FILTER_PROPERTY_STATUS => 'int', FILTER_PROPERTY_REPORTER_ID => 'int', FILTER_PROPERTY_HANDLER_ID => 'int', FILTER_PROPERTY_NOTE_USER_ID => 'int', FILTER_PROPERTY_RESOLUTION => 'int', FILTER_PROPERTY_PRIORITY => 'int', FILTER_PROPERTY_BUILD => 'string', FILTER_PROPERTY_VERSION => 'string', FILTER_PROPERTY_HIDE_STATUS => 'int', FILTER_PROPERTY_FIXED_IN_VERSION => 'string', FILTER_PROPERTY_TARGET_VERSION => 'string', FILTER_PROPERTY_MONITOR_USER_ID => 'int', FILTER_PROPERTY_PROFILE_ID => 'int');
    foreach ($t_multi_select_list as $t_multi_field_name => $t_multi_field_type) {
        if (!isset($p_filter_arr[$t_multi_field_name])) {
            if (FILTER_PROPERTY_HIDE_STATUS == $t_multi_field_name) {
                $p_filter_arr[$t_multi_field_name] = array(config_get('hide_status_default'));
            } else {
                if ('custom_fields' == $t_multi_field_name) {
                    $p_filter_arr[$t_multi_field_name] = array($f_custom_fields_data);
                } else {
                    $p_filter_arr[$t_multi_field_name] = array(META_FILTER_ANY);
                }
            }
        } else {
            if (!is_array($p_filter_arr[$t_multi_field_name])) {
                $p_filter_arr[$t_multi_field_name] = array($p_filter_arr[$t_multi_field_name]);
            }
            $t_checked_array = array();
            foreach ($p_filter_arr[$t_multi_field_name] as $t_filter_value) {
                $t_filter_value = stripslashes($t_filter_value);
                if ($t_filter_value === 'any' || $t_filter_value === '[any]') {
                    $t_filter_value = META_FILTER_ANY;
                }
                if ($t_filter_value === 'none' || $t_filter_value === '[none]') {
                    $t_filter_value = META_FILTER_NONE;
                }
                if ('string' == $t_multi_field_type) {
                    $t_checked_array[] = $t_filter_value;
                } else {
                    if ('int' == $t_multi_field_type) {
                        $t_checked_array[] = (int) $t_filter_value;
                    } else {
                        if ('array' == $t_multi_field_type) {
                            $t_checked_array[] = $t_filter_value;
                        }
                    }
                }
            }
            $p_filter_arr[$t_multi_field_name] = $t_checked_array;
        }
    }
    if (is_array($t_custom_fields) && count($t_custom_fields) > 0) {
        foreach ($t_custom_fields as $t_cfid) {
            if (!isset($p_filter_arr['custom_fields'][$t_cfid])) {
                $p_filter_arr['custom_fields'][$t_cfid] = array(META_FILTER_ANY);
            } else {
                if (!is_array($p_filter_arr['custom_fields'][$t_cfid])) {
                    $p_filter_arr['custom_fields'][$t_cfid] = array($p_filter_arr['custom_fields'][$t_cfid]);
                }
                $t_checked_array = array();
                foreach ($p_filter_arr['custom_fields'][$t_cfid] as $t_filter_value) {
                    $t_filter_value = stripslashes($t_filter_value);
                    if ($t_filter_value === 'any' || $t_filter_value === '[any]') {
                        $t_filter_value = META_FILTER_ANY;
                    }
                    $t_checked_array[] = $t_filter_value;
                }
                $p_filter_arr['custom_fields'][$t_cfid] = $t_checked_array;
            }
        }
    }
    # all of our filter values are now guaranteed to be there, and correct.
    return $p_filter_arr;
}
Beispiel #3
0
function ERP_custom_function_print_custom_fields($p_name, $p_sel_value)
{
    # Custom Fields
    $t_custom_fields = custom_field_get_ids();
    foreach ($t_custom_fields as $t_field_id) {
        $t_def = custom_field_get_definition($t_field_id);
        echo '<tr ' . helper_alternate_class() . '><td class="category">';
        ERP_print_documentation_link($p_name);
        echo ': ' . string_display(lang_get_defaulted($t_def['name'])) . '</td>';
        echo '<td class="center" colspan="2">';
        ERP_print_custom_field_input(is_array($p_sel_value) && isset($p_sel_value[$t_field_id]) ? $p_sel_value[$t_field_id] : NULL, $t_def);
        echo '</td></tr>';
    }
}
Beispiel #4
0
function filter_ensure_valid_filter($p_filter_arr)
{
    # extend current filter to add information passed via POST
    if (!isset($p_filter_arr['_version'])) {
        $p_filter_arr['_version'] = config_get('cookie_version');
    }
    $t_cookie_vers = (int) substr($p_filter_arr['_version'], 1);
    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');
    }
    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'));
    }
    if (!isset($p_filter_arr['highlight_changed'])) {
        $p_filter_arr['highlight_changed'] = config_get('default_show_changed');
    }
    if (!isset($p_filter_arr['sticky_issues'])) {
        $p_filter_arr['sticky_issues'] = config_get('show_sticky_issues');
    }
    if (!isset($p_filter_arr['sort'])) {
        $p_filter_arr['sort'] = "last_updated";
    }
    if (!isset($p_filter_arr['dir'])) {
        $p_filter_arr['dir'] = "DESC";
    }
    if (!isset($p_filter_arr['platform'])) {
        $p_filter_arr['platform'] = array(0 => META_FILTER_ANY);
    }
    if (!isset($p_filter_arr['os'])) {
        $p_filter_arr['os'] = array(0 => META_FILTER_ANY);
    }
    if (!isset($p_filter_arr['os_build'])) {
        $p_filter_arr['os_build'] = array(0 => META_FILTER_ANY);
    }
    if (!isset($p_filter_arr['project_id'])) {
        $p_filter_arr['project_id'] = array(0 => META_FILTER_CURRENT);
    }
    if (!isset($p_filter_arr['start_month'])) {
        $p_filter_arr['start_month'] = gpc_get_string('start_month', date('m'));
    }
    if (!isset($p_filter_arr['start_day'])) {
        $p_filter_arr['start_day'] = gpc_get_string('start_day', 1);
    }
    if (!isset($p_filter_arr['start_year'])) {
        $p_filter_arr['start_year'] = gpc_get_string('start_year', date('Y'));
    }
    if (!isset($p_filter_arr['end_month'])) {
        $p_filter_arr['end_month'] = gpc_get_string('end_month', date('m'));
    }
    if (!isset($p_filter_arr['end_day'])) {
        $p_filter_arr['end_day'] = gpc_get_string('end_day', date('d'));
    }
    if (!isset($p_filter_arr['end_year'])) {
        $p_filter_arr['end_year'] = gpc_get_string('end_year', date('Y'));
    }
    if (!isset($p_filter_arr['search'])) {
        $p_filter_arr['search'] = '';
    }
    if (!isset($p_filter_arr['and_not_assigned'])) {
        $p_filter_arr['and_not_assigned'] = gpc_get_bool('and_not_assigned', false);
    }
    if (!isset($p_filter_arr['do_filter_by_date'])) {
        $p_filter_arr['do_filter_by_date'] = gpc_get_bool('do_filter_by_date', false);
    }
    if (!isset($p_filter_arr['view_state'])) {
        $p_filter_arr['view_state'] = gpc_get('view_state', '');
    } else {
        if ($p_filter_arr['view_state'] == 'any' || $p_filter_arr['view_state'] == 0) {
            $p_filter_arr['view_state'] = META_FILTER_ANY;
        }
    }
    if (!isset($p_filter_arr['relationship_type'])) {
        $p_filter_arr['relationship_type'] = gpc_get_int('relationship_type', -1);
    }
    if (!isset($p_filter_arr['relationship_bug'])) {
        $p_filter_arr['relationship_bug'] = gpc_get_int('relationship_bug', 0);
    }
    if (!isset($p_filter_arr['target_version'])) {
        $p_filter_arr['target_version'] = META_FILTER_ANY;
    }
    if (!isset($p_filter_arr['tag_string'])) {
        $p_filter_arr['tag_string'] = gpc_get_string('tag_string', '');
    }
    if (!isset($p_filter_arr['tag_select'])) {
        $p_filter_arr['tag_select'] = gpc_get_string('tag_select', '');
    }
    $t_custom_fields = custom_field_get_ids();
    # @@@ (thraxisp) This should really be the linked ids, but we don't know the project
    $f_custom_fields_data = array();
    if (is_array($t_custom_fields) && sizeof($t_custom_fields) > 0) {
        foreach ($t_custom_fields as $t_cfid) {
            if (is_array(gpc_get('custom_field_' . $t_cfid, null))) {
                $f_custom_fields_data[$t_cfid] = gpc_get_string_array('custom_field_' . $t_cfid, META_FILTER_ANY);
            } else {
                $f_custom_fields_data[$t_cfid] = gpc_get_string('custom_field_' . $t_cfid, META_FILTER_ANY);
                $f_custom_fields_data[$t_cfid] = array($f_custom_fields_data[$t_cfid]);
            }
        }
    }
    #validate sorting
    $t_fields = helper_get_columns_to_view();
    $t_n_fields = count($t_fields);
    for ($i = 0; $i < $t_n_fields; $i++) {
        if (isset($t_fields[$i]) && in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) {
            unset($t_fields[$i]);
        }
    }
    $t_sort_fields = split(',', $p_filter_arr['sort']);
    $t_dir_fields = split(',', $p_filter_arr['dir']);
    for ($i = 0; $i < 2; $i++) {
        if (isset($t_sort_fields[$i])) {
            $t_drop = false;
            $t_sort = $t_sort_fields[$i];
            if (strpos($t_sort, 'custom_') === 0) {
                if (false === custom_field_get_id_from_name(substr($t_sort, strlen('custom_')))) {
                    $t_drop = true;
                }
            } else {
                if (!in_array($t_sort, $t_fields)) {
                    $t_drop = true;
                }
            }
            if (!in_array($t_dir_fields[$i], array("ASC", "DESC"))) {
                $t_drop = true;
            }
            if ($t_drop) {
                unset($t_sort_fields[$i]);
                unset($t_dir_fields[$i]);
            }
        }
    }
    if (count($t_sort_fields) > 0) {
        $p_filter_arr['sort'] = implode(',', $t_sort_fields);
        $p_filter_arr['dir'] = implode(',', $t_dir_fields);
    } else {
        $p_filter_arr['sort'] = "last_updated";
        $p_filter_arr['dir'] = "DESC";
    }
    # validate or filter junk from other fields
    $t_multi_select_list = array('show_category' => 'string', 'show_severity' => 'int', 'show_status' => 'int', 'reporter_id' => 'int', 'handler_id' => 'int', 'show_resolution' => 'int', 'show_priority' => 'int', 'show_build' => 'string', 'show_version' => 'string', 'hide_status' => 'int', 'fixed_in_version' => 'string', 'target_version' => 'string', 'user_monitor' => 'int', 'show_profile' => 'int');
    foreach ($t_multi_select_list as $t_multi_field_name => $t_multi_field_type) {
        if (!isset($p_filter_arr[$t_multi_field_name])) {
            if ('hide_status' == $t_multi_field_name) {
                $p_filter_arr[$t_multi_field_name] = array(config_get('hide_status_default'));
            } else {
                if ('custom_fields' == $t_multi_field_name) {
                    $p_filter_arr[$t_multi_field_name] = array($f_custom_fields_data);
                } else {
                    $p_filter_arr[$t_multi_field_name] = array(META_FILTER_ANY);
                }
            }
        } else {
            if (!is_array($p_filter_arr[$t_multi_field_name])) {
                $p_filter_arr[$t_multi_field_name] = array($p_filter_arr[$t_multi_field_name]);
            }
            $t_checked_array = array();
            foreach ($p_filter_arr[$t_multi_field_name] as $t_filter_value) {
                $t_filter_value = stripslashes($t_filter_value);
                if ($t_filter_value === 'any' || $t_filter_value === '[any]') {
                    $t_filter_value = META_FILTER_ANY;
                }
                if ($t_filter_value === 'none' || $t_filter_value === '[none]') {
                    $t_filter_value = META_FILTER_NONE;
                }
                if ('string' == $t_multi_field_type) {
                    $t_checked_array[] = db_prepare_string($t_filter_value);
                } else {
                    if ('int' == $t_multi_field_type) {
                        $t_checked_array[] = db_prepare_int($t_filter_value);
                    } else {
                        if ('array' == $t_multi_field_type) {
                            $t_checked_array[] = $t_filter_value;
                        }
                    }
                }
            }
            $p_filter_arr[$t_multi_field_name] = $t_checked_array;
        }
    }
    if (is_array($t_custom_fields) && sizeof($t_custom_fields) > 0) {
        foreach ($t_custom_fields as $t_cfid) {
            if (!isset($p_filter_arr['custom_fields'][$t_cfid])) {
                $p_filter_arr['custom_fields'][$t_cfid] = array(META_FILTER_ANY);
            } else {
                if (!is_array($p_filter_arr['custom_fields'][$t_cfid])) {
                    $p_filter_arr['custom_fields'][$t_cfid] = array($p_filter_arr['custom_fields'][$t_cfid]);
                }
                $t_checked_array = array();
                foreach ($p_filter_arr['custom_fields'][$t_cfid] as $t_filter_value) {
                    $t_filter_value = stripslashes($t_filter_value);
                    if ($t_filter_value === 'any' || $t_filter_value === '[any]') {
                        $t_filter_value = META_FILTER_ANY;
                    }
                    $t_checked_array[] = db_prepare_string($t_filter_value);
                }
                $p_filter_arr['custom_fields'][$t_cfid] = $t_checked_array;
            }
        }
    }
    # all of our filter values are now guaranteed to be there, and correct.
    return $p_filter_arr;
}
Beispiel #5
0
			log_event( LOG_FILTERING, 'view_all_set.php: Generalise the filter' );

			$t_setting_arr[ FILTER_PROPERTY_CATEGORY_ID ]		= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_REPORTER_ID ] 		= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_HANDLER_ID ] 		= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_BUILD ] 			= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_VERSION ] 			= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_PRIORITY ]			= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_FIXED_IN_VERSION ]	= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_TARGET_VERSION ]	= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_MONITOR_USER_ID ] 	= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_NOTE_USER_ID ]  	= array( META_FILTER_ANY );
			$t_setting_arr[ FILTER_PROPERTY_RELATIONSHIP_TYPE ] = -1;
			$t_setting_arr[ FILTER_PROPERTY_RELATIONSHIP_BUG ] 	= 0;

			$t_custom_fields 		= custom_field_get_ids(); # @@@ (thraxisp) This should really be the linked ids, but we don't know the project
			$t_custom_fields_data 	= array();
			if ( is_array( $t_custom_fields ) && ( count( $t_custom_fields ) > 0 ) ) {
				foreach( $t_custom_fields as $t_cfid ) {
					$t_custom_fields_data[$t_cfid] =  array( META_FILTER_ANY );
				}
			}
			$t_setting_arr['custom_fields'] = $t_custom_fields_data;

			break;
	# Just set the search string value
	case '5':
			log_event( LOG_FILTERING, 'view_all_set.php: Search Text' );
			$t_setting_arr[ FILTER_PROPERTY_SEARCH ] = $f_search;

			break;