Файл: sources/admin/backup_database.php
Строк: 33
<?php
if (!defined('VAPHP'))
{
die("Этот файл недоступен.");
}
class backup_database extends base
{
function backup_database()
{
global $CONF, $DB, $FORM, $LNG, $TMPL;
if (!isset($FORM['submit']))
{
$TMPL['header'] = $LNG['a_backup_header'];
$TMPL['admin_content'] = <<<EndHTML
{$LNG['a_backup_warn']}<br><br>
<form action="{$TMPL['site_url']}/index.php?a=admin&b=backup_database" method="post">
<input type="submit" class="ButtonNormal" name="submit" value="{$LNG['a_backup_header']}" />
</form>
EndHTML;
}
else
{
$tables_to_backup = array(
"{$CONF['sql_prefix']}_bad_words" => true,
"{$CONF['sql_prefix']}_cat" => true,
"{$CONF['sql_prefix']}_sessions" => false,
"{$CONF['sql_prefix']}_settings" => true,
"{$CONF['sql_prefix']}_sites" => true,
"{$CONF['sql_prefix']}_subcat" => true,
);
header('Pragma: no-cache');
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Content-Disposition: attachment; filename="' . $CONF['list_name'] . date(' Y-m-d') . '.sql"');
header('Content-Type: text/x-sql');
foreach($tables_to_backup as $table_name => $save_data)
{
echo $DB->get_table($table_name, $save_data);
}
exit;
}
}
}
?>