admin-db is needed for wp_delete_category
git-svn-id: https://develop.svn.wordpress.org/trunk@2940 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8c5f91cd89
commit
ab51dd291b
|
@ -1,80 +1,81 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('../wp-config.php');
|
require_once('../wp-config.php');
|
||||||
require_once('admin-functions.php');
|
require_once('admin-functions.php');
|
||||||
|
require_once('admin-db.php');
|
||||||
get_currentuserinfo();
|
|
||||||
if ( !$current_user )
|
get_currentuserinfo();
|
||||||
die('-1');
|
if ( !$current_user )
|
||||||
|
die('-1');
|
||||||
function grab_results() {
|
|
||||||
global $ajax_results;
|
function grab_results() {
|
||||||
$ajax_results = func_get_arg(0);
|
global $ajax_results;
|
||||||
}
|
$ajax_results = func_get_arg(0);
|
||||||
|
}
|
||||||
function get_out_now() { exit; }
|
|
||||||
add_action('shutdown', 'get_out_now', -1);
|
function get_out_now() { exit; }
|
||||||
|
add_action('shutdown', 'get_out_now', -1);
|
||||||
// check_admin_referer();
|
|
||||||
|
// check_admin_referer();
|
||||||
switch ( $_POST['action'] ) :
|
|
||||||
case 'delete-link' :
|
switch ( $_POST['action'] ) :
|
||||||
$id = (int) $_POST['id'];
|
case 'delete-link' :
|
||||||
if ( !current_user_can('manage_links') )
|
$id = (int) $_POST['id'];
|
||||||
die ('-1');
|
if ( !current_user_can('manage_links') )
|
||||||
|
die ('-1');
|
||||||
if ( $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$id'") )
|
|
||||||
die('1');
|
if ( $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$id'") )
|
||||||
else die('0');
|
die('1');
|
||||||
break;
|
else die('0');
|
||||||
case 'delete-post' :
|
break;
|
||||||
case 'delete-page' :
|
case 'delete-post' :
|
||||||
$id = (int) $_POST['id'];
|
case 'delete-page' :
|
||||||
if ( !current_user_can('edit_post', $post_id) )
|
$id = (int) $_POST['id'];
|
||||||
die('-1');
|
if ( !current_user_can('edit_post', $post_id) )
|
||||||
|
die('-1');
|
||||||
if ( wp_delete_post($id) )
|
|
||||||
die('1');
|
if ( wp_delete_post($id) )
|
||||||
else die('0');
|
die('1');
|
||||||
break;
|
else die('0');
|
||||||
case 'delete-cat' :
|
break;
|
||||||
if ( !current_user_can('manage_categories') )
|
case 'delete-cat' :
|
||||||
die ('-1');
|
if ( !current_user_can('manage_categories') )
|
||||||
|
die ('-1');
|
||||||
$id = (int) $_POST['id'];
|
|
||||||
$cat_name = get_catname($cat_ID);
|
$id = (int) $_POST['id'];
|
||||||
|
$cat_name = get_catname($cat_ID);
|
||||||
if ( wp_delete_category($id) )
|
|
||||||
die('1');
|
if ( wp_delete_category($id) )
|
||||||
else die('0');
|
die('1');
|
||||||
break;
|
else die('0');
|
||||||
case 'delete-comment' :
|
break;
|
||||||
$id = (int) $_POST['id'];
|
case 'delete-comment' :
|
||||||
|
$id = (int) $_POST['id'];
|
||||||
if ( !$comment = get_comment($id) )
|
|
||||||
die('0');
|
if ( !$comment = get_comment($id) )
|
||||||
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
die('0');
|
||||||
die('-1');
|
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
|
||||||
|
die('-1');
|
||||||
if ( wp_set_comment_status($comment->comment_ID, "delete") ) {
|
|
||||||
do_action('delete_comment', $comment->comment_ID);
|
if ( wp_set_comment_status($comment->comment_ID, "delete") ) {
|
||||||
die('1');
|
do_action('delete_comment', $comment->comment_ID);
|
||||||
} else {
|
die('1');
|
||||||
die('0');
|
} else {
|
||||||
}
|
die('0');
|
||||||
break;
|
}
|
||||||
case 'delete-link-category' :
|
break;
|
||||||
$id = (int) $_POST['id'];
|
case 'delete-link-category' :
|
||||||
if ( 1 == $id )
|
$id = (int) $_POST['id'];
|
||||||
die('0');
|
if ( 1 == $id )
|
||||||
if ( !current_user_can('manage_links') )
|
die('0');
|
||||||
die('-1');
|
if ( !current_user_can('manage_links') )
|
||||||
|
die('-1');
|
||||||
if ( $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$id'") ) {
|
|
||||||
$wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$id'");
|
if ( $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$id'") ) {
|
||||||
die('1');
|
$wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$id'");
|
||||||
} else {
|
die('1');
|
||||||
die('0');
|
} else {
|
||||||
}
|
die('0');
|
||||||
break;
|
}
|
||||||
endswitch;
|
break;
|
||||||
?>
|
endswitch;
|
||||||
|
?>
|
||||||
|
|
Loading…
Reference in New Issue