Plugin Directory

Changeset 3364351


Ignore:
Timestamp:
09/19/2025 06:52:00 AM (6 months ago)
Author:
wpyog
Message:

type casting of document id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wpyog-documents/tags/1.3.5/index.php

    r3364123 r3364351  
    469469    if (isset($_REQUEST['document']) && !empty($_REQUEST['document'])) {
    470470        $downloadUrl = sanitize_text_field($_REQUEST['document']);
    471         $post_id = base64_decode( urldecode( $downloadUrl));
     471        $post_id = intval(base64_decode( urldecode( $downloadUrl)));
     472
     473        if(empty($post_id)){
     474            wp_die('invalid document id');
     475        }
     476
    472477        $document_link = get_post_meta( $post_id, 'document_link', true );
    473478
    474479        if (empty($document_link)){
    475             wp_die('file not found', 404);
     480            wp_die('file not found');
    476481        }
    477482
     
    499504            header('Content-Length: ' . filesize($physical_path));
    500505            flush(); // Flush system output buffer
    501             readfile($physical_path);           
     506            readfile($physical_path);
     507            die();         
     508        } else{
     509            wp_die('file not found');
    502510        }
    503         die();
    504     }
     511       
     512    } 
    505513}
    506514
Note: See TracChangeset for help on using the changeset viewer.