当前位置: 首页>>代码示例>>PHP>>正文


PHP filter_ensure_valid_filter函数代码示例

本文整理汇总了PHP中filter_ensure_valid_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_ensure_valid_filter函数的具体用法?PHP filter_ensure_valid_filter怎么用?PHP filter_ensure_valid_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了filter_ensure_valid_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: current_user_get_bug_filter

			document.filters.start_day.disabled = ! document.filters.do_filter_by_date.checked;
			document.filters.start_year.disabled = ! document.filters.do_filter_by_date.checked;
			document.filters.end_month.disabled = ! document.filters.do_filter_by_date.checked;
			document.filters.end_day.disabled = ! document.filters.do_filter_by_date.checked;
			document.filters.end_year.disabled = ! document.filters.do_filter_by_date.checked;

		    return true;
		}
		// -->
		</script>

		<?php 
}
# @@@ thraxisp - could this be replaced by a call to filter_draw_selection_area2
$t_filter = current_user_get_bug_filter();
$t_filter = filter_ensure_valid_filter($t_filter);
$t_project_id = helper_get_current_project();
$t_current_user_access_level = current_user_get_access_level();
$t_accessible_custom_fields_ids = array();
$t_accessible_custom_fields_names = array();
$t_accessible_custom_fields_type = array();
$t_accessible_custom_fields_values = array();
$t_filter_cols = config_get('filter_custom_fields_per_row');
$t_custom_cols = 1;
$t_custom_rows = 0;
#get valid target fields
$t_fields = helper_get_columns_to_view();
$t_n_fields = count($t_fields);
for ($i = 0; $i < $t_n_fields; $i++) {
    if (in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) {
        unset($t_fields[$i]);
开发者ID:renemilk,项目名称:spring-website,代码行数:31,代码来源:view_filters_page.php

示例2: array

if ($t_highlight_changed != -1) {
    $my_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED] = $t_highlight_changed;
}
# Handle custom fields.
$t_custom_fields = array();
foreach ($_GET as $t_var_name => $t_var_value) {
    if (strpos($t_var_name, 'custom_field_') === 0) {
        $t_custom_field_id = utf8_substr($t_var_name, 13);
        $t_custom_fields[$t_custom_field_id] = $t_var_value;
    }
}
$my_filter['custom_fields'] = $t_custom_fields;
# Must use advanced filter so that the project_id is applied and multiple
# selections are handled.
$my_filter['_view_type'] = 'advanced';
$tc_setting_arr = filter_ensure_valid_filter($my_filter);
$t_settings_serialized = serialize($tc_setting_arr);
$t_settings_string = config_get('cookie_version') . '#' . $t_settings_serialized;
# Store the filter string in the database: its the current filter, so some values won't change
$t_project_id = helper_get_current_project();
$t_project_id = $t_project_id * -1;
$t_row_id = filter_db_set_for_current_user($t_project_id, false, '', $t_settings_string);
# set cookie values
gpc_set_cookie(config_get('view_all_cookie'), $t_row_id, time() + config_get('cookie_time_length'), config_get('cookie_path'));
# redirect to print_all or view_all page
if ($f_print) {
    $t_redirect_url = 'print_all_bug_page.php';
} else {
    $t_redirect_url = 'view_all_bug_page.php';
}
print_header_redirect($t_redirect_url);
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:31,代码来源:search.php

示例3: mci_filter_db_get_available_queries

/**
 * Basically this is a copy of core/filter_api.php#filter_db_get_available_queries().
 * The only difference is that the result of this function is not an array of filter
 * names but an array of filter structures.
 * @param integer $p_project_id Project id.
 * @param integer $p_user_id    User id.
 * @return array
 */
function mci_filter_db_get_available_queries($p_project_id = null, $p_user_id = null)
{
    $t_overall_query_arr = array();
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = (int) $p_project_id;
    }
    if (null === $p_user_id) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = (int) $p_user_id;
    }
    # If the user doesn't have access rights to stored queries, just return
    if (!access_has_project_level(config_get('stored_query_use_threshold'))) {
        return $t_overall_query_arr;
    }
    # Get the list of available queries. By sorting such that public queries are
    # first, we can override any query that has the same name as a private query
    # with that private one
    $t_query = 'SELECT * FROM {filters}
					WHERE (project_id=' . db_param() . '
						OR project_id=0)
					AND name!=\'\'
					AND (is_public = ' . db_param() . '
						OR user_id = ' . db_param() . ')
					ORDER BY is_public DESC, name ASC';
    $t_result = db_query($t_query, array($t_project_id, true, $t_user_id));
    $t_query_count = db_num_rows($t_result);
    for ($i = 0; $i < $t_query_count; $i++) {
        $t_row = db_fetch_array($t_result);
        $t_filter_detail = explode('#', $t_row['filter_string'], 2);
        if (!isset($t_filter_detail[1])) {
            continue;
        }
        $t_filter = json_decode($t_filter_detail[1], true);
        $t_filter = filter_ensure_valid_filter($t_filter);
        $t_row['url'] = filter_get_url($t_filter);
        $t_overall_query_arr[$t_row['name']] = $t_row;
    }
    return array_values($t_overall_query_arr);
}
开发者ID:elmarculino,项目名称:mantisbt,代码行数:50,代码来源:mc_api.php

