Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/09/2011 06:51:40 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Prevent forum and topic ID's from being poisoned by functions that attempt to make calculations out of turn. Also prevent incorrect assignment of parent topic and forum ID's when posting from admin area. Fixes #1433.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-reply-template.php

    r3101 r3125  
    10711071    function bbp_get_reply_topic_id( $reply_id = 0 ) {
    10721072
     1073        // Assume there is no topic id
     1074        $topic_id = 0;
     1075
    10731076        // Check that reply_id is valid
    1074         if ( $reply_id = bbp_get_reply_id( $reply_id ) ) {
     1077        if ( $reply_id = bbp_get_reply_id( $reply_id ) )
    10751078
    10761079            // Get topic_id from reply
    1077             $topic_id = get_post_meta( $reply_id, '_bbp_topic_id', true );
    1078             $topic_id = bbp_get_topic_id( $topic_id );
    1079 
    1080         // reply_id is not valid, so no topic exists
    1081         } else {
    1082             $topic_id = 0;
    1083         }
     1080            if ( $topic_id = get_post_meta( $reply_id, '_bbp_topic_id', true ) )
     1081
     1082                // Validate the topic_id
     1083                $topic_id = bbp_get_topic_id( $topic_id );
    10841084
    10851085        return apply_filters( 'bbp_get_reply_topic_id', (int) $topic_id, $reply_id );
     
    11111111    function bbp_get_reply_forum_id( $reply_id = 0 ) {
    11121112
     1113        // Assume there is no forum
     1114        $forum_id = 0;
     1115
    11131116        // Check that reply_id is valid
    1114         if ( $reply_id = bbp_get_reply_id( $reply_id ) ) {
     1117        if ( $reply_id = bbp_get_reply_id( $reply_id ) )
    11151118
    11161119            // Get forum_id from reply
    1117             $forum_id = get_post_meta( $reply_id, '_bbp_forum_id', true );
    1118             $forum_id = bbp_get_forum_id( $forum_id );
    1119 
    1120         // reply_id is not valid, so no forum exists
    1121         } else {
    1122             $forum_id = 0;
    1123         }
     1120            if ( $forum_id = get_post_meta( $reply_id, '_bbp_forum_id', true ) )
     1121
     1122                // Validate the forum_id
     1123                $forum_id = bbp_get_forum_id( $forum_id );
    11241124
    11251125        return apply_filters( 'bbp_get_reply_forum_id', (int) $forum_id, $reply_id );
Note: See TracChangeset for help on using the changeset viewer.