.
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
$g_allow_browser_cache = 1;
require_once( 'core.php' );
require_once( 'bug_api.php' );
require_once( 'custom_field_api.php' );
require_once( 'relationship_api.php' );
define ( 'BUG_VIEW_INC_ALLOW', true );
$f_bug_id = gpc_get_int( 'id' );
$t_bug = bug_get( $f_bug_id );
$tpl_file = __FILE__;
$tpl_mantis_dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
$tpl_show_page_header = false;
$tpl_force_readonly = true;
$tpl_fields_config_option = 'bug_change_status_page_fields';
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;
}
$f_new_status = gpc_get_int( 'new_status' );
$f_reopen_flag = gpc_get_int( 'reopen_flag', OFF );
$t_reopen = config_get( 'bug_reopen_status', null, null, $t_bug->project_id );
$t_resolved = config_get( 'bug_resolved_status_threshold', null, null, $t_bug->project_id );
$t_closed = config_get( 'bug_closed_status_threshold', null, null, $t_bug->project_id );
$t_current_user_id = auth_get_current_user_id();
# Ensure user has proper access level before proceeding
if( $f_new_status == $t_reopen && $f_reopen_flag ) {
access_ensure_can_reopen_bug( $t_bug, $t_current_user_id );
}
else if( $f_new_status == $t_closed ) {
access_ensure_can_close_bug( $t_bug, $t_current_user_id );
}
else if ( bug_is_readonly( $f_bug_id )
|| !access_has_bug_level( access_get_status_threshold( $f_new_status, $t_bug->project_id ), $f_bug_id, $t_current_user_id ) ) {
access_denied();
}
$t_can_update_due_date = access_has_bug_level( config_get( 'due_date_update_threshold' ), $f_bug_id );
# get new issue handler if set, otherwise default to original handler
$f_handler_id = gpc_get_int( 'handler_id', $t_bug->handler_id );
if ( config_get( 'bug_assigned_status' ) == $f_new_status ) {
$t_bug_sponsored = sponsorship_get_amount( sponsorship_get_all_ids( $f_bug_id ) ) > 0;
if ( $t_bug_sponsored ) {
if ( !access_has_bug_level( config_get( 'assign_sponsored_bugs_threshold' ), $f_bug_id ) ) {
trigger_error( ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR );
}
}
if ( $f_handler_id != NO_USER ) {
if ( !access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id, $f_handler_id ) ) {
trigger_error( ERROR_HANDLER_ACCESS_TOO_LOW, ERROR );
}
if ( $t_bug_sponsored ) {
if ( !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id, $f_handler_id ) ) {
trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR );
}
}
}
}
$t_status_label = str_replace( " ", "_", MantisEnum::getLabel( config_get( 'status_enum_string' ), $f_new_status ) );
html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
print_recently_visited();
?>