示例4: current_user_get_bug_filter

/**
 * Returns the issue filter parameters for the current user
 *
 * @return Active issue filter for current user or false if no filter is currently defined.
 * @access public
 */
function current_user_get_bug_filter($p_project_id = null)
{
    $f_filter_string = gpc_get_string('filter', '');
    $t_view_all_cookie = '';
    $t_cookie_detail = '';
    $t_filter = '';
    if (!is_blank($f_filter_string)) {
        if (is_numeric($f_filter_string)) {
            $t_token = token_get_value(TOKEN_FILTER);
            if (null != $t_token) {
                $t_filter = unserialize($t_token);
            }
        } else {
            $t_filter = unserialize($f_filter_string);
        }
    } else {
        if (!filter_is_cookie_valid()) {
            return false;
        } else {
            $t_user_id = auth_get_current_user_id();
            $t_filter = user_get_bug_filter($t_user_id, $p_project_id);
        }
    }
    $t_filter = filter_ensure_valid_filter($t_filter);
    return $t_filter;
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:32,代码来源:current_user_api.php

示例5: mci_filter_search_get_rows

/**
 * Get all issue rows matching the custom filter.
 *
 * @param integer               $p_user_id          The user id.
 * @param FilterSearchData      $p_filter_search    The custom filter.
 * @param integer               $p_page_number      Start with the given page number (zero-based).
 * @param integer               $p_per_page         Number of issues to display per page.
 * @return array of issue rows
 */
function mci_filter_search_get_rows($p_user_id, $p_filter_search, $p_page_number, $p_per_page)
{
    global $g_soap_api_to_filter_names;
    // object to array
    if (is_object($p_filter_search)) {
        $p_filter_search = get_object_vars($p_filter_search);
    }
    $t_project_id = array();
    if (isset($p_filter_search['project_id'])) {
        // check access right to all projects
        foreach ($p_filter_search['project_id'] as $t_id) {
            if (mci_has_readonly_access($p_user_id, $t_id)) {
                $t_project_id[] = $t_id;
            } else {
                error_log('User: ' . $p_user_id . ' has not access right to project: ' . $t_id . '.');
            }
        }
        // user has not access right to any project
        if (count($t_project_id) < 1) {
            return mci_soap_fault_access_denied($p_user_id);
        }
    } else {
        if (!mci_has_readonly_access($p_user_id, ALL_PROJECTS)) {
            return mci_soap_fault_access_denied($p_user_id);
        }
        $t_project_id = array(ALL_PROJECTS);
    }
    $t_filter = array('_view_type' => 'advanced');
    $t_filter['project_id'] = $t_project_id;
    // default fields
    foreach ($g_soap_api_to_filter_names as $t_soap_name => $t_filter_name) {
        if (isset($p_filter_search[$t_soap_name])) {
            $t_value = $p_filter_search[$t_soap_name];
            $t_filter[$t_filter_name] = $t_value;
        }
    }
    // custom fields
    if (isset($p_filter_search['custom_fields'])) {
        foreach ($p_filter_search['custom_fields'] as $t_custom_field) {
            // object to array
            if (is_object($t_custom_field)) {
                $t_custom_field = get_object_vars($t_custom_field);
            }
            $t_field = $t_custom_field['field'];
            if (is_object($t_field)) {
                $t_field = get_object_vars($t_field);
            }
            // if is set custom_field's id, use it primary
            if (isset($t_field['id'])) {
                $t_custom_field_id = $t_field['id'];
            } else {
                $t_custom_field_id = custom_field_get_id_from_name($t_field['name']);
            }
            $t_value = $t_custom_field['value'];
            $t_filter['custom_fields'][$t_custom_field_id] = $t_value;
        }
    }
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_result = array();
    $t_page_number = $p_page_number < 1 ? 1 : $p_page_number;
    $t_page_count = 0;
    $t_bug_count = 0;
    return filter_get_bug_rows($t_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter);
}
开发者ID:elmarculino,项目名称:mantisbt,代码行数:73,代码来源:mc_filter_api.php

示例6: mci_filter_db_get_available_queries

/**
 * Basically this is a copy of core/filter_api.php#filter_db_get_available_queries().
 * The only difference is that the result of this function is not an array of filter
 * names but an array of filter structures.
 */
function mci_filter_db_get_available_queries($p_project_id = null, $p_user_id = null)
{
    $t_filters_table = db_get_table('filters');
    $t_overall_query_arr = array();
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = db_prepare_int($p_project_id);
    }
    if (null === $p_user_id) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = db_prepare_int($p_user_id);
    }
    # If the user doesn't have access rights to stored queries, just return
    if (!access_has_project_level(config_get('stored_query_use_threshold'))) {
        return $t_overall_query_arr;
    }
    # Get the list of available queries. By sorting such that public queries are
    # first, we can override any query that has the same name as a private query
    # with that private one
    $query = "SELECT * FROM {$t_filters_table}\n\t\t\t\t\tWHERE (project_id=" . db_param() . "\n\t\t\t\t\t\tOR project_id=0)\n\t\t\t\t\tAND name!=''\n\t\t\t\t\tAND (is_public = " . db_prepare_bool(true) . "\n\t\t\t\t\t\tOR user_id = " . db_param() . ")\n\t\t\t\t\tORDER BY is_public DESC, name ASC";
    $result = db_query_bound($query, array($t_project_id, $t_user_id));
    $query_count = db_num_rows($result);
    for ($i = 0; $i < $query_count; $i++) {
        $row = db_fetch_array($result);
        $t_filter_detail = explode('#', $row['filter_string'], 2);
        if (!isset($t_filter_detail[1])) {
            continue;
        }
        $t_filter = unserialize($t_filter_detail[1]);
        $t_filter = filter_ensure_valid_filter($t_filter);
        $row['url'] = filter_get_url($t_filter);
        $t_overall_query_arr[$row['name']] = $row;
    }
    return array_values($t_overall_query_arr);
}
开发者ID:Kirill,项目名称:mantisbt,代码行数:42,代码来源:mc_api.php

