コード例 #1
0
ファイル: async.php プロジェクト: Ariflaw/b2evolution
     break;
 case 'conflict_files':
     // Replace old file with new and set new name for old file
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('conflictfiles');
     param('fileroot_ID', 'string');
     // Check permission:
     $current_User->check_perm('files', 'add', true, $fileroot_ID);
     param('path', 'string');
     param('oldfile', 'string');
     param('newfile', 'string');
     param('format', 'string');
     $fileroot = explode('_', $fileroot_ID);
     $fileroot_type = $fileroot[0];
     $fileroot_type_ID = empty($fileroot[1]) ? 0 : $fileroot[1];
     $result = replace_old_file_with_new($fileroot_type, $fileroot_type_ID, $path, $newfile, $oldfile, false);
     $data = array();
     if ($format == 'full_path_link') {
         // User link with full path to file
         $FileCache =& get_FileCache();
         $new_File =& $FileCache->get_by_root_and_path($fileroot_type, $fileroot_type_ID, trailing_slash($path) . $newfile, true);
         $old_File =& $FileCache->get_by_root_and_path($fileroot_type, $fileroot_type_ID, trailing_slash($path) . $oldfile, true);
         $data['new'] = $new_File->get_view_link();
         $data['old'] = $old_File->get_view_link();
     } else {
         // Simple text format
         $data['new'] = $newfile;
         $data['old'] = $oldfile;
     }
     if ($result !== true) {
         // Send an error if it was created during the replacing
コード例 #2
0
ファイル: upload.ctrl.php プロジェクト: Ariflaw/b2evolution
                $_FILES['uploadfile']['_evo_fetched_url'][$k] = $url;
                // skip is_uploaded_file and keep info
                unset($file_contents);
            } else {
                $failedFiles[$k] = sprintf('Could not retrieve file. Error: %s (status %s). Used method: %s.', $info['error'], isset($info['status']) ? $info['status'] : '-', isset($info['used_method']) ? $info['used_method'] : '-');
            }
        }
    }
}
// Process renaming/replacing of old versions:
if (!empty($renamedFiles)) {
    foreach ($renamedFiles as $rKey => $rData) {
        $replace_old = param('Renamed_' . $rKey, 'string', null);
        if ($replace_old == "Yes") {
            // replace the old file with the new one
            replace_old_file_with_new($fm_FileRoot->type, $fm_FileRoot->in_type_ID, $path, $renamedFiles[$rKey]['newName'], $renamedFiles[$rKey]['oldName']);
        }
    }
    forget_param('renamedFiles');
    unset($renamedFiles);
    if ($upload_quickmode) {
        header_redirect(regenerate_url('ctrl', 'ctrl=files', '', '&'));
    }
}
// Process uploaded files:
if ($action != 'switchtab' && isset($_FILES) && count($_FILES)) {
    // Stop a request from the blocked IP addresses or Domains
    antispam_block_request();
    // Check that this action request is not a CSRF hacked request:
    $Session->assert_received_crumb('file');
    $upload_result = process_upload($fm_FileRoot->ID, $path, false, false, $upload_quickmode);