Skip to content

Commit 82cf1e8

Browse files
author
Marius Cramer
committed
Merge branch 'renky/ispconfig3-master'
Conflicts: interface/web/mail/templates/mail_user_backup_list.htm
2 parents f3f4aa5 + f42d916 commit 82cf1e8

38 files changed

+251
-38
lines changed

install/sql/incremental/upd_dev_collection.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ NS|{DOMAIN}.|{NS2}.|0|3600
3232
MX|{DOMAIN}.|mail.{DOMAIN}.|10|3600
3333
TXT|{DOMAIN}.|v=spf1 mx a ~all|0|3600' WHERE `dns_template`.`template_id` = 1;
3434

35+
ALTER TABLE `mail_backup` CHANGE `filesize` `filesize` VARCHAR(20) NOT NULL DEFAULT '';
36+
ALTER TABLE `web_backup` CHANGE `filesize` `filesize` VARCHAR(20) NOT NULL DEFAULT '';

install/sql/ispconfig3.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ CREATE TABLE `mail_backup` (
703703
`backup_mode` varchar(64) NOT NULL DEFAULT '',
704704
`tstamp` int(10) unsigned NOT NULL DEFAULT '0',
705705
`filename` varchar(255) NOT NULL DEFAULT '',
706-
`filesize` VARCHAR(10) NOT NULL DEFAULT '',
706+
`filesize` VARCHAR(20) NOT NULL DEFAULT '',
707707
PRIMARY KEY (`backup_id`)
708708
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
709709

@@ -1746,7 +1746,7 @@ CREATE TABLE `web_backup` (
17461746
`backup_mode` varchar(64) NOT NULL DEFAULT '',
17471747
`tstamp` int(10) unsigned NOT NULL DEFAULT '0',
17481748
`filename` varchar(255) NOT NULL DEFAULT '',
1749-
`filesize` VARCHAR(10) NOT NULL DEFAULT '',
1749+
`filesize` VARCHAR(20) NOT NULL DEFAULT '',
17501750
PRIMARY KEY (`backup_id`)
17511751
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
17521752

install/tpl/system.ini.master

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ webdavuser_prefix=[CLIENTNAME]
2323
dblist_phpmyadmin_link=y
2424
phpmyadmin_url=/phpmyadmin
2525
webftp_url=
26+
vhost_subdomains=n
27+
vhost_aliasdomains=n
2628
client_username_web_check_disabled=n
29+
backups_include_into_web_quota=n
2730
reseller_can_use_options=n
2831

32+
2933
[tools]
3034

3135
[domains]

interface/lib/classes/plugin_backuplist_mail.inc.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class plugin_backuplist_mail extends plugin_base {
3939

4040
function onShow() {
4141
global $app;
42+
43+
$app->uses('functions');
44+
4245
$listTpl = new tpl;
4346
$listTpl->newTemplate('templates/mail_user_backup_list.htm');
4447

@@ -53,7 +56,7 @@ function onShow() {
5356
if(isset($_GET['backup_action'])) {
5457
$backup_id = $app->functions->intval($_GET['backup_id']);
5558
/*
56-
if($_GET['backup_action'] == 'download' && $backup_id > 0) {
59+
if($_GET['backup_action'] == 'download_mail' && $backup_id > 0) {
5760
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
5861
$tmp = $app->db->queryOneRecord($sql);
5962
if($tmp['number'] == 0) {
@@ -73,16 +76,16 @@ function onShow() {
7376
}
7477
}
7578
*/
76-
if($_GET['backup_action'] == 'restore' && $backup_id > 0) {
77-
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
79+
if($_GET['backup_action'] == 'restore_mail' && $backup_id > 0) {
80+
$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore_mail' AND action_param = '$backup_id'";
7881
$tmp = $app->db->queryOneRecord($sql);
7982
if($tmp['number'] == 0) {
8083
$message .= $wb['restore_info_txt'];
8184
$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
8285
"VALUES (".
8386
(int)$this->form->dataRecord['server_id'] . ", " .
8487
time() . ", " .
85-
"'backup_restore', " .
88+
"'backup_restore_mail', " .
8689
"'".$backup_id."', " .
8790
"'pending', " .
8891
"''" .
@@ -105,6 +108,7 @@ function onShow() {
105108
$rec["bgcolor"] = $bgcolor;
106109
$rec['date'] = date($app->lng('conf_format_datetime'),$rec['tstamp']);
107110
$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])];
111+
$rec['filesize'] = $app->functions->formatBytes($rec['filesize']);
108112
$records_new[] = $rec;
109113
}
110114
}

interface/lib/classes/remote.d/mail.inc.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,71 @@ public function mail_user_filter_delete($session_id, $primary_id)
309309
// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
310310
return $affected_rows;
311311
}
312+
313+
// Mail backup list function by Dominik Müller, info@profi-webdesign.net
314+
public function mail_user_backup_list($session_id, $primary_id = null)
315+
{
316+
global $app;
317+
318+
if(!$this->checkPerm($session_id, 'mail_user_backup')) {
319+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
320+
return false;
321+
}
322+
323+
if ($site_id != null) {
324+
$sql = "SELECT * FROM mail_backup WHERE parent_domain_id = ".$app->functions->intval($site_id);
325+
}
326+
else {
327+
$sql = "SELECT * FROM mail_backup";
328+
}
329+
330+
$result = $app->db->queryAllRecords($sql);
331+
return $result;
332+
}
333+
334+
// Mail backup restore/download functions by Dominik Müller, info@profi-webdesign.net
335+
public function mail_user_backup($session_id, $primary_id, $action_type)
336+
{
337+
global $app;
338+
339+
if(!$this->checkPerm($session_id, 'mail_user_backup')) {
340+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
341+
return false;
342+
}
343+
344+
//*Set variables
345+
$backup_record = $app->db->queryOneRecord("SELECT * FROM `mail_backup` WHERE `backup_id`='$primary_id'");
346+
$server_id = $backup_record['server_id'];
347+
348+
//*Set default action state
349+
$action_state = "pending";
350+
$tstamp = time();
351+
352+
//* Basic validation of variables
353+
if ($server_id <= 0) {
354+
$this->server->fault('invalid_backup_id', "Invalid or non existant backup_id $primary_id");
355+
return false;
356+
}
357+
358+
if (/*$action_type != 'backup_download_mail' and*/ $action_type != 'backup_restore_mail') {
359+
$this->server->fault('invalid_action', "Invalid action_type $action_type");
360+
return false;
361+
}
362+
363+
//* Validate instance
364+
$instance_record = $app->db->queryOneRecord("SELECT * FROM `sys_remoteaction` WHERE `action_param`='$primary_id' and `action_type`='$action_type' and `action_state`='pending'");
365+
if ($instance_record['action_id'] >= 1) {
366+
$this->server->fault('duplicate_action', "There is already a pending $action_type action");
367+
return false;
368+
}
369+
370+
//* Save the record
371+
if ($app->db->query("INSERT INTO `sys_remoteaction` SET `server_id` = '$server_id', `tstamp` = '$tstamp', `action_type` = '$action_type', `action_param` = '$primary_id', `action_state` = '$action_state'")) {
372+
return true;
373+
} else {
374+
return false;
375+
}
376+
}
312377

313378
//* Get alias details
314379
public function mail_alias_get($session_id, $primary_id)

interface/web/admin/form/system_config.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@
166166
'default' => 'n',
167167
'value' => array(0 => 'n', 1 => 'y')
168168
),
169+
'backups_include_into_web_quota' => array (
170+
'datatype' => 'VARCHAR',
171+
'formtype' => 'CHECKBOX',
172+
'default' => 'n',
173+
'value' => array(0 => 'n', 1 => 'y')
174+
),
169175
'reseller_can_use_options' => array (
170176
'datatype' => 'VARCHAR',
171177
'formtype' => 'CHECKBOX',

interface/web/admin/lib/lang/ar_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $wb['use_combobox_txt'] = 'Use jQuery UI Combobox';
4848
$wb['use_loadindicator_txt'] = 'Use Load Indicator';
4949
$wb['f5_to_reload_js_txt'] = 'If you change this, you might have to press F5 to make the browser reload JavaScript libraries or empty your browser cache.';
5050
$wb['client_username_web_check_disabled_txt'] = 'Disable client username check for the word \'web\'.';
51+
$wb['backups_include_into_web_quota_txt'] = 'Include backup files into web quota.';
5152
$wb['mailbox_show_autoresponder_tab_txt'] = 'Show autoresponder tab in mail account details';
5253
$wb['mailbox_show_mail_filter_tab_txt'] = 'Show mail filter tab in mail account details';
5354
$wb['mailbox_show_custom_rules_tab_txt'] = 'Show custom mailfilter tab in mail account details';

interface/web/admin/lib/lang/bg_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $wb['use_combobox_txt'] = 'Use jQuery UI Combobox';
4848
$wb['use_loadindicator_txt'] = 'Use Load Indicator';
4949
$wb['f5_to_reload_js_txt'] = 'If you change this, you might have to press F5 to make the browser reload JavaScript libraries or empty your browser cache.';
5050
$wb['client_username_web_check_disabled_txt'] = 'Disable client username check for the word \'web\'.';
51+
$wb['backups_include_into_web_quota_txt'] = 'Include backup files into web quota.';
5152
$wb['mailbox_show_autoresponder_tab_txt'] = 'Show autoresponder tab in mail account details';
5253
$wb['mailbox_show_mail_filter_tab_txt'] = 'Show mail filter tab in mail account details';
5354
$wb['mailbox_show_custom_rules_tab_txt'] = 'Show custom mailfilter tab in mail account details';

interface/web/admin/lib/lang/br_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $wb['use_combobox_txt'] = 'Use jQuery UI Combobox';
4848
$wb['use_loadindicator_txt'] = 'Use Load Indicator';
4949
$wb['f5_to_reload_js_txt'] = 'If you change this, you might have to press F5 to make the browser reload JavaScript libraries or empty your browser cache.';
5050
$wb['client_username_web_check_disabled_txt'] = 'Disable client username check for the word \'web\'.';
51+
$wb['backups_include_into_web_quota_txt'] = 'Include backup files into web quota.';
5152
$wb['mailbox_show_autoresponder_tab_txt'] = 'Show autoresponder tab in mail account details';
5253
$wb['mailbox_show_mail_filter_tab_txt'] = 'Show mail filter tab in mail account details';
5354
$wb['mailbox_show_custom_rules_tab_txt'] = 'Show custom mailfilter tab in mail account details';

interface/web/admin/lib/lang/cz_system_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $wb['use_combobox_txt'] = 'Použití jQuery UI Combobox';
4848
$wb['use_loadindicator_txt'] = 'Použití indikátoru zatížení';
4949
$wb['f5_to_reload_js_txt'] = 'Pokud vypnete tuto volbu, zřejmě budete muset používat klávesu F5, aby internetový prohlížeč znovu načetl JavaScript knihovny nebo budete muset ručně vyprázdňovat mezipaměť (cache) vašeho internetového prohlížeče.';
5050
$wb['client_username_web_check_disabled_txt'] = 'Disable client username check for the word \'web\'.';
51+
$wb['backups_include_into_web_quota_txt'] = 'Include backup files into web quota.';
5152
$wb['mailbox_show_autoresponder_tab_txt'] = 'Show Autoresponder tab in Mailbox detail';
5253
$wb['mailbox_show_mail_filter_tab_txt'] = 'Show Mail Filter tab in Mailbox detail';
5354
$wb['mailbox_show_custom_rules_tab_txt'] = 'Show Custom Rules tab in Mailbox detail';

0 commit comments

Comments
 (0)