public function actionCreate() { global $db_url; $url = parse_url($db_url); $url['path'] = urldecode($url['path']); $dbname = substr($url['path'], 1); is_admin(); $dir = "data/{$dbname}/"; if (!class_exists('ZipArchive')) { show_message(t('BACKUP_NOTSUPPORT'), true, 'index.php?action=control_panel&subtab=message'); } if (!is_flatfile()) { show_message(t('BACKUP_TYPE_NOTSUPPORT'), true, 'index.php?action=control_panel&subtab=message'); } $zip = new ZipArchive(); $filename = $dir . "backup-" . date('Ymd', time()) . ".zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open <{$filename}>\n"); } $d = dir($dir); while (false !== ($entry = $d->read())) { if (substr($entry, -4) == '.txt') { $zip->addFile($dir . $entry); } } $d->close(); $zip->close(); header("Location:{$filename}"); }
?> </a> </span> <input type='submit' value='<?php echo t('DELETE_CHECKED'); ?> ' /> <a id="deleteallLink" href="index.php?controller=post&action=deleteAll"><?php echo t('DELETE_ALL'); ?> </a> <a id="deleteallreplyLink" href="index.php?controller=reply&action=deleteAll"><?php echo t('DELETE_ALL_REPLY'); ?> </a> <?php if (is_flatfile()) { ?> <a href="index.php?controller=backup&action=create"><?php echo t('BACKUP'); } ?> </a> </td></tr> </table> </form> </div> <div class="tab-pane" id="ban_ip"> <form id="banip_manage" action="index.php?controller=badip&action=update" method="post"> <table class="table2"> <thead>
public function actionLogout() { if (isset($_SESSION['user'])) { unset($_SESSION['user']); session_destroy(); } if (isset($_SESSION['admin'])) { if (is_flatfile()) { delete_backup_files(); } unset($_SESSION['admin']); session_destroy(); } header("Location:index.php"); }