예제 #1
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);
    $t_lang = mci_get_user_lang($t_user_id);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    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 new soap_fault('Client', '', 'Access Denied');
    }
    $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_id = $t_issue_data['id'];
        $t_issue = array();
        $t_issue['id'] = $t_id;
        $t_issue['view_state'] = mci_enum_get_array_by_id($t_issue_data['view_state'], 'view_state', $t_lang);
        $t_issue['last_updated'] = timestamp_to_iso8601($t_issue_data['last_updated']);
        $t_issue['project'] = mci_project_as_array_by_id($t_issue_data['project_id']);
        $t_issue['category'] = mci_null_if_empty($t_issue_data['category']);
        $t_issue['priority'] = mci_enum_get_array_by_id($t_issue_data['priority'], 'priority', $t_lang);
        $t_issue['severity'] = mci_enum_get_array_by_id($t_issue_data['severity'], 'severity', $t_lang);
        $t_issue['status'] = mci_enum_get_array_by_id($t_issue_data['status'], 'status', $t_lang);
        $t_issue['reporter'] = mci_account_get_array_by_id($t_issue_data['reporter_id']);
        $t_issue['summary'] = $t_issue_data['summary'];
        $t_issue['version'] = mci_null_if_empty($t_issue_data['version']);
        $t_issue['build'] = mci_null_if_empty($t_issue_data['build']);
        $t_issue['platform'] = mci_null_if_empty($t_issue_data['platform']);
        $t_issue['os'] = mci_null_if_empty($t_issue_data['os']);
        $t_issue['os_build'] = mci_null_if_empty($t_issue_data['os_build']);
        $t_issue['reproducibility'] = mci_enum_get_array_by_id($t_issue_data['reproducibility'], 'reproducibility', $t_lang);
        $t_issue['date_submitted'] = timestamp_to_iso8601($t_issue_data['date_submitted']);
        $t_issue['sponsorship_total'] = $t_issue_data['sponsorship_total'];
        if (!empty($t_issue_data['handler_id'])) {
            $t_issue['handler'] = mci_account_get_array_by_id($t_issue_data['handler_id']);
        }
        $t_issue['projection'] = mci_enum_get_array_by_id($t_issue_data['projection'], 'projection', $t_lang);
        $t_issue['eta'] = mci_enum_get_array_by_id($t_issue_data['eta'], 'eta', $t_lang);
        $t_issue['resolution'] = mci_enum_get_array_by_id($t_issue_data['resolution'], 'resolution', $t_lang);
        $t_issue['fixed_in_version'] = mci_null_if_empty($t_issue_data['fixed_in_version']);
        $t_issue['description'] = bug_get_text_field($t_id, 'description');
        $t_issue['steps_to_reproduce'] = mci_null_if_empty(bug_get_text_field($t_id, 'steps_to_reproduce'));
        $t_issue['additional_information'] = mci_null_if_empty(bug_get_text_field($t_id, 'additional_information'));
        $t_issue['attachments'] = mci_issue_get_attachments($t_issue_data['id']);
        $t_issue['relationships'] = mci_issue_get_relationships($t_issue_data['id'], $t_user_id);
        $t_issue['notes'] = mci_issue_get_notes($t_issue_data['id']);
        $t_issue['custom_fields'] = mci_issue_get_custom_fields($t_issue_data['id']);
        $t_result[] = $t_issue;
    }
    return $t_result;
}
예제 #2
0
function update_bug_summary_by_version($t_version, $map_file)
{
    $db_table = db_get_table('mantis_bug_table');
    $query = "SELECT `id`, `summary`, `project_id` FROM {$db_table} WHERE `version` = '" . mysql_real_escape_string($t_version) . "'";
    $result = db_query_bound($query);
    $rows = array();
    while (true) {
        $row = db_fetch_array($result);
        if ($row == false) {
            break;
        }
        $rows[] = $row;
    }
    if (count($rows) === 0) {
        return;
    }
    require_once "ProjectAcraExt.php";
    $app_packages = get_project_package_list($rows[0]['project_id']);
    foreach ($rows as $row) {
        $bug_id = $row['id'];
        $stacktrace = bug_get_text_field($bug_id, 'description');
        $info = get_stack_map($stacktrace);
        $exception = $info->exception;
        $method = "";
        $suffix = "";
        $size = count($info->stack);
        if ($size > 0) {
            foreach ($info->stack as $entry) {
                $func = $entry->method;
                foreach ($app_packages as $pack => $len) {
                    if (strncmp($func, $pack, $len) === 0) {
                        $method = $entry->method;
                        $suffix = $entry->suffix;
                        break;
                    }
                }
                if (strlen($method) > 0) {
                    break;
                }
            }
        }
        if (strlen($exception) > 0) {
            $line = build_summary_text($exception, $method . $suffix);
        } else {
            $line = 'Acra report crash ' . $method . $suffix;
        }
        $line = mysql_real_escape_string($line);
        $query = "UPDATE `{$db_table}` SET `summary` = '{$line}' WHERE `id` = {$bug_id}; ";
        db_query_bound($query);
    }
}
예제 #3
0
파일: mantishelper.php 프로젝트: n2i/xvnkb
function addExtraBugData($bug)
{
    $bug["project_name"] = project_get_name($bug["project_id"]);
    if ($bug["reporter_id"] != "") {
        $bug["reporter_name"] = user_get_field($bug["reporter_id"], 'username');
    }
    $bug["severity_name"] = get_enum_element('severity', $bug["severity"]);
    $bug["priority_name"] = get_enum_element('priority', $bug["priority"]);
    $bug["status_name"] = get_enum_element('status', $bug["status"]);
    $bug["reproducibility_name"] = get_enum_element('reproducibility', $bug["reproducibility"]);
    if ($bug["handler_id"] == "") {
        $bug["handler_name"] = user_get_field($bug["handler_id"], 'username');
    }
    $bug["projection_name"] = get_enum_element('projection', $bug["projection"]);
    $bug["eta_name"] = get_enum_element('eta', $bug["eta"]);
    $bug["resolution_name"] = get_enum_element('resolution', $bug["resolution"]);
    $bug["description"] = bug_get_text_field($bug["id"], 'description');
    return $bug;
}
/**
 * Print table body
 * @param $status_cols
 */
