Example #1
0
function rrename_after_cleaner($source)
{
    $files = scandir($source);
    foreach ($files as $file) {
        if ($file != "." && $file != "..") {
            if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
                rrename_after_cleaner($source . DIRECTORY_SEPARATOR . $file);
            } else {
                unlink($source . DIRECTORY_SEPARATOR . $file);
            }
        }
    }
    return rmdir($source);
}
Example #2
0
     }
     // check if server disables copy or rename
     if (is_function_callable($action == 'copy' ? 'copy' : 'rename') === FALSE) {
         response(sprintf(trans('Function_Disabled'), $action == 'copy' ? lcfirst(trans('Copy')) : lcfirst(trans('Cut'))), 403)->send();
         exit;
     }
     if ($action == 'copy') {
         rcopy($data['path'], $path);
         rcopy($data['path_thumb'], $path_thumb);
     } elseif ($action == 'cut') {
         rrename($data['path'], $path);
         rrename($data['path_thumb'], $path_thumb);
         // cleanup
         if (is_dir($data['path']) === TRUE) {
             rrename_after_cleaner($data['path']);
             rrename_after_cleaner($data['path_thumb']);
         }
     }
     // cleanup
     $_SESSION['RF']['clipboard']['path'] = NULL;
     $_SESSION['RF']['clipboard_action'] = NULL;
     break;
 case 'chmod':
     $mode = $_POST['new_mode'];
     $rec_option = $_POST['is_recursive'];
     $valid_options = array('none', 'files', 'folders', 'both');
     $chmod_perm = is_dir($path) ? $chmod_dirs : $chmod_files;
     // check perm
     if ($chmod_perm === FALSE) {
         response(sprintf(trans('File_Permission_Not_Allowed'), is_dir($path) ? lcfirst(trans('Folders')) : lcfirst(trans('Files'))), 403)->send();
         exit;