<?php
define("WP_ADMIN", true);
// 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"));
	
require (TMP_ADMIN_PATH.'/inc/slider.include_forms.php'); 


$id = $_POST["id"];
$form = $_POST["form"];
$this_page = $_POST["thispage"];
$slider = $_POST["slider"];


switch ($form):
	default:
	case 'main_slider':

	if (isset($id)) {
		
		cloudfw_loop_all_sliders(cloudfw_delete_slider($id),NULL,$this_page);
	}
	break;
	
	case 'default_slider':
			
		if (isset($id) && is_numeric($id)) {

		$slider_content = cloudfw_get_slider($slider);
		ksort($slider_content);

		$ii = 0;
		foreach ($slider_content as $vars => $var){
			
			if ((int)$vars !== (int)$id):
			
				$new_slider_content[$ii] = $slider_content[$vars];
			
				$ii++;		
			
			endif;
			}
		
		update_option($slider, $new_slider_content);
		cloudfw_loop_slider_items($new_slider_content, 'default_slider', $id);
		
		}
	
	break;
	case 'inline_slider':
			
		if (isset($id) && is_numeric($id)) {

		$slider_content = cloudfw_get_slider($slider);
		ksort($slider_content);

		$ii = 0;
		foreach ($slider_content as $vars => $var){
			
			if ((int)$vars !== (int)$id):
			
				$new_slider_content[$ii] = $slider_content[$vars];
			
				$ii++;		
			
			endif;
			}
		
		update_option($slider, $new_slider_content);
		cloudfw_loop_slider_items($new_slider_content, 'inline_slider', $id);
		
	}
	
	break;
endswitch;		



?>