function download_scenarios($aSims) { // Define the PEAR installation path require_once MAX_PATH . '/lib/pear/Archive/Tar.php'; $oTar = new Archive_Tar(TMP_PATH . '/scenarios.tar.gz'); $aResult = array(); $aFiles = ''; foreach ($aSims as $k => $v) { $aData = get_simulation_file_list(SCENARIOS_DATASETS, '', false, $k); foreach ($aData as $k1 => $v1) { $aFiles .= FOLDER_DATA . '/' . $v1 . ' '; } $aFiles .= FOLDER_SAVE . '/' . $k . '.php '; } $tmpdir = getcwd(); chdir(SIM_PATH); $oTar->create($aFiles); $aResult = $oTar->listContent(); chdir($tmpdir); return 'scenarios.tar.gz'; }
<?php /* +---------------------------------------------------------------------------+ | Revive Adserver | | http://www.revive-adserver.com | | | | Copyright: See the COPYRIGHT.txt file. | | License: GPLv2 or later, see the LICENSE.txt file. | +---------------------------------------------------------------------------+ */ check_environment(); if (array_key_exists('submit', $_REQUEST)) { $file = download_scenarios($_REQUEST['download']); header('Content-type: application/x-gzip'); header('Content-Disposition: attachment; filename="' . $file . '"'); readfile(TMP_PATH . '/' . $file); die; } include TPL_PATH . '/frameheader.html'; $aSims = get_simulation_file_list(FOLDER_SAVE, 'php', true); include TPL_PATH . '/body_download_scenario.html';