2005-11-13 05:40:18 +01:00
|
|
|
<?php
|
|
|
|
require_once('../wp-config.php');
|
|
|
|
require_once('admin-functions.php');
|
|
|
|
require_once('admin-db.php');
|
|
|
|
|
2005-12-15 17:31:41 +01:00
|
|
|
if ( !is_user_logged_in() )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('-1');
|
|
|
|
|
|
|
|
function get_out_now() { exit; }
|
2006-03-07 00:29:10 +01:00
|
|
|
add_action( 'shutdown', 'get_out_now', -1 );
|
2005-11-13 05:40:18 +01:00
|
|
|
|
|
|
|
// check_admin_referer();
|
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
$id = (int) $_POST['id'];
|
2005-11-13 05:40:18 +01:00
|
|
|
switch ( $_POST['action'] ) :
|
|
|
|
case 'delete-link' :
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( !current_user_can( 'manage_links' ) )
|
|
|
|
die('-1');
|
2005-11-13 05:40:18 +01:00
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( wp_delete_link( $id ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('1');
|
|
|
|
else die('0');
|
|
|
|
break;
|
|
|
|
case 'delete-post' :
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( !current_user_can( 'delete_post', $id ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('-1');
|
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( wp_delete_post( $id ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('1');
|
2006-03-07 00:29:10 +01:00
|
|
|
else die('0');
|
2005-11-13 05:40:18 +01:00
|
|
|
break;
|
2006-03-07 00:29:10 +01:00
|
|
|
case 'delete-page' :
|
|
|
|
if ( !current_user_can( 'delete_page', $id ) )
|
|
|
|
die('-1');
|
2005-11-13 05:40:18 +01:00
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( wp_delete_post( $id ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('1');
|
|
|
|
else die('0');
|
|
|
|
break;
|
2006-03-07 00:29:10 +01:00
|
|
|
case 'delete-cat' :
|
|
|
|
if ( !current_user_can( 'manage_categories' ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('-1');
|
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( wp_delete_category( $id ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('1');
|
2006-03-07 00:29:10 +01:00
|
|
|
else die('0');
|
2005-11-13 05:40:18 +01:00
|
|
|
break;
|
2006-03-07 00:29:10 +01:00
|
|
|
case 'delete-comment' :
|
|
|
|
if ( !$comment = get_comment( $id ) )
|
2006-02-14 21:09:13 +01:00
|
|
|
die('0');
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
|
2006-02-14 21:09:13 +01:00
|
|
|
die('-1');
|
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( wp_delete_comment( $comment->comment_ID ) )
|
2006-02-14 21:09:13 +01:00
|
|
|
die('1');
|
2006-03-07 00:29:10 +01:00
|
|
|
else die('0');
|
2006-02-14 21:09:13 +01:00
|
|
|
break;
|
2006-03-07 00:29:10 +01:00
|
|
|
case 'delete-comment-as-spam' :
|
|
|
|
if ( !$comment = get_comment( $id ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('0');
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('-1');
|
|
|
|
|
2006-03-07 00:29:10 +01:00
|
|
|
if ( wp_set_comment_status( $comment->comment_ID, 'spam' ) )
|
2005-11-13 05:40:18 +01:00
|
|
|
die('1');
|
2006-03-07 00:29:10 +01:00
|
|
|
else die('0');
|
2005-11-13 05:40:18 +01:00
|
|
|
break;
|
2006-02-12 08:53:23 +01:00
|
|
|
endswitch;
|
2005-11-13 05:40:18 +01:00
|
|
|
?>
|