Changeset 3180
- Timestamp:
- 05/21/2011 07:46:01 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-topic-functions.php
r3171 r3180 93 93 /** Topic Title *******************************************************/ 94 94 95 // Topic title 96 if ( !empty( $_POST['bbp_topic_title'] ) ) { 97 98 // Sanitize and strip HTML tags 95 if ( !empty( $_POST['bbp_topic_title'] ) ) 99 96 $topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) ); 100 97 101 // Filter and sanitize 102 $topic_title = apply_filters( 'bbp_new_topic_pre_title', $topic_title ); 103 } 98 // Filter and sanitize 99 $topic_title = apply_filters( 'bbp_new_topic_pre_title', $topic_title ); 104 100 105 101 // No topic title … … 109 105 /** Topic Content *****************************************************/ 110 106 111 // Topic content 112 if ( !empty( $_POST['bbp_topic_content'] ) ) { 113 114 // Set topic content 107 if ( !empty( $_POST['bbp_topic_content'] ) ) 115 108 $topic_content = $_POST['bbp_topic_content']; 116 109 117 // Filter and sanitize 118 $topic_content = apply_filters( 'bbp_new_topic_pre_content', $topic_content ); 119 } 110 // Filter and sanitize 111 $topic_content = apply_filters( 'bbp_new_topic_pre_content', $topic_content ); 120 112 121 113 // No topic content 122 114 if ( empty( $topic_content ) ) 123 $bbp->errors->add( 'bbp_topic_content', __( '<strong>ERROR</strong>: Your topic needs some content.', 'bbpress' ) );115 $bbp->errors->add( 'bbp_topic_content', __( '<strong>ERROR</strong>: Your topic cannot be empty.', 'bbpress' ) ); 124 116 125 117 /** Topic Forum *******************************************************/ … … 171 163 172 164 // Explode by comma 173 if ( strstr( $terms, ',' ) ) {165 if ( strstr( $terms, ',' ) ) 174 166 $terms = explode( ',', $terms ); 175 }176 167 177 168 // Add topic tag ID as main key … … 354 345 // Forum is a category 355 346 if ( bbp_is_forum_category( $forum_id ) ) 356 $bbp->errors->add( 'bbp_edit_topic_forum_category', __( '<strong>ERROR</strong>: This forum is a category. No topics can be created in this forum.', 'bbpress' ) );347 $bbp->errors->add( 'bbp_edit_topic_forum_category', __( '<strong>ERROR</strong>: This forum is a category. No topics can be created in it.', 'bbpress' ) ); 357 348 358 349 // Forum is closed and user cannot access … … 371 362 /** Topic Title *******************************************************/ 372 363 373 // Topic title 374 if ( !empty( $_POST['bbp_topic_title'] ) ) { 375 376 // Sanitize and strip HTML tags 364 if ( !empty( $_POST['bbp_topic_title'] ) ) 377 365 $topic_title = esc_attr( strip_tags( $_POST['bbp_topic_title'] ) ); 378 366 379 // Filter and sanitize 380 $topic_title = apply_filters( 'bbp_edit_topic_pre_title', $topic_title, $topic_id ); 381 } 367 // Filter and sanitize 368 $topic_title = apply_filters( 'bbp_edit_topic_pre_title', $topic_title, $topic_id ); 382 369 383 370 // No topic title … … 387 374 /** Topic Content *****************************************************/ 388 375 389 // Topic content 390 if ( !empty( $_POST['bbp_topic_content'] ) ) { 391 392 // Set topic content 376 if ( !empty( $_POST['bbp_topic_content'] ) ) 393 377 $topic_content = $_POST['bbp_topic_content']; 394 378 395 // Filter and sanitize 396 $topic_content = apply_filters( 'bbp_edit_topic_pre_content', $topic_content, $topic_id ); 397 } 379 // Filter and sanitize 380 $topic_content = apply_filters( 'bbp_edit_topic_pre_content', $topic_content, $topic_id ); 398 381 399 382 // No topic content … … 410 393 411 394 // Explode by comma 412 if ( strstr( $terms, ',' ) ) {395 if ( strstr( $terms, ',' ) ) 413 396 $terms = explode( ',', $terms ); 414 }415 397 416 398 // Add topic tag ID as main key … … 468 450 469 451 // Revision Reason 470 if ( !empty( $_POST['bbp_topic_edit_reason'] ) ) {452 if ( !empty( $_POST['bbp_topic_edit_reason'] ) ) 471 453 $topic_edit_reason = esc_attr( strip_tags( $_POST['bbp_topic_edit_reason'] ) ); 472 }473 454 474 455 // Update revision log … … 508 489 509 490 /** Errors ********************************************************/ 491 510 492 } else { 511 493 $append_error = ( is_wp_error( $topic_id ) && $topic_id->get_error_message() ) ? $topic_id->get_error_message() . ' ' : ''; … … 1685 1667 do_action( 'bbp_toggle_topic_handler', $success, $post_data, $action ); 1686 1668 1687 // No Errors1669 // No errors 1688 1670 if ( false != $success && !is_wp_error( $success ) ) { 1689 1671 … … 1853 1835 // If it's a reply, then get the parent (topic id) 1854 1836 if ( bbp_is_reply( $topic_id ) ) 1855 $topic_id = bbp_get_reply_topic_id( $ reply_id );1837 $topic_id = bbp_get_reply_topic_id( $topic_id ); 1856 1838 else 1857 1839 $topic_id = bbp_get_topic_id( $topic_id ); … … 1957 1939 // If it's a reply, then get the parent (topic id) 1958 1940 if ( bbp_is_reply( $topic_id ) ) 1959 $topic_id = bbp_get_reply_topic_id( $ reply_id );1941 $topic_id = bbp_get_reply_topic_id( $topic_id ); 1960 1942 else 1961 1943 $topic_id = bbp_get_topic_id( $topic_id );
Note: See TracChangeset
for help on using the changeset viewer.