示例7: mc_filter_get_issue_headers

/**
 * Get the issue headers that match the specified filter and paging details.
 *
 * @param string $p_username  The name of the user trying to access the filters.
 * @param string $p_password  The password of the user.
 * @param integer $p_filter_id  The id of the filter to apply.
 * @param integer $p_page_number  Start with the given page number (zero-based)
 * @param integer $p_per_page  Number of issues to display per page
 * @return Array that represents an IssueDataArray structure
 */
function mc_filter_get_issue_headers($p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    $t_orig_page_number = $p_page_number < 1 ? 1 : $p_page_number;
    $t_page_count = 0;
    $t_bug_count = 0;
    $t_filter = filter_db_get_filter($p_filter_id);
    $t_filter_detail = explode('#', $t_filter, 2);
    if (!isset($t_filter_detail[1])) {
        return SoapObjectsFactory::newSoapFault('Server', 'Invalid Filter');
    }
    $t_filter = unserialize($t_filter_detail[1]);
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_result = array();
    $t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id);
    // the page number was moved back, so we have exceeded the actual page number, see bug #12991
    if ($t_orig_page_number > $p_page_number) {
        return $t_result;
    }
    foreach ($t_rows as $t_issue_data) {
        $t_result[] = mci_issue_data_as_header_array($t_issue_data);
    }
    return $t_result;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:40,代码来源:mc_filter_api.php

示例8: timeline_events

/**
 * Get an array of timeline events
 * Events for which the skip() method returns true will be excluded
 * @param integer $p_start_time Timestamp representing start time of the period.
 * @param integer $p_end_time   Timestamp representing end time of the period.
 * @param integer $p_max_events The maximum number of events to return or 0 for unlimited.
 * @param type $p_filter		Filter array to use for filtering bugs
 * @return array
 */
