SOAP API: do not try to unserialize an invalid filter
[mantis.git] / print_all_bug_options_inc.php
blob3c67af4280053c5fe2fd64c4ee50db6fefb40b6f
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 * @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 authentication_api.php
24 * @uses database_api.php
25 * @uses form_api.php
26 * @uses helper_api.php
27 * @uses lang_api.php
28 * @uses string_api.php
29 * @uses user_api.php
30 * @uses utility_api.php
33 if ( !defined( 'PRINT_ALL_BUG_OPTIONS_INC_ALLOW' ) ) {
34 return;
37 require_api( 'authentication_api.php' );
38 require_api( 'database_api.php' );
39 require_api( 'form_api.php' );
40 require_api( 'helper_api.php' );
41 require_api( 'lang_api.php' );
42 require_api( 'string_api.php' );
43 require_api( 'user_api.php' );
44 require_api( 'utility_api.php' );
46 # this function only gets the field names, by appending strings
47 function get_field_names()
49 #currently 27 fields
50 return $t_arr = array (
51 'id',
52 'category',
53 'severity',
54 'reproducibility',
55 'date_submitted',
56 'last_update',
57 'reporter',
58 'assigned_to',
59 'priority',
60 'status',
61 'build',
62 'projection',
63 'eta',
64 'platform',
65 'os',
66 'os_version',
67 'product_version',
68 'resolution',
69 'duplicate_id',
70 'summary',
71 'description',
72 'steps_to_reproduce',
73 'additional_information',
74 'attached_files',
75 'bugnote_title',
76 'bugnote_date',
77 'bugnote_description',
78 'time_tracking' );
82 function edit_printing_prefs( $p_user_id = null, $p_error_if_protected = true, $p_redirect_url = '' )
84 if ( null === $p_user_id ) {
85 $p_user_id = auth_get_current_user_id();
88 $c_user_id = db_prepare_int( $p_user_id );
90 # protected account check
91 if ( $p_error_if_protected ) {
92 user_ensure_unprotected( $p_user_id );
95 $t_user_print_pref_table = db_get_table( 'user_print_pref' );
97 if ( is_blank( $p_redirect_url ) ) {
98 $p_redirect_url = 'print_all_bug_page.php';
101 # get the fields list
102 $t_field_name_arr = get_field_names();
103 $field_name_count = count( $t_field_name_arr );
105 # Grab the data
106 $query = "SELECT print_pref
107 FROM $t_user_print_pref_table
108 WHERE user_id=" . db_param();
109 $result = db_query_bound( $query, Array( $c_user_id ) );
111 ## OOPS, No entry in the database yet. Lets make one
112 if ( 0 == db_num_rows( $result ) ) {
114 # create a default array, same size than $t_field_name
115 for ($i=0 ; $i<$field_name_count ; $i++) {
116 $t_default_arr[$i] = 1 ;
118 $t_default = implode( '', $t_default_arr ) ;
120 # all fields are added by default
121 $query = "INSERT
122 INTO $t_user_print_pref_table
123 (user_id, print_pref)
124 VALUES
125 (" . db_param() . "," . db_param() . ")";
127 $result = db_query_bound( $query, Array( $c_user_id, $t_default ) );
129 # Rerun select query
130 $query = "SELECT print_pref
131 FROM $t_user_print_pref_table
132 WHERE user_id=" . db_param();
133 $result = db_query_bound( $query, Array( $c_user_id ) );
136 # putting the query result into an array with the same size as $t_fields_arr
137 $row = db_fetch_array( $result );
138 $t_prefs = $row['print_pref'];
140 # Account Preferences Form BEGIN
141 $t_index_count=0;
143 <br />
144 <div>
145 <form method="post" action="print_all_bug_options_update.php">
146 <?php echo form_security_field( 'print_all_bug_options_update' ) ?>
147 <input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
148 <input type="hidden" name="redirect_url" value="<?php echo string_attribute( $p_redirect_url ) ?>" />
149 <table class="width75" cellspacing="1">
150 <tr>
151 <td class="form-title">
152 <?php echo lang_get( 'printing_preferences_title' ) ?>
153 </td>
154 <td class="right">
155 </td>
156 </tr>
159 <?php # display the checkboxes
160 for ($i=0 ; $i <$field_name_count ; $i++) {
162 printf ( '<tr %s>', helper_alternate_class( $i ) );
165 <th class="category">
166 <?php echo lang_get( $t_field_name_arr[$i] ) ?>
167 </th>
168 <td>
169 <input type="checkbox" name="<?php echo 'print_' . $t_field_name_arr[$i]; ?>"
170 <?php if ( isset( $t_prefs[$i] ) && ( $t_prefs[$i]==1 ) ) echo 'checked="checked"' ?> />
171 </td>
172 </tr>
174 <?php
177 <tr>
178 <td>&#160;</td>
179 <td>
180 <input type="submit" class="button" value="<?php echo lang_get( 'update_prefs_button' ) ?>" />
181 </td>
182 </tr>
183 </table>
184 </form>
185 </div>
187 <br />
189 <div class="border center">
190 <form method="post" action="print_all_bug_options_reset.php">
191 <?php echo form_security_field( 'print_all_bug_options_reset' ) ?>
192 <input type="submit" class="button" value="<?php echo lang_get( 'reset_prefs_button' ) ?>" />
193 </form>
194 </div>
196 <?php