Пример #1
0
 * @Copyright (C) 2014 VINADES.,JSC. All rights reserved
 * @License GNU/GPL version 2 or any later version
 * @Createdate 2-2-2010 12:55
 */
if (!defined('NV_IS_FILE_DATABASE')) {
    die('Stop!!!');
}
$filename = $nv_Request->get_title('filename', 'get', '');
$checkss = $nv_Request->get_title('checkss', 'get', '');
$log_dir = NV_LOGS_DIR . '/dump_backup';
if ($global_config['idsite']) {
    $log_dir .= '/' . $global_config['site_dir'];
}
$path_filename = NV_BASE_SITEURL . '/' . $log_dir . '/' . $filename;
if (nv_is_file($path_filename, $log_dir) === true and $checkss == md5($filename . NV_CHECK_SESSION)) {
    nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['download'], 'File name: ' . basename($filename), $admin_info['userid']);
    //Download file
    $name = basename($path_filename);
    $name_arr = explode('_', $name);
    if (sizeof($name_arr) > 1 and strlen($name_arr[0]) == 32) {
        $name = substr($name, 33);
    }
    $download = new NukeViet\Files\Download(NV_DOCUMENT_ROOT . $path_filename, NV_ROOTDIR . '/' . NV_LOGS_DIR . '/dump_backup', $name);
    $download->download_file();
    exit;
} else {
    $contents = 'File not exist !';
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_admin_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
}
Пример #2
0
        $file_basename = $subfile . '.zip';
        $directory = NV_ROOTDIR . '/' . NV_TEMP_DIR;
    } else {
        if ($file_exists) {
            @nv_deletefile($tem_file);
        }
        $zip = new PclZip($tem_file);
        $zip->add($file_src, PCLZIP_OPT_REMOVE_PATH, $upload_dir);
        if (isset($global_config['site_logo']) and !empty($global_config['site_logo']) and file_exists(NV_ROOTDIR . '/' . $global_config['site_logo'])) {
            $paths = explode('/', $global_config['site_logo']);
            array_pop($paths);
            $paths = implode('/', $paths);
            $zip->add(NV_ROOTDIR . '/' . $global_config['site_logo'], PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . '/' . $paths);
        }
        if (file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/README.txt')) {
            $zip->add(NV_ROOTDIR . '/' . NV_DATADIR . '/README.txt', PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . '/' . NV_DATADIR);
        }
        if (file_exists($tem_file)) {
            $file_src = $tem_file;
            $file_basename = $subfile . '.zip';
            $directory = NV_ROOTDIR . '/' . NV_TEMP_DIR;
        }
    }
}
$download = new NukeViet\Files\Download($file_src, $directory, $file_basename, $is_resume, $max_speed);
if ($is_zip) {
    $mtime = ($mtime = filemtime($session_files['fileupload'][$filename]['src'])) > 0 ? $mtime : NV_CURRENTTIME;
    $download->set_property('mtime', $mtime);
}
$download->download_file();
exit;