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/>.
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
24 * @uses access_api.php
25 * @uses authentication_api.php
26 * @uses config_api.php
27 * @uses constant_inc.php
28 * @uses database_api.php
30 * @uses helper_api.php
34 * @uses project_api.php
35 * @uses string_api.php
39 require_once( 'core.php' );
40 require_api( 'access_api.php' );
41 require_api( 'authentication_api.php' );
42 require_api( 'config_api.php' );
43 require_api( 'constant_inc.php' );
44 require_api( 'database_api.php' );
45 require_api( 'form_api.php' );
46 require_api( 'helper_api.php' );
47 require_api( 'html_api.php' );
48 require_api( 'lang_api.php' );
49 require_api( 'print_api.php' );
50 require_api( 'project_api.php' );
51 require_api( 'string_api.php' );
52 require_api( 'user_api.php' );
54 access_ensure_global_level( config_get( 'view_configuration_threshold' ) );
56 $t_read_write_access = access_has_global_level( config_get('set_configuration_threshold' ) );
58 html_page_top( lang_get( 'configuration_report' ) );
60 print_manage_menu( 'adm_config_report.php' );
61 print_manage_config_menu( 'adm_config_report.php' );
63 function get_config_type( $p_type ) {
67 case CONFIG_TYPE_FLOAT
:
69 case CONFIG_TYPE_COMPLEX
:
71 case CONFIG_TYPE_STRING
:
77 function print_config_value_as_string( $p_type, $p_value ) {
81 case CONFIG_TYPE_FLOAT
:
82 $t_value = (float)$p_value;
86 $t_value = (integer)$p_value;
89 case CONFIG_TYPE_STRING
:
90 $t_value = config_eval( $p_value );
91 echo string_nl2br( string_html_specialchars( "'$t_value'" ) );
93 case CONFIG_TYPE_COMPLEX
:
94 $t_value = @unserialize
( $p_value );
95 if ( $t_value === false ) {
100 $t_value = config_eval( $p_value );
106 if ( $t_corrupted ) {
107 echo lang_get( 'configuration_corrupted' );
109 if ( function_exists( 'var_export' ) ) {
110 var_export( $t_value );
119 $t_config_table = db_get_table( 'config' );
120 $query = "SELECT config_id, user_id, project_id, type, value, access_reqd FROM $t_config_table ORDER BY user_id, project_id, config_id";
121 $result = db_query_bound( $query );
125 <table
class="width100" cellspacing
="1">
129 <td
class="form-title" colspan
="7">
130 <?php
echo lang_get( 'database_configuration' ) ?
>
133 <tr
class="row-category">
135 <?php
echo lang_get( 'username' ) ?
>
138 <?php
echo lang_get( 'project_name' ) ?
>
141 <?php
echo lang_get( 'configuration_option' ) ?
>
144 <?php
echo lang_get( 'configuration_option_type' ) ?
>
147 <?php
echo lang_get( 'configuration_option_value' ) ?
>
150 <?php
echo lang_get( 'access_level' ) ?
>
152 <?php
if ( $t_read_write_access ): ?
>
154 <?php
echo lang_get( 'actions' ) ?
>
159 while ( $row = db_fetch_array( $result ) ) {
160 extract( $row, EXTR_PREFIX_ALL
, 'v' );
163 <!-- Repeated Info Rows
-->
164 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
166 <?php
echo ($v_user_id == 0) ?
lang_get( 'all_users' ) : string_display_line( user_get_name( $v_user_id ) ) ?
>
169 <?php
echo string_display_line( project_get_name( $v_project_id ) ) ?
>
172 <?php
echo string_display_line( $v_config_id ) ?
>
175 <?php
echo string_display_line( get_config_type( $v_type ) ) ?
>
178 <?php
print_config_value_as_string( $v_type, $v_value ) ?
>
181 <?php
echo get_enum_element( 'access_levels', $v_access_reqd ) ?
>
183 <?php
if ( $t_read_write_access ): ?
>
186 if ( config_can_delete( $v_config_id ) ) {
187 print_button( "adm_config_delete.php?user_id=$v_user_id&project_id=$v_project_id&config_option=$v_config_id", lang_get( 'delete_link' ) );
200 if ( $t_read_write_access ) {
203 <!-- Config Set Form
-->
204 <form method
="post" action
="adm_config_set.php">
205 <?php
echo form_security_field( 'adm_config_set' ) ?
>
206 <table
class="width100" cellspacing
="1">
210 <td
class="form-title" colspan
="2">
211 <?php
echo lang_get( 'set_configuration_option' ) ?
>
214 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
216 <?php
echo lang_get( 'username' ) ?
>
219 <select name
="user_id">
220 <option value
="0" selected
="selected"><?php
echo lang_get( 'all_users' ); ?
></option
>
221 <?php
print_user_option_list( auth_get_current_user_id() ) ?
>
225 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
227 <?php
echo lang_get( 'project_name' ) ?
>
230 <select name
="project_id">
231 <option value
="0" selected
="selected"><?php
echo lang_get( 'all_projects' ); ?
></option
>
232 <?php
print_project_option_list( ALL_PROJECTS
, false ) ?
>
236 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
238 <?php
echo lang_get( 'configuration_option' ) ?
>
241 <input type
="text" name
="config_option" value
="" size
="64" maxlength
="64" />
244 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
246 <?php
echo lang_get( 'configuration_option_type' ) ?
>
250 <option value
="default" selected
="selected">default</option
>
251 <option value
="string">string</option
>
252 <option value
="integer">integer</option
>
253 <option value
="complex">complex
</option
>
257 <tr
<?php
echo helper_alternate_class() ?
> valign
="top">
259 <?php
echo lang_get( 'configuration_option_value' ) ?
>
262 <textarea name
="value" cols
="80" rows
="10"></textarea
>
267 <input type
="submit" name
="config_set" class="button" value
="<?php echo lang_get( 'set_configuration_option' ) ?>" />
273 } # end user can change config