Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a1ea1766c5d3
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0acb11b5b0dd
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 27, 2013

  1. Config report: retrieval of saved project filter does not work

    When retrieving a saved filter from the cookie in adm_config_report.php
    the saved project id is not reflected in the filter's selection list:
    'All Projects' is always selected instead of the actual project. This
    value should only be picked as default when the project id does not
    exist.
    
    This is due to a missing negation in the check for project's existence.
    
    Fixes  #15691
    dregad committed Mar 27, 2013
    Copy the full SHA
    840b55f View commit details
  2. Copy the full SHA
    0acb11b View commit details
Showing with 53 additions and 48 deletions.
  1. +53 −48 adm_config_report.php
101 changes: 53 additions & 48 deletions adm_config_report.php
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@

access_ensure_project_level( config_get( 'view_configuration_threshold' ) );

$t_read_write_access = access_has_global_level( config_get('set_configuration_threshold' ) );

html_page_top( lang_get( 'configuration_report' ) );

print_manage_menu( 'adm_config_report.php' );
@@ -63,11 +65,11 @@ function print_config_value_as_string( $p_type, $p_value, $p_for_display = true
echo (integer)$p_value;
return;
case CONFIG_TYPE_STRING:
$t_value = config_eval( $p_value );
$t_value = string_nl2br( string_html_specialchars( config_eval( $p_value ) ) );
if( $p_for_display ) {
$t_value = "'$t_value'";
}
echo string_nl2br( string_html_specialchars( $t_value ) );
echo $t_value;
return;
case CONFIG_TYPE_COMPLEX:
$t_value = @unserialize( $p_value );
@@ -97,10 +99,11 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
foreach( $p_array as $t_key => $t_value ) {
echo "<option value='$t_key'";
check_selected( $p_filter_value, $t_key );
echo ">" . string_attribute( $t_value ) . "</option>\n";
echo '>' . string_attribute( $t_value ) . "</option>\n";
}
}


# Get filter values
$t_filter_save = gpc_get_bool( 'save' );
$t_filter_default = gpc_get_bool( 'default_filter_button', false );
@@ -142,7 +145,7 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
$t_filter_project_value = $t_cookie_contents[1];
$t_filter_config_value = $t_cookie_contents[2];

if( $t_filter_project_value != META_FILTER_NONE && project_exists( $t_filter_project_value ) ) {
if( $t_filter_project_value != META_FILTER_NONE && !project_exists( $t_filter_project_value ) ) {
$t_filter_project_value = ALL_PROJECTS;
}
}
@@ -234,9 +237,10 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
?>

<br />
<div align="center">

<!-- FILTER FORM -->
<div align="center">

<form id="filter_form" method="post">
<?php # CSRF protection not required here - form does not result in modifications ?>
<input type="hidden" name="save" value="1" />
@@ -324,10 +328,13 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
<td class="center">
<?php echo lang_get( 'access_level' ) ?>
</td>
<?php if( $t_read_write_access ) { ?>
<td class="center">
<?php echo lang_get( 'actions' ) ?>
</td>
<?php } ?>
</tr>

<?php
# Pre-generate a form security token to avoid performance issues when the
# db contains a large number of configurations
@@ -357,52 +364,55 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
<td class="center">
<?php echo get_enum_element( 'access_levels', $v_access_reqd ) ?>
</td>
<?php
if( $t_read_write_access ) {
?>
<td class="center">
<?php
if (
config_can_delete( $v_config_id )
&& access_has_global_level( config_get( 'set_configuration_threshold' ) )
) {
# Update button (will populate edit form at page bottom)
print_button(
'#config_set_form',
lang_get( 'edit_link' ),
array(
'user_id' => $v_user_id,
'project_id' => $v_project_id,
'config_option' => $v_config_id,
'type' => $v_type,
'value' => $v_value,
),
OFF
);

# Delete button
print_button(
'adm_config_delete.php',
lang_get( 'delete_link' ),
array(
'user_id' => $v_user_id,
'project_id' => $v_project_id,
'config_option' => $v_config_id,
),
$t_form_security_token
);
} else {
echo '&#160;';
}
?>
<?php
if( config_can_delete( $v_config_id ) ) {
# Update button (will populate edit form at page bottom)
print_button(
'#config_set_form',
lang_get( 'edit_link' ),
array(
'user_id' => $v_user_id,
'project_id' => $v_project_id,
'config_option' => $v_config_id,
'type' => $v_type,
'value' => $v_value,
),
OFF
);

# Delete button
print_button(
'adm_config_delete.php',
lang_get( 'delete_link' ),
array(
'user_id' => $v_user_id,
'project_id' => $v_project_id,
'config_option' => $v_config_id,
),
$t_form_security_token
);
} else {
echo '&#160;';
}
?>
</td>
<?php
} # end if config_can_delete
?>
</tr>
<?php
} # end for loop
} # end while loop
?>
</table>


<?php
# Only display the edit form if user is authorized to change configuration
if ( access_has_global_level( config_get( 'set_configuration_threshold' ) ) ) {
if( $t_read_write_access ) {
?>
<br />

@@ -470,13 +480,7 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
</td>
<td>
<select name="type">
<?php
foreach( $t_config_types as $t_key => $t_type ) {
echo '<option value="' . $t_key . '" ';
check_selected( $t_key, $t_edit_type );
echo ">$t_type</option>";
}
?>
<?php print_option_list_from_array( $t_config_types, $t_edit_type ); ?>
</select>
</td>
</tr>
@@ -493,6 +497,7 @@ function print_option_list_from_array( $p_array, $p_filter_value ) {
</td>
</tr>

<!-- Submit button -->
<tr>
<td colspan="2">
<input type="submit" name="config_set" class="button" value="<?php echo lang_get( 'set_configuration_option' ) ?>" />