Example #1
0
     $_SESSION['cut_folders'] = array();
     $_SESSION['cut_files'] = array();
     break;
 case 'paste':
     while ($file = smartstrip(array_shift($_SESSION['cut_files']))) {
         if ($file != $path . '/' . basename($file)) {
             if (!$fs->has_write_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->move($file, $path . '/' . basename($file));
                     }
                 } else {
                     array_unshift($_SESSION['cut_files'], $file);
                     $overwrite_source_path = $file;
                     $overwrite_destination_path = $path . '/' . basename($file);
                     $task = 'overwrite';
                     break;
                 }
             } else {
                 $fs->move($file, $path . '/' . basename($file));
             }
         }
     }
     while ($file = smartstrip(array_shift($_SESSION['copy_files']))) {
         if ($file != $path . '/' . basename($file)) {
}
if ($filename == '') {
    $filename = basename($_SESSION['email_tmp_file']);
} else {
    $filename = smartstrip($filename);
}
if (isset($task) && $task == 'GO_HANDLER') {
    require $GO_CONFIG->class_path . 'filesystem.class.inc';
    $fs = new filesystem();
    if (file_exists(smartstrip($_REQUEST['path']) . '/' . $filename)) {
        $feedback = '<p class="Error">' . $fbNameExists . '</p>';
    } elseif (!$fs->has_write_permission($GO_SECURITY->user_id, smartstrip($_REQUEST['path']))) {
        $feedback = '<p class="Error">' . $strAccessDenied . ': ' . smartstrip($_REQUEST['path']) . '</p>';
    } else {
        $new_path = smartstrip($_REQUEST['path']) . '/' . $filename;
        if ($fs->move($_SESSION['email_tmp_file'], $new_path)) {
            $old_umask = umask(00);
            chmod($new_path, $GO_CONFIG->create_mode);
            umask($old_umask);
            unset($_SESSION['tmp_account_id']);
            unset($_SESSION['email_tmp_file']);
            echo "<script type=\"text/javascript\" language=\"javascript\">\n";
            echo "window.close()\n";
            echo "</script>\n";
        } else {
            $feedback = '<p class="Error">' . $strSaveError . '</p>';
        }
    }
}
if (isset($_REQUEST['account_id'])) {
    $_SESSION['tmp_account_id'] = $_REQUEST['account_id'];
 /**
  * @en Rename a file or directory
  * @ru Переименовывает файл или директорию
  *
  * $result = filesystem::move('file.txt', 'file-new.txt'); # bool(true) on success and bool(false) otherwise
  *
  * @param string $path_from
  * @param string $path_to
  *
  * @return bool
  */
 public static function rename($path_from, $path_to)
 {
     return filesystem::move($path_from, $path_to);
 }