/
bugnote_add.php3
98 lines (89 loc) · 2.66 KB
/
bugnote_add.php3
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?
# Mantis - a php based bugtracking system
# Copyright (C) 2000 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
?>
<? include( "core_API.php" ) ?>
<? login_cookie_check() ?>
<?
db_mysql_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );
### get user information
$query = "SELECT id
FROM $g_mantis_user_table
WHERE cookie_string='$g_string_cookie_val'";
$result = mysql_query($query);
if ( $result ) {
$u_id = mysql_result( $result, "id" );
}
$f_bugnote_text = string_safe( $f_bugnote_text );
### insert bugnote text
$query = "INSERT
INTO $g_mantis_bugnote_text_table
( id, note )
VALUES
( null, '$f_bugnote_text' )";
$result = mysql_query( $query );
### retrieve bugnote text id number
### NOTE: this is not guarranteed to be the correct one.
### The value LAST_INSERT_ID is stored on a per connection basis.
$query = "select LAST_INSERT_ID()";
$result = mysql_query( $query );
if ( $result ) {
$t_bugnote_text_id = mysql_result( $result, 0 );
}
### 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_bug_id', '$u_id','$t_bugnote_text_id',NOW(), NOW() )";
$result = mysql_query( $query );
### set last updated
$query = "UPDATE $g_mantis_bug_table
SET last_updated=NOW()
WHERE id='$f_bug_id'";
$result = mysql_query($query);
?>
<? print_html_top() ?>
<? print_head_top() ?>
<? print_title( $g_window_title ) ?>
<? print_css( $g_css_include_file ) ?>
<?
if ( $result ) {
if ( get_current_user_profile_field( "advanced_view" )=="on" ) {
print_meta_redirect( "$g_view_bug_advanced_page?f_id=$f_bug_id", $g_wait_time );
}
else {
print_meta_redirect( "$g_view_bug_page?f_id=$f_bug_id", $g_wait_time );
}
}
?>
<? include( $g_meta_include_file ) ?>
<? print_head_bottom() ?>
<? print_body_top() ?>
<? print_header( $g_page_title ) ?>
<p>
<? print_menu( $g_menu_include_file ) ?>
<p>
<div align=center>
<?
if ( $result ) {
PRINT "Bugnote added...<p>";
}
### OK!!!
else {
PRINT "ERROR DETECTED: Report this sql statement to <a href=\"<? echo $g_administrator_email ?>\">administrator</a><p>";
PRINT $query;
}
?>
<p>
<? if ( get_current_user_profile_field( "advanced_view" )=="on" ) { ?>
<a href="<? echo $g_view_bug_advanced_page ?>?f_id=<? echo $f_id ?>">Click here to proceed</a>
<? } else { ?>
<a href="<? echo $g_view_bug_page ?>?f_id=<? echo $f_id ?>">Click here to proceed</a>
<? } ?>
</div>
<? print_footer() ?>
<? print_body_bottom() ?>
<? print_html_bottom() ?>