Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/12/2011 12:32:15 AM (14 years ago)
Author:
djpaul
Message:

Correctly handle invalid forum permalinks. Also fixes a couple of PHP notices. Fixes #2349.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-template.php

    r4088 r4124  
    899899    extract( $r, EXTR_SKIP );
    900900
    901     if ( empty( $topic_id ) && bp_is_current_component( 'groups') && bp_is_current_action( 'forum' ) && 'topic' == $bp->action_variables[0] )
     901    if ( empty( $topic_id ) && bp_is_current_component( 'groups') && bp_is_current_action( 'forum' ) && !empty( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] && !empty( $bp->action_variables[1] ) )
    902902        $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[1] );
    903903    elseif ( empty( $topic_id ) && bp_is_current_component( 'forums') && bp_is_current_action( 'topic' ) && !empty( $bp->action_variables[0] ) )
    904904        $topic_id = bp_forums_get_topic_id_from_slug( $bp->action_variables[0] );
    905905
    906     if ( is_numeric( $topic_id ) ) {
    907         $topic_template = new BP_Forums_Template_Topic( $topic_id, $per_page, $max, $order );
     906    if ( empty( $topic_id ) ) {
     907        return false;
     908
     909    } else {
     910        $topic_template = new BP_Forums_Template_Topic( (int) $topic_id, $per_page, $max, $order );
    908911
    909912        // Current topic forum_id needs to match current_group forum_id
    910913        if ( bp_is_current_component( 'groups' ) && $topic_template->forum_id != groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ) )
    911914            return false;
    912 
    913     } else {
    914         return false;
    915915    }
    916916
Note: See TracChangeset for help on using the changeset viewer.