Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions admin/subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
echo '</h2>';
echo '<form method="post">' . "\r\n";
echo '<input type="hidden" name="s2_admin" />' . "\r\n";
echo wp_nonce_field( 's2-export-csv', 's2-export-csv' );

$exclude = array();
switch ( $current_tab ) {
Expand Down
13 changes: 13 additions & 0 deletions classes/class-s2-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,19 @@ function_exists( 'register_block_type' ) &&

// Capture CSV export.
if ( isset( $_POST['s2_admin'] ) && isset( $_POST['csv'] ) ) {
// Security check: Verify user has proper capabilities.
if ( ! current_user_can( apply_filters( 's2_capability', 'manage_options', 'manage' ) ) ) {
wp_die( 'Not permitted.' );
}

// Security check: Verify nonce.
if (
! isset( $_REQUEST['s2-export-csv'] ) ||
! wp_verify_nonce( sanitize_key( $_REQUEST['s2-export-csv'] ), 's2-export-csv' )
) {
wp_die( 'Request cannot be completed.' );
}

$date = gmdate( 'Y-m-d' );
header( 'Content-Description: File Transfer' );
header( 'Content-type: application/octet-stream' );
Expand Down