Skip to content

Commit

Permalink
fix(1.3.23): Fix admin import/export page
Browse files Browse the repository at this point in the history
  • Loading branch information
daanrijpkemacb committed Oct 29, 2024
1 parent 92d6a8b commit 9f73622
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 11 additions & 1 deletion bluem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2036,12 +2036,20 @@ function bluem_admin_import_execute($data): array
* Render the admin Import / Export page
* @return void
*/
function bluem_admin_importexport(): void
function bluem_admin_importexport()
{
$import_data = null;
$messages = [];


var_dump($_POST);
if (isset($_POST['action']) && $_POST['action'] === "import") {
//
// if (!isset($_POST['bluem_importexport_nonce']) || !wp_verify_nonce($_POST['bluem_importexport_nonce'])) {
// echo "<div class='notice notice-error'><p>" . esc_html__("Kon niet importeren: nonce niet geldig", 'bluem') . "</p></div>";
// die();
// }

$decoded = true;

if (isset($_POST['import']) && $_POST['import'] !== "") {
Expand Down Expand Up @@ -2081,6 +2089,8 @@ function bluem_admin_importexport(): void
$options_json = wp_json_encode($options);
}

$form_nonce = wp_create_nonce( 'bluem_importexport_nonce' );

// @todo: improve this by creating a renderer function and passing the renderdata
// @todo: then generalise this to other parts of the plugin
include_once 'views/importexport.php';
Expand Down
6 changes: 5 additions & 1 deletion views/importexport.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@
<?php esc_html_e('Upload je instellingen hier.', 'bluem'); ?>

<form method="post"
action="<?php echo esc_url(admin_url('admin.php?page=bluem_admin_importexport&action=import')); ?>">
action="<?php echo esc_url(admin_url('admin.php?page=bluem-importexport')); ?>">

<input type="hidden" name="action" value="import">

<input type="hidden" name="bluem_importexport_nonce" value="<?php echo $form_nonce;?>">

<label for="import">
Input:
</label>
Expand Down

0 comments on commit 9f73622

Please sign in to comment.