[ Root ] [ Search ] [ Index ]

PHP Cross Reference of bbPress Trunk

Provided by Yoast

title

Body

[close]

/ -> bb-edit.php (source)

   1  <?php
   2  require ('./bb-load.php');
   3  
   4  bb_auth('logged_in');
   5  
   6  $post_id = (int) $_POST['post_id'];
   7  
   8  $bb_post  = bb_get_post( $post_id );
   9  
  10  if ( !$bb_post ) {
  11      wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
  12      die();
  13  }
  14  
  15  if ( !bb_current_user_can( 'edit_post', $post_id ) )
  16      bb_die(__('Sorry, post is too old.'));
  17  
  18  bb_check_admin_referer( 'edit-post_' . $post_id );
  19  
  20  if ( 0 != $bb_post->post_status && 'all' == $_GET['view'] ) // We're trying to edit a deleted post
  21      add_filter('bb_is_first_where', 'bb_no_where');
  22  
  23  if ( bb_is_first( $bb_post->post_id ) && bb_current_user_can( 'edit_topic', $bb_post->topic_id ) ) {
  24      bb_insert_topic( array(
  25          'topic_title' => stripslashes( $_POST['topic'] ),
  26          'topic_id' => $bb_post->topic_id
  27      ) );
  28  }
  29  
  30  bb_insert_post( array(
  31      'post_text' => stripslashes( $_POST['post_content'] ),
  32      'post_id' => $post_id,
  33      'topic_id' => $bb_post->topic_id
  34  ) );
  35  
  36  if ( $post_id ) {
  37      if ( $_REQUEST['view'] === 'all' ) {
  38          add_filter( 'get_post_link', 'bb_make_link_view_all' );
  39      }
  40      $post_link = get_post_link( $post_id );
  41      wp_redirect( $post_link );
  42  } else {
  43      wp_redirect( bb_get_uri(null, null, BB_URI_CONTEXT_HEADER) );
  44  }
  45  exit;
  46  ?>


Generated: Mon Nov 15 04:45:27 2010 Cross-referenced by PHPXref 0.7