Esempio n. 1
0
/**
 * 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;
}
auth_ensure_user_authenticated();
$f_search = gpc_get_string(FILTER_PROPERTY_FREE_TEXT, false);
/** @todo need a better default */
$f_offset = gpc_get_int('offset', 0);
$t_cookie_value_id = gpc_get_cookie(config_get('view_all_cookie'), '');
$t_cookie_value = filter_db_get_filter($t_cookie_value_id);
$f_highlight_changed = 0;
$f_sort = null;
$f_dir = null;
$t_project_id = 0;
$t_columns = helper_get_columns_to_view(COLUMNS_TARGET_PRINT_PAGE);
$t_num_of_columns = count($t_columns);
# check to see if the cookie exists
if (!is_blank($t_cookie_value)) {
    # check to see if new cookie is needed
    if (!filter_is_cookie_valid()) {
        print_header_redirect('view_all_set.php?type=0&print=1');
    }
    $t_setting_arr = explode('#', $t_cookie_value, 2);
    $t_filter_cookie_arr = unserialize($t_setting_arr[1]);
    $f_highlight_changed = $t_filter_cookie_arr[FILTER_PROPERTY_HIGHLIGHT_CHANGED];
    $f_sort = $t_filter_cookie_arr[FILTER_PROPERTY_SORT_FIELD_NAME];
    $f_dir = $t_filter_cookie_arr[FILTER_PROPERTY_SORT_DIRECTION];
    $t_project_id = helper_get_current_project();
}
# This replaces the actual search that used to be here
$f_page_number = gpc_get_int('page_number', 1);
$t_per_page = -1;
$t_bug_count = null;
$t_page_count = null;
$result = filter_get_bug_rows($f_page_number, $t_per_page, $t_page_count, $t_bug_count);
Esempio n. 3
0
/**
* 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;
}