SOAP API: do not try to unserialize an invalid filter
[mantis.git] / print_bugnote_inc.php
blob912cf674575dfa132200053d00be5beab8940df2
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 - 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
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 if ( !defined( 'PRINT_BUGNOTE_INC_ALLOW' ) ) {
41 return;
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;
65 } else {
66 $t_restriction = '';
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' );
74 $query = "SELECT *
75 FROM $t_bugnote_table
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);
82 <br />
83 <table class="width100" cellspacing="1">
84 <?php
85 # no bugnotes
86 if ( 0 == $num_notes ) {
88 <tr>
89 <td class="print" colspan="2">
90 <?php echo lang_get( 'no_bugnotes_msg' ) ?>
91 </td>
92 </tr>
93 <?php } else { # print bugnotes ?>
94 <tr>
95 <td class="form-title" colspan="2">
96 <?php echo lang_get( 'bug_notes_title' ) ?>
97 </td>
98 </tr>
99 <?php
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 );
117 <tr>
118 <td class="print-spacer" colspan="2">
119 <hr />
120 </td>
121 </tr>
122 <tr>
123 <td class="nopad" width="20%">
124 <table class="hide" cellspacing="1">
125 <tr>
126 <td class="print">
127 (<?php echo bugnote_format_id( $v3_id ) ?>)
128 </td>
129 </tr>
130 <tr>
131 <td class="print">
132 <?php
133 echo print_user( $v3_reporter_id );
134 ?>&#160;&#160;&#160;
135 </td>
136 </tr>
137 <tr>
138 <td class="print">
139 <?php echo $v3_date_submitted ?>&#160;&#160;&#160;
140 <?php if ( $v3_date_submitted != $v3_last_modified ) {
141 echo '<br />(' . lang_get( 'last_edited') . lang_get( 'word_separator' ) . $v3_last_modified . ')';
142 } ?>
143 </td>
144 </tr>
145 </table>
146 </td>
147 <td class="nopad" width="85%">
148 <table class="hide" cellspacing="1">
149 <tr>
150 <td class="print">
151 <?php
152 switch ( $v3_note_type ) {
153 case REMINDER:
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 );
156 $t_to = array();
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 />';
161 default:
162 echo $v3_note;
165 </td>
166 </tr>
167 </table>
168 </td>
169 </tr>
170 <?php
171 } # end for loop
172 } # end else
174 </table>