Changeset 2860 for trunk/bb-edit.php
- Timestamp:
- 02/10/2011 08:33:59 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/bb-edit.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-edit.php
r2147 r2860 6 6 $post_id = (int) $_POST['post_id']; 7 7 8 $bb_post = bb_get_post( $post_id );8 $bb_post = bb_get_post( $post_id ); 9 9 10 10 if ( !$bb_post ) { … … 21 21 add_filter('bb_is_first_where', 'bb_no_where'); 22 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 ) ); 23 // Check possible anonymous user data 24 $post_author = $post_email = $post_url = ''; 25 26 if ( !bb_get_user( get_post_author_id( $post_id ) ) ) { 27 if ( !$post_author = sanitize_user( trim( $_POST['author'] ) ) ) 28 bb_die( __( 'Every post needs an author name!' ) ); 29 elseif ( !$post_email = sanitize_email( trim( $_POST['email'] ) ) ) 30 bb_die( __( 'Every post needs a valid email address!' ) ); 31 32 if ( !empty( $_POST['url'] ) ) 33 $post_url = esc_url( trim( $_POST['url'] ) ); 28 34 } 29 35 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 ) ); 36 // Loop through possible anonymous post data 37 foreach( array('post_author', 'post_email', 'post_url') as $field ) { 38 if ( ! empty( $$field ) ) { 39 $post_data[$field] = $$field; 40 } 41 } 42 43 // Setup topic data 44 if ( bb_is_first( $bb_post->post_id ) && bb_current_user_can( 'edit_topic', $bb_post->topic_id ) ) { 45 46 $post_data['topic_title'] = stripslashes( $_POST['topic'] ); 47 $post_data['topic_id'] = $bb_post->topic_id; 48 49 bb_insert_topic( $post_data ); 50 } 51 52 // Setup post data 53 $post_data['post_text'] = stripslashes( $_POST['post_content'] ); 54 $post_data['post_id'] = $post_id; 55 56 bb_insert_post( $post_data ); 35 57 36 58 if ( $post_id ) {
Note: See TracChangeset
for help on using the changeset viewer.