Skip to content

Commit 3b8f71d

Browse files
authored
Merge pull request #237 from rtCamp/fix/GH-236-value-sent-from-button-save-all-changes
Fixed issue for 'Save All Changes' value sent for button on form submit
2 parents ae3d26b + 402be41 commit 3b8f71d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

admin/partials/nginx-helper-general-options.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@
3838
'purge_page_on_mod' => FILTER_SANITIZE_STRING,
3939
'purge_page_on_new_comment' => FILTER_SANITIZE_STRING,
4040
'purge_page_on_deleted_comment' => FILTER_SANITIZE_STRING,
41+
'smart_http_expire_form_nonce' => FILTER_SANITIZE_STRING,
4142
);
4243

4344
$all_inputs = filter_input_array( INPUT_POST, $args );
4445

45-
if ( isset( $all_inputs['smart_http_expire_save'] ) && 'Save All Changes' === $all_inputs['smart_http_expire_save'] ) {
46-
46+
if ( isset( $all_inputs['smart_http_expire_save'] ) && wp_verify_nonce( $all_inputs['smart_http_expire_form_nonce'], 'smart-http-expire-form-nonce' ) ) {
4747
unset( $all_inputs['smart_http_expire_save'] );
4848
unset( $all_inputs['is_submit'] );
4949

@@ -720,6 +720,7 @@
720720
</table>
721721
</div> <!-- End of .inside -->
722722
</div>
723+
<input type="hidden" name="smart_http_expire_form_nonce" value="<?php echo wp_create_nonce('smart-http-expire-form-nonce'); ?>"/>
723724
<?php
724725
submit_button( __( 'Save All Changes', 'nginx-helper' ), 'primary large', 'smart_http_expire_save', true );
725726
?>

0 commit comments

Comments
 (0)