/
bug_close.php
67 lines (58 loc) · 1.81 KB
/
bug_close.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
?>
<?php
# This file sets the bug to the chosen resolved state then gives the
# user the opportunity to enter a reason for the closure
?>
<?php include( "core_API.php" ) ?>
<?php login_cookie_check() ?>
<?php
db_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );
project_access_check( $f_id );
check_access( UPDATER );
check_bug_exists( $f_id );
$f_id = (integer)$f_id;
$t_handler_id = get_current_user_field( "id " );
# Update fields
$t_clo_val = CLOSED;
$query = "UPDATE $g_mantis_bug_table
SET status='$t_clo_val'
WHERE id='$f_id'";
$result = db_query($query);
# get user information
$u_id = get_current_user_field( "id " );
$f_bugnote_text = trim( $f_bugnote_text );
# check for blank bugnote
if ( !empty( $f_bugnote_text ) ) {
$f_bugnote_text = string_prepare_textarea( $f_bugnote_text );
# insert bugnote text
$query = "INSERT
INTO $g_mantis_bugnote_text_table
( id, note )
VALUES
( null, '$f_bugnote_text' )";
$result = db_query( $query );
# retrieve bugnote text id number
$t_bugnote_text_id = db_insert_id();
# insert bugnote info
$query = "INSERT
INTO $g_mantis_bugnote_table
( id, bug_id, reporter_id, bugnote_text_id, date_submitted, last_modified )
VALUES
( null, '$f_id', '$u_id','$t_bugnote_text_id', NOW(), NOW() )";
$result = db_query( $query );
}
# updated the last_updated date
$result = bug_date_update( $f_id );
email_close( $f_id );
$t_redirect_url = $g_view_all_bug_page;
if ( $result ) {
print_header_redirect( $t_redirect_url );
} else {
print_mantis_error( ERROR_GENERIC );
}
?>