Changeset 12008 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 10/08/2009 08:24:59 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r12007 r12008 200 200 die('-1'); 201 201 202 check_ajax_referer( "delete-comment_$id" ); 203 $status = wp_get_comment_status( $comment->comment_ID ); 204 202 205 if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) { 203 check_ajax_referer( "trash-comment_$id" ); 204 if ( 'trash' == wp_get_comment_status( $comment->comment_ID ) ) 206 if ( 'trash' == $status ) 205 207 die( (string) time() ); 206 208 $r = wp_trash_comment( $comment->comment_ID ); 207 209 } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) { 208 check_ajax_referer( "untrash-comment_$id" ); 210 if ( 'trash' != $status ) 211 die( (string) time() ); 209 212 $r = wp_untrash_comment( $comment->comment_ID ); 210 213 } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { 211 check_ajax_referer( "delete-comment_$id" ); 212 if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) ) 214 if ( 'spam' == $status ) 213 215 die( (string) time() ); 214 216 $r = wp_set_comment_status( $comment->comment_ID, 'spam' ); 217 } elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) { 218 $r = wp_delete_comment( $comment->comment_ID ); 215 219 } else { 216 check_ajax_referer( "delete-comment_$id");217 $r = wp_delete_comment( $comment->comment_ID );218 } 220 die('-1'); 221 } 222 219 223 if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts 220 224 _wp_ajax_delete_comment_response( $comment->comment_ID ); … … 369 373 die( (string) time() ); 370 374 371 $r = 0; 372 if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) { 373 check_ajax_referer( "approve-comment_$id" ); 375 check_ajax_referer( "approve-comment_$id" ); 376 if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) 374 377 $result = wp_set_comment_status( $comment->comment_ID, 'approve', true ); 375 } else { 376 check_ajax_referer( "unapprove-comment_$id" ); 378 else 377 379 $result = wp_set_comment_status( $comment->comment_ID, 'hold', true ); 378 } 380 379 381 if ( is_wp_error($result) ) { 380 382 $x = new WP_Ajax_Response( array(
Note: See TracChangeset
for help on using the changeset viewer.