示例#1
0
function filebrowser_rmdirr($folder)
{
    $folder = trailingslashit($folder);
    if ($dir = @opendir($folder)) {
        while (($file = readdir($dir)) !== false) {
            if (!is_dir($folder . $file) and $file != '..' and $file != '.') {
                @unlink($folder . $file);
            } elseif (is_dir($folder . $file) and $file != '..' and $file != '.') {
                filebrowser_rmdirr($folder . $file);
            }
        }
        closedir($dir);
        @rmdir($folder);
    }
}
         header('HTTP/1.0 404 Not Found');
         die(__('File does not exist.', 'backwpup'));
     }
     break;
 case 'delete':
     check_admin_referer('filebrowser');
     unset($_GET['copyfiles']);
     unset($_GET['movefiles']);
     if (is_array($_POST['selfiles'])) {
         $files = $_POST['selfiles'];
     } else {
         $files[0] = $_GET['selfiles'];
     }
     foreach ($files as $file) {
         if (is_dir($file)) {
             filebrowser_rmdirr($file);
             $filebrowser_message .= str_replace('%1', basename($file), __('Folder %1 deleted recursive.', 'filebrowser')) . '<br />';
         } else {
             if (@unlink($file)) {
                 $filebrowser_message .= str_replace('%1', basename($file), __('File %1 deleted.', 'filebrowser')) . '<br />';
             } else {
                 $filebrowser_message .= str_replace('%1', basename($file), __('File %1 NOT deleted.', 'filebrowser')) . '<br />';
             }
         }
     }
     $gotofolder = dirname($files[0]);
     unset($_GET['gotofolder']);
     break;
 case 'unzip':
     check_admin_referer('filebrowser');
     ignore_user_abort(true);