コード例 #1
0
ファイル: files.ctrl.php プロジェクト: LFSF/oras
 if (!$loop_src_File->is_dir()) {
     if ($error_filename = validate_filename($new_names[$loop_src_File->get_md5_ID()])) {
         // Not a file name or not an allowed extension
         $confirm = 0;
         $Messages->add($error_filename, 'error');
         continue;
     }
 } elseif ($error_dirname = validate_dirname($new_names[$loop_src_File->get_md5_ID()])) {
     // Not a directory name
     $confirm = 0;
     $Messages->add($error_dirname, 'error');
     continue;
 }
 // Check if destination file exists:
 $FileCache =& get_Cache('FileCache');
 if (($dest_File =& $FileCache->get_by_root_and_path($fm_Filelist->get_root_type(), $fm_Filelist->get_root_ID(), $fm_Filelist->get_rds_list_path() . $new_names[$loop_src_File->get_md5_ID()])) && $dest_File->exists()) {
     // Target exists
     if ($dest_File === $loop_src_File) {
         param_error('new_names[' . $loop_src_File->get_md5_ID() . ']', T_('Source and target files are the same. Please choose another name or directory.'));
         $confirm = 0;
         continue;
     }
     if (!isset($overwrite[$loop_src_File->get_md5_ID()])) {
         // We have not yet asked to overwrite:
         param_error('new_names[' . $loop_src_File->get_md5_ID() . ']', sprintf(T_('The file «%s» already exists.'), $dest_File->get_rdfp_rel_path()));
         $overwrite[$loop_src_File->get_md5_ID()] = 0;
         $confirm = 0;
         continue;
     }
     // We have asked to overwite...
     if ($fm_mode == 'file_copy') {