95 lines
1.8 KiB
PHP
Executable File
95 lines
1.8 KiB
PHP
Executable File
<?php
|
|
|
|
$func = include('includes/auth.php');
|
|
|
|
$func(function () {
|
|
|
|
ini_set('max_execution_time', 0);
|
|
|
|
if ( array_key_exists('export', $_GET) ) {
|
|
|
|
Core::skipLog();
|
|
|
|
$date = date('Ymd-His', time());
|
|
$dir = sprintf(
|
|
'../app/cache/tmp/%1$s/backups/%2$s',
|
|
$_SESSION['Auth']['user']['id'],
|
|
$date
|
|
);
|
|
|
|
if ( !file_exists($dir) )
|
|
mkdir($dir, 0777, 1);
|
|
|
|
FileSystem::zip($dir . '/filesystem.zip', '..', '../app/cache/tmp');
|
|
|
|
/*
|
|
// export database
|
|
file_put_contents(
|
|
sprintf(
|
|
'%1$s/database.sql',
|
|
$dir
|
|
),
|
|
EngineSystem::get('utils')
|
|
->load('MySQLExport.sql.setml')
|
|
->run(array('provider' => 'cine'))
|
|
->getData('')
|
|
);
|
|
*/
|
|
|
|
FileSystem::zip($fff = $dir . '/' . $_SERVER['HTTP_HOST'] . '-' . $date . '.zip', $dir);
|
|
|
|
//~ header('Content-Transfer-Encoding: binary');
|
|
header(sprintf(
|
|
'Content-Disposition: attachment; filename="%2$s-%1$s.zip"',
|
|
$date,
|
|
$_SERVER['HTTP_HOST']
|
|
));
|
|
header(sprintf(
|
|
'Content-Length: %1$s',
|
|
filesize($fff)
|
|
));
|
|
readfile(sprintf(
|
|
'%1$s/%3$s-%2$s.zip',
|
|
$dir,
|
|
$date,
|
|
$_SERVER['HTTP_HOST']
|
|
));
|
|
|
|
FileSystem::rm('system/tmp/' . $_SESSION['Auth']['user']['id'] . '/backups');
|
|
|
|
}
|
|
|
|
if ( !empty($_POST) ) {
|
|
|
|
if ( array_key_exists('cancel', $_POST) )
|
|
die(header('Location: ' . $_SERVER['HTTP_REFERER']));
|
|
|
|
if ( !empty($_POST['conf']) ) {
|
|
|
|
if ( !$_POST['conf']['runtime']['mode'] ) {
|
|
|
|
$_POST['conf']['mode'] = 'debug';
|
|
$_POST['conf']['runtime']['preprocessor'] = 1;
|
|
|
|
}
|
|
|
|
Core::setConf($_POST['conf']);
|
|
|
|
|
|
} elseif ( !empty($_POST['cache']) ) {
|
|
|
|
Core::emptyCache($_POST['cache']['mode']);
|
|
|
|
}
|
|
|
|
header('Location:' . $_SERVER['HTTP_REFERER']);
|
|
die();
|
|
|
|
}
|
|
|
|
echo EngineSystem::get('back')->load('pages/system.html')->run(Core::getConf())->getData('');
|
|
|
|
});
|
|
|
|
?>
|