function copy_dir($abs_item, $abs_new_item) { if (nx_isFTPMode()) { $tmp_dir = nx_ftp_make_local_copy($abs_item); $res = $GLOBALS['FTPCONNECTION']->putRecursive($tmp_dir, $abs_new_item); remove($tmp_dir); return $res; } else { return copy_dir($abs_item, $abs_new_item); } }
function download_item($dir, $item, $unlink = false) { // download file global $action; // Security Fix: $item = basename($item); while (@ob_end_clean()) { } ob_start(); if (nx_isFTPMode()) { $abs_item = $dir . '/' . $item; } else { $abs_item = get_abs_item($dir, $item); if (!strstr($abs_item, realpath($GLOBALS['home_dir']))) { $abs_item = realpath($GLOBALS['home_dir']) . $abs_item; } } if (($GLOBALS["permissions"] & 01) != 01) { show_error($GLOBALS["error_msg"]["accessfunc"]); } if (!$GLOBALS['nx_File']->file_exists($abs_item)) { show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]); } if (!get_show_item($dir, $item)) { show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]); } if (nx_isFTPMode()) { $abs_item = nx_ftp_make_local_copy($abs_item); $unlink = true; } $browser = id_browser(); header('Content-Type: ' . ($browser == 'IE' || $browser == 'OPERA' ? 'application/octetstream' : 'application/octet-stream')); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize(realpath($abs_item))); //header("Content-Encoding: none"); if ($browser == 'IE') { header('Content-Disposition: attachment; filename="' . $item . '"'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header('Content-Disposition: attachment; filename="' . $item . '"'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); } @set_time_limit(0); @readFileChunked($abs_item); if ($unlink == true) { unlink($abs_item); } ob_end_flush(); nx_exit(); }