<?php


// Call WP Load
$wp_include = "../wp-load.php";$i = 0;
while (!file_exists($wp_include) && $i++ < 10) {$wp_include = "../$wp_include";} require($wp_include);
if ( !is_user_logged_in() || !current_user_can('edit_posts') ) 
	wp_die(__("You are not allowed to be here","cloudfw"));	


$id = $_POST["id"];
$nonce = $_POST["nonce"];

if (!isset($id) && !isset($nonce)) {echo 'ERROR'; die();}

if (wp_create_nonce('sidebar_remove') !== $nonce) {echo 'ERROR'; die();}

check_admin_referer();

global $_opt;
$bars = $_opt[PFIX."_custom_sidebars"];

unset($bars[$id]);

update_option(PFIX."_custom_sidebars", $bars);
	
	echo 'OK'; die();

?>