コード例 #1
0
 function display_commit_message($event, $bugid)
 {
     if (!$bugid) {
         return;
     }
     $t_fields = config_get('bug_view_page_fields');
     $t_fields = columns_filter_disabled($t_fields);
     $tpl_show_id = in_array('id', $t_fields);
     $tpl_show_description = in_array('description', $t_fields);
     $tpl_show_status = in_array('status', $t_fields);
     if ($tpl_show_id && $tpl_show_description && $tpl_show_status) {
         bug_ensure_exists($bugid);
         $bug = bug_get($bugid, true);
         access_ensure_bug_level(VIEWER, $bugid);
         $tpl_description = string_display_links($bug->summary);
         $tpl_status = get_enum_element('status', $bug->status);
         $tpl_link = config_get('path') . string_get_bug_view_url($bugid, null);
         $message = sprintf('%s - #JJ%d: %s<br/>%s', strtoupper($tpl_status), $bugid, $tpl_description, $tpl_link);
         echo '<tr ', helper_alternate_class(), '>';
         echo '<td class="category">', plugin_lang_get('commit_message'), '</td>';
         echo '<td colspan="5">' . $message . '</td>';
         echo '</tr>';
     }
 }
コード例 #2
0
require_api('form_api.php');
require_api('gpc_api.php');
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('profile_api.php');
require_api('project_api.php');
require_api('relationship_api.php');
require_api('string_api.php');
require_api('utility_api.php');
require_api('version_api.php');
$f_master_bug_id = gpc_get_int('m_id', 0);
if ($f_master_bug_id > 0) {
    # master bug exists...
    bug_ensure_exists($f_master_bug_id);
    # master bug is not read-only...
    if (bug_is_readonly($f_master_bug_id)) {
        error_parameters($f_master_bug_id);
        trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
    }
    $t_bug = bug_get($f_master_bug_id, true);
    #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of
    #       what the current project is set to.
    if ($t_bug->project_id != helper_get_current_project()) {
        # in case the current project is not the same project of the bug we are viewing...
        # ... override the current project. This to avoid problems with categories and handlers lists etc.
        $g_project_override = $t_bug->project_id;
        $t_changed_project = true;
    } else {
        $t_changed_project = false;
コード例 #3
0
ファイル: bug_actiongroup.php プロジェクト: gtn/mantisbt
$f_bug_noteprivate = gpc_get_bool('private');
$t_form_name = 'bug_actiongroup_' . $f_action;
form_security_validate($t_form_name);
$t_custom_group_actions = config_get('custom_group_actions');
foreach ($t_custom_group_actions as $t_custom_group_action) {
    if ($f_action == $t_custom_group_action['action']) {
        require_once $t_custom_group_action['action_page'];
        exit;
    }
}
$t_failed_ids = array();
if (0 != $f_custom_field_id) {
    $t_custom_field_def = custom_field_get_definition($f_custom_field_id);
}
foreach ($f_bug_arr as $t_bug_id) {
    bug_ensure_exists($t_bug_id);
    $t_bug = bug_get($t_bug_id, true);
    if ($t_bug->project_id != helper_get_current_project()) {
        # in case the current project is not the same project of the bug we are viewing...
        # ... override the current project. This to avoid problems with categories and handlers lists etc.
        $g_project_override = $t_bug->project_id;
        # @todo (thraxisp) the next line goes away if the cache was smarter and used project
        config_flush_cache();
        # flush the config cache so that configs are refetched
    }
    $t_status = $t_bug->status;
    switch ($f_action) {
        case 'CLOSE':
            $t_closed = config_get('bug_closed_status_threshold');
            if (access_can_close_bug($t_bug)) {
                if ($t_status < $t_closed && bug_check_workflow($t_status, $t_closed)) {
コード例 #4
0
# --------------------------------------------------------
# $Id: bug_view_advanced_page.php,v 1.87.2.1 2007-10-13 22:32:59 giallu Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'bug_api.php';
require_once $t_core_path . 'custom_field_api.php';
require_once $t_core_path . 'file_api.php';
require_once $t_core_path . 'compress_api.php';
require_once $t_core_path . 'date_api.php';
require_once $t_core_path . 'relationship_api.php';
require_once $t_core_path . 'last_visited_api.php';
require_once $t_core_path . 'tag_api.php';
$f_bug_id = gpc_get_int('bug_id');
$f_history = gpc_get_bool('history', config_get('history_default_visible'));
bug_ensure_exists($f_bug_id);
access_ensure_bug_level(VIEWER, $f_bug_id);
$t_bug = bug_prepare_display(bug_get($f_bug_id, true));
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if (SIMPLE_ONLY == config_get('show_view')) {
    print_header_redirect('bug_view_page.php?bug_id=' . $f_bug_id);
}
compress_enable();
html_page_top1(bug_format_summary($f_bug_id, SUMMARY_CAPTION));
html_page_top2();
print_recently_visited();
$t_access_level_needed = config_get('view_history_threshold');
コード例 #5
0
form_security_validate('bug_relationship_add');
$f_rel_type = gpc_get_int('rel_type');
$f_src_bug_id = gpc_get_int('src_bug_id');
$f_dest_bug_id_string = gpc_get_string('dest_bug_id');
# user has access to update the bug...
access_ensure_bug_level(config_get('update_bug_threshold'), $f_src_bug_id);
$f_dest_bug_id_string = str_replace(',', '|', $f_dest_bug_id_string);
$f_dest_bug_id_array = explode('|', $f_dest_bug_id_string);
foreach ($f_dest_bug_id_array as $f_dest_bug_id) {
    $f_dest_bug_id = (int) $f_dest_bug_id;
    # source and destination bugs are the same bug...
    if ($f_src_bug_id == $f_dest_bug_id) {
        trigger_error(ERROR_RELATIONSHIP_SAME_BUG, ERROR);
    }
    # the related bug exists...
    bug_ensure_exists($f_dest_bug_id);
    # bug is not read-only...
    if (bug_is_readonly($f_src_bug_id)) {
        error_parameters($f_src_bug_id);
        trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
    }
    # user can access to the related bug at least as viewer...
    if (!access_has_bug_level(VIEWER, $f_dest_bug_id)) {
        error_parameters($f_dest_bug_id);
        trigger_error(ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR);
    }
    $t_bug = bug_get($f_src_bug_id, true);
    if ($t_bug->project_id != helper_get_current_project()) {
        # in case the current project is not the same project of the bug we are viewing...
        # ... override the current project. This to avoid problems with categories and handlers lists etc.
        $g_project_override = $t_bug->project_id;
コード例 #6
0
ファイル: bug_update.php プロジェクト: Kirill/mantisbt
    # invalid.
    if (!custom_field_validate($t_cf_id, $t_new_custom_field_value)) {
        error_parameters(lang_get_defaulted(custom_field_get_field($t_cf_id, 'name')));
        trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
    }
    # Remember the new custom field values so we can set them when updating
    # the bug (done after all data passed to this update page has been
    # validated).
    $t_custom_fields_to_set[] = array('id' => $t_cf_id, 'value' => $t_new_custom_field_value);
}
# Perform validation of the duplicate ID of the bug.
if ($t_updated_bug->duplicate_id !== 0) {
    if ($t_updated_bug->duplicate_id === $f_bug_id) {
        trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR);
    }
    bug_ensure_exists($t_updated_bug->duplicate_id);
    if (!access_has_bug_level(config_get('update_bug_threshold'), $t_updated_bug->duplicate_id)) {
        trigger_error(ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR);
    }
    if (relationship_exists($f_bug_id, $t_updated_bug->duplicate_id)) {
        trigger_error(ERROR_RELATIONSHIP_ALREADY_EXISTS, ERROR);
    }
}
# Validate the new bug note (if any is provided).
if ($t_bug_note->note || config_get('time_tracking_enabled') && helper_duration_to_minutes($t_bug_note->time_tracking) > 0) {
    access_ensure_bug_level(config_get('add_bugnote_threshold'), $f_bug_id);
    if (!$t_bug_note->note && !config_get('time_tracking_without_note')) {
        error_parameters(lang_get('bugnote'));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    if ($t_bug_note->view_state !== config_get('default_bugnote_view_status')) {
コード例 #7
0
/**
 * resolve the given bug
 * @param int p_bug_id
 * @param int p_resolution resolution code
 * @param int p_status optional custom status (defaults to bug_resolved_status_threshold)
 * @param string p_fixed_in_version optional version string in which issue is fixed
 * @param int p_duplicate_id optional id of duplicate issue (defaults to null)
 * @param int p_handler_id optional id of issue handler
 * @param string p_bugnote_text optional bug note to add
 * @param bool p_bugnote_private optional true if bug note should be private (defaults to false)
 * @param string p_time_tracking optional time spent (defaults to '0:00')
 * @return bool (always true)
 * @access public
 */
function bug_resolve($p_bug_id, $p_resolution, $p_status = null, $p_fixed_in_version = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_text = '', $p_bugnote_private = false, $p_time_tracking = '0:00')
{
    $c_resolution = (int) $p_resolution;
    if (null == $p_status) {
        $p_status = config_get('bug_resolved_status_threshold');
    }
    $p_bugnote_text = trim($p_bugnote_text);
    # Add bugnote if supplied
    # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off.
    # Error condition stopped execution but status had already been changed
    bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE);
    $t_duplicate = !is_blank($p_duplicate_id) && $p_duplicate_id != 0;
    if ($t_duplicate) {
        if ($p_bug_id == $p_duplicate_id) {
            trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR);
            # never returns
        }
        # the related bug exists...
        bug_ensure_exists($p_duplicate_id);
        # check if there is other relationship between the bugs...
        $t_id_relationship = relationship_same_type_exists($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
        if ($t_id_relationship > 0) {
            # Update the relationship
            relationship_update($t_id_relationship, $p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
            # Add log line to the history (both bugs)
            history_log_event_special($p_bug_id, BUG_REPLACE_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
            history_log_event_special($p_duplicate_id, BUG_REPLACE_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
        } else {
            if ($t_id_relationship != -1) {
                # Add the new relationship
                relationship_add($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
                # Add log line to the history (both bugs)
                history_log_event_special($p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
                history_log_event_special($p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
            }
        }
        # else relationship is -1 - same type exists, do nothing
        # Copy list of users monitoring the duplicate bug to the original bug
        bug_monitor_copy($p_bug_id, $p_duplicate_id);
        bug_set_field($p_bug_id, 'duplicate_id', (int) $p_duplicate_id);
    }
    bug_set_field($p_bug_id, 'status', $p_status);
    bug_set_field($p_bug_id, 'fixed_in_version', $p_fixed_in_version);
    bug_set_field($p_bug_id, 'resolution', $c_resolution);
    # only set handler if specified explicitly or if bug was not assigned to a handler
    if (null == $p_handler_id) {
        if (bug_get_field($p_bug_id, 'handler_id') == 0) {
            $p_handler_id = auth_get_current_user_id();
            bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
        }
    } else {
        bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
    }
    email_resolved($p_bug_id);
    email_relationship_child_resolved($p_bug_id);
    if ($c_resolution >= config_get('bug_resolution_fixed_threshold') && $c_resolution < config_get('bug_resolution_not_fixed_threshold')) {
        twitter_issue_resolved($p_bug_id);
    }
    return true;
}
コード例 #8
0
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('sponsorship_api.php');
if (!config_get('enable_sponsorship')) {
    trigger_error(ERROR_SPONSORSHIP_NOT_ENABLED, ERROR);
}
form_security_validate('account_sponsor_update');
auth_ensure_user_authenticated();
$f_bug_list = gpc_get_string('buglist', '');
$t_bug_list = explode(',', $f_bug_list);
foreach ($t_bug_list as $t_bug) {
    list($t_bug_id, $t_sponsor_id) = explode(':', $t_bug);
    $c_bug_id = (int) $t_bug_id;
    bug_ensure_exists($c_bug_id);
    # dies if bug doesn't exist
    access_ensure_bug_level(config_get('handle_sponsored_bugs_threshold'), $c_bug_id);
    # dies if user can't handle bug
    $t_bug = bug_get($c_bug_id);
    $t_sponsor = sponsorship_get((int) $t_sponsor_id);
    $t_new_payment = gpc_get_int('sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid);
    if ($t_new_payment != $t_sponsor->paid) {
        sponsorship_update_paid($t_sponsor_id, $t_new_payment);
    }
}
form_security_purge('account_sponsor_update');
$t_redirect_url = 'account_sponsor_page.php';
html_page_top(null, $t_redirect_url);
html_operation_successful($t_redirect_url, lang_get('payment_updated'));
html_page_bottom();
コード例 #9
0
ファイル: bug_api.php プロジェクト: jin255ff/company_website
function bug_resolve($p_bug_id, $p_resolution, $p_fixed_in_version = '', $p_bugnote_text = '', $p_duplicate_id = null, $p_handler_id = null, $p_bugnote_private = false, $p_time_tracking = '0:00')
{
    $p_bugnote_text = trim($p_bugnote_text);
    # Add bugnote if supplied
    # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off.
    # Error condition stopped execution but status had already been changed
    bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', NULL, FALSE);
    $t_duplicate = !is_blank($p_duplicate_id) && $p_duplicate_id != 0;
    if ($t_duplicate) {
        if ($p_bug_id == $p_duplicate_id) {
            trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR);
            # never returns
        }
        # the related bug exists...
        bug_ensure_exists($p_duplicate_id);
        if (ON == config_get('enable_relationship')) {
            # check if there is other relationship between the bugs...
            $t_id_relationship = relationship_same_type_exists($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
            if ($t_id_relationship == -1) {
                # the relationship type is already set. Nothing to do
            } else {
                if ($t_id_relationship > 0) {
                    # there is already a relationship between them -> we have to update it and not to add a new one
                    helper_ensure_confirmed(lang_get('replace_relationship_sure_msg'), lang_get('replace_relationship_button'));
                    # Update the relationship
                    relationship_update($t_id_relationship, $p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
                    # Add log line to the history (both bugs)
                    history_log_event_special($p_bug_id, BUG_REPLACE_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
                    history_log_event_special($p_duplicate_id, BUG_REPLACE_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
                } else {
                    # Add the new relationship
                    relationship_add($p_bug_id, $p_duplicate_id, BUG_DUPLICATE);
                    # Add log line to the history (both bugs)
                    history_log_event_special($p_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $p_duplicate_id);
                    history_log_event_special($p_duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $p_bug_id);
                }
            }
        }
        bug_set_field($p_bug_id, 'duplicate_id', (int) $p_duplicate_id);
    }
    $c_resolution = db_prepare_int($p_resolution);
    bug_set_field($p_bug_id, 'status', config_get('bug_resolved_status_threshold'));
    bug_set_field($p_bug_id, 'fixed_in_version', $p_fixed_in_version);
    bug_set_field($p_bug_id, 'resolution', $c_resolution);
    # only set handler if specified explicitly or if bug was not assigned to a handler
    if (null == $p_handler_id) {
        if (bug_get_field($p_bug_id, 'handler_id') == 0) {
            $p_handler_id = auth_get_current_user_id();
            bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
        }
    } else {
        bug_set_field($p_bug_id, 'handler_id', $p_handler_id);
    }
    email_resolved($p_bug_id);
    if ($c_resolution == FIXED) {
        twitter_issue_resolved($p_bug_id);
    }
    # MASC RELATIONSHIP
    if (ON == config_get('enable_relationship')) {
        email_relationship_child_resolved($p_bug_id);
    }
    # MASC RELATIONSHIP
    return true;
}
コード例 #10
0
if ( !config_get( 'enable_sponsorship' ) ) {
	trigger_error( ERROR_SPONSORSHIP_NOT_ENABLED, ERROR );
}

form_security_validate( 'account_sponsor_update' );

auth_ensure_user_authenticated();

$f_bug_list = gpc_get_string( 'buglist', '' );
$t_bug_list = explode( ',', $f_bug_list );

foreach ( $t_bug_list as $t_bug ) {
	list( $t_bug_id, $t_sponsor_id ) = explode( ':', $t_bug );
	$c_bug_id = (int) $t_bug_id;

	bug_ensure_exists( $c_bug_id ); # dies if bug doesn't exist

	access_ensure_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $c_bug_id ); # dies if user can't handle bug

	$t_bug = bug_get( $c_bug_id );
	$t_sponsor = sponsorship_get( (int) $t_sponsor_id );

	$t_new_payment = gpc_get_int( 'sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid );
	if ( $t_new_payment != $t_sponsor->paid ) {
		sponsorship_update_paid( $t_sponsor_id, $t_new_payment );
	}
}

form_security_purge( 'account_sponsor_update' );

$t_redirect = 'account_sponsor_page.php';