function timeline_events($p_start_time, $p_end_time, $p_max_events, $p_filter = null)
{
    $t_timeline_events = array();
    if (null === $p_filter) {
        # create an empty filter, to match all bugs
        $t_filter = filter_ensure_valid_filter(array());
        # Override the default hide status, to show all bugs
        $t_filter[FILTER_PROPERTY_HIDE_STATUS] = array();
    }
    $t_result = history_get_range_result_filter($t_filter, $p_start_time, $p_end_time, 'DESC');
    $t_count = 0;
    while ($t_history_event = history_get_event_from_row($t_result, auth_get_current_user_id(), true)) {
        $t_event = null;
        $t_user_id = $t_history_event['userid'];
        $t_timestamp = $t_history_event['date'];
        $t_issue_id = $t_history_event['bug_id'];
        switch ($t_history_event['type']) {
            case NEW_BUG:
                $t_event = new IssueCreatedTimelineEvent($t_timestamp, $t_user_id, $t_issue_id);
                break;
            case BUGNOTE_ADDED:
                $t_bugnote_id = $t_history_event['old_value'];
                $t_event = new IssueNoteCreatedTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_bugnote_id);
                break;
            case BUG_MONITOR:
                # Skip monitors added for others due to reminders, only add monitor events where added
                # user is the same as the logged in user.
                if ((int) $t_history_event['old_value'] == (int) $t_history_event['userid']) {
                    $t_event = new IssueMonitorTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, true);
                }
                break;
            case BUG_UNMONITOR:
                $t_event = new IssueMonitorTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, false);
                break;
            case TAG_ATTACHED:
                $t_event = new IssueTagTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['old_value'], true);
                break;
            case TAG_DETACHED:
                $t_event = new IssueTagTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['old_value'], false);
                break;
            case NORMAL_TYPE:
                switch ($t_history_event['field']) {
                    case 'status':
                        $t_event = new IssueStatusChangeTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['old_value'], $t_history_event['new_value']);
                        break;
                    case 'handler_id':
                        $t_event = new IssueAssignedTimelineEvent($t_timestamp, $t_user_id, $t_issue_id, $t_history_event['new_value']);
                        break;
                }
                break;
        }
        # Do not include skipped events
        if ($t_event != null && !$t_event->skip()) {
            $t_timeline_events[] = $t_event;
            $t_count++;
            if ($p_max_events > 0 && $t_count >= $p_max_events) {
                break;
            }
        }
    }
    return $t_timeline_events;
}
开发者ID:spring,项目名称:spring-website,代码行数:71,代码来源:timeline_api.php

示例9: current_user_get_bug_filter

/**
* Returns the issue filter parameters for the current user
*
* @param integer $p_project_id Project id. This argument is only used if a 'filter' string is not passed via the web request.
*                              The default value is null meaning return the current filter for user's current project
                               if a filter string is not supplied.
* @return array User filter, if not set, then default filter.
* @access public
*/
function current_user_get_bug_filter($p_project_id = null)
{
    $f_filter_string = gpc_get_string('filter', '');
    $t_filter = '';
    if (!is_blank($f_filter_string)) {
        if (is_numeric($f_filter_string)) {
            $t_token = token_get_value(TOKEN_FILTER);
            if (null != $t_token) {
                $t_filter = json_decode($t_token, true);
            }
        } else {
            $t_filter = json_decode($f_filter_string, true);
        }
        $t_filter = filter_ensure_valid_filter($t_filter);
    } else {
        if (!filter_is_cookie_valid()) {
            $t_filter = filter_get_default();
        } else {
            $t_user_id = auth_get_current_user_id();
            $t_filter = user_get_bug_filter($t_user_id, $p_project_id);
        }
    }
    return $t_filter;
}
开发者ID:hamx0r,项目名称:mantisbt,代码行数:33,代码来源:current_user_api.php

示例10: install_stored_filter_migrate

