Changeset 11749 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 07/30/2009 01:39:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r11731 r11749 182 182 switch ( $action = $_POST['action'] ) : 183 183 case 'delete-comment' : // On success, die with time() instead of 1 184 check_ajax_referer( "delete-comment_$id" );185 184 if ( !$comment = get_comment( $id ) ) 186 185 die( (string) time() ); … … 188 187 die('-1'); 189 188 190 if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { 189 if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) { 190 check_ajax_referer( "trash-comment_$id" ); 191 if ( 'trash' == wp_get_comment_status( $comment->comment_ID ) ) 192 die( (string) time() ); 193 $r = wp_trash_comment( $comment->comment_ID ); 194 } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) { 195 check_ajax_referer( "untrash-comment_$id" ); 196 $r = wp_untrash_comment( $comment->comment_ID ); 197 } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { 198 check_ajax_referer( "delete-comment_$id" ); 191 199 if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) ) 192 200 die( (string) time() ); 193 201 $r = wp_set_comment_status( $comment->comment_ID, 'spam' ); 194 202 } else { 195 $r = wp_set_comment_status( $comment->comment_ID, 'delete' ); 203 check_ajax_referer( "delete-comment_$id" ); 204 $r = wp_delete_comment( $comment->comment_ID ); 196 205 } 197 206 if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
Note: See TracChangeset
for help on using the changeset viewer.