From 1f50209744f36c1602b11a3787dacfd3ea76527e Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 20 Jul 2015 04:23:33 -0400
Subject: [PATCH] Merge branch 'master' into 'master'

---
 interface/web/vm/lib/lang/fr_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/se_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/ar_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/ja_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/ro_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/pl_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/hu_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/sk_openvz_template.lng             |    2 
 install/lib/installer_base.lib.php                           |   11 +-
 install/sql/ispconfig3.sql                                   |    2 
 interface/web/vm/lib/lang/hu_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/pt_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/el_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/sk_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/de_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/tr_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/cz_openvz_template.lng             |    3 
 interface/web/vm/lib/lang/de_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/it_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/hr_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/br_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/id_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/nl_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/fi_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/pl_openvz_vm.lng                   |    2 
 server/lib/classes/cron.d/500-backup_mail.inc.php            |   38 ++++---
 interface/web/vm/lib/lang/br_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/es_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/ru_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/se_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/ar_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/id_openvz_template.lng             |    2 
 install/tpl/fedora_amavisd_conf.master                       |    2 
 interface/web/vm/lib/lang/tr_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/en_openvz_template.lng             |    3 
 interface/web/vm/lib/lang/fr_openvz_vm.lng                   |    2 
 install/tpl/server.ini.master                                |    2 
 interface/web/vm/lib/lang/ja_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/nl_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/ro_openvz_vm.lng                   |    2 
 server/lib/classes/cron.d/500-backup.inc.php                 |   23 ++--
 interface/web/vm/lib/lang/es_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/pt_openvz_template.lng             |    2 
 server/lib/classes/system.inc.php                            |   27 +++++
 install/dist/lib/gentoo.lib.php                              |    2 
 interface/web/vm/lib/lang/ru_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/bg_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/en_openvz_vm.lng                   |    2 
 install/install.php                                          |   44 ++++----
 interface/web/vm/lib/lang/fi_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/bg_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/hr_openvz_template.lng             |    4 
 interface/web/vm/lib/lang/it_openvz_vm.lng                   |    2 
 interface/web/vm/lib/lang/el_openvz_template.lng             |    2 
 interface/web/vm/lib/lang/cz_openvz_vm.lng                   |    2 
 interface/web/vm/templates/openvz_template_advanced_edit.htm |   10 +-
 56 files changed, 142 insertions(+), 115 deletions(-)

diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index a4c3789..736fa4f 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -290,7 +290,7 @@
 			//* Configure master.cf and add a line for deliver
 			$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf[$config_dir.'/master.cf', $deliver_content);
+			af($configdir.'/master.cf', $deliver_content);
 			unset($content);
 			unset($deliver_content);
 		}
diff --git a/install/install.php b/install/install.php
index c9f6545..a439672 100644
--- a/install/install.php
+++ b/install/install.php
@@ -248,11 +248,11 @@
 	$inst->add_database_server_record();
 
 	//* Configure Postgrey
-	$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey');
+	$force = @($conf['postgrey']['installed']) ? true : $inst->force_configure_app('Postgrey', false);
 	if($force) swriteln('Configuring Postgrey');
 
 	//* Configure Postfix
