root/trunk/gui/client/backup.php

Revision 1359, 3.1 kB (checked in by scitech, 2 months ago)

Fixed #1544: Add SQL user has only one option -> useless. Fixed #1545: HTML bug with hint for updates. Fixed #1546: Tiny english typo

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21 require '../include/ispcp-lib.php';
22
23 check_login(__FILE__);
24
25 $tpl = new pTemplate();
26 $tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/backup.tpl');
27 $tpl->define_dynamic('page_message', 'page');
28 $tpl->define_dynamic('logged_from', 'page');
29
30 // page functions.
31
32 function send_backup_restore_request(&$sql, $user_id) {
33     if (isset($_POST['uaction']) && $_POST['uaction'] === 'bk_restore') {
34         check_for_lock_file();
35
36         $query = <<<SQL_QUERY
37         UPDATE
38             domain
39         SET
40             domain_status = 'restore'
41         WHERE
42             domain_admin_id = ?
43 SQL_QUERY;
44
45         $rs = exec_query($sql, $query, array($user_id));
46
47         send_request();
48         write_log($_SESSION['user_logged'] . ": restore backup files.");
49         set_page_message(tr('Backup archive scheduled for restoring!'));
50     }
51 }
52
53 // common page data.
54
55 $theme_color = Config::get('USER_INITIAL_THEME');
56
57 $tpl->assign(
58         array(
59             'TR_CLIENT_BACKUP_PAGE_TITLE' => tr('ispCP - Client/Daily Backup'),
60             'THEME_COLOR_PATH' => "../themes/$theme_color",
61             'THEME_CHARSET' => tr('encoding'),
62             'ISP_LOGO' => get_logo($_SESSION['user_id'])
63             )
64         );
65
66 // dynamic page data.
67
68 send_backup_restore_request($sql, $_SESSION['user_id']);
69
70 // static page messages.
71
72 gen_client_mainmenu($tpl, Config::get('CLIENT_TEMPLATE_PATH') . '/main_menu_webtools.tpl');
73 gen_client_menu($tpl, Config::get('CLIENT_TEMPLATE_PATH') . '/menu_webtools.tpl');
74
75 gen_logged_from($tpl);
76
77 check_permissions($tpl);
78
79 if (Config::get('ZIP') == "gzip") {
80     $name = "backup_YYYY_MM_DD.tar.gz";
81 } else {
82     $name = "backup_YYYY_MM_DD.tar.bz2";
83 }
84
85 $tpl->assign(
86         array(
87             'TR_BACKUP' => tr('Backup'),
88             'TR_DAILY_BACKUP' => tr('Daily backup'),
89             'TR_DOWNLOAD_DIRECTION' => tr("Instructions to download today's backup"),
90             'TR_FTP_LOG_ON' => tr('Login with your FTP account'),
91             'TR_SWITCH_TO_BACKUP' => tr('Switch to backups/ directory'),
92             'TR_DOWNLOAD_FILE' => tr('Download the files stored in this directory'),
93             'TR_USUALY_NAMED' => tr('(usually named') . ' ' . $name . ')',
94             'TR_RESTORE_BACKUP' => tr('Restore backup'),
95             'TR_RESTORE_DIRECTIONS' => tr('Click the Restore button and the system will restore the last daily backup'),
96             'TR_RESTORE' => tr('Restore'),
97             'TR_CONFIRM_MESSAGE' => tr('Are you sure you want to restore the backup?')
98             )
99         );
100
101 gen_page_message($tpl);
102
103 $tpl->parse('PAGE', 'page');
104 $tpl->prnt();
105
106 if (Config::get('DUMP_GUI_DEBUG'))
107     dump_gui_debug();
108
109 unset_messages();
110
111 ?>
Note: See TracBrowser for help on using the browser.