/**
 *	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.
 *
 * Filter Versions:
 * v1,2,3,4 - Legacy Filters that can not be migrated (not used since 2004)
 * v5 - https://github.com/mantisbt/mantisbt/commit/eb1b93057e470e40727bc75a85f436ab35b84a74
 * v6 - https://github.com/mantisbt/mantisbt/commit/de2e2931f993c3b6fc82781eff051f9037fdc6b5
 * v7 - https://github.com/mantisbt/mantisbt/commit/0450981225647544083d21576dfb2bae044b3e98
 * v8 - https://github.com/mantisbt/mantisbt/commit/5cb368796528bcb35aa3935bf431b08a29cb1e90
 * v9 - https://github.com/mantisbt/mantisbt/commit/9dfc5fb6edb6da1e0324ceac3a27a727f2b23ba7
 *
 * Filters are stored within the database as vX#FILTER, where vX is a raw version string and
 * FILTER is a serialized string in php serialization or json format.
 *
 * This function is used to upgrade any previous filters to the latest version, and should be
 * updated when bouncing filter version number. Schema.php should be updated to call do_nothing
 * for the existing filter schema update and the updated version of this function called in a
 * new schema update step
 *
 * @return integer
 */
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');
    # convert filters to use the same value for the filter key and the form field
    # Note: This list should only be updated for basic renames i.e. data + type of data remain the same
    # before and after the rename.
    $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_query = 'SELECT * FROM {filters}';
    $t_result = db_query($t_query);
    while ($t_row = db_fetch_array($t_result)) {
        # Grab Filter Version and data into $t_setting_arr
        $t_setting_arr = explode('#', $t_row['filter_string'], 2);
        switch ($t_setting_arr[0]) {
            # Remove any non-upgradeable filters i.e. versions 1 to 4.
            case 'v1':
            case 'v2':
            case 'v3':
            case 'v4':
                $t_delete_query = 'DELETE FROM {filters} WHERE id=' . db_param();
                $t_delete_result = db_query($t_delete_query, array($t_row['id']));
                continue;
        }
        if (isset($t_setting_arr[1])) {
            switch ($t_setting_arr[0]) {
                # Filter versions 5 to 8 are stored in php serialized format
                case 'v5':
                case 'v6':
                case 'v7':
                case 'v8':
                    $t_filter_arr = unserialize($t_setting_arr[1]);
                    break;
                default:
                    $t_filter_arr = json_decode($t_setting_arr[1], true);
            }
        } else {
            $t_delete_query = 'DELETE FROM {filters} WHERE id=' . db_param();
            $t_delete_result = db_query($t_delete_query, array($t_row['id']));
            continue;
        }
        # serialized or json encoded data in filter table is invalid - abort upgrade as this should not be possible
        # so we should investigate and fix underlying data issue first if necessary
        if ($t_filter_arr === false) {
            return 1;
            # Fatal: invalid data found in filters table
        }
        # Ff the filter version does not match the latest version, pass it through filter_ensure_valid_filter to do any updates
        # This will set default values for filter fields
        if ($t_filter_arr['_version'] != FILTER_VERSION) {
            $t_filter_arr = filter_ensure_valid_filter($t_filter_arr);
        }
        # For any fields that are being renamed, we can now perform the rename and migrate existing data.
        # We unset the old field when done to ensure the filter contains only current optimised data.
        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;
                }
            }
        }
        # We now have a valid filter in with updated version number (version is updated by filter_ensure_valid_filter)
        # Check that this is the case, to before storing the updated filter values.
//.........这里部分代码省略.........
开发者ID:elmarculino,项目名称:mantisbt,代码行数:101,代码来源:install_helper_functions_api.php

示例11: filter_draw_selection_area2

