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-admin/bbp-replies.php

    r3120 r3125  
    568568
    569569                // Output forum name
    570                 bbp_topic_title( $topic_id );
    571 
    572                 // Link information
    573                 $actions = apply_filters( 'reply_topic_row_actions', array (
    574                     'edit' => '<a href="' . add_query_arg( array( 'post' => $topic_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
    575                     'view' => '<a href="' . bbp_get_topic_permalink( $topic_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'
    576                 ) );
    577 
    578                 // Output forum post row links
    579                 foreach ( $actions as $action => $link )
    580                     $formatted_actions[] = '<span class="' . $action . '">' . $link . '</span>';
    581 
    582                 //echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>';
     570                if ( !empty( $topic_id ) ) {
     571                    bbp_topic_title( $topic_id );
     572
     573                    // Link information
     574                    $actions = apply_filters( 'reply_topic_row_actions', array (
     575                        'edit' => '<a href="' . add_query_arg( array( 'post' => $topic_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
     576                        'view' => '<a href="' . bbp_get_topic_permalink( $topic_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'
     577                    ) );
     578
     579                    // Output forum post row links
     580                    foreach ( $actions as $action => $link )
     581                        $formatted_actions[] = '<span class="' . $action . '">' . $link . '</span>';
     582
     583                    if ( !empty( $topic_id ) )
     584                        echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>';
     585
     586                // Reply has no topic
     587                } else {
     588                    _e( '(No Topic)', 'bbpress' );
     589                }
    583590
    584591                break;
     
    591598
    592599                // Output forum name
    593                 bbp_forum_title( $forum_id );
    594 
    595                 // Link information
    596                 $actions = apply_filters( 'reply_topic_forum_row_actions', array (
    597                     'edit' => '<a href="' . add_query_arg( array( 'post' => $forum_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
    598                     'view' => '<a href="' . bbp_get_forum_permalink( $forum_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'
    599                 ) );
    600 
    601                 // Output forum post row links
    602                 foreach ( $actions as $action => $link )
    603                     $formatted_actions[] = '<span class="' . $action . '">' . $link . '</span>';
    604 
    605                 //echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>';
     600                if ( !empty( $forum_id ) ) {
     601                    bbp_forum_title( $forum_id );
     602
     603                    // Link information
     604                    $actions = apply_filters( 'reply_topic_forum_row_actions', array (
     605                        'edit' => '<a href="' . add_query_arg( array( 'post' => $forum_id, 'action' => 'edit' ), admin_url( '/post.php' ) ) . '">' . __( 'Edit', 'bbpress' ) . '</a>',
     606                        'view' => '<a href="' . bbp_get_forum_permalink( $forum_id ) . '">' . __( 'View', 'bbpress' ) . '</a>'
     607                    ) );
     608
     609                    // Output forum post row links
     610                    foreach ( $actions as $action => $link )
     611                        $formatted_actions[] = '<span class="' . $action . '">' . $link . '</span>';
     612
     613                    // Show forum actions
     614                    if ( !empty( $forum_id ) )
     615                        echo '<div class="row-actions">' . implode( ' | ', $formatted_actions ) . '</div>';
     616
     617                // Reply has no forum
     618                } else {
     619                    _e( '(No Forum)', 'bbpress' );
     620                }
    606621
    607622                break;
Note: See TracChangeset for help on using the changeset viewer.