2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
18 * This include file prints out the list of bugnotes attached to the bug
19 * $f_bug_id must be set and be set to the bug id
22 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
23 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
24 * @link http://www.mantisbt.org
26 * @uses access_api.php
27 * @uses authentication_api.php
28 * @uses bugnote_api.php
29 * @uses config_api.php
30 * @uses constant_inc.php
31 * @uses current_user_api.php
32 * @uses database_api.php
36 * @uses string_api.php
40 require_api( 'access_api.php' );
41 require_api( 'authentication_api.php' );
42 require_api( 'bugnote_api.php' );
43 require_api( 'config_api.php' );
44 require_api( 'constant_inc.php' );
45 require_api( 'current_user_api.php' );
46 require_api( 'database_api.php' );
47 require_api( 'gpc_api.php' );
48 require_api( 'lang_api.php' );
49 require_api( 'print_api.php' );
50 require_api( 'string_api.php' );
51 require_api( 'user_api.php' );
53 $f_bug_id = gpc_get_int( 'bug_id' );
55 # grab the user id currently logged in
56 $t_user_id = auth_get_current_user_id();
57 $c_bug_id = (integer)$f_bug_id;
59 if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) {
60 $t_restriction = 'AND view_state=' . VS_PUBLIC
;
65 $t_bugnote_table = db_get_table( 'bugnote' );
66 $t_bugnote_text_table = db_get_table( 'bugnote_text' );
67 # get the bugnote data
68 $t_bugnote_order = current_user_get_pref( 'bugnote_order' );
72 WHERE bug_id=" . db_param() . " $t_restriction
73 ORDER BY date_submitted $t_bugnote_order";
74 $result = db_query_bound($query, Array( $c_bug_id ) );
75 $num_notes = db_num_rows($result);
79 <table
class="width100" cellspacing
="1">
82 if ( 0 == $num_notes ) {
85 <td
class="print" colspan
="2">
86 <?php
echo lang_get( 'no_bugnotes_msg' ) ?
>
89 <?php
} else { # print bugnotes ?>
91 <td
class="form-title" colspan
="2">
92 <?php
echo lang_get( 'bug_notes_title' ) ?
>
96 for ( $i=0; $i < $num_notes; $i++
) {
97 # prefix all bugnote data with v3_
98 $row = db_fetch_array( $result );
99 extract( $row, EXTR_PREFIX_ALL
, 'v3' );
100 $v3_date_submitted = date( config_get( 'normal_date_format' ), $v3_date_submitted );
101 $v3_last_modified = date( config_get( 'normal_date_format' ), $v3_last_modified );
103 # grab the bugnote text and id and prefix with v3_
104 $query = "SELECT note, id
105 FROM $t_bugnote_text_table
106 WHERE id=" . db_param();
107 $result2 = db_query_bound( $query, Array( $v3_bugnote_text_id ) );
108 $v3_note = db_result( $result2, 0, 0 );
109 $v3_bugnote_text_id = db_result( $result2, 0, 1 );
111 $v3_note = string_display_links( $v3_note );
114 <td
class="print-spacer" colspan
="2">
119 <td
class="nopad" valign
="top" width
="20%">
120 <table
class="hide" cellspacing
="1">
123 (<?php
echo bugnote_format_id( $v3_id ) ?
>)
129 echo print_user( $v3_reporter_id );
135 <?php
echo $v3_date_submitted ?
> 
; 
; 
;
136 <?php
if ( $v3_date_submitted != $v3_last_modified ) {
137 echo '<br />(' . lang_get( 'last_edited') . lang_get( 'word_separator' ) . $v3_last_modified . ')';
143 <td
class="nopad" valign
="top" width
="85%">
144 <table
class="hide" cellspacing
="1">
148 switch ( $v3_note_type ) {
150 echo '<div class="italic">' . lang_get( 'reminder_sent_to' ) . ' ';
151 $v3_note_attr = utf8_substr( $v3_note_attr, 1, utf8_strlen( $v3_note_attr ) - 2 );
153 foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
154 $t_to[] = user_get_name( $t_recipient );
156 echo implode( ', ', $t_to ) . '</div><br />';