Making WordPress.org

Ticket #2869: 2869.meta.diff

File 2869.meta.diff, 1.5 KB (added by davidmosterd, 8 years ago)

Initial patch using filter_input

  • wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
    index 43f3413e..3a37eb02 100644
    class WordCamp_Post_Types_Plugin { 
    18221822                        return;
    18231823                }
    18241824
    1825                 if ( isset( $_POST['wcpt-meta-sponsor-info'] ) && wp_verify_nonce( $_POST['wcpt-meta-sponsor-info'], 'edit-sponsor-info' ) ) {
     1825                if ( wp_verify_nonce( filter_input( INPUT_POST,  'wcpt-meta-sponsor-info' ), 'edit-sponsor-info' ) ) {
    18261826                        $text_values = array(
    18271827                                'company_name', 'first_name', 'last_name', 'email_address', 'phone_number', 'vat_number', 'twitter_handle',
    18281828                                'street_address1', 'street_address2', 'city', 'state', 'zip_code', 'country'
    18291829                        );
    18301830
    18311831                        foreach ( $text_values as $id ) {
    1832                                 $values[ $id ] = sanitize_text_field( $_POST["_wcpt_sponsor_$id"] );
     1832                                $values[ $id ] = sanitize_text_field( filter_input( INPUT_POST, '_wcpt_sponsor_' . $id ) );
    18331833                        }
    18341834
    1835                         $values['website'] = esc_url_raw( $_POST['_wcpt_sponsor_website'] );
     1835                        $values['website'] = esc_url_raw( filter_input( INPUT_POST, '_wcpt_sponsor_website' ) );
    18361836                        // TODO: maybe only allows links to home page, depending on outcome of http://make.wordpress.org/community/2013/12/31/irs-rules-for-corporate-sponsorship-of-wordcamp/
    18371837
    18381838                        $values['first_name'] = ucfirst( $values['first_name'] );