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 - 2011 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 if ( !defined( 'PRINT_BUGNOTE_INC_ALLOW' ) ) {
44 require_api( 'access_api.php' );
45 require_api( 'authentication_api.php' );
46 require_api( 'bugnote_api.php' );
47 require_api( 'config_api.php' );
48 require_api( 'constant_inc.php' );
49 require_api( 'current_user_api.php' );
50 require_api( 'database_api.php' );
51 require_api( 'gpc_api.php' );
52 require_api( 'lang_api.php' );
53 require_api( 'print_api.php' );
54 require_api( 'string_api.php' );
55 require_api( 'user_api.php' );
57 $f_bug_id = gpc_get_int( 'bug_id' );
59 # grab the user id currently logged in
60 $t_user_id = auth_get_current_user_id();
61 $c_bug_id = (integer)$f_bug_id;
63 if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) {
64 $t_restriction = 'AND view_state=' . VS_PUBLIC
;
69 $t_bugnote_table = db_get_table( 'bugnote' );
70 $t_bugnote_text_table = db_get_table( 'bugnote_text' );
71 # get the bugnote data
72 $t_bugnote_order = current_user_get_pref( 'bugnote_order' );
76 WHERE bug_id=" . db_param() . " $t_restriction
77 ORDER BY date_submitted $t_bugnote_order";
78 $result = db_query_bound($query, Array( $c_bug_id ) );
79 $num_notes = db_num_rows($result);
83 <table
class="width100" cellspacing
="1">
86 if ( 0 == $num_notes ) {
89 <td
class="print" colspan
="2">
90 <?php
echo lang_get( 'no_bugnotes_msg' ) ?
>
93 <?php
} else { # print bugnotes ?>
95 <td
class="form-title" colspan
="2">
96 <?php
echo lang_get( 'bug_notes_title' ) ?
>
100 for ( $i=0; $i < $num_notes; $i++
) {
101 # prefix all bugnote data with v3_
102 $row = db_fetch_array( $result );
103 extract( $row, EXTR_PREFIX_ALL
, 'v3' );
104 $v3_date_submitted = date( config_get( 'normal_date_format' ), $v3_date_submitted );
105 $v3_last_modified = date( config_get( 'normal_date_format' ), $v3_last_modified );
107 # grab the bugnote text and id and prefix with v3_
108 $query = "SELECT note, id
109 FROM $t_bugnote_text_table
110 WHERE id=" . db_param();
111 $result2 = db_query_bound( $query, Array( $v3_bugnote_text_id ) );
112 $v3_note = db_result( $result2, 0, 0 );
113 $v3_bugnote_text_id = db_result( $result2, 0, 1 );
115 $v3_note = string_display_links( $v3_note );
118 <td
class="print-spacer" colspan
="2">
123 <td
class="nopad" width
="20%">
124 <table
class="hide" cellspacing
="1">
127 (<?php
echo bugnote_format_id( $v3_id ) ?
>)
133 echo print_user( $v3_reporter_id );
139 <?php
echo $v3_date_submitted ?
>   
140 <?php
if ( $v3_date_submitted != $v3_last_modified ) {
141 echo '<br />(' . lang_get( 'last_edited') . lang_get( 'word_separator' ) . $v3_last_modified . ')';
147 <td
class="nopad" width
="85%">
148 <table
class="hide" cellspacing
="1">
152 switch ( $v3_note_type ) {
154 echo '<div class="italic">' . lang_get( 'reminder_sent_to' ) . ' ';
155 $v3_note_attr = utf8_substr( $v3_note_attr, 1, utf8_strlen( $v3_note_attr ) - 2 );
157 foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
158 $t_to[] = string_display_line( user_get_name( $t_recipient ) );
160 echo implode( ', ', $t_to ) . '</div><br />';