2 require_once('../wp-config.php');
3 require_once('admin-functions.php');
4 require_once('admin-db.php');
7 if ( !is_user_logged_in() )
10 function grab_results() {
12 $ajax_results = func_get_arg(0);
15 function get_out_now() { exit; }
16 add_action('shutdown', 'get_out_now', -1);
18 // check_admin_referer();
20 switch ( $_POST['action'] ) :
22 $id = (int) $_POST['id'];
23 if ( !current_user_can('manage_links') )
26 if ( wp_delete_link($id) )
32 $id = (int) $_POST['id'];
33 if ( !current_user_can('edit_post', $id) ) {
37 if ( wp_delete_post($id) ) {
42 if ( !current_user_can('manage_categories') )
45 $id = (int) $_POST['id'];
46 $cat_name = get_catname($cat_ID);
48 if ( wp_delete_category($id) )
52 case 'delete-comment' :
53 $id = (int) $_POST['id'];
55 if ( !$comment = get_comment($id) )
57 if ( !current_user_can('edit_post', $comment->comment_post_ID) )
60 if ( wp_delete_comment($comment->comment_ID) ) {
66 case 'delete-link-category' :
67 $id = (int) $_POST['id'];
70 if ( !current_user_can('manage_links') )
73 if ( $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$id'") ) {
74 $wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$id'");