Skip to content

Commit

Permalink
Kses posts content closer to the place we use it
Browse files Browse the repository at this point in the history
We were ksesing the contents right after we got it
from POST, which caused a post update getting empty
after uses to be deleted, instead of empty.

This isn't very DRY, but we need to extract the
CRUD functionality for entries anyway, we will
have this in central place then.
  • Loading branch information
nb committed Aug 15, 2012
1 parent d187252 commit ec017c4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions liveblog.php
Expand Up @@ -337,9 +337,9 @@ public static function ajax_insert_entry() {
self::ajax_check_nonce();

// Check POST data
$post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
$replaces_comment_id = isset( $_POST['replaces'] ) ? intval( $_POST['replaces'] ) : 0;
$entry_content = isset( $_POST['entry_content'] ) ? wp_filter_post_kses( $_POST['entry_content'] ) : '';
$post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
$replaces_comment_id = isset( $_POST['replaces'] ) ? intval( $_POST['replaces'] ) : 0;
$entry_content = isset( $_POST['entry_content'] ) ? $_POST['entry_content'] : '';

if ( empty( $post_id ) )
self::send_error( __( 'Sorry, that post is not accepting Liveblog entries.', 'liveblog' ) );
Expand All @@ -350,7 +350,7 @@ public static function ajax_insert_entry() {
// Insert new comment
$new_comment_id = wp_insert_comment( array(
'comment_post_ID' => $post_id,
'comment_content' => $entry_content,
'comment_content' => wp_filter_post_kses( $entry_content ),
'comment_approved' => self::key,
'comment_type' => self::key,
'user_id' => $user->ID,
Expand Down Expand Up @@ -379,7 +379,7 @@ public static function ajax_insert_entry() {
if ( !empty( $entry_content ) ) {
wp_update_comment( array(
'comment_ID' => $replaces_comment_id,
'comment_content' => $entry_content
'comment_content' => wp_filter_post_kses( $entry_content ),
) );

// Delete this comment
Expand Down

0 comments on commit ec017c4

Please sign in to comment.