-	$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix');
+	$force = @($conf['postfix']['installed']) ? true : $inst->force_configure_app('Postfix', false);
 	if($force) {
 		swriteln('Configuring Postfix');
 		$inst->configure_postfix();
@@ -262,7 +262,7 @@
 	if($conf['services']['mail']) {
 
 		//* Configure Mailman
-		$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman');
+		$force = @($conf['mailman']['installed']) ? true : $inst->force_configure_app('Mailman', false);
 		if($force) {
 			swriteln('Configuring Mailman');
 			$inst->configure_mailman();
@@ -270,8 +270,8 @@
 
 		//* Check for Dovecot and Courier
 		if(!$conf['dovecot']['installed'] && !$conf['courier']['installed']) {
-			$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot');
-			$conf['courier']['installed'] = $inst->force_configure_app('Courier');
+			$conf['dovecot']['installed'] = $inst->force_configure_app('Dovecot', false);
+			$conf['courier']['installed'] = $inst->force_configure_app('Courier', false);
 		}
 		//* Configure Mailserver - Dovecot or Courier
 		if($conf['dovecot']['installed'] && $conf['courier']['installed']) {
@@ -298,21 +298,21 @@
 		}
 
 		//* Configure Spamasassin
-		$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin');
+		$force = @($conf['spamassassin']['installed']) ? true : $inst->force_configure_app('Spamassassin', false);
 		if($force) {
 			swriteln('Configuring Spamassassin');
 			$inst->configure_spamassassin();
 		}
     
 		//* Configure Amavis
-		$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd');
+		$force = @($conf['amavis']['installed']) ? true : $inst->force_configure_app('Amavisd', false);
 		if($force) {
 			swriteln('Configuring Amavisd');
 			$inst->configure_amavis();
 		}
 
 		//* Configure Getmail
-		$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail');
+		$force = @($conf['getmail']['installed']) ? true : $inst->force_configure_app('Getmail', false);
 		if($force) {
 			swriteln('Configuring Getmail');
 			$inst->configure_getmail();
@@ -322,9 +322,9 @@
 
 	//* Check for DNS
 	if(!$conf['powerdns']['installed'] && !$conf['bind']['installed'] && !$conf['mydns']['installed']) {
-		$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS');
-		$conf['bind']['installed'] = $inst->force_configure_app('BIND');
-		$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS');
+		$conf['powerdns']['installed'] = $inst->force_configure_app('PowerDNS', false);
+		$conf['bind']['installed'] = $inst->force_configure_app('BIND', false);
+		$conf['mydns']['installed'] = $inst->force_configure_app('MyDNS', false);
 	}
 	//* Configure PowerDNS
 	if($conf['powerdns']['installed']) {
@@ -346,14 +346,14 @@
 	}
 
 	//* Configure Jailkit
-	$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit');
+	$force = @($conf['jailkit']['installed']) ? true : $inst->force_configure_app('Jailkit', false);
 	if($force) {
 		swriteln('Configuring Jailkit');
 		$inst->configure_jailkit();
 	}
 
 	//* Configure Pureftpd
-	$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd');
+	$force = @($conf['pureftpd']['installed']) ? true : $inst->force_configure_app('pureftpd', false);
 	if($force) {
 		swriteln('Configuring Pureftpd');
 		$inst->configure_pureftpd();
@@ -361,8 +361,8 @@
 
 	//* Check for Web-Server
 	if(!$conf['apache']['installed'] && !$conf['nginx']['installed']) {
-		$conf['apache']['installed'] = $inst->force_configure_app('Apache');
-		$conf['nginx']['installed'] = $inst->force_configure_app('nginx');
+		$conf['apache']['installed'] = $inst->force_configure_app('Apache', false);
+		$conf['nginx']['installed'] = $inst->force_configure_app('nginx', false);
 	}
 
 	//* Configure Webserver - Apache or nginx
@@ -382,7 +382,7 @@
 		$conf['services']['web'] = true;
 		$conf['services']['file'] = true;
 		//* Configure Vlogger
-		$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger');
+		$force = @($conf['vlogger']['installed']) ? true : $inst->force_configure_app('vlogger', false);
 		if($force) {
 			swriteln('Configuring vlogger');
 			$inst->configure_vlogger();
@@ -406,7 +406,7 @@
 	}
 
     //* Configure XMPP
-	$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server');
+	$force = @($conf['xmpp']['installed']) ? true : $inst->force_configure_app('Metronome XMPP Server', false);
 	if($force) {
         swriteln('Configuring Metronome XMPP Server');
         $inst->configure_xmpp();
@@ -415,8 +415,8 @@
 
 	//* Check for Firewall
 	if(!$conf['ufw']['installed'] && !$conf['firewall']['installed']) {
-		$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall');
-		$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall');
+		$conf['ufw']['installed'] = $inst->force_configure_app('Ubuntu Firewall', false);
+		$conf['firewall']['installed'] = $inst->force_configure_app('Bastille Firewall', false);
 	}
 	//* Configure Firewall - Ubuntu or Bastille
 	if($conf['ufw']['installed'] && $conf['firewall']['installed']) {
@@ -441,14 +441,14 @@
 	}
 
 	//* Configure Fail2ban
-	$force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban');
+	$force = @($conf['fail2ban']['installed']) ? true : $inst->force_configure_app('Fail2ban', false);
 	if($force) {
 		swriteln('Configuring Fail2ban');
 		$inst->configure_fail2ban();
 	}
 
 	//* Configure OpenVZ
-	$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ');
+	$force = @($conf['openvz']['installed']) ? true : $inst->force_configure_app('OpenVZ', false);
 	if($force) {
 		$conf['services']['vserver'] = true;
 		swriteln('Configuring OpenVZ');
@@ -873,4 +873,4 @@
 echo "Installation completed.\n";
 
 
-?>
\ No newline at end of file
+?>
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 3f54fc8..87533e6 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -164,13 +164,14 @@
 		if ($conf['services']['web'] && (($conf['apache']['installed'] && is_file($conf['apache']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")) || ($conf['nginx']['installed'] && is_file($conf['nginx']["vhost_conf_enabled_dir"]."/000-ispconfig.vhost")))) $this->ispconfig_interface_installed = true;
 	}
 
-    public function force_configure_app($service) {
+    public function force_configure_app($service, $enable_force=true) {
 		$force = false;
         swriteln("[WARN] autodetect for $service failed");
-        if(strtolower($this->simple_query("Force configure $service", array('y', 'n'), 'n') ) == 'y') {
-//			swriteln("Configure $service");
-            $force = true;
-		} else swriteln("Skipping $service\n");
+		if($enable_force) {
+	        if(strtolower($this->simple_query("Force configure $service", array('y', 'n'), 'n') ) == 'y') {
+	            $force = true;
+			} else swriteln("Skipping $service\n");
+		}
 		return $force;
     }
 
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index df45246..1ed6e5e 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -785,6 +785,7 @@
   `destination` text,
   `type` enum('alias','aliasdomain','forward','catchall') NOT NULL default 'alias',
   `active` enum('n','y') NOT NULL DEFAULT 'n',
+  `greylisting` enum('n','y' ) NOT NULL DEFAULT 'n',
   PRIMARY KEY  (`forwarding_id`),
   KEY `server_id` (`server_id`,`source`),
   KEY `type` (`type`)
@@ -928,6 +929,7 @@
   `move_junk` enum('n','y') NOT NULL default 'n',
   `custom_mailfilter` mediumtext,
   `postfix` enum('n','y') NOT NULL default 'y',
+  `greylisting` enum('n','y' ) NOT NULL DEFAULT 'n',
   `access` enum('n','y') NOT NULL default 'y',
   `disableimap` enum('n','y') NOT NULL default 'n',
   `disablepop3` enum('n','y') NOT NULL default 'n',
diff --git a/install/tpl/fedora_amavisd_conf.master b/install/tpl/fedora_amavisd_conf.master
index 56b2d2c..5275552 100644
--- a/install/tpl/fedora_amavisd_conf.master
+++ b/install/tpl/fedora_amavisd_conf.master
@@ -48,7 +48,7 @@
 
 @local_domains_maps = ( [".$mydomain"] );  # list of all local domains
 
-@mynetworks = qw( 00.0.0.0/8 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10
+@mynetworks = qw( 0.0.0.0/8 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10
                   10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 );
 
 $unix_socketname = "$MYHOME/amavisd.sock";  # amavisd-release or amavis-milter
diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master
index f521cab..dbff7ed 100644
--- a/install/tpl/server.ini.master
+++ b/install/tpl/server.ini.master
@@ -18,7 +18,7 @@
 backup_dir=/var/backup
 backup_dir_is_mount=y
 backup_mode=rootgz
-backup_delete=y
+backup_delete=n
 monit_url=
 monit_user=
 monit_password=
diff --git a/interface/web/vm/lib/lang/ar_openvz_template.lng b/interface/web/vm/lib/lang/ar_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/ar_openvz_template.lng
+++ b/interface/web/vm/lib/lang/ar_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ar_openvz_vm.lng b/interface/web/vm/lib/lang/ar_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/ar_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/ar_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/bg_openvz_template.lng b/interface/web/vm/lib/lang/bg_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/bg_openvz_template.lng
+++ b/interface/web/vm/lib/lang/bg_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/bg_openvz_vm.lng b/interface/web/vm/lib/lang/bg_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/bg_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/bg_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/br_openvz_template.lng b/interface/web/vm/lib/lang/br_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/br_openvz_template.lng
+++ b/interface/web/vm/lib/lang/br_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/br_openvz_vm.lng b/interface/web/vm/lib/lang/br_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/br_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/br_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/cz_openvz_template.lng b/interface/web/vm/lib/lang/cz_openvz_template.lng
index 7fff3b3..3abd816 100644
--- a/interface/web/vm/lib/lang/cz_openvz_template.lng
+++ b/interface/web/vm/lib/lang/cz_openvz_template.lng
@@ -91,6 +91,5 @@
 $wb['Template'] = 'Šablona';
 $wb['Advanced'] = 'Pokročilý';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
-
diff --git a/interface/web/vm/lib/lang/cz_openvz_vm.lng b/interface/web/vm/lib/lang/cz_openvz_vm.lng
index c2c26d0..eaf12b7 100644
--- a/interface/web/vm/lib/lang/cz_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/cz_openvz_vm.lng
@@ -38,6 +38,6 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Pokročilý';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
 
diff --git a/interface/web/vm/lib/lang/de_openvz_template.lng b/interface/web/vm/lib/lang/de_openvz_template.lng
index 0f0e3ae..c86e878 100644
--- a/interface/web/vm/lib/lang/de_openvz_template.lng
+++ b/interface/web/vm/lib/lang/de_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Erweitert';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/de_openvz_vm.lng b/interface/web/vm/lib/lang/de_openvz_vm.lng
index b41c65d..edce4b7 100644
--- a/interface/web/vm/lib/lang/de_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/de_openvz_vm.lng
@@ -37,5 +37,5 @@
 $wb['template_nameserver_error_empty'] = 'Nameserver ist leer.';
 $wb['Virtual server'] = 'Virtueller Server';
 $wb['Advanced'] = 'Erweitert';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/el_openvz_template.lng b/interface/web/vm/lib/lang/el_openvz_template.lng
index 2f5c8f6..b8c6543 100644
--- a/interface/web/vm/lib/lang/el_openvz_template.lng
+++ b/interface/web/vm/lib/lang/el_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/el_openvz_vm.lng b/interface/web/vm/lib/lang/el_openvz_vm.lng
index 889d1f3..c74b102 100644
--- a/interface/web/vm/lib/lang/el_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/el_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Εικονικός server';
 $wb['Advanced'] = 'Για προχωρημένους';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/en_openvz_template.lng b/interface/web/vm/lib/lang/en_openvz_template.lng
index 1d9d457..a2b7f8d 100644
--- a/interface/web/vm/lib/lang/en_openvz_template.lng
+++ b/interface/web/vm/lib/lang/en_openvz_template.lng
@@ -91,6 +91,5 @@
 $wb["Template"] = 'Template';
 $wb["Advanced"] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb['features_txt'] = 'iptables';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/en_openvz_vm.lng b/interface/web/vm/lib/lang/en_openvz_vm.lng
index d7ad26c..67cdbfd 100644
--- a/interface/web/vm/lib/lang/en_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/en_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb["Virtual server"] = 'Virtual server';
 $wb["Advanced"] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/es_openvz_template.lng b/interface/web/vm/lib/lang/es_openvz_template.lng
index d64c981..cad0933 100644
--- a/interface/web/vm/lib/lang/es_openvz_template.lng
+++ b/interface/web/vm/lib/lang/es_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Plantilla';
 $wb['Advanced'] = 'Avanzado';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/es_openvz_vm.lng b/interface/web/vm/lib/lang/es_openvz_vm.lng
index 495de6f..6a88f4f 100644
--- a/interface/web/vm/lib/lang/es_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/es_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Servidor virtual';
 $wb['Advanced'] = 'Avanzado';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/fi_openvz_template.lng b/interface/web/vm/lib/lang/fi_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/fi_openvz_template.lng
+++ b/interface/web/vm/lib/lang/fi_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/fi_openvz_vm.lng b/interface/web/vm/lib/lang/fi_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/fi_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/fi_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/fr_openvz_template.lng b/interface/web/vm/lib/lang/fr_openvz_template.lng
index 14655c0..66db265 100644
--- a/interface/web/vm/lib/lang/fr_openvz_template.lng
+++ b/interface/web/vm/lib/lang/fr_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Modèle';
 $wb['Advanced'] = 'Avancé';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/fr_openvz_vm.lng b/interface/web/vm/lib/lang/fr_openvz_vm.lng
index 9672848..26d21a0 100644
--- a/interface/web/vm/lib/lang/fr_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/fr_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Serveur virtuel';
 $wb['Advanced'] = 'Avancé';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/hr_openvz_template.lng b/interface/web/vm/lib/lang/hr_openvz_template.lng
index 19a371f..69b36b9 100644
--- a/interface/web/vm/lib/lang/hr_openvz_template.lng
+++ b/interface/web/vm/lib/lang/hr_openvz_template.lng
@@ -91,7 +91,5 @@
 $wb['Template'] = 'Predložak';
 $wb['Advanced'] = 'Napredno';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
-
-
diff --git a/interface/web/vm/lib/lang/hr_openvz_vm.lng b/interface/web/vm/lib/lang/hr_openvz_vm.lng
index 4be9932..6ae18e1 100644
--- a/interface/web/vm/lib/lang/hr_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/hr_openvz_vm.lng
@@ -38,7 +38,7 @@
 $wb['Virtual server'] = 'Virtualni server';
 $wb['Advanced'] = 'Napredno';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
 
 
diff --git a/interface/web/vm/lib/lang/hu_openvz_template.lng b/interface/web/vm/lib/lang/hu_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/hu_openvz_template.lng
+++ b/interface/web/vm/lib/lang/hu_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/hu_openvz_vm.lng b/interface/web/vm/lib/lang/hu_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/hu_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/hu_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/id_openvz_template.lng b/interface/web/vm/lib/lang/id_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/id_openvz_template.lng
+++ b/interface/web/vm/lib/lang/id_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/id_openvz_vm.lng b/interface/web/vm/lib/lang/id_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/id_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/id_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/it_openvz_template.lng b/interface/web/vm/lib/lang/it_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/it_openvz_template.lng
+++ b/interface/web/vm/lib/lang/it_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/it_openvz_vm.lng b/interface/web/vm/lib/lang/it_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/it_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/it_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ja_openvz_template.lng b/interface/web/vm/lib/lang/ja_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/ja_openvz_template.lng
+++ b/interface/web/vm/lib/lang/ja_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ja_openvz_vm.lng b/interface/web/vm/lib/lang/ja_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/ja_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/ja_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/nl_openvz_template.lng b/interface/web/vm/lib/lang/nl_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/nl_openvz_template.lng
+++ b/interface/web/vm/lib/lang/nl_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/nl_openvz_vm.lng b/interface/web/vm/lib/lang/nl_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/nl_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/nl_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/pl_openvz_template.lng b/interface/web/vm/lib/lang/pl_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/pl_openvz_template.lng
+++ b/interface/web/vm/lib/lang/pl_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/pl_openvz_vm.lng b/interface/web/vm/lib/lang/pl_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/pl_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/pl_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/pt_openvz_template.lng b/interface/web/vm/lib/lang/pt_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/pt_openvz_template.lng
+++ b/interface/web/vm/lib/lang/pt_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/pt_openvz_vm.lng b/interface/web/vm/lib/lang/pt_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/pt_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/pt_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ro_openvz_template.lng b/interface/web/vm/lib/lang/ro_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/ro_openvz_template.lng
+++ b/interface/web/vm/lib/lang/ro_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ro_openvz_vm.lng b/interface/web/vm/lib/lang/ro_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/ro_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/ro_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ru_openvz_template.lng b/interface/web/vm/lib/lang/ru_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/ru_openvz_template.lng
+++ b/interface/web/vm/lib/lang/ru_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/ru_openvz_vm.lng b/interface/web/vm/lib/lang/ru_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/ru_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/ru_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/se_openvz_template.lng b/interface/web/vm/lib/lang/se_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/se_openvz_template.lng
+++ b/interface/web/vm/lib/lang/se_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/se_openvz_vm.lng b/interface/web/vm/lib/lang/se_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/se_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/se_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/sk_openvz_template.lng b/interface/web/vm/lib/lang/sk_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/sk_openvz_template.lng
+++ b/interface/web/vm/lib/lang/sk_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/sk_openvz_vm.lng b/interface/web/vm/lib/lang/sk_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/sk_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/sk_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/tr_openvz_template.lng b/interface/web/vm/lib/lang/tr_openvz_template.lng
index 217747c..262cad0 100644
--- a/interface/web/vm/lib/lang/tr_openvz_template.lng
+++ b/interface/web/vm/lib/lang/tr_openvz_template.lng
@@ -91,5 +91,5 @@
 $wb['Template'] = 'Template';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/lib/lang/tr_openvz_vm.lng b/interface/web/vm/lib/lang/tr_openvz_vm.lng
index 06a10d2..3f4e1c1 100644
--- a/interface/web/vm/lib/lang/tr_openvz_vm.lng
+++ b/interface/web/vm/lib/lang/tr_openvz_vm.lng
@@ -38,5 +38,5 @@
 $wb['Virtual server'] = 'Virtual server';
 $wb['Advanced'] = 'Advanced';
 $wb['features_txt'] = 'Features';
-$wb["iptables_txt"] = "iptables";
+$wb["iptables_txt"] = "IP Tables";
 ?>
diff --git a/interface/web/vm/templates/openvz_template_advanced_edit.htm b/interface/web/vm/templates/openvz_template_advanced_edit.htm
index 4ef22d6..d3dee9a 100644
--- a/interface/web/vm/templates/openvz_template_advanced_edit.htm
+++ b/interface/web/vm/templates/openvz_template_advanced_edit.htm
@@ -15,8 +15,8 @@
                 <label for="numothersock" class="col-sm-3 control-label">{tmpl_var name='numothersock_txt'}</label>
                 <div class="col-sm-9"><input type="text" name="numothersock" id="numothersock" value="{tmpl_var name='numothersock'}" class="form-control" /></div></div>
             <div class="form-group">
-                <label for="vmguarpages" class="col-sm-3 control-label">{tmpl_var name='vmguarpages_txt'}</label>
-                <div class="col-sm-9"><input type="text" name="vmguarpages" id="vmguarpages" value="{tmpl_var name='vmguarpages'}" class="form-control" /></div></div>
+                <label for="vmguarpages" class="col-sm-3 control-label" readonly >{tmpl_var name='vmguarpages_txt'}</label>
+                <div class="col-sm-9"><input type="text" name="vmguarpages" id="vmguarpages" value="{tmpl_var name='vmguarpages'}" class="form-control" readonly /></div></div>
             <div class="form-group">
                 <label for="kmemsize" class="col-sm-3 control-label">{tmpl_var name='kmemsize_txt'}</label>
                 <div class="col-sm-9"><input type="text" name="kmemsize" id="kmemsize" value="{tmpl_var name='kmemsize'}" class="form-control" /></div></div>
@@ -34,16 +34,16 @@
                 <div class="col-sm-9"><input type="text" name="dgramrcvbuf" id="dgramrcvbuf" value="{tmpl_var name='dgramrcvbuf'}" class="form-control" /></div></div>
             <div class="form-group">
                 <label for="oomguarpages" class="col-sm-3 control-label">{tmpl_var name='oomguarpages_txt'}</label>
-                <div class="col-sm-9"><input type="text" name="oomguarpages" id="oomguarpages" value="{tmpl_var name='oomguarpages'}" class="form-control" /></div></div>
+                <div class="col-sm-9"><input type="text" name="oomguarpages" id="oomguarpages" value="{tmpl_var name='oomguarpages'}" class="form-control" readonly /></div></div>
             <div class="form-group">
                 <label for="privvmpages" class="col-sm-3 control-label">{tmpl_var name='privvmpages_txt'}</label>
-                <div class="col-sm-9"><input type="text" name="privvmpages" id="privvmpages" value="{tmpl_var name='privvmpages'}" class="form-control" /></div></div>
+                <div class="col-sm-9"><input type="text" name="privvmpages" id="privvmpages" value="{tmpl_var name='privvmpages'}" class="form-control" readonly /></div></div>
             <div class="form-group">
                 <label for="lockedpages" class="col-sm-3 control-label">{tmpl_var name='lockedpages_txt'}</label>
                 <div class="col-sm-9"><input type="text" name="lockedpages" id="lockedpages" value="{tmpl_var name='lockedpages'}" class="form-control" /></div></div>
             <div class="form-group">
                 <label for="shmpages" class="col-sm-3 control-label">{tmpl_var name='shmpages_txt'}</label>
-                <div class="col-sm-9"><input type="text" name="shmpages" id="shmpages" value="{tmpl_var name='shmpages'}" class="form-control" /></div></div>
+                <div class="col-sm-9"><input type="text" name="shmpages" id="shmpages" value="{tmpl_var name='shmpages'}" class="form-control" readonly /></div></div>
             <div class="form-group">
                 <label for="physpages" class="col-sm-3 control-label">{tmpl_var name='physpages_txt'}</label>
                 <div class="col-sm-9"><input type="text" name="physpages" id="physpages" value="{tmpl_var name='physpages'}" class="form-control" /></div></div>
diff --git a/server/lib/classes/cron.d/500-backup.inc.php b/server/lib/classes/cron.d/500-backup.inc.php
index a9fa3f9..e196cb5 100644
--- a/server/lib/classes/cron.d/500-backup.inc.php
+++ b/server/lib/classes/cron.d/500-backup.inc.php
@@ -192,11 +192,16 @@
 							$web_user = $rec['system_user'];
 							$web_backup_dir = realpath($backup_dir.'/web'.$web_id);
 							if(is_dir($web_backup_dir)) {
-								exec('sudo -u '.escapeshellarg($web_user).' rm -f '.escapeshellarg($web_backup_dir.'/*'));
-								$sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ?";
-								$app->db->query($sql, $conf['server_id'], $web_id);
-								if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $web_id);
+								$dir_handle = opendir($web_backup_dir.'/');
+								while ($file = readdir($dir_handle)) {
+									if(!is_dir($file)) {
+										unlink ("$web_backup_dir/"."$file");
+									}
+								}
 							}
+							$sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ?";
+							$app->db->query($sql, $conf['server_id'], $web_id);
+							if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $web_id);
 						}
 					}
 				}
@@ -353,15 +358,7 @@
 				}
 				//* end run_backups
 				if( $server_config['backup_dir_is_mount'] == 'y' ) $app->system->umount_backup_dir($backup_dir);
-			} else {
-				//* send email to admin that backup directory could not be mounted
-				$global_config = $app->getconf->get_global_config('mail');
-				if($global_config['admin_mail'] != ''){
-					$subject = 'Backup directory '.$backup_dir.' could not be mounted';
-					$message = "Backup directory ".$backup_dir." could not be mounted.\n\nThe command\n\n".$server_config['backup_dir_mount_cmd']."\n\nfailed.";
-					mail($global_config['admin_mail'], $subject, $message);
-				}
-			}
+			} 
 		}
 		
 		// delete files from backup download dir (/var/www/example.com/backup)
diff --git a/server/lib/classes/cron.d/500-backup_mail.inc.php b/server/lib/classes/cron.d/500-backup_mail.inc.php
index 89cb167..6e718b8 100644
--- a/server/lib/classes/cron.d/500-backup_mail.inc.php
+++ b/server/lib/classes/cron.d/500-backup_mail.inc.php
@@ -66,7 +66,6 @@
 			if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $run_backups = false;
 
 			$records = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE server_id = ? AND maildir != ''", intval($conf['server_id']));
-
 			if(is_array($records) && $run_backups) {
 				if(!is_dir($backup_dir)) {
 					mkdir(escapeshellcmd($backup_dir), $backup_dir_permissions, true);
@@ -76,12 +75,13 @@
 
 				foreach($records as $rec) {
 					//* Do the mailbox backup
+					$email = $rec['email'];
+					$temp = explode("@",$email);
+					$domain = $temp[1];
+					unset($temp);
+					$domain_rec=$app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = ?", $domain);
+
 					if($rec['backup_interval'] == 'daily' or ($rec['backup_interval'] == 'weekly' && date('w') == 0) or ($rec['backup_interval'] == 'monthly' && date('d') == '01')) {
-						$email = $rec['email'];
-						$temp = explode("@",$email);
-						$domain = $temp[1];
-						unset($temp);;
-						$domain_rec=$app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = ?", $domain);
 						
 						$backupusername = 'root';
 						$backupgroup = 'root';
@@ -194,23 +194,29 @@
 						unset($dir_handle);
 					}
 					/* Remove inactive backups */
-					if($rec['backup_interval'] == 'none') {
+					if($rec['backup_interval'] == 'none' || $rec['backup_interval'] == '') {
+
+						/* remove archives */
+						$mail_backup_dir = realpath($backup_dir.'/mail'.$domain_rec['domain_id']);
+						$mail_backup_file = 'mail'.$rec['mailuser_id'].'_*';
+						if(is_dir($mail_backup_dir)) {
+							$dir_handle = opendir($mail_backup_dir.'/');
+							while ($file = readdir($dir_handle)) {
+								if(!is_dir($file)) {
+									unlink ("$mail_backup_dir/"."$file");
+								}
+							}
+						}
 						/* remove backups from db */
 						$sql = "DELETE FROM mail_backup WHERE server_id = ? AND parent_domain_id = ? AND mailuser_id = ?";
 						$app->db->query($sql, $conf['server_id'], $domain_rec['domain_id'], $rec['mailuser_id']);
 						if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $domain_rec['domain_id'], $rec['mailuser_id']);
-						/* remove archives */
-						$mail_backup_dir = $backup_dir.'/mail'.$rec['domain_id'];	
-						$mail_backup_file = 'mail'.$rec['mailuser_id'].'_*';
-						if(is_dir($mail_backup_dir)) {
-							foreach (glob($mail_backup_dir.'/'.$mail_backup_file) as $filename) {
-								unlink($filename);
-							}
-						}
+
 					}
 				}
 				if( $server_config['backup_dir_is_mount'] == 'y' ) $app->system->umount_backup_dir($backup_dir);
-			} //* end run_backups
+				//* end run_backups
+			}
 		}
 
 		parent::onRunJob();
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 98fc51f..739e822 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -1802,6 +1802,8 @@
 	}
 
 	function mount_backup_dir($backup_dir, $mount_cmd = '/usr/local/ispconfig/server/scripts/backup_dir_mount.sh'){
+		global $app, $conf;
+
 		$mounted = true;
 		if ( 	is_file($mount_cmd) &&
 				is_executable($mount_cmd) &&
@@ -1813,11 +1815,22 @@
 				if (!$this->is_mounted($backup_dir)) $mounted = false;
 			}
 		} else $mounted = false;
+		if (!$mounted) {
+			//* send email to admin that backup directory could not be mounted
+			$global_config = $app->getconf->get_global_config('mail');
+			if($global_config['admin_mail'] != ''){
+				$subject = 'Backup directory '.$backup_dir.' could not be mounted';
+				$message = "Backup directory ".$backup_dir." could not be mounted.\n\nThe command\n\n".$mount_cmd."\n\nfailed.";
+				mail($global_config['admin_mail'], $subject, $message);
+			}
+		}
 
 		return $mounted;
 	}
 
 	function umount_backup_dir($backup_dir, $mount_cmd = '/usr/local/ispconfig/server/scripts/backup_dir_umount.sh'){
+		global $app, $conf;
+
 		if ( 	is_file($mount_cmd) &&
 				is_executable($mount_cmd) &&
 				fileowner($mount_cmd) === 0
@@ -1828,7 +1841,19 @@
 			}
 		}
 
-        return $this->is_mounted($backup_dir) == 0 ? true : false;
+        $unmounted = $this->is_mounted($backup_dir) == 0 ? true : false;
+		if(!$unmounted) {
+			//* send email to admin that backup directory could not be unmounted
+			$global_config = $app->getconf->get_global_config('mail');
+			if($global_config['admin_mail'] != ''){
+				$subject = 'Backup directory '.$backup_dir.' could not be unmounted';
+				$message = "Backup directory ".$backup_dir." could not be unmounted.\n\nThe command\n\n".$mount_cmd."\n\nfailed.";
+				mail($global_config['admin_mail'], $subject, $message);
+			}
+		}
+
+		return $unmounted;
+
 	}
 
 	function getinitcommand($servicename, $action, $init_script_directory = ''){

--
Gitblit v1.9.1