Admidio/admidio

View on GitHub
adm_program/installation/install_steps/download_config.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
 ***********************************************************************************************
 * Installation step: download_config
 *
 * @copyright The Admidio Team
 * @see https://www.admidio.org/
 * @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
 ***********************************************************************************************
 */
if (basename($_SERVER['SCRIPT_FILENAME']) === 'download_config.php') {
    exit('This page may not be called directly!');
}

$filename   = 'config.php';
$fileLength = strlen($_SESSION['config_file_content']);

header('Content-Type: text/plain; charset=utf-8');
header('Content-Length: '.$fileLength);
header('Content-Disposition: attachment; filename="'.$filename.'"');
echo $_SESSION['config_file_content'];
exit();