Skip to content

Commit

Permalink
Fix invalid HTML in manage_config_workflow_page
Browse files Browse the repository at this point in the history
The generated markup has a form to revert the configuration changes
defined within the main form. This is invalid HTML.

To fix this without complicating the layout, we use a deported <button>
within the main form, using the HTML5 `form` attribute pointing to the
the revert form's id, which is defined outside.

Fixes #25784
  • Loading branch information
dregad committed May 23, 2019
1 parent 54e553d commit 3667d0c
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions manage_config_workflow_page.php
Expand Up @@ -553,33 +553,36 @@ function access_end() {
access_begin( lang_get( 'access_levels' ) );
access_row();
access_end();
echo '</div>';

if( $g_can_change_flags ) {
echo '<div class="col-md-12">';
echo '<input type="submit" class="btn btn-primary btn-white btn-round" value="' . lang_get( 'change_configuration' ) . '" />' . "\n";
echo '</form>' . "\n";

# Deported submit button for separate form defined below
# included here to simplify page layout
if( 0 < count( $g_overrides ) ) {
echo '<div class="pull-right">';
echo '<form id="mail_config_action" method="post" action="manage_config_revert.php">' ."\n";
echo '<fieldset>' . "\n";
echo form_security_field( 'manage_config_revert' );
echo '<input name="revert" type="hidden" value="' . implode( ',', $g_overrides ) . '" />';
echo '<input name="project" type="hidden" value="' . $t_project . '" />';
echo '<input name="return" type="hidden" value="' . string_attribute( form_action_self() ) .'" />';
echo '<input type="submit" class="btn btn-primary btn-sm btn-white btn-round" value="';
if( ALL_PROJECTS == $t_project ) {
echo lang_get( 'revert_to_system' );
} else {
echo lang_get( 'revert_to_all_project' );
}
echo '" />' . "\n";
echo '</fieldset>' . "\n";
echo '</form></div>' . "\n";
echo '<button form="mail_config_action" class="btn btn-primary btn-white btn-round">'
. lang_get( ALL_PROJECTS == $t_project ? 'revert_to_system' : 'revert_to_all_project' )
. "</button>\n";
}
echo '</div>';
}
echo '</form>' . "\n";

# Secondary form to revert config - submit button is defined above
if( $g_can_change_flags && 0 < count( $g_overrides ) ) {
?>
<form id="mail_config_action" method="post" action="manage_config_revert.php">
<fieldset>
<?php echo form_security_field( 'manage_config_revert' ); ?>
<input name="revert" type="hidden" value="<?php echo implode( ',', $g_overrides ) ?>" />
<input name="project" type="hidden" value="<?php echo $t_project ?>" />
<input name="return" type="hidden" value="<?php echo string_attribute( form_action_self() ) ?>" />
</fieldset>
</form>


} else {
echo '</form>' . "\n";
<?php
}
echo '</div>';

layout_page_end();

0 comments on commit 3667d0c

Please sign in to comment.