function print_tbody($status_cols)
{
    $storyboard_db_api = new storyboard_db_api();
    $project_spec_bug_ids = $storyboard_db_api->get_bugarray_by_project(helper_get_current_project());
    $types = $storyboard_db_api->select_all_types();
    echo '<tbody>';
    foreach ($types as $type) {
        echo '<tr>';
        echo '<td class="category">' . $type[1] . '</td>';
        foreach ($status_cols as $status_col) {
            echo '<td class="story_baord">';
            foreach ($project_spec_bug_ids as $project_spec_bug_id) {
                $card = $storyboard_db_api->select_story_card($project_spec_bug_id);
                if ($card[2] == $type[0]) {
                    $bug_status = bug_get_field($project_spec_bug_id, 'status');
                    if ($bug_status == $status_col) {
                        echo '<a href="' . string_get_bug_view_url($project_spec_bug_id) . '" class="rcv_tooltip">';
                        echo '<div class="story_card">';
                        echo string_display_line(bug_format_id($project_spec_bug_id));
                        echo '<span>';
                        print_story_card_title($project_spec_bug_id);
                        print_story_card_info('summary', bug_get_field($project_spec_bug_id, 'summary'), false);
                        print_story_card_info('description', bug_get_text_field($project_spec_bug_id, 'description'), false);
                        print_story_card_info('card_risk', $card[3], true);
                        print_story_card_info('card_story_pt', $card[4], true);
                        print_story_card_info('card_story_pt_post', $card[5], true);
                        print_story_card_info('card_acc_crit', $card[6], true);
                        echo '</span>';
                        echo '</div>';
                        echo '</a><br/><br/><br/>';
                    }
                }
            }
            echo '</td>';
        }
        echo '</tr>';
    }
    echo '</tbody>';
}
예제 #5
0
/**
 * Returns an array for SOAP encoding from a BugData object
 *
 * @param BugData $p_issue_data A BugData object to process.
 * @param integer $p_user_id    A valid user identifier.
 * @param string  $p_lang       A valid language string.
 * @return array The issue as an array
 */
