Ejemplo n.º 1
0
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'current_user_api.php';
require_once 'bug_api.php';
require_once 'date_api.php';
require_once 'icon_api.php';
require_once 'string_api.php';
require_once 'columns_api.php';
require_once 'config_filter_defaults_inc.php';
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];
Ejemplo n.º 2
0
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
auth_ensure_user_authenticated();
compress_enable();
html_page_top();
?>
<br />
<div align="center">
<?php 
$t_query_to_store = filter_db_get_filter(gpc_get_cookie(config_get('view_all_cookie'), ''));
$t_query_arr = filter_db_get_available_queries();
# Let's just see if any of the current filters are the
# same as the one we're about the try and save
foreach ($t_query_arr as $t_id => $t_name) {
    if (filter_db_get_filter($t_id) == $t_query_to_store) {
        print lang_get('query_exists') . ' (' . $t_name . ')<br />';
    }
}
# Check for an error
$t_error_msg = strip_tags(gpc_get_string('error_msg', null));
if ($t_error_msg != null) {
    print "<br />{$t_error_msg}<br /><br />";
}
print lang_get('query_name_label') . lang_get('word_separator');
?>
<form method="post" action="query_store.php">
<?php 
echo form_security_field('query_store');
?>
<input type="text" name="query_name" /><br />
Ejemplo n.º 3
0
/**
 * Check if the filter cookie exists and is of the correct version.
 * @return boolean
 */
function filter_is_cookie_valid()
{
    $t_view_all_cookie_id = gpc_get_cookie(config_get('view_all_cookie'), '');
    $t_view_all_cookie = filter_db_get_filter($t_view_all_cookie_id);
    # check to see if the cookie does not exist
    if (is_blank($t_view_all_cookie)) {
        return false;
    }
    # check to see if new cookie is needed
    $t_setting_arr = explode('#', $t_view_all_cookie, 2);
    if ($t_setting_arr[0] == 'v1' || $t_setting_arr[0] == 'v2' || $t_setting_arr[0] == 'v3' || $t_setting_arr[0] == 'v4') {
        return false;
    }
    # We shouldn't need to do this anymore, as filters from v5 onwards should cope with changing
    # filter indices dynamically
    $t_filter_cookie_arr = array();
    if (isset($t_setting_arr[1])) {
        $t_filter_cookie_arr = json_decode($t_setting_arr[1], true);
    } else {
        return false;
    }
    if ($t_filter_cookie_arr['_version'] != FILTER_VERSION) {
        return false;
    }
    return true;
}
Ejemplo n.º 4
0
$t_issues_per_page = 25;
$t_page_count = 0;
$t_issues_count = 0;
$t_project_id = $f_project_id;
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') . ']';
    }
Ejemplo n.º 5
0
/**
 * 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;
}
Ejemplo n.º 6
0
$f_query_name = strip_tags(gpc_get_string('query_name'));
$f_is_public = gpc_get_bool('is_public');
$f_all_projects = gpc_get_bool('all_projects');
$t_query_redirect_url = 'query_store_page.php';
# We can't have a blank name
if (is_blank($f_query_name)) {
    $t_query_redirect_url = $t_query_redirect_url . '?error_msg=' . urlencode(lang_get('query_blank_name'));
    print_header_redirect($t_query_redirect_url);
}
# Check and make sure they don't already have a
# query with the same name
$t_query_arr = filter_db_get_available_queries();
foreach ($t_query_arr as $t_id => $t_name) {
    if ($f_query_name == $t_name) {
        $t_query_redirect_url = $t_query_redirect_url . '?error_msg=' . urlencode(lang_get('query_dupe_name'));
        print_header_redirect($t_query_redirect_url);
        exit;
    }
}
$t_project_id = helper_get_current_project();
if ($f_all_projects) {
    $t_project_id = 0;
}
$t_filter_string = filter_db_get_filter(gpc_get_cookie(config_get('view_all_cookie'), ''));
$t_new_row_id = filter_db_set_for_current_user($t_project_id, $f_is_public, $f_query_name, $t_filter_string);
if ($t_new_row_id == -1) {
    $t_query_redirect_url = $t_query_redirect_url . '?error_msg=' . urlencode(lang_get('query_store_error'));
    print_header_redirect($t_query_redirect_url);
} else {
    print_header_redirect('view_all_bug_page.php');
}
Ejemplo n.º 7
0
/**
 * 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_project_id  The id of the project to retrieve filters for.
 * @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 = json_decode($t_filter_detail[1], true);
    $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;
}
Ejemplo n.º 8
0
     break;
     # Set the sort order and direction
 # Set the sort order and direction
 case '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
Ejemplo n.º 9
0
/**
 * 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;
}
Ejemplo n.º 10
0
/**
 * 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 ========================= --
?>