示例#1
0
 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}");
 }
示例#2
0
?>
</a>&nbsp;</span>
          <input type='submit' value='<?php 
echo t('DELETE_CHECKED');
?>
' />&nbsp;
          <a id="deleteallLink" href="index.php?controller=post&amp;action=deleteAll"><?php 
echo t('DELETE_ALL');
?>
</a>&nbsp;
          <a id="deleteallreplyLink" href="index.php?controller=reply&amp;action=deleteAll"><?php 
echo t('DELETE_ALL_REPLY');
?>
</a>
          <?php 
if (is_flatfile()) {
    ?>
<a href="index.php?controller=backup&amp;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&amp;action=update" method="post">
          <table class="table2">
          <thead>
示例#3
0
 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");
 }