function mci_issue_data_as_array(BugData $p_issue_data, $p_user_id, $p_lang)
{
    $t_id = $p_issue_data->id;
    $t_issue = array();
    $t_issue['id'] = $t_id;
    $t_issue['view_state'] = mci_enum_get_array_by_id($p_issue_data->view_state, 'view_state', $p_lang);
    $t_issue['last_updated'] = SoapObjectsFactory::newDateTimeVar($p_issue_data->last_updated);
    $t_issue['project'] = mci_project_as_array_by_id($p_issue_data->project_id);
    $t_issue['category'] = mci_get_category($p_issue_data->category_id);
    $t_issue['priority'] = mci_enum_get_array_by_id($p_issue_data->priority, 'priority', $p_lang);
    $t_issue['severity'] = mci_enum_get_array_by_id($p_issue_data->severity, 'severity', $p_lang);
    $t_issue['status'] = mci_enum_get_array_by_id($p_issue_data->status, 'status', $p_lang);
    $t_issue['reporter'] = mci_account_get_array_by_id($p_issue_data->reporter_id);
    $t_issue['summary'] = mci_sanitize_xml_string($p_issue_data->summary);
    $t_issue['version'] = mci_null_if_empty($p_issue_data->version);
    $t_issue['build'] = mci_null_if_empty($p_issue_data->build);
    $t_issue['profile_id'] = mci_null_if_empty($p_issue_data->profile_id);
    $t_issue['platform'] = mci_null_if_empty($p_issue_data->platform);
    $t_issue['os'] = mci_null_if_empty($p_issue_data->os);
    $t_issue['os_build'] = mci_null_if_empty($p_issue_data->os_build);
    $t_issue['reproducibility'] = mci_enum_get_array_by_id($p_issue_data->reproducibility, 'reproducibility', $p_lang);
    $t_issue['date_submitted'] = SoapObjectsFactory::newDateTimeVar($p_issue_data->date_submitted);
    $t_issue['sticky'] = $p_issue_data->sticky;
    $t_issue['sponsorship_total'] = $p_issue_data->sponsorship_total;
    if (!empty($p_issue_data->handler_id)) {
        $t_issue['handler'] = mci_account_get_array_by_id($p_issue_data->handler_id);
    }
    $t_issue['projection'] = mci_enum_get_array_by_id($p_issue_data->projection, 'projection', $p_lang);
    $t_issue['eta'] = mci_enum_get_array_by_id($p_issue_data->eta, 'eta', $p_lang);
    $t_issue['resolution'] = mci_enum_get_array_by_id($p_issue_data->resolution, 'resolution', $p_lang);
    $t_issue['fixed_in_version'] = mci_null_if_empty($p_issue_data->fixed_in_version);
    $t_issue['target_version'] = mci_null_if_empty($p_issue_data->target_version);
    $t_issue['description'] = mci_sanitize_xml_string(bug_get_text_field($t_id, 'description'));
    $t_steps_to_reproduce = bug_get_text_field($t_id, 'steps_to_reproduce');
    $t_issue['steps_to_reproduce'] = mci_null_if_empty(mci_sanitize_xml_string($t_steps_to_reproduce));
    $t_additional_information = bug_get_text_field($t_id, 'additional_information');
    $t_issue['additional_information'] = mci_null_if_empty(mci_sanitize_xml_string($t_additional_information));
    $t_issue['due_date'] = SoapObjectsFactory::newDateTimeVar($p_issue_data->due_date);
    $t_issue['attachments'] = mci_issue_get_attachments($p_issue_data->id);
    $t_issue['relationships'] = mci_issue_get_relationships($p_issue_data->id, $p_user_id);
    $t_issue['notes'] = mci_issue_get_notes($p_issue_data->id);
    $t_issue['custom_fields'] = mci_issue_get_custom_fields($p_issue_data->id);
    $t_issue['tags'] = mci_issue_get_tags_for_bug_id($p_issue_data->id, $p_user_id);
    $t_issue['monitors'] = mci_account_get_array_by_ids(bug_get_monitors($p_issue_data->id));
    return $t_issue;
}
예제 #6
0
$t_bug_phone_build = $acra_bug_ext->phone_build;
$t_bug_phone_build = htmlentities($t_bug_phone_build);
echo str_replace("\n", "<br/>\n", $t_bug_phone_build);
?>
            </div>
        </div>
    </div>
