Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / print_bugnote_inc.php
blobacc75f32f677878de35b921d920e557147f2d6e5
1 <?php
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/>.
17 /**
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
21 * @package MantisBT
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
33 * @uses gpc_api.php
34 * @uses lang_api.php
35 * @uses print_api.php
36 * @uses string_api.php
37 * @uses user_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;
61 } else {
62 $t_restriction = '';
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' );
70 $query = "SELECT *
71 FROM $t_bugnote_table
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);
78 <br />
79 <table class="width100" cellspacing="1">
80 <?php
81 # no bugnotes
82 if ( 0 == $num_notes ) {
84 <tr>
85 <td class="print" colspan="2">
86 <?php echo lang_get( 'no_bugnotes_msg' ) ?>
87 </td>
88 </tr>
89 <?php } else { # print bugnotes ?>
90 <tr>
91 <td class="form-title" colspan="2">
92 <?php echo lang_get( 'bug_notes_title' ) ?>
93 </td>
94 </tr>
95 <?php
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 );
113 <tr>
114 <td class="print-spacer" colspan="2">
115 <hr size="1" />
116 </td>
117 </tr>
118 <tr>
119 <td class="nopad" valign="top" width="20%">
120 <table class="hide" cellspacing="1">
121 <tr>
122 <td class="print">
123 (<?php echo bugnote_format_id( $v3_id ) ?>)
124 </td>
125 </tr>
126 <tr>
127 <td class="print">
128 <?php
129 echo print_user( $v3_reporter_id );
130 ?>&nbsp;&nbsp;&nbsp;
131 </td>
132 </tr>
133 <tr>
134 <td class="print">
135 <?php echo $v3_date_submitted ?>&nbsp;&nbsp;&nbsp;
136 <?php if ( $v3_date_submitted != $v3_last_modified ) {
137 echo '<br />(' . lang_get( 'last_edited') . lang_get( 'word_separator' ) . $v3_last_modified . ')';
138 } ?>
139 </td>
140 </tr>
141 </table>
142 </td>
143 <td class="nopad" valign="top" width="85%">
144 <table class="hide" cellspacing="1">
145 <tr>
146 <td class="print">
147 <?php
148 switch ( $v3_note_type ) {
149 case REMINDER:
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 );
152 $t_to = array();
153 foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
154 $t_to[] = user_get_name( $t_recipient );
156 echo implode( ', ', $t_to ) . '</div><br />';
157 default:
158 echo $v3_note;
161 </td>
162 </tr>
163 </table>
164 </td>
165 </tr>
166 <?php
167 } # end for loop
168 } # end else
170 </table>