<?php

//**************************************************************************************************

// Copyright (c) Flashoculus.com

// www.flashoculus.com

// support@flashoculus.com

// This script is a part of the G-Administrator for Flashoculus G-series Flash Galleries.

// You are licensed to use this product on one (1) domain.

// Please contact us for extra licenses if required.

//**************************************************************************************************


$imageFolder='../T_images/';
$mp3Folder='../T_mp3/';


$deleteTarget=$_POST['deleteTarget'];
$deleteMp3=$_POST['deleteMp3'];
$deleteMp3Target=$_POST['deleteMp3Target'];
$resizeError=$_POST['resizeError'];
$thumbsAutoCreate=$_POST['thumbsAutoCreate']; 

if(isset($deleteTarget))
{
   $deleteArray = explode('|',$deleteTarget);
   $deleteArrayLength = sizeof($deleteArray);
   if($resizeError == 'N')
   {
   
       if( $deleteArray[0] == 'empty' )
       {
       }else
       {   
          for($i=0;$i<=$deleteArrayLength-1;$i++){
		  
		    if (file_exists($imageFolder.$deleteArray[$i])) 
			{
               unlink($imageFolder.$deleteArray[$i]);
			}
			if (file_exists($imageFolder.'adminThumbs/'.$deleteArray[$i]))
			{ 
		       unlink($imageFolder.'adminThumbs/'.$deleteArray[$i]);
			}
			if($thumbsAutoCreate == 'true')
			{
			   if (file_exists($imageFolder.'thumbs/'.$deleteArray[$i])) 
			   {
		          unlink($imageFolder.'thumbs/'.$deleteArray[$i]);
			   }
			}
		 }
	  }
	
	}else
	{
	   if( $deleteArray[0] == 'empty')
       {
       }else
       {
	       if (file_exists($imageFolder.'thumbs/'.$deleteArray[0])) 
		   {
		      unlink($imageFolder.'thumbs/'.$deleteArray[0]);
		   }
		   if (file_exists($imageFolder.'adminThumbs/'.$deleteArray[0])) 
		   {
		      unlink($imageFolder.'adminThumbs/'.$deleteArray[0]);
		   }
		   if (file_exists($imageFolder.$deleteArray[0])) 
		   {
		      unlink($imageFolder.$deleteArray[0]);
		   } 
	   }
   }
   if($deleteMp3 == 'true'){
   if (file_exists($mp3Folder.$deleteMp3Target)) 
		   {
		      unlink($mp3Folder.$deleteMp3Target);
		   }
		   }
   echo '<success>1</success>'; 
}
 
?>