Skip to:
Content

bbPress.org

Changeset 5078


Ignore:
Timestamp:
08/19/2013 07:10:14 AM (8 years ago)
Author:
johnjamesjacoby
Message:

Use bbp_get_topic_types() rather than compare to hardcoded array. Also switch from isset() to !empty() checks, and add an empty() check for 'sub_action' when toggling a topic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/topics/functions.php

    r5077 r5078  
    277277
    278278    // Check a whitelist of possible topic status ID's
    279     } elseif ( isset( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
     279    } elseif ( !empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
    280280        $topic_status = $_POST['bbp_topic_status'];
    281281
     
    613613
    614614    // Check a whitelist of possible topic status ID's
    615     } elseif ( isset( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
     615    } elseif ( !empty( $_POST['bbp_topic_status'] ) && in_array( $_POST['bbp_topic_status'], array_keys( bbp_get_topic_statuses() ) ) ) {
    616616        $topic_status = $_POST['bbp_topic_status'];
    617617
     
    721721        /** Stickies **********************************************************/
    722722
    723         if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array( 'stick', 'super', 'unstick' ) ) ) {
     723        if ( !empty( $_POST['bbp_stick_topic'] ) && in_array( $_POST['bbp_stick_topic'], array_keys( bbp_get_topic_types() ) ) ) {
    724724
    725725            // What's the caps?
     
    21302130        case 'bbp_toggle_topic_trash' :
    21312131
    2132             $sub_action = in_array( $_GET['sub_action'], array( 'trash', 'untrash', 'delete' ) ) ? $_GET['sub_action'] : false;
     2132            $sub_action = !empty( $_GET['sub_action'] ) && in_array( $_GET['sub_action'], array( 'trash', 'untrash', 'delete' ) ) ? $_GET['sub_action'] : false;
    21332133
    21342134            if ( empty( $sub_action ) )
Note: See TracChangeset for help on using the changeset viewer.