</div>
<script src="<?php 
echo plugin_file('chico.js');
?>
"></script>
<script>
    // Tabs
    <?php 
$t_bug_text = bug_get_text_field($id, 'description');
$t_restore_file = get_restore_file_by_version_name($t_bug->version);
$t_bug_text = restore_stacktrace_by_file($t_bug_text, $t_restore_file);
$t_bug_text = str_replace("\r", "", $t_bug_text);
$packages = get_project_package_list($t_bug->project_id);
?>
    var tabs = $(".YOUR_SELECTOR_Tabs").tabs();
    var div = document.getElementById('tab1-a');
    var packages = <?php 
echo json_encode(array_keys($packages));
?>
;
    var stacktrace = <?php 
echo json_encode($t_bug_text);
?>
;
예제 #7
0
 public function replacePlaceHolders($s_text, $i_bugId)
 {
     /*
      * @local string
      */
     $s_modifiedText = '';
     $s_modifiedText = str_replace("{bug_id}", $i_bugId, $s_text);
     $s_modifiedText = str_replace("{bug_summary}", bug_get_field($i_bugId, 'summary'), $s_modifiedText);
     $s_modifiedText = str_replace("{bug_description}", bug_get_text_field($i_bugId, 'description'), $s_modifiedText);
     $s_modifiedText = str_replace("{bug_category}", category_full_name(bug_get_field($i_bugId, 'category_id'), false), $s_modifiedText);
     $s_modifiedText = str_replace("{project_id}", bug_get_field($i_bugId, 'project_id'), $s_modifiedText);
     $s_modifiedText = str_replace("{project_name}", project_get_name(bug_get_field($i_bugId, 'project_id')), $s_modifiedText);
     $s_modifiedText = str_replace("{user_id}", current_user_get_field('id'), $s_modifiedText);
     $s_modifiedText = str_replace("{user_name}", current_user_get_field('username'), $s_modifiedText);
     # '@L@' is a special placeholder for a '+' since jquery's serialize function
     # replaces all spaces also with a '+'
     ############################################################################'
     $s_modifiedText = str_replace("@L@", "+", $s_modifiedText);
     return $s_modifiedText;
 }
