Пример #1
0
             $fs->move($file, $path . '/' . basename($file));
         }
     }
 }
 while ($file = smartstrip(array_shift($_SESSION['copy_files']))) {
     if ($file != $path . '/' . basename($file)) {
         if (!$fs->has_read_permission($GO_SECURITY->user_id, $file)) {
             $popup_feedback .= access_denied_box($file);
             break;
         } elseif (!$fs->has_write_permission($GO_SECURITY->user_id, $path)) {
             $popup_feedback .= access_denied_box($path);
             break;
         } elseif ($fs->chroot_file_exists($path . '/' . basename($file))) {
             if ($overwrite_destination_path == $path . '/' . basename($file) || $overwrite_all == 'true') {
                 if ($overwrite == "true") {
                     $fs->copy($file, $path . '/' . basename($file));
                 }
             } else {
                 array_unshift($_SESSION['copy_files'], $file);
                 $overwrite_source_path = $file;
                 $overwrite_destination_path = $path . '/' . basename($file);
                 $task = 'overwrite';
                 break;
             }
         } else {
             $fs->copy($file, $path . '/' . basename($file));
         }
     }
 }
 while ($folder = smartstrip(array_shift($_SESSION['cut_folders']))) {
     if ($folder != $path . '/' . basename($folder)) {
Пример #2
0
switch ($task) {
    case 'upload':
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $task = 'list';
            if (isset($_FILES['file'])) {
                $_SESSION['cut_files'] = array();
                $_SESSION['cut_folders'] = array();
                $_SESSION['copy_folders'] = array();
                $_SESSION['copy_files'] = array();
                for ($i = 0; $i < count($_FILES['file']['tmp_name']); $i++) {
                    if (is_uploaded_file($_FILES['file']['tmp_name'][$i])) {
                        $extension = get_extension($_FILES['file']['name'][$i]);
                        if (!$filetypes->get_type($extension)) {
                            $filetypes->add_type($extension, $_FILES['file']['type'][$i]);
                        }
                        if ($fs->copy($_FILES['file']['tmp_name'][$i], $GO_CONFIG->tmpdir . '/' . $_FILES['file']['name'][$i])) {
                            $_SESSION['copy_files'][] = $GO_CONFIG->tmpdir . '/' . $_FILES['file']['name'][$i];
                        }
                    }
                }
                while ($file = smartstrip(array_shift($_SESSION['copy_files']))) {
                    $new_path = $path . '/' . basename($file);
                    if (!$write_permission) {
                        $popup_feedback .= access_denied_box($path);
                        break;
                    } elseif (file_exists($new_path)) {
                        if ($overwrite_destination_path == $new_path && $overwrite_all != 'true') {
                            if ($overwrite == "true") {
                                $fs->copy($file, $new_path);
                            }
                        } else {