SOAP API: do not try to unserialize an invalid filter
[mantis.git] / bug_revision_view_page.php
blobb6193ba2484c9c31f62577074a5e3c224c11766b
1 <?php
2 # Mantis - a php based bugtracking system
4 # Mantis 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 # Mantis 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 Mantis. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses core.php
24 * @uses access_api.php
25 * @uses bug_api.php
26 * @uses bugnote_api.php
27 * @uses bug_revision_api.php
28 * @uses config_api.php
29 * @uses constant_inc.php
30 * @uses form_api.php
31 * @uses gpc_api.php
32 * @uses helper_api.php
33 * @uses html_api.php
34 * @uses lang_api.php
35 * @uses print_api.php
36 * @uses string_api.php
37 * @uses user_api.php
40 /**
41 * MantisBT Core API's
43 require_once( 'core.php' );
44 require_api( 'access_api.php' );
45 require_api( 'bug_api.php' );
46 require_api( 'bugnote_api.php' );
47 require_api( 'bug_revision_api.php' );
48 require_api( 'config_api.php' );
49 require_api( 'constant_inc.php' );
50 require_api( 'form_api.php' );
51 require_api( 'gpc_api.php' );
52 require_api( 'helper_api.php' );
53 require_api( 'html_api.php' );
54 require_api( 'lang_api.php' );
55 require_api( 'print_api.php' );
56 require_api( 'string_api.php' );
57 require_api( 'user_api.php' );
59 $f_bug_id = gpc_get_int( 'bug_id', 0 );
60 $f_bugnote_id = gpc_get_int( 'bugnote_id', 0 );
61 $f_rev_id = gpc_get_int( 'rev_id', 0 );
63 $t_title = '';
65 if ( $f_bug_id ) {
66 $t_bug_id = $f_bug_id;
67 $t_bug_data = bug_get( $t_bug_id, true );
68 $t_bug_revisions = array_reverse( bug_revision_list( $t_bug_id ), true );
70 $t_title = lang_get( 'issue_id' ) . $t_bug_id;
72 } else if ( $f_bugnote_id ) {
73 $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' );
74 $t_bug_data = bug_get( $t_bug_id, true );
76 $t_bug_revisions = array_reverse( bug_revision_list( $t_bug_id, REV_ANY, $f_bugnote_id ), true );
78 $t_title = lang_get( 'bugnote' ) . ' ' . $f_bugnote_id;
80 } else if ( $f_rev_id ) {
81 $t_bug_revisions = array_reverse( bug_revision_like( $f_rev_id ), true );
83 if ( count( $t_bug_revisions ) < 1 ) {
84 trigger_error( ERROR_GENERIC, ERROR );
87 $t_bug_id = $t_bug_revisions[$f_rev_id]['bug_id'];
88 $t_bug_data = bug_get( $t_bug_id, true );
90 $t_title = lang_get( 'issue_id' ) . $t_bug_id;
92 } else {
93 trigger_error( ERROR_GENERIC, ERROR );
96 function show_revision( $t_revision ) {
97 static $s_can_drop = null;
98 static $s_drop_token = null;
99 static $s_user_access = null;
101 if ( is_null( $s_can_drop ) ) {
102 $s_can_drop = access_has_bug_level( config_get( 'bug_revision_drop_threshold' ), $t_revision['bug_id'] );
103 $s_drop_token = form_security_param( 'bug_revision_drop' );
106 switch( $t_revision['type'] ) {
107 case REV_DESCRIPTION:
108 $t_label = lang_get( 'description' );
109 break;
110 case REV_STEPS_TO_REPRODUCE:
111 $t_label = lang_get( 'steps_to_reproduce' );
112 break;
113 case REV_ADDITIONAL_INFO:
114 $t_label = lang_get( 'additional_information' );
115 break;
117 case REV_BUGNOTE:
118 if ( is_null( $s_user_access ) ) {
119 $s_user_access = access_has_bug_level( config_get( 'private_bugnote_threshold' ), $t_revision['bug_id'] );
122 if ( !$s_user_access ) {
123 return null;
126 $t_label = lang_get( 'bugnote' );
127 break;
129 default:
130 $t_label = '';
133 $t_by_string = sprintf( lang_get( 'revision_by' ), string_display_line( date( config_get( 'normal_date_format' ), $t_revision['timestamp'] ) ), string_display_line( user_get_name( $t_revision['user_id'] ) ) );
136 <tr class="spacer"><td><a id="revision-<?php echo $t_revision['id'] ?>"></a></td></tr>
138 <tr <?php echo helper_alternate_class() ?>>
139 <th class="category"><?php echo lang_get( 'revision' ) ?></th>
140 <td colspan="2"><?php echo $t_by_string ?></td>
141 <td class="center" width="5%">
142 <?php if ( $s_can_drop ) {
143 print_bracket_link( 'bug_revision_drop.php?id=' . $t_revision['id'] . $s_drop_token, lang_get( 'revision_drop' ) );
144 } ?>
145 </tr>
147 <tr <?php echo helper_alternate_class() ?>>
148 <th class="category"><?php echo $t_label ?></th>
149 <td colspan="3"><?php echo string_display_links( $t_revision['value'] ) ?></td>
150 </tr>
152 <?php
155 html_page_top( bug_format_summary( $t_bug_id, SUMMARY_CAPTION ) );
157 print_recently_visited();
161 <br/>
162 <table class="width100" cellspacing="1">
164 <tr>
165 <td class="form-title" colspan="2"><?php echo lang_get( 'view_revisions' ), ': ', $t_title ?></td>
166 <td class="right" colspan="2">
167 <?php
168 if ( !$f_bug_id && !$f_bugnote_id ) { print_bracket_link( '?bug_id=' . $t_bug_id, lang_get( 'all_revisions' ) ); }
169 print_bracket_link( 'view.php?id=' . $t_bug_id, lang_get( 'back_to_issue' ) );
171 </td>
172 </tr>
174 <tr <?php echo helper_alternate_class() ?>>
175 <th class="category" width="15%"><?php echo lang_get( 'summary' ) ?></th>
176 <td colspan="3"><?php echo bug_format_summary( $t_bug_id, SUMMARY_FIELD ) ?></td>
177 </tr>
179 <?php foreach( $t_bug_revisions as $t_rev ) {
180 show_revision( $t_rev );
181 } ?>
183 </table>
185 <?php
186 html_page_bottom();