예제 #8
0
    function show_acra_detail_buttons_plugin()
    {
        require "ProjectAcraExt.php";
        $id = gpc_get_string("id", '');
        $t_bug = bug_get($id);
        $packages = get_project_package_list($t_bug->project_id);
        $t_bug_text = bug_get_text_field($id, 'description');
        $t_restore_file = get_restore_file_by_version_name($t_bug->version);
        $restore_map = get_restore_map($t_restore_file);
        $t_bug_text = restore_stacktrace_by_map($t_bug_text, $restore_map);
        $t_bug_text = str_replace("\r", "", $t_bug_text);
        $bugnotes = bugnote_get_all_bugnotes($id);
        ?>
        <link rel="stylesheet" type="text/css" href="<?php 
        echo plugin_file("chico.css");
        ?>
" />
        <link rel="stylesheet" type="text/css" href="<?php 
        echo plugin_file("acra_view_bug.css");
        ?>
" />
        <script type="text/javascript" src="<?php 
        echo plugin_file("acra_view_bug.js");
        ?>
"></script>
        <script type="text/javascript" src="<?php 
        echo plugin_file("fancyBox/fancybox.js");
        ?>
"></script>
        <link rel="stylesheet" type="text/css" href="<?php 
        echo plugin_file("fancyBox/fancybox.css");
        ?>
"
              media="screen"/>
        <style type="text/css">
            .acra_popup {
                width: 800px;
                height: 400px;
                display: none;
                padding: 0px;
            }

            .acra_frame {
                width: 100%;
                height: 100%;
            }
        </style>
        <div id="acra_dialog" style="display:none">
            <?php 
        foreach ($bugnotes as $note) {
            if (strlen($note->note_attr) > 0) {
                echo '<div class="acra_popup" id="acra_';
                echo sprintf("%06d", $note->note_attr);
                echo '" style="display: none;">';
                echo '<iframe class="acra_frame" src="index.php?acra_page=detail.php&acra_id=';
                echo sprintf("%06d", $note->note_attr);
                echo '"></iframe></div>';
                echo "\r\n";
            }
        }
        ?>
        </div>
        <script>
            //update stack trace
            var packages = <?php 
        echo json_encode(array_keys($packages));
        ?>
;
            var list = jQuery(".category");
            for (var i = 0; i < list.length; i++) {
                var e = list[i];
                var txt = e.innerText;
                if ("Description" == txt) {
                    e = e.nextSibling;
                    e.innerHTML = acra_buildStacktraceDiv(<?php 
        echo json_encode($t_bug_text);
        ?>
, packages);
                    break;
                }
            }

            //update notes
            var noteRow, noteCells, noteTextCell, restoredNoteHtml, acraDetailLink;
            <?php 
        foreach ($bugnotes as $note) {
            $t_bug_text = restore_stacktrace_by_map($note->note, $restore_map);
            $t_bug_text = json_encode($t_bug_text);
            ?>
noteRow = document.getElementById('c<?php 
            echo $note->id;
            ?>
');
                noteCells = noteRow.getElementsByClassName("bugnote-note-public");
                noteTextCell = noteCells[0];
                noteTextCell.innerHTML = acra_buildStacktraceDiv(<?php 
            echo $t_bug_text;
            ?>
, packages);

                <?php 
            if (strlen($note->note_attr)) {
                ?>
        acraDetailLink = document.createElement("div");
                acraDetailLink.innerHTML = '<a class="fancybox" href="#acra_<?php 
                echo sprintf("%06d", $note->note_attr);
                ?>
" class="button-small">Acra Detail</a>';
                noteRow.firstElementChild.lastElementChild.appendChild(acraDetailLink);
                <?php 
            }
            ?>

            <?php 
        }
        ?>

            var cells = jQuery("td");
            var reg = new RegExp(/^\s*ID\s*$/);
            var idCell = null;
            for (var i = 0; i < cells.length; i++) {
                var str = cells[i].innerText;
                if (reg.test(str)) {
                    idCell = cells[i];
                    break;
                }
            }
            if (idCell != null) {
                var shorts = idCell.parentElement.previousElementSibling.firstElementChild;
                jQuery(shorts).append('<span class="bracket-link">[&nbsp;<a href="index.php?acra_page=test.php&acra_id=<?php 
        echo gpc_get_string("id");
        ?>
">View ACRA more info</a>&nbsp;]</span>');
            }

            jQuery('.fancybox').fancybox();
        </script>
    <?php 
    }
예제 #9
0
$t_display = htmlentities($t_display);
echo str_replace("\n", "<br>\n", $t_display);
?>
            </div>

            <div id="tab2-a" class="ch-hide">
                <?php 
$t_init_conf = $acra_bug_ext->initial_configuration;
$t_init_conf = htmlentities($t_init_conf);
echo str_replace("\n", "<br>\n", $t_init_conf);
?>
            </div>

            <div id="tab3-a" class="ch-hide">
                <?php 
$t_bug_crash_conf = bug_get_text_field($acra_bug_ext->issue_id, 'additional_information');
$t_bug_crash_conf = htmlentities($t_bug_crash_conf);
echo str_replace("\n", "<br>\n", $t_bug_crash_conf);
?>
            </div>

            <div id="tab4-a" class="ch-hide">
                <?php 
$t_bug_phone_build = $acra_bug_ext->phone_build;
$t_bug_phone_build = htmlentities($t_bug_phone_build);
echo str_replace("\n", "<br>\n", $t_bug_phone_build);
?>
            </div>

            <div id="tab5-a" class="ch-hide">
                <?php