Blame Extras/Mantis/1.1.2-1.fc9/bug_report_page.php

4c79b5
4c79b5
# Mantis - a php based bugtracking system
4c79b5
4c79b5
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
4c79b5
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
4c79b5
4c79b5
# Mantis is free software: you can redistribute it and/or modify
4c79b5
# it under the terms of the GNU General Public License as published by
4c79b5
# the Free Software Foundation, either version 2 of the License, or
4c79b5
# (at your option) any later version.
4c79b5
#
4c79b5
# Mantis is distributed in the hope that it will be useful,
4c79b5
# but WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4c79b5
# GNU General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
4c79b5
4c79b5
	#------------------------------
4c79b5
	#   $Revision: 2643 $
4c79b5
	#     $Author: al $    
4c79b5
	#       $Date: 2009-06-18 19:06:27 -0400 (Thu, 18 Jun 2009) $                                              
4c79b5
	#------------------------------
4c79b5
4c79b5
	# This file POSTs data to report_bug.php
4c79b5
4c79b5
	$g_allow_browser_cache = 1;
4c79b5
	require_once( 'core.php' );
4c79b5
4c79b5
	$t_core_path = config_get( 'core_path' );
4c79b5
4c79b5
	require_once( $t_core_path.'file_api.php' );
4c79b5
	require_once( $t_core_path.'custom_field_api.php' );
4c79b5
	require_once( $t_core_path.'last_visited_api.php' );
4c79b5
4c79b5
	$f_master_bug_id = gpc_get_int( 'm_id', 0 );
4c79b5
4c79b5
	# this page is invalid for the 'All Project' selection except if this is a clone
4c79b5
	if ( ( ALL_PROJECTS == helper_get_current_project() ) && ( 0 == $f_master_bug_id ) ) {
4c79b5
		print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' );
4c79b5
	}
4c79b5
4c79b5
	if ( ADVANCED_ONLY == config_get( 'show_report' ) ) {
4c79b5
		print_header_redirect ( 'bug_report_advanced_page.php' .
4c79b5
				( 0 == $f_master_bug_id ) ? '' : '?m_id=' . $f_master_bug_id );
4c79b5
	}
4c79b5
4c79b5
	if( $f_master_bug_id > 0 ) {
4c79b5
		# master bug exists...
4c79b5
		bug_ensure_exists( $f_master_bug_id );
4c79b5
4c79b5
		# master bug is not read-only...
4c79b5
		if ( bug_is_readonly( $f_master_bug_id ) ) {
4c79b5
			error_parameters( $f_master_bug_id );
4c79b5
			trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
4c79b5
		}
4c79b5
4c79b5
		$t_bug = bug_prepare_edit( bug_get( $f_master_bug_id, true ) );
4c79b5
4c79b5
		# the user can at least update the master bug (needed to add the relationship)...
4c79b5
		access_ensure_bug_level( config_get( 'update_bug_threshold', null, $t_bug->project_id ), $f_master_bug_id );
4c79b5
4c79b5
		#@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of
4c79b5
		#       what the current project is set to.
4c79b5
		if( $t_bug->project_id != helper_get_current_project() ) {
4c79b5
            # in case the current project is not the same project of the bug we are viewing...
4c79b5
            # ... override the current project. This to avoid problems with categories and handlers lists etc.
4c79b5
            $g_project_override = $t_bug->project_id;
4c79b5
            $t_changed_project = true;
4c79b5
        } else {
4c79b5
            $t_changed_project = false;
4c79b5
        }
4c79b5
4c79b5
	    access_ensure_project_level( config_get( 'report_bug_threshold' ) );
4c79b5
4c79b5
	    $f_product_version		= $t_bug->version;
4c79b5
		$f_category				= $t_bug->category;
4c79b5
		$f_reproducibility		= $t_bug->reproducibility;
4c79b5
		$f_severity				= $t_bug->severity;
4c79b5
		$f_priority				= $t_bug->priority;
4c79b5
		$f_summary				= $t_bug->summary;
4c79b5
		$f_description			= $t_bug->description;
4c79b5
		$f_additional_info		= $t_bug->additional_information;
4c79b5
		$f_view_state			= $t_bug->view_state;
4c79b5
4c79b5
		$t_project_id			= $t_bug->project_id;
4c79b5
	} else {
4c79b5
	    access_ensure_project_level( config_get( 'report_bug_threshold' ) );
4c79b5
4c79b5
		$f_product_version		= gpc_get_string( 'product_version', '' );
4c79b5
		$f_category				= gpc_get_string( 'category', config_get( 'default_bug_category' ) );
4c79b5
		$f_reproducibility		= gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) );
4c79b5
		$f_severity				= gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
4c79b5
		$f_priority				= gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
4c79b5
		$f_summary				= gpc_get_string( 'summary', '' );
4c79b5
		$f_description			= gpc_get_string( 'description', '' );
4c79b5
		$f_additional_info		= gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
4c79b5
		$f_view_state			= gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
4c79b5
4c79b5
		$t_project_id			= helper_get_current_project();
4c79b5
4c79b5
		$t_changed_project		= false;
4c79b5
	}
4c79b5
4c79b5
	$f_report_stay			= gpc_get_bool( 'report_stay', false );
4c79b5
4c79b5
	html_page_top1( lang_get( 'report_bug_link' ) );
4c79b5
	html_page_top2();
4c79b5
4c79b5
?>
4c79b5
4c79b5

