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
5 changes: 2 additions & 3 deletions includes/classes/class-ajax-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,7 @@ public function atbdp_post_attachment_upload() {
$upload_token = isset( $_POST['upload_token'] ) ? sanitize_text_field( wp_unslash( $_POST['upload_token'] ) ) : '';
$token_data = $upload_token ? get_transient( 'directorist_file_upload_' . $upload_token ) : false;

if (
empty( $token_data )
if ( empty( $token_data )
|| ! is_array( $token_data )
|| (int) ( $token_data['directory'] ?? 0 ) !== $directory
|| (string) ( $token_data['field_key'] ?? '' ) !== $field_id
Expand Down Expand Up @@ -985,7 +984,7 @@ public function atbdp_post_attachment_upload() {
}

$field_id = sanitize_text_field( $field_config['field_key'] );
$fixed_file = ( ! empty( $_FILES[ $field_id . 'async-upload' ] ) ) ? directorist_clean( wp_unslash( $_FILES[ $field_id . 'async-upload' ] ) ) : '';
$fixed_file = ( ! empty( $_FILES[ $field_id . 'async-upload' ] ) ) ? directorist_clean( $_FILES[ $field_id . 'async-upload' ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- Unslashing corrupts Windows upload paths in raw $_FILES data.

if ( empty( $fixed_file ) ) {
throw new \Exception( __( 'No file supplied.', 'directorist' ), 400 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function save_imported_post_type_data() {

$term_id = ( ! empty( $_POST[ 'term_id' ] ) ) ? absint( $_POST[ 'term_id' ] ) : 0;
$directory_name = ( ! empty( $_POST[ 'directory-name' ] ) ) ? sanitize_text_field( wp_unslash( $_POST[ 'directory-name' ] ) ) : '';
$json_file = ( ! empty( $_FILES[ 'directory-import-file' ] ) ) ? directorist_clean( wp_unslash( $_FILES[ 'directory-import-file' ] ) ) : '';
$json_file = ( ! empty( $_FILES[ 'directory-import-file' ] ) ) ? directorist_clean( $_FILES[ 'directory-import-file' ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- Unslashing corrupts Windows upload paths in raw $_FILES data.

// Validation
$response = [
Expand Down
Loading