示例#1
0
/**
 * Get all issues matching the specified filter.
 *
 * @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_issues($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();
    }
    $t_lang = mci_get_user_lang($t_user_id);
    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_array($t_issue_data, $t_user_id, $t_lang);
    }
    return $t_result;
}
示例#2
0
function mc_project_get_issues($p_username, $p_password, $p_project_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();
    }
    $t_lang = mci_get_user_lang($t_user_id);
    if ($p_project_id != ALL_PROJECTS && !project_exists($p_project_id)) {
        return SoapObjectsFactory::newSoapFault('Client', "Project '{$p_project_id}' does not exist.");
    }
    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_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, null, $p_project_id);
    $t_result = array();
    // 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_array($t_issue_data, $t_user_id, $t_lang);
    }
    return $t_result;
}
示例#3
0
/**
 * Get all issues matching the specified filter.
 *
 * @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_issues($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();
    }
    $t_lang = mci_get_user_lang($t_user_id);
    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_result[] = mci_issue_data_as_array($t_issue_data, $t_user_id, $t_lang);
    }
    return $t_result;
}
示例#4
0
function mc_project_get_issues($p_username, $p_password, $p_project_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();
    }
    $t_lang = mci_get_user_lang($t_user_id);
    if (!project_exists($p_project_id)) {
        return new soap_fault('Client', '', "Project '{$p_project_id}' does not exist.");
    }
    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_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, null, $p_project_id);
    $t_result = array();
    foreach ($t_rows as $t_issue_data) {
        $t_result[] = mci_issue_data_as_array($t_issue_data, $t_user_id, $t_lang);
    }
    return $t_result;
}
示例#5
0
/**
 * Get all issues matching the ids.
 *
 * @param string                $p_username         The name of the user trying to access the filters.
 * @param string                $p_password         The password of the user.
 * @param IntegerArray          $p_issue_ids        Number of issues to display per page.
 * @return array that represents an IssueDataArray structure
 */
function mc_issues_get($p_username, $p_password, $p_issue_ids)
{
    global $g_project_override;
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    $t_lang = mci_get_user_lang($t_user_id);
    $t_result = array();
    foreach ($p_issue_ids as $t_id) {
        if (mci_check_access_to_bug($t_user_id, $t_id) === false) {
            continue;
        }
        log_event(LOG_WEBSERVICE, 'getting details for issue \'' . $t_id . '\'');
        $t_issue_data = bug_get($t_id, true);
        $t_result[] = mci_issue_data_as_array($t_issue_data, $t_user_id, $t_lang);
    }
    return $t_result;
}
示例#6
0
/**
 * Get all issues matching the custom filter.
 *
 * @param string                $p_username         The name of the user trying to access the filters.
 * @param string                $p_password         The password of the user.
 * @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 that represents an IssueDataArray structure
 */
function mc_filter_search_issues($p_username, $p_password, $p_filter_search, $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();
    }
    $t_rows = mci_filter_search_get_rows($t_user_id, $p_filter_search, $p_page_number, $p_per_page);
    $t_lang = mci_get_user_lang($t_user_id);
    $t_result = array();
    foreach ($t_rows as $t_issue_data) {
        $t_result[] = mci_issue_data_as_array($t_issue_data, $t_user_id, $t_lang);
    }
    return $t_result;
}