4c79b5
4c79b5
<form name="report_bug_form" method="post" <?php if ( file_allow_bug_upload() ) { echo 'enctype="multipart/form-data"'; } ?> action="bug_report.php">
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
		<input type="hidden" name="m_id" value="<?php echo $f_master_bug_id ?>" />
4c79b5
		<input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />
4c79b5
		<input type="hidden" name="handler_id" value="0" />
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		
4c79b5
			if ( BOTH == config_get( 'show_report' ) ) {
4c79b5
				print_bracket_link( 'bug_report_advanced_page.php' .
4c79b5
					( $f_master_bug_id > 0 ? '?m_id=' . $f_master_bug_id : '' ), lang_get( 'advanced_report_link' ) );
4c79b5
			}
4c79b5
		?>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		*', lang_get( 'category' ) ?> 
4c79b5
	
4c79b5
	
4c79b5
		
4c79b5
			echo "[" . project_get_field( $t_bug->project_id, 'name' ) . "] ";
4c79b5
		} ?>
4c79b5
		<select <?php echo helper_get_tab_index() ?> name="category">
4c79b5
			
4c79b5
				if ( is_blank( $f_category ) ) {
4c79b5
					echo '<option value="" selected="selected">', string_attribute( lang_get( 'select_option' ) ), '</option>';
4c79b5
				}
4c79b5
4c79b5
				print_category_option_list( $f_category ); 
4c79b5
			?>
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		 
4c79b5
	
4c79b5
	
4c79b5
		<select <?php echo helper_get_tab_index() ?> name="reproducibility">
4c79b5
			
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		 
4c79b5
	
4c79b5
	
4c79b5
		<select <?php echo helper_get_tab_index() ?> name="severity">
4c79b5
			
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		 
4c79b5
	
4c79b5
	
4c79b5
		<select <?php echo helper_get_tab_index() ?> name="priority">
4c79b5
			
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
	$t_show_version = ( ON == config_get( 'show_product_version' ) )
4c79b5
			|| ( ( AUTO == config_get( 'show_product_version' ) )
4c79b5
						&& ( count( version_get_all_rows( $t_project_id ) ) > 0 ) );
4c79b5
	if ( $t_show_version ) {
4c79b5
?>
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		<select <?php echo helper_get_tab_index() ?> name="product_version">
4c79b5
			
4c79b5
		</select>
4c79b5
	
4c79b5
4c79b5
4c79b5
	}
4c79b5
?>
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		* 
4c79b5
	
4c79b5
	
4c79b5
		<input <?php echo helper_get_tab_index() ?> type="text" name="summary" size="80" maxlength="128" value="" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		* 
4c79b5
	
4c79b5
	
4c79b5
		<textarea <?php echo helper_get_tab_index() ?> name="description" cols="80" rows="10"></textarea>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		 
4c79b5
	
4c79b5
	
4c79b5
		<textarea <?php echo helper_get_tab_index() ?> name="additional_info" cols="80" rows="10"></textarea>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	$t_custom_fields_found = false;
4c79b5
	$t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
4c79b5
	foreach( $t_related_custom_field_ids as $t_id ) {
4c79b5
		$t_def = custom_field_get_definition( $t_id );
4c79b5
		if( ( ( $t_def['display_report'] && !$t_def['advanced'] ) || $t_def['require_report']) && custom_field_has_write_access_to_project( $t_id, $t_project_id ) ) {
4c79b5
			$t_custom_fields_found = true;
4c79b5
?>
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
			*
4c79b5
		
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
4c79b5
4c79b5
		} # if (!$t_def['advanced']) && has write access
4c79b5
	} # foreach( $t_related_custom_field_ids as $t_id )
4c79b5
?>
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	$t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
4c79b5
?>
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
		(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)'?>
4c79b5
	
4c79b5
	
4c79b5
		<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
4c79b5
		<input <?php echo helper_get_tab_index() ?> name="file" type="file" size="60" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
4c79b5
	if ( access_has_project_level( config_get( 'set_view_status_threshold' ) ) ) {
4c79b5
?>
4c79b5
		<label title="<?php echo lang_get( 'public' );?>"><input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value=""  /> </label>
4c79b5
		<label title="<?php echo lang_get( 'private' ); ?>"><input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value=""  /> </label>
4c79b5
4c79b5
	} else {
4c79b5
		echo get_enum_element( 'project_view_state', $f_view_state );
4c79b5
	}
4c79b5
?>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	if( $f_master_bug_id > 0 ) {
4c79b5
?>
4c79b5
>
4c79b5
	
4c79b5
		
4c79b5
	
4c79b5
	
4c79b5
		
4c79b5
		' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '' ?>
4c79b5
	
4c79b5
4c79b5
4c79b5
	}
4c79b5
?>
4c79b5
4c79b5
4c79b5
>
4c79b5
	
4c79b5
		 
4c79b5
	
4c79b5
	
4c79b5
		<label title="<?php echo lang_get( 'check_report_more_bugs' ); ?>"><input <?php echo helper_get_tab_index() ?> type="checkbox" name="report_stay"  /> ()</label>
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
	
4c79b5
		 * 
4c79b5
	
4c79b5
	
4c79b5
		<input <?php echo helper_get_tab_index() ?> type="submit" class="button" value="" />
4c79b5
	
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
</form>
4c79b5
4c79b5
4c79b5
4c79b5
4c79b5
<script type="text/javascript" language="JavaScript">
4c79b5
4c79b5
	window.document.report_bug_form.category.focus();
4c79b5
-->
4c79b5
</script>
4c79b5
4c79b5
4c79b5