Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/15/2018 03:52:40 PM (8 years ago)
Author:
espellcaste
Message:

Make use of bp_is_post_request() instead of hardcoding POST verifications directly.

BuddyPress is not making use of the bp_is_post_request() in several ajax scenarios to confirm if the post request is indeed a POST request. Instead, it is hardcoding the check directly. This change updates those places making use of this function.

Props DjPaul

Fixes #7684

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/activity/ajax.php

    r11856 r11858  
    8686 */
    8787function bp_nouveau_ajax_mark_activity_favorite() {
    88     // Bail if not a POST action.
    89     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     88    if ( ! bp_is_post_request() ) {
    9089        wp_send_json_error();
    9190    }
     
    127126 */
    128127function bp_nouveau_ajax_unmark_activity_favorite() {
    129     // Bail if not a POST action.
    130     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     128    if ( ! bp_is_post_request() ) {
    131129        wp_send_json_error();
    132130    }
     
    164162 */
    165163function bp_nouveau_ajax_clear_new_mentions() {
    166     // Bail if not a POST action.
    167     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     164    if ( ! bp_is_post_request() ) {
    168165        wp_send_json_error();
    169166    }
     
    194191
    195192    // Bail if not a POST action.
    196     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     193    if ( ! bp_is_post_request() ) {
    197194        wp_send_json_error( $response );
    198195    }
     
    266263
    267264    // Bail if not a POST action.
    268     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     265    if ( ! bp_is_post_request() ) {
    269266        wp_send_json_error( $response );
    270267    }
     
    327324
    328325    // Bail if not a POST action.
    329     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     326    if ( ! bp_is_post_request() ) {
    330327        wp_send_json_error( $response );
    331328    }
     
    564561
    565562    // Bail if not a POST action.
    566     if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
     563    if ( ! bp_is_post_request() ) {
    567564        wp_send_json_error( $response );
    568565    }
Note: See TracChangeset for help on using the changeset viewer.