Location: PHPKode > projects > Ajax File Manager - AjaxExplorer > ajaxexplorer/script/copied.php
<?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='0001';
include 'core.php';

$dirc=Post('dirc');
$file=Post('file');
$from=Post('from');
$list=array('/');

$does="Copy\t".$dirc."\t".$file;
include 'track.php';

$copy=$from==$dirc? 'Copy of ':'';
foreach(explode('|', $file) as $name)
{
  if($name && ($replace || !file_exists($root.$dirc.$copy.$name)))
  {
    if(is_dir($dirs=$root.$from.$name.'/'))
    {
      echo mkdir($root.$dirc.$copy.$name)? $copy.$name.':folder:'.filemtime($root.$from.$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=1; $i>=0; $i--)
      {
	if(isset($d[$i])) foreach($d[$i] as $file) $i? mkdir($root.$dirc.$copy.$name.$file):copy($dirs.$file, $root.$dirc.$copy.$name.$file);
      }

      $list=array('/');
      unset($d);
    }
    else echo copy(($file=$root.$from.$name), $root.$dirc.$copy.$name) && !Post('hide')? $copy.$name.':'.filesize($file).':'.filemtime($file).'|':'';
  }
}

?>
Return current item: Ajax File Manager - AjaxExplorer