function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true)
{
    $t_form_name_suffix = $p_expanded ? '_open' : '_closed';
    $t_filter = current_user_get_bug_filter();
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_project_id = helper_get_current_project();
    $t_page_number = (int) $p_page_number;
    $t_view_type = $t_filter['_view_type'];
    $t_tdclass = 'small-caption';
    $t_trclass = 'row-category2';
    $t_action = 'view_all_set.php?f=3';
    if ($p_for_screen == false) {
        $t_tdclass = 'print';
        $t_trclass = '';
        $t_action = 'view_all_set.php';
    }
    ?>

		<br />
		<form method="post" name="filters<?php 
    echo $t_form_name_suffix;
    ?>
" id="filters_form<?php 
    echo $t_form_name_suffix;
    ?>
" action="<?php 
    print $t_action;
    ?>
">
		<input type="hidden" name="type" value="1" />
		<?php 
    if ($p_for_screen == false) {
        print '<input type="hidden" name="print" value="1" />';
        print '<input type="hidden" name="offset" value="0" />';
    }
    ?>
		<input type="hidden" name="page_number" value="<?php 
    print $t_page_number;
    ?>
" />
		<input type="hidden" name="view_type" value="<?php 
    print $t_view_type;
    ?>
" />
		<table class="width100" cellspacing="1">

		<?php 
    $t_filter_cols = config_get('filter_custom_fields_per_row');
    if ($p_expanded) {
        $t_custom_cols = $t_filter_cols;
        $t_current_user_access_level = current_user_get_access_level();
        $t_accessible_custom_fields_ids = array();
        $t_accessible_custom_fields_names = array();
        $t_accessible_custom_fields_values = array();
        $t_num_custom_rows = 0;
        $t_per_row = 0;
        if (ON == config_get('filter_by_custom_fields')) {
            $t_custom_fields = custom_field_get_linked_ids($t_project_id);
            foreach ($t_custom_fields as $t_cfid) {
                $t_field_info = custom_field_cache_row($t_cfid, true);
                if ($t_field_info['access_level_r'] <= $t_current_user_access_level) {
                    $t_accessible_custom_fields_ids[] = $t_cfid;
                    $t_accessible_custom_fields_names[] = $t_field_info['name'];
                    $t_accessible_custom_fields_types[] = $t_field_info['type'];
                    $t_accessible_custom_fields_values[] = custom_field_distinct_values($t_cfid);
                }
            }
            if (count($t_accessible_custom_fields_ids) > 0) {
                $t_per_row = config_get('filter_custom_fields_per_row');
                $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row);
            }
        }
        $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen;
        if ('advanced' == $t_view_type) {
            $t_filters_url = $t_filters_url . '&amp;view_type=advanced';
        }
        $t_filters_url = $t_filters_url . '&amp;target_field=';
        $t_show_version = ON == config_get('show_product_version') || AUTO == config_get('show_product_version') && count(version_get_all_rows_with_subs($t_project_id)) > 0;
        # overload handler_id setting if user isn't supposed to see them (ref #6189)
        if (!access_has_project_level(config_get('view_handler_threshold'), $t_project_id)) {
            $t_filter['handler_id'] = array(META_FILTER_ANY);
        }
        ?>

		<tr <?php 
        print "class=\"" . $t_trclass . "\"";
        ?>
>
			<td class="small-caption" valign="top">
				<a href="<?php 
        print $t_filters_url . 'reporter_id[]';
        ?>
" id="reporter_id_filter"><?php 
        print lang_get('reporter');
        ?>
:</a>
			</td>
			<td class="small-caption" valign="top">
				<a href="<?php 
        print $t_filters_url . 'user_monitor[]';
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:filter_api.php

示例12: mc_filter_get_issue_headers

/**
 * Get the issue headers that match the specified filter and paging details.
 *
 * @param string $p_username  The name of the user trying to access the filters.
 * @param string $p_password  The password of the user.
 * @param integer $p_filter_id  The id of the filter to apply.
 * @param integer $p_page_number  Start with the given page number (zero-based)
 * @param integer $p_per_page  Number of issues to display per page
 * @return Array that represents an IssueDataArray structure
 */
function mc_filter_get_issue_headers($p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    $t_page_count = 0;
    $t_bug_count = 0;
    $t_filter = filter_db_get_filter($p_filter_id);
    $t_filter_detail = explode('#', $t_filter, 2);
    if (!isset($t_filter_detail[1])) {
        return new soap_fault('Server', '', 'Invalid Filter');
    }
    $t_filter = unserialize($t_filter_detail[1]);
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_result = array();
    $t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter, $p_project_id);
    foreach ($t_rows as $t_issue_data) {
        $t_id = $t_issue_data->id;
        $t_issue = array();
        $t_issue['id'] = $t_id;
        $t_issue['view_state'] = $t_issue_data->view_state;
        $t_issue['last_updated'] = timestamp_to_iso8601($t_issue_data->last_updated);
        $t_issue['project'] = $t_issue_data->project_id;
        $t_issue['category'] = mci_get_category($t_issue_data->category_id);
        $t_issue['priority'] = $t_issue_data->priority;
        $t_issue['severity'] = $t_issue_data->severity;
        $t_issue['status'] = $t_issue_data->status;
        $t_issue['reporter'] = $t_issue_data->reporter_id;
        $t_issue['summary'] = $t_issue_data->summary;
        if (!empty($t_issue_data->handler_id)) {
            $t_issue['handler'] = $t_issue_data->handler_id;
        }
        $t_issue['resolution'] = $t_issue_data->resolution;
        $t_issue['attachments_count'] = count(mci_issue_get_attachments($t_issue_data->id));
        $t_issue['notes_count'] = count(mci_issue_get_notes($t_issue_data->id));
        $t_result[] = $t_issue;
    }
    return $t_result;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:53,代码来源:mc_filter_api.php

示例13: filter_draw_selection_area2

/**
 *  Prints the filter selection area for both the bug list view screen and
 *  the bug list print screen. This function was an attempt to make it easier to
 *  add new filters and rearrange them on screen for both pages.
 * @param int $p_page_number
 * @param bool $p_for_screen
 * @param bool $p_expanded
 */
function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true)
{
    $t_form_name_suffix = $p_expanded ? '_open' : '_closed';
    $t_filter = current_user_get_bug_filter();
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_project_id = helper_get_current_project();
    $t_page_number = (int) $p_page_number;
    $t_view_type = $t_filter['_view_type'];
    $t_tdclass = 'small-caption';
    $t_trclass = 'row-category2';
    $t_action = 'view_all_set.php?f=3';
    if ($p_for_screen == false) {
        $t_tdclass = 'print';
        $t_trclass = '';
        $t_action = 'view_all_set.php';
    }
    ?>

		<br />
		<form method="post" name="filters<?php 
    echo $t_form_name_suffix;
    ?>
" id="filters_form<?php 
    echo $t_form_name_suffix;
    ?>
" action="<?php 
    echo $t_action;
    ?>
">
		<?php 
    # CSRF protection not required here - form does not result in modifications
    ?>
		<input type="hidden" name="type" value="1" />
		<?php 
    if ($p_for_screen == false) {
        echo '<input type="hidden" name="print" value="1" />';
        echo '<input type="hidden" name="offset" value="0" />';
    }
    ?>
		<input type="hidden" name="page_number" value="<?php 
    echo $t_page_number;
    ?>
" />
		<input type="hidden" name="view_type" value="<?php 
    echo $t_view_type;
    ?>
" />
		<table class="width100" cellspacing="1">

		<?php 
    $t_filter_cols = config_get('filter_custom_fields_per_row');
    if ($p_expanded) {
        $t_custom_cols = $t_filter_cols;
        $t_current_user_access_level = current_user_get_access_level();
        $t_accessible_custom_fields_ids = array();
        $t_accessible_custom_fields_names = array();
        $t_accessible_custom_fields_values = array();
        $t_num_custom_rows = 0;
        $t_per_row = 0;
        if (ON == config_get('filter_by_custom_fields')) {
            $t_custom_fields = custom_field_get_linked_ids($t_project_id);
            foreach ($t_custom_fields as $t_cfid) {
                $t_field_info = custom_field_cache_row($t_cfid, true);
                if ($t_field_info['access_level_r'] <= $t_current_user_access_level && $t_field_info['filter_by']) {
                    $t_accessible_custom_fields_ids[] = $t_cfid;
                    $t_accessible_custom_fields_names[] = $t_field_info['name'];
                    $t_accessible_custom_fields_types[] = $t_field_info['type'];
                    $t_accessible_custom_fields_values[] = custom_field_distinct_values($t_field_info);
                }
            }
            if (count($t_accessible_custom_fields_ids) > 0) {
                $t_per_row = config_get('filter_custom_fields_per_row');
                $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row);
            }
        }
        $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen;
        if ('advanced' == $t_view_type) {
            $t_filters_url = $t_filters_url . '&amp;view_type=advanced';
        }
        $t_filters_url = $t_filters_url . '&amp;target_field=';
        $t_show_product_version = version_should_show_product_version($t_project_id);
        $t_show_build = $t_show_product_version && config_get('enable_product_build') == ON;
        # overload handler_id setting if user isn't supposed to see them (ref #6189)
        if (!access_has_project_level(config_get('view_handler_threshold'), $t_project_id)) {
            $t_filter[FILTER_PROPERTY_HANDLER_ID] = array(META_FILTER_ANY);
        }
        ?>

		<tr <?php 
        echo "class=\"" . $t_trclass . "\"";
        ?>
>
//.........这里部分代码省略.........
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:101,代码来源:filter_api.php

示例14: user_get_bug_filter

/**
 * return the bug filter parameters for the specified user
 *
 * @param integer $p_user_id    A valid user identifier.
 * @param integer $p_project_id A valid project identifier.
 * @return array The user filter, or default filter if not valid.
 */
function user_get_bug_filter($p_user_id, $p_project_id = null)
{
    if (null === $p_project_id) {
        $t_project_id = helper_get_current_project();
    } else {
        $t_project_id = $p_project_id;
    }
    $t_view_all_cookie_id = filter_db_get_project_current($t_project_id, $p_user_id);
    $t_view_all_cookie = filter_db_get_filter($t_view_all_cookie_id, $p_user_id);
    $t_cookie_detail = explode('#', $t_view_all_cookie, 2);
    if (!isset($t_cookie_detail[1])) {
        return filter_get_default();
    }
    $t_filter = json_decode($t_cookie_detail[1], true);
    $t_filter = filter_ensure_valid_filter($t_filter);
    return $t_filter;
}
开发者ID:pkdevboxy,项目名称:mantisbt,代码行数:24,代码来源:user_api.php

示例15: filter_draw_selection_area2

/**
 *  Prints the filter selection area for both the bug list view screen and
 *  the bug list print screen. This function was an attempt to make it easier to
 *  add new filters and rearrange them on screen for both pages.
 * @param int $p_page_number
 * @param bool $p_for_screen
 * @param bool $p_expanded
 */
function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true)
{
    $t_form_name_suffix = $p_expanded ? '_open' : '_closed';
    $t_filter = current_user_get_bug_filter();
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_project_id = helper_get_current_project();
    $t_page_number = (int) $p_page_number;
    $t_view_type = $t_filter['_view_type'];
    $t_tdclass = 'small-caption';
    $t_trclass = 'row-category2';
    $t_action = 'view_all_set.php?f=3';
    if ($p_for_screen == false) {
        $t_tdclass = 'print';
        $t_trclass = '';
        $t_action = 'view_all_set.php';
    }
    ?>

	<div class="filter-box">
		<form method="post" name="filters<?php 
    echo $t_form_name_suffix;
    ?>
" id="filters_form<?php 
    echo $t_form_name_suffix;
    ?>
" action="<?php 
    echo $t_action;
    ?>
">
		<?php 
    # CSRF protection not required here - form does not result in modifications
    ?>
		<input type="hidden" name="type" value="1" />
		<?php 
    if ($p_for_screen == false) {
        echo '<input type="hidden" name="print" value="1" />';
        echo '<input type="hidden" name="offset" value="0" />';
    }
    ?>
		<input type="hidden" name="page_number" value="<?php 
    echo $t_page_number;
    ?>
" />
		<input type="hidden" name="view_type" value="<?php 
    echo $t_view_type;
    ?>
" />
		<?php 
    $t_filter_cols = config_get('filter_custom_fields_per_row');
    if ($p_expanded) {
        ?>
		<table width="100%" cellspacing="1">
		<?php 
        $t_custom_cols = $t_filter_cols;
        $t_current_user_access_level = current_user_get_access_level();
        $t_accessible_custom_fields_ids = array();
        $t_accessible_custom_fields_names = array();
        $t_accessible_custom_fields_values = array();
        $t_num_custom_rows = 0;
        $t_per_row = 0;
        if (ON == config_get('filter_by_custom_fields')) {
            $t_custom_fields = custom_field_get_linked_ids($t_project_id);
            foreach ($t_custom_fields as $t_cfid) {
                $t_field_info = custom_field_cache_row($t_cfid, true);
                if ($t_field_info['access_level_r'] <= $t_current_user_access_level && $t_field_info['filter_by']) {
                    $t_accessible_custom_fields_ids[] = $t_cfid;
                    $t_accessible_custom_fields_names[] = $t_field_info['name'];
                    $t_accessible_custom_fields_types[] = $t_field_info['type'];
                    $t_accessible_custom_fields_values[] = custom_field_distinct_values($t_field_info);
                }
            }
            if (count($t_accessible_custom_fields_ids) > 0) {
                $t_per_row = config_get('filter_custom_fields_per_row');
                $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row);
            }
        }
        $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen;
        if ('advanced' == $t_view_type) {
            $t_filters_url = $t_filters_url . '&amp;view_type=advanced';
        }
        $t_filters_url = $t_filters_url . '&amp;target_field=';
        $t_show_product_version = version_should_show_product_version($t_project_id);
        $t_show_build = $t_show_product_version && config_get('enable_product_build') == ON;
        # overload handler_id setting if user isn't supposed to see them (ref #6189)
        if (!access_has_project_level(config_get('view_handler_threshold'), $t_project_id)) {
            $t_filter[FILTER_PROPERTY_HANDLER_ID] = array(META_FILTER_ANY);
        }
        $t_dynamic_filter_expander_class = config_get('use_javascript') && config_get('use_dynamic_filters') ? ' class="dynamic-filter-expander"' : '';
        ?>

		<tr <?php 
        echo "class=\"" . $t_trclass . "\"";
//.........这里部分代码省略.........
开发者ID:nextgens,项目名称:mantisbt,代码行数:101,代码来源:filter_api.php


注:本文中的filter_ensure_valid_filter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。