Skip to:
Content

bbPress.org

Ticket #2826: 0002-Hardening-2.patch

File 0002-Hardening-2.patch, 2.1 KB (added by glynwintle, 7 years ago)

Patch

  • includes/forums/functions.php

    ---
     includes/forums/functions.php | 3 +--
     includes/topics/functions.php | 3 +--
     2 files changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/includes/forums/functions.php b/includes/forums/functions.php
    index 050791d..b8a9976 100644
    a b function bbp_update_forum_topic_count_hidden( $forum_id = 0, $topic_count = 0 ) 
    14541454
    14551455                // Get topics of forum
    14561456                if ( empty( $topic_count ) ) {
    1457                         $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "'";
    1458                         $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $forum_id, bbp_get_topic_post_type() ) );
     1457                        $topic_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( %d, %d ) AND post_type = '%s';", $forum_id, bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_topic_post_type() ) );
    14591458                }
    14601459
    14611460                // Update the count
  • includes/topics/functions.php

    diff --git a/includes/topics/functions.php b/includes/topics/functions.php
    index 88fb802..d85cc67 100644
    a b function bbp_update_topic_reply_count_hidden( $topic_id = 0, $reply_count = 0 ) 
    24412441
    24422442        // Get replies of topic
    24432443        if ( empty( $reply_count ) ) {
    2444                 $post_status = "'" . implode( "','", array( bbp_get_trash_status_id(), bbp_get_spam_status_id() ) ) . "'";
    2445                 $reply_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $topic_id, bbp_get_reply_post_type() ) );
     2444                $reply_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( %d, %d ) AND post_type = '%s';", $topic_id, bbp_get_trash_status_id(), bbp_get_spam_status_id(), bbp_get_reply_post_type() ) );
    24462445        }
    24472446
    24482447        update_post_meta( $topic_id, '_bbp_reply_count_hidden', (int) $reply_count );