<?php
/*
AjaxExplorer Copyright (C) 2007-2008 Syed Mohammad Sidque Tahir Al-Habshi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Head to
GNU site http://www.gnu.org/licenses/ for license copy.
*/
$access='0004';
include 'core.php';
$dirc=Post('dirc');
$file=Post('file');
$item=explode('|', Post('item'));
$list=array('/');
$does="Delete\t".$dirc."\t".$file;
include 'track.php';
foreach(explode('|', $file) as $id=>$name)
{
if(!$name) break;
if(!$recycle || strpos($dirc, '/user/'.$username.'/Recycle Bin/')!==false)
{
if(is_dir($dirs=$root.$dirc.$name))
{
for($i=0; $i<count($list); $i++)
{
if($dir=opendir($dirs.$list[$i]))
{
while($file=readdir($dir))
{
if($file!='.' && $file!='..')
{
is_dir($dirs.$list[$i].$file)? $list[]=$list[$i].$file.'/':$d[0][]=$list[$i].$file;
}
}
$d[1][]=$list[$i];
closedir($dir);
}
}
for($i=0; $i<2; $i++)
{
if(isset($d[$i])) foreach(array_reverse($d[$i]) as $file) $i? rmdir($dirs.$file):unlink($dirs.$file);
}
$flag=file_exists($dirs)? 0:1;
$list=array('/');
unset($d);
}
else $flag=unlink($dirs)? 1:0;
}
else $flag=rename($root.$dirc.$name, '../user/'.$username.'/Recycle Bin/'.str_replace('/', '$', $name.'^'.$dirc).'^'.time())? 1:0;
for($i=0; $i<2; $i++) if(isset($d[$i])) unset($d[$i]);
echo $flag? $item[$id].'|':'';
}
?>