Commit 5a43e7a2 authored by tbrehm's avatar tbrehm

- Implemented new backup and restore functions for websites and databases (see also FS#1389)

- Added "actions" framework in server to replace the functions provided by the core modules
- Moved system update function from remoteactins core module to software update plugin.
parent 819fd7f2
ALTER TABLE `web_database` ADD `parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0' AFTER `server_id`;
ALTER TABLE `web_database` ADD `backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none', ADD `backup_copies` INT NOT NULL DEFAULT '1' AFTER `remote_ips`;
CREATE TABLE `web_backup` (
`backup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(10) unsigned NOT NULL,
`parent_domain_id` int(10) unsigned NOT NULL,
`backup_type` enum('web','mysql') NOT NULL DEFAULT 'web',
`backup_mode` varchar(64) NOT NULL DEFAULT '',
`tstamp` int(10) unsigned NOT NULL,
`filename` varchar(255) NOT NULL,
PRIMARY KEY (`backup_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......@@ -1437,6 +1437,23 @@ CREATE TABLE `webdav_user` (
-- --------------------------------------------------------
--
-- Table structure for table `web_backup`
--
CREATE TABLE `web_backup` (
`backup_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(10) unsigned NOT NULL,
`parent_domain_id` int(10) unsigned NOT NULL,
`backup_type` enum('web','mysql') NOT NULL DEFAULT 'web',
`backup_mode` varchar(64) NOT NULL DEFAULT '',
`tstamp` int(10) unsigned NOT NULL,
`filename` varchar(255) NOT NULL,
PRIMARY KEY (`backup_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `web_database`
--
......@@ -1449,6 +1466,7 @@ CREATE TABLE `web_database` (
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) unsigned NOT NULL DEFAULT '0',
`parent_domain_id` int(11) unsigned NOT NULL DEFAULT '0',
`type` varchar(16) NOT NULL DEFAULT 'y',
`database_name` varchar(64) DEFAULT NULL,
`database_user` varchar(64) DEFAULT NULL,
......@@ -1456,6 +1474,8 @@ CREATE TABLE `web_database` (
`database_charset` varchar(64) DEFAULT NULL,
`remote_access` enum('n','y') NOT NULL DEFAULT 'y',
`remote_ips` text NOT NULL,
`backup_interval` VARCHAR( 255 ) NOT NULL DEFAULT 'none',
`backup_copies` INT NOT NULL DEFAULT '1',
`active` enum('n','y') NOT NULL DEFAULT 'y',
PRIMARY KEY (`database_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
......
......@@ -13,7 +13,7 @@ hostname=server1.domain.tld
nameservers=192.168.0.1,192.168.0.2
loglevel=2
backup_dir=/var/backup
backup_dir_ftpread=n
backup_mode=rootgz
[mail]
module=postfix_mysql
......
<?php
/*
Copyright (c) 2012, Till Brehm, ISPConfig UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class plugin_backuplist extends plugin_base {
var $module;
var $form;
var $tab;
var $record_id;
var $formdef;
var $options;
function onShow() {
global $app;
$listTpl = new tpl;
$listTpl->newTemplate('templates/web_backup_list.htm');
//* Loading language file
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng";
include($lng_file);
$listTpl->setVar($wb);
$message = '';
$error = '';
if(isset($_GET['backup_action'])) {
$backup_id = intval($_GET['backup_id']);
if($_GET['backup_action'] == 'download' && $backup_id > 0) {
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
$tmp = $app->db->queryOneRecord($sql);
if($tmp['number'] == 0) {
$message .= $wb['download_info_txt'];
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
"VALUES (".
(int)$this->form->dataRecord['server_id'] . ", " .
time() . ", " .
"'backup_download', " .
"'".$backup_id."', " .
"'pending', " .
"''" .
")";
$app->db->query($sql);
} else {
$error .= $wb['download_pending_txt'];
}
}
if($_GET['backup_action'] == 'restore' && $backup_id > 0) {
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
$tmp = $app->db->queryOneRecord($sql);
if($tmp['number'] == 0) {
$message .= $wb['restore_info_txt'];
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
"VALUES (".
(int)$this->form->dataRecord['server_id'] . ", " .
time() . ", " .
"'backup_restore', " .
"'".$backup_id."', " .
"'pending', " .
"''" .
")";
$app->db->query($sql);
} else {
$error .= $wb['restore_pending_txt'];
}
}
}
//* Get the data
$sql = "SELECT * FROM web_backup WHERE parent_domain_id = ".$this->form->id." ORDER BY tstamp DESC, backup_type ASC";
$records = $app->db->queryAllRecords($sql);
$bgcolor = "#FFFFFF";
if(is_array($records)) {
foreach($records as $rec) {
// Change of color
$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
$rec["bgcolor"] = $bgcolor;
$rec['date'] = date($app->lng('conf_format_datetime'),$rec['tstamp']);
$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])];
$records_new[] = $rec;
}
}
$listTpl->setLoop('records',@$records_new);
$listTpl->setVar('parent_id',$this->form->id);
$listTpl->setVar('msg',$message);
$listTpl->setVar('error',$error);
// Setting Returnto information in the session
$list_name = 'backup_list';
// $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
$_SESSION["s"]["form"]["return_to"] = $list_name;
return $listTpl->grab();
}
}
?>
\ No newline at end of file
......@@ -138,11 +138,13 @@ $form["tabs"]['server'] = array(
'width' => '40',
'maxlength' => '255'
),
'backup_dir_ftpread' => array(
'backup_mode' => array(
'datatype' => 'VARCHAR',
'formtype' => 'CHECKBOX',
'default' => 'y',
'value' => array(0 => 'n', 1 => 'y')
'formtype' => 'SELECT',
'default' => 'userzip',
'value' => array('userzip' => 'backup_mode_userzip', 'rootgz' => 'backup_mode_rootgz'),
'width' => '40',
'maxlength' => '255'
),
##################################
# ENDE Datatable fields
......
......@@ -87,7 +87,9 @@ $wb["network_config_warning_txt"] = 'The network configuration option is only av
$wb["CA_path_txt"] = 'CA Path';
$wb["CA_pass_txt"] = 'CA passphrase';
$wb["fastcgi_config_syntax_txt"] = 'FastCGI config syntax';
$wb["backup_dir_ftpread_txt"] = 'Backup dir. readable for website FTP users.';
$wb["backup_mode_txt"] = 'Backup mode';
$wb["backup_mode_userzip"] = 'Backup web files owned by web user as zip';
$wb["backup_mode_rootgz"] = 'Backup all files in web directory as root user';
$wb["server_type_txt"] = 'Server Type';
$wb["nginx_vhost_conf_dir_txt"] = 'Nginx Vhost config dir';
$wb["nginx_vhost_conf_enabled_dir_txt"] = 'Nginx Vhost config enabled dir';
......@@ -153,7 +155,6 @@ $wb["set_folder_permissions_on_update_txt"] = 'Set folder permissions on update'
$wb["add_web_users_to_sshusers_group_txt"] = 'Add web users to -sshusers- group';
$wb["connect_userid_to_webid_txt"] = 'Connect Linux userid to webid';
$wb["connect_userid_to_webid_start_txt"] = 'Start ID for userid/webid connect';
$wb["realtime_blackhole_list_txt"] = 'Real-time Blackhole List';
$wb["realtime_blackhole_list_note_txt"] = '(Separate RBL\'s with commas)';
?>
\ No newline at end of file
......@@ -43,10 +43,10 @@
<input name="backup_dir" id="backup_dir" value="{tmpl_var name='backup_dir'}" size="40" maxlength="255" type="text" class="textInput" />
</div>
<div class="ctrlHolder">
<p class="label">{tmpl_var name='backup_dir_ftpread_txt'}</p>
<div class="multiField">
{tmpl_var name='backup_dir_ftpread'}
</div>
<label for="backup_mode">{tmpl_var name='backup_mode_txt'}</label>
<select name="backup_mode" id="backup_mode" class="selectInput">
{tmpl_var name='backup_mode'}
</select>
</div>
</fieldset>
......
......@@ -269,6 +269,12 @@ function del_record(link,confirmation) {
}
}
function confirm_action(link,confirmation) {
if(window.confirm(confirmation)) {
loadContent(link);
}
}
function loadContentInto(elementid,pagename) {
var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
......
......@@ -231,14 +231,14 @@ class page_action extends tform_actions {
// Spamfilter policy
$policy_id = intval($this->dataRecord["policy"]);
if($policy_id > 0) {
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".mysql_real_escape_string($this->dataRecord["email"])."'");
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
if($tmp_user["id"] > 0) {
// There is already a record that we will update
$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
} else {
// We create a new record
$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".mysql_real_escape_string($this->dataRecord["email"])."', '".mysql_real_escape_string($this->dataRecord["email"])."', 'Y')";
VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($this->dataRecord["email"])."', '".$app->db->quote($this->dataRecord["email"])."', 'Y')";
$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
}
} // endif spamfilter policy
......@@ -266,7 +266,7 @@ class page_action extends tform_actions {
// Spamfilter policy
$policy_id = intval($this->dataRecord["policy"]);
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".mysql_real_escape_string($this->dataRecord["email"])."'");
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
if($policy_id > 0) {
if($tmp_user["id"] > 0) {
// There is already a record that we will update
......@@ -274,7 +274,7 @@ class page_action extends tform_actions {
} else {
// We create a new record
$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".mysql_real_escape_string($this->dataRecord["email"])."', '".mysql_real_escape_string($this->dataRecord["email"])."', 'Y')";
VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($this->dataRecord["email"])."', '".$app->db->quote($this->dataRecord["email"])."', 'Y')";
$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
}
}else {
......
......@@ -92,20 +92,6 @@ class page_action extends tform_actions {
$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
unset($tmp);
// Fill the client select field
$sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
$clients = $app->db->queryAllRecords($sql);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
//$tmp_data_record = $app->tform->getDataRecord($this->id);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
$app->tpl->setVar("client_group_id",$client_select);
} else {
// The user is admin
......@@ -117,33 +103,6 @@ class page_action extends tform_actions {
$server_id = $tmp['server_id'];
}
$sql = "SELECT ip_address FROM server_ip WHERE server_id = $server_id";
$ips = $app->db->queryAllRecords($sql);
$ip_select = "<option value='*'>*</option>";
//$ip_select = "";
if(is_array($ips)) {
foreach( $ips as $ip) {
$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
}
}
$app->tpl->setVar("ip_address",$ip_select);
unset($tmp);
unset($ips);
// Fill the client select field
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
$clients = $app->db->queryAllRecords($sql);
$client_select = "<option value='0'></option>";
//$tmp_data_record = $app->tform->getDataRecord($this->id);
if(is_array($clients)) {
foreach( $clients as $client) {
$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
}
}
$app->tpl->setVar("client_group_id",$client_select);
}
/*
......@@ -212,9 +171,6 @@ class page_action extends tform_actions {
}
}
// Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
}
......@@ -224,10 +180,8 @@ class page_action extends tform_actions {
function onBeforeUpdate() {
global $app, $conf, $interfaceConf;
/*
* If the names should be restricted -> do it!
*/
//* Site shell not be empty
if($this->dataRecord['parent_domain_id'] == 0) $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty").'<br />';
//* Get the database name and database user prefix
$app->uses('getconf');
......@@ -290,6 +244,9 @@ class page_action extends tform_actions {
function onBeforeInsert() {
global $app, $conf, $interfaceConf;
//* Site shell not be empty
if($this->dataRecord['parent_domain_id'] == 0) $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty").'<br />';
//* Database username and database name shall not be empty
if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />';
if($this->dataRecord['database_user'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"].'<br />';
......@@ -331,30 +288,32 @@ class page_action extends tform_actions {
function onAfterInsert() {
global $app, $conf;
// make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
// also make sure that the user can not delete domain created by a admin
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE web_database SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_id = ".$this->id);
}
if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE web_database SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_id = ".$this->id);
if($this->dataRecord["parent_domain_id"] > 0) {
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
//* The Database user shall be owned by the same group then the website
$sys_groupid = $web['sys_groupid'];
$backup_interval = $web['backup_interval'];
$backup_copies = $web['backup_copies'];
$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
$app->db->query($sql);
}
}
function onAfterUpdate() {
global $app, $conf;
// make sure that the record belongs to the client group and not the admin group when a admin inserts it
// also make sure that the user can not delete domain created by a admin
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE web_database SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_id = ".$this->id);
}
if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) {
$client_group_id = intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE web_database SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_id = ".$this->id);
if($this->dataRecord["parent_domain_id"] > 0) {
$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
//* The Database user shall be owned by the same group then the website
$sys_groupid = $web['sys_groupid'];
$backup_interval = $web['backup_interval'];
$backup_copies = $web['backup_copies'];
$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
$app->db->query($sql);
}
}
......
......@@ -69,6 +69,17 @@ $form["tabs"]['database'] = array (
),
'value' => ''
),
'parent_domain_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
'keyfield'=> 'domain_id',
'valuefield'=> 'domain'
),
'value' => array('0' => $app->tform->lng('select_site_txt'))
),
'type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
......
......@@ -431,7 +431,7 @@ $form["tabs"]['stats'] = array (
)
);
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// if($_SESSION["s"]["user"]["typ"] == 'admin') {
//* Backup
$form["tabs"]['backup'] = array (
......@@ -458,10 +458,17 @@ $form["tabs"]['backup'] = array (
##################################
# ENDE Datatable fields
##################################
),
'plugins' => array (
'backup_records' => array (
'class' => 'plugin_backuplist',
'options' => array(
)
)
)
);
}
// }
if($_SESSION["s"]["user"]["typ"] == 'admin') {
......
......@@ -22,4 +22,9 @@ $wb["database_name_change_txt"] = 'The database name can not be changed';
$wb["database_charset_change_txt"] = 'The database charset can not be changed';
$wb["database_name_error_len"] = 'Database name - {db} - too long. The max. database name length incl. prefix is 64 chars.';
$wb["database_user_error_len"] = 'Database username - {user}- too long. The max. database username length incl. prefix is 16 chars.';
$wb["parent_domain_id_txt"] = 'Site';
$wb["database_site_error_empty"] = 'Select the site to which the database belongs.';
$wb["select_site_txt"] = '- Select Site -';
$wb["btn_save_txt"] = 'Save';
$wb["btn_cancel_txt"] = 'Cancel';
?>
<?php
$wb['list_head_txt'] = 'Existing backups';
$wb['date_txt'] = 'Date';
$wb['backup_type_txt'] = 'Type';
$wb['filename_txt'] = 'Backup file';
$wb['restore_backup_txt'] = 'Restore backup';
$wb['download_backup_txt'] = 'Download backup';
$wb['download_info_txt'] = 'The backup file will be available for download in the backup folder of the website in a few minutes.';
$wb['restore_info_txt'] = 'Restore of the backup has been started. This action takes several minutes to be completed.';
$wb['restore_confirm_txt'] = 'Restoring will overwrite existing files in your website. Do you really want to restore this backup?';
$wb['download_pending_txt'] = 'There is already a pending backup download job.';
$wb['restore_pending_txt'] = 'There is already a pending backup restore job.';
$wb['backup_type_mysql'] = 'MySQL Database';
$wb['backup_type_web'] = 'Website files';
?>
\ No newline at end of file
......@@ -20,21 +20,13 @@
</select>
</tmpl_if>
</div>
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
<select name="client_group_id" id="client_group_id" class="selectInput">
{tmpl_var name='client_group_id'}
</select>
</div>
</tmpl_if>
<tmpl_if name="is_reseller">
<div class="ctrlHolder">
<label for="client_group_id">{tmpl_var name='client_txt'}</label>
<select name="client_group_id" id="client_group_id" class="selectInput">
{tmpl_var name='client_group_id'}
<label for="parent_domain_id">{tmpl_var name='parent_domain_id_txt'}</label>
<select name="parent_domain_id" id="parent_domain_id" class="selectInput">
{tmpl_var name='parent_domain_id'}
</select>
</div>
</tmpl_if>
<div class="ctrlHolder">
<label for="type">{tmpl_var name='type_txt'}</label>
<select name="type" id="type" class="selectInput formLengthHalf">
......
<tmpl_if name="msg">
<div id="OKMsg"><p><tmpl_var name="msg"></p></div>
</tmpl_if>
<tmpl_if name="error">
<div id="errorMsg"><h3>ERROR</h3><ol><tmpl_var name="error"></ol></div>
</tmpl_if>
<h3><tmpl_var name="list_head_txt"></h3>
<div class="pnl_listarea">
<fieldset><legend><tmpl_var name="list_head_txt"></legend>
<table class="list">
<thead>
<tr>
<th class="tbl_col_date" scope="col"><tmpl_var name="date_txt"></th>
<th class="tbl_col_date" scope="col"><tmpl_var name="backup_type_txt"></th>
<th class="tbl_col_filename" scope="col"><tmpl_var name="filename_txt"></th>
<th class="tbl_col_buttons" scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
<tmpl_loop name="records">
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td class="tbl_col_date">{tmpl_var name="date"}</td>
<td class="tbl_col_date">{tmpl_var name="backup_type"}</td>
<td class="tbl_col_filename">{tmpl_var name="filename"}</td>
<td class="tbl_col_buttons" style="width:300px;">
<div class="buttons" >
<button class="iconstxt icoRestore" type="button" onClick="confirm_action('sites/web_domain_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=restore&backup_id={tmpl_var name='backup_id'}','{tmpl_var name='restore_confirm_txt'}');">
<span>{tmpl_var name="restore_backup_txt"}</span>
</button>
<button class="iconstxt icoDownload" type="button" onClick="loadContent('sites/web_domain_edit.php?id={tmpl_var name='parent_id'}&next_tab=backup&backup_action=download&backup_id={tmpl_var name='backup_id'}');">
<span>{tmpl_var name="download_backup_txt"}</span>
</button>
</div>
</td>
</tr>
</tmpl_loop>
</tbody>
</table>
</fieldset>
</div>
......@@ -19,6 +19,8 @@
</div>
</fieldset>
{tmpl_var name='backup_records'}
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<div class="buttonHolder buttons">
......
......@@ -96,7 +96,7 @@ function getClientID($dataRecord) {
}
}
/* get the name of the client */
$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . $client_group_id);
$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . intval($client_group_id));
$clientID = $tmp['client_id'];
if ($clientID == '') $clientID = '0';
return $clientID;
......