From 615a0a96618fa99e7e452523145d6c0f238d4473 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 31 Jul 2013 09:33:43 -0400
Subject: [PATCH] Merged revisions 3960-4065 from stable branch.

---
 server/conf/mail/web_quota_notification_de.txt               |   14 
 interface/web/admin/templates/server_config_web_edit.htm     |   22 
 interface/web/login/lib/lang/en.lng                          |    1 
 interface/web/mail/templates/user_quota_stats_list.htm       |  105 
 interface/web/sites/templates/database_edit.htm              |    2 
 server/scripts/run-getmail.sh                                |    2 
 install/tpl/debian6_dovecot2.conf.master                     |    4 
 install/sql/incremental/upd_0053.sql                         |    2 
 interface/web/sites/cron_edit.php                            |   13 
 interface/web/monitor/lib/module.conf.php                    |   10 
 interface/web/admin/templates/system_config_mail_edit.htm    |    2 
 interface/web/monitor/log_list.php                           |    2 
 interface/web/themes/default/css/styles.css                  | 3707 +++++++++++++-------------
 interface/web/sites/list/aps_installedpackages.list.php      |  174 
 interface/web/admin/software_update_list.php                 |    3 
 interface/web/admin/lib/lang/de_server_config.lng            |   23 
 server/plugins-available/mysql_clientdb_plugin.inc.php       |  120 
 server/conf/mail/mail_quota_notification_de.txt              |   14 
 interface/web/login/lib/lang/de.lng                          |    1 
 interface/web/monitor/show_munin.php                         |   82 
 interface/lib/classes/listform_actions.inc.php               |  190 
 interface/web/client/lib/lang/en_client_template_list.lng    |    1 
 interface/web/vm/openvz_ip_list.php                          |    2 
 interface/web/admin/users_list.php                           |    2 
 interface/web/sites/lib/lang/de_web_domain.lng               |    9 
 interface/web/sites/lib/lang/en_web_domain.lng               |    7 
 interface/web/admin/templates/server_config_mail_edit.htm    |   22 
 interface/web/mail/mail_aliasdomain_list.php                 |    2 
 server/conf/mail/web_quota_ok_notification_en.txt            |   14 
 server/server.php                                            |   10 
 interface/lib/plugins/sites_web_database_user_plugin.inc.php |    4 
 interface/web/sites/aps_availablepackages_list.php           |    6 
 interface/web/sites/templates/web_domain_edit.htm            |    2 
 interface/web/help/templates/support_message_list.htm        |    7 
 interface/web/sites/templates/web_domain_advanced.htm        |    9 
 install/tpl/debian_postfix.conf.master                       |   33 
 interface/web/mail/mail_domain_list.php                      |    2 
 server/lib/classes/monitor_tools.inc.php                     |    9 
 interface/web/monitor/lib/lang/en.lng                        |    6 
 interface/web/client/reseller_list.php                       |    4 
 install/tpl/opensuse_postfix.conf.master                     |   30 
 interface/web/admin/templates/server_config_server_edit.htm  |   30 
 interface/web/monitor/datalog_list.php                       |    4 
 interface/web/sites/database_phpmyadmin.php                  |    6 
 interface/web/dashboard/lib/lang/de_dashlet_quota.lng        |    8 
 install/lib/install.lib.php                                  |    8 
 interface/web/dns/dns_soa_edit.php                           |   15 
 server/conf/mail/web_quota_ok_notification_de.txt            |   14 
 interface/web/sites/webdav_user_list.php                     |    2 
 server/lib/classes/system.inc.php                            |    2 
 install/tpl/debian_dovecot2.conf.master                      |    4 
 interface/web/admin/form/server_ip.tform.php                 |    2 
 interface/web/admin/lib/lang/en_server_config.lng            |   27 
 server/lib/app.inc.php                                       |   45 
 interface/web/monitor/templates/show_munin.htm               |   10 
 interface/web/client/client_template_edit.php                |  194 
 interface/web/mail/lib/lang/de_spamfilter_policy.lng         |    2 
 interface/web/admin/lib/lang/de_software_package_list.lng    |    4 
 interface/web/help/faq_list.php                              |    2 
 server/conf/mail/web_quota_notification_en.txt               |   14 
 interface/web/js/jquery.tipsy.js                             |   11 
 interface/web/dashboard/lib/lang/de_dashlet_mailquota.lng    |    8 
 interface/web/login/templates/password_reset.htm             |    4 
 interface/web/mail/lib/lang/de_user_quota_stats_list.lng     |    1 
 interface/web/admin/form/software_repo.tform.php             |    2 
 interface/web/client/lib/lang/en_client.lng                  |    3 
 interface/web/dns/dns_srv_edit.php                           |   16 
 install/sql/ispconfig3.sql                                   |    9 
 server/plugins-available/apache2_plugin.inc.php              |   63 
 interface/web/dns/dns_wizard.php                             |   12 
 interface/web/sites/templates/user_quota_stats_list.htm      |    4 
 interface/web/sites/database_user_edit.php                   |   18 
 interface/web/admin/lib/lang/en_software_repo.lng            |    1 
 interface/lib/classes/ispcmail.inc.php                       |   56 
 interface/web/sites/lib/lang/en_shell_user.lng               |    2 
 interface/web/js/scrigo.js.php                               |    1 
 interface/web/mail/webmailer.php                             |   11 
 interface/web/sites/web_vhost_subdomain_edit.php             |    2 
 interface/web/admin/lib/lang/de_software_package.lng         |    6 
 server/conf/getmail.conf.master                              |    2 
 interface/web/admin/lib/lang/de_system_config.lng            |    2 
 interface/web/mailuser/mail_user_autoresponder_edit.php      |    6 
 interface/web/login/templates/index.htm                      |    3 
 server/conf/mail/web_traffic_notification_en.txt             |    7 
 interface/lib/classes/validate_ftpuser.inc.php               |    7 
 interface/web/dns/dns_a_list.php                             |    2 
 interface/web/mail/lib/lang/de_spamfilter_users.lng          |    2 
 install/tpl/apache_ispconfig.vhost.master                    |    2 
 interface/web/monitor/lib/lang/de.lng                        |    6 
 interface/web/client/lib/lang/en_reseller.lng                |    3 
 interface/web/sites/database_edit.php                        |   12 
 interface/web/admin/form/server_config.tform.php             |  121 
 interface/web/sites/database_user_del.php                    |    7 
 install/dist/lib/centos53.lib.php                            |   12 
 interface/web/client/client_edit.php                         |    2 
 interface/web/sites/web_subdomain_list.php                   |    4 
 interface/web/mail/lib/lang/en_spamfilter_users.lng          |    2 
 interface/web/client/templates/reseller_edit_limits.htm      |    6 
 interface/web/mail/list/user_quota_stats.list.php            |    2 
 interface/web/sites/shell_user_edit.php                      |    8 
 interface/web/sites/form/shell_user.tform.php                |    2 
 server/plugins-available/nginx_plugin.inc.php                |   60 
 interface/web/help/lib/lang/en_support_message_list.lng      |    1 
 interface/web/mail/mail_user_list.php                        |    2 
 server/cron_daily.php                                        |  444 ++
 interface/web/sites/ftp_user_list.php                        |    2 
 interface/web/vm/openvz_vm_edit.php                          |   12 
 interface/web/themes/default/templates/main.tpl.htm          |    3 
 server/plugins-available/cron_plugin.inc.php                 |    2 
 interface/web/admin/lib/lang/en_software_package.lng         |    6 
 install/tpl/gentoo_postfix.conf.master                       |   30 
 interface/web/admin/templates/remote_user_list.htm           |    6 
 server/mods-available/web_module.inc.php                     |   11 
 interface/web/dns/dns_slave_list.php                         |    4 
 interface/web/mail/mail_domain_catchall_list.php             |    2 
 interface/web/admin/lib/lang/de_software_repo.lng            |    3 
 interface/web/admin/software_package_list.php                |    3 
 server/mods-available/monitor_core_module.inc.php            |   20 
 interface/web/client/templates/domain_list.htm               |    2 
 interface/web/client/lib/lang/en_client_del.lng              |    1 
 interface/lib/classes/remoting_lib.inc.php                   |    3 
 interface/web/mail/user_quota_stats.php                      |   20 
 interface/web/mail/lib/lang/en_user_quota_stats_list.lng     |    1 
 interface/web/sites/templates/web_domain_redirect.htm        |    6 
 install/dist/lib/centos52.lib.php                            |   12 
 interface/web/sites/database_list.php                        |    2 
 interface/web/admin/software_package_edit.php                |   59 
 interface/web/sites/web_aliasdomain_list.php                 |    4 
 install/sql/incremental/upd_0051.sql                         |    2 
 server/lib/classes/services.inc.php                          |    3 
 interface/web/client/templates/client_del.htm                |    8 
 interface/web/dns/dns_import.php                             |   12 
 interface/web/admin/form/system_config.tform.php             |    3 
 interface/web/mail/mail_forward_list.php                     |    2 
 server/plugins-available/ftpuser_base_plugin.inc.php         |   12 
 interface/web/mail/mail_alias_list.php                       |    2 
 interface/web/monitor/show_monit.php                         |   82 
 interface/web/client/form/reseller.tform.php                 |   11 
 interface/web/admin/form/software_package.tform.php          |  116 
 interface/web/admin/templates/software_package_edit.htm      |   27 
 interface/web/dashboard/templates/dashboard.htm              |    6 
 server/mods-available/dns_module.inc.php                     |   11 
 server/conf/nginx_vhost.conf.master                          |    4 
 server/conf/mail/web_traffic_notification_de.txt             |    8 
 interface/web/dashboard/dashboard.php                        |    2 
 interface/web/client/lib/lang/de_client_template_list.lng    |    1 
 install/tpl/opensuse_dovecot2.conf.master                    |    4 
 interface/lib/classes/tpl.inc.php                            |   14 
 interface/web/client/client_list.php                         |    4 
 interface/web/help/lib/lang/en_support_message.lng           |    7 
 interface/web/dashboard/lib/lang/en_dashlet_quota.lng        |    8 
 interface/web/admin/lib/lang/en_software_package_list.lng    |    2 
 interface/web/mail/mail_blacklist_list.php                   |    2 
 interface/web/sites/lib/lang/de_shell_user.lng               |    2 
 interface/web/client/lib/lang/de_client_del.lng              |    1 
 interface/web/client/templates/client_edit_limits.htm        |    8 
 interface/web/monitor/templates/show_monit.htm               |   10 
 interface/lib/classes/tform.inc.php                          |    1 
 install/dist/lib/opensuse.lib.php                            |  104 
 interface/web/client/lib/lang/de_reseller.lng                |    5 
 interface/web/sites/web_domain_edit.php                      |   75 
 interface/web/admin/templates/software_package_list.htm      |    7 
 interface/web/admin/server_php_list.php                      |    2 
 server/conf/mail/mail_quota_ok_notification_en.txt           |   14 
 install/sql/incremental/upd_0054.sql                         |    1 
 interface/web/mail/mail_mailinglist_edit.php                 |   12 
 install/dist/lib/fedora.lib.php                              |  110 
 interface/web/client/client_circle_list.php                  |    2 
 interface/web/dashboard/lib/lang/en_dashlet_mailquota.lng    |    8 
 interface/web/sites/form/database_user.tform.php             |    2 
 interface/web/sites/database_del.php                         |    2 
 interface/web/admin/lib/lang/de_software_repo_list.lng       |    4 
 interface/web/help/lib/lang/de_support_message_list.lng      |    1 
 interface/web/help/lib/lang/de_support_message.lng           |    7 
 interface/web/mail/mail_user_stats.php                       |   80 
 interface/web/help/support_message_edit.php                  |   58 
 install/lib/installer_base.lib.php                           |  149 
 install/tpl/fedora_dovecot2.conf.master                      |    4 
 interface/web/sites/shell_user_list.php                      |    2 
 interface/web/dns/dns_template_list.php                      |    4 
 interface/web/sites/database_user_list.php                   |    2 
 server/lib/classes/tpl.inc.php                               |    4 
 interface/lib/classes/remoting.inc.php                       |    4 
 interface/web/dashboard/dashlets/templates/mailquota.htm     |   29 
 install/sql/incremental/upd_0052.sql                         |    1 
 interface/web/admin/server_ip_list.php                       |    2 
 interface/web/mailuser/mail_user_filter_list.php             |    2 
 interface/web/sites/form/web_domain.tform.php                |   10 
 server/plugins-available/bind_plugin.inc.php                 |    5 
 server/conf/mail/mail_quota_ok_notification_de.txt           |   14 
 interface/web/client/client_del.php                          |    1 
 interface/web/admin/lib/lang/de_software_package_install.lng |    2 
 interface/web/dns/dns_slave_edit.php                         |   16 
 interface/web/client/lib/lang/de_client.lng                  |    5 
 interface/web/sites/ftp_user_edit.php                        |   17 
 interface/lib/classes/sites_database_plugin.inc.php          |   50 
 interface/web/help/support_message_list.php                  |    2 
 interface/web/admin/lib/lang/de.lng                          |    2 
 interface/web/sites/web_sites_stats.php                      |   90 
 interface/lib/classes/functions.inc.php                      |   17 
 interface/web/mail/spamfilter_whitelist_list.php             |    2 
 interface/web/dashboard/dashlets/mailquota.php               |   93 
 interface/web/help/list/support_message.list.php             |    9 
 interface/web/sites/web_vhost_subdomain_list.php             |    4 
 interface/web/client/client_template_list.php                |    2 
 interface/web/sites/list/user_quota_stats.list.php           |    3 
 interface/web/help/form/support_message.tform.php            |    2 
 install/tpl/server.ini.master                                |   21 
 interface/web/sites/user_quota_stats.php                     |    5 
 interface/web/help/templates/support_message_view.htm        |    4 
 interface/web/dns/dns_soa_list.php                           |    4 
 interface/web/admin/lib/lang/de_software_update_list.lng     |    2 
 interface/web/sites/web_domain_list.php                      |    4 
 interface/web/client/domain_list.php                         |    2 
 interface/web/dashboard/dashlets/templates/quota.htm         |   29 
 interface/web/admin/templates/system_config_sites_edit.htm   |    2 
 interface/lib/classes/listform.inc.php                       |   21 
 interface/web/admin/lib/lang/en_system_config.lng            |    3 
 interface/web/admin/form/server_php.tform.php                |    2 
 interface/web/client/reseller_edit.php                       |    2 
 interface/web/client/form/client.tform.php                   |   35 
 install/dist/lib/gentoo.lib.php                              |   52 
 interface/web/mail/mail_domain_edit.php                      |   12 
 interface/web/sites/ajax_get_json.php                        |   10 
 interface/web/mail/spamfilter_blacklist_list.php             |    2 
 server/conf/mail/mail_quota_notification_en.txt              |   14 
 interface/web/mail/mail_whitelist_list.php                   |    2 
 install/tpl/fedora_postfix.conf.master                       |   30 
 interface/web/dashboard/dashlets/quota.php                   |  116 
 server/plugins-available/getmail_plugin.inc.php              |    8 
 install/dist/lib/debian60.lib.php                            |   14 
 231 files changed, 5,156 insertions(+), 2,896 deletions(-)

diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php
index 8accc9a..a7e4f94 100644
--- a/install/dist/lib/centos52.lib.php
+++ b/install/dist/lib/centos52.lib.php
@@ -41,7 +41,7 @@
 		}
 
 		// load files
-		$content = rf('tpl/mm_cfg.py.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
 		$old_file = rf($full_file_name);
 
 		$old_options = array();
@@ -67,7 +67,11 @@
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
 		
-		copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+        if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+            copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+        } else {
+            copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+        }
 		chgrp($full_file_name,'mailman');
 		chmod($full_file_name,0750);
 		
@@ -110,7 +114,7 @@
 		$configfile = 'fedora_amavisd_conf';
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -142,7 +146,7 @@
 		// Only add the content if we had not addded it before
 		if(!stristr($content,"127.0.0.1:10025")) {
 			unset($content);
-			$content = rf("tpl/master_cf_amavis.master");
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
 			af($conf["postfix"]["config_dir"].'/master.cf',$content);
 		}
 		unset($content);
diff --git a/install/dist/lib/centos53.lib.php b/install/dist/lib/centos53.lib.php
index d1960a1..91f1746 100644
--- a/install/dist/lib/centos53.lib.php
+++ b/install/dist/lib/centos53.lib.php
@@ -41,7 +41,7 @@
 		}
 
 		// load files
-		$content = rf('tpl/mm_cfg.py.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
 		$old_file = rf($full_file_name);
 
 		$old_options = array();
@@ -67,7 +67,11 @@
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
 		
-		copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+        if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+            copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+        } else {
+            copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+        }
 		chgrp($full_file_name,'mailman');
 		chmod($full_file_name,0750);
 		
@@ -111,7 +115,7 @@
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(!is_dir($conf["amavis"]["config_dir"])) mkdir($conf["amavis"]["config_dir"]);
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -143,7 +147,7 @@
 		// Only add the content if we had not addded it before
 		if(!stristr($content,"127.0.0.1:10025")) {
 			unset($content);
-			$content = rf("tpl/master_cf_amavis.master");
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
 			af($conf["postfix"]["config_dir"].'/master.cf',$content);
 		}
 		unset($content);
diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php
index 3430478..e1be291 100644
--- a/install/dist/lib/debian60.lib.php
+++ b/install/dist/lib/debian60.lib.php
@@ -86,9 +86,17 @@
 		
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-			copy('tpl/debian6_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot2.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/debian6_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            }
 		} else {
-			copy('tpl/debian6_dovecot.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/debian6_dovecot.conf.master',$config_dir.'/'.$configfile);
+            }
 		}
 		
 		//* dovecot-sql.conf
@@ -97,7 +105,7 @@
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 			chmod($config_dir.'/'.$configfile.'~', 0400);
 		}
-		$content = rf('tpl/debian6_dovecot-sql.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian6_dovecot-sql.conf.master', 'tpl/debian6_dovecot-sql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index aa83141..a0136f6 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -41,7 +41,7 @@
 		}
 
 		// load files
-		$content = rf('tpl/mm_cfg.py.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
 		$old_file = rf($full_file_name);
 
 		$old_options = array();
@@ -98,7 +98,11 @@
 		}
 		
 		if(is_dir('/etc/mailman')) {
-			copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+            } else {
+                copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+            }
 			chgrp($full_file_name,'mailman');
 			chmod($full_file_name,0750);
 		}
@@ -162,38 +166,16 @@
 		if(!is_user($cf['vmail_username'])) caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");		
 
 		//* These postconf commands will be executed on installation and update
-		$postconf_commands = array (
-			'virtual_alias_domains =',
-			'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, mysql:'.$config_dir.'/mysql-virtual_email2email.cf',
-			'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf',
-			'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf',
-			'virtual_mailbox_base = '.$cf['vmail_mailbox_base'],
-			'virtual_uid_maps = static:'.$cf['vmail_userid'],
-			'virtual_gid_maps = static:'.$cf['vmail_groupid'],
-			'smtpd_sasl_auth_enable = yes',
-			'broken_sasl_auth_clients = yes',
-			'smtpd_sasl_authenticated_header = yes',
-			'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination',
-			'smtpd_use_tls = yes',
-			'smtpd_tls_security_level = may',
-			'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert',
-			'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
-			'transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
-			'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
-			'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
-			'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
-			'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
-			'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
-			'maildrop_destination_concurrency_limit = 1',
-			'maildrop_destination_recipient_limit   = 1',
-			'virtual_transport = maildrop',
-			'header_checks = regexp:'.$config_dir.'/header_checks',
-			'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks',
-			'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks',
-			'body_checks = regexp:'.$config_dir.'/body_checks',
-			'inet_interfaces = all'
-		);
-		
+        $postconf_placeholders = array('{config_dir}' => $config_dir,
+                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+                                       '{vmail_userid}' => $cf['vmail_userid'],
+                                       '{vmail_groupid}' => $cf['vmail_groupid'],
+                                       '{rbl_list}' => $rbl_list);
+        
+        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_postfix.conf.master', 'tpl/fedora_postfix.conf.master');
+        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
+        
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
 			$postconf_commands = array_merge($postconf_commands,array(
@@ -278,7 +260,7 @@
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
             copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
         }
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
 		wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content);
 		
@@ -299,7 +281,7 @@
 		global $conf;
 		
 		$configfile = 'tpl/fedora_saslauthd_smtpd_conf.master';
-		$content = rf($configfile);
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_saslauthd_smtpd_conf.master', $configfile);
 		wf('/usr/lib/sasl2/smtpd.conf',$content);
 		if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl/smtpd.conf',$content);
 		if(is_dir('/usr/lib64')) wf('/usr/lib64/sasl2/smtpd.conf',$content);
@@ -315,7 +297,7 @@
 		if(is_file("$pam/smtp"))    copy("$pam/smtp", "$pam/smtp~");
 		if(is_file("$pam/smtp~"))   exec("chmod 400 $pam/smtp~");
 
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -338,7 +320,7 @@
             copy("$config_dir/$configfile", "$config_dir/$configfile~");
         }
 		exec("chmod 400 $config_dir/$configfile~");
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -421,11 +403,19 @@
 		
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-			copy('tpl/fedora_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot2.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/fedora_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            }
 		} else {
-			copy('tpl/fedora_dovecot.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/fedora_dovecot.conf.master',$config_dir.'/'.$configfile);
+            }
 		}
-		
+
 		//* dovecot-sql.conf
 		$configfile = 'dovecot-sql.conf';
 		if(is_file("$config_dir/$configfile")){
@@ -433,7 +423,7 @@
 			exec("chmod 400 $config_dir/$configfile~");
         }
 		
-		$content = rf("tpl/fedora_dovecot-sql.conf.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_dovecot-sql.conf.master', "tpl/fedora_dovecot-sql.conf.master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -452,7 +442,7 @@
 		$configfile = 'fedora_amavisd_conf';
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -483,7 +473,7 @@
 		// Only add the content if we had not addded it before
 		if(!stristr($content,"127.0.0.1:10025")) {
 			unset($content);
-			$content = rf("tpl/master_cf_amavis.master");
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
 			af($conf["postfix"]["config_dir"].'/master.cf',$content);
 		}
 		unset($content);
@@ -546,7 +536,7 @@
 		if(is_file("$config_dir/$configfile~")){
             exec("chmod 400 $config_dir/$configfile~");
         }
-		$content = rf('tpl/pureftpd_mysql.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $content);
 		$content = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $content);
@@ -557,7 +547,11 @@
 		exec("chown root:root $config_dir/$configfile");
 		
 		// copy our customized copy of pureftpd.conf to the pure-ftpd config directory
-		exec("cp tpl/fedora_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master')) {
+            exec("cp " . $conf['ispconfig_install_dir'].'/server/conf-custom/install/fedora_pureftpd_conf.master ' . "$config_dir/pure-ftpd.conf");
+        }else {
+            exec("cp tpl/fedora_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+        }
 		
 	}
 	
@@ -569,7 +563,7 @@
 		$configfile = 'mydns.conf';
 		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile,$conf["mydns"]["config_dir"].'/'.$configfile.'~');
 		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["mydns"]["config_dir"].'/'.$configfile.'~');
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -633,7 +627,7 @@
         $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
         
 		// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
-		$content = rf('tpl/apache_ispconfig.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
 		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
 
 		if(is_array($records) && count($records) > 0) {
@@ -727,7 +721,11 @@
 		if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__);
   		@mkdir("/etc/Bastille", octdec($directory_mode));
   		if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
-  		caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+  		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
+            caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+        } else {
+            caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+        }
   		caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
   		$content = rf("/etc/Bastille/bastille-firewall.cfg");
   		$content = str_replace("{DNS_SERVERS}", "", $content);
@@ -815,7 +813,7 @@
 		if(is_file($install_dir.'/interface/lib/'.$configfile)){
             copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
         }
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -839,7 +837,7 @@
 		if(is_file($install_dir.'/server/lib/'.$configfile)){
             copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
         }
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -1014,7 +1012,7 @@
         
         
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf("tpl/apache_ispconfig.vhost.master");
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
 		
 			// comment out the listen directive if port is 80 or 443
@@ -1055,7 +1053,7 @@
 				replaceLine('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter','PHPRC=','PHPRC=/etc/',0,0);
 				*/
 				//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-					$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
+					$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
 					$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
 					$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
 					if(!is_dir('/var/www/php-fcgi-scripts/ispconfig')) exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
@@ -1073,7 +1071,7 @@
 			$vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/nginx_ispconfig.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
 		
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
@@ -1100,7 +1098,7 @@
 			
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/php_fpm_pool.conf.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'ispconfig', $content);
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
@@ -1195,7 +1193,7 @@
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 		
-		$content = rf("tpl/mysql_clientdb.conf.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master");
 		$content = str_replace('{hostname}',$conf['mysql']['host'],$content);
 		$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
 		$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index bc6b499..382689c 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -81,35 +81,15 @@
 		}
 
 		//* These postconf commands will be executed on installation and update
-		$postconf_commands = array (
-			'virtual_alias_domains =',
-			'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, mysql:'.$config_dir.'/mysql-virtual_email2email.cf',
-			'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf',
-			'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf',
-			'virtual_mailbox_base = '.$cf['vmail_mailbox_base'],
-			'virtual_uid_maps = static:'.$cf['vmail_userid'],
-			'virtual_gid_maps = static:'.$cf['vmail_groupid'],
-			'smtpd_sasl_auth_enable = yes',
-			'broken_sasl_auth_clients = yes',
-			'smtpd_sasl_authenticated_header = yes',
-			'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination',
-			'smtpd_use_tls = yes',
-			'smtpd_tls_security_level = may',
-			'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert',
-			'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
-			'transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
-			'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
-			'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
-			'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
-			'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
-			'maildrop_destination_concurrency_limit = 1',
-			'maildrop_destination_recipient_limit   = 1',
-			'virtual_transport = maildrop',
-			'header_checks = regexp:'.$config_dir.'/header_checks',
-			'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks',
-			'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks',
-			'body_checks = regexp:'.$config_dir.'/body_checks'
-		);
+        $postconf_placeholders = array('{config_dir}' => $config_dir,
+                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+                                       '{vmail_userid}' => $cf['vmail_userid'],
+                                       '{vmail_groupid}' => $cf['vmail_groupid'],
+                                       '{rbl_list}' => $rbl_list);
+        
+        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/gentoo_postfix.conf.master', 'tpl/gentoo_postfix.conf.master');
+        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
 		
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
@@ -165,7 +145,7 @@
 		$this->write_config_file($configfile, $content);
 		
 		//* Writing the Maildrop mailfilter file
-		$content = rf('tpl/mailfilter.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailfilter.master', 'tpl/mailfilter.master');
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
 		
 		$this->write_config_file($cf['vmail_mailbox_base'].'/.mailfilter', $content);
@@ -612,7 +592,7 @@
 		
 			//if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') ) 
 			//{
-				$content = rf('tpl/apache_apps_fcgi_starter.master');
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps_fcgi_starter.master', 'tpl/apache_apps_fcgi_starter.master');
 				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
 				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
 				mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true);
@@ -652,7 +632,7 @@
 			$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'_':$conf['web']['apps_vhost_servername'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/nginx_apps.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_apps.vhost.master', 'tpl/nginx_apps.vhost.master');
 			
 			if($conf['web']['apps_vhost_ip'] == '_default_'){
 				$apps_vhost_ip = '';
@@ -678,7 +658,7 @@
 			
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/apps_php_fpm_pool.conf.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apps_php_fpm_pool.conf.master', 'tpl/apps_php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'apps', $content);
 			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
@@ -943,7 +923,7 @@
 			$this->write_config_file($vhost_path, $content);
 		
 			if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
 				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
 				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
 				@mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
@@ -961,7 +941,7 @@
 			$vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/nginx_ispconfig.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
 		
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
@@ -988,7 +968,7 @@
 			
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/php_fpm_pool.conf.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'ispconfig', $content);
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index 197aa15..57b2cd6 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -41,7 +41,7 @@
 		}
 
 		// load files
-		$content = rf('tpl/mm_cfg.py.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
 		$old_file = rf($full_file_name);
 
 		$old_options = array();
@@ -98,7 +98,11 @@
 		}
 		
 		if(is_dir('/etc/mailman')) {
-			copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+            } else {
+                copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+            }
 			chgrp($full_file_name,'mailman');
 			chmod($full_file_name,0750);
 		}
@@ -175,37 +179,15 @@
 		if($cf['vmail_mailbox_base'] != '' && strlen($cf['vmail_mailbox_base']) >= 10 && $this->is_update === false) exec('chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base']);
 		
 		//* These postconf commands will be executed on installation and update
-		$postconf_commands = array (
-			'virtual_alias_domains =',
-			'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, mysql:'.$config_dir.'/mysql-virtual_email2email.cf',
-			'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf',
-			'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf',
-			'virtual_mailbox_base = '.$cf['vmail_mailbox_base'],
-			'virtual_uid_maps = static:'.$cf['vmail_userid'],
-			'virtual_gid_maps = static:'.$cf['vmail_groupid'],
-			'smtpd_sasl_auth_enable = yes',
-			'broken_sasl_auth_clients = yes',
-			'smtpd_sasl_authenticated_header = yes',
-			'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination',
-			'smtpd_use_tls = yes',
-			'smtpd_tls_security_level = may',
-			'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert',
-			'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
-			'transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
-			'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
-			'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
-			'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
-			'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
-			'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
-			'maildrop_destination_concurrency_limit = 1',
-			'maildrop_destination_recipient_limit   = 1',
-			'virtual_transport = maildrop',
-			'header_checks = regexp:'.$config_dir.'/header_checks',
-			'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks',
-			'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks',
-			'body_checks = regexp:'.$config_dir.'/body_checks',
-			'inet_interfaces = all'
-		);
+        $postconf_placeholders = array('{config_dir}' => $config_dir,
+                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+                                       '{vmail_userid}' => $cf['vmail_userid'],
+                                       '{vmail_groupid}' => $cf['vmail_groupid'],
+                                       '{rbl_list}' => $rbl_list);
+        
+        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_postfix.conf.master', 'tpl/opensuse_postfix.conf.master');
+        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
 		
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
@@ -282,7 +264,7 @@
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
             copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
         }
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
 		wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content);
 		
@@ -353,7 +335,7 @@
 		if(is_file("$pam/smtp"))    copy("$pam/smtp", "$pam/smtp~");
 		if(is_file("$pam/smtp~"))   exec("chmod 400 $pam/smtp~");
 
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -376,7 +358,7 @@
             copy("$config_dir/$configfile", "$config_dir/$configfile~");
         }
 		exec("chmod 400 $config_dir/$configfile~");
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -456,9 +438,17 @@
 		
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-			copy('tpl/opensuse_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot2.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot2.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/opensuse_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            }
 		} else {
-			copy('tpl/opensuse_dovecot.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/opensuse_dovecot.conf.master',$config_dir.'/'.$configfile);
+            }
 		}
 		
 		//* dovecot-sql.conf
@@ -468,7 +458,7 @@
 			exec("chmod 400 $config_dir/$configfile~");
         }
 		
-		$content = rf("tpl/opensuse_dovecot-sql.conf.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_dovecot-sql.conf.master', "tpl/opensuse_dovecot-sql.conf.master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -487,7 +477,7 @@
 		$configfile = 'opensuse_amavisd_conf';
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf')) @copy($conf["amavis"]["config_dir"].'/amavisd.conf',$conf["amavis"]["config_dir"].'/amavisd.conf~');
 		if(is_file($conf["amavis"]["config_dir"].'/amavisd.conf~')) exec('chmod 400 '.$conf["amavis"]["config_dir"].'/amavisd.conf~');
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -517,7 +507,7 @@
 		// Only add the content if we had not addded it before
 		if(!stristr($content,"127.0.0.1:10025")) {
 			unset($content);
-			$content = rf("tpl/master_cf_amavis.master");
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', "tpl/master_cf_amavis.master");
 			af($conf["postfix"]["config_dir"].'/master.cf',$content);
 		}
 		unset($content);
@@ -577,7 +567,7 @@
 		if(is_file("$config_dir/$configfile~")){
             exec("chmod 400 $config_dir/$configfile~");
         }
-		$content = rf('tpl/pureftpd_mysql.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf["mysql"]["ispconfig_user"], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $content);
 		$content = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $content);
@@ -588,7 +578,11 @@
 		exec("chown root:root $config_dir/$configfile");
 		
 		// copy our customized copy of pureftpd.conf to the pure-ftpd config directory
-		exec("cp tpl/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/opensuse_pureftpd_conf.master')) {
+            exec("cp " . $conf['ispconfig_install_dir']."/server/conf-custom/install/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+        } else {
+            exec("cp tpl/opensuse_pureftpd_conf.master $config_dir/pure-ftpd.conf");
+        }
 		
 	}
 	
@@ -600,7 +594,7 @@
 		$configfile = 'mydns.conf';
 		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile)) copy($conf["mydns"]["config_dir"].'/'.$configfile,$conf["mydns"]["config_dir"].'/'.$configfile.'~');
 		if(is_file($conf["mydns"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["mydns"]["config_dir"].'/'.$configfile.'~');
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -646,7 +640,7 @@
         $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
         
 		//copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
-		$content = rf('tpl/apache_ispconfig.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
 		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
 
 		if(is_array($records) && count($records) > 0) {
@@ -782,7 +776,11 @@
 		if(is_dir("/etc/Bastille")) caselog("mv -f /etc/Bastille /etc/Bastille.backup", __FILE__, __LINE__);
   		@mkdir("/etc/Bastille", octdec($directory_mode));
   		if(is_dir("/etc/Bastille.backup/firewall.d")) caselog("cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/", __FILE__, __LINE__);
-  		caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+  		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
+            caselog("cp -f " . $conf['ispconfig_install_dir']."/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+        } else {
+            caselog("cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
+        }
   		caselog("chmod 644 /etc/Bastille/bastille-firewall.cfg", __FILE__, __LINE__);
   		$content = rf("/etc/Bastille/bastille-firewall.cfg");
   		$content = str_replace("{DNS_SERVERS}", "", $content);
@@ -870,7 +868,7 @@
 		if(is_file($install_dir.'/interface/lib/'.$configfile)){
             copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
         }
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -894,7 +892,7 @@
 		if(is_file($install_dir.'/server/lib/'.$configfile)){
             copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
         }
-		$content = rf("tpl/$configfile.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/$configfile.master");
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -1065,7 +1063,7 @@
         
 			// Dont just copy over the virtualhost template but add some custom settings
          
-			$content = rf("tpl/apache_ispconfig.vhost.master");
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', "tpl/apache_ispconfig.vhost.master");
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
 		
 			// comment out the listen directive if port is 80 or 443
@@ -1091,7 +1089,7 @@
 			wf("$vhost_conf_dir/ispconfig.vhost", $content);
 		
 			//if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
 				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
 				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
 				exec('mkdir -p /srv/www/php-fcgi-scripts/ispconfig');
@@ -1122,7 +1120,7 @@
 			$vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/nginx_ispconfig.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
 		
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
@@ -1149,7 +1147,7 @@
 			
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/php_fpm_pool.conf.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'ispconfig', $content);
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
@@ -1244,7 +1242,7 @@
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 		
-		$content = rf("tpl/mysql_clientdb.conf.master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', "tpl/mysql_clientdb.conf.master");
 		$content = str_replace('{hostname}',$conf['mysql']['host'],$content);
 		$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
 		$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 9673a76..9c61759 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -160,7 +160,7 @@
 			$distid = 'debian60';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian 6.0 (Squeeze/Sid) or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'6.0') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'7.0') || strstr(trim(file_get_contents('/etc/debian_version')),'7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 			$distname = 'Debian';
 			$distver = 'Wheezy/Sid';
 			$distid = 'debian60';
@@ -345,6 +345,12 @@
 	return false;
 }
 
+function rfsel($file, $file2) {
+    clearstatcache();
+    if(is_file($file)) return rf($file);
+    else return rf($file2);
+}
+
 function rf($file){
 	clearstatcache();
 	if(is_file($file)) {
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index c7b4ae7..2c97558 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -508,7 +508,7 @@
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.$configfile.'~');
 		}
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -528,9 +528,17 @@
 		if (is_dir($config_dir)) {
 			if(is_file($config_dir.'/'.$jk_init)) copy($config_dir.'/'.$jk_init, $config_dir.'/'.$jk_init.'~');
 			if(is_file($config_dir.'/'.$jk_chrootsh.'.master')) copy($config_dir.'/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh.'~');
-
-			copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
-			copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
+            
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
+            } else {
+                copy('tpl/'.$jk_init.'.master', $config_dir.'/'.$jk_init);
+            }
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
+            } else {
+                copy('tpl/'.$jk_chrootsh.'.master', $config_dir.'/'.$jk_chrootsh);
+            }
 		}
 
 		//* help jailkit fo find its ini files
@@ -550,7 +558,7 @@
 		}
 
 		// load files
-		$content = rf('tpl/mm_cfg.py.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mm_cfg.py.master', 'tpl/mm_cfg.py.master');
 		$old_file = rf($full_file_name);
 
 		$old_options = array();
@@ -604,7 +612,11 @@
 		}
 		
 		if(is_dir('/etc/mailman')) {
-			copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+			if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/mailman-virtual_to_transport.sh', $full_file_name);
+            } else {
+                copy('tpl/mailman-virtual_to_transport.sh',$full_file_name);
+            }
 			chgrp($full_file_name,'list');
 			chmod($full_file_name,0750);
 		}
@@ -681,42 +693,16 @@
 		}
 		unset($rbl_hosts);
 		unset($server_ini_array);
-
-		$postconf_commands = array (
-				'alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases',
-				'alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases',
-				'virtual_alias_domains =',
-				'virtual_alias_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_forwardings.cf, proxy:mysql:'.$config_dir.'/mysql-virtual_email2email.cf, hash:/var/lib/mailman/data/virtual-mailman',
-				'virtual_mailbox_domains = proxy:mysql:'.$config_dir.'/mysql-virtual_domains.cf',
-				'virtual_mailbox_maps = proxy:mysql:'.$config_dir.'/mysql-virtual_mailboxes.cf',
-				'virtual_mailbox_base = '.$cf['vmail_mailbox_base'],
-				'virtual_uid_maps = static:'.$cf['vmail_userid'],
-				'virtual_gid_maps = static:'.$cf['vmail_groupid'],
-				'inet_protocols=all',
-				'smtpd_sasl_auth_enable = yes',
-				'broken_sasl_auth_clients = yes',
-				'smtpd_sasl_authenticated_header = yes',
-				'smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:'.$config_dir.'/mysql-virtual_recipient.cf, reject_unauth_destination'. $rbl_list,
-				'smtpd_use_tls = yes',
-				'smtpd_tls_security_level = may',
-				'smtpd_tls_cert_file = '.$config_dir.'/smtpd.cert',
-				'smtpd_tls_key_file = '.$config_dir.'/smtpd.key',
-				'transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:'.$config_dir.'/mysql-virtual_transports.cf',
-				'relay_domains = mysql:'.$config_dir.'/mysql-virtual_relaydomains.cf',
-				'relay_recipient_maps = mysql:'.$config_dir.'/mysql-virtual_relayrecipientmaps.cf',
-				'proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps',
-				'smtpd_sender_restrictions = check_sender_access mysql:'.$config_dir.'/mysql-virtual_sender.cf',
-				'smtpd_client_restrictions = check_client_access mysql:'.$config_dir.'/mysql-virtual_client.cf',
-				'smtpd_client_message_rate_limit = 100',
-				'maildrop_destination_concurrency_limit = 1',
-				'maildrop_destination_recipient_limit   = 1',
-				'virtual_transport = maildrop',
-				'header_checks = regexp:'.$config_dir.'/header_checks',
-				'mime_header_checks = regexp:'.$config_dir.'/mime_header_checks',
-				'nested_header_checks = regexp:'.$config_dir.'/nested_header_checks',
-				'body_checks = regexp:'.$config_dir.'/body_checks',
-				'owner_request_special = no'
-		);
+        
+        $postconf_placeholders = array('{config_dir}' => $config_dir,
+                                       '{vmail_mailbox_base}' => $cf['vmail_mailbox_base'],
+                                       '{vmail_userid}' => $cf['vmail_userid'],
+                                       '{vmail_groupid}' => $cf['vmail_groupid'],
+                                       '{rbl_list}' => $rbl_list);
+        
+        $postconf_tpl = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_postfix.conf.master', 'tpl/debian_postfix.conf.master');
+        $postconf_tpl = strtr($postconf_tpl, $postconf_placeholders);
+        $postconf_commands = array_filter(explode("\n", $postconf_tpl)); // read and remove empty lines
 
 		//* These postconf commands will be executed on installation only
 		if($this->is_update == false) {
@@ -784,7 +770,7 @@
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)) {
 			copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
 		}
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{dist_postfix_vmail_mailbox_base}', $cf['vmail_mailbox_base'], $content);
 		wf($cf['vmail_mailbox_base'].'/.'.$configfile, $content);
 
@@ -823,7 +809,7 @@
 
 		if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf')) copy($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$conf['postfix']['config_dir'].'/sasl/smtpd.conf~');
 		if(is_file($conf['postfix']['config_dir'].'/sasl/smtpd.conf~')) chmod($conf['postfix']['config_dir'].'/sasl/smtpd.conf~', 0400);
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -868,7 +854,7 @@
 		if(is_file($pam.'/smtp'))    copy($pam.'/smtp', $pam.'/smtp~');
 		if(is_file($pam.'/smtp~'))   chmod($pam.'/smtp~', 0400);
 
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -891,7 +877,7 @@
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 		}
 		chmod($config_dir.'/'.$configfile.'~', 0400);
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -970,9 +956,17 @@
 
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-			copy('tpl/debian_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot2.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/debian_dovecot2.conf.master',$config_dir.'/'.$configfile);
+            }
 		} else {
-			copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile);
+            if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master')) {
+                copy($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot.conf.master', $config_dir.'/'.$configfile);
+            } else {
+                copy('tpl/debian_dovecot.conf.master',$config_dir.'/'.$configfile);
+            }
 		}
 
 		//* dovecot-sql.conf
@@ -981,7 +975,7 @@
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 		}
 		if(is_file($config_dir.'/'.$configfile.'~')) chmod($config_dir.'/'.$configfile.'~', 0400);
-		$content = rf('tpl/debian_dovecot-sql.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/debian_dovecot-sql.conf.master', 'tpl/debian_dovecot-sql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -1001,7 +995,7 @@
 		$configfile = 'amavisd_user_config';
 		if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user')) copy($conf['amavis']['config_dir'].'/conf.d/50-user',$conf['amavis']['config_dir'].'/50-user~');
 		if(is_file($conf['amavis']['config_dir'].'/conf.d/50-user~')) chmod($conf['amavis']['config_dir'].'/conf.d/50-user~', 0400);
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -1037,7 +1031,7 @@
 		// Only add the content if we had not addded it before
 		if(!stristr($content,'127.0.0.1:10025')) {
 			unset($content);
-			$content = rf('tpl/master_cf_amavis.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/master_cf_amavis.master', 'tpl/master_cf_amavis.master');
 			af($conf['postfix']['config_dir'].'/master.cf',$content);
 		}
 		unset($content);
@@ -1092,7 +1086,7 @@
 		if(is_file($config_dir.'/'.$configfile.'~')) {
 			chmod($config_dir.'/'.$configfile.'~', 0400);
 		}
-		$content = rf('tpl/pureftpd_mysql.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/pureftpd_mysql.conf.master', 'tpl/pureftpd_mysql.conf.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -1128,7 +1122,7 @@
 		$configfile = 'mydns.conf';
 		if(is_file($conf['mydns']['config_dir'].'/'.$configfile)) copy($conf['mydns']['config_dir'].'/'.$configfile,$conf['mydns']['config_dir'].'/'.$configfile.'~');
 		if(is_file($conf['mydns']['config_dir'].'/'.$configfile.'~')) chmod($conf['mydns']['config_dir'].'/'.$configfile.'~', 0400);
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}',$conf['mysql']['database'],$content);
@@ -1171,7 +1165,7 @@
 		$configfile = 'pdns.local';
 		if(is_file($conf['powerdns']['config_dir'].'/'.$configfile)) copy($conf['powerdns']['config_dir'].'/'.$configfile,$conf['powerdns']['config_dir'].'/'.$configfile.'~');
 		if(is_file($conf['powerdns']['config_dir'].'/'.$configfile.'~')) chmod($conf['powerdns']['config_dir'].'/'.$configfile.'~', 0400);
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['ispconfig_user'],$content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{powerdns_database}',$conf['powerdns']['database'],$content);
@@ -1235,7 +1229,7 @@
 
 		// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
 
-		$content = rf('tpl/apache_ispconfig.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.conf.master', 'tpl/apache_ispconfig.conf.master');
 		$records = $this->db->queryAllRecords('SELECT * FROM '.$conf['mysql']['master_database'].'.server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
 
 		if(is_array($records) && count($records) > 0) {
@@ -1362,7 +1356,7 @@
 		$configfile = 'squid.conf';
 		if(is_file($conf["squid"]["config_dir"].'/'.$configfile)) copy($conf["squid"]["config_dir"].'/'.$configfile,$conf["squid"]["config_dir"].'/'.$configfile.'~');
 		if(is_file($conf["squid"]["config_dir"].'/'.$configfile.'~')) exec('chmod 400 '.$conf["squid"]["config_dir"].'/'.$configfile.'~');
-		$content = rf("tpl/".$configfile.".master");
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', "tpl/".$configfile.".master");
 		$content = str_replace('{server_name}',$server_name,$content);
 		$content = str_replace('{ip_address}',$ip_address, $content);
 		$content = str_replace('{config_dir}',$conf['squid']['config_dir'], $content);
@@ -1390,7 +1384,11 @@
 		if(is_dir('/etc/Bastille')) caselog('mv -f /etc/Bastille /etc/Bastille.backup', __FILE__, __LINE__);
 		@mkdir('/etc/Bastille', 0700);
 		if(is_dir('/etc/Bastille.backup/firewall.d')) caselog('cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/', __FILE__, __LINE__);
-		caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
+		if(is_file($conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master')) {
+            caselog('cp -f ' . $conf['ispconfig_install_dir'].'/server/conf-custom/install/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
+        } else {
+            caselog('cp -f tpl/bastille-firewall.cfg.master /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
+        }
 		caselog('chmod 644 /etc/Bastille/bastille-firewall.cfg', __FILE__, __LINE__);
 		$content = rf('/etc/Bastille/bastille-firewall.cfg');
 		$content = str_replace('{DNS_SERVERS}', '', $content);
@@ -1448,7 +1446,7 @@
 		$configfile = 'vlogger-dbi.conf';
 		if(is_file($conf['vlogger']['config_dir'].'/'.$configfile)) copy($conf['vlogger']['config_dir'].'/'.$configfile,$conf['vlogger']['config_dir'].'/'.$configfile.'~');
 		if(is_file($conf['vlogger']['config_dir'].'/'.$configfile.'~')) chmod($conf['vlogger']['config_dir'].'/'.$configfile.'~', 0400);
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$content = str_replace('{mysql_server_ispconfig_user}',$conf['mysql']['master_ispconfig_user'],$content);
 			$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['master_ispconfig_password'], $content);
@@ -1500,7 +1498,7 @@
 			$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/apache_apps.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps.vhost.master', 'tpl/apache_apps.vhost.master');
 
 			$content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content);
 			$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
@@ -1526,7 +1524,7 @@
 			}
 
 			if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) {
-				$content = rf('tpl/apache_apps_fcgi_starter.master');
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps_fcgi_starter.master', 'tpl/apache_apps_fcgi_starter.master');
 				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
 				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
 				mkdir($conf['web']['website_basedir'].'/php-fcgi-scripts/apps', 0755, true);
@@ -1566,7 +1564,7 @@
 			$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'_':$conf['web']['apps_vhost_servername'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/nginx_apps.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_apps.vhost.master', 'tpl/nginx_apps.vhost.master');
 
 			if($conf['web']['apps_vhost_ip'] == '_default_'){
 				$apps_vhost_ip = '';
@@ -1602,7 +1600,7 @@
 
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/apps_php_fpm_pool.conf.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apps_php_fpm_pool.conf.master', 'tpl/apps_php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'apps', $content);
 			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
@@ -1677,7 +1675,7 @@
 		if(is_file($install_dir.'/interface/lib/'.$configfile)) {
 			copy($install_dir.'/interface/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~');
 		}
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}',$conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -1701,7 +1699,7 @@
 		if(is_file($install_dir.'/server/lib/'.$configfile)) {
 			copy($install_dir.'/server/lib/'.$configfile, $install_dir.'/interface/lib/'.$configfile.'~');
 		}
-		$content = rf('tpl/'.$configfile.'.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/'.$configfile.'.master', 'tpl/'.$configfile.'.master');
 		$content = str_replace('{mysql_server_ispconfig_user}', $conf['mysql']['ispconfig_user'], $content);
 		$content = str_replace('{mysql_server_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
@@ -1894,7 +1892,7 @@
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/apache_ispconfig.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig.vhost.master', 'tpl/apache_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
 
 			// comment out the listen directive if port is 80 or 443
@@ -1926,7 +1924,7 @@
 				}
 			}
 			//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$content = rf('tpl/apache_ispconfig_fcgi_starter.master');
+				$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_ispconfig_fcgi_starter.master', 'tpl/apache_ispconfig_fcgi_starter.master');
 				$content = str_replace('{fastcgi_bin}', $conf['fastcgi']['fastcgi_bin'], $content);
 				$content = str_replace('{fastcgi_phpini_path}', $conf['fastcgi']['fastcgi_phpini_path'], $content);
 				@mkdir('/var/www/php-fcgi-scripts/ispconfig', 0755, true);
@@ -1943,7 +1941,7 @@
 			$vhost_conf_enabled_dir = $conf['nginx']['vhost_conf_enabled_dir'];
 
 			// Dont just copy over the virtualhost template but add some custom settings
-			$content = rf('tpl/nginx_ispconfig.vhost.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_ispconfig.vhost.master', 'tpl/nginx_ispconfig.vhost.master');
 			$content = str_replace('{vhost_port}', $conf['nginx']['vhost_port'], $content);
 
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
@@ -1970,7 +1968,7 @@
 
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
-			$content = rf('tpl/php_fpm_pool.conf.master');
+			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
 			$content = str_replace('{fpm_pool}', 'ispconfig', $content);
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
@@ -2070,7 +2068,7 @@
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
 
-		$content = rf('tpl/mysql_clientdb.conf.master');
+		$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/mysql_clientdb.conf.master', 'tpl/mysql_clientdb.conf.master');
 		$content = str_replace('{hostname}',$conf['mysql']['host'],$content);
 		$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
 		$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
@@ -2162,12 +2160,17 @@
 		global $conf, $dist;
 
 		$final_path = '';
-		$dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master";
-		if (file_exists($dist_template)) {
+        $dist_template = $conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $tLocal . '.master';
+        if (file_exists($dist_template)) {
 			$final_path = $dist_template;
 		} else {
-			$final_path = "tpl/$tLocal.master";
-		}
+            $dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$tLocal.master";
+            if (file_exists($dist_template)) {
+                $final_path = $dist_template;
+            } else {
+                $final_path = "tpl/$tLocal.master";
+            }
+        }
 
 		if (!$tRf) {
 			return $final_path;
diff --git a/install/sql/incremental/upd_0051.sql b/install/sql/incremental/upd_0051.sql
new file mode 100644
index 0000000..4395e2e
--- /dev/null
+++ b/install/sql/incremental/upd_0051.sql
@@ -0,0 +1,2 @@
+UPDATE `country` SET `iso` = 'RS', `name` = 'SERBIA', `printable_name` = 'Serbia', `iso3` = 'SRB', `numcode` = 381 WHERE `iso` = 'CS';
+INSERT INTO `country` (`iso`, `name`, `printable_name`, `iso3`, `numcode`) VALUES ('ME', 'MONTENEGRO', 'Montenegro', 'MNE', 382);
\ No newline at end of file
diff --git a/install/sql/incremental/upd_0052.sql b/install/sql/incremental/upd_0052.sql
index 346589b..d92bc32 100644
--- a/install/sql/incremental/upd_0052.sql
+++ b/install/sql/incremental/upd_0052.sql
@@ -2,3 +2,4 @@
 ALTER TABLE `mail_domain` ADD `dkim_public` MEDIUMTEXT NOT NULL AFTER `domain`;
 ALTER TABLE `mail_domain` ADD `dkim_private` MEDIUMTEXT NOT NULL AFTER `domain`;
 ALTER TABLE `mail_domain` ADD `dkim` ENUM( 'n', 'y' ) NOT NULL AFTER `domain`;
+ALTER TABLE `client` ADD `default_slave_dnsserver` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1' AFTER `limit_dns_zone`;
diff --git a/install/sql/incremental/upd_0053.sql b/install/sql/incremental/upd_0053.sql
new file mode 100644
index 0000000..14487c6
--- /dev/null
+++ b/install/sql/incremental/upd_0053.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `web_domain` ADD `last_quota_notification` DATE NULL DEFAULT NULL;
+ALTER TABLE `mail_user` ADD `last_quota_notification` DATE NULL DEFAULT NULL;
diff --git a/install/sql/incremental/upd_0054.sql b/install/sql/incremental/upd_0054.sql
new file mode 100644
index 0000000..7e7f0c3
--- /dev/null
+++ b/install/sql/incremental/upd_0054.sql
@@ -0,0 +1 @@
+ALTER TABLE `web_domain` ADD `rewrite_rules` MEDIUMTEXT NULL DEFAULT NULL;
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index 2a2d4a0..cb2033d 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -204,6 +204,7 @@
   `limit_aps` int(11) NOT NULL DEFAULT '-1',
   `default_dnsserver` int(11) unsigned NOT NULL DEFAULT '1',
   `limit_dns_zone` int(11) NOT NULL DEFAULT '-1',
+  `default_slave_dnsserver` int(11) unsigned NOT NULL DEFAULT '1',
   `limit_dns_slave_zone` int(11) NOT NULL DEFAULT '-1',
   `limit_dns_record` int(11) NOT NULL DEFAULT '-1',
   `default_dbserver` int(11) NOT NULL DEFAULT '1',
@@ -839,6 +840,7 @@
   `disablesieve` enum('n','y') NOT NULL default 'n',
   `disablelda` enum('n','y') NOT NULL default 'n',
   `disabledoveadm` enum('n','y') NOT NULL default 'n',
+  `last_quota_notification` date NULL default NULL,
   PRIMARY KEY  (`mailuser_id`),
   KEY `server_id` (`server_id`,`email`),
   KEY `email_access` (`email`,`access`)
@@ -1761,6 +1763,8 @@
   `traffic_quota_lock` enum('n','y') NOT NULL default 'n',
   `fastcgi_php_version` varchar(255) DEFAULT NULL,
   `proxy_directives` mediumtext,
+  `last_quota_notification` date NULL default NULL,
+  `rewrite_rules` mediumtext,
   PRIMARY KEY  (`domain_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
@@ -2036,7 +2040,7 @@
 ('ST', 'SAO TOME AND PRINCIPE', 'Sao Tome and Principe', 'STP', 678),
 ('SA', 'SAUDI ARABIA', 'Saudi Arabia', 'SAU', 682),
 ('SN', 'SENEGAL', 'Senegal', 'SEN', 686),
-('CS', 'SERBIA AND MONTENEGRO', 'Serbia and Montenegro', NULL, NULL),
+('RS', 'SERBIA', 'Serbia', 'SRB', 381),
 ('SC', 'SEYCHELLES', 'Seychelles', 'SYC', 690),
 ('SL', 'SIERRA LEONE', 'Sierra Leone', 'SLE', 694),
 ('SG', 'SINGAPORE', 'Singapore', 'SGP', 702),
@@ -2086,7 +2090,8 @@
 ('EH', 'WESTERN SAHARA', 'Western Sahara', 'ESH', 732),
 ('YE', 'YEMEN', 'Yemen', 'YEM', 887),
 ('ZM', 'ZAMBIA', 'Zambia', 'ZMB', 894),
-('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716);
+('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716),
+('ME', 'MONTENEGRO', 'Montenegro', 'MNE', 382);
 
 -- --------------------------------------------------------
 
diff --git a/install/tpl/apache_ispconfig.vhost.master b/install/tpl/apache_ispconfig.vhost.master
index 15b2956..f3b32c0 100644
--- a/install/tpl/apache_ispconfig.vhost.master
+++ b/install/tpl/apache_ispconfig.vhost.master
@@ -18,7 +18,7 @@
     DocumentRoot /var/www/ispconfig/
     SuexecUserGroup ispconfig ispconfig
     <Directory /var/www/ispconfig/>
-      Options Indexes FollowSymLinks MultiViews +ExecCGI
+      Options -Indexes FollowSymLinks MultiViews +ExecCGI
       AllowOverride AuthConfig Indexes Limit Options FileInfo
       AddHandler fcgid-script .php
       FCGIWrapper /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter .php
diff --git a/install/tpl/debian6_dovecot2.conf.master b/install/tpl/debian6_dovecot2.conf.master
index f9bf270..f359260 100644
--- a/install/tpl/debian6_dovecot2.conf.master
+++ b/install/tpl/debian6_dovecot2.conf.master
@@ -31,6 +31,10 @@
   }
   user = root
 }
+service imap-login {
+  client_limit = 1000
+  process_limit = 500
+}
 protocol imap {
   mail_plugins = quota imap_quota
 }
diff --git a/install/tpl/debian_dovecot2.conf.master b/install/tpl/debian_dovecot2.conf.master
index f9bf270..f359260 100644
--- a/install/tpl/debian_dovecot2.conf.master
+++ b/install/tpl/debian_dovecot2.conf.master
@@ -31,6 +31,10 @@
   }
   user = root
 }
+service imap-login {
+  client_limit = 1000
+  process_limit = 500
+}
 protocol imap {
   mail_plugins = quota imap_quota
 }
diff --git a/install/tpl/debian_postfix.conf.master b/install/tpl/debian_postfix.conf.master
new file mode 100644
index 0000000..85f5d07
--- /dev/null
+++ b/install/tpl/debian_postfix.conf.master
@@ -0,0 +1,33 @@
+alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
+alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
+virtual_alias_domains =
+virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, proxy:mysql:{config_dir}/mysql-virtual_email2email.cf, hash:/var/lib/mailman/data/virtual-mailman
+virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
+virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
+virtual_mailbox_base = {vmail_mailbox_base}
+virtual_uid_maps = static:{vmail_userid}
+virtual_gid_maps = static:{vmail_groupid}
+inet_protocols=all
+smtpd_sasl_auth_enable = yes
+broken_sasl_auth_clients = yes
+smtpd_sasl_authenticated_header = yes
+smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:{config_dir}/mysql-virtual_recipient.cf, reject_unauth_destination{rbl_list}
+smtpd_use_tls = yes
+smtpd_tls_security_level = may
+smtpd_tls_cert_file = {config_dir}/smtpd.cert
+smtpd_tls_key_file = {config_dir}/smtpd.key
+transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:{config_dir}/mysql-virtual_transports.cf
+relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
+relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
+proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
+smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf
+smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
+smtpd_client_message_rate_limit = 100
+maildrop_destination_concurrency_limit = 1
+maildrop_destination_recipient_limit   = 1
+virtual_transport = maildrop
+header_checks = regexp:{config_dir}/header_checks
+mime_header_checks = regexp:{config_dir}/mime_header_checks
+nested_header_checks = regexp:{config_dir}/nested_header_checks
+body_checks = regexp:{config_dir}/body_checks
+owner_request_special = no
\ No newline at end of file
diff --git a/install/tpl/fedora_dovecot2.conf.master b/install/tpl/fedora_dovecot2.conf.master
index 6826306..75fad4f 100644
--- a/install/tpl/fedora_dovecot2.conf.master
+++ b/install/tpl/fedora_dovecot2.conf.master
@@ -31,6 +31,10 @@
   }
   user = root
 }
+service imap-login {
+  client_limit = 1000
+  process_limit = 500
+}
 protocol imap {
   mail_plugins = quota imap_quota
 }
diff --git a/install/tpl/fedora_postfix.conf.master b/install/tpl/fedora_postfix.conf.master
new file mode 100644
index 0000000..c84bd11
--- /dev/null
+++ b/install/tpl/fedora_postfix.conf.master
@@ -0,0 +1,30 @@
+virtual_alias_domains =
+virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, proxy:mysql:{config_dir}/mysql-virtual_email2email.cf
+virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
+virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
+virtual_mailbox_base = {vmail_mailbox_base}
+virtual_uid_maps = static:{vmail_userid}
+virtual_gid_maps = static:{vmail_groupid}
+smtpd_sasl_auth_enable = yes
+broken_sasl_auth_clients = yes
+smtpd_sasl_authenticated_header = yes
+smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:{config_dir}/mysql-virtual_recipient.cf, reject_unauth_destination{rbl_list}
+smtpd_use_tls = yes
+smtpd_tls_security_level = may
+smtpd_tls_cert_file = {config_dir}/smtpd.cert
+smtpd_tls_key_file = {config_dir}/smtpd.key
+transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:{config_dir}/mysql-virtual_transports.cf
+relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
+relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
+proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
+smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf
+smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
+smtpd_client_message_rate_limit = 100
+maildrop_destination_concurrency_limit = 1
+maildrop_destination_recipient_limit   = 1
+virtual_transport = maildrop
+header_checks = regexp:{config_dir}/header_checks
+mime_header_checks = regexp:{config_dir}/mime_header_checks
+nested_header_checks = regexp:{config_dir}/nested_header_checks
+body_checks = regexp:{config_dir}/body_checks
+inet_interfaces = all
\ No newline at end of file
diff --git a/install/tpl/gentoo_postfix.conf.master b/install/tpl/gentoo_postfix.conf.master
new file mode 100644
index 0000000..c84bd11
--- /dev/null
+++ b/install/tpl/gentoo_postfix.conf.master
@@ -0,0 +1,30 @@
+virtual_alias_domains =
+virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, proxy:mysql:{config_dir}/mysql-virtual_email2email.cf
+virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
+virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
+virtual_mailbox_base = {vmail_mailbox_base}
+virtual_uid_maps = static:{vmail_userid}
+virtual_gid_maps = static:{vmail_groupid}
+smtpd_sasl_auth_enable = yes
+broken_sasl_auth_clients = yes
+smtpd_sasl_authenticated_header = yes
+smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:{config_dir}/mysql-virtual_recipient.cf, reject_unauth_destination{rbl_list}
+smtpd_use_tls = yes
+smtpd_tls_security_level = may
+smtpd_tls_cert_file = {config_dir}/smtpd.cert
+smtpd_tls_key_file = {config_dir}/smtpd.key
+transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:{config_dir}/mysql-virtual_transports.cf
+relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
+relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
+proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
+smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf
+smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
+smtpd_client_message_rate_limit = 100
+maildrop_destination_concurrency_limit = 1
+maildrop_destination_recipient_limit   = 1
+virtual_transport = maildrop
+header_checks = regexp:{config_dir}/header_checks
+mime_header_checks = regexp:{config_dir}/mime_header_checks
+nested_header_checks = regexp:{config_dir}/nested_header_checks
+body_checks = regexp:{config_dir}/body_checks
+inet_interfaces = all
\ No newline at end of file
diff --git a/install/tpl/opensuse_dovecot2.conf.master b/install/tpl/opensuse_dovecot2.conf.master
index f9bf270..f359260 100644
--- a/install/tpl/opensuse_dovecot2.conf.master
+++ b/install/tpl/opensuse_dovecot2.conf.master
@@ -31,6 +31,10 @@
   }
   user = root
 }
+service imap-login {
+  client_limit = 1000
+  process_limit = 500
+}
 protocol imap {
   mail_plugins = quota imap_quota
 }
diff --git a/install/tpl/opensuse_postfix.conf.master b/install/tpl/opensuse_postfix.conf.master
new file mode 100644
index 0000000..c84bd11
--- /dev/null
+++ b/install/tpl/opensuse_postfix.conf.master
@@ -0,0 +1,30 @@
+virtual_alias_domains =
+virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, proxy:mysql:{config_dir}/mysql-virtual_email2email.cf
+virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
+virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
+virtual_mailbox_base = {vmail_mailbox_base}
+virtual_uid_maps = static:{vmail_userid}
+virtual_gid_maps = static:{vmail_groupid}
+smtpd_sasl_auth_enable = yes
+broken_sasl_auth_clients = yes
+smtpd_sasl_authenticated_header = yes
+smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, check_recipient_access mysql:{config_dir}/mysql-virtual_recipient.cf, reject_unauth_destination{rbl_list}
+smtpd_use_tls = yes
+smtpd_tls_security_level = may
+smtpd_tls_cert_file = {config_dir}/smtpd.cert
+smtpd_tls_key_file = {config_dir}/smtpd.key
+transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:{config_dir}/mysql-virtual_transports.cf
+relay_domains = mysql:{config_dir}/mysql-virtual_relaydomains.cf
+relay_recipient_maps = mysql:{config_dir}/mysql-virtual_relayrecipientmaps.cf
+proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
+smtpd_sender_restrictions = check_sender_access mysql:{config_dir}/mysql-virtual_sender.cf
+smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual_client.cf
+smtpd_client_message_rate_limit = 100
+maildrop_destination_concurrency_limit = 1
+maildrop_destination_recipient_limit   = 1
+virtual_transport = maildrop
+header_checks = regexp:{config_dir}/header_checks
+mime_header_checks = regexp:{config_dir}/mime_header_checks
+nested_header_checks = regexp:{config_dir}/nested_header_checks
+body_checks = regexp:{config_dir}/body_checks
+inet_interfaces = all
\ No newline at end of file
diff --git a/install/tpl/server.ini.master b/install/tpl/server.ini.master
index 007d51b..d22a072 100644
--- a/install/tpl/server.ini.master
+++ b/install/tpl/server.ini.master
@@ -14,8 +14,15 @@
 nameservers=8.8.8.8,8.8.4.4
 firewall=bastille
 loglevel=2
+admin_notify_events=1
 backup_dir=/var/backup
 backup_mode=rootgz
+monit_url=
+monit_user=
+monit_password=
+munin_url=
+munin_user=
+munin_password=
 
 [mail]
 module=postfix_mysql
@@ -35,6 +42,10 @@
 message_size_limit=0
 mailbox_quota_stats=y
 realtime_blackhole_list=
+overquota_notify_admin=y
+overquota_notify_client=y
+overquota_notify_freq=7
+overquota_notify_onok=n
 sendmail_path=/usr/sbin/sendmail
 
 [getmail]
@@ -58,7 +69,7 @@
 apps_vhost_port=8081
 apps_vhost_ip=_default_
 apps_vhost_servername=
-php_open_basedir=[website_path]/web:[website_path]/private:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/php
+php_open_basedir=[website_path]/web:[website_path]/private:[website_path]/tmp:/var/www/[website_domain]/web:/srv/www/[website_domain]/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin
 htaccess_allow_override=All
 awstats_conf_dir=/etc/awstats
 awstats_data_dir=/var/lib/awstats
@@ -82,8 +93,12 @@
 connect_userid_to_webid=n
 connect_userid_to_webid_start=10000
 web_folder_protection=y
-php_ini_check_minutes=1
-
+<<<<<<< .minephp_ini_check_minutes=1
+=======overquota_notify_admin=y
+overquota_notify_client=y
+overquota_notify_freq=7
+overquota_notify_onok=n
+>>>>>>> .theirs
 [dns]
 bind_user=root
 bind_group=bind
diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index a79942d..74f8400 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -130,10 +130,21 @@
 	}
 	
 	public function get_ispconfig_url() {
+		global $app;
+		
 		$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
-		$url .= '://'.$_SERVER['SERVER_NAME'];
-		if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
-			$url .= ':'.$_SERVER['SERVER_PORT'];
+		if($_SERVER['SERVER_NAME'] != '_') {
+			$url .= '://'.$_SERVER['SERVER_NAME'];
+			if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
+				$url .= ':'.$_SERVER['SERVER_PORT'];
+			}
+		} else {
+			$app->uses("getconf");
+			$server_config = $app->getconf->get_server_config(1,'server');
+			$url .= '://'.$server_config['hostname'];
+			if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
+				$url .= ':'.$_SERVER['SERVER_PORT'];
+			}
 		}
 		return $url;
 	}
diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index e30a711..d49af96 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -414,16 +414,22 @@
             $this->body = "This is a multi-part message in MIME format.\n\n";
             
             if($text) {
-                $this->body .= "--{$this->mime_boundary}\n" .
+                /*$this->body .= "--{$this->mime_boundary}\n" .
                               "Content-Type:text/plain; charset=\"" . strtolower($this->mail_charset) . "\"\n" .
-                              "Content-Transfer-Encoding: 7bit\n\n" . $this->text_part . "\n\n";
-            }
+                              "Content-Transfer-Encoding: 7bit\n\n" . $this->text_part . "\n\n";*/
+				$this->body .= "--{$this->mime_boundary}\n" .
+                              "Content-Type:text/plain; charset=\"UTF-8\"\n" .
+                              "Content-Transfer-Encoding: 8bit\n\n" . $this->text_part . "\n\n";
+			}
             
             if($html) {
-                $this->body .= "--{$this->mime_boundary}\n" .
+                /*$this->body .= "--{$this->mime_boundary}\n" .
                                "Content-Type:text/html; charset=\"" . strtolower($this->mail_charset) . "\"\n" . 
-                               "Content-Transfer-Encoding: 7bit\n\n" . $this->html_part . "\n\n";
-            }
+                               "Content-Transfer-Encoding: 7bit\n\n" . $this->html_part . "\n\n";*/
+				$this->body .= "--{$this->mime_boundary}\n" .
+                              "Content-Type:text/html; charset=\"UTF-8\"\n" .
+                              "Content-Transfer-Encoding: 8bit\n\n" . $this->html_part . "\n\n";
+			}
             
             if($attach) {
                 foreach($this->attachments as $att) {
@@ -490,17 +496,42 @@
         $this->_is_signed = true;
     }
     
+    private function _char_to_hex($matches) {
+        return '=' . strtoupper(dechex(ord($matches[1])));
+    }
+    
     /**
     * Function to encode a header if necessary
     * according to RFC2047
     * @access private
     */
     private function _encodeHeader($input, $charset = 'ISO-8859-1') {
-        preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches);
-        foreach ($matches[1] as $value) {
-            $replacement = preg_replace('/([\x20\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value);
-            $input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
-        }
+		preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches);
+		foreach ($matches[1] as $value) {
+			$replacement = preg_replace_callback('/([\x20\x80-\xFF])/', array($this, '_char_to_hex'), $value);
+			$input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
+		}
+        
+        return $input;
+    }
+	
+	/**
+    * Function to encode the subject if necessary
+    * according to RFC2047
+    * @access private
+    */
+    private function _encodeSubject($input, $charset = 'ISO-8859-1') {
+        /*
+		if($charset == 'UTF-8' && function_exists('imap_8bit')) {
+			$input = "=?utf-8?Q?" . imap_8bit($input) . "?=";
+		} else {
+			preg_match_all('/(\s?\w*[\x80-\xFF]+\w*\s?)/', $input, $matches);
+			foreach ($matches[1] as $value) {
+				$replacement = preg_replace('/([\x20\x80-\xFF])/e', '"=" . strtoupper(dechex(ord("\1")))', $value);
+				$input = str_replace($value, '=?' . $charset . '?Q?' . $replacement . '?=', $input);
+			}
+		}*/
+		$input='=?UTF-8?B?'.base64_encode($input).'?=';
         
         return $input;
     }
@@ -578,7 +609,8 @@
             //$subject = $this->_encodeHeader($this->headers['Subject'], $this->mail_charset);
             $subject = $this->headers['Subject'];
             
-            $enc_subject = $this->_encodeHeader($subject, $this->mail_charset);
+            //$enc_subject = $this->_encodeHeader($subject, $this->mail_charset);
+			$enc_subject = $this->_encodeSubject($subject, $this->mail_charset);
             unset($this->headers['Subject']);
         }
         
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index e690a1c..b3a59e9 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -180,9 +180,10 @@
         if(@is_array($this->listDef['item'])) { 
             foreach($this->listDef['item'] as $i) {
                 $field = $i['field'];
+				$table = $i['table'];
                 // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
 		        if(isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_SESSION['search'][$list_name][$search_prefix.$field] != ''){
-                    $sql_where .= " $field ".$i['op']." '".$app->db->quote($i['prefix'].$_SESSION['search'][$list_name][$search_prefix.$field].$i['suffix'])."' and";
+                    $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$_SESSION['search'][$list_name][$search_prefix.$field].$i['suffix'])."' and";
                 }
             }
         }
@@ -216,7 +217,7 @@
         if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
 
         $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
-        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
+        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where");
         $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
 
 
@@ -357,6 +358,16 @@
 							}
 						}
                         break;
+					case 'DATETIMETSTAMP':
+                        if ($record[$key] > 0) {
+							// is value int?
+							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
+	                        	$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
+							} else {
+	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+							}
+						}
+                        break;
 					case 'DATE':
                         if ($record[$key] > 0) {
 							// is value int?
@@ -422,6 +433,12 @@
 						    $record[$key] = date('Y-m-d',strtotime($record[$key]));
                         }
                         break;
+						
+					case 'DATETIMETSTAMP':
+                        if($record[$key] > 0) {
+						    $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
+                        }
+                        break;
 					
                     case 'DATE':
                         if($record[$key] != '' && $record[$key] != '0000-00-00') {
diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index aef3371..acb0b96 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -36,7 +36,27 @@
 	public $SQLExtWhere = '';
 	public $SQLOrderBy = '';
 	public $SQLExtSelect = '';
-	
+	private $sortKeys;
+    
+    private function _sort($aOne, $aTwo) {
+        if(!is_array($aOne) || !is_array($aTwo)) return 0;
+        
+        if(!is_array($this->sortKeys)) $this->sortKeys = array($this->sortKeys);
+        foreach($this->sortKeys as $sKey => $sDir) {
+            if(is_numeric($sKey)) {
+                $sKey = $sDir;
+                $sDir = 'ASC';
+            }
+            $a = $aOne[$sKey];
+            $b = $aTwo[$sKey];
+            if(is_string($a)) $a = strtolower($a);
+            if(is_string($b)) $b = strtolower($b);
+            if($a < $b) return ($sDir == 'DESC' ? 1 : -1);
+            elseif($a > $b) return ($sDir == 'DESC' ? -1 : 1);
+        }
+        return 0;
+    }
+    
 	public function onLoad()
     {
 		global $app, $conf, $list_def_file;
@@ -59,28 +79,49 @@
 		
 		//* Manipulate order by for sorting / Every list has a stored value
 		//* Against notice error
-		if(!isset($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
-		  $_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = '';
+		if(!isset($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
+		  $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = '';
 		}
-
+        
+        $php_sort = false;
+        
 		if(!empty($_GET['orderby'])){
 		  $order = str_replace('tbl_col_','',$_GET['orderby']);
+		  
 		  //* Check the css class submited value
 		  if (preg_match("/^[a-z\_]{1,}$/",$order)) {
-		    if($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] == $order){
-		      $_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order.' DESC';
+            
+            if(isset($app->listform->listDef['phpsort']) && is_array($app->listform->listDef['phpsort']) && in_array($order, $app->listform->listDef['phpsort'])) {
+                $php_sort = true;
+            } else {
+                // prepend correct table
+                $prepend_table = $app->listform->listDef['table'];
+                if(trim($app->listform->listDef['additional_tables']) != '' && is_array($app->listform->listDef['item']) && count($app->listform->listDef['item']) > 0) {
+                    foreach($app->listform->listDef['item'] as $field) {
+                        if($field['field'] == $order && $field['table'] != ''){
+                            $prepend_table = $field['table'];
+                            break;
+                        }
+                    }
+                }
+                $order = $prepend_table.'.'.$order;
+            }
+			
+		    if($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] == $order){
+				$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order.' DESC';
 		    } else {
-		      $_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order;
+				$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = $order;
 		    }
+            $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php'] = $php_sort;
 		  }
 		}
 
 		// If a manuel oder by like customers isset the sorting will be infront
-		if(!empty($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
-		  if(empty($this->SQLOrderBy)){
-		    $this->SQLOrderBy = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
+		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']) && !$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']){
+          if(empty($this->SQLOrderBy)){
+		    $this->SQLOrderBy = "ORDER BY ".$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
 		  } else {
-		    $this->SQLOrderBy = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ',$this->SQLOrderBy);
+		    $this->SQLOrderBy = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ',$this->SQLOrderBy);
 		  }
 		}
 		
@@ -95,7 +136,18 @@
 				$records_new[] = $this->prepareDataRow($rec);
 			}
 		}
-
+        
+        if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']) && $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']) {
+            $order_by = $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'];
+            $order_dir = 'ASC';
+            if(substr($order_by, -5) === ' DESC') {
+                $order_by = substr($order_by, 0, -5);
+                $order_dir = 'DESC';
+            }
+            $this->sortKeys = array($order_by => $order_dir);
+            uasort($records_new, array($this, '_sort'));
+        }
+        
 		$app->tpl->setLoop('records',$records_new);
 
 		$this->onShow();
@@ -133,7 +185,7 @@
 		return $rec;
 	}
 	
-	private function getQueryString() {
+	public function getQueryString() {
 		global $app;
 		$sql_where = '';
 
@@ -151,6 +203,7 @@
 		}
 		
 		$sql_where = $app->listform->getSearchSQL($sql_where);
+		if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
 		$app->tpl->setVar($app->listform->searchValues);
 		
 		$order_by_sql = $this->SQLOrderBy;
@@ -161,109 +214,26 @@
 
 		$extselect = '';
 		$join = '';
-		if(!empty($_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
-		  $order = str_replace(' DESC','',$_SESSION['search'][$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
-		  if($order == 'server_id' && $app->listform->listDef['table'] != 'server'){
-		    $join .= ' LEFT JOIN server as s ON '.$app->listform->listDef['table'].'.server_id = s.server_id ';
-		    $order_by_sql = str_replace('server_id','s.server_name',$order_by_sql);
-		  } elseif($order == 'client_id' && $app->listform->listDef['table'] != 'client'){
-		    $join .= ' LEFT JOIN client as c ON '.$app->listform->listDef['table'].'.client_id = c.client_id ';
-		    $order_by_sql = str_replace('client_id','c.contact_name',$order_by_sql);
-		  } elseif($order == 'parent_domain_id'){
-		    $join .= ' LEFT JOIN web_domain as wd ON '.$app->listform->listDef['table'].'.parent_domain_id = wd.domain_id ';
-			//$order_by_sql = str_replace(' domain', ' '.$app->listform->listDef['table'].'.domain',$order_by_sql);
-		    //$order_by_sql = str_replace('parent_domain_id','wd.domain',$order_by_sql);
-			$order_by_sql = preg_replace('@( |,|^)(domain)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $order_by_sql);
-			$order_by_sql = preg_replace('@( |,|^)(parent_domain_id)( |,|$)@', '$1wd.domain$3', $order_by_sql);
-			
-		    //$sql_where = str_replace('type',$app->listform->listDef['table'].'.type',$sql_where);
-			//$sql_where = str_replace(' domain',' '.$app->listform->listDef['table'].'.domain',$sql_where);
-			$sql_where = preg_replace('@( |,|^)(type)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $sql_where);
-			$sql_where = preg_replace('@( |,|^)(domain)( |,|$)@', '$1'.$app->listform->listDef['table'].'.$2$3', $sql_where);
-		  } elseif($order == 'sys_groupid'){
-		    $join .= ' LEFT JOIN sys_group as sg ON '.$app->listform->listDef['table'].'.sys_groupid = sg.groupid ';
-		    $order_by_sql = str_replace('sys_groupid','sg.name',$order_by_sql);
-		  } elseif($order == 'rid'){
-		    $join .= ' LEFT JOIN spamfilter_users as su ON '.$app->listform->listDef['table'].'.rid = su.id ';
-		    $order_by_sql = str_replace('rid','su.email',$order_by_sql);
-		  } elseif($order == 'policy_id'){
-		    $join .= ' LEFT JOIN spamfilter_policy as sp ON '.$app->listform->listDef['table'].'.policy_id = sp.id ';
-		    $order_by_sql = str_replace('policy_id','sp.policy_name',$order_by_sql);
-		  } elseif($order == 'web_folder_id'){
-		    $join .= ' LEFT JOIN web_folder as wf ON '.$app->listform->listDef['table'].'.web_folder_id = wf.web_folder_id ';
-		    $order_by_sql = str_replace('web_folder_id','wf.path',$order_by_sql);
-		  } elseif($order == 'ostemplate_id' && $app->listform->listDef['table'] != 'openvz_ostemplate'){
-		    $join .= ' LEFT JOIN openvz_ostemplate as oo ON '.$app->listform->listDef['table'].'.ostemplate_id = oo.ostemplate_id ';
-		    $order_by_sql = str_replace('ostemplate_id','oo.template_name',$order_by_sql);
-		  } elseif($order == 'template_id' && $app->listform->listDef['table'] != 'openvz_template'){
-		    $join .= ' LEFT JOIN openvz_template as ot ON '.$app->listform->listDef['table'].'.template_id = ot.template_id ';
-		    $order_by_sql = str_replace('template_id','ot.template_name',$order_by_sql);
-		  } elseif($order == 'sender_id' && $app->listform->listDef['table'] != 'sys_user'){
-		    $join .= ' LEFT JOIN sys_user as su ON '.$app->listform->listDef['table'].'.sender_id = su.userid ';
-		    $order_by_sql = str_replace('sender_id','su.username',$order_by_sql);
-		  } elseif($order == 'web_traffic_last_month'){
-		    $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $tmp_month = date('m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
-		    $order_by_sql = str_replace('web_traffic_last_month','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'web_traffic_this_month'){
-		    $tmp_year = date('Y');
-		    $tmp_month = date('m');
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
-		    $order_by_sql = str_replace('web_traffic_this_month','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'web_traffic_last_year'){
-		    $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
-		    $order_by_sql = str_replace('web_traffic_last_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'web_traffic_this_year'){
-		    $tmp_year = date('Y');
-		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
-		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
-		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
-		    $order_by_sql = str_replace('web_traffic_this_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
-		  } elseif($order == 'mail_traffic_last_month'){
-		    $tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";
-		    $order_by_sql = str_replace('mail_traffic_last_month','traffic',$order_by_sql);
-		  } elseif($order == 'mail_traffic_this_month'){
-		    $tmp_date = date('Y-m');
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";
-		    $order_by_sql = str_replace('mail_traffic_this_month','traffic',$order_by_sql);
-		  } elseif($order == 'mail_traffic_last_year'){
-		    $tmp_date = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
-		    $extselect .= ', SUM(mt.traffic) as calctraffic';
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";;
-		    $order_by_sql = str_replace('mail_traffic_last_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
-		  } elseif($order == 'mail_traffic_this_year'){
-		    $tmp_date = date('Y');
-		    $extselect .= ', SUM(mt.traffic) as calctraffic';
-		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
-		    $sql_where .= " AND mt.month like '$tmp_date%'";
-		    $order_by_sql = str_replace('mail_traffic_this_year','calctraffic',$order_by_sql);
-		    $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
-		  }
-		}
 		
 		if($this->SQLExtSelect != '') {
 			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; 
 			$extselect .= $this->SQLExtSelect;
 		}
+		
+		$table_selects = array();
+		$table_selects[] = trim($app->listform->listDef['table']).'.*';
+		$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
+		if($app->listform->listDef['additional_tables'] != ''){
+			$additional_tables = explode(',', $app->listform->listDef['additional_tables']);
+			foreach($additional_tables as $additional_table){
+				$table_selects[] = trim($additional_table).'.*';
+			}
+		}
+		$select = implode(', ', $table_selects);
 
-		return 'SELECT '.$app->listform->listDef['table'].'.*'.$extselect.' FROM '.$app->listform->listDef['table']."$join WHERE $sql_where $order_by_sql $limit_sql";
+		$sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
+		//echo $sql;
+		return $sql;
 	}
 	
 	
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index ed7c3ed..66ba90d 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -2137,12 +2137,12 @@
             return false;
         }
         
-        if (preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)) {
+        if(!preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)){
             $this->server->fault('no_domain_found', 'Invalid domain name.');
             return false;
         }
 
-        $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin.'%');
+        $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin."%'");
         if(isset($rec['id'])) {
             return $app->functions->intval($rec['id']);
         } else {
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 510c726..f9cf59d 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -817,7 +817,8 @@
 			if(@is_numeric($primary_id)) {
 				$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
             	return $app->db->queryOneRecord($sql);
-			} elseif (@is_array($primary_id)) {
+			} elseif (@is_array($primary_id) || @is_object($primary_id)) {
+                if(@is_object($primary_id)) $primary_id = get_object_vars($primary_id); // do not use cast (array)xxx because it returns private and protected properties!
 				$sql_offset = 0;
                 $sql_limit = 0;
                 $sql_where = '';
diff --git a/interface/lib/classes/sites_database_plugin.inc.php b/interface/lib/classes/sites_database_plugin.inc.php
index b8181aa..37cc546 100644
--- a/interface/lib/classes/sites_database_plugin.inc.php
+++ b/interface/lib/classes/sites_database_plugin.inc.php
@@ -33,7 +33,7 @@
 	public function processDatabaseInsert($form_page) {
         global $app;
         
-		if($form_page->dataRecord["parent_domain_id"] > 0) {
+		/*if($form_page->dataRecord["parent_domain_id"] > 0) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($form_page->dataRecord["parent_domain_id"]));
 		
 			//* The Database user shall be owned by the same group then the website
@@ -42,14 +42,14 @@
             $sys_groupid = $form_page->dataRecord['sys_groupid'];
         }
         
-
+        
         if($form_page->dataRecord['database_user_id']) {
             // check if there has already been a database on this server with that user
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "')");
             
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $form_page->dataRecord['server_id'];
                     $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user);
@@ -59,23 +59,23 @@
 
         if($form_page->dataRecord['database_ro_user_id']) {
             // check if there has already been a database on this server with that user
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "')");
             
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $form_page->dataRecord['server_id'];
                     $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user);
                 }
             }
-        }
+        }*/
     }
     
     public function processDatabaseUpdate($form_page) {
         global $app;
         
-        $old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($form_page->id));
+        /*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($form_page->id));
         
         if($form_page->dataRecord["parent_domain_id"] > 0) {
             $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($form_page->dataRecord["parent_domain_id"]));
@@ -89,10 +89,10 @@
         // check if database user has changed
         if($old_record['database_user_id'] && $old_record['database_user_id'] != $form_page->dataRecord['database_user_id'] && $old_record['database_user_id'] != $form_page->dataRecord['database_ro_user_id']) {
             // check if any database on the server still uses this one
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "' AND `database_id` != '" . $app->functions->intval($form_page->id) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `database_id` != '" . $app->functions->intval($form_page->id) . "'");
             if($check['cnt'] < 1) {
                 // send a datalog delete
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $form_page->dataRecord['server_id'];
                     $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array());
@@ -102,24 +102,24 @@
         // check if readonly database user has changed
         if($old_record['database_ro_user_id'] && $old_record['database_ro_user_id'] != $form_page->dataRecord['database_ro_user_id'] && $old_record['database_ro_user_id'] != $form_page->dataRecord['database_user_id']) {
             // check if any database on the server still uses this one
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "' AND `database_id` != '" . $app->functions->intval($form_page->id) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "') AND `database_id` != '" . $app->functions->intval($form_page->id) . "'");
             if($check['cnt'] < 1) {
                 // send a datalog delete
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $form_page->dataRecord['server_id'];
                     $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array());
                 }
             }
-        }
+        }*/
         
-        if($form_page->dataRecord['database_user_id']) {
+        /*if($form_page->dataRecord['database_user_id']) {
             // check if there has already been a database on this server with that user
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "')");
             
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $form_page->dataRecord['server_id'];
                     $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user);
@@ -129,30 +129,30 @@
 
         if($form_page->dataRecord['database_ro_user_id']) {
             // check if there has already been a database on this server with that user
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "')");
             
             if($check && $check['cnt'] < 1) {
                 // we need to make a datalog insert for the database users that are connected to this database
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $form_page->dataRecord['server_id'];
                     $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user);
                 }
             }
-        }
+        }*/
         
     }
     
     public function processDatabaseDelete($primary_id) {
         global $app;
         
-        $old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($primary_id));
+        /*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($primary_id));
         if($old_record['database_user_id']) {
             // check if any database on the server still uses this one
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "' AND `database_id` != '" . $app->functions->intval($primary_id) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `database_id` != '" . $app->functions->intval($primary_id) . "'");
             if($check['cnt'] < 1) {
                 // send a datalog delete
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $old_record['server_id'];
                     $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array());
@@ -161,16 +161,16 @@
         }
         if($old_record['database_ro_user_id']) {
             // check if any database on the server still uses this one
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "' AND `database_id` != '" . $app->functions->intval($primary_id) . "'");
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "') AND `database_id` != '" . $app->functions->intval($primary_id) . "'");
             if($check['cnt'] < 1) {
                 // send a datalog delete
-                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "'");
+                $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "'");
                 if($db_user) {
                     $db_user['server_id'] = $old_record['server_id'];
                     $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array());
                 }
             }
-        }
+        }*/
         
     }
 }
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 05e53fb..23b05ce 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -949,6 +949,7 @@
 										$field_value_array[] = $field_value;
 									}
 									foreach($field_value_array as $field_value) {
+										$field_value = trim($field_value);
 										if(function_exists('filter_var')) {
 											if(!filter_var($field_value,FILTER_VALIDATE_IP)) {
 												$errmsg = $validator['errmsg'];
diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php
index 72d0dfe..070e349 100644
--- a/interface/lib/classes/tpl.inc.php
+++ b/interface/lib/classes/tpl.inc.php
@@ -192,12 +192,12 @@
             if (is_array($k)) {
                 foreach($k as $key => $value){
                     $key = ($this->OPTIONS['CASELESS']) ? strtolower(trim($key)) : trim($key);
-                    if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
+                    if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $key) && $value !== null ) {
                         $this->_vars[$key] = $value;
                     }
                 }
             } else {
-                if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
+                if (preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k) && $v !== null) {
                     if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
                     $this->_vars[trim($k)] = $v;
                 } else {
@@ -243,7 +243,7 @@
             for ($i = 0; $i < $num_args; $i++) {
                 $var = func_get_arg($i);
                 if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-                if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;
+                if (!preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $var)) continue;
                 unset($this->_vars[$var]);
             }
             return true;
@@ -300,12 +300,14 @@
          */
         public function setLoop($k, $v)
         {
-            if (is_array($v) && preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $k)) {
+            if (is_array($v) && preg_match('/^[A-Za-z]+[A-Za-z0-9_]*$/', $k)) {
                 $k = ($this->OPTIONS['CASELESS']) ? strtolower(trim($k)) : trim($k);
                 $this->_arrvars[$k] = array();
                 if ($this->OPTIONS['SET_LOOP_VAR'] && !empty($v)) $this->setvar($k, 1);
                 if (($this->_arrvars[$k] = $this->_arrayBuild($v)) == false) {
                     vlibTemplateError::raiseError('VT_WARNING_INVALID_ARR', WARNING, $k);
+                } else {
+                    $this->vars['_'.$k.'_num'] = count($v);
                 }
             }
             return true;
@@ -849,8 +851,8 @@
                 $regex.=    '[\"\']?';
                 $regex.= ')?\s*';
                 $regex.= '(?:>|\/>|}|-->){1}';
-                $regex.= '([\r\n|\n|\r])?/ie';
-                $data = preg_replace($regex,"\$this->_parseTag(array('\\0','\\1','\\2','\\3','\\4','\\5','\\6','\\7','\\8','\\9'));",$data);
+                $regex.= '([\r\n|\n|\r])?/i';
+                $data = preg_replace_callback($regex, array($this, _parseTag), $data);
 
                 if ($this->_cache) { // add cache if need be
                     $this->_createCache($data);
diff --git a/interface/lib/classes/validate_ftpuser.inc.php b/interface/lib/classes/validate_ftpuser.inc.php
index 0682650..60768a3 100644
--- a/interface/lib/classes/validate_ftpuser.inc.php
+++ b/interface/lib/classes/validate_ftpuser.inc.php
@@ -47,7 +47,7 @@
         
         
         $ftp_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM ftp_user WHERE ftp_user_id = '".$app->db->quote($app->tform->primary_id)."'");
-        if(!$ftp_data["parent_domain_id"]) {
+        if(!is_array($ftp_data) || $ftp_data["parent_domain_id"] < 1) {
             $errmsg = $validator['errmsg'];
             if(isset($app->tform->wordbook[$errmsg])) {
                 return $app->tform->wordbook[$errmsg]."<br>\r\n";
@@ -57,7 +57,7 @@
         }
         
         $domain_data = $app->db->queryOneRecord("SELECT domain_id, document_root FROM web_domain WHERE domain_id = '".$app->db->quote($ftp_data["parent_domain_id"])."'");
-        if(!$domain_data["domain_id"]) {
+        if(!is_array($domain_data) || $domain_data["domain_id"] < 1) {
             $errmsg = $validator['errmsg'];
             if(isset($app->tform->wordbook[$errmsg])) {
                 return $app->tform->wordbook[$errmsg]."<br>\r\n";
@@ -75,6 +75,9 @@
 		
 		if(stristr($field_value,'..') or stristr($field_value,'./') or stristr($field_value,'/.')) $is_ok = false;
         
+		//* Final check if docroot path of website is >= 5 chars
+		if(strlen($doc_root) < 5) $is_ok = false;
+		
         if($is_ok == false) {
             $errmsg = $validator['errmsg'];
             if(isset($app->tform->wordbook[$errmsg])) {
diff --git a/interface/lib/plugins/sites_web_database_user_plugin.inc.php b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
index 30c1e22..791ee59 100644
--- a/interface/lib/plugins/sites_web_database_user_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
@@ -27,7 +27,7 @@
         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
+        // also make sure that the user can not delete entry created by an admin
         if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
             $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
             $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_user_id = ".$page_form->id);
@@ -36,6 +36,6 @@
             $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
             $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$page_form->id);
         }
-        $app->db->query("UPDATE web_database_user SET server_id = '" . $app->functions->intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id);
+        //$app->db->query("UPDATE web_database_user SET server_id = '" . $app->functions->intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id);
 	}
 }              	
\ No newline at end of file
diff --git a/interface/web/admin/form/server_config.tform.php b/interface/web/admin/form/server_config.tform.php
index fb5bf87..c83075f 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -150,6 +150,14 @@
 			'width' => '40',
 			'maxlength' => '255'
 		),
+		'admin_notify_events' => array(
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'value' => array('3' => 'no_notifications_txt', '0' => 'Debug', '1' => 'Warnings', '2' => 'Errors'),
+			'width' => '40',
+			'maxlength' => '255'
+		),
 		'backup_dir' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -166,6 +174,62 @@
 			'formtype' => 'SELECT',
 			'default' => 'userzip',
 			'value' => array('userzip' => 'backup_mode_userzip', 'rootgz' => 'backup_mode_rootgz'),
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'monit_url' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
+                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+                                                                'errmsg'=> 'monit_url_error_regex'),
+                                                ),
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'monit_user' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'monit_password' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'munin_url' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
+                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+                                                                'errmsg'=> 'munin_url_error_regex'),
+                                                ),
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'munin_user' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
+		'munin_password' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
 		),
@@ -331,23 +395,38 @@
 			'formtype' => 'TEXT',
 			'default' => '',
 			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(,\s*(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))*$/',
+														'regex' => '/^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])(,\s*(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]))*)?$/',
 														'errmsg'=> 'rbl_error_regex'),
 									),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
 		),
-		'sendmail_path' => array(
+		'overquota_notify_admin' => array(
 			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value' => array(0 => 'n', 1 => 'y')
+		),
+		'overquota_notify_client' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value' => array(0 => 'n', 1 => 'y')
+		),
+		'overquota_notify_freq' => array(
+			'datatype' => 'INTEGER',
 			'formtype' => 'TEXT',
-			'default' => '/usr/sbin/sendmail',
-			'validators' => array(0 => array('type' => 'NOTEMPTY',
-					'errmsg' => 'sendmail_path_error_empty'),
-			),
+			'default' => '7',
 			'value' => '',
-			'width' => '40',
-			'maxlength' => '255'
+            'width' => '20',
+            'maxlength' => '255'
+		),
+		'overquota_notify_onok' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value' => array(0 => 'n', 1 => 'y')
 		),
 	##################################
 	# ENDE Datatable fields
@@ -563,6 +642,32 @@
 			'default' => 'y',
 			'value' => array(0 => 'n', 1 => 'y')
 		),
+		'overquota_notify_admin' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value' => array(0 => 'n', 1 => 'y')
+		),
+		'overquota_notify_client' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value' => array(0 => 'n', 1 => 'y')
+		),
+		'overquota_notify_freq' => array(
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '7',
+			'value' => '',
+            'width' => '20',
+            'maxlength' => '255'
+		),
+		'overquota_notify_onok' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value' => array(0 => 'n', 1 => 'y')
+		),
 		'user' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
diff --git a/interface/web/admin/form/server_ip.tform.php b/interface/web/admin/form/server_ip.tform.php
index 98fa07d..e565e1e 100644
--- a/interface/web/admin/form/server_ip.tform.php
+++ b/interface/web/admin/form/server_ip.tform.php
@@ -105,7 +105,7 @@
 			'formtype'	=> 'SELECT',
 			'default'	=> '',
 			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT client_id,CONCAT(contact_name,' :: ',username) as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
+										'querystring' => "SELECT client_id,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
 										'keyfield'=> 'client_id',
 										'valuefield'=> 'name'
 									 ),
diff --git a/interface/web/admin/form/server_php.tform.php b/interface/web/admin/form/server_php.tform.php
index cc20572..58c1d7f 100644
--- a/interface/web/admin/form/server_php.tform.php
+++ b/interface/web/admin/form/server_php.tform.php
@@ -100,7 +100,7 @@
 			'formtype'	=> 'SELECT',
 			'default'	=> '',
 			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT client_id,CONCAT(contact_name,' :: ',username) as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
+										'querystring' => "SELECT client_id,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM client WHERE {AUTHSQL} ORDER BY contact_name",
 										'keyfield'=> 'client_id',
 										'valuefield'=> 'name'
 									 ),
diff --git a/interface/web/admin/form/software_package.tform.php b/interface/web/admin/form/software_package.tform.php
new file mode 100644
index 0000000..96ce5aa
--- /dev/null
+++ b/interface/web/admin/form/software_package.tform.php
@@ -0,0 +1,116 @@
+<?php
+
+/*
+Copyright (c) 2008, Till Brehm, projektfarm Gmbh
+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.
+*/
+
+/*
+	Form Definition
+
+	Tabellendefinition
+
+	Datentypen:
+	- INTEGER (Wandelt Ausdrücke in Int um)
+	- DOUBLE
+	- CURRENCY (Formatiert Zahlen nach Währungsnotation)
+	- VARCHAR (kein weiterer Format Check)
+	- TEXT (kein weiterer Format Check)
+	- DATE (Datumsformat, Timestamp Umwandlung)
+
+	Formtype:
+	- TEXT (normales Textfeld)
+	- TEXTAREA (normales Textfeld)
+	- PASSWORD (Feldinhalt wird nicht angezeigt)
+	- SELECT (Gibt Werte als option Feld aus)
+	- RADIO
+	- CHECKBOX
+	- FILE
+
+	VALUE:
+	- Wert oder Array
+
+	Hinweis:
+	Das ID-Feld ist nicht bei den Table Values einzufügen.
+
+
+*/
+
+$form["title"] 			= "Software Package";
+$form["description"] 	= "Modify software package details";
+$form["name"] 			= "software_package";
+$form["action"]			= "software_package_edit.php";
+$form["db_table"]		= "software_package";
+$form["db_table_idx"]	= "package_id";
+$form["db_history"]		= "no";
+$form["tab_default"]	= "software_package";
+$form["list_default"]	= "software_package_list.php";
+$form["auth"]			= 'yes';
+
+$form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
+$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
+$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
+$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
+
+$form["tabs"]['software_package'] = array (
+	'title' 	=> "Software Package",
+	'width' 	=> 80,
+	'template' 	=> "templates/software_package_edit.htm",
+	'fields' 	=> array (
+	##################################
+	# Beginn Datenbankfelder
+	##################################
+		'package_title' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> '',
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '40',
+			'maxlength'	=> '40',
+			'rows'		=> '',
+			'cols'		=> ''
+		),
+		'package_key' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'TEXT',
+			'validators'	=> '',
+			'default'	=> '',
+			'value'		=> '',
+			'separator'	=> '',
+			'width'		=> '40',
+			'maxlength'	=> '40',
+			'rows'		=> '',
+			'cols'		=> ''
+		),
+	##################################
+	# ENDE Datenbankfelder
+	##################################
+	)
+);
+?>
\ No newline at end of file
diff --git a/interface/web/admin/form/software_repo.tform.php b/interface/web/admin/form/software_repo.tform.php
index 5d0fd11..0396e6f 100644
--- a/interface/web/admin/form/software_repo.tform.php
+++ b/interface/web/admin/form/software_repo.tform.php
@@ -60,7 +60,7 @@
 */
 
 $form["title"] 			= "Software Repository";
-$form["description"] 	= "Software Repositoy which may contain addons or updates";
+$form["description"] 	= "Software Repository which may contain addons or updates";
 $form["name"] 			= "software_repo";
 $form["action"]			= "software_repo_edit.php";
 $form["db_table"]		= "software_repo";
diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php
index d44b6ad..da67f6b 100644
--- a/interface/web/admin/form/system_config.tform.php
+++ b/interface/web/admin/form/system_config.tform.php
@@ -214,7 +214,8 @@
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
 			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}(\?.+)?$/',
+                                                                /*'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}(\?.+)?$/',*/
+																'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
                                                                 'errmsg'=> 'webmail_url_error_regex'),
                                                 ),
 			'default'	=> '',
diff --git a/interface/web/admin/lib/lang/de.lng b/interface/web/admin/lib/lang/de.lng
index cca00fe..0a7af75 100644
--- a/interface/web/admin/lib/lang/de.lng
+++ b/interface/web/admin/lib/lang/de.lng
@@ -35,7 +35,7 @@
 $wb['Domains'] = 'Domains';
 $wb['Misc'] = 'Diverses';
 $wb['Software'] = 'Apps & Add-Ons';
-$wb['Repositories'] = 'Bibliotheken';
+$wb['Repositories'] = 'Repositories';
 $wb['Packages'] = 'Pakete';
 $wb['Updates'] = 'Updates';
 $wb['Language Editor'] = 'Sprachen Editor';
diff --git a/interface/web/admin/lib/lang/de_server_config.lng b/interface/web/admin/lib/lang/de_server_config.lng
index 3611969..b6f1051 100644
--- a/interface/web/admin/lib/lang/de_server_config.lng
+++ b/interface/web/admin/lib/lang/de_server_config.lng
@@ -171,10 +171,21 @@
 $wb['overtraffic_notify_admin_txt'] = 'Überschreiten des Transfer Limits an den Administrator senden';
 $wb['overtraffic_notify_client_txt'] = 'Überschreiten des Transfer Limits an den Kunden senden';
 $wb['rbl_error_regex'] = 'Bitte geben Sie gültige RBL-Hostnamen an.';
-$wb['php_ini_check_minutes_txt'] = 'Pr&uuml;fe System php.ini Dateien auf &Auml;nderungen alle';
-$wb['php_ini_check_minutes_info_txt'] = 'Minute(n) (0 deaktiviert diese Funktion)';
-$wb['php_ini_check_minutes_error_empty'] = 'Der Wert f&uuml;r die Einstellung der php.ini Pr&uuml;fung ist ung&uuml;ltig.';
-$wb["rbl_error_regex"] = 'Bitte geben Sie gültige RBL-Hostnamen an.';
-$wb["sendmail_path_txt"] = 'Pfad zu Sendmail';
-$wb["sendmail_path_error_empty"] = 'Sendmail Pfad ist leer.';
+$wb['overquota_notify_admin_txt'] = 'Quota-Warnungen an den Administrator senden';
+$wb['overquota_notify_client_txt'] = 'Quota-Warnungen an den Kunden senden';
+$wb['overquota_notify_onok_txt'] = 'Meldung an den Kunden senden, wenn Belegung wieder ok';
+$wb['overquota_notify_freq_txt'] = 'Quota-Warnung alle X Tage versenden';
+$wb['overquota_notify_freq_note_txt'] = '0 = Meldung nur einmalig versenden, keine Wiederholung';
+$wb['admin_notify_events_txt'] = 'Sende E-Mail an Administrator ab folgendem Level';
+$wb['no_notifications_txt'] = 'Keine Benachrichtigungen';
+$wb['monit_url_txt'] = 'Monit-URL';
+$wb['monit_user_txt'] = 'Monit-Benutzer';
+$wb['monit_password_txt'] = 'Monit-Passwort';
+$wb['monit_url_error_regex'] = 'Ungültige Monit-URL';
+$wb['monit_url_note_txt'] = 'Platzhalter:';
+$wb['munin_url_txt'] = 'Munin-URL';
+$wb['munin_user_txt'] = 'Munin-Benutzer';
+$wb['munin_password_txt'] = 'Munin-Passwort';
+$wb['munin_url_error_regex'] = 'Ungültige Munin-URL';
+$wb['munin_url_note_txt'] = 'Platzhalter:';
 ?>
diff --git a/interface/web/admin/lib/lang/de_software_package.lng b/interface/web/admin/lib/lang/de_software_package.lng
new file mode 100644
index 0000000..4c3431b
--- /dev/null
+++ b/interface/web/admin/lib/lang/de_software_package.lng
@@ -0,0 +1,6 @@
+<?php
+$wb['package_title_txt'] = 'Paket-Titel';
+$wb['package_key_txt'] = 'Paket-Key';
+$wb['Software Package'] = 'Software-Paket';
+$wb['Modify software package details'] = 'Software-Paket-Einstellungen bearbeiten';
+?>
diff --git a/interface/web/admin/lib/lang/de_software_package_install.lng b/interface/web/admin/lib/lang/de_software_package_install.lng
index cd4b20d..1ef69d1 100644
--- a/interface/web/admin/lib/lang/de_software_package_install.lng
+++ b/interface/web/admin/lib/lang/de_software_package_install.lng
@@ -1,6 +1,6 @@
 <?php
 $wb['head_txt'] = 'Softwarepaket installieren';
-$wb['install_key_txt'] = 'Installations Key eingeben';
+$wb['install_key_txt'] = 'Installationskey eingeben';
 $wb['btn_save_txt'] = 'Installation starten';
 $wb['btn_cancel_txt'] = 'Abbrechen';
 ?>
diff --git a/interface/web/admin/lib/lang/de_software_package_list.lng b/interface/web/admin/lib/lang/de_software_package_list.lng
index 0d74780..75b7504 100644
--- a/interface/web/admin/lib/lang/de_software_package_list.lng
+++ b/interface/web/admin/lib/lang/de_software_package_list.lng
@@ -7,5 +7,7 @@
 $wb['toolsarea_head_txt'] = 'Pakete';
 $wb['repoupdate_txt'] = 'Softwarepakete Liste updaten';
 $wb['package_id_txt'] = 'Lokale App ID';
-$wb['no_packages_txt'] = 'No packages available';
+$wb['no_packages_txt'] = 'Keine Pakete verfügbar';
+$wb['edit_txt'] = 'Bearbeiten';
+$wb['delete_txt'] = 'Löschen';
 ?>
diff --git a/interface/web/admin/lib/lang/de_software_repo.lng b/interface/web/admin/lib/lang/de_software_repo.lng
index bbacc85..2a8cf15 100644
--- a/interface/web/admin/lib/lang/de_software_repo.lng
+++ b/interface/web/admin/lib/lang/de_software_repo.lng
@@ -1,7 +1,8 @@
 <?php
-$wb['repo_name_txt'] = 'Bibliothek';
+$wb['repo_name_txt'] = 'Repository';
 $wb['repo_url_txt'] = 'URL';
 $wb['repo_username_txt'] = 'Benutzername (optional)';
 $wb['repo_password_txt'] = 'Passwort (optional)';
 $wb['active_txt'] = 'Aktiv';
+$wb['Software Repository which may contain addons or updates'] = 'Software-Repository, das Add-Ons oder Updates enthalten kann';
 ?>
diff --git a/interface/web/admin/lib/lang/de_software_repo_list.lng b/interface/web/admin/lib/lang/de_software_repo_list.lng
index 4a9c2c4..db6f49f 100644
--- a/interface/web/admin/lib/lang/de_software_repo_list.lng
+++ b/interface/web/admin/lib/lang/de_software_repo_list.lng
@@ -1,6 +1,6 @@
 <?php
-$wb['list_head_txt'] = 'Bibliothek';
+$wb['list_head_txt'] = 'Repository';
 $wb['active_txt'] = 'Aktiv';
-$wb['repo_name_txt'] = 'Bibliothek';
+$wb['repo_name_txt'] = 'Repository';
 $wb['repo_url_txt'] = 'URL';
 ?>
diff --git a/interface/web/admin/lib/lang/de_software_update_list.lng b/interface/web/admin/lib/lang/de_software_update_list.lng
index 29ba194..cf31e88 100644
--- a/interface/web/admin/lib/lang/de_software_update_list.lng
+++ b/interface/web/admin/lib/lang/de_software_update_list.lng
@@ -5,5 +5,5 @@
 $wb['update_title_txt'] = 'Update';
 $wb['version_txt'] = 'Version';
 $wb['action_txt'] = 'Aktion';
-$wb['no_updates_txt'] = 'No updates available';
+$wb['no_updates_txt'] = 'Keine Updates verfügbar';
 ?>
diff --git a/interface/web/admin/lib/lang/de_system_config.lng b/interface/web/admin/lib/lang/de_system_config.lng
index ca37e07..163fa34 100644
--- a/interface/web/admin/lib/lang/de_system_config.lng
+++ b/interface/web/admin/lib/lang/de_system_config.lng
@@ -50,4 +50,6 @@
 $wb['mailbox_show_mail_filter_tab_txt'] = 'Zeige E-Mail Filter Reiter in E-Mail Kontodetails';
 $wb['mailbox_show_custom_rules_tab_txt'] = 'Zeige Benutzerregel Reiter in E-Mail Kontodetails';$wb['webmail_url_error_regex'] = 'Falsche Webmail URL';
 $wb['reseller_can_use_options_txt'] = 'Reseller können den Optionen Reiter bei Webseiten verwenden';
+$wb['phpmyadmin_url_note_txt'] = 'Platzhalter:';
+$wb['webmail_url_note_txt'] = 'Platzhalter:';
 ?>
diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng
index b9f270e..c4abee8 100644
--- a/interface/web/admin/lib/lang/en_server_config.lng
+++ b/interface/web/admin/lib/lang/en_server_config.lng
@@ -172,13 +172,22 @@
 $wb["web_folder_protection_txt"] = 'Make web folders immutable (extended attributes)';
 $wb["overtraffic_notify_admin_txt"] = 'Send overtraffic notification to admin';
 $wb["overtraffic_notify_client_txt"] = 'Send overtraffic notification to client';
-$wb["v6_prefix_txt"] = 'IPv6 Prefix';
-$wb["vhost_rewrite_v6_txt"] = 'Rewrite IPv6 on Mirror';
-$wb["v6_prefix_wrong"] = 'Invalid v6 Netmask format.';
-$wb["php_ini_check_minutes_txt"] = 'Check system php.ini files for changes each';
-$wb["php_ini_check_minutes_info_txt"] = 'minutes (0 disables checking)';
-$wb['php_ini_check_minutes_error_empty'] = 'Invalid value for php.ini checking.';
 $wb["rbl_error_regex"] = 'Please specify valid RBL hostnames.';
-$wb["sendmail_path_txt"] = 'Sendmail Path';
-$wb["sendmail_path_error_empty"] = 'Sendmail Path is empty.';
-?>
+$wb["overquota_notify_admin_txt"] = 'Send quota warnings to admin';
+$wb["overquota_notify_client_txt"] = 'Send quota warnings to client';
+$wb["overquota_notify_onok_txt"] = 'Send quota ok message to client';
+$wb['overquota_notify_freq_txt'] = 'Send quota warning each X days';
+$wb['overquota_notify_freq_note_txt'] = '0 = send message just once, no repeated messages';
+$wb['admin_notify_events_txt'] = 'Send email to admin starting with the following level';
+$wb['no_notifications_txt'] = 'No Notifications';
+$wb['monit_url_txt'] = 'Monit URL';
+$wb['monit_user_txt'] = 'Monit User';
+$wb['monit_password_txt'] = 'Monit Password';
+$wb['monit_url_error_regex'] = 'Invalid Monit URL';
+$wb['monit_url_note_txt'] = 'Placeholder:';
+$wb['munin_url_txt'] = 'Munin URL';
+$wb['munin_user_txt'] = 'Munin User';
+$wb['munin_password_txt'] = 'Munin Password';
+$wb['munin_url_error_regex'] = 'Invalid Munin URL';
+$wb['munin_url_note_txt'] = 'Placeholder:';
+?>
diff --git a/interface/web/admin/lib/lang/en_software_package.lng b/interface/web/admin/lib/lang/en_software_package.lng
new file mode 100644
index 0000000..62ef734
--- /dev/null
+++ b/interface/web/admin/lib/lang/en_software_package.lng
@@ -0,0 +1,6 @@
+<?php
+$wb["package_title_txt"] = 'Package Title';
+$wb["package_key_txt"] = 'Package Key';
+$wb["Software Package"] = 'Software Package';
+$wb['Modify software package details'] = 'Modify software package details';
+?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_software_package_list.lng b/interface/web/admin/lib/lang/en_software_package_list.lng
index 8ba66d7..2909d83 100644
--- a/interface/web/admin/lib/lang/en_software_package_list.lng
+++ b/interface/web/admin/lib/lang/en_software_package_list.lng
@@ -8,4 +8,6 @@
 $wb['repoupdate_txt'] = 'Update package list';
 $wb['package_id_txt'] = 'local App-ID';
 $wb['no_packages_txt'] = 'No packages available';
+$wb['edit_txt'] = 'Edit';
+$wb['delete_txt'] = 'Delete';
 ?>
diff --git a/interface/web/admin/lib/lang/en_software_repo.lng b/interface/web/admin/lib/lang/en_software_repo.lng
index 7968b00..1b50bb7 100644
--- a/interface/web/admin/lib/lang/en_software_repo.lng
+++ b/interface/web/admin/lib/lang/en_software_repo.lng
@@ -4,4 +4,5 @@
 $wb["repo_username_txt"] = 'User (optional)';
 $wb["repo_password_txt"] = 'Password (optional)';
 $wb["active_txt"] = 'Active';
+$wb['Software Repository which may contain addons or updates'] = 'Software Repository which may contain addons or updates';
 ?>
\ No newline at end of file
diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng
index a6bf4cb..2edd543 100644
--- a/interface/web/admin/lib/lang/en_system_config.lng
+++ b/interface/web/admin/lib/lang/en_system_config.lng
@@ -53,5 +53,6 @@
 $wb['mailbox_show_mail_filter_tab_txt'] = 'Show mail filter tab in mail account details';
 $wb['mailbox_show_custom_rules_tab_txt'] = 'Show custom mailfilter tab in mail account details';
 $wb['webmail_url_error_regex'] = 'Invalid webmail URL';
-$wb['reseller_can_use_options_txt'] = 'Reseller can use options tab in web sites config';
+$wb['phpmyadmin_url_note_txt'] = 'Placeholder:';
+$wb['webmail_url_note_txt'] = 'Placeholder:';
 ?>
diff --git a/interface/web/admin/server_ip_list.php b/interface/web/admin/server_ip_list.php
index 6c98269..939d41f 100644
--- a/interface/web/admin/server_ip_list.php
+++ b/interface/web/admin/server_ip_list.php
@@ -46,7 +46,7 @@
 
 $app->uses('listform_actions');
 
-$app->listform_actions->SQLOrderBy = "ORDER BY server_id, ip_address";
+$app->listform_actions->SQLOrderBy = "ORDER BY server_ip.server_id, server_ip.ip_address";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/admin/server_php_list.php b/interface/web/admin/server_php_list.php
index 86a7050..bcd323b 100644
--- a/interface/web/admin/server_php_list.php
+++ b/interface/web/admin/server_php_list.php
@@ -46,7 +46,7 @@
 
 $app->uses('listform_actions');
 
-$app->listform_actions->SQLOrderBy = "ORDER BY server_id, name";
+$app->listform_actions->SQLOrderBy = "ORDER BY server_php.server_id, server_php.name";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/admin/software_package_edit.php b/interface/web/admin/software_package_edit.php
new file mode 100644
index 0000000..27a40f2
--- /dev/null
+++ b/interface/web/admin/software_package_edit.php
@@ -0,0 +1,59 @@
+<?php
+/*
+Copyright (c) 2008, Till Brehm, projektfarm Gmbh
+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.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/software_package.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('admin');
+if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+	
+}
+
+$page = new page_action;
+$page->onLoad();
+
+?>
\ No newline at end of file
diff --git a/interface/web/admin/software_package_list.php b/interface/web/admin/software_package_list.php
index 0b7fd54..af6887b 100644
--- a/interface/web/admin/software_package_list.php
+++ b/interface/web/admin/software_package_list.php
@@ -181,7 +181,8 @@
 
 $app->tpl->setLoop('records',$packages);
 
-include_once('lib/lang/en_software_package_list.lng');
+$language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
+include_once('lib/lang/'.$language.'_software_package_list.lng');
 $app->tpl->setVar($wb);
 
 
diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php
index 0f09241..682a644 100644
--- a/interface/web/admin/software_update_list.php
+++ b/interface/web/admin/software_update_list.php
@@ -211,7 +211,8 @@
 
 $app->tpl->setLoop('records',$records_out);
 
-include_once('lib/lang/en_software_update_list.lng');
+$language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
+include_once('lib/lang/'.$language.'_software_update_list.lng');
 $app->tpl->setVar($wb);
 
 
diff --git a/interface/web/admin/templates/remote_user_list.htm b/interface/web/admin/templates/remote_user_list.htm
index 4bc5db3..88ddf6a 100644
--- a/interface/web/admin/templates/remote_user_list.htm
+++ b/interface/web/admin/templates/remote_user_list.htm
@@ -17,12 +17,12 @@
             <table class="list">
                 <thead>
                     <tr class="caption">
-                        <th class="tbl_col_remote_user_pid" scope="col"><tmpl_var name="parent_remote_userid_txt"></th>
+                        <th class="tbl_col_remote_userid" scope="col"><tmpl_var name="parent_remote_userid_txt"></th>
                         <th class="tbl_col_remote_username" scope="col"><tmpl_var name="username_txt"></th>
                         <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
                     </tr>
                     <tr class="filter">
-                        <td class="tbl_col_remote_user_pid">&nbsp;</td>           
+                        <td class="tbl_col_remote_userid">&nbsp;</td>           
                         <td class="tbl_col_remote_username"><input type="text" name="search_username" value="{tmpl_var name='search_username'}" /></td>
                         <td class="tbl_col_buttons">
                             <button type="button" class="button icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','admin/remote_user_list.php');"><span>{tmpl_var name="filter_txt"}</span></button>
@@ -32,7 +32,7 @@
                 <tbody>
                     <tmpl_loop name="records">
                         <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
-                            <td class="tbl_col_remote_user_pid"><a href="#" onclick="loadContent('admin/remote_user_edit.php?id={tmpl_var name='remote_userid'}');">{tmpl_var name="remote_userid"}</a></td>
+                            <td class="tbl_col_remote_userid"><a href="#" onclick="loadContent('admin/remote_user_edit.php?id={tmpl_var name='remote_userid'}');">{tmpl_var name="remote_userid"}</a></td>
                             <td class="tbl_col_remote_username"><a href="#" onclick="loadContent('admin/remote_user_edit.php?id={tmpl_var name='remote_userid'}');">{tmpl_var name="remote_username"}</a></td>
                             <td class="tbl_col_buttons">
                                 <a class="button icons16 icoDelete" href="javascript: del_record('admin/remote_user_del.php?id={tmpl_var name='remote_userid'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
diff --git a/interface/web/admin/templates/server_config_mail_edit.htm b/interface/web/admin/templates/server_config_mail_edit.htm
index 0374931..6ab03eb 100644
--- a/interface/web/admin/templates/server_config_mail_edit.htm
+++ b/interface/web/admin/templates/server_config_mail_edit.htm
@@ -85,9 +85,27 @@
                 <label for="realtime_blackhole_list">{tmpl_var name='realtime_blackhole_list_txt'}</label>
                 <input name="realtime_blackhole_list" id="realtime_blackhole_list" value="{tmpl_var name='realtime_blackhole_list'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='realtime_blackhole_list_note_txt'}
             </div>
+			<div class="ctrlHolder">
+                <p class="label">{tmpl_var name='overquota_notify_admin_txt'}</p>
+                <div class="multiField">
+                    {tmpl_var name='overquota_notify_admin'}
+                </div>
+            </div>
             <div class="ctrlHolder">
-                <label for="sendmail_path">{tmpl_var name='sendmail_path_txt'}</label>
-                <input name="sendmail_path" id="sendmail_path" value="{tmpl_var name='sendmail_path'}" size="40" maxlength="255" type="text" class="textInput" />
+                <p class="label">{tmpl_var name='overquota_notify_client_txt'}</p>
+                <div class="multiField">
+                    {tmpl_var name='overquota_notify_client'}
+                </div>
+            </div>
+            <div class="ctrlHolder">
+                <label for="overquota_notify_freq">{tmpl_var name='overquota_notify_freq_txt'}</label>
+                <input name="overquota_notify_freq" id="overquota_notify_freq" value="{tmpl_var name='overquota_notify_freq'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='overquota_notify_freq_note_txt'}
+            </div>
+            <div class="ctrlHolder">
+                <p class="label">{tmpl_var name='overquota_notify_onok_txt'}</p>
+                <div class="multiField">
+                    {tmpl_var name='overquota_notify_onok'}
+                </div>
             </div>
         </fieldset>
             
diff --git a/interface/web/admin/templates/server_config_server_edit.htm b/interface/web/admin/templates/server_config_server_edit.htm
index aed2447..6dab52f 100644
--- a/interface/web/admin/templates/server_config_server_edit.htm
+++ b/interface/web/admin/templates/server_config_server_edit.htm
@@ -48,6 +48,12 @@
                     {tmpl_var name='loglevel'}
                 </select>
             </div>
+			<div class="ctrlHolder">
+                <label for="admin_notify_events">{tmpl_var name='admin_notify_events_txt'}</label>
+                <select name="admin_notify_events" id="admin_notify_events" class="selectInput">
+                    {tmpl_var name='admin_notify_events'}
+                </select>
+            </div>
             <div class="ctrlHolder">
                 <label for="backup_dir">{tmpl_var name='backup_dir_txt'}</label>
                 <input name="backup_dir" id="backup_dir" value="{tmpl_var name='backup_dir'}" size="40" maxlength="255" type="text" class="textInput" />
@@ -58,6 +64,30 @@
                     {tmpl_var name='backup_mode'}
                 </select>
             </div>
+			<div class="ctrlHolder">
+                <label for="monit_url">{tmpl_var name='monit_url_txt'}</label>
+                <input name="monit_url" id="monit_url" value="{tmpl_var name='monit_url'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='monit_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a>
+            </div>
+			<div class="ctrlHolder">
+                <label for="monit_user">{tmpl_var name='monit_user_txt'}</label>
+                <input name="monit_user" id="monit_user" value="{tmpl_var name='monit_user'}" size="40" maxlength="255" type="text" class="textInput" />
+            </div>
+			<div class="ctrlHolder">
+                <label for="monit_password">{tmpl_var name='monit_password_txt'}</label>
+                <input name="monit_password" id="monit_password" value="{tmpl_var name='monit_password'}" size="40" maxlength="255" type="text" class="textInput" />
+            </div>
+			<div class="ctrlHolder">
+                <label for="munin_url">{tmpl_var name='munin_url_txt'}</label>
+                <input name="munin_url" id="munin_url" value="{tmpl_var name='munin_url'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='munin_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a>
+            </div>
+			<div class="ctrlHolder">
+                <label for="munin_user">{tmpl_var name='munin_user_txt'}</label>
+                <input name="munin_user" id="munin_user" value="{tmpl_var name='munin_user'}" size="40" maxlength="255" type="text" class="textInput" />
+            </div>
+			<div class="ctrlHolder">
+                <label for="munin_password">{tmpl_var name='munin_password_txt'}</label>
+                <input name="munin_password" id="munin_password" value="{tmpl_var name='munin_password'}" size="40" maxlength="255" type="text" class="textInput" />
+            </div>
         </fieldset>
             
         <input type="hidden" name="id" value="{tmpl_var name='id'}">
diff --git a/interface/web/admin/templates/server_config_web_edit.htm b/interface/web/admin/templates/server_config_web_edit.htm
index 602d9f5..6656634 100644
--- a/interface/web/admin/templates/server_config_web_edit.htm
+++ b/interface/web/admin/templates/server_config_web_edit.htm
@@ -115,6 +115,28 @@
                     {tmpl_var name='overtraffic_notify_client'}
                 </div>
             </div>
+			<div class="ctrlHolder">
+                <p class="label">{tmpl_var name='overquota_notify_admin_txt'}</p>
+                <div class="multiField">
+                    {tmpl_var name='overquota_notify_admin'}
+                </div>
+            </div>
+            <div class="ctrlHolder">
+                <p class="label">{tmpl_var name='overquota_notify_client_txt'}</p>
+                <div class="multiField">
+                    {tmpl_var name='overquota_notify_client'}
+                </div>
+            </div>
+            <div class="ctrlHolder">
+                <label for="overquota_notify_freq">{tmpl_var name='overquota_notify_freq_txt'}</label>
+                <input name="overquota_notify_freq" id="overquota_notify_freq" value="{tmpl_var name='overquota_notify_freq'}" size="40" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='overquota_notify_freq_note_txt'}
+            </div>
+            <div class="ctrlHolder">
+                <p class="label">{tmpl_var name='overquota_notify_onok_txt'}</p>
+                <div class="multiField">
+                    {tmpl_var name='overquota_notify_onok'}
+                </div>
+            </div>
             <div class="subsectiontoggle"><span></span>{tmpl_var name='ssl_settings_txt'}<em></em></div>
             <div style="display:none;">
                 <div class="ctrlHolder">
diff --git a/interface/web/admin/templates/software_package_edit.htm b/interface/web/admin/templates/software_package_edit.htm
new file mode 100644
index 0000000..c2a0254
--- /dev/null
+++ b/interface/web/admin/templates/software_package_edit.htm
@@ -0,0 +1,27 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_software_package">
+  
+    <div class="pnl_formsarea">
+        <fieldset class="inlineLabels">
+            <div class="ctrlHolder">
+                <label for="package_title">{tmpl_var name='package_title_txt'}</label>
+                {tmpl_var name='package_title'}<input name="package_title" id="package_title" value="{tmpl_var name='package_title'}" size="40" maxlength="40" type="hidden" class="textInput" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="package_key">{tmpl_var name='package_key_txt'}</label>
+                <input name="package_key" id="package_key" value="{tmpl_var name='package_key'}" size="40" maxlength="40" type="text" class="textInput" />
+            </div>
+        
+            
+        <input type="hidden" name="id" value="{tmpl_var name='id'}">
+            
+        <div class="buttonHolder buttons">
+            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onclick="submitForm('pageForm','admin/software_package_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onclick="loadContent('admin/software_package_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+        </div>
+		</fieldset>
+    </div>
+  
+</div>
\ No newline at end of file
diff --git a/interface/web/admin/templates/software_package_list.htm b/interface/web/admin/templates/software_package_list.htm
index 576ffbc..c15b79b 100644
--- a/interface/web/admin/templates/software_package_list.htm
+++ b/interface/web/admin/templates/software_package_list.htm
@@ -21,7 +21,7 @@
                         <th class="tbl_col_installed" scope="col"><tmpl_var name="installed_txt"></th>
                         <th class="tbl_col_package_title" scope="col"><tmpl_var name="package_title_txt"></th>
                         <th class="tbl_col_package_description" scope="col"><tmpl_var name="package_description_txt"></th>
-                        <th class="tbl_col_package_description" scope="col"><tmpl_var name="package_id_txt"></th>
+                        <th class="tbl_col_package_id" scope="col"><tmpl_var name="package_id_txt"></th>
                         <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
                     </tr>
                 </thead>
@@ -32,8 +32,9 @@
                             <td class="tbl_col_installed">{tmpl_var name="installed"}</td>
                             <td class="tbl_col_package_title">{tmpl_var name="package_title"}</td>
                             <td class="tbl_col_package_description">{tmpl_var name="package_description"}</td>
-                            <td class="tbl_col_package_description">ispapp{tmpl_var name="package_id"}</td>
-                            <td class="tbl_col_buttons">
+                            <td class="tbl_col_package_id">ispapp{tmpl_var name="package_id"}</td>
+							<td class="tbl_col_buttons">
+								<a class="button icons16 icoEdit" href="javascript: loadContent('admin/software_package_edit.php?id={tmpl_var name='package_id'}');"><span>{tmpl_var name='edit_txt'}</span></a>
                                 <a class="button icons16 icoDelete" href="javascript: del_record('admin/software_package_del.php?software_update_inst_id={tmpl_var name='software_update_inst_id'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
                             </td>
                         </tr>
diff --git a/interface/web/admin/templates/system_config_mail_edit.htm b/interface/web/admin/templates/system_config_mail_edit.htm
index f69ed85..e9c0c0e 100644
--- a/interface/web/admin/templates/system_config_mail_edit.htm
+++ b/interface/web/admin/templates/system_config_mail_edit.htm
@@ -37,7 +37,7 @@
             </div>
             <div class="ctrlHolder">
                 <label for="webmail_url">{tmpl_var name='webmail_url_txt'}</label>
-                <input name="webmail_url" id="webmail_url" value="{tmpl_var name='webmail_url'}" size="30" maxlength="255" type="text" class="textInput" />
+                <input name="webmail_url" id="webmail_url" value="{tmpl_var name='webmail_url'}" size="30" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='webmail_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a>
             </div>
             <div class="ctrlHolder">
                 <p class="label">{tmpl_var name='mailmailinglist_link_txt'}</p>
diff --git a/interface/web/admin/templates/system_config_sites_edit.htm b/interface/web/admin/templates/system_config_sites_edit.htm
index e60e3fa..65f37b7 100644
--- a/interface/web/admin/templates/system_config_sites_edit.htm
+++ b/interface/web/admin/templates/system_config_sites_edit.htm
@@ -33,7 +33,7 @@
             </div>
             <div class="ctrlHolder">
                 <label for="phpmyadmin_url">{tmpl_var name='phpmyadmin_url_txt'}</label>
-                <input name="phpmyadmin_url" id="phpmyadmin_url" value="{tmpl_var name='phpmyadmin_url'}" size="30" maxlength="255" type="text" class="textInput" />
+                <input name="phpmyadmin_url" id="phpmyadmin_url" value="{tmpl_var name='phpmyadmin_url'}" size="30" maxlength="255" type="text" class="textInput" />&nbsp;{tmpl_var name='phpmyadmin_url_note_txt'} <a href="javascript:void(0);" class="addPlaceholder">[SERVERNAME]</a>, <a href="javascript:void(0);" class="addPlaceholder">[DATABASENAME]</a>
             </div>
             <div class="ctrlHolder">
                 <label for="webftp_url">{tmpl_var name='webftp_url_txt'}</label>
diff --git a/interface/web/admin/users_list.php b/interface/web/admin/users_list.php
index ae0bca5..412d4fa 100644
--- a/interface/web/admin/users_list.php
+++ b/interface/web/admin/users_list.php
@@ -45,7 +45,7 @@
 $app->auth->check_module_permissions('admin');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLOrderBy = 'ORDER BY username';
+$app->listform_actions->SQLOrderBy = 'ORDER BY sys_user.username';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/client/client_circle_list.php b/interface/web/client/client_circle_list.php
index 935fbee..f37da38 100644
--- a/interface/web/client/client_circle_list.php
+++ b/interface/web/client/client_circle_list.php
@@ -17,7 +17,7 @@
 
 $app->uses('listform_actions');
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY circle_name, circle_id';
+$app->listform_actions->SQLOrderBy = 'ORDER BY client_circle.circle_name, client_circle.circle_id';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php
index 14f211e..ecee8f5 100644
--- a/interface/web/client/client_del.php
+++ b/interface/web/client/client_del.php
@@ -97,6 +97,7 @@
 		}
 		
 		$app->tpl->setVar('id',$this->id);
+		$app->tpl->setVar('number_records',$number);
 		$app->tpl->setLoop('records', $table_list);
 		
 		//* load language file 
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 6f7cf53..2b72d81 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -177,7 +177,7 @@
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE db_server = 1 AND mirror_server_id = 0 LIMIT 0,1');
 		$default_dbserver = $app->functions->intval($tmp['server_id']);
 		
-		$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
+		$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
 		$app->db->query($sql);
 		
 
diff --git a/interface/web/client/client_list.php b/interface/web/client/client_list.php
index 3eff65b..35258b8 100644
--- a/interface/web/client/client_list.php
+++ b/interface/web/client/client_list.php
@@ -17,8 +17,8 @@
 
 $app->uses('listform_actions');
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
-$app->listform_actions->SQLExtWhere = "limit_client = 0";
+$app->listform_actions->SQLOrderBy = 'ORDER BY client.company_name, client.contact_name, client.client_id';
+$app->listform_actions->SQLExtWhere = "client.limit_client = 0";
 $app->listform_actions->SQLExtSelect = ', client.country as countryiso';
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/client/client_template_edit.php b/interface/web/client/client_template_edit.php
index 8dcb5a8..a683800 100644
--- a/interface/web/client/client_template_edit.php
+++ b/interface/web/client/client_template_edit.php
@@ -1,97 +1,97 @@
-<?php
-/*
-Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
-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.
-*/
-
-
-/******************************************
-* Begin Form configuration
-******************************************/
-
-$tform_def_file = "form/client_template.tform.php";
-
-/******************************************
-* End Form configuration
-******************************************/
-
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-
-//* Check permissions for module
-$app->auth->check_module_permissions('client');
-if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.');
-
-// Loading classes
-$app->uses('tpl,tform,tform_actions');
-$app->load('tform_actions');
-
-class page_action extends tform_actions {
-
-	function onBeforeUpdate() {
-		global $app;
-		
-		if(isset($this->dataRecord['template_type'])) {
-			//* Check if the template_type has been changed
-			$rec = $app->db->queryOneRecord("SELECT template_type from client_template WHERE template_id = ".$this->id);
-			if($rec['template_type'] != $this->dataRecord['template_type']) {
-				//* Add a error message and switch back to old server
-				$app->tform->errorMessage .= $app->lng('The template type can not be changed.');
-				$this->dataRecord['template_type'] = $rec['template_type'];
-			}
-			unset($rec);
-		}
-	}
-	
-	
-	/*
-	 This function is called automatically right after
-	 the data was successful updated in the database.
-	*/
-	function onAfterUpdate() {
-		global $app;
-		
-        $app->uses('client_templates');
-		/*
-		 * the template has changed. apply the new data to all clients
-		 */
-		if ($this->dataRecord["template_type"] == 'm'){
-			$sql = "SELECT client_id FROM client WHERE template_master = " . $this->id;
-		} else {
-			$sql = "SELECT client_id FROM client WHERE template_additional LIKE '%/" . $this->id . "/%'";
-		}
-		$clients = $app->db->queryAllRecords($sql);
-		if (is_array($clients)){
-			foreach ($clients as $client){
-                $app->client_templates->apply_client_templates($client['client_id']);
-			}
-		}
-	}
-}
-
-$page = new page_action;
-$page->onLoad();
-?>
+<?php
+/*
+Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
+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.
+*/
+
+
+/******************************************
+* Begin Form configuration
+******************************************/
+
+$tform_def_file = "form/client_template.tform.php";
+
+/******************************************
+* End Form configuration
+******************************************/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('client');
+if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.');
+
+// Loading classes
+$app->uses('tpl,tform,tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+	function onBeforeUpdate() {
+		global $app;
+		
+		if(isset($this->dataRecord['template_type'])) {
+			//* Check if the template_type has been changed
+			$rec = $app->db->queryOneRecord("SELECT template_type from client_template WHERE template_id = ".$this->id);
+			if($rec['template_type'] != $this->dataRecord['template_type']) {
+				//* Add a error message and switch back to old server
+				$app->tform->errorMessage .= $app->lng('The template type can not be changed.');
+				$this->dataRecord['template_type'] = $rec['template_type'];
+			}
+			unset($rec);
+		}
+	}
+	
+	
+	/*
+	 This function is called automatically right after
+	 the data was successful updated in the database.
+	*/
+	function onAfterUpdate() {
+		global $app;
+		
+        $app->uses('client_templates');
+		/*
+		 * the template has changed. apply the new data to all clients
+		 */
+		if ($this->dataRecord["template_type"] == 'm'){
+			$sql = "SELECT client_id FROM client WHERE template_master = " . $this->id;
+		} else {
+			$sql = "SELECT client_id FROM client WHERE template_additional LIKE '%/" . $this->id . "/%' OR template_additional LIKE '" . $this->id . "/%' OR template_additional LIKE '%/" . $this->id . "'";
+		}
+		$clients = $app->db->queryAllRecords($sql);
+		if (is_array($clients)){
+			foreach ($clients as $client){
+                $app->client_templates->apply_client_templates($client['client_id']);
+			}
+		}
+	}
+}
+
+$page = new page_action;
+$page->onLoad();
+?>
diff --git a/interface/web/client/client_template_list.php b/interface/web/client/client_template_list.php
index f0d1752..bdfe1d1 100644
--- a/interface/web/client/client_template_list.php
+++ b/interface/web/client/client_template_list.php
@@ -44,6 +44,6 @@
 if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLOrderBy = 'ORDER BY template_name';
+$app->listform_actions->SQLOrderBy = 'ORDER BY client_template.template_name';
 $app->listform_actions->onLoad();
 ?>
diff --git a/interface/web/client/domain_list.php b/interface/web/client/domain_list.php
index 14308ed..e4ef725 100644
--- a/interface/web/client/domain_list.php
+++ b/interface/web/client/domain_list.php
@@ -46,7 +46,7 @@
 
 $app->uses('listform_actions');
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY domain';
+$app->listform_actions->SQLOrderBy = 'ORDER BY domain.domain';
 $app->listform_actions->onLoad();
 
 ?>
\ No newline at end of file
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index 7d7bf45..b29a831 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -899,20 +899,31 @@
 			'rows'		=> '',
 			'cols'		=> ''
 		),
-                'limit_dns_slave_zone' => array (
-                        'datatype'      => 'INTEGER',
-                        'formtype'      => 'TEXT',
-                        'validators'    => array (      0 => array (    'type'  => 'ISINT',
+		'default_slave_dnsserver' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '1',
+			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
+										'class'=> 'custom_datasource',
+										'function'=> 'client_servers'
+									 ),
+			'value'		=> '',
+			'name'		=> 'default_slave_dnsserver'
+		),
+		'limit_dns_slave_zone' => array (
+            'datatype'      => 'INTEGER',
+            'formtype'      => 'TEXT',
+            'validators'    => array (      0 => array (    'type'  => 'ISINT',
                                                                                                                 'errmsg'=> 'limit_dns_slave_zone_error_notint'),
                                                                         ),
-                        'default'       => '-1',
-                        'value'         => '',
-                        'separator'     => '',
-                        'width'         => '10',
-                        'maxlength'     => '10',
-                        'rows'          => '',
-                        'cols'          => ''
-                ),
+            'default'       => '-1',
+            'value'         => '',
+            'separator'     => '',
+            'width'         => '10',
+            'maxlength'     => '10',
+            'rows'          => '',
+            'cols'          => ''
+        ),
 		'limit_dns_record' => array (
 			'datatype'	=> 'INTEGER',
 			'formtype'	=> 'TEXT',
diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php
index df240e5..a6c4bd9 100644
--- a/interface/web/client/form/reseller.tform.php
+++ b/interface/web/client/form/reseller.tform.php
@@ -894,6 +894,17 @@
 			'rows'		=> '',
 			'cols'		=> ''
 		),
+		'default_slave_dnsserver' => array (
+			'datatype'	=> 'INTEGER',
+			'formtype'	=> 'SELECT',
+			'default'	=> '1',
+			'datasource'	=> array ( 	'type'	=> 'SQL',
+										'querystring' => 'SELECT server_id,server_name FROM server WHERE dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+										'keyfield'=> 'server_id',
+										'valuefield'=> 'server_name'
+									 ),
+			'value'		=> ''
+		),
                 'limit_dns_slave_zone' => array (
                         'datatype'      => 'INTEGER',
                         'formtype'      => 'TEXT',
diff --git a/interface/web/client/lib/lang/de_client.lng b/interface/web/client/lib/lang/de_client.lng
index 46afed5..57310d8 100644
--- a/interface/web/client/lib/lang/de_client.lng
+++ b/interface/web/client/lib/lang/de_client.lng
@@ -103,10 +103,10 @@
 $wb['limit_web_quota_txt'] = 'Webbeschränkung';
 $wb['limit_traffic_quota_txt'] = 'Trafficbeschränkung';
 $wb['limit_trafficquota_error_notint'] = 'Trafficbeschränkung muss eine Zahl sein.';
-$wb['limit_dns_slave_zone_txt'] = 'Max. Anzahl an Zweiter DNS Zonen';
+$wb['limit_dns_slave_zone_txt'] = 'Max. Anzahl an Secondary DNS Zonen';
 $wb['limit_webdav_user_txt'] = 'Max. Anzahl an WebDAV Benutzern';
 $wb['limit_webdav_user_error_notint'] = 'Das WebDAV Benutzer Limit muss eine Zahl sein.';
-$wb['limit_dns_slave_zone_error_notint'] = 'Das Zweiter DNS Zonen Limit muss eine Zahl sein.';
+$wb['limit_dns_slave_zone_error_notint'] = 'Das Secondary DNS Zonen Limit muss eine Zahl sein.';
 $wb['customer_no_txt'] = 'Kundennummer';
 $wb['vat_id_txt'] = 'USt-ID';
 $wb['required_fields_txt'] = '* Benötigte Felder';
@@ -143,4 +143,5 @@
 $wb['aps_limits_txt'] = 'APS Installationsassistent Limits';
 $wb['limit_aps_txt'] = 'Max. Anzahl an APS-Instanzen';
 $wb['limit_aps_error_notint'] = 'Das APS Instanzen Limit muss eine Zahl sein.';
+$wb['default_slave_dnsserver_txt'] = 'Standard Secondary DNS Server';
 ?>
diff --git a/interface/web/client/lib/lang/de_client_del.lng b/interface/web/client/lib/lang/de_client_del.lng
index c6982a2..d13fcfa 100644
--- a/interface/web/client/lib/lang/de_client_del.lng
+++ b/interface/web/client/lib/lang/de_client_del.lng
@@ -3,4 +3,5 @@
 $wb['delete_explanation'] = 'Diese Aktion wird folgende Anzahl an Datensätzen des Kunden löschen';
 $wb['btn_save_txt'] = 'Kunden löschen';
 $wb['btn_cancel_txt'] = 'Abbrechen, ohne den Kunden zu löschen';
+$wb['confirm_client_delete_txt'] = 'Sind Sie sicher, daß Sie den Kunden löschen möchten?';
 ?>
diff --git a/interface/web/client/lib/lang/de_client_template_list.lng b/interface/web/client/lib/lang/de_client_template_list.lng
index 98195fe..552035f 100644
--- a/interface/web/client/lib/lang/de_client_template_list.lng
+++ b/interface/web/client/lib/lang/de_client_template_list.lng
@@ -2,4 +2,5 @@
 $wb['list_head_txt'] = 'Kundenvorlagen';
 $wb['template_type_txt'] = 'Typ';
 $wb['template_name_txt'] = 'Vorlagenname';
+$wb['template_id_txt'] = 'Template ID';
 ?>
diff --git a/interface/web/client/lib/lang/de_reseller.lng b/interface/web/client/lib/lang/de_reseller.lng
index 14cd58a..072d648 100644
--- a/interface/web/client/lib/lang/de_reseller.lng
+++ b/interface/web/client/lib/lang/de_reseller.lng
@@ -101,8 +101,8 @@
 $wb['limit_web_quota_txt'] = 'Speicherplatzbeschränkung';
 $wb['limit_traffic_quota_txt'] = 'Transfervolumenbeschränkung';
 $wb['limit_trafficquota_error_notint'] = 'Transfervolumenbeschränkung muss eine Zahl sein.';
-$wb['limit_dns_slave_zone_txt'] = 'Max. Anzahl an Zweiter DNS Zonen';
-$wb['limit_dns_slave_zone_error_notint'] = 'Das Zweiter DNS Zonen Limit muss eine Zahl sein.';
+$wb['limit_dns_slave_zone_txt'] = 'Max. Anzahl an Secondary DNS Zonen';
+$wb['limit_dns_slave_zone_error_notint'] = 'Das Secondary DNS Zonen Limit muss eine Zahl sein.';
 $wb['limit_dns_record_error_notint'] = 'Das DNS Eintrag Limit muss eine Zahl sein.';
 $wb['customer_no_txt'] = 'Kundennummer';
 $wb['vat_id_txt'] = 'USt-ID';
@@ -142,4 +142,5 @@
 $wb['aps_limits_txt'] = 'APS Installationsassistent Limits';
 $wb['limit_aps_txt'] = 'Max. Anzahl an APS-Instanzen';
 $wb['limit_aps_error_notint'] = 'Das APS Instanzen Limit muss eine Zahl sein.';
+$wb['default_slave_dnsserver_txt'] = 'Standard Secondary DNS Server';
 ?>
diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng
index 61a719b..69574d8 100644
--- a/interface/web/client/lib/lang/en_client.lng
+++ b/interface/web/client/lib/lang/en_client.lng
@@ -91,7 +91,7 @@
 $wb["limit_database_error_notint"] = 'The database limit must be a number.';
 $wb["limit_cron_error_notint"] = 'The cron limit must be a number.';
 $wb["limit_cron_error_frequency"] = 'The cron frequency limit must be a number.';
-$wb["username_error_regex"] = 'The Username contains invalid chracaters.';
+$wb["username_error_regex"] = 'The Username contains invalid characters.';
 $wb["template_master_txt"] = 'Master template';
 $wb["template_additional_txt"] = 'Addon template';
 $wb["active_template_additional_txt"] = 'Active Addons';
@@ -146,4 +146,5 @@
 $wb['aps_limits_txt'] = 'APS Installer Limits';
 $wb['limit_aps_txt'] = 'Max. number of APS instances';
 $wb['limit_aps_error_notint'] = 'The APS instances limit must be a number.';
+$wb["default_slave_dnsserver_txt"] = 'Default Secondary DNS Server';
 ?>
diff --git a/interface/web/client/lib/lang/en_client_del.lng b/interface/web/client/lib/lang/en_client_del.lng
index 4d16af6..7b1bbf9 100644
--- a/interface/web/client/lib/lang/en_client_del.lng
+++ b/interface/web/client/lib/lang/en_client_del.lng
@@ -3,4 +3,5 @@
 $wb["delete_explanation"] = 'This action will delete the following number of records associated with this client';
 $wb["btn_save_txt"] = 'Delete the client';
 $wb["btn_cancel_txt"] = 'Cancel without deleting the client';
+$wb["confirm_client_delete_txt"] = 'Are you sure you want to delete this client?';
 ?>
diff --git a/interface/web/client/lib/lang/en_client_template_list.lng b/interface/web/client/lib/lang/en_client_template_list.lng
index ac52186..ce1f9bd 100644
--- a/interface/web/client/lib/lang/en_client_template_list.lng
+++ b/interface/web/client/lib/lang/en_client_template_list.lng
@@ -2,4 +2,5 @@
 $wb["list_head_txt"] = 'Client-Templates';
 $wb["template_type_txt"] = 'Type';
 $wb["template_name_txt"] = 'Template name';
+$wb['template_id_txt'] = 'Template ID';
 ?>
diff --git a/interface/web/client/lib/lang/en_reseller.lng b/interface/web/client/lib/lang/en_reseller.lng
index 711c414..d936ddb 100644
--- a/interface/web/client/lib/lang/en_reseller.lng
+++ b/interface/web/client/lib/lang/en_reseller.lng
@@ -90,7 +90,7 @@
 $wb["limit_database_error_notint"] = 'The database limit must be a number.';
 $wb["limit_cron_error_notint"] = 'The cron limit must be a number.';
 $wb["limit_cron_error_frequency"] = 'The cron frequency limit must be a number.';
-$wb["username_error_regex"] = 'The Username contains invalid chracaters.';
+$wb["username_error_regex"] = 'The Username contains invalid characters.';
 $wb["template_master_txt"] = 'Master template';
 $wb["template_additional_txt"] = 'Addon template';
 $wb["add_additional_template_txt"] = 'Add additional template';
@@ -144,4 +144,5 @@
 $wb['aps_limits_txt'] = 'APS Installer Limits';
 $wb['limit_aps_txt'] = 'Max. number of APS instances';
 $wb['limit_aps_error_notint'] = 'The APS instances limit must be a number.';
+$wb["default_slave_dnsserver_txt"] = 'Default Secondary DNS Server';
 ?>
diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index 83754f3..1d02237 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -175,7 +175,7 @@
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE db_server = 1 LIMIT 0,1');
 		$default_dbserver = $app->functions->intval($tmp['server_id']);
 		
-		$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
+		$sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
 		$app->db->query($sql);
 
 		parent::onAfterInsert();
diff --git a/interface/web/client/reseller_list.php b/interface/web/client/reseller_list.php
index fa819e6..fd8fca0 100644
--- a/interface/web/client/reseller_list.php
+++ b/interface/web/client/reseller_list.php
@@ -47,8 +47,8 @@
 
 $app->uses('listform_actions');
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY company_name, contact_name, client_id';
-$app->listform_actions->SQLExtWhere = "(limit_client > 0 or limit_client = -1)";
+$app->listform_actions->SQLOrderBy = 'ORDER BY client.company_name, client.contact_name, client.client_id';
+$app->listform_actions->SQLExtWhere = "(client.limit_client > 0 or client.limit_client = -1)";
 $app->listform_actions->SQLExtSelect = ', client.country as countryiso';
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/client/templates/client_del.htm b/interface/web/client/templates/client_del.htm
index ff25488..efde39d 100644
--- a/interface/web/client/templates/client_del.htm
+++ b/interface/web/client/templates/client_del.htm
@@ -4,14 +4,18 @@
 <div class="panel panel_client_del">
 
     <div class="pnl_formsarea">
-
+		
         <div id="OKMsg">
+			<tmpl_if name='number_records'>
             <tmpl_var name="delete_explanation">:<br /><br />
                 <tmpl_loop name="records">
                     <tmpl_var name="table">, 
                 </tmpl_loop>
+			</tmpl_else>
+				<tmpl_var name="confirm_client_delete_txt">
+			</tmpl_if>
         </div>
-
+		
         <input type="checkbox" name="confirm" value="yes" /> <b><tmpl_var name="confirm_action_txt"></b>
 
         <input type="hidden" name="id" value="{tmpl_var name='id'}">
diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm
index 3ad6c9d..2e81002 100644
--- a/interface/web/client/templates/client_edit_limits.htm
+++ b/interface/web/client/templates/client_edit_limits.htm
@@ -256,6 +256,12 @@
                     <label for="limit_dns_zone">{tmpl_var name='limit_dns_zone_txt'}</label>
                     <input name="limit_dns_zone" id="limit_dns_zone" value="{tmpl_var name='limit_dns_zone'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
                 </div>
+				<div class="ctrlHolder">
+                    <label for="default_slave_dnsserver">{tmpl_var name='default_slave_dnsserver_txt'}</label>
+                    <select name="default_slave_dnsserver" id="default_slave_dnsserver" class="selectInput">
+                        {tmpl_var name='default_slave_dnsserver'}
+                    </select>
+                </div>
                 <div class="ctrlHolder">
                     <label for="limit_dns_slave_zone">{tmpl_var name='limit_dns_slave_zone_txt'}</label>
                     <input name="limit_dns_slave_zone" id="limit_dns_slave_zone" value="{tmpl_var name='limit_dns_slave_zone'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
@@ -307,7 +313,7 @@
         .find('div.pnl_formsarea')
         .find('fieldset')
         .find('input,select,button')
-        .not('#template_master,#template_additional')
+        .not('#template_master,#template_additional,#default_mailserver,#default_webserver,#default_dbserver,#default_dnsserver,#default_slave_dnsserver')
         .click(function(e) {
             if(custom_template_selected()) return true;
             e.preventDefault();
diff --git a/interface/web/client/templates/domain_list.htm b/interface/web/client/templates/domain_list.htm
index 38882f2..bd8f8be 100644
--- a/interface/web/client/templates/domain_list.htm
+++ b/interface/web/client/templates/domain_list.htm
@@ -25,7 +25,7 @@
             <thead>
                 <tr>
                     <th class="tbl_col_domain" scope="col"><tmpl_var name="domain_txt"></th>
-                    <th class="tbl_col_sys_groupid" scope="col"><tmpl_var name="user_txt">A</th>
+                    <th class="tbl_col_sys_groupid" scope="col"><tmpl_var name="user_txt"></th>
                     <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
                 </tr>
                 <tr>
diff --git a/interface/web/client/templates/reseller_edit_limits.htm b/interface/web/client/templates/reseller_edit_limits.htm
index 468a680..6a93369 100644
--- a/interface/web/client/templates/reseller_edit_limits.htm
+++ b/interface/web/client/templates/reseller_edit_limits.htm
@@ -244,6 +244,12 @@
                     <label for="limit_dns_zone">{tmpl_var name='limit_dns_zone_txt'}</label>
                     <input name="limit_dns_zone" id="limit_dns_zone" value="{tmpl_var name='limit_dns_zone'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
                 </div>
+				<div class="ctrlHolder">
+                    <label for="default_slave_dnsserver">{tmpl_var name='default_slave_dnsserver_txt'}</label>
+                    <select name="default_slave_dnsserver" id="default_slave_dnsserver" class="selectInput">
+                        {tmpl_var name='default_slave_dnsserver'}
+                    </select>
+                </div>
                 <div class="ctrlHolder">
                     <label for="limit_dns_slave_zone">{tmpl_var name='limit_dns_slave_zone_txt'}</label>
                     <input name="limit_dns_slave_zone" id="limit_dns_slave_zone" value="{tmpl_var name='limit_dns_slave_zone'}" size="10" maxlength="10" type="text" class="textInput formLengthLimit" />
diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php
index b0bb809..dae00f8 100644
--- a/interface/web/dashboard/dashboard.php
+++ b/interface/web/dashboard/dashboard.php
@@ -157,7 +157,7 @@
 
 /* Which dashlets in which column */
 /******************************************************************************/
-$leftcol_dashlets = array('modules','invoices');
+$leftcol_dashlets = array('modules','invoices','quota','mailquota');
 $rightcol_dashlets = array('limits');
 /******************************************************************************/
 
diff --git a/interface/web/dashboard/dashlets/mailquota.php b/interface/web/dashboard/dashlets/mailquota.php
new file mode 100644
index 0000000..a65b06d
--- /dev/null
+++ b/interface/web/dashboard/dashlets/mailquota.php
@@ -0,0 +1,93 @@
+<?php
+
+class dashlet_mailquota {
+	
+	function show() {
+		global $app, $conf;
+		
+		//* Loading Template
+		$app->uses('tpl');
+		
+		$tpl = new tpl;
+		$tpl->newTemplate("dashlets/templates/mailquota.htm");
+		
+		$wb = array();
+		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_mailquota.lng';
+		if(is_file($lng_file)) include($lng_file);
+		$tpl->setVar($wb);
+		
+		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC");
+		$monitor_data = array();
+		if(is_array($tmp_rec)) {
+			foreach ($tmp_rec as $tmp_mon) {
+				//$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+				$tmp_array = unserialize($app->db->unquote($tmp_mon['data']));
+				if(is_array($tmp_array)) {
+					foreach($tmp_array as $username => $data) {
+						if(!$monitor_data[$username]['used']) $monitor_data[$username]['used'] = $data['used'];
+					}
+				}
+			}
+		}
+		//print_r($monitor_data);
+		if($_SESSION["s"]["user"]["typ"] != 'admin'){
+			$sql_where = " AND sys_groupid = ".$_SESSION['s']['user']['default_group'];
+		}
+		
+		$has_mailquota = false;
+		// select email accounts belonging to client
+		$emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE 1".$sql_where);
+		//print_r($emails);
+		if(is_array($emails) && !empty($emails)){
+			for($i=0;$i<sizeof($emails);$i++){
+				$email = $emails[$i]['email'];
+		
+				$emails[$i]['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
+		
+				if (!is_numeric($emails[$i]['used'])) $emails[$i]['used']=$emails[$i]['used'][1];
+				
+				// colours
+				$emails[$i]['display_colour'] = '#000000';
+				if($emails[$i]['quota'] > 0){
+					$used_ratio = $emails[$i]['used']/$emails[$i]['quota'];
+				} else {
+					$used_ratio = 0;
+				}
+				if($used_ratio >= 0.8) $emails[$i]['display_colour'] = '#fd934f';
+				if($used_ratio >= 1) $emails[$i]['display_colour'] = '#cc0000';
+
+				if($emails[$i]['quota'] == 0){
+					$emails[$i]['quota'] = $app->lng('unlimited');
+				} else {
+					$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576,4).' MB';
+				}
+
+
+				if($emails[$i]['used'] < 1544000) {
+					$emails[$i]['used'] = round($emails[$i]['used'] / 1024,4).' KB';
+				} else {
+					$emails[$i]['used'] = round($emails[$i]['used'] / 1048576,4).' MB';
+				} 
+		
+			}
+			$has_mailquota = true;
+			$tpl->setloop('mailquota', $emails);
+		}
+		//print_r($sites);
+		
+		$tpl->setVar('has_mailquota',$has_mailquota);
+		
+		return $tpl->grab();
+		
+		
+	}
+}
+
+
+
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/dashboard/dashlets/quota.php b/interface/web/dashboard/dashlets/quota.php
new file mode 100644
index 0000000..bfbfe73
--- /dev/null
+++ b/interface/web/dashboard/dashlets/quota.php
@@ -0,0 +1,116 @@
+<?php
+
+class dashlet_quota {
+	
+	function show() {
+		global $app, $conf;
+		
+		//* Loading Template
+		$app->uses('tpl');
+		
+		$tpl = new tpl;
+		$tpl->newTemplate("dashlets/templates/quota.htm");
+		
+		$wb = array();
+		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_quota.lng';
+		if(is_file($lng_file)) include($lng_file);
+		$tpl->setVar($wb);
+		
+		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
+		$monitor_data = array();
+		if(is_array($tmp_rec)) {
+			foreach ($tmp_rec as $tmp_mon) {
+				$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+			}
+		}
+		//print_r($monitor_data);
+		if($_SESSION["s"]["user"]["typ"] != 'admin'){
+			$sql_where = " AND sys_groupid = ".$_SESSION['s']['user']['default_group'];
+		}
+		
+		$has_quota = false;
+		// select websites belonging to client
+		$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y'".$sql_where);
+		//print_r($sites);
+		if(is_array($sites) && !empty($sites)){
+			for($i=0;$i<sizeof($sites);$i++){
+				$username = $sites[$i]['system_user'];
+				$sites[$i]['used'] = $monitor_data['user'][$username]['used'];
+				$sites[$i]['soft'] = $monitor_data['user'][$username]['soft'];
+				$sites[$i]['hard'] = $monitor_data['user'][$username]['hard'];
+				$sites[$i]['files'] = $monitor_data['user'][$username]['files'];
+				
+				if (!is_numeric($sites[$i]['used'])){
+					if ($sites[$i]['used'][0] > $sites[$i]['used'][1]){
+						$sites[$i]['used'] = $sites[$i]['used'][0];
+					} else {
+						$sites[$i]['used'] = $sites[$i]['used'][1];
+					}
+				}
+				if (!is_numeric($sites[$i]['soft'])) $sites[$i]['soft']=$sites[$i]['soft'][1];
+				if (!is_numeric($sites[$i]['hard'])) $sites[$i]['hard']=$sites[$i]['hard'][1];
+				if (!is_numeric($sites[$i]['files'])) $sites[$i]['files']=$sites[$i]['files'][1];
+				
+				// colours
+				$sites[$i]['display_colour'] = '#000000';
+				if($sites[$i]['soft'] > 0){
+					$used_ratio = $sites[$i]['used']/$sites[$i]['soft'];
+				} else {
+					$used_ratio = 0;
+				}
+				if($used_ratio >= 0.8) $sites[$i]['display_colour'] = '#fd934f';
+				if($used_ratio >= 1) $sites[$i]['display_colour'] = '#cc0000';
+		
+				if($sites[$i]['used'] > 1024) {
+					$sites[$i]['used'] = round($sites[$i]['used'] / 1024,2).' MB';
+				} else {
+					if ($sites[$i]['used'] != '') $sites[$i]['used'] .= ' KB';
+				}
+		
+				if($sites[$i]['soft'] > 1024) {
+					$sites[$i]['soft'] = round($sites[$i]['soft'] / 1024,2).' MB';
+				} else {
+					$sites[$i]['soft'] .= ' KB';
+				}
+		
+				if($sites[$i]['hard'] > 1024) {
+					$sites[$i]['hard'] = round($sites[$i]['hard'] / 1024,2).' MB';
+				} else {
+					$sites[$i]['hard'] .= ' KB';
+				}
+		
+				if($sites[$i]['soft'] == " KB") $sites[$i]['soft'] = $app->lng('unlimited');
+				if($sites[$i]['hard'] == " KB") $sites[$i]['hard'] = $app->lng('unlimited');
+		
+		
+				/*
+				if(!strstr($sites[$i]['used'],'M') && !strstr($sites[$i]['used'],'K')) $sites[$i]['used'].= ' B';
+				if(!strstr($sites[$i]['soft'],'M') && !strstr($sites[$i]['soft'],'K')) $sites[$i]['soft'].= ' B';
+				if(!strstr($sites[$i]['hard'],'M') && !strstr($sites[$i]['hard'],'K')) $sites[$i]['hard'].= ' B';
+				*/
+		
+				if($sites[$i]['soft'] == '0 B' || $sites[$i]['soft'] == '0 KB' || $sites[$i]['soft'] == '0') $sites[$i]['soft'] = $app->lng('unlimited');
+				if($sites[$i]['hard'] == '0 B' || $sites[$i]['hard'] == '0 KB' || $sites[$i]['hard'] == '0') $sites[$i]['hard'] = $app->lng('unlimited');
+		
+			}
+			$has_quota = true;
+			$tpl->setloop('quota', $sites);
+		}
+		//print_r($sites);
+		
+		$tpl->setVar('has_quota',$has_quota);
+		
+		return $tpl->grab();
+		
+		
+	}
+}
+
+
+
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/interface/web/dashboard/dashlets/templates/mailquota.htm b/interface/web/dashboard/dashlets/templates/mailquota.htm
new file mode 100644
index 0000000..25ee9d7
--- /dev/null
+++ b/interface/web/dashboard/dashlets/templates/mailquota.htm
@@ -0,0 +1,29 @@
+<div style="float: left;">
+	<h2>{tmpl_var name='mailquota_txt'}</h2>
+	<div style="width:320px;">
+	<table class="list">
+		<thead>
+		<tr>
+		  <td>{tmpl_var name='email_txt'}</td>
+		  <td>{tmpl_var name='name_txt'}</td>
+		  <td>{tmpl_var name='used_txt'}</td>
+		  <td>{tmpl_var name='quota_txt'}</td>
+		</tr>
+		</thead>
+	<tmpl_if name="has_mailquota">
+	<tmpl_loop name='mailquota'>
+		<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='email'}</td>
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='name'}</td>
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='used'}</td>
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='quota'}</td>
+		</tr>
+	</tmpl_loop>
+	<tmpl_else>
+	<tr>
+	  <td colspan="4" style="text-align:center;">{tmpl_var name='no_email_accounts_txt'}</td>
+	</tr>
+	</tmpl_if>
+	</table>
+	</div>
+</div>
\ No newline at end of file
diff --git a/interface/web/dashboard/dashlets/templates/quota.htm b/interface/web/dashboard/dashlets/templates/quota.htm
new file mode 100644
index 0000000..3cf40e7
--- /dev/null
+++ b/interface/web/dashboard/dashlets/templates/quota.htm
@@ -0,0 +1,29 @@
+<div style="float: left;">
+	<h2>{tmpl_var name='quota_txt'}</h2>
+	<div style="width:320px;">
+	<table class="list">
+		<thead>
+		<tr>
+		  <td>{tmpl_var name='domain_txt'}</td>
+		  <td>{tmpl_var name='used_txt'}</td>
+		  <td>{tmpl_var name='soft_txt'}</td>
+		  <td>{tmpl_var name='hard_txt'}</td>
+		</tr>
+		</thead>
+	<tmpl_if name="has_quota">
+	<tmpl_loop name='quota'>
+		<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='domain'}</td>
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='used'}</td>
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='soft'}</td>
+		  <td style="color:{tmpl_var name='display_colour'}">{tmpl_var name='hard'}</td>
+		</tr>
+	</tmpl_loop>
+	<tmpl_else>
+	<tr>
+	  <td colspan="4" style="text-align:center;">{tmpl_var name='no_sites_txt'}</td>
+	</tr>
+	</tmpl_if>
+	</table>
+	</div>
+</div>
\ No newline at end of file
diff --git a/interface/web/dashboard/lib/lang/de_dashlet_mailquota.lng b/interface/web/dashboard/lib/lang/de_dashlet_mailquota.lng
new file mode 100644
index 0000000..2fb3f6d
--- /dev/null
+++ b/interface/web/dashboard/lib/lang/de_dashlet_mailquota.lng
@@ -0,0 +1,8 @@
+<?php
+$wb["mailquota_txt"] = 'Mailbox-Speicherplatz';
+$wb["email_txt"] = 'E-Mail-Adresse';
+$wb["name_txt"] = 'Name';
+$wb["used_txt"] = 'Verwendet';
+$wb["quota_txt"] = 'Verfügbar';
+$wb["no_email_accounts_txt"] = 'Kein E-Mail-Konto gefunden.';
+?>
\ No newline at end of file
diff --git a/interface/web/dashboard/lib/lang/de_dashlet_quota.lng b/interface/web/dashboard/lib/lang/de_dashlet_quota.lng
new file mode 100644
index 0000000..6050e10
--- /dev/null
+++ b/interface/web/dashboard/lib/lang/de_dashlet_quota.lng
@@ -0,0 +1,8 @@
+<?php
+$wb["quota_txt"] = 'Webseiten-Speicherplatz';
+$wb["domain_txt"] = 'Domain / Webseite';
+$wb["used_txt"] = 'Verwendet';
+$wb["hard_txt"] = 'Hard Limit';
+$wb["soft_txt"] = 'Soft Limit';
+$wb["no_sites_txt"] = 'Keine Webseite gefunden.';
+?>
\ No newline at end of file
diff --git a/interface/web/dashboard/lib/lang/en_dashlet_mailquota.lng b/interface/web/dashboard/lib/lang/en_dashlet_mailquota.lng
new file mode 100644
index 0000000..2c2b6cd
--- /dev/null
+++ b/interface/web/dashboard/lib/lang/en_dashlet_mailquota.lng
@@ -0,0 +1,8 @@
+<?php
+$wb["mailquota_txt"] = 'Mailbox Quota';
+$wb["email_txt"] = 'Email Address';
+$wb["name_txt"] = 'Name';
+$wb["used_txt"] = 'Used Space';
+$wb["quota_txt"] = 'Quota';
+$wb["no_email_accounts_txt"] = 'No email accounts found.';
+?>
\ No newline at end of file
diff --git a/interface/web/dashboard/lib/lang/en_dashlet_quota.lng b/interface/web/dashboard/lib/lang/en_dashlet_quota.lng
new file mode 100644
index 0000000..8b2e3d4
--- /dev/null
+++ b/interface/web/dashboard/lib/lang/en_dashlet_quota.lng
@@ -0,0 +1,8 @@
+<?php
+$wb["quota_txt"] = 'Website Harddisk Quota';
+$wb["domain_txt"] = 'Domain / Website';
+$wb["used_txt"] = 'Used space';
+$wb["hard_txt"] = 'Hard limit';
+$wb["soft_txt"] = 'Soft limit';
+$wb["no_sites_txt"] = 'No web sites found.';
+?>
\ No newline at end of file
diff --git a/interface/web/dashboard/templates/dashboard.htm b/interface/web/dashboard/templates/dashboard.htm
index 09aa158..4d68fbd 100644
--- a/interface/web/dashboard/templates/dashboard.htm
+++ b/interface/web/dashboard/templates/dashboard.htm
@@ -36,13 +36,17 @@
     <div style="float:left; width:350px;">
         <tmpl_loop name='leftcol'>
             {tmpl_var name='content'}
-            <p>&nbsp;</p>
+			<tmpl_if name='content'>
+            <p style="clear:left">&nbsp;</p>
+			</tmpl_if>
         </tmpl_loop>
     </div>
     <div style="float:left; width:350px;">
         <tmpl_loop name='rightcol'>
             {tmpl_var name='content'}
+			<tmpl_if name='content'>
             <p>&nbsp;</p>
+			</tmpl_if>
         </tmpl_loop>
     </div>
 </div>
\ No newline at end of file
diff --git a/interface/web/dns/dns_a_list.php b/interface/web/dns/dns_a_list.php
index c01aec6..afe76b6 100644
--- a/interface/web/dns/dns_a_list.php
+++ b/interface/web/dns/dns_a_list.php
@@ -16,7 +16,7 @@
 $app->auth->check_module_permissions('dns');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLExtWhere = "type = 'A'";
+$app->listform_actions->SQLExtWhere = "dns_rr.type = 'A'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/dns/dns_import.php b/interface/web/dns/dns_import.php
index e722a10..255d290 100644
--- a/interface/web/dns/dns_import.php
+++ b/interface/web/dns/dns_import.php
@@ -84,14 +84,14 @@
 	$app->tpl->setVar("server_id",$server_id_option);
 	
 	// load the list of clients
-	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 	$clients = $app->db->queryAllRecords($sql);
 	$client_select = '';
 	if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
 	if(is_array($clients)) {
 		foreach( $clients as $client) {
 			$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
-			$client_select .= "<option value='$client[groupid]' $selected>$client[name] :: $client[contactname]</option>\r\n";
+			$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 		}
 	}
 
@@ -102,18 +102,18 @@
 	
 	// Get the limits of the client
 	$client_group_id = $_SESSION["s"]["user"]["default_group"];
-	$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+	$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
 	
 	// load the list of clients
-	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
+	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
 	$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['name'].' :: '.$client['contactname'].'</option>';
+	$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
 	if(is_array($clients)) {
 		foreach( $clients as $client) {
 			$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
-			$client_select .= "<option value='$client[groupid]' $selected>$client[name] :: $client[contactname]</option>\r\n";
+			$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 		}
 	}
 
diff --git a/interface/web/dns/dns_slave_edit.php b/interface/web/dns/dns_slave_edit.php
index 2a5247a..46e251a 100644
--- a/interface/web/dns/dns_slave_edit.php
+++ b/interface/web/dns/dns_slave_edit.php
@@ -72,7 +72,7 @@
 		// If user is admin, we will allow him to select to whom this record belongs
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Domains of the user
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = '';
 			if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
@@ -80,7 +80,7 @@
 			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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 		$app->tpl->setVar("client_group_id",$client_select);
@@ -88,18 +88,18 @@
 		
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.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['name'].' :: '.$client['contactname'].'</option>';
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -123,7 +123,7 @@
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT limit_dns_slave_zone, default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$client = $app->db->queryOneRecord("SELECT limit_dns_slave_zone, default_slave_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 		
 			// When the record is updated
 			if($this->id > 0) {
@@ -134,7 +134,7 @@
 			// When the record is inserted
 			} else {
 				// set the server ID to the default dnsserver of the client
-				$this->dataRecord["server_id"] = $client["default_dnsserver"];
+				$this->dataRecord["server_id"] = $client["default_slave_dnsserver"];
 				
 				// Check if the user may add anoter secondary domain.
 				if(!$app->tform->checkClientLimit('limit_dns_slave_zone')) {
diff --git a/interface/web/dns/dns_slave_list.php b/interface/web/dns/dns_slave_list.php
index bc66641..fe78ca2 100644
--- a/interface/web/dns/dns_slave_list.php
+++ b/interface/web/dns/dns_slave_list.php
@@ -16,9 +16,9 @@
 $app->auth->check_module_permissions('dns');
 
 $app->uses('listform_actions');
-// $app->listform_actions->SQLExtWhere = "access = 'REJECT'";
+// $app->listform_actions->SQLExtWhere = "dns_slave.access = 'REJECT'";
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY origin';
+$app->listform_actions->SQLOrderBy = 'ORDER BY dns_slave.origin';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php
index 5ffa3ac..9f524e8 100644
--- a/interface/web/dns/dns_soa_edit.php
+++ b/interface/web/dns/dns_soa_edit.php
@@ -82,7 +82,7 @@
 		// If user is admin, we will allow him to select to whom this record belongs
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Domains of the user
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = '';
 			if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
@@ -90,7 +90,7 @@
 			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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 		$app->tpl->setVar("client_group_id",$client_select);
@@ -98,18 +98,18 @@
 		
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.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['name'].' :: '.$client['contactname'].'</option>';
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -172,6 +172,9 @@
 		if(stristr($this->dataRecord["mbox"],'@')) {
 			$this->dataRecord["mbox"] = str_replace('@','.',$this->dataRecord["mbox"]);
 		}
+		
+		$this->dataRecord["xfer"] = preg_replace('/\s+/', '', $this->dataRecord["xfer"]);
+		$this->dataRecord["also_notify"] = preg_replace('/\s+/', '', $this->dataRecord["also_notify"]);
 
 		//* Check if a secondary zone with the same name already exists 	
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_slave WHERE origin = \"".$this->dataRecord["origin"]."\" AND server_id = \"".$this->dataRecord["server_id"]."\"");
diff --git a/interface/web/dns/dns_soa_list.php b/interface/web/dns/dns_soa_list.php
index d2851f7..27604fb 100644
--- a/interface/web/dns/dns_soa_list.php
+++ b/interface/web/dns/dns_soa_list.php
@@ -16,9 +16,9 @@
 $app->auth->check_module_permissions('dns');
 
 $app->uses('listform_actions');
-// $app->listform_actions->SQLExtWhere = "access = 'REJECT'";
+// $app->listform_actions->SQLExtWhere = "dns_soa.access = 'REJECT'";
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY origin';
+$app->listform_actions->SQLOrderBy = 'ORDER BY dns_soa.origin';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/dns/dns_srv_edit.php b/interface/web/dns/dns_srv_edit.php
index 893fcd2..e41b554 100644
--- a/interface/web/dns/dns_srv_edit.php
+++ b/interface/web/dns/dns_srv_edit.php
@@ -77,18 +77,10 @@
 
 		// Split the 3 parts of the SRV Record apart
 		$split = explode(' ', $this->dataRecord['data']);
-
-		// Weight
-		$this->dataRecord['weight'] = $split[0];
-
-		// Port
-		$this->dataRecord['port'] = $split[1];
-
-		// Target
-		$this->dataRecord['target'] = $split[2];
-
-		// Bind the new datarecord to the template
-		$app->tpl->setVar($this->dataRecord);
+		
+		$app->tpl->setVar('weight', $split[0]);
+		$app->tpl->setVar('port', $split[1]);
+		$app->tpl->setVar('target', $split[2]);
 
 		parent::onShowEnd();
 	}
diff --git a/interface/web/dns/dns_template_list.php b/interface/web/dns/dns_template_list.php
index 37648a1..acad5d3 100644
--- a/interface/web/dns/dns_template_list.php
+++ b/interface/web/dns/dns_template_list.php
@@ -16,9 +16,9 @@
 $app->auth->check_module_permissions('dns');
 
 $app->uses('listform_actions');
-// $app->listform_actions->SQLExtWhere = "access = 'REJECT'";
+// $app->listform_actions->SQLExtWhere = "dns_template.access = 'REJECT'";
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY name';
+$app->listform_actions->SQLOrderBy = 'ORDER BY dns_template.name';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index c7d70c4..fb73e1a 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -81,14 +81,14 @@
 	$app->tpl->setVar("server_id",$server_id_option);
 	
 	// load the list of clients
-	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 	$clients = $app->db->queryAllRecords($sql);
 	$client_select = '';
 	if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
 	if(is_array($clients)) {
 		foreach( $clients as $client) {
 			$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
-			$client_select .= "<option value='$client[groupid]' $selected>$client[name] :: $client[contactname]</option>\r\n";
+			$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 		}
 	}
 
@@ -99,18 +99,18 @@
 	
 	// Get the limits of the client
 	$client_group_id = $_SESSION["s"]["user"]["default_group"];
-	$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+	$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
 	
 	// load the list of clients
-	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
+	$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id'];
 	$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['name'].' :: '.$client['contactname'].'</option>';
+	$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
 	if(is_array($clients)) {
 		foreach( $clients as $client) {
 			$selected = ($client["groupid"] == $sys_groupid)?'SELECTED':'';
-			$client_select .= "<option value='$client[groupid]' $selected>$client[name] :: $client[contactname]</option>\r\n";
+			$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 		}
 	}
 
diff --git a/interface/web/help/faq_list.php b/interface/web/help/faq_list.php
index df69273..79e9b6f 100644
--- a/interface/web/help/faq_list.php
+++ b/interface/web/help/faq_list.php
@@ -26,7 +26,7 @@
 	$res = $app->db->queryOneRecord("SELECT MIN(hfs_id) AS min_id FROM help_faq_sections");
 	$hf_section = $res['min_id'];
 }
-$app->listform_actions->SQLExtWhere = "hf_section = $hf_section";
+$app->listform_actions->SQLExtWhere = "help_faq.hf_section = $hf_section";
 
 
 if($hf_section) $res = $app->db->queryOneRecord("SELECT hfs_name FROM help_faq_sections WHERE hfs_id=$hf_section");
diff --git a/interface/web/help/form/support_message.tform.php b/interface/web/help/form/support_message.tform.php
index 29c337f..a8c0847 100644
--- a/interface/web/help/form/support_message.tform.php
+++ b/interface/web/help/form/support_message.tform.php
@@ -71,7 +71,7 @@
 			'formtype'	=> 'SELECT',
 			'default'	=> $sm_default_recipient_id,
 			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> "SELECT sys_user.userid, CONCAT(sys_user.username,' :: ',client.company_name,' :: ',client.contact_name) as contactname FROM sys_user, client WHERE sys_user.userid != 1 AND sys_user.client_id = client.client_id AND $authsql ORDER BY sys_user.username",
+										'querystring' 	=> "SELECT sys_user.userid, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_user, client WHERE sys_user.userid != 1 AND sys_user.client_id = client.client_id AND $authsql ORDER BY sys_user.username",
 										'keyfield'		=> 'userid',
 										'valuefield'	=> 'contactname'
 									 ),
diff --git a/interface/web/help/lib/lang/de_support_message.lng b/interface/web/help/lib/lang/de_support_message.lng
index 60d3c0c..67d68f9 100644
--- a/interface/web/help/lib/lang/de_support_message.lng
+++ b/interface/web/help/lib/lang/de_support_message.lng
@@ -5,4 +5,11 @@
 $wb['message_txt'] = 'Nachricht';
 $wb['tstamp_txt'] = 'Zeitpunkt';
 $wb['reply_txt'] = 'Antworten';
+$wb['date_txt'] = 'Datum';
+$wb['support_request_subject_txt'] = 'Supportanfrage';
+$wb['support_request_txt'] = 'Sie haben eine Supportanfrage erhalten. Bitte antworten Sie nicht auf diese Email, sondern bearbeiten Sie die Supportanfrage in ISPConfig.';
+$wb['answer_to_support_request_txt'] = 'Sie haben eine Antwort auf Ihre Supportanfrage erhalten. Bitte antworten Sie nicht auf diese Email, sondern bearbeiten Sie die Nachricht in ISPConfig.';
+$wb['answer_to_support_request_sent_txt'] = 'Ihre Antwort auf die Supportanfrage ist verschickt worden. Bitte antworten Sie nicht auf diese Email.';
+$wb['support_request_sent_txt'] = 'Ihre Supportanfrage ist verschickt worden. Bitte antworten Sie nicht auf diese Email.';
+$wb['recipient_or_sender_email_address_not_valid_txt'] = 'Die Nachricht konnte nicht verschickt werden, da die Empfänger- und/oder die Sender-Email-Adresse nicht gültig ist.';
 ?>
diff --git a/interface/web/help/lib/lang/de_support_message_list.lng b/interface/web/help/lib/lang/de_support_message_list.lng
index 7273475..74fbeb2 100644
--- a/interface/web/help/lib/lang/de_support_message_list.lng
+++ b/interface/web/help/lib/lang/de_support_message_list.lng
@@ -3,4 +3,5 @@
 $wb['sender_id_txt'] = 'Absender';
 $wb['subject_txt'] = 'Betreff';
 $wb['add_new_record_txt'] = 'Neue Supportnachricht erstellen';
+$wb['date_txt'] = 'Datum';
 ?>
diff --git a/interface/web/help/lib/lang/en_support_message.lng b/interface/web/help/lib/lang/en_support_message.lng
index 59816c6..bcc50ac 100644
--- a/interface/web/help/lib/lang/en_support_message.lng
+++ b/interface/web/help/lib/lang/en_support_message.lng
@@ -5,4 +5,11 @@
 $wb['message_txt'] = 'Message';
 $wb['tstamp_txt'] = 'Timestamp';
 $wb['reply_txt'] = 'Reply';
+$wb['date_txt'] = 'Date';
+$wb['support_request_subject_txt'] = 'Support Request';
+$wb['support_request_txt'] = 'You have got a support request. Please don\'t reply to this email, but process the support request inside ISPConfig.';
+$wb['answer_to_support_request_txt'] = 'You have got a reply to your support request. Please don\'t reply to this email, but process the message inside ISPConfig.';
+$wb['answer_to_support_request_sent_txt'] = 'Your reply to the support request has been sent. Please don\'t reply to this email.';
+$wb['support_request_sent_txt'] = 'Your support request has been sent. Please don\'t reply to this email.';
+$wb['recipient_or_sender_email_address_not_valid_txt'] = 'The message could not be sent because the recipient and/or the sender email address is not valid.';
 ?>
diff --git a/interface/web/help/lib/lang/en_support_message_list.lng b/interface/web/help/lib/lang/en_support_message_list.lng
index 9f2b3fd..2cea311 100644
--- a/interface/web/help/lib/lang/en_support_message_list.lng
+++ b/interface/web/help/lib/lang/en_support_message_list.lng
@@ -3,4 +3,5 @@
 $wb['sender_id_txt'] = 'Sender';
 $wb['subject_txt'] = 'Subject';
 $wb["add_new_record_txt"] = 'Create new support message';
+$wb['date_txt'] = 'Date';
 ?>
\ No newline at end of file
diff --git a/interface/web/help/list/support_message.list.php b/interface/web/help/list/support_message.list.php
index 1f2f8e3..1474959 100644
--- a/interface/web/help/list/support_message.list.php
+++ b/interface/web/help/list/support_message.list.php
@@ -57,6 +57,15 @@
 							'suffix'	=> '%',
 							'width'		=> '',
 							'value'		=> '');
+							
+$liste['item'][] = array(	'field'		=> 'tstamp',
+							'datatype'	=> 'DATETIMETSTAMP',
+							'formtype'	=> 'TEXT',
+							'op'		=> '=',
+							'prefix'	=> '',
+							'suffix'	=> '',
+							'width'		=> '',
+							'value'		=> '');
 
 
 ?>
\ No newline at end of file
diff --git a/interface/web/help/support_message_edit.php b/interface/web/help/support_message_edit.php
index c6e992f..b1cbf2a 100644
--- a/interface/web/help/support_message_edit.php
+++ b/interface/web/help/support_message_edit.php
@@ -31,6 +31,53 @@
 		//* Set the sender_id field to the ID of the current user
 		$this->dataRecord['sender_id'] = $_SESSION['s']['user']['userid'];
 		
+		//* Get recipient email address
+		if($this->dataRecord['recipient_id'] > 1){
+			$sql = "SELECT client.email FROM sys_user, client WHERE sys_user.userid = ".$this->dataRecord['recipient_id']." AND sys_user.client_id = client.client_id";
+			$client = $app->db->queryOneRecord($sql);
+			$recipient_email = $client['email'];
+		} else {
+			$app->uses('ini_parser,getconf');
+			$system_config_mail_settings = $app->getconf->get_global_config('mail');
+			$recipient_email = $system_config_mail_settings['admin_mail'];
+		}
+		
+		//* Get sender email address
+		if($this->dataRecord['sender_id'] > 1){
+			$sql = "SELECT client.email FROM sys_user, client WHERE sys_user.userid = ".$this->dataRecord['sender_id']." AND sys_user.client_id = client.client_id";
+			$client = $app->db->queryOneRecord($sql);
+			$sender_email = $client['email'];
+		} else {
+			$app->uses('ini_parser,getconf');
+			$system_config_mail_settings = $app->getconf->get_global_config('mail');
+			$sender_email = $system_config_mail_settings['admin_mail'];
+		}
+		
+		$email_regex = '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i';
+		if(preg_match($email_regex, $sender_email, $match) && preg_match($email_regex, $recipient_email, $match)){
+			$subject = $app->tform->lng('support_request_subject_txt').': '.$this->dataRecord['subject'];
+			if($this->dataRecord['recipient_id'] == 1){
+				$message = $app->tform->lng('support_request_txt');
+			} else {
+				$message = $app->tform->lng('answer_to_support_request_txt');
+			}
+			$message .= "\n\n".$app->tform->lng('message_txt').": \"".$this->dataRecord['message']."\"";
+			$message .= "\n\nISPConfig: ".($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
+			$app->functions->mail($recipient_email, $subject, $message, $sender_email);
+			
+			//* Send confirmation email to sender
+			if($this->dataRecord['sender_id'] == 1){
+				$confirmation_message = $app->tform->lng('answer_to_support_request_sent_txt');
+			} else {
+				$confirmation_message = $app->tform->lng('support_request_sent_txt');
+			}
+			$confirmation_message .= "\n\n".$app->tform->lng('message_txt').": \"".$this->dataRecord['message']."\"";
+			$confirmation_message .= "\n\nISPConfig: ".($_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
+			$app->functions->mail($sender_email, $subject, $confirmation_message, $recipient_email);
+		} else {
+			$app->tform->errorMessage .= $app->tform->lng("recipient_or_sender_email_address_not_valid_txt")."<br />";
+		}
+		
 		//* call the onSubmit function of the parent class
 		parent::onSubmit();
 	}
@@ -44,6 +91,17 @@
 		//*  read only template  if a existing message is loaded
 		if($this->id > 0) {
 			$app->tform->formDef['tabs']['message']['template'] = 'templates/support_message_view.htm';
+			$record = $app->db->queryOneRecord("SELECT * FROM support_message WHERE support_message_id = ".$this->id);
+			if ($record['tstamp'] > 0) {
+							// is value int?
+							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record['tstamp'], $p)) {
+	                        	$record['tstamp'] = date($app->lng('conf_format_datetime'), $record['tstamp']);
+							} else {
+	                        	$record['tstamp'] = date($app->lng('conf_format_datetime'), strtotime($record['tstamp']));
+							}
+						}
+			$app->tpl->setVar("date", $record['tstamp']);
+			//die(print_r($this->dataRecord));
 		}
 		
 		//* call the onShow function of the parent class
diff --git a/interface/web/help/support_message_list.php b/interface/web/help/support_message_list.php
index dcf779e..b2ac8c0 100644
--- a/interface/web/help/support_message_list.php
+++ b/interface/web/help/support_message_list.php
@@ -12,7 +12,7 @@
 $app->uses('listform_actions');
 
 //* Optional limit
-$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
+$app->listform_actions->SQLExtWhere = "support_message.recipient_id = ".$_SESSION['s']['user']['userid'];
 
 //* Start the form rendering and action ahndling
 $app->listform_actions->onLoad();
diff --git a/interface/web/help/templates/support_message_list.htm b/interface/web/help/templates/support_message_list.htm
index af20223..d3fa429 100644
--- a/interface/web/help/templates/support_message_list.htm
+++ b/interface/web/help/templates/support_message_list.htm
@@ -20,11 +20,13 @@
                     <tr class="caption">
                         <th class="tbl_col_sender_id" scope="col"><tmpl_var name="sender_id_txt"></th>
                         <th class="tbl_col_subject" scope="col"><tmpl_var name="subject_txt"></th>
+						<th class="tbl_col_tstamp" scope="col"><tmpl_var name="date_txt"></th>
                         <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
                     </tr>
                     <tr class="filter">
                         <td class="tbl_col_sender_id"><select name="search_sender_id">{tmpl_var name='search_sender_id'}</select></td>
                         <td class="tbl_col_subject"><input type="text" name="search_subject" value="{tmpl_var name='search_subject'}" /></td>
+						<td class="tbl_col_tstamp">&nbsp;</td>
                         <td class="tbl_col_buttons">
                             <button type="button" class="button icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','help/support_message_list.php');"><span>{tmpl_var name="filter_txt"}</span></button>
                         </td>
@@ -35,6 +37,7 @@
                         <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
                             <td class="tbl_col_sender_id"><a href="#" onclick="loadContent('help/support_message_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="sender_id"}</a></td>
                             <td class="tbl_col_subject"><a href="#" onclick="loadContent('help/support_message_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="subject"}</a></td>
+							<td class="tbl_col_tstamp"><a href="#" onclick="loadContent('help/support_message_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="tstamp"}</a></td>
                             <td class="tbl_col_buttons">
                                 <a class="button icons16 icoDelete" href="javascript: del_record('help/support_message_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a>
                             </td>
@@ -42,13 +45,13 @@
                     </tmpl_loop>
                     <tmpl_unless name="records">
                         <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
-                            <td colspan="3">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
+                            <td colspan="4">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
                         </tr>
                     </tmpl_unless>
                 </tbody>
                 <tfoot>
                     <tr>
-                        <td class="tbl_footer tbl_paging" colspan="3"><tmpl_var name="paging"></td>
+                        <td class="tbl_footer tbl_paging" colspan="4"><tmpl_var name="paging"></td>
                     </tr>
                 </tfoot>
             </table>
diff --git a/interface/web/help/templates/support_message_view.htm b/interface/web/help/templates/support_message_view.htm
index c399e90..f7145e0 100644
--- a/interface/web/help/templates/support_message_view.htm
+++ b/interface/web/help/templates/support_message_view.htm
@@ -13,6 +13,10 @@
                 <label for="message">{tmpl_var name='message_txt'}</label>
                 <p>{tmpl_var name='message'}</p>
             </div>
+			<div class="ctrlHolder">
+                <label for="message">{tmpl_var name='date_txt'}</label>
+                <p>{tmpl_var name='date'}</p>
+            </div>
         </fieldset>
         <div class="buttonHolder buttons">
             <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='reply_txt'}" onclick="loadContent('help/support_message_edit.php?reply={tmpl_var name='id'}');"><span>{tmpl_var name='reply_txt'}</span></button>
diff --git a/interface/web/js/jquery.tipsy.js b/interface/web/js/jquery.tipsy.js
index 1484a01..5e9c694 100644
--- a/interface/web/js/jquery.tipsy.js
+++ b/interface/web/js/jquery.tipsy.js
@@ -371,20 +371,21 @@
                     internal = false;
                     return;
                 }
-                var matcher = new RegExp( "" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "", "i" ),
-                    matchtext = $(this).val();
+                var matchtext = $(this).val().toLowerCase();
                     valid = false,
-                    selected = false;
+                    selected = false,
+                    selected_val = "";
                 select.children( "option" ).each(function() {
-                    if( (($(this).val() == "" && matchtext == "") || $( this ).text().match( matcher )) && $(this).css('display') != 'none' ) {
+                    if( (($(this).val() == "" && matchtext == "") || $( this ).val().toLowerCase() == matchtext) && $(this).css('display') != 'none' ) {
                         valid = true;
                         selected = $(this);
+                        selected_val = $(this).text();
                         return false;
                     }
                 });
                 if(!valid) return false;
                 
-                input.val($(this).val()).autocomplete('option','select').call(input, (e ? e : {target: select}), { item: { option: selected.get(0), internal: true } });
+                input.val(selected_val).autocomplete('option','select').call(input, (e ? e : {target: select}), { item: { option: selected.get(0), internal: true } });
             });
 
             $( "<a>" )
diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index b1b2ef4..c78406a 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -1,6 +1,7 @@
 <?php
 	session_start();
 	include('../../lib/config.inc.php');
+    header('Content-Type: text/javascript; charset=utf-8'); // the config file sets the content type header so we have to override it here!
 	require_once('../../lib/app.inc.php');
 	$lang = (isset($_SESSION['s']['language']) && $_SESSION['s']['language'] != '')?$_SESSION['s']['language']:'en';
 	include_once(ISPC_ROOT_PATH.'/web/strengthmeter/lib/lang/'.$lang.'_strengthmeter.lng');
diff --git a/interface/web/login/lib/lang/de.lng b/interface/web/login/lib/lang/de.lng
index a6c66fe..439fa02 100644
--- a/interface/web/login/lib/lang/de.lng
+++ b/interface/web/login/lib/lang/de.lng
@@ -21,4 +21,5 @@
 $wb['email_txt'] = 'E-Mail';
 $wb['error_maintenance_mode'] = 'Diese ISPConfig Installation wird gerade gewartet. Wir sind in Kürze wieder für Sie da. Vielen Dank für Ihre Geduld.';
 $wb['theme_not_compatible'] = 'Das gewählte Design ist mit dieser ISPConfig Version nicht kompatibel. Bitte prüfen Sie, ob ein Update des Themes verfügbar ist.<br />Es wurde nun automatisch das Standard Design aktiviert.';
+$wb['back_txt'] = 'Zur&uuml;ck';
 ?>
diff --git a/interface/web/login/lib/lang/en.lng b/interface/web/login/lib/lang/en.lng
index 37b4a19..082d1c2 100644
--- a/interface/web/login/lib/lang/en.lng
+++ b/interface/web/login/lib/lang/en.lng
@@ -22,6 +22,7 @@
 $wb['pw_reset_txt']	= "Password reset";
 $wb['pw_button_txt']	= "Resend password";
 $wb['email_txt']	= "Email";
+$wb['back_txt'] = 'Back';
 
 $wb['error_maintenance_mode'] = 'This ISPConfig installation is currently under maintenance. We should be back shortly. Thank you for your patience.';
 
diff --git a/interface/web/login/templates/index.htm b/interface/web/login/templates/index.htm
index b99a1dc..a956701 100644
--- a/interface/web/login/templates/index.htm
+++ b/interface/web/login/templates/index.htm
@@ -26,7 +26,8 @@
         <input type="hidden" name="s_pg" value="index" />
 
         <div class="buttonHolder buttons">
-            <button class="positive iconstxt icoKey" type="button" value="{tmpl_var name="add_new_record_txt"}" onclick="submitLoginForm('pageForm');"><span>{tmpl_var name='login_button_txt'}</span></button>
+            <button class="positive iconstxt icoKey" type="button" value="{tmpl_var name='add_new_record_txt'}" onclick="submitLoginForm('pageForm');"><span>{tmpl_var name='login_button_txt'}</span></button>
+            <button class="negative iconstxt icoKey" type="button" value="{tmpl_var name='pw_lost_txt'}" onclick="loadContent('login/password_reset.php');"><span>{tmpl_var name='pw_lost_txt'}</span></button>
         </div>
     </div>
 
diff --git a/interface/web/login/templates/password_reset.htm b/interface/web/login/templates/password_reset.htm
index a4ab311..7055834 100644
--- a/interface/web/login/templates/password_reset.htm
+++ b/interface/web/login/templates/password_reset.htm
@@ -26,7 +26,9 @@
         <input type="hidden" name="s_pg" value="index" />
 
         <div class="buttonHolder buttons">
-            <button class="positive" type="button" value="{tmpl_var name="add_new_record_txt"}" onclick="submitForm('pageForm','login/password_reset.php');"><span>{tmpl_var name='pw_button_txt'}</span></button>
+            <button class="positive" type="button" value="{tmpl_var name='pw_button_txt'}" onclick="submitForm('pageForm','login/password_reset.php');"><span>{tmpl_var name='pw_button_txt'}</span></button>
+            <button class="negative" type="button" value="{tmpl_var name='back_txt'}" onclick="loadInitContent();"><span>{tmpl_var name='back_txt'}</span></button>
+
         </div>
     </div>
   
diff --git a/interface/web/mail/lib/lang/de_spamfilter_policy.lng b/interface/web/mail/lib/lang/de_spamfilter_policy.lng
index 497cb90..32acca4 100644
--- a/interface/web/mail/lib/lang/de_spamfilter_policy.lng
+++ b/interface/web/mail/lib/lang/de_spamfilter_policy.lng
@@ -16,7 +16,7 @@
 $wb['spam_tag_level_txt'] = 'SPAM Markierungslevel';
 $wb['spam_tag2_level_txt'] = 'SPAM Markierungslevel 2';
 $wb['spam_kill_level_txt'] = 'SPAM Markierungslevel Kill';
-$wb['spam_dsn_cutoff_level_txt'] = 'SPAM Markierungslevel DNS Cutoff';
+$wb['spam_dsn_cutoff_level_txt'] = 'SPAM Markierungslevel DSN Cutoff';
 $wb['spam_quarantine_cutoff_level_txt'] = 'SPAM Markierungslevel Quarantine Cutoff';
 $wb['spam_modifies_subj_txt'] = 'SPAM ändert Betreff';
 $wb['spam_subject_tag_txt'] = 'SPAM Betreff Markierung';
diff --git a/interface/web/mail/lib/lang/de_spamfilter_users.lng b/interface/web/mail/lib/lang/de_spamfilter_users.lng
index d31d0e1..b7f6cd4 100644
--- a/interface/web/mail/lib/lang/de_spamfilter_users.lng
+++ b/interface/web/mail/lib/lang/de_spamfilter_users.lng
@@ -5,4 +5,6 @@
 $wb['email_txt'] = 'E-Mail (Zeichenkette)';
 $wb['fullname_txt'] = 'Name';
 $wb['local_txt'] = 'Lokal';
+$wb['email_error_notempty'] = 'Die E-Mail-Adresse darf nicht leer sein.';
+$wb['fullname_error_notempty'] = 'Der Name darf nicht leer sein.';
 ?>
diff --git a/interface/web/mail/lib/lang/de_user_quota_stats_list.lng b/interface/web/mail/lib/lang/de_user_quota_stats_list.lng
index 9a23a97..beb9c18 100755
--- a/interface/web/mail/lib/lang/de_user_quota_stats_list.lng
+++ b/interface/web/mail/lib/lang/de_user_quota_stats_list.lng
@@ -4,4 +4,5 @@
 $wb['name_txt'] = 'Name';
 $wb['email_txt'] = 'E-Mail Adresse';
 $wb['used_txt'] = 'Verbrauchter Speicherplatz';
+$wb['percentage_txt'] = 'Verbraucht in %';
 ?>
diff --git a/interface/web/mail/lib/lang/en_spamfilter_users.lng b/interface/web/mail/lib/lang/en_spamfilter_users.lng
index 78b346c..38d51ae 100644
--- a/interface/web/mail/lib/lang/en_spamfilter_users.lng
+++ b/interface/web/mail/lib/lang/en_spamfilter_users.lng
@@ -5,4 +5,6 @@
 $wb["email_txt"] = 'Email (Pattern)';
 $wb["fullname_txt"] = 'Name';
 $wb["local_txt"] = 'Local';
+$wb['email_error_notempty'] = 'The email address must not be empty.';
+$wb['fullname_error_notempty'] = 'The name must not be empty.';
 ?>
\ No newline at end of file
diff --git a/interface/web/mail/lib/lang/en_user_quota_stats_list.lng b/interface/web/mail/lib/lang/en_user_quota_stats_list.lng
index 2a493ce..1804193 100755
--- a/interface/web/mail/lib/lang/en_user_quota_stats_list.lng
+++ b/interface/web/mail/lib/lang/en_user_quota_stats_list.lng
@@ -4,4 +4,5 @@
 $wb["name_txt"] = 'Name';
 $wb["email_txt"] = 'Email Address';
 $wb["used_txt"] = 'Used space';
+$wb["percentage_txt"] = 'Used %';
 ?>
diff --git a/interface/web/mail/list/user_quota_stats.list.php b/interface/web/mail/list/user_quota_stats.list.php
index 1123b93..5787556 100644
--- a/interface/web/mail/list/user_quota_stats.list.php
+++ b/interface/web/mail/list/user_quota_stats.list.php
@@ -40,6 +40,8 @@
 // Enable auth
 $liste["auth"]				= "yes";
 
+// mark columns for php sorting (no real mySQL columns)
+$liste["phpsort"] = array('used_sort', 'percentage_sort');
 
 /*****************************************************
 * Suchfelder
diff --git a/interface/web/mail/mail_alias_list.php b/interface/web/mail/mail_alias_list.php
index 1ee6ad6..6921894 100644
--- a/interface/web/mail/mail_alias_list.php
+++ b/interface/web/mail/mail_alias_list.php
@@ -18,7 +18,7 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'alias'";
+$app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'alias'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/mail_aliasdomain_list.php b/interface/web/mail/mail_aliasdomain_list.php
index 8998afa..396aa61 100644
--- a/interface/web/mail/mail_aliasdomain_list.php
+++ b/interface/web/mail/mail_aliasdomain_list.php
@@ -18,7 +18,7 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'aliasdomain'";
+$app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'aliasdomain'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php
index 000afd1..9c118b3 100644
--- a/interface/web/mail/mail_blacklist_list.php
+++ b/interface/web/mail/mail_blacklist_list.php
@@ -16,7 +16,7 @@
 $app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLExtWhere = "access = 'REJECT'";
+$app->listform_actions->SQLExtWhere = "mail_access.access = 'REJECT'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/mail_domain_catchall_list.php b/interface/web/mail/mail_domain_catchall_list.php
index e07495f..a703a17 100644
--- a/interface/web/mail/mail_domain_catchall_list.php
+++ b/interface/web/mail/mail_domain_catchall_list.php
@@ -18,7 +18,7 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'catchall'";
+$app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'catchall'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index d806f03..f8ce78d 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -71,7 +71,7 @@
 
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Clients of the user
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = '';
@@ -80,7 +80,7 @@
 			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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -89,7 +89,7 @@
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by client.contact_name");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by client.contact_name");
 
 			// Set the mailserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_mailserver]");
@@ -97,15 +97,15 @@
 			unset($tmp);
 
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.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['name'].' :: '.$client['contactname'].'</option>';
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
diff --git a/interface/web/mail/mail_domain_list.php b/interface/web/mail/mail_domain_list.php
index d07855c..cad6506 100644
--- a/interface/web/mail/mail_domain_list.php
+++ b/interface/web/mail/mail_domain_list.php
@@ -21,7 +21,7 @@
 // Limit the results to alias domains
 // $app->listform_actions->SQLExtWhere = "type = 'local'";
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY domain';
+$app->listform_actions->SQLOrderBy = 'ORDER BY mail_domain.domain';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/mail/mail_forward_list.php b/interface/web/mail/mail_forward_list.php
index 40c8244..4fd4790 100644
--- a/interface/web/mail/mail_forward_list.php
+++ b/interface/web/mail/mail_forward_list.php
@@ -18,7 +18,7 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'forward'";
+$app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'forward'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/mail_mailinglist_edit.php b/interface/web/mail/mail_mailinglist_edit.php
index 47b18eb..5864396 100644
--- a/interface/web/mail/mail_mailinglist_edit.php
+++ b/interface/web/mail/mail_mailinglist_edit.php
@@ -72,7 +72,7 @@
 		
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Clients of the user
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = '';
 			if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
@@ -80,7 +80,7 @@
 			if(is_array($clients)) {
 				foreach( $clients as $client) {
 					$selected = ($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
-					$client_select .= "<option value='$client[groupid]' $selected>$client[name] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -89,18 +89,18 @@
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name");
 
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.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['name'].' :: '.$client['contactname'].'</option>';
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
 			$tmp_data_record = $app->tform->getDataRecord($this->id);
 			if(is_array($clients)) {
 				foreach( $clients as $client) {
 					$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
-					$client_select .= "<option value='$client[groupid]' $selected>$client[name] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
diff --git a/interface/web/mail/mail_user_list.php b/interface/web/mail/mail_user_list.php
index fcbbaa7..7f93e2b 100644
--- a/interface/web/mail/mail_user_list.php
+++ b/interface/web/mail/mail_user_list.php
@@ -44,7 +44,7 @@
 }
 
 $list = new list_action;
-$list->SQLOrderBy = 'ORDER BY email';
+$list->SQLOrderBy = 'ORDER BY mail_user.email';
 $list->onLoad();
 
 
diff --git a/interface/web/mail/mail_user_stats.php b/interface/web/mail/mail_user_stats.php
index 36c7da5..65b179d 100644
--- a/interface/web/mail/mail_user_stats.php
+++ b/interface/web/mail/mail_user_stats.php
@@ -54,6 +54,86 @@
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
+	
+	function getQueryString() {
+		global $app;
+		$sql_where = '';
+
+		//* Generate the search sql
+		if($app->listform->listDef['auth'] != 'no') {
+			if($_SESSION['s']['user']['typ'] == "admin") {
+				$sql_where = '';
+			} else {
+				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; 
+                //$sql_where = $app->tform->getAuthSQL('r').' and';
+			}
+		}		
+		if($this->SQLExtWhere != '') {
+			$sql_where .= ' '.$this->SQLExtWhere.' and';
+		}
+		
+		$sql_where = $app->listform->getSearchSQL($sql_where);
+		if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
+		$app->tpl->setVar($app->listform->searchValues);
+		
+		$order_by_sql = $this->SQLOrderBy;
+
+		//* Generate SQL for paging
+		$limit_sql = $app->listform->getPagingSQL($sql_where);
+		$app->tpl->setVar('paging',$app->listform->pagingHTML);
+
+		$extselect = '';
+		$join = '';
+		
+		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
+		  $order = str_replace(' DESC','',$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
+		  list($tmp_table, $order) = explode('.', $order);
+		  if($order == 'mail_traffic_last_month'){
+		    $tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+		    $sql_where .= " AND mt.month like '$tmp_date%'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_last_month','traffic',$order_by_sql);
+		  } elseif($order == 'mail_traffic_this_month'){
+		    $tmp_date = date('Y-m');
+		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+		    $sql_where .= " AND mt.month like '$tmp_date%'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_this_month','traffic',$order_by_sql);
+		  } elseif($order == 'mail_traffic_last_year'){
+		    $tmp_date = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		    $extselect .= ', SUM(mt.traffic) as calctraffic';
+		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+		    $sql_where .= " AND mt.month like '$tmp_date%'";;
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_last_year','calctraffic',$order_by_sql);
+		    $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
+		  } elseif($order == 'mail_traffic_this_year'){
+		    $tmp_date = date('Y');
+		    $extselect .= ', SUM(mt.traffic) as calctraffic';
+		    $join .= ' INNER JOIN mail_traffic as mt ON '.$app->listform->listDef['table'].'.mailuser_id = mt.mailuser_id ';
+		    $sql_where .= " AND mt.month like '$tmp_date%'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.mail_traffic_this_year','calctraffic',$order_by_sql);
+		    $order_by_sql = "GROUP BY mailuser_id ".$order_by_sql;
+		  }
+		}
+		
+		if($this->SQLExtSelect != '') {
+			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; 
+			$extselect .= $this->SQLExtSelect;
+		}
+		
+		$table_selects = array();
+		$table_selects[] = trim($app->listform->listDef['table']).'.*';
+		$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
+		if($app->listform->listDef['additional_tables'] != ''){
+			$additional_tables = explode(',', $app->listform->listDef['additional_tables']);
+			foreach($additional_tables as $additional_table){
+				$table_selects[] = trim($additional_table).'.*';
+			}
+		}
+		$select = implode(', ', $table_selects);
+
+		$sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
+		return $sql;
+	}
 }
 
 $list = new list_action;
diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php
index 6a5358e..a4c39a9 100644
--- a/interface/web/mail/mail_whitelist_list.php
+++ b/interface/web/mail/mail_whitelist_list.php
@@ -16,7 +16,7 @@
 $app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLExtWhere = "access = 'OK'";
+$app->listform_actions->SQLExtWhere = "mail_access.access = 'OK'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/spamfilter_blacklist_list.php b/interface/web/mail/spamfilter_blacklist_list.php
index c2cc411..087e533 100644
--- a/interface/web/mail/spamfilter_blacklist_list.php
+++ b/interface/web/mail/spamfilter_blacklist_list.php
@@ -16,7 +16,7 @@
 $app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLExtWhere = "wb = 'B'";
+$app->listform_actions->SQLExtWhere = "spamfilter_wblist.wb = 'B'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/spamfilter_whitelist_list.php b/interface/web/mail/spamfilter_whitelist_list.php
index 12c622a..ffb0fc9 100644
--- a/interface/web/mail/spamfilter_whitelist_list.php
+++ b/interface/web/mail/spamfilter_whitelist_list.php
@@ -16,7 +16,7 @@
 $app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLExtWhere = "wb = 'W'";
+$app->listform_actions->SQLExtWhere = "spamfilter_wblist.wb = 'W'";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/mail/templates/user_quota_stats_list.htm b/interface/web/mail/templates/user_quota_stats_list.htm
index afa7355..c2a5397 100644
--- a/interface/web/mail/templates/user_quota_stats_list.htm
+++ b/interface/web/mail/templates/user_quota_stats_list.htm
@@ -1,51 +1,54 @@
-<h2><tmpl_var name="list_head_txt"></h2>
-
-<div class="panel panel_list_user_quota_stats">
-
-    <div class="pnl_listarea">
-        <fieldset><legend><tmpl_var name="list_head_txt"></legend>
-            <table class="list">
-                <thead>
-                    <tr class="caption">
-                        <th class="tbl_col_email" scope="col"><tmpl_var name="email_txt"></th>
-                        <th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th>
-                        <th class="tbl_col_used tbl_col_nosort" scope="col"><tmpl_var name="used_txt"></th>
-                        <th class="tbl_col_quota" scope="col"><tmpl_var name="quota_txt"></th>
-                        <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
-                    </tr>
-                    <tr class="filter">
-                        <td class="tbl_col_email"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" /></td>
-                        <td class="tbl_col_name"><input type="text" name="search_system_user" value="{tmpl_var name='search_name'}" /></td>
-                        <td class="tbl_col_used">&nbsp;</td>
-                        <td class="tbl_col_quota">&nbsp;</td>
-                        <td class="tbl_col_buttons">
-                            <button type="button" class="button icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','mail/user_quota_stats.php');"><span>{tmpl_var name="filter_txt"}</span></button>
-                        </td>
-                    </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_email"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="email"}</a></td>
-                            <td class="tbl_col_name"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td>
-                            <td class="tbl_col_used"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="used"}</a></td>
-                            <td class="tbl_col_quota"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="quota"}</a></td>
-                            <td class="tbl_col_buttons"></td>
-                        </tr>
-                    </tmpl_loop>
-                    <tmpl_unless name="records">
-                        <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
-                            <td colspan="5">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
-                        </tr>
-                    </tmpl_unless>
-                </tbody>
-                <tfoot>
-                    <tr>
-                        <td class="tbl_footer tbl_paging" colspan="5"><tmpl_var name="paging"></td>
-                    </tr>
-                </tfoot>
-            </table>
-        </fieldset>
-    </div>
-
-</div>
+<h2><tmpl_var name="list_head_txt"></h2>
+
+<div class="panel panel_list_user_quota_stats">
+
+    <div class="pnl_listarea">
+        <fieldset><legend><tmpl_var name="list_head_txt"></legend>
+            <table class="list">
+                <thead>
+                    <tr class="caption">
+                        <th class="tbl_col_email" scope="col"><tmpl_var name="email_txt"></th>
+                        <th class="tbl_col_name" scope="col"><tmpl_var name="name_txt"></th>
+                        <th class="tbl_col_used_sort" scope="col"><tmpl_var name="used_txt"></th>
+                        <th class="tbl_col_quota" scope="col"><tmpl_var name="quota_txt"></th>
+                        <th class="tbl_col_percentage_sort" scope="col"><tmpl_var name="percentage_txt"></th>
+                        <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
+                    </tr>
+                    <tr class="filter">
+                        <td class="tbl_col_email"><input type="text" name="search_email" value="{tmpl_var name='search_email'}" /></td>
+                        <td class="tbl_col_name"><input type="text" name="search_system_user" value="{tmpl_var name='search_name'}" /></td>
+                        <td class="tbl_col_used">&nbsp;</td>
+                        <td class="tbl_col_quota">&nbsp;</td>
+                        <td class="tbl_col_percentage">&nbsp;</td>
+                        <td class="tbl_col_buttons">
+                            <button type="button" class="button icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="submitForm('pageForm','mail/user_quota_stats.php');"><span>{tmpl_var name="filter_txt"}</span></button>
+                        </td>
+                    </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_email"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="email"}</a></td>
+                            <td class="tbl_col_name"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="name"}</a></td>
+                            <td class="tbl_col_used"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="used"}</a></td>
+                            <td class="tbl_col_quota"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="quota"}</a></td>
+                            <td class="tbl_col_percentage"><a href="#" onclick="loadContent('mail/mail_user_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="percentage"}</a></td>
+                            <td class="tbl_col_buttons"></td>
+                        </tr>
+                    </tmpl_loop>
+                    <tmpl_unless name="records">
+                        <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
+                            <td colspan="6">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
+                        </tr>
+                    </tmpl_unless>
+                </tbody>
+                <tfoot>
+                    <tr>
+                        <td class="tbl_footer tbl_paging" colspan="6"><tmpl_var name="paging"></td>
+                    </tr>
+                </tfoot>
+            </table>
+        </fieldset>
+    </div>
+
+</div>
diff --git a/interface/web/mail/user_quota_stats.php b/interface/web/mail/user_quota_stats.php
index 5766ff7..dfc1d8a 100644
--- a/interface/web/mail/user_quota_stats.php
+++ b/interface/web/mail/user_quota_stats.php
@@ -50,16 +50,24 @@
 		$rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
 		
 		if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
-
-        $rec['quota'] = round($rec['quota'] / 1048576,2).' MB';
-		if($rec['quota'] == "0 MB") $rec['quota'] = $app->lng('unlimited');
+		
+		if($rec['quota'] == 0){
+			$rec['quota'] = $app->lng('unlimited');
+            $rec['percentage'] = '';
+            $rec['percentage_sort'] = 0;
+		} else {
+            $rec['percentage'] = round(100 * $rec['used'] / $rec['quota']) . '%';
+			$rec['percentage_sort'] = round(100 * $rec['used'] / $rec['quota']);
+			$rec['quota'] = round($rec['quota'] / 1048576,4).' MB';
+		}
 
 
+        $rec['used_sort'] = $rec['used'];
         if($rec['used'] < 1544000) {
-            $rec['used'] = round($rec['used'] / 1024,2).' KB';
+            $rec['used'] = round($rec['used'] / 1024,4).' KB';
         } else {
-            $rec['used'] = round($rec['used'] / 1048576,2).' MB';
-        }   
+            $rec['used'] = round($rec['used'] / 1048576,4).' MB';
+        }
 
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
diff --git a/interface/web/mail/webmailer.php b/interface/web/mail/webmailer.php
index 2cff5da..7b3e862 100644
--- a/interface/web/mail/webmailer.php
+++ b/interface/web/mail/webmailer.php
@@ -55,14 +55,21 @@
 $global_config = $app->getconf->get_global_config('mail');
 
 if($global_config['webmail_url'] != '') {
-	header('Location:' . $global_config['webmail_url']);
+	$webmail_url = $global_config['webmail_url'];
+	$webmail_url = str_replace('[SERVERNAME]', $serverData['server_name'], $webmail_url);
+	header('Location:' . $webmail_url);
 } else {
 
 /*
  * We only redirect to the login-form, so there is no need, to check any rights
  */
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
-	header('Location:' . $http . '://' . $serverData['server_name'] . '/webmail');
+	if($web_config['server_type'] == 'nginx') {
+		header('Location: http://' . $serverData['server_name'] . ':8081/webmail');
+	} else {
+		header('Location: ' . $http . '://' . $serverData['server_name'] . '/webmail');
+	}
+	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
 }
 exit;
 ?>
\ No newline at end of file
diff --git a/interface/web/mailuser/mail_user_autoresponder_edit.php b/interface/web/mailuser/mail_user_autoresponder_edit.php
index 5fac5b9..5e58081 100644
--- a/interface/web/mailuser/mail_user_autoresponder_edit.php
+++ b/interface/web/mailuser/mail_user_autoresponder_edit.php
@@ -81,6 +81,12 @@
 			$app->tpl->setVar("ar_active", '');
 		}
 		
+		if($this->dataRecord['autoresponder_subject'] == '') {
+			$app->tpl->setVar('autoresponder_subject', $app->tform->lng('autoresponder_subject'));
+		} else {
+			$app->tpl->setVar('autoresponder_subject', $this->dataRecord['autoresponder_subject']);
+		}
+        
 		parent::onShowEnd();
 	}
 	
diff --git a/interface/web/mailuser/mail_user_filter_list.php b/interface/web/mailuser/mail_user_filter_list.php
index 43d7eec..d896aa5 100644
--- a/interface/web/mailuser/mail_user_filter_list.php
+++ b/interface/web/mailuser/mail_user_filter_list.php
@@ -24,7 +24,7 @@
 
 $list = new list_action;
 
-$list->SQLExtWhere = "mailuser_id = ".$_SESSION['s']['user']['mailuser_id'];
+$list->SQLExtWhere = "mail_user_filter.mailuser_id = ".$_SESSION['s']['user']['mailuser_id'];
 
 $list->onLoad();
 
diff --git a/interface/web/monitor/datalog_list.php b/interface/web/monitor/datalog_list.php
index 6f4766e..dd5bfb3 100644
--- a/interface/web/monitor/datalog_list.php
+++ b/interface/web/monitor/datalog_list.php
@@ -50,13 +50,13 @@
 
 $sql = '(';
 foreach($servers as $sv) {
-	$sql .= " (datalog_id > ".$sv['updated']." AND sys_datalog.server_id = ".$sv['server_id'].") OR ";
+	$sql .= " (sys_datalog.datalog_id > ".$sv['updated']." AND sys_datalog.server_id = ".$sv['server_id'].") OR ";
 }
 $sql = substr($sql,0,-4);
 $sql .= ')';
 
 $app->listform_actions->SQLExtWhere = $sql;
-$app->listform_actions->SQLOrderBy = "ORDER BY tstamp DESC, datalog_id DESC";
+$app->listform_actions->SQLOrderBy = "ORDER BY sys_datalog.tstamp DESC, sys_datalog.datalog_id DESC";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/monitor/lib/lang/de.lng b/interface/web/monitor/lib/lang/de.lng
index ff0b645..cf9621f 100644
--- a/interface/web/monitor/lib/lang/de.lng
+++ b/interface/web/monitor/lib/lang/de.lng
@@ -146,4 +146,10 @@
 $wb['Show fail2ban-Log'] = 'Fail2ban Protokoll anzeigen';
 $wb['Show IPTables'] = 'IPTables anzeigen';
 $wb['Show OpenVz VE BeanCounter'] = 'OpenVz VE BeanCounter anzeigen';
+$wb['Show Monit'] = 'Monit anzeigen';
+$wb['no_monit_url_defined_txt'] = 'Keine Monit-URL definiert.';
+$wb['no_permissions_to_view_monit_txt'] = 'Sie haben nicht die Berechtigung, auf Monit zuzugreifen.';
+$wb['Show Munin'] = 'Munin anzeigen';
+$wb['no_munin_url_defined_txt'] = 'Keine Munin-URL definiert.';
+$wb['no_permissions_to_view_munin_txt'] = 'Sie haben nicht die Berechtigung, auf Munin zuzugreifen.';
 ?>
diff --git a/interface/web/monitor/lib/lang/en.lng b/interface/web/monitor/lib/lang/en.lng
index e1be79b..20cf1fb 100644
--- a/interface/web/monitor/lib/lang/en.lng
+++ b/interface/web/monitor/lib/lang/en.lng
@@ -146,4 +146,10 @@
 $wb['monitor_title_beancounter_txt'] = 'OpenVz VE BeanCounter';
 $wb['monitor_updates_nosupport_txt'] = 'Your distribution is not supported for this monitoring';
 $wb['monitor_beancounter_nosupport_txt'] = 'This server is not a OpenVz VE and has no beancounter information';
+$wb['Show Monit'] = 'Show Monit';
+$wb['no_monit_url_defined_txt'] = 'No Monit URL defined.';
+$wb['no_permissions_to_view_monit_txt'] = 'You are not allowed to access Monit.';
+$wb['Show Munin'] = 'Show Munin';
+$wb['no_munin_url_defined_txt'] = 'No Munin URL defined.';
+$wb['no_permissions_to_view_munin_txt'] = 'You are not allowed to access Munin.';
 ?>
diff --git a/interface/web/monitor/lib/module.conf.php b/interface/web/monitor/lib/module.conf.php
index 5983687..1d4e5e1 100644
--- a/interface/web/monitor/lib/module.conf.php
+++ b/interface/web/monitor/lib/module.conf.php
@@ -115,11 +115,21 @@
                   'target' 	=> 'content',
                   'link'	=> 'monitor/show_data.php?type=services',
                   'html_id' => 'services');
+				  
+$items[] = array( 'title' 	=> "Show Monit",
+                  'target' 	=> 'content',
+                  'link'	=> 'monitor/show_monit.php',
+                  'html_id' => 'monit');
 
 $items[] = array( 'title' 	=> "Show OpenVz VE BeanCounter",
                   'target' 	=> 'content',
                   'link'	=> 'monitor/show_data.php?type=openvz_beancounter',
                   'html_id' => 'openvz_beancounter');
+				  
+$items[] = array( 'title' 	=> "Show Munin",
+                  'target' 	=> 'content',
+                  'link'	=> 'monitor/show_munin.php',
+                  'html_id' => 'monit');
 
 $module["nav"][] = array(	'title'	=> 'Server State',
                             'open' 	=> 1,
diff --git a/interface/web/monitor/log_list.php b/interface/web/monitor/log_list.php
index d8304ad..2d5edb2 100644
--- a/interface/web/monitor/log_list.php
+++ b/interface/web/monitor/log_list.php
@@ -47,7 +47,7 @@
 $app->uses('listform_actions');
 //$app->listform_actions->SQLExtWhere = "wb = 'W'";
 
-$app->listform_actions->SQLOrderBy = "ORDER BY tstamp DESC, syslog_id DESC";
+$app->listform_actions->SQLOrderBy = "ORDER BY sys_log.tstamp DESC, sys_log.syslog_id DESC";
 
 $app->listform_actions->onLoad();
 
diff --git a/interface/web/monitor/show_monit.php b/interface/web/monitor/show_monit.php
new file mode 100644
index 0000000..3dd8f03
--- /dev/null
+++ b/interface/web/monitor/show_monit.php
@@ -0,0 +1,82 @@
+<?php
+
+/*
+Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
+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.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('monitor');
+
+$app->uses('tools_monitor');
+
+// Loading the template
+$app->uses('tpl');
+$app->tpl->newTemplate("form.tpl.htm");
+$app->tpl->setInclude('content_tpl', 'templates/show_monit.htm');
+
+$monTransSrv = $app->lng("monitor_settings_server_txt");
+$title = 'Monit ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+
+$app->tpl->setVar("list_head_txt", $title);
+
+if($_SESSION["s"]["user"]["typ"] == 'admin'){
+	
+	$app->uses('getconf');
+	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'],'server');
+
+	$monit_url = trim($server_config['monit_url']);
+	if($monit_url != ''){
+		$monit_url = str_replace('[SERVERNAME]', $_SESSION['monitor']['server_name'], $monit_url);
+		$monit_user = trim($server_config['monit_user']);
+		$monit_password = trim($server_config['monit_password']);
+		$auth_string = '';
+		if($monit_user != ''){
+			$auth_string = $monit_user;
+		}
+		if($monit_user != '' && $monit_password != ''){
+			$auth_string .= ':'.$monit_password;
+		}
+		if($auth_string != '') $auth_string .= '@';
+	
+		$monit_url_parts = parse_url($monit_url);
+  
+		$monit_url = $monit_url_parts['scheme'].'://'.$auth_string.$monit_url_parts['host'].(isset($monit_url_parts['port']) ? ':' . $monit_url_parts['port'] : '').(isset($monit_url_parts['path']) ? $monit_url_parts['path'] : '').(isset($monit_url_parts['query']) ? '?' . $monit_url_parts['query'] : '').(isset($monit_url_parts['fragment']) ? '#' . $monit_url_parts['fragment'] : '');
+	
+		$app->tpl->setVar("monit_url", $monit_url);
+	} else {
+		$app->tpl->setVar("no_monit_url_defined_txt", $app->lng("no_monit_url_defined_txt"));
+	}
+} else {
+	$app->tpl->setVar("no_permissions_to_view_monit_txt", $app->lng("no_permissions_to_view_monit_txt"));
+}
+
+$app->tpl_defaults();
+$app->tpl->pparse();
+?>
diff --git a/interface/web/monitor/show_munin.php b/interface/web/monitor/show_munin.php
new file mode 100644
index 0000000..b193d58
--- /dev/null
+++ b/interface/web/monitor/show_munin.php
@@ -0,0 +1,82 @@
+<?php
+
+/*
+Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com
+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.
+*/
+
+require_once('../../lib/config.inc.php');
+require_once('../../lib/app.inc.php');
+
+//* Check permissions for module
+$app->auth->check_module_permissions('monitor');
+
+$app->uses('tools_monitor');
+
+// Loading the template
+$app->uses('tpl');
+$app->tpl->newTemplate("form.tpl.htm");
+$app->tpl->setInclude('content_tpl', 'templates/show_munin.htm');
+
+$monTransSrv = $app->lng("monitor_settings_server_txt");
+$title = 'Munin ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+
+$app->tpl->setVar("list_head_txt", $title);
+
+if($_SESSION["s"]["user"]["typ"] == 'admin'){
+	
+	$app->uses('getconf');
+	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'],'server');
+
+	$munin_url = trim($server_config['munin_url']);
+	if($munin_url != ''){
+		$munin_url = str_replace('[SERVERNAME]', $_SESSION['monitor']['server_name'], $munin_url);
+		$munin_user = trim($server_config['munin_user']);
+		$munin_password = trim($server_config['munin_password']);
+		$auth_string = '';
+		if($munin_user != ''){
+			$auth_string = $munin_user;
+		}
+		if($munin_user != '' && $munin_password != ''){
+			$auth_string .= ':'.$munin_password;
+		}
+		if($auth_string != '') $auth_string .= '@';
+	
+		$munin_url_parts = parse_url($munin_url);
+  
+		$munin_url = $munin_url_parts['scheme'].'://'.$auth_string.$munin_url_parts['host'].(isset($munin_url_parts['port']) ? ':' . $munin_url_parts['port'] : '').(isset($munin_url_parts['path']) ? $munin_url_parts['path'] : '').(isset($munin_url_parts['query']) ? '?' . $munin_url_parts['query'] : '').(isset($munin_url_parts['fragment']) ? '#' . $munin_url_parts['fragment'] : '');
+		
+		$app->tpl->setVar("munin_url", $munin_url);
+	} else {
+		$app->tpl->setVar("no_munin_url_defined_txt", $app->lng("no_munin_url_defined_txt"));
+	}
+} else {
+	$app->tpl->setVar("no_permissions_to_view_munin_txt", $app->lng("no_permissions_to_view_munin_txt"));
+}
+
+$app->tpl_defaults();
+$app->tpl->pparse();
+?>
diff --git a/interface/web/monitor/templates/show_monit.htm b/interface/web/monitor/templates/show_monit.htm
new file mode 100644
index 0000000..27265bd
--- /dev/null
+++ b/interface/web/monitor/templates/show_monit.htm
@@ -0,0 +1,10 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_system">
+<tmpl_if name='monit_url'>
+    <iframe src="{tmpl_var name='monit_url'}" width="100%" height="1000" frameborder="0" style="overflow:visible;"></iframe>
+<tmpl_else>
+	<div id="errorMsg"><h3>ERROR</h3><ol><li>{tmpl_var name="no_monit_url_defined_txt"} {tmpl_var name="no_permissions_to_view_monit_txt"}<br></li></ol></div>
+</tmpl_if>
+</div>
\ No newline at end of file
diff --git a/interface/web/monitor/templates/show_munin.htm b/interface/web/monitor/templates/show_munin.htm
new file mode 100644
index 0000000..86d33f1
--- /dev/null
+++ b/interface/web/monitor/templates/show_munin.htm
@@ -0,0 +1,10 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_system">
+<tmpl_if name='munin_url'>
+    <iframe src="{tmpl_var name='munin_url'}" width="100%" height="1000" frameborder="0" style="overflow:visible;"></iframe>
+<tmpl_else>
+	<div id="errorMsg"><h3>ERROR</h3><ol><li>{tmpl_var name="no_munin_url_defined_txt"} {tmpl_var name="no_permissions_to_view_munin_txt"}<br></li></ol></div>
+</tmpl_if>
+</div>
\ No newline at end of file
diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index ba9a32e..334738a 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -69,11 +69,17 @@
 		$web_config = $app->getconf->get_server_config($server_id, 'web');
 		if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
 		if($server_type == 'nginx' && $php_type == 'fast-cgi') $php_type = 'php-fpm';
+		// get client id
+		$sql_where = '';
+		if($_SESSION["s"]["user"]["typ"] != 'admin'){
+			$sql_where = " AND client_id = ".$_SESSION["s"]["user"]["client_id"];
+		}
+		
 		if($php_type == 'php-fpm'){
-			$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id");
+			$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fpm_init_script != '' AND php_fpm_ini_dir != '' AND php_fpm_pool_dir != '' AND server_id = $server_id".$sql_where);
 		}
 		if($php_type == 'fast-cgi'){
-			$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id");
+			$php_records = $app->db->queryAllRecords("SELECT * FROM server_php WHERE php_fastcgi_binary != '' AND php_fastcgi_ini_dir != '' AND server_id = $server_id".$sql_where);
 		}
 		$php_select = "";
 		if(is_array($php_records) && !empty($php_records)) {
diff --git a/interface/web/sites/aps_availablepackages_list.php b/interface/web/sites/aps_availablepackages_list.php
index 3e3b83b..0966df9 100644
--- a/interface/web/sites/aps_availablepackages_list.php
+++ b/interface/web/sites/aps_availablepackages_list.php
@@ -42,10 +42,10 @@
 // Load needed classes
 $app->uses('tpl,listform_actions');
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY name, version';
+$app->listform_actions->SQLOrderBy = 'ORDER BY aps_packages.name, aps_packages.version';
 // Show only unlocked packages to clients and (un-)lockable packages to admins
-if($_SESSION['s']['user']['typ'] != 'admin') $app->listform_actions->SQLExtWhere = 'package_status = '.PACKAGE_ENABLED;
-else $app->listform_actions->SQLExtWhere = '(package_status = '.PACKAGE_ENABLED.' OR package_status = '.PACKAGE_LOCKED.')';
+if($_SESSION['s']['user']['typ'] != 'admin') $app->listform_actions->SQLExtWhere = 'aps_packages.package_status = '.PACKAGE_ENABLED;
+else $app->listform_actions->SQLExtWhere = '(aps_packages.package_status = '.PACKAGE_ENABLED.' OR aps_packages.package_status = '.PACKAGE_LOCKED.')';
 
 // Get package amount
 $pkg_count = $app->db->queryOneRecord("SELECT COUNT(*) FROM aps_packages");
diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php
index 43d047f..4c584d1 100644
--- a/interface/web/sites/cron_edit.php
+++ b/interface/web/sites/cron_edit.php
@@ -115,8 +115,17 @@
             $this->dataRecord["type"] = 'url';
         } else {
             $domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($parent_domain["sys_groupid"]));
-            if($domain_owner["limit_cron_type"] == 'full') $this->dataRecord["type"] = 'full';
-            else $this->dataRecord["type"] = 'chrooted';
+            //* True when the site is assigned to a client
+			if(isset($domain_owner["limit_cron_type"])) {
+				if($domain_owner["limit_cron_type"] == 'full') {
+					$this->dataRecord["type"] = 'full';
+				} else {
+					$this->dataRecord["type"] = 'chrooted';
+				}
+			} else {
+				//* True when the site is assigned to the admin
+				$this->dataRecord["type"] = 'full';
+			}
         }
         
         parent::onSubmit();
diff --git a/interface/web/sites/database_del.php b/interface/web/sites/database_del.php
index 2dc90fd..d3c00cd 100644
--- a/interface/web/sites/database_del.php
+++ b/interface/web/sites/database_del.php
@@ -52,7 +52,7 @@
 		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
         
         $app->uses('sites_database_plugin');
-        $app->sites_database_plugin->processDatabaseDelete($this->id);
+        //$app->sites_database_plugin->processDatabaseDelete($this->id);
 	}
 }
 
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index c259ff0..8dc3ab3 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -264,6 +264,10 @@
 						if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
 							$this->dataRecord['remote_ips'] .= ',' . $server_config['ip_address'];
 						}
+                        $tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
+                        $tmp = array_unique($tmp);
+                        $this->dataRecord['remote_ips'] = implode(',', $tmp);
+                        unset($tmp);
 					}
 				}
             }
@@ -328,6 +332,10 @@
 						if(preg_match('/(^|,)' . preg_quote($server_config['ip_address'], '/') . '(,|$)/', $this->dataRecord['remote_ips']) == false) {
 							$this->dataRecord['remote_ips'] .= ',' . $server_config['ip_address'];
 						}
+                        $tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
+                        $tmp = array_unique($tmp);
+                        $this->dataRecord['remote_ips'] = implode(',', $tmp);
+                        unset($tmp);
 					}
 				}
             }
@@ -341,7 +349,7 @@
         
         $app->uses('sites_database_plugin');
         
-        $app->sites_database_plugin->processDatabaseInsert($this);
+        //$app->sites_database_plugin->processDatabaseInsert($this);
         
         $app->db->query($sql);
         if($app->db->errorMessage != '') die($app->db->errorMessage);
@@ -355,7 +363,7 @@
         if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(),$this->id)) {
             
             $app->uses('sites_database_plugin');
-            $app->sites_database_plugin->processDatabaseUpdate($this);
+            //$app->sites_database_plugin->processDatabaseUpdate($this);
 
             $app->db->query($sql);
             if($app->db->errorMessage != '') die($app->db->errorMessage);
diff --git a/interface/web/sites/database_list.php b/interface/web/sites/database_list.php
index dfe11be..42c2005 100644
--- a/interface/web/sites/database_list.php
+++ b/interface/web/sites/database_list.php
@@ -67,7 +67,7 @@
 }
 
 $list = new list_action;
-$list->SQLOrderBy = 'ORDER BY database_name';
+$list->SQLOrderBy = 'ORDER BY web_database.database_name';
 $list->onLoad();
 
 
diff --git a/interface/web/sites/database_phpmyadmin.php b/interface/web/sites/database_phpmyadmin.php
index 0bd379d..e77c5df 100644
--- a/interface/web/sites/database_phpmyadmin.php
+++ b/interface/web/sites/database_phpmyadmin.php
@@ -65,13 +65,13 @@
 if($global_config['phpmyadmin_url'] != '') {
 	$phpmyadmin_url = $global_config['phpmyadmin_url'];
 	$phpmyadmin_url = str_replace(array('[SERVERNAME]', '[DATABASENAME]'),array($serverData['server_name'], $dbData['database_name']),$phpmyadmin_url);
-	header('Location:'.$phpmyadmin_url);
+	header('Location: '.$phpmyadmin_url);
 } else {
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
 	if($web_config['server_type'] == 'nginx') {
-		header('location:' . $http . '://' . $serverData['server_name'] . ':8081/phpmyadmin');
+		header('Location: http://' . $serverData['server_name'] . ':8081/phpmyadmin');
 	} else {
-		header('location:' . $http . '://' . $serverData['server_name'] . '/phpmyadmin');
+		header('Location: ' . $http . '://' . $serverData['server_name'] . '/phpmyadmin');
 	}
 }
 exit;
diff --git a/interface/web/sites/database_user_del.php b/interface/web/sites/database_user_del.php
index 9abcfd1..7931fb7 100644
--- a/interface/web/sites/database_user_del.php
+++ b/interface/web/sites/database_user_del.php
@@ -53,7 +53,12 @@
 		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
         
         $old_record = $app->tform->getDataRecord($this->id);
-        $app->db->datalogDelete('web_database_user', 'database_user_id', $this->id);
+        
+        /* we cannot use datalogDelete here, as we need to set server_id to 0 */
+        $app->db->query("DELETE FROM `web_database_user` WHERE $index_field = '$index_value'");
+        $new_rec = array();
+        $old_record['server_id'] = 0;
+        $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $this->id, $old_record, $new_rec);
     }
     
     function onAfterDelete() { // this has to be done on AFTER delete, because we need the db user still in the database when the server plugin processes the datalog
diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php
index 50975a7..1b71196 100644
--- a/interface/web/sites/database_user_edit.php
+++ b/interface/web/sites/database_user_edit.php
@@ -69,21 +69,21 @@
 			$client = $app->db->queryOneRecord("SELECT client.company_name, client.contact_name, client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
             
             // Fill the client select field
-            $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+            $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
             $records = $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['company_name'].' :: '.$client['contact_name'].'</option>';
+            $client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
             //$tmp_data_record = $app->tform->getDataRecord($this->id);
             if(is_array($records)) {
                 foreach( $records as $rec) {
                     $selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
-                    $client_select .= "<option value='$rec[groupid]' $selected>$rec[name] :: $rec[contactname]</option>\r\n";
+                    $client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
                 }
             }
             $app->tpl->setVar("client_group_id",$client_select);
         } elseif($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = "<option value='0'></option>";
 			//$tmp_data_record = $app->tform->getDataRecord($this->id);
@@ -91,7 +91,7 @@
 				foreach( $clients as $client) {
 					//$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
 					$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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -147,7 +147,7 @@
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
 		
-        $this->dataRecord['server_id'] = $conf['server_id'];
+        $this->dataRecord['server_id'] = 0; // we need this on all servers
         
 		parent::onBeforeUpdate();
 	}
@@ -179,7 +179,7 @@
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
 		
-        $this->dataRecord['server_id'] = $conf['server_id'];
+        $this->dataRecord['server_id'] = 0; // we need this on all servers
         
 		parent::onBeforeInsert();
 	}
@@ -209,7 +209,7 @@
 			$app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id);
 		}
 		
-		$password = $app->db->queryOneRecord("SELECT database_password FROM web_database_user WHERE database_user_id = ".$this->id);
+		/*$password = $app->db->queryOneRecord("SELECT database_password FROM web_database_user WHERE database_user_id = ".$this->id);
         
         $records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'");
         foreach($records as $rec) {
@@ -219,7 +219,7 @@
 			$new_rec['database_password'] = $password['database_password'];
             $app->db->datalogSave('web_database_user', 'UPDATE', 'database_user_id', $this->id, $this->oldDataRecord, $new_rec);
         }
-        unset($new_rec);
+        unset($new_rec);*/
 	}
 
 }
diff --git a/interface/web/sites/database_user_list.php b/interface/web/sites/database_user_list.php
index 52a48e4..84c9535 100644
--- a/interface/web/sites/database_user_list.php
+++ b/interface/web/sites/database_user_list.php
@@ -58,7 +58,7 @@
 }
 
 $list = new list_action;
-$list->SQLOrderBy = 'ORDER BY database_user';
+$list->SQLOrderBy = 'ORDER BY web_database_user.database_user';
 $list->onLoad();
 
 
diff --git a/interface/web/sites/form/database_user.tform.php b/interface/web/sites/form/database_user.tform.php
index 2bac933..fa2b2d3 100644
--- a/interface/web/sites/form/database_user.tform.php
+++ b/interface/web/sites/form/database_user.tform.php
@@ -44,7 +44,7 @@
 $form["action"]			= "database_user_edit.php";
 $form["db_table"]		= "web_database_user";
 $form["db_table_idx"]	= "database_user_id";
-$form["db_history"]		= "no";
+$form["db_history"]		= "yes";
 $form["tab_default"]	= "database_user";
 $form["list_default"]	= "database_user_list.php";
 $form["auth"]			= 'yes'; // yes / no
diff --git a/interface/web/sites/form/shell_user.tform.php b/interface/web/sites/form/shell_user.tform.php
index d698a7a..61d92b3 100644
--- a/interface/web/sites/form/shell_user.tform.php
+++ b/interface/web/sites/form/shell_user.tform.php
@@ -91,7 +91,7 @@
 			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
 														'errmsg'=> 'username_error_unique'),
 										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
+														'regex' => '/^[\w\.\-]{0,32}$/',
 														'errmsg'=> 'username_error_regex'),
 									),
 			'default'	=> '',
diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php
index 8f991b7..233b464 100644
--- a/interface/web/sites/form/web_domain.tform.php
+++ b/interface/web/sites/form/web_domain.tform.php
@@ -318,6 +318,14 @@
 			'default'	=> '',
 			'value'		=> array('' => 'no_redirect_txt', 'non_www_to_www' => 'domain.tld => www.domain.tld', 'www_to_non_www' => 'www.domain.tld => domain.tld', '*_domain_tld_to_domain_tld' => '*.doman.tld => domain.tld', '*_domain_tld_to_www_domain_tld' => '*.domain.tld => www.domain.tld', '*_to_domain_tld' => '* => domain.tld', '*_to_www_domain_tld' => '* => www.domain.tld')
 		),
+		'rewrite_rules' => array (
+			'datatype'	=> 'TEXT',
+			'formtype'	=> 'TEXT',
+			'default'	=> '',
+			'value'		=> '',
+			'width'		=> '30',
+			'maxlength'	=> '255'
+		),
 	##################################
 	# ENDE Datatable fields
 	##################################
@@ -507,7 +515,7 @@
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'SELECT',
 			'default'	=> '',
-			'value'		=> array('none' => 'No backup', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly')
+			'value'		=> array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
 		),
 		'backup_copies' => array (
 			'datatype'	=> 'INTEGER',
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index 455d126..798233d 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -177,6 +177,23 @@
 			$app->db->query($sql);
 		}
 		
+		//* 2. check to ensure that the FTP user path is not changed to a path outside of the docroot by a normal user
+		if(isset($this->dataRecord['dir']) && $this->dataRecord['dir'] != $this->oldDataRecord['dir'] && !$app->auth->is_admin()) {
+			$vd = new validate_ftpuser;
+			$error_message = $vd->ftp_dir('dir', $this->dataRecord['dir'], '');
+			//* This check should normally never be triggered
+			//* Set the path to a safe path (web doc root).
+			if($error_message != '') {
+				$ftp_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM ftp_user WHERE ftp_user_id = '".$app->db->quote($app->tform->primary_id)."'");
+				$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($ftp_data["parent_domain_id"]));
+				$dir = $web["document_root"];
+				$sql = "UPDATE ftp_user SET dir = '$dir' WHERE ftp_user_id = ".$this->id;
+				$app->db->query($sql);
+				$app->log("Error in FTP path settings of FTP user ".$this->dataRecord['username'], 1);
+			}
+			
+		}
+		
 	}
 }
 
diff --git a/interface/web/sites/ftp_user_list.php b/interface/web/sites/ftp_user_list.php
index 250efcf..d5b648c 100644
--- a/interface/web/sites/ftp_user_list.php
+++ b/interface/web/sites/ftp_user_list.php
@@ -68,7 +68,7 @@
 }
 
 $list = new list_action;
-$list->SQLOrderBy = 'ORDER BY username';
+$list->SQLOrderBy = 'ORDER BY ftp_user.username';
 $list->onLoad();
 
 
diff --git a/interface/web/sites/lib/lang/de_shell_user.lng b/interface/web/sites/lib/lang/de_shell_user.lng
index 20d82cc..9de369f 100644
--- a/interface/web/sites/lib/lang/de_shell_user.lng
+++ b/interface/web/sites/lib/lang/de_shell_user.lng
@@ -26,4 +26,6 @@
 $wb['repeat_password_txt'] = 'Passwort wiederholen';
 $wb['password_mismatch_txt'] = 'Die Passwörter stimmen nicht überein.';
 $wb['password_match_txt'] = 'Die Passwörter stimmen überein.';
+$wb['username_must_not_exceed_32_chars_txt'] = 'Der Benutzername darf 32 Zeichen nicht überschreiten.';
+$wb['username_not_allowed_txt'] = 'Der Benutzername ist nicht erlaubt.';
 ?>
diff --git a/interface/web/sites/lib/lang/de_web_domain.lng b/interface/web/sites/lib/lang/de_web_domain.lng
index dab184f..5467c99 100644
--- a/interface/web/sites/lib/lang/de_web_domain.lng
+++ b/interface/web/sites/lib/lang/de_web_domain.lng
@@ -111,5 +111,12 @@
 $wb['available_nginx_directive_snippets_txt'] = 'Verfügbare nginx Direktiven Schnipsel:';
 $wb['proxy_directives_txt'] = 'Proxy Direktiven';
 $wb['available_proxy_directive_snippets_txt'] = 'Verfügbare Proxy Direktiven Schnipsel:';
-$wb['no_server_error'] = 'No server selected.';
+$wb['no_server_error'] = 'Kein server ausgewählt.';
+$wb['no_backup_txt'] = 'Kein Backup';
+$wb['daily_backup_txt'] = 'Täglich';
+$wb['weekly_backup_txt'] = 'Wöchentlich';
+$wb['monthly_backup_txt'] = 'Monatlich';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Unzulässige Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Erlaubte Direktiven:';
 ?>
diff --git a/interface/web/sites/lib/lang/en_shell_user.lng b/interface/web/sites/lib/lang/en_shell_user.lng
index ef0aba0..c15d1b5 100644
--- a/interface/web/sites/lib/lang/en_shell_user.lng
+++ b/interface/web/sites/lib/lang/en_shell_user.lng
@@ -26,4 +26,6 @@
 $wb['repeat_password_txt'] = 'Repeat Password';
 $wb['password_mismatch_txt'] = 'The passwords do not match.';
 $wb['password_match_txt'] = 'The passwords do match.';
+$wb['username_must_not_exceed_32_chars_txt'] = 'The username must not exceed 32 characters.';
+$wb['username_not_allowed_txt'] = 'The username is not allowed.';
 ?>
diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng
index d7b3dcf..f48953f 100644
--- a/interface/web/sites/lib/lang/en_web_domain.lng
+++ b/interface/web/sites/lib/lang/en_web_domain.lng
@@ -112,4 +112,11 @@
 $wb['proxy_directives_txt'] = 'Proxy Directives';
 $wb['available_proxy_directive_snippets_txt'] = 'Available Proxy Directive Snippets:';
 $wb['no_server_error'] = 'No server selected.';
+$wb['no_backup_txt'] = 'No backup';
+$wb['daily_backup_txt'] = 'Daily';
+$wb['weekly_backup_txt'] = 'Weekly';
+$wb['monthly_backup_txt'] = 'Monthly';
+$wb['rewrite_rules_txt'] = 'Rewrite Rules';
+$wb['invalid_rewrite_rules_txt'] = 'Invalid Rewrite Rules';
+$wb['allowed_rewrite_rule_directives_txt'] = 'Allowed Directives:';
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/list/aps_installedpackages.list.php b/interface/web/sites/list/aps_installedpackages.list.php
index 1751af7..2340824 100644
--- a/interface/web/sites/list/aps_installedpackages.list.php
+++ b/interface/web/sites/list/aps_installedpackages.list.php
@@ -1,83 +1,93 @@
-<?php
-/*
-Copyright (c) 2012, ISPConfig UG
-Contributors: web wack creations,  http://www.web-wack.at
-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.
-*/
-
-$liste['name'] = 'aps_instances'; // Name of the list
-$liste['table'] = 'aps_instances,aps_packages'; // Database table
-$liste['table_idx'] = 'id'; // Table index
-$liste["search_prefix"] = 'search_'; // Search field prefix
-$liste['records_per_page'] = 15; // Records per page
-$liste['file'] = 'aps_installedpackages_list.php'; // Script file for this list
-$liste['edit_file']    = ''; // Script file to edit
-$liste['delete_file'] = ''; // Script file to delete
-$liste['paging_tpl'] = 'templates/paging.tpl.htm'; // Paging template
-$liste['auth'] = 'no'; // Handling it myself (check for admin)
-
-// Search fields
-$liste["item"][] = array('field'    => 'name',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'TEXT',
-                         'op'       => 'LIKE',
-                         'prefix'   => '%',
-                         'suffix'   => '%',
-                         'width'    => '',
-                         'value'    => '');
- 
-$liste["item"][] = array('field'    => 'version',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'TEXT',
-                         'op'       => 'like',
-                         'prefix'   => '%',
-                         'suffix'   => '%',
-                         'width'    => '',
-                         'value'    => '');
- 
- /*
-$liste["item"][] = array('field'    => 'customer_id',
-                         'datatype' => 'INTEGER',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'width'    => '',
-                         'value'    => '');
-*/
-                         
-$liste["item"][] = array('field'    => 'instance_status',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'width'    => '',
-                         'value'    => array(INSTANCE_INSTALL => $app->lng('Installation_task'),
-                                             INSTANCE_ERROR => $app->lng('Installation_error'),
-                                             INSTANCE_SUCCESS => $app->lng('Installation_success'),
-                                             INSTANCE_REMOVE => $app->lng('Installation_remove'))); 
+<?php
+/*
+Copyright (c) 2012, ISPConfig UG
+Contributors: web wack creations,  http://www.web-wack.at
+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.
+*/
+
+$liste['name'] = 'aps_instances'; // Name of the list
+$liste['table'] = 'aps_instances'; // Database table
+$liste['table_idx'] = 'id'; // Table index
+
+// if multiple tables are involved, list the additional tables here (comma separated)
+$liste["additional_tables"] = "aps_packages";
+
+// if multiple tables are involved, specify sql to join these tables
+$liste["join_sql"] = " aps_instances.package_id = aps_packages.id";
+
+$liste["search_prefix"] = 'search_'; // Search field prefix
+$liste['records_per_page'] = 15; // Records per page
+$liste['file'] = 'aps_installedpackages_list.php'; // Script file for this list
+$liste['edit_file']    = ''; // Script file to edit
+$liste['delete_file'] = ''; // Script file to delete
+$liste['paging_tpl'] = 'templates/paging.tpl.htm'; // Paging template
+$liste['auth'] = 'no'; // Handling it myself (check for admin)
+
+// Search fields
+$liste["item"][] = array('field'    => 'name',
+                         'datatype' => 'VARCHAR',
+                         'formtype' => 'TEXT',
+                         'op'       => 'LIKE',
+                         'prefix'   => '%',
+                         'suffix'   => '%',
+                         'width'    => '',
+                         'value'    => '',
+						 'table'	=> 'aps_packages');
+ 
+$liste["item"][] = array('field'    => 'version',
+                         'datatype' => 'VARCHAR',
+                         'formtype' => 'TEXT',
+                         'op'       => 'like',
+                         'prefix'   => '%',
+                         'suffix'   => '%',
+                         'width'    => '',
+                         'value'    => '',
+						 'table'	=> 'aps_packages');
+ 
+ /*
+$liste["item"][] = array('field'    => 'customer_id',
+                         'datatype' => 'INTEGER',
+                         'formtype' => 'SELECT',
+                         'op'       => '=',
+                         'prefix'   => '',
+                         'suffix'   => '',
+                         'width'    => '',
+                         'value'    => '');
+*/
+                         
+$liste["item"][] = array('field'    => 'instance_status',
+                         'datatype' => 'VARCHAR',
+                         'formtype' => 'SELECT',
+                         'op'       => '=',
+                         'prefix'   => '',
+                         'suffix'   => '',
+                         'width'    => '',
+                         'value'    => array(INSTANCE_INSTALL => $app->lng('Installation_task'),
+                                             INSTANCE_ERROR => $app->lng('Installation_error'),
+                                             INSTANCE_SUCCESS => $app->lng('Installation_success'),
+                                             INSTANCE_REMOVE => $app->lng('Installation_remove')),
+						 'table'	=> 'aps_instances'); 
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/list/user_quota_stats.list.php b/interface/web/sites/list/user_quota_stats.list.php
index c3999c2..646da27 100644
--- a/interface/web/sites/list/user_quota_stats.list.php
+++ b/interface/web/sites/list/user_quota_stats.list.php
@@ -42,6 +42,9 @@
 // Enable auth
 $liste["auth"]				= "yes";
 
+// mark columns for php sorting (no real mySQL columns)
+$liste["phpsort"] = array('used_sort', 'files');
+
 
 /*****************************************************
 * Suchfelder
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index 6939d4a..b14963a 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -121,7 +121,7 @@
 		$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
 		foreach($blacklist as $line) {
 			if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))){
-				$app->tform->errorMessage .= 'The username is not allowed.';
+				$app->tform->errorMessage .= $app->tform->lng('username_not_allowed_txt');
 			}
 		}
 		unset($blacklist);
@@ -138,6 +138,8 @@
             $this->dataRecord['username_prefix'] = $shelluser_prefix;
 			/* restrict the names */
 			$this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
+			
+			if(strlen($this->dataRecord['username']) > 32) $app->tform->errorMessage .= $app->tform->lng("username_must_not_exceed_32_chars_txt");
 		}
 		parent::onBeforeInsert();
 	}
@@ -166,7 +168,7 @@
 		$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
 		foreach($blacklist as $line) {
 			if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))){
-				$app->tform->errorMessage .= 'The username is not allowed.';
+				$app->tform->errorMessage .= $app->tform->lng('username_not_allowed_txt');
 			}
 		}
 		unset($blacklist);
@@ -188,6 +190,8 @@
             
 			/* restrict the names */
 			$this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
+			
+			if(strlen($this->dataRecord['username']) > 32) $app->tform->errorMessage .= $app->tform->lng("username_must_not_exceed_32_chars_txt");
 		}
 	}
 	
diff --git a/interface/web/sites/shell_user_list.php b/interface/web/sites/shell_user_list.php
index 3307d63..cba130c 100644
--- a/interface/web/sites/shell_user_list.php
+++ b/interface/web/sites/shell_user_list.php
@@ -49,7 +49,7 @@
 // Limit the results to alias domains
 //$app->listform_actions->SQLExtWhere = "type = 'subdomain'";
 
-$app->listform_actions->SQLOrderBy = 'ORDER BY username';
+$app->listform_actions->SQLOrderBy = 'ORDER BY shell_user.username';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/sites/templates/database_edit.htm b/interface/web/sites/templates/database_edit.htm
index 8ef4ff2..5da53db 100644
--- a/interface/web/sites/templates/database_edit.htm
+++ b/interface/web/sites/templates/database_edit.htm
@@ -77,7 +77,7 @@
             </div>
             <div class="ctrlHolder">
                 <label for="remote_ips">{tmpl_var name='remote_ips_txt'}</label>
-                <input name="remote_ips" id="remote_ips" value="{tmpl_var name='remote_ips'}" size="60" type="text" class="textInput formLengthHalf" />
+                <input name="remote_ips" id="remote_ips" value="{tmpl_var name='remote_ips'}" size="30" type="text" class="textInput" />
             </div>
             <div class="ctrlHolder">
                 <p class="label">{tmpl_var name='active_txt'}</p>
diff --git a/interface/web/sites/templates/user_quota_stats_list.htm b/interface/web/sites/templates/user_quota_stats_list.htm
index e20b991..1403a01 100644
--- a/interface/web/sites/templates/user_quota_stats_list.htm
+++ b/interface/web/sites/templates/user_quota_stats_list.htm
@@ -9,10 +9,10 @@
                 <tr class="caption">
                     <th class="tbl_col_domain" scope="col"><tmpl_var name="domain_txt"></th>
                     <th class="tbl_col_system_user" scope="col"><tmpl_var name="system_user_txt"></th>
-                    <th class="tbl_col_used tbl_col_nosort" scope="col"><tmpl_var name="used_txt"></th>
+                    <th class="tbl_col_used_sort" scope="col"><tmpl_var name="used_txt"></th>
                     <th class="tbl_col_soft tbl_col_nosort" scope="col"><tmpl_var name="soft_txt"></th>
                     <th class="tbl_col_hard tbl_col_nosort" scope="col"><tmpl_var name="hard_txt"></th>
-                    <th class="tbl_col_files tbl_col_nosort" scope="col"><tmpl_var name="files_txt"></th>
+                    <th class="tbl_col_files" scope="col"><tmpl_var name="files_txt"></th>
                     <th class="tbl_col_limit" scope="col">{tmpl_var name='search_limit'}</th>
                 </tr>
                 <tr class="filter">
diff --git a/interface/web/sites/templates/web_domain_advanced.htm b/interface/web/sites/templates/web_domain_advanced.htm
index f612f28..5df608a 100644
--- a/interface/web/sites/templates/web_domain_advanced.htm
+++ b/interface/web/sites/templates/web_domain_advanced.htm
@@ -61,11 +61,11 @@
                     <input name="pm_max_requests" id="pm_max_requests" value="{tmpl_var name='pm_max_requests'}" size="3" maxlength="6" type="text" class="textInput formLengthLimit" />
                 </div>
             </div>
-            <div class="ctrlHolder">
+            <div class="ctrlHolder php">
                 <label for="php_open_basedir">{tmpl_var name='php_open_basedir_txt'}</label>
                 <input name="php_open_basedir" id="php_open_basedir" value="{tmpl_var name='php_open_basedir'}" size="30" type="text" class="textInput"  style="width:400px;" />
             </div>
-            <div class="ctrlHolder">
+            <div class="ctrlHolder php">
                 <label for="custom_php_ini">{tmpl_var name='custom_php_ini_txt'}</label>
                 <textarea name="custom_php_ini" id="custom_php_ini" rows='10' cols='50' style="width:400px;">{tmpl_var name='custom_php_ini'}</textarea>&nbsp;<b>{tmpl_var name="available_php_directive_snippets_txt"}</b><br><br>&nbsp;{tmpl_var name="php_directive_snippets_txt"}
             </div>
@@ -144,6 +144,11 @@
             } else {
                 jQuery('.phpfpm').hide();
             }
+			if(data.phptype == "no"){
+                jQuery('.php').hide();
+            } else {
+                jQuery('.php').show();
+            }
         });
 		jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getredirecttype"}, function(data) {
             if(data.redirecttype == "proxy"){
diff --git a/interface/web/sites/templates/web_domain_edit.htm b/interface/web/sites/templates/web_domain_edit.htm
index 25e91b1..9a10623 100644
--- a/interface/web/sites/templates/web_domain_edit.htm
+++ b/interface/web/sites/templates/web_domain_edit.htm
@@ -45,7 +45,7 @@
             </div>
             <div class="ctrlHolder">
                 <label for="ipv6_address">{tmpl_var name='ipv6_address_txt'}</label>
-                <select name="ipv6_address" id="ipv6_address" class="selectInput formLengthIPv4">
+                <select name="ipv6_address" id="ipv6_address" class="selectInput formLengthIPv6">
                     {tmpl_var name='ipv6_address'}
                 </select>
             </div>
diff --git a/interface/web/sites/templates/web_domain_redirect.htm b/interface/web/sites/templates/web_domain_redirect.htm
index 0f69395..faff044 100644
--- a/interface/web/sites/templates/web_domain_redirect.htm
+++ b/interface/web/sites/templates/web_domain_redirect.htm
@@ -21,6 +21,10 @@
                     {tmpl_var name='seo_redirect'}
                 </select>
             </div>
+			<div class="ctrlHolder nginx">
+                <label for="rewrite_rules">{tmpl_var name='rewrite_rules_txt'}</label>
+                <textarea name="rewrite_rules" id="rewrite_rules" rows='10' cols='50' style="width:400px;">{tmpl_var name='rewrite_rules'}</textarea>&nbsp;<b>{tmpl_var name="allowed_rewrite_rule_directives_txt"}</b><br><br>&nbsp;break<br>&nbsp;if<br>&nbsp;return<br>&nbsp;rewrite<br>&nbsp;set
+            </div>
         </fieldset>
 
         <input type="hidden" name="id" value="{tmpl_var name='id'}">
@@ -58,6 +62,7 @@
                 jQuery('#redirect_type option[value="R,L"]').hide();
                 jQuery('#redirect_type option[value="R=301,L"]').hide();
                 if(selected != "no" && selected != "" && selected != "last" && selected != "break" && selected != "redirect" && selected != "permanent" && selected != "proxy") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+				jQuery('.nginx').show();
             } else {
                 jQuery('#redirect_type option[value="last"]').attr('disabled','disabled');
                 jQuery('#redirect_type option[value="break"]').attr('disabled','disabled');
@@ -71,6 +76,7 @@
                 jQuery('#redirect_type option[value="permanent"]').hide();
 				jQuery('#redirect_type option[value="proxy"]').hide();
                 if(selected != "no" && selected != "" && selected != "R" && selected != "L" && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+				jQuery('.nginx').hide();
             }
         });
     }
diff --git a/interface/web/sites/user_quota_stats.php b/interface/web/sites/user_quota_stats.php
index 56cc02c..32aa706 100644
--- a/interface/web/sites/user_quota_stats.php
+++ b/interface/web/sites/user_quota_stats.php
@@ -42,6 +42,7 @@
 		$username = $rec['system_user'];
 		
 		$rec['used'] = $monitor_data['user'][$username]['used'];
+		$rec['used_sort'] = $rec['used'];
 		$rec['soft'] = $monitor_data['user'][$username]['soft'];
 		$rec['hard'] = $monitor_data['user'][$username]['hard'];
 		$rec['files'] = $monitor_data['user'][$username]['files'];
@@ -95,8 +96,8 @@
 }
 
 $list = new list_action;
-$list->SQLExtWhere = "type = 'vhost'";
-$list->SQLOrderBy = 'ORDER BY domain';
+$list->SQLExtWhere = "web_domain.type = 'vhost'";
+$list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
 
diff --git a/interface/web/sites/web_aliasdomain_list.php b/interface/web/sites/web_aliasdomain_list.php
index ef4a181..c5e63be 100644
--- a/interface/web/sites/web_aliasdomain_list.php
+++ b/interface/web/sites/web_aliasdomain_list.php
@@ -47,8 +47,8 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'alias'";
-$app->listform_actions->SQLOrderBy = 'ORDER BY domain';
+$app->listform_actions->SQLExtWhere = "web_domain.type = 'alias'";
+$app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index 11946aa..5c0ec9a 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -171,7 +171,7 @@
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			
 			//* Get global web config
 			$web_config = $app->getconf->get_server_config($client['default_webserver'], 'web');
@@ -182,15 +182,15 @@
 			unset($tmp);
 
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
 			$records = $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['name'].' :: '.$client['contactname'].'</option>';
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
 			//$tmp_data_record = $app->tform->getDataRecord($this->id);
 			if(is_array($records)) {
 				foreach( $records as $rec) {
 					$selected = @(is_array($this->dataRecord) && ($rec["groupid"] == $this->dataRecord['client_group_id'] || $rec["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
-					$client_select .= "<option value='$rec[groupid]' $selected>$rec[name] :: $rec[contactname]</option>\r\n";
+					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -377,7 +377,7 @@
 			unset($php_records);
 
 			// Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
 			$clients = $app->db->queryAllRecords($sql);
 			$client_select = "<option value='0'></option>";
 			//$tmp_data_record = $app->tform->getDataRecord($this->id);
@@ -385,7 +385,7 @@
 				foreach( $clients as $client) {
 					//$selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
 					$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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -661,7 +661,15 @@
 		
 		//* get the server config for this server
 		$app->uses("getconf");
-		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web');
+		if($this->id > 0){
+			$web_rec = $app->tform->getDataRecord($this->id);
+			$server_id = $web_rec["server_id"];
+		} else {
+			// Get the first server ID
+			$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE web_server = 1 ORDER BY server_name LIMIT 0,1");
+			$server_id = intval($tmp['server_id']);
+		}
+		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : $server_id),'web');
 		//* Check for duplicate ssl certs per IP if SNI is disabled
 		if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') {
 			$sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id;
@@ -677,6 +685,59 @@
 				$app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'<br>';
 			}
 		}
+		
+		// Check rewrite rules
+		$server_type = $web_config['server_type'];
+		
+		if($server_type == 'nginx' && isset($this->dataRecord['rewrite_rules']) && trim($this->dataRecord['rewrite_rules']) != '') {
+			$rewrite_rules = trim($this->dataRecord['rewrite_rules']);
+			$rewrites_are_valid = true;
+			// use this counter to make sure all curly brackets are properly closed
+			$if_level = 0;
+			// Make sure we only have Unix linebreaks
+			$rewrite_rules = str_replace("\r\n", "\n", $rewrite_rules);
+			$rewrite_rules = str_replace("\r", "\n", $rewrite_rules);
+			$rewrite_rule_lines = explode("\n", $rewrite_rules);
+			if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
+				foreach($rewrite_rule_lines as $rewrite_rule_line){
+					// rewrite
+					if(preg_match('@^\s*rewrite\s+(^/)?\S+(\$)?\s+\S+(\s+(last|break|redirect|permanent|))?\s*;\s*$@', $rewrite_rule_line)) continue;
+					// if
+					if(preg_match('@^\s*if\s+\(\s*\$\S+(\s+(\!?(=|~|~\*))\s+(\S+|\".+\"))?\s*\)\s*\{\s*$@', $rewrite_rule_line)){
+						$if_level += 1;
+						continue;
+					}
+					// if - check for files, directories, etc.
+					if(preg_match('@^\s*if\s+\(\s*\!?-(f|d|e|x)\s+\S+\s*\)\s*\{\s*$@', $rewrite_rule_line)){
+						$if_level += 1;
+						continue;
+					}
+					// break
+					if(preg_match('@^\s*break\s*;\s*$@', $rewrite_rule_line)){
+						$if_level += 1;
+						continue;
+					}
+					// return code [ text ]
+					if(preg_match('@^\s*return\s+\d\d\d.*;\s*$@', $rewrite_rule_line)) continue;
+					// return code URL
+					// return URL
+					if(preg_match('@^\s*return(\s+\d\d\d)?\s+(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*\@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*\s*;\s*$@', $rewrite_rule_line)) continue;
+					// set
+					if(preg_match('@^\s*set\s+\$\S+\s+\S+\s*;\s*$@', $rewrite_rule_line)) continue;
+					// closing curly bracket
+					if(trim($rewrite_rule_line) == '}'){
+						$if_level -= 1;
+						continue;
+					}
+					$rewrites_are_valid = false;
+					break;
+				}
+			}
+			
+			if(!$rewrites_are_valid || $if_level != 0){
+				$app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
+			}
+		}
 
 		parent::onSubmit();
 	}
diff --git a/interface/web/sites/web_domain_list.php b/interface/web/sites/web_domain_list.php
index feae9c8..d9c5066 100644
--- a/interface/web/sites/web_domain_list.php
+++ b/interface/web/sites/web_domain_list.php
@@ -52,8 +52,8 @@
 }
 
 $list = new list_action;
-$list->SQLExtWhere = "type = 'vhost' AND parent_domain_id = '0'";
-$list->SQLOrderBy = 'ORDER BY domain';
+$list->SQLExtWhere = "web_domain.type = 'vhost' AND web_domain.parent_domain_id = '0'";
+$list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
 ?>
\ No newline at end of file
diff --git a/interface/web/sites/web_sites_stats.php b/interface/web/sites/web_sites_stats.php
index 3a01069..6249b68 100644
--- a/interface/web/sites/web_sites_stats.php
+++ b/interface/web/sites/web_sites_stats.php
@@ -79,11 +79,97 @@
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
+	
+	function getQueryString() {
+		global $app;
+		$sql_where = '';
+
+		//* Generate the search sql
+		if($app->listform->listDef['auth'] != 'no') {
+			if($_SESSION['s']['user']['typ'] == "admin") {
+				$sql_where = '';
+			} else {
+				$sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; 
+                //$sql_where = $app->tform->getAuthSQL('r').' and';
+			}
+		}		
+		if($this->SQLExtWhere != '') {
+			$sql_where .= ' '.$this->SQLExtWhere.' and';
+		}
+		
+		$sql_where = $app->listform->getSearchSQL($sql_where);
+		if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql'];
+		$app->tpl->setVar($app->listform->searchValues);
+		
+		$order_by_sql = $this->SQLOrderBy;
+
+		//* Generate SQL for paging
+		$limit_sql = $app->listform->getPagingSQL($sql_where);
+		$app->tpl->setVar('paging',$app->listform->pagingHTML);
+
+		$extselect = '';
+		$join = '';
+		
+		if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){
+		  $order = str_replace(' DESC','',$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']);
+		  list($tmp_table, $order) = explode('.', $order);
+		  if($order == 'web_traffic_last_month'){
+		    $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		    $tmp_month = date('m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_month','calctraffic',$order_by_sql);
+		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
+		  } elseif($order == 'web_traffic_this_month'){
+		    $tmp_year = date('Y');
+		    $tmp_month = date('m');
+		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_month','calctraffic',$order_by_sql);
+		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
+		  } elseif($order == 'web_traffic_last_year'){
+		    $tmp_year = date('Y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_year','calctraffic',$order_by_sql);
+		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
+		  } elseif($order == 'web_traffic_this_year'){
+		    $tmp_year = date('Y');
+		    $extselect .= ', SUM(wt.traffic_bytes) as calctraffic';
+		    $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname ';
+		    $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'";
+		    $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_year','calctraffic',$order_by_sql);
+		    $order_by_sql = "GROUP BY domain ".$order_by_sql;
+		  }
+		}
+		
+		if($this->SQLExtSelect != '') {
+			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; 
+			$extselect .= $this->SQLExtSelect;
+		}
+		
+		$table_selects = array();
+		$table_selects[] = trim($app->listform->listDef['table']).'.*';
+		$app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']);
+		if($app->listform->listDef['additional_tables'] != ''){
+			$additional_tables = explode(',', $app->listform->listDef['additional_tables']);
+			foreach($additional_tables as $additional_table){
+				$table_selects[] = trim($additional_table).'.*';
+			}
+		}
+		$select = implode(', ', $table_selects);
+
+		$sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql";
+		return $sql;
+	}
 }
 
 $list = new list_action;
-$list->SQLExtWhere = "(type = 'vhost' or type = 'vhostsubdomain')";
-$list->SQLOrderBy = 'ORDER BY domain';
+$list->SQLExtWhere = "(web_domain.type = 'vhost' or web_domain.type = 'vhostsubdomain')";
+$list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
 
diff --git a/interface/web/sites/web_subdomain_list.php b/interface/web/sites/web_subdomain_list.php
index f5feaf7..f14d7b3 100644
--- a/interface/web/sites/web_subdomain_list.php
+++ b/interface/web/sites/web_subdomain_list.php
@@ -47,8 +47,8 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'subdomain'";
-$app->listform_actions->SQLOrderBy = 'ORDER BY domain';
+$app->listform_actions->SQLExtWhere = "web_domain.type = 'subdomain'";
+$app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index c9bdd27..656a7dd 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -131,7 +131,7 @@
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_subdomain, client.default_webserver, client.contact_name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_subdomain, client.default_webserver, client.contact_name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			
 			//* Get global web config
 			$web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
diff --git a/interface/web/sites/web_vhost_subdomain_list.php b/interface/web/sites/web_vhost_subdomain_list.php
index 8c48339..0677a93 100644
--- a/interface/web/sites/web_vhost_subdomain_list.php
+++ b/interface/web/sites/web_vhost_subdomain_list.php
@@ -47,8 +47,8 @@
 $app->uses('listform_actions');
 
 // Limit the results to alias domains
-$app->listform_actions->SQLExtWhere = "type = 'vhostsubdomain'";
-$app->listform_actions->SQLOrderBy = 'ORDER BY domain';
+$app->listform_actions->SQLExtWhere = "web_domain.type = 'vhostsubdomain'";
+$app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/sites/webdav_user_list.php b/interface/web/sites/webdav_user_list.php
index cc4532c..b94157c 100644
--- a/interface/web/sites/webdav_user_list.php
+++ b/interface/web/sites/webdav_user_list.php
@@ -44,7 +44,7 @@
 $app->auth->check_module_permissions('sites');
 
 $app->uses('listform_actions');
-$app->listform_actions->SQLOrderBy = 'ORDER BY username';
+$app->listform_actions->SQLOrderBy = 'ORDER BY webdav_user.username';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/themes/default/css/styles.css b/interface/web/themes/default/css/styles.css
index b8de084..c937f96 100644
--- a/interface/web/themes/default/css/styles.css
+++ b/interface/web/themes/default/css/styles.css
@@ -1,1843 +1,1866 @@
-@charset "UTF-8";
-/* 
-    Document   : styles.css
-    Created on : 06.07.2012, 12:21:59
-    Author     : Christian Foellmann (foe-services.de)
-    Description:
-        Basis was css-code from the "ISPConfig 3: default theme" which was based on
-        "Yet Another Multicolumn Layout" - (X)HTML/CSS Framework 3.0.6
-        by Copyright 2005-2008, Dirk Jesse (http://www.yaml.de)
-*/
-
-/* overall
--------------------------------------------------------------- */
-* {
-    margin: 0;
-    padding: 0;
-}
-html * { font-size: 100.01% }
-body {
-    font-family: "Trebuchet MS", sans-serif;
-    font-size: 75.00%; 
-    color: #444;
-    background: url("../images/screen_bg.png") repeat-x top left fixed #EEEEEE;
-    padding: 10px 0;
-}
-ul, ol, dl { line-height: 1.5em; margin: 0 0 1em 1em }
-li { margin-left: 1.5em; line-height: 1.5em }
-dt { font-weight: bold }
-dd { margin: 0 0 1em 2em }
-a {
-    color: #4D87C7;
-    text-decoration:none;
-}
-a:focus,
-a:hover,
-a:active {
-    color:#182E7A;
-    text-decoration:underline;
-}
-hr {
-    color: #fff;
-    background:transparent;
-    margin: 0 0 0.5em 0;
-    padding: 0 0 0.5em 0;
-    border:0;
-    border-bottom: 1px #eee solid;
-}
-textarea, pre, tt, code {
-    font-family: Consolas,"Lucida Console","Courier New",monospace;
-    font-size: 0.9em;	
-}
-
-h1,h2,h3,h4,h5,h6 { 
-    font-family: "Trebuchet MS", sans-serif;
-    font-weight:bold; 
-    color:#666;
-    margin: 0 0 0.25em 0; 
-}
-h1 { font-size: 200% }                        /* 24px */
-h2 { font-size: 200% }                        /* 24px */
-h3 { font-size: 150% }                        /* 18px */
-h4 { font-size: 133.33% }                     /* 16px */
-h5 { font-size: 116.67% }                     /* 14px */
-h6 { font-size: 116.67%; font-style:italic }  /* 14px */
-
-p { line-height: 1.5em; margin: 0 0 1em 0; }
-
-cite, blockquote { font-style:italic }
-blockquote { margin: 0 0 1em 1.5em }
-
-strong,b { font-weight: bold }
-em,i { font-style:italic }
-
-pre, code { font-family: monospace; font-size: 1.1em; }
-
-acronym, abbr {
-    letter-spacing: .07em;
-    border-bottom: .1em dashed #c00;
-    cursor: help;
-}
-
-header, #nav, #main, footer {
-    clear: both;
-}
-#page {
-    min-width: 980px;
-    max-width: 80%;
-    background: #fff;
-    text-align:left;
-    margin: 0 auto;
-    padding: 10px;
-}
-.skip, .hideme, .print {
-    height: 1px;
-    left: -1000em;
-    position: absolute;
-    top: -1000em;
-    width: 1px;
-}
-
-/* header
--------------------------------------------------------------- */
-header {
-    position: relative;
-    color: #faf0e6;
-    padding: 15px 2em 5px 20px;
-    background: url("../images/header_bg.png") repeat-x top left #9a9a9a;
-}
-header h1 {
-    font-size:2.5em;
-    letter-spacing:-2px;
-    line-height:65%;
-    color: silver;
-}
-header span {
-    color: #333333;
-}
-
-/* header/topsubnav
--------------------------------------------------------------- */
-#topsubnav {
-    position:absolute;
-    top: 10px;
-    right: 10px;
-    text-align: right;
-}
-#topsubnav a { 
-    color: #f0f8ff;
-    font-weight: normal;
-    background:transparent;
-    text-decoration:none;
-}
-#topsubnav a:focus, 
-#topsubnav a:hover,
-#topsubnav a:active {
-    text-decoration:underline;
-    background-color: transparent;
-}
-
-/* nav
--------------------------------------------------------------- */
-#topNav ul {
-    list-style: none;
-    padding: 0 0 0 20px;
-    margin: 0;
-    background: #9a9a9a
-}
-
-#topNav ul li {
-    display: inline;
-    margin: 0 2px 0 0;
-}
-
-#topNav a {
-    background: url("../icons/x32_sprite.png") no-repeat #D3D3D3;
-    color:black;
-    display:inline-block;
-    height:20px;
-    padding-top:37px;
-    text-align:center;
-    text-decoration:none;
-    min-width:78px;
-}
-
-#topNav a:hover {
-    background-color: #eeeeee;
-    color: #000000;
-}
-
-#topNav #topNav_current a {
-    font-weight: bold;
-    color: black;
-    background-color: #ffffff;
-}
-.topnav-tools { background-position: 22px -10px !important; }
-.topnav-admin { background-position: 22px -74px !important; }
-.topnav-sites { background-position: 22px -523px !important; }
-.topnav-monitor { background-position: 22px -585px !important; }
-.topnav- { background-position: 22px -650px !important; }
-.topnav-help { background-position: 22px -715px !important; }
-.topnav-mail { background-position: 22px -780px !important; }
-.topnav-mailuser { background-position: 22px -780px !important; }
-.topnav-vm { background-position: 22px -842px !important; }
-.topnav-domain { background-position: 22px -905px !important; }
-.topnav-dns { background-position: 22px -970px !important; }
-.topnav-dashboard { background-position: 22px -1035px !important; }
-.topnav-client { background-position: 22px -1098px !important; }
-.topnav-billing { background-position: 22px -1162px !important; }
-#topNav a span {
-            padding: 0 3px;
-        }
-/* main
--------------------------------------------------------------- */
-#main { 
-    background: #fff;
-    padding: 1em 0;
-}
-
-/* main/sideNav + submenu
--------------------------------------------------------------- */
-#sideNav { 
-    width: 200px; 
-    float:left;
-    padding: 0 10px 0 0; 
-}
-
-#submenu {
-    width: 100%;
-    overflow: hidden;
-    margin: 0px;
-    list-style-type: none;
-    border-bottom: 2px #ddd solid;
-}
-
-#submenu ul {
-    list-style-type: none;
-    margin:0;
-    padding: 0;
-}
-#submenu li {
-    float:left;
-    width: 100%;
-    margin:0;
-    padding: 0;
-    font-size:0.9em;
-}
-
-#submenu a,
-#submenu strong {
-    display:block;
-    width: 90%;
-    padding: 2px 0px 2px 10%;
-    text-decoration: none;
-    background-color:#fff;
-    color: #444;
-    border-bottom: 1px #eee solid;
-}
-
-/* Menu Title */
-#submenu li.title {
-    width: 100%;
-    padding: 0px;
-    font-weight: bold;
-    color: #444;
-    background-color: #fff;
-    border-top: 2px #888 solid;
-    font-size: 1.1em;
-}
-
-#submenu li.title a {
-    background-color: #f0f8ff;
-    color: #444;
-}
-#submenu li.title a:hover {
-    color: white;
-}
-
-#submenu li span {
-    display:block;
-    width: 90%;
-    padding: 3px 0px 3px 10%;
-    font-weight: bold;
-    border-bottom: 1px #ddd solid;
-}
-
-/* Level 1 */
-#submenu li.active,
-#submenu li strong {
-    width: 90%;
-    padding: 3px 0px 3px 10%;
-    font-weight: bold;
-    color: #fff;
-    background-color:#aab;
-    border-bottom: 1px #eee solid;
-}
-
-#submenu li a {
-    width: 90%;
-    padding-left: 10%;
-    background-color:#fff;
-    color: #444;
-}
-#submenu li a:focus,
-#submenu li a:hover,
-#submenu li a:active {
-    background-color:#f63;
-    color: #fff;
-}
-
-/* Form-Elements in the Menu*/
-#submenu * select#server_id {
-    margin: 3px 10%;
-    padding: 1px;
-    width: 80%;
-}
-
-/* main/content
--------------------------------------------------------------- */
-#content { 
-    margin-left: 200px; 
-    margin-right: 0;
-    padding: 0px 10px 10px 20px;
-    border-left: 1px #ddd solid;
-}
-
-/* footer
--------------------------------------------------------------- */
-
-footer { 
-    color:#666; 
-    background: #f9f9f9;
-    padding: 10px 20px;
-    border-top: 5px #efefef solid;
-    font-size: 0.8em;
-    text-align: center;
-}
-footer a {
-    color: #999;
-    background:transparent;
-    font-weight: bold;
-}
-footer a:hover, footer a:active {
-    color: #4D87C7; 
-    background-color: transparent; 
-    text-decoration:underline;
-}
-
-/* Set a background-color, no system backgorund used anymore */
-select, input, textarea {
-    background: #FFFFFF;
-    border: 1px solid #DFDFDF;
-    padding: 1px;
-    outline:none;
-}
-
-table { width: auto; border-collapse:collapse; margin-bottom: 0.5em; }
-table.full { width: 100%; }
-table.fixed { table-layout:fixed }
-
-table.list td {
-    max-width: 350px;
-    min-width: 32px;
-    white-space: nowrap;
-    overflow:hidden;
-    text-overflow: ellipsis;
-    -o-text-overflow: ellipsis;
-    -icab-text-overflow: ellipsis;
-    -khtml-text-overflow: ellipsis;
-    -moz-text-overflow: ellipsis;
-    -webkit-text-overflow: ellipsis;
-}
-th,
-td {
-    padding: 0.5em;
-    text-align:left;
-}
-thead th {
-    background: #444 url("../images/lists_thead_bg.png") repeat-x;
-    color: #fff;
-}
-tbody th {
-    background: #ccc;
-    color: #333;
-}
-tbody th.sub {
-    background: #ddd;
-    color: #333;
-}
-table.list th[class$="_pid"],
-table.list td[class$="_pid"],
-table.list th[class$="_active"],
-table.list td[class$="_active"],
-table.list th.tbl_col_autoresponder,
-table.list td.tbl_col_autoresponder {
-    width: 70px;
-    text-align: center;
-}
-table.list .tbl_col_buttons,
-table.list .tbl_col_limit {
-    width: 150px;
-}
-.tbl_col_client_pid input {
-    width: 50px;
-}
-.pnl_listarea th[class^="tbl_col"] { cursor:pointer; }
-.pnl_listarea th[class^="tbl_col"]:hover { background-position:0 -15px!important; }
-.pnl_listarea th.tbl_col_nosort { cursor:default; }
-.pnl_listarea th.tbl_col_nosort:hover { background-position:0 0!important; }
-
-.pageForm_description { font-size: 12px; }
-
-/* Tab-Box */
-.tabbox_tabs { border-bottom: 1px solid #d3d3d3; }
-.tabbox_tabs ul {
-    list-style: none;
-    padding: 0;
-    margin: 0;
-}
-.tabbox_tabs li {
-    display: inline;
-    margin: 0 2px 0 0;
-}
-.tabbox_tabs a {
-    padding: 0 1em;
-    text-decoration: none;
-    color: black;
-    background: #d3d3d3;
-    border: 1px solid #d3d3d3;
-}
-.tabbox_tabs a:hover {
-    background: #fc0;
-    color: #540;
-}
-.tabbox_tabs .active a {
-    font-weight: bold;
-    color: #ff6600;
-    background: #ffffff;
-}
-.pnl_toolsarea fieldset, .pnl_listarea fieldset, .pnl_formsarea fieldset {
-    border-top: 1px solid #949494;
-    margin: 20px 0;
-}
-.pnl_toolsarea fieldset legend , .pnl_listarea fieldset legend {
-    font-weight: bold;
-    color: #6299c5;
-}
-.pnl_formarea fieldset {
-    font-weight: bold;
-}
-/* hide line and legend when inside tabbed content */
-#tabbox_content * .pnl_toolsarea fieldset, #tabbox_content * .pnl_listarea fieldset, #tabbox_content * .pnl_formsarea fieldset { border: none !important; }
-#tabbox_content * .pnl_toolsarea fieldset legend, #tabbox_content * .pnl_listarea fieldset legend, #tabbox_content * .pnl_formsarea fieldset legend { display: none !important; }
-.codeview {
-    margin:20px 0;
-    padding:2px;
-    border: 1px solid #ffcc00;
-    background: #fffaea;
-    font-family: Consolas, "Lucida Console", "Courier New", monospace;
-    font-size: 0.9em;
-}
-.codeview .logerror { background: rgb(255,0,0); }
-.codeview .logwarn { background: rgb(255,204,0); }
-.codeview .loginfo { background: rgb(153,204,255); }
-/* Lists */
-table.list {
-    width: 100%;
-    border: 1px solid #d3d3d3 !important;
-}
-table.list thead th { font-size: 10px; }
-table.list tbody { border: 1px solid #d3d3d3 !important; }
-table.list tfoot td { text-align: center;  background: #f8f8f8 url("../images/lists_tfoot_bg.png") repeat-x bottom left;  padding: 24px 8px 8px 8px; }
-table.list .tbl_paging img { vertical-align: top; }
-table.list .tbl_row_even { background: #fcfcfc; }
-table.list .tbl_row_uneven { background: #f0f8ff; }
-table.list tr:hover { background: #fffacd; }
-table.list td { word-wrap:break-word;white-space:pre-wrap; }
-table.list td.tbl_col_buttons { word-wrap:normal;white-space:normal;overflow:visible; }
-
-/* Password Strength */
-#passBar {
-    width: 101px; height: 10px;
-    background: url("../images/meter_bg.gif") repeat-x bottom left;
-    margin: 2px 0;
-    float: left;
-}
-#passText {
-    padding: 0;
-    float: left;
-}
-
-/* Systemmonitor */
-.systemmonitor-server,
-.systemmonitor-ve,
-.systemmonitor-state {
-    margin: 10px 5px;
-    font-family: Consolas, "Lucida Console", "Courier New", monospace;
-    font-size: 0.9em;
-    float: left;
-    width: 100%;
-}
-.systemmonitor-server:hover,
-.systemmonitor-vm:hover { background-color: #FFFACD; }
-.state-no_state,
-.state-no_state-ve {
-    border-top: 4px solid #95A19F;
-    background-color: #f8f8ff;
-}
-.state-unknown,
-.state-unknown-ve {
-    border-top: 4px solid #30302e;
-    background-color: #cecfc5;
-}
-.state-ok,
-.state-ok-ve {
-    border-top: 4px solid #23fb00;
-    background-color: #adffa2;
-}
-.state-info,
-.state-info-ve {
-    border-top: 4px solid #183e99;
-    background-color: #d4e2ff;
-}
-.state-warning,
-.state-warning-ve {
-    border-top: 4px solid #ffa800;
-    background-color: #ffda93;
-}
-.state-critical,
-.state-critical-ve {
-    border-top: 4px solid #ff0000;
-    background-color: #ffb9b9;
-}
-.state-error,
-.state-error-ve {
-    border-top: 4px solid #ff0000;
-    background-color: #ff7f7f;
-}       
-div.icoDevice {
-    float: left;
-    width: 64px;
-    height: 64px;
-    margin: 5px;
-    background: url("../icons/device_sprite.png") no-repeat transparent;
-}
-.systemmonitor-server div.icoDevice { background-position: 0 0; }
-.systemmonitor-ve div.icoDevice { background-position: -64px 0; }
-.systemmonitor-network div.icoDevice { background-position: -128px 0; }
-div.statusDevice,
-div.statusMsg { float: left; }
-div.statusMsg p { 
-    float: left;
-    padding: 5px;
-}
-.systemmonitor-state .status {
-    margin: 5px;
-}
-.status {
-    float: right;
-    width: 32px;
-    height: 32px;
-    background: url("../icons/x32_sprite.png") no-repeat transparent;
-}
-div.status {
-    float: left !important;
-}
-.state-warning .status,
-.state-warning-ve .status { background-position: 0 -143px; }
-.state-no_state .status,
-.state-no_state-ve .status,
-.state-unknown .status,
-.state-unknown-ve .status { background-position: 0 -207px; }
-.state-ok .status,
-.state-ok-ve .status { background-position: 0 -270px; }
-.state-info .status,
-.state-info-ve .status { background-position: 0 -336px; }
-.state-error .status,
-.state-error-ve .status { background-position: 0 -400px; }
-.state-critical .status,
-.state-critical-ve .status { background-position: 0 -463px; }
-
-/* Usage unknown  
-.systemmonitor-content table {
-    border: none;
-    margin-top: 10px;
-}
-
-.systemmonitor-content * .online {
-    border: 1px solid #ffffff;
-    background-color: #E3FFB8;
-    color: #000000;
-    padding:0px 5px;
-}
-.systemmonitor-content * .offline {
-    border: 1px solid #ffffff;
-    background-color: #d12f19; 
-    color:#ffffff;
-    padding:0px 5px;
-}*/
-
-/* Dashboard */
-.dashboard-modules {
-    float:left;
-    width:60px;
-    height: 60px;
-    border:1px dotted #888888;
-    background-color: #cccccc;
-    margin:10px;
-    background-position: center 5px;
-    background-repeat: no-repeat;
-    text-align: center;
-}
-.dashboard-modules a, 
-.dashboard-modules a:hover {
-    background: url("../icons/x32_sprite.png") no-repeat transparent;
-    color:Black;
-    display:block;
-    font-weight:bold;
-    height:30px;
-    padding-top:42px;
-    width:60px;
-    text-decoration: none;
-}
-.dashboard-modules.tools a { background-position: 12px -9px; }
-.dashboard-modules.admin a { background-position: 12px -73px; }
-.dashboard-modules.sites a { background-position: 12px -520px; }
-.dashboard-modules.monitor a { background-position: 13px -585px; }
-.dashboard-modules.help a { background-position: 13px -716px; }
-.dashboard-modules.mail a { background-position: 12px -776px; }
-.dashboard-modules.vm a { background-position: 14px -842px; }
-.dashboard-modules.domain a { background-position: 12px -905px; }
-.dashboard-modules.dns a { background-position: 12px -970px; }
-.dashboard-modules.client a { background-position: 13px -1096px; }
-.dashboard-modules.billing a { background-position: 14px -1162px; }
-
-.panel_dashboard h2 { font-size:20px; }
-
-/* Image-Replacement */
-.swap { background-repeat:no-repeat; }
-.swap span { display:none; height:16px; } 
-#ir-HeaderLogo {
-    background-image: url("../images/header_logo.png");
-    height:32px;
-    margin:0 0 0.2em;
-} 
-div#ir-Yes,
-div#ir-No {
-    text-align: center;
-    background: url("../icons/x16_sprite.png") no-repeat transparent;
-}
-#ir-Yes {
-    background-position: center -342px !important;
-    height: 16px;
-}
-#ir-No {
-    background-position: center -362px !important;
-    height: 16px;
-}
-.swap {
-    background-repeat: no-repeat;
-}
-.swap span {
-    display: none;
-    height: 16px;
-}
-/* BUTTONS */
-a.button,
-.button,
-.buttons button {
-    display: inline-block;
-    margin: 0 2px;
-    padding: 2px 5px;
-    color: #525252;
-    text-shadow: 0px 1px 1px #fff;
-    border: 1px solid #c6c6c6;
-    border-radius: 4px;
-    background-color: #f7f7f7;
-    box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
-    -o-box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
-    -webkit-box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
-    -moz-box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
-    text-decoration: none;
-}
-a.button:focus,
-input.button:focus,
-.buttons button:focus {
-    border-color: #4fadd5;
-    box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
-    -moz-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
-    -webkit-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
-    -o-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
-    outline: none;
-}
-.buttons button[type]{
-    padding:5px 10px 5px 7px; /* Firefox */
-    line-height:17px; /* Safari */
-    white-space: nowrap;
-}
-*:first-child+html button[type]{
-    padding:4px 10px 3px 7px; /* IE7 */
-}
-.buttons button img,
-.buttons a img {
-    margin:0 3px -3px 0 !important;
-    padding:0;
-    border:none;
-    width:16px;
-    height:16px;
-}
-.topbuttons {
-    margin-bottom: 10px;
-}
-/* BUTTONS STANDARD */
-button:hover,
-.buttons a:hover {
-    background-color:#dff4ff;
-    border:1px solid #c2e1ef;
-    color:#336699;
-}
-.buttons a:active {
-    background-color:#6299c5;
-    border:1px solid #6299c5;
-    color:#fff;
-}
-
-/* BUTTONS POSITIVE */
-button.positive,
-.buttons a.positive { color:#529214; }
-.buttons a.positive:hover,
-button.positive:hover {
-    background-color:#E6EFC2;
-    border:1px solid #C6D880;
-    color:#529214;
-}
-.buttons a.positive:active {
-    background-color:#529214;
-    border:1px solid #529214;
-    color:#fff;
-}
-
-/* BUTTONS NEGATIVE */
-.buttons a.negative,
-button.negative {
-    color:#d12f19;
-}
-.buttons a.negative:hover,
-button.negative:hover {
-    background-color:#fbe3e4;
-    border:1px solid #fbc2c4;
-    color:#d12f19;
-}
-.buttons a.negative:active {
-    background-color:#d12f19;
-    border:1px solid #d12f19;
-    color:#fff;
-}
-
-/* Button with icon and text */
-.iconstxt { background: url("../icons/button_sprite.png") no-repeat transparent; }
-.iconstxt span { padding-left: 20px; font-weight: bold; }
-.iconstxt.icoPositive { background-position: 6px -130px; }
-.iconstxt.icoNegative { background-position: 6px -98px; }
-.iconstxt.icoAdd { background-position: 6px -66px; }
-.iconstxt.icoKey { background-position: 6px -1px; }
-.iconstxt.icoDelete { background-position: 6px -34px; }
-.iconstxt.icoDownload { background-position: 6px -1px; }
-.iconstxt.icoRestore { background-position: 6px -1px; }
-
-/* Button with icon and without text */
-.icons16 { position: relative; }
-.icons16>span {
-    opacity: 0;
-    visibility: hidden;
-    -webkit-transition: opacity 1s linear;
-    -moz-transition: opacity 1s linear;
-    -o-transition: opacity 1s linear;
-    -ms-transition: opacity 1s linear;
-    transition: opacity 1s linear;
-    position: absolute;
-    right: 23px;
-    top: -1px;
-    padding: 1px 2px;
-    border: 1px solid rgb(155,155,11);
-    background: rgb(255,255,111);
-    white-space: nowrap;
-}
-.icons16:hover>span {
-    opacity: 1.0;
-    visibility: visible;
-}
-a.icons16 {
-    height: 18px;
-    width: 18px;
-    padding: 0;
-    background: url("../icons/x16_sprite.png") no-repeat transparent;
-}
-button.icons16 {
-    height: 20px;
-    width: 20px;
-    padding: 0;
-    background: url("../icons/x16_sprite.png") no-repeat transparent;
-}
-.icons16.icoEdit { background-position: -1px -1px; }
-.icons16.icoLoginAs { background-position: -1px -21px; }
-.icons16.icoPDF { background-position: -1px -61px; }
-.icons16.icoDelete { background-position: -1px -81px; }
-.icons16.icoWebmailer { background-position: -1px -101px; }
-.icons16.icoFilter { background-position: -1px -161px; }
-.icons16.icoDbAdmin { background-position: -1px -221px; }
-.icons16.icoAction { background-position: -1px -241px; }
-.icons16.icoLink { background-position: -1px -422px; float: right; }
-
-div.group-icon {
-    float: left;
-    padding: 2px 0;
-}
-.group-admin,
-.group-user {
-    height: 20px;
-    width: 20px;
-    padding: 0;
-    float: left;
-    background: url("../icons/x16_sprite.png") no-repeat transparent;
-}
-.group-admin { background-position: 0 -380px; }
-.group-user { background-position: 0 -400px; }
-
-span.marked { color: #cc0000; }
-span.small { font-size: 0.9em; }
-
-#ajaxloader {
-    position: absolute;
-    width: 325px;
-    height: 150px;
-    background: #ffffff url('../images/ajax-loader.gif') no-repeat center center;
-    border: solid 2px #e1e1e1;
-    border-radius: 10px;
-    /*background: rgba(255, 255, 255, 0.85);*/
-    padding: 20px;
-    text-align:center;
-    z-index: 100;
-}
-.blockLabel.email_at {
-    width: 20px !important;
-    margin: 1.6em 0.3em 0 0 !important;
-}
-.textDisplay { display: block; }
-
-/* Form Length Classes */
-.textInput.formLengthBool { width: 25px !important; }
-.selectInput.formLengthBool { width: 60px !important; }
-.textInput.formLengthLimit { width: 50px !important; }
-.selectInput.formLengthLimit { width: 85px !important; }
-.formLengthDate { width: 75px !important; }
-.formLengthIPv4 { width: 125px !important; }
-.formLengthIPv6 { width: 100% !important; }
-.formLengthEmailUser { width: 30% !important; }
-.formLengthEmailDomain { width: 30% !important; }
-.formLengthHalf { width: 15% !important; }
-.formLengthDouble { width: 50% !important; }
-
-/* Individual Form Lengths */
-.textInput#username, 
-.textInput#password,
-.textInput#passwort,
-.textInput#source_password { width: 100px; }
-.selectInput#language {	width: 75px; }
-.selectInput#client_group_id, .selectInput#default_group { width: 125px; }
-input#refresh, input#retry, input#expire, input#minimum, input#ttl { width: 50px !important; }
-
-/* --- */
-
-a[href $="#logout"] {
-    padding-right: 20px;
-    background: url("../icons/x16_sprite.png") no-repeat right -143px transparent !important;
-}
-
-/* Select Menu with Images */
-select.withicons option {
-    background-repeat:no-repeat;
-    background-position: 1px;
-    padding-left:24px;
-}	
-div[class^=country-] {
-    background-image: url("../icons/flags_sprite.png");
-    background-repeat: no-repeat;
-    height: 20px;
-    width: 26px;
-}
-li[class^=country-] {
-    background-image: url("../icons/flags_sprite.png");
-    background-repeat: no-repeat;
-    text-indent: 24px;
-}
-li[class^=country-] a.ui-state-hover { background: transparent; }
-div[class^=country-] span {
-    display: none;
-}
-select.flags option {
-    background-image: url("../icons/flags_sprite.png");
-    background-repeat: no-repeat;
-    padding: 1px 0 1px 30px;
-}
-select.flags option[value=EL] {background-position:0 -1475px}
-select.flags option[value=AD], select.flags option[value=ad], .country-AD {background-position:0 -1px}
-select.flags option[value=AE], select.flags option[value=ae], .country-AE {background-position:0 -23px}
-select.flags option[value=AF], select.flags option[value=af], .country-AF {background-position:0 -45px}
-select.flags option[value=AG], select.flags option[value=ag], .country-AG {background-position:0 -67px}
-select.flags option[value=AI], select.flags option[value=ai], .country-AI {background-position:0 -89px}
-select.flags option[value=AL], select.flags option[value=al], .country-AL {background-position:0 -111px}
-select.flags option[value=AM], select.flags option[value=am], .country-AM {background-position:0 -133px}
-select.flags option[value=AN], select.flags option[value=an], .country-AN {background-position:0 -155px}
-select.flags option[value=AO], select.flags option[value=ao], .country-AO {background-position:0 -177px}
-select.flags option[value=AQ], select.flags option[value=aq], .country-AQ {background-position:0 -199px}
-select.flags option[value=AR], select.flags option[value=ar], .country-AR {background-position:0 -221px}
-select.flags option[value=AS], select.flags option[value=as], .country-AS {background-position:0 -243px}
-select.flags option[value=AT], select.flags option[value=at], .country-AT {background-position:0 -265px}
-select.flags option[value=AU], select.flags option[value=au], .country-AU {background-position:0 -287px}
-select.flags option[value=AW], select.flags option[value=aw], .country-AW {background-position:0 -309px}
-select.flags option[value=AX], select.flags option[value=ax], .country-AX {background-position:0 -331px}
-select.flags option[value=AZ], select.flags option[value=az], .country-AZ {background-position:0 -353px}
-select.flags option[value=BA], select.flags option[value=ba], .country-BA {background-position:0 -375px}
-select.flags option[value=BB], select.flags option[value=bb], .country-BB {background-position:0 -397px}
-select.flags option[value=BD], select.flags option[value=bd], .country-BD {background-position:0 -419px}
-select.flags option[value=BE], select.flags option[value=be], .country-BE {background-position:0 -441px}
-select.flags option[value=BF], select.flags option[value=bf], .country-BF {background-position:0 -463px}
-select.flags option[value=BG], select.flags option[value=bg], .country-BG {background-position:0 -485px}
-select.flags option[value=BH], select.flags option[value=bh], .country-BH {background-position:0 -507px}
-select.flags option[value=BI], select.flags option[value=bi], .country-BI {background-position:0 -529px}
-select.flags option[value=BJ], select.flags option[value=bj], .country-BJ {background-position:0 -551px}
-select.flags option[value=BM], select.flags option[value=bm], .country-BM {background-position:0 -573px}
-select.flags option[value=BN], select.flags option[value=bn], .country-BN {background-position:0 -595px}
-select.flags option[value=BO], select.flags option[value=bo], .country-BO {background-position:0 -617px}
-select.flags option[value=BR], select.flags option[value=br], .country-BR {background-position:0 -639px}
-select.flags option[value=BS], select.flags option[value=bs], .country-BS {background-position:0 -661px}
-select.flags option[value=BT], select.flags option[value=bt], .country-BT {background-position:0 -683px}
-select.flags option[value=BV], select.flags option[value=bv], .country-BV {background-position:0 -705px}
-select.flags option[value=BW], select.flags option[value=bw], .country-BW {background-position:0 -727px}
-select.flags option[value=BY], select.flags option[value=by], .country-BY {background-position:0 -749px}
-select.flags option[value=BZ], select.flags option[value=bz], .country-BZ {background-position:0 -771px}
-select.flags option[value=CA], select.flags option[value=ca], .country-CA {background-position:0 -793px}
-select.flags option[value=CC], select.flags option[value=cc], .country-CC {background-position:0 -837px}
-select.flags option[value=CD], select.flags option[value=cd], .country-CD {background-position:0 -859px}
-select.flags option[value=CF], select.flags option[value=cf], .country-CF {background-position:0 -881px}
-select.flags option[value=CG], select.flags option[value=cg], .country-CG {background-position:0 -903px}
-select.flags option[value=CH], select.flags option[value=ch], .country-CH {background-position:0 -925px}
-select.flags option[value=CI], select.flags option[value=ci], .country-CI {background-position:0 -947px}
-select.flags option[value=CK], select.flags option[value=ck], .country-CK {background-position:0 -969px}
-select.flags option[value=CL], select.flags option[value=cl], .country-CL {background-position:0 -991px}
-select.flags option[value=CM], select.flags option[value=cm], .country-CM {background-position:0 -1013px}
-select.flags option[value=CN], select.flags option[value=cn], .country-CN {background-position:0 -1035px}
-select.flags option[value=CO], select.flags option[value=co], .country-CO {background-position:0 -1057px}
-select.flags option[value=CR], select.flags option[value=cr], .country-CR {background-position:0 -1079px}
-select.flags option[value=CS], select.flags option[value=cs], .country-CS {background-position:0 -1101px}
-select.flags option[value=CU], select.flags option[value=cu], .country-CU {background-position:0 -1123px}
-select.flags option[value=CV], select.flags option[value=cv], .country-CV {background-position:0 -1145px}
-select.flags option[value=CX], select.flags option[value=cx], .country-CX {background-position:0 -1167px}
-select.flags option[value=CY], select.flags option[value=cy], .country-CY {background-position:0 -1189px}
-select.flags option[value=CZ], select.flags option[value=cz], .country-CZ {background-position:0 -1211px}
-select.flags option[value=DE], select.flags option[value=de], .country-DE {background-position:0 -1233px}
-select.flags option[value=DJ], select.flags option[value=dj], .country-DJ {background-position:0 -1255px}
-select.flags option[value=DK], select.flags option[value=dk], .country-DK {background-position:0 -1277px}
-select.flags option[value=DM], select.flags option[value=dm], .country-DM {background-position:0 -1299px}
-select.flags option[value=DO], select.flags option[value=do], .country-DO {background-position:0 -1321px}
-select.flags option[value=DZ], select.flags option[value=dz], .country-DZ {background-position:0 -1343px}
-select.flags option[value=EC], select.flags option[value=ec], .country-EC {background-position:0 -1365px}
-select.flags option[value=EE], select.flags option[value=ee], .country-EE {background-position:0 -1387px}
-select.flags option[value=EG], select.flags option[value=eg], .country-EG {background-position:0 -1409px}
-select.flags option[value=EH], select.flags option[value=eh], .country-EH {background-position:0 -1431px}
-select.flags option[value=ER], select.flags option[value=er], .country-ER {background-position:0 -1475px}
-select.flags option[value=ES], select.flags option[value=es], .country-ES {background-position:0 -1497px}
-select.flags option[value=ET], select.flags option[value=ET], select.flags option[value=et], .country-ET {background-position:0 -1519px}
-select.flags option[value=FI], select.flags option[value=fi], .country-FI {background-position:0 -1585px}
-select.flags option[value=FJ], select.flags option[value=fj], .country-FJ {background-position:0 -1607px}
-select.flags option[value=FK], select.flags option[value=fk], .country-FK {background-position:0 -1629px}
-select.flags option[value=FM], select.flags option[value=fm], .country-FM {background-position:0 -1651px}
-select.flags option[value=FO], select.flags option[value=fo], .country-FO {background-position:0 -1673px}
-select.flags option[value=FR], select.flags option[value=fr], .country-FR {background-position:0 -1695px}
-select.flags option[value=GA], select.flags option[value=ga], .country-GA {background-position:0 -1717px}
-select.flags option[value=GB], select.flags option[value=en], select.flags option[value=gb], .country-GB, .country-EN {background-position:0 -1739px}
-select.flags option[value=GD], select.flags option[value=gd], .country-GD {background-position:0 -1761px}
-select.flags option[value=GE], select.flags option[value=ge], .country-GE {background-position:0 -1783px}
-select.flags option[value=GF], select.flags option[value=gf], .country-GF {background-position:0 -1805px}
-select.flags option[value=GH], select.flags option[value=gh], .country-GH {background-position:0 -1827px}
-select.flags option[value=GI], select.flags option[value=gi], .country-GI {background-position:0 -1849px}
-select.flags option[value=GL], select.flags option[value=gl], .country-GL {background-position:0 -1871px}
-select.flags option[value=GM], select.flags option[value=gm], .country-GM {background-position:0 -1893px}
-select.flags option[value=GN], select.flags option[value=gn], .country-GN {background-position:0 -1915px}
-select.flags option[value=GP], select.flags option[value=gp], .country-GP {background-position:0 -1937px}
-select.flags option[value=GQ], select.flags option[value=gq], .country-GQ {background-position:0 -1959px}
-select.flags option[value=GR], select.flags option[value=el], select.flags option[value=gr], .country-GR, .country-EL {background-position:0 -1981px}
-select.flags option[value=GS], select.flags option[value=gs], .country-GS {background-position:0 -2003px}
-select.flags option[value=GT], select.flags option[value=gt], .country-GT {background-position:0 -2025px}
-select.flags option[value=GU], select.flags option[value=gu], .country-GU {background-position:0 -2047px}
-select.flags option[value=GW], select.flags option[value=gw], .country-GW {background-position:0 -2069px}
-select.flags option[value=GY], select.flags option[value=gy], .country-GY {background-position:0 -2091px}
-select.flags option[value=HK], select.flags option[value=hk], .country-HK {background-position:0 -2113px}
-select.flags option[value=HM], select.flags option[value=hm], .country-HM {background-position:0 -2135px}
-select.flags option[value=HN], select.flags option[value=hn], .country-HN {background-position:0 -2157px}
-select.flags option[value=HR], select.flags option[value=hr], .country-HR {background-position:0 -2179px}
-select.flags option[value=HT], select.flags option[value=ht], .country-HT {background-position:0 -2201px}
-select.flags option[value=HU], select.flags option[value=hu], .country-HU {background-position:0 -2223px}
-select.flags option[value=ID], select.flags option[value=id], .country-ID {background-position:0 -2245px}
-select.flags option[value=IE], select.flags option[value=ie], .country-IE {background-position:0 -2267px}
-select.flags option[value=IL], select.flags option[value=il], .country-IL {background-position:0 -2289px}
-select.flags option[value=IN], select.flags option[value=in], .country-IN {background-position:0 -2311px}
-select.flags option[value=IO], select.flags option[value=io], .country-IO {background-position:0 -2333px}
-select.flags option[value=IQ], select.flags option[value=iq], .country-IQ {background-position:0 -2355px}
-select.flags option[value=IR], select.flags option[value=ir], .country-IR {background-position:0 -2377px}
-select.flags option[value=IS], select.flags option[value=is], .country-IS {background-position:0 -2399px}
-select.flags option[value=IT], select.flags option[value=it], .country-IT {background-position:0 -2421px}
-select.flags option[value=JM], select.flags option[value=jm], .country-JM {background-position:0 -2443px}
-select.flags option[value=JO], select.flags option[value=jo], .country-JO {background-position:0 -2465px}
-select.flags option[value=JP], select.flags option[value=ja], select.flags option[value=jp], .country-JP, .country-JA {background-position:0 -2487px}
-select.flags option[value=KE], select.flags option[value=ke], .country-KE {background-position:0 -2509px}
-select.flags option[value=KG], select.flags option[value=kg], .country-KG {background-position:0 -2531px}
-select.flags option[value=KH], select.flags option[value=kh], .country-KH {background-position:0 -2553px}
-select.flags option[value=KI], select.flags option[value=ki], .country-KI {background-position:0 -2575px}
-select.flags option[value=KM], select.flags option[value=km], .country-KM {background-position:0 -2597px}
-select.flags option[value=KN], select.flags option[value=kn], .country-KN {background-position:0 -2619px}
-select.flags option[value=KP], select.flags option[value=kp], .country-KP {background-position:0 -2641px}
-select.flags option[value=KR], select.flags option[value=kr], .country-KR {background-position:0 -2663px}
-select.flags option[value=KW], select.flags option[value=kw], .country-KW {background-position:0 -2685px}
-select.flags option[value=KY], select.flags option[value=ky], .country-KY {background-position:0 -2707px}
-select.flags option[value=KZ], select.flags option[value=kz], .country-KZ {background-position:0 -2729px}
-select.flags option[value=LA], select.flags option[value=la], .country-LA {background-position:0 -2751px}
-select.flags option[value=LB], select.flags option[value=lb], .country-LB {background-position:0 -2773px}
-select.flags option[value=LC], select.flags option[value=lc], .country-LC {background-position:0 -2795px}
-select.flags option[value=LI], select.flags option[value=li], .country-LI {background-position:0 -2817px}
-select.flags option[value=LK], select.flags option[value=lk], .country-LK {background-position:0 -2839px}
-select.flags option[value=LR], select.flags option[value=lr], .country-LR {background-position:0 -2861px}
-select.flags option[value=LS], select.flags option[value=ls], .country-LS {background-position:0 -2883px}
-select.flags option[value=LT], select.flags option[value=lt], .country-LT {background-position:0 -2905px}
-select.flags option[value=LU], select.flags option[value=lu], .country-LU {background-position:0 -2927px}
-select.flags option[value=LV], select.flags option[value=lv], .country-LV {background-position:0 -2949px}
-select.flags option[value=LY], select.flags option[value=ly], .country-LY {background-position:0 -2971px}
-select.flags option[value=MA], select.flags option[value=ma], .country-MA {background-position:0 -2993px}
-select.flags option[value=MC], select.flags option[value=mc], .country-MC {background-position:0 -3015px}
-select.flags option[value=MD], select.flags option[value=md], .country-MD {background-position:0 -3037px}
-select.flags option[value=ME], select.flags option[value=me], .country-ME {background-position:0 -3059px}
-select.flags option[value=MG], select.flags option[value=mg], .country-MG {background-position:0 -3081px}
-select.flags option[value=MH], select.flags option[value=mh], .country-MH {background-position:0 -3103px}
-select.flags option[value=MK], select.flags option[value=mk], .country-MK {background-position:0 -3125px}
-select.flags option[value=ML], select.flags option[value=ml], .country-ML {background-position:0 -3147px}
-select.flags option[value=MM], select.flags option[value=mm], .country-MM {background-position:0 -3169px}
-select.flags option[value=MN], select.flags option[value=mn], .country-MN {background-position:0 -3191px}
-select.flags option[value=MO], select.flags option[value=mo], .country-MO {background-position:0 -3213px}
-select.flags option[value=MP], select.flags option[value=mp], .country-MP {background-position:0 -3235px}
-select.flags option[value=MQ], select.flags option[value=mq], .country-MQ {background-position:0 -3257px}
-select.flags option[value=MR], select.flags option[value=mr], .country-MR {background-position:0 -3279px}
-select.flags option[value=MS], select.flags option[value=ms], .country-MS {background-position:0 -3301px}
-select.flags option[value=MT], select.flags option[value=mt], .country-MT {background-position:0 -3323px}
-select.flags option[value=MU], select.flags option[value=mu], .country-MU {background-position:0 -3345px}
-select.flags option[value=MV], select.flags option[value=mv], .country-MV {background-position:0 -3367px}
-select.flags option[value=MW], select.flags option[value=mw], .country-MW {background-position:0 -3389px}
-select.flags option[value=MX], select.flags option[value=mx], .country-MX {background-position:0 -3411px}
-select.flags option[value=MY], select.flags option[value=my], .country-MY {background-position:0 -3433px}
-select.flags option[value=MZ], select.flags option[value=mz], .country-MZ {background-position:0 -3455px}
-select.flags option[value=NA], select.flags option[value=na], .country-NA {background-position:0 -3477px}
-select.flags option[value=NC], select.flags option[value=nc], .country-NC {background-position:0 -3499px}
-select.flags option[value=NE], select.flags option[value=ne], .country-NE {background-position:0 -3521px}
-select.flags option[value=NF], select.flags option[value=nf], .country-NF {background-position:0 -3543px}
-select.flags option[value=NG], select.flags option[value=ng], .country-NG {background-position:0 -3565px}
-select.flags option[value=NI], select.flags option[value=ni], .country-NI {background-position:0 -3587px}
-select.flags option[value=NL], select.flags option[value=nl], .country-NL {background-position:0 -3609px}
-select.flags option[value=NO], select.flags option[value=no], .country-NO {background-position:0 -3631px}
-select.flags option[value=NP], select.flags option[value=np], .country-NP {background-position:0 -3653px}
-select.flags option[value=NR], select.flags option[value=nr], .country-NR {background-position:0 -3675px}
-select.flags option[value=NU], select.flags option[value=nu], .country-NU {background-position:0 -3697px}
-select.flags option[value=NZ], select.flags option[value=nz], .country-NZ {background-position:0 -3719px}
-select.flags option[value=OM], select.flags option[value=om], .country-OM {background-position:0 -3741px}
-select.flags option[value=PA], select.flags option[value=pa], .country-PA {background-position:0 -3763px}
-select.flags option[value=PE], select.flags option[value=pe], .country-PE {background-position:0 -3785px}
-select.flags option[value=PF], select.flags option[value=pf], .country-PF {background-position:0 -3807px}
-select.flags option[value=PG], select.flags option[value=pg], .country-PG {background-position:0 -3829px}
-select.flags option[value=PH], select.flags option[value=ph], .country-PH {background-position:0 -3851px}
-select.flags option[value=PK], select.flags option[value=pk], .country-PK {background-position:0 -3873px}
-select.flags option[value=PL], select.flags option[value=pl], .country-PL {background-position:0 -3895px}
-select.flags option[value=PM], select.flags option[value=pm], .country-PM {background-position:0 -3917px}
-select.flags option[value=PN], select.flags option[value=pn], .country-PN {background-position:0 -3939px}
-select.flags option[value=PR], select.flags option[value=pr], .country-PR {background-position:0 -3961px}
-select.flags option[value=PS], select.flags option[value=ps], .country-PS {background-position:0 -3983px}
-select.flags option[value=PT], select.flags option[value=pt], .country-PT {background-position:0 -4005px}
-select.flags option[value=PW], select.flags option[value=pw], .country-PW {background-position:0 -4027px}
-select.flags option[value=PY], select.flags option[value=py], .country-PY {background-position:0 -4049px}
-select.flags option[value=QA], select.flags option[value=qa], .country-QA {background-position:0 -4071px}
-select.flags option[value=RE], select.flags option[value=re], .country-RE {background-position:0 -4093px}
-select.flags option[value=RO], select.flags option[value=ro], .country-RO {background-position:0 -4115px}
-select.flags option[value=RS], select.flags option[value=rs], .country-RS {background-position:0 -4137px}
-select.flags option[value=RU], select.flags option[value=ru], .country-RU {background-position:0 -4159px}
-select.flags option[value=RW], select.flags option[value=rw], .country-RW {background-position:0 -4181px}
-select.flags option[value=SA], select.flags option[value=sa], .country-SA {background-position:0 -4203px}
-select.flags option[value=SB], select.flags option[value=sb], .country-SB {background-position:0 -4225px}
-select.flags option[value=SC], select.flags option[value=sc], .country-SC {background-position:0 -4247px}
-select.flags option[value=SD], select.flags option[value=sd], .country-SD {background-position:0 -4291px}
-select.flags option[value=SE], select.flags option[value=se], .country-SE {background-position:0 -4313px}
-select.flags option[value=SG], select.flags option[value=sg], .country-SG {background-position:0 -4335px}
-select.flags option[value=SH], select.flags option[value=sh], .country-SH {background-position:0 -4357px}
-select.flags option[value=SI], select.flags option[value=si], .country-SI {background-position:0 -4379px}
-select.flags option[value=SJ], select.flags option[value=sj], .country-SJ {background-position:0 -4401px}
-select.flags option[value=SK], select.flags option[value=sk], .country-SK {background-position:0 -4423px}
-select.flags option[value=SL], select.flags option[value=sl], .country-SL {background-position:0 -4445px}
-select.flags option[value=SM], select.flags option[value=sm], .country-SM {background-position:0 -4467px}
-select.flags option[value=SN], select.flags option[value=sn], .country-SN {background-position:0 -4489px}
-select.flags option[value=SO], select.flags option[value=so], .country-SO {background-position:0 -4511px}
-select.flags option[value=SR], select.flags option[value=sr], .country-SR {background-position:0 -4533px}
-select.flags option[value=ST], select.flags option[value=st], .country-ST {background-position:0 -4555px}
-select.flags option[value=SV], select.flags option[value=sv], .country-SV {background-position:0 -4577px}
-select.flags option[value=SY], select.flags option[value=sy], .country-SY {background-position:0 -4599px}
-select.flags option[value=SZ], select.flags option[value=sz], .country-SZ {background-position:0 -4621px}
-select.flags option[value=TC], select.flags option[value=tc], .country-TC {background-position:0 -4643px}
-select.flags option[value=TD], select.flags option[value=td], .country-TD {background-position:0 -4665px}
-select.flags option[value=TF], select.flags option[value=tf], .country-TF {background-position:0 -4687px}
-select.flags option[value=TG], select.flags option[value=tg], .country-TG {background-position:0 -4709px}
-select.flags option[value=TH], select.flags option[value=th], .country-TH {background-position:0 -4731px}
-select.flags option[value=TJ], select.flags option[value=tj], .country-TJ {background-position:0 -4753px}
-select.flags option[value=TK], select.flags option[value=tk], .country-TK {background-position:0 -4775px}
-select.flags option[value=TL], select.flags option[value=tl], .country-TL {background-position:0 -4797px}
-select.flags option[value=TM], select.flags option[value=tm], .country-TM {background-position:0 -4819px}
-select.flags option[value=TN], select.flags option[value=tn], .country-TN {background-position:0 -4841px}
-select.flags option[value=TO], select.flags option[value=to], .country-TO {background-position:0 -4863px}
-select.flags option[value=TR], select.flags option[value=tr], .country-TR {background-position:0 -4885px}
-select.flags option[value=TT], select.flags option[value=tt], .country-TT {background-position:0 -4907px}
-select.flags option[value=TV], select.flags option[value=tv], .country-TV {background-position:0 -4929px}
-select.flags option[value=TW], select.flags option[value=tw], .country-TW {background-position:0 -4951px}
-select.flags option[value=TZ], select.flags option[value=tz], .country-TZ {background-position:0 -4973px}
-select.flags option[value=UA], select.flags option[value=ua], .country-UA {background-position:0 -4995px}
-select.flags option[value=UG], select.flags option[value=ug], .country-UG {background-position:0 -5017px}
-select.flags option[value=UM], select.flags option[value=um], .country-UM {background-position:0 -5039px}
-select.flags option[value=US], select.flags option[value=us], .country-US {background-position:0 -5061px}
-select.flags option[value=UY], select.flags option[value=uy], .country-UY {background-position:0 -5083px}
-select.flags option[value=UZ], select.flags option[value=uz], .country-UZ {background-position:0 -5105px}
-select.flags option[value=VA], select.flags option[value=va], .country-VA {background-position:0 -5127px}
-select.flags option[value=VC], select.flags option[value=vc], .country-VC {background-position:0 -5149px}
-select.flags option[value=VE], select.flags option[value=ve], .country-VE {background-position:0 -5171px}
-select.flags option[value=VG], select.flags option[value=vg], .country-VG {background-position:0 -5193px}
-select.flags option[value=VI], select.flags option[value=vi], .country-VI {background-position:0 -5215px}
-select.flags option[value=VN], select.flags option[value=vn], .country-VN {background-position:0 -5237px}
-select.flags option[value=VU], select.flags option[value=vu], .country-VU {background-position:0 -5259px}
-select.flags option[value=WF], select.flags option[value=wf], .country-WF {background-position:0 -5303px}
-select.flags option[value=WS], select.flags option[value=ws], .country-WS {background-position:0 -5325px}
-select.flags option[value=YE], select.flags option[value=ye], .country-YE {background-position:0 -5347px}
-select.flags option[value=YT], select.flags option[value=yt], .country-YT {background-position:0 -5369px}
-select.flags option[value=ZA], select.flags option[value=za], .country-ZA {background-position:0 -5391px}
-select.flags option[value=ZM], select.flags option[value=zm], .country-ZM {background-position:0 -5413px}
-select.flags option[value=ZW], select.flags option[value=zw], .country-ZW {background-position:0 -5435px}
-
-.panel_login {
-    max-width: 80%;
-    min-width: 680px;
-}
-div.subsectiontoggle {
-    border:1px solid #ccc;
-    font-weight:bold;
-    font-size:14px;
-    padding-top:10px;
-    padding-bottom:0;
-    margin-top:5px;
-    text-indent:15px;
-    cursor:pointer;
-    margin-bottom:10px;
-    background-color:#f4f4f4;
-    -moz-border-radius:5px;
-    -webkit-border-radius:5px;
-    -khtml-border-radius:5px;
-    -o-border-radius:5px;
-    -ms-border-radius:5px;
-    border-radius:5px;
-}
-div.subsectiontoggle span {
-    display:inline-block;
-    margin-bottom:-3px;
-    margin-right:10px;
-    width:16px;
-    height:16px;
-    background: url("../icons/button_sprite.png") 0 -72px no-repeat transparent;
-}
-div.subsectiontoggle span.showing{
-    background-position: 0 -40px;
-}
-div.subsectiontoggle em {
-    display:block;
-    position:relative;
-    left:425px;
-    top:-13px;
-    margin-bottom:-3px;
-    width:13px;
-    height:13px;
-    background:url("../images/chevron.png") top left no-repeat;
-    -webkit-transform:none;
-    -moz-transform:none;
-    -khtml-transform:none;
-    -o-transform:none;
-    -ms-transform:none;
-    transform:none;
-    -webkit-transition-duration: .2s;
-    -moz-transition-duration: .2s;
-    -khtml-transition-duration: .2s;
-    -o-transition-duration: .2s;
-    -ms-transition-duration: .2s;
-    transition-duration: .2s;
-    -webkit-transition-property: -webkit-transform;
-    -moz-transition-property: -moz-transform;
-    -khtml-transition-property: -khtml-transform;
-    -o-transition-property: -o-transform;
-    -ms-transition-property: -ms-transform;
-    transition-property: transform;
-}
-div.subsectiontoggle em.showing {
-    display:block;
-    position:relative;
-    left:425px;
-    top:-13px;
-    background:url("../images/chevron.png") top left no-repeat;
-    width:13px;
-    height:13px;
-    -webkit-transform:rotate(90deg);
-    -moz-transform:rotate(90deg);
-    -khtml-transform:rotate(90deg);
-    -o-transform:rotate(90deg);
-    -ms-transform:rotate(90deg);
-    transform:rotate(90deg);
-}
-div.subsectiontoggle:hover em {
-    -webkit-transform:rotate(90deg);
-    -moz-transform:rotate(90deg);
-    -khtml-transform:rotate(90deg);
-    -o-transform:rotate(90deg);
-    -ms-transform:rotate(90deg);
-    transform:rotate(90deg);
-}
-
-
-div.gs-container {
-    margin-top:10px;
-}
-div.gs-container * {
-    margin: 0;
-    padding: 0;
-    background-position: 0 0;
-    text-decoration: none;
-    font-size: 1em;
-}
-div.gs-container input {
-    background: url("../icons/x16_sprite.png") no-repeat 2px -119px #FFFFFF;
-    height:20px;
-    border:1px solid #444;
-    padding:0 22px 2px;
-    color:#444;
-    -moz-border-radius:5px;
-    -webkit-border-radius:5px;
-    -khtml-border-radius:5px;
-    -o-border-radius:5px;
-    -ms-border-radius:5px;
-    border-radius:5px;
-}
-input.gs-loading {
-    background-image: url("../images/loading.gif");
-    background-repeat: no-repeat;
-    background-position: center right;
-}
-ul.gs-resultbox {
-    margin: 0 !important;
-    padding: 0 !important;
-    width: 300px;
-    z-index: 999999;
-    border: 1px solid #777;
-    font-size: 11px;
-    background: #fff;
-    -moz-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -webkit-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -khtml-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -o-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -ms-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    box-shadow: 2px 2px 5px 0 #c5c5c5;
-    list-style: none;
-    -moz-border-radius:5px;
-    -webkit-border-radius:5px;
-    -khtml-border-radius:5px;
-    -o-border-radius:5px;
-    -ms-border-radius:5px;
-    border-radius:5px;
-    max-height:500px;
-    overflow:auto;
-}
-ul.gs-resultbox li {
-    float: left;
-    width: 100%;
-    clear: both;
-    cursor: pointer;
-}
-ul.gs-resultbox li.gs-cheader {
-    height: 13px;
-    overflow: hidden;
-    padding: 5px 0;
-    color: #fff;
-    background: #6ea6d1;
-    cursor:default;
-    padding-bottom:10px;
-}
-ul.gs-resultbox li.gs-cheader p.gs-cheader-title {
-    margin: 0 !important;
-    padding: 0 0 0 10px !important;
-    float: left;
-    font-size: 12px;
-    font-weight: bold;
-}
-ul.gs-resultbox li.gs-cheader p.gs-cheader-limit {
-    margin: 0 !important;
-    padding: 0 10px 0 0 !important;
-    float: right;
-    font-size: 11px;
-    font-weight: normal;
-}
-ul.gs-resultbox li.gs-cdata {
-    margin: 0 !important;
-    padding: 0 !important;
-    border-bottom: 1px solid #c5c5c5;
-}
-ul.gs-resultbox li.gs-cdata:last-child {
-    border-bottom: none;
-}
-ul.gs-resultbox li.gs-cdata:hover {
-    background: #eaf4fd;
-}
-ul.gs-resultbox li.gs-cdata a {
-    display: block;
-    padding: 5px 10px;
-    text-decoration: none !important;
-    background: #fff;
-}
-ul.gs-resultbox li.gs-cdata a:hover {
-    background: #cde0ff;
-}
-ul.gs-resultbox li.gs-cdata img {
-    margin-right: 12px;
-}
-ul.gs-resultbox li.gs-cdata p {
-    margin: 0 !important;
-    padding: 0 !important;
-    color: #444;
-    font-size: 10px;
-    min-height:30px;
-}
-ul.gs-resultbox li.gs-cdata p span.gs-cdata-title {
-    display: inline !important;
-    margin: 0 !important;
-    padding: 0 !important;
-    font-size: 11px;
-    font-weight: bold;
-    color: #000;
-}
-ul.gs-resultbox li:first-child {
-    -moz-border-radius:5px 5px 0 0;
-    -webkit-border-radius:5px 5px 0 0;
-    -khtml-border-radius:5px 5px 0 0;
-    -o-border-radius:5px 5px 0 0;
-    -ms-border-radius:5px 5px 0 0;
-    border-radius:5px 5px 0 0;
-}
-ul.gs-resultbox li:last-child {
-    -moz-border-radius:0 0 5px 5px;
-    -webkit-border-radius:0 0 5px 5px;
-    -khtml-border-radius:0 0 5px 5px;
-    -o-border-radius:0 0 5px 5px;
-    -ms-border-radius:0 0 5px 5px;
-    border-radius:0 0 5px 5px;
-}
-
-div.df-container {
-}
-div.df-container * {
-    margin: 0;
-    padding: 0;
-    background-position: 0 0;
-    text-decoration: none;
-    font-size: 1em;
-}
-div.df-container input {
-}
-input.df-loading {
-    background-image: url("../images/loading.gif");
-    background-repeat: no-repeat;
-    background-position: center right;
-}
-ul.df-resultbox {
-    margin: 0 !important;
-    padding: 0 !important;
-    min-width: 250px;
-    max-width: 500px;
-    z-index: 999999;
-    border: 1px solid #777;
-    font-size: 11px;
-    background: #fff;
-    -moz-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -webkit-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -khtml-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -o-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    -ms-box-shadow: 2px 2px 5px 0 #c5c5c5;
-    box-shadow: 2px 2px 5px 0 #c5c5c5;
-    list-style: none;
-    -moz-border-radius:5px;
-    -webkit-border-radius:5px;
-    -khtml-border-radius:5px;
-    -o-border-radius:5px;
-    -ms-border-radius:5px;
-    border-radius:5px;
-}
-ul.df-resultbox li {
-    float: left;
-    width: 100%;
-    clear: both;
-    cursor: pointer;
-}
-ul.df-resultbox li.df-cheader {
-    height: 13px;
-    overflow: hidden;
-    padding: 5px 0;
-    color: #fff;
-    background: #6ea6d1;
-    cursor:default;
-    padding-bottom:10px;
-}
-ul.df-resultbox li.df-cheader p.df-cheader-title {
-    margin: 0 !important;
-    padding: 0 0 0 10px !important;
-    float: left;
-    font-size: 12px;
-    font-weight: bold;
-}
-ul.df-resultbox li.df-cheader p.df-cheader-limit {
-    margin: 0 !important;
-    padding: 0 10px 0 0 !important;
-    float: right;
-    font-size: 11px;
-    font-weight: normal;
-}
-ul.df-resultbox li.df-cdata {
-    margin: 0 !important;
-    padding: 0 !important;
-    border-bottom: 1px solid #c5c5c5;
-}
-ul.df-resultbox li.df-cdata:last-child {
-    border-bottom: none;
-}
-ul.df-resultbox li.df-cdata:hover {
-    background: #eaf4fd;
-}
-ul.df-resultbox li.df-cdata a {
-    display: block;
-    padding: 5px 10px;
-    text-decoration: none !important;
-    background: #fff;
-}
-ul.df-resultbox li.df-cdata a:hover {
-    background: #cde0ff;
-}
-ul.df-resultbox li.df-cdata img {
-    margin-right: 12px;
-}
-ul.df-resultbox li.df-cdata p {
-    margin: 0 !important;
-    padding: 0 !important;
-    color: #444;
-    font-size: 10px;
-    min-height:30px;
-}
-ul.df-resultbox li.df-cdata p span.df-cdata-title {
-    display: inline !important;
-    margin: 0 !important;
-    padding: 0 !important;
-    font-size: 11px;
-    font-weight: bold;
-    color: #000;
-}
-ul.df-resultbox li:first-child {
-    -moz-border-radius:5px 5px 0 0;
-    -webkit-border-radius:5px 5px 0 0;
-    -khtml-border-radius:5px 5px 0 0;
-    -o-border-radius:5px 5px 0 0;
-    -ms-border-radius:5px 5px 0 0;
-    border-radius:5px 5px 0 0;
-}
-ul.df-resultbox li:last-child {
-    -moz-border-radius:0 0 5px 5px;
-    -webkit-border-radius:0 0 5px 5px;
-    -khtml-border-radius:0 0 5px 5px;
-    -o-border-radius:0 0 5px 5px;
-    -ms-border-radius:0 0 5px 5px;
-    border-radius:0 0 5px 5px;
-}
-
-span.icons16-empty {
-    float:left;
-    display:block;
-    height:20px;
-    width:20px;
-    margin:0 7px 0 0;
-}
-
-.ttip {
-    width:16px;
-    height:16px;
-    cursor:pointer;
-    background: url("../icons/x16_sprite.png") no-repeat -2px -42px transparent;
-    float:right;
-    display:inline;
-    position:relative;
-    right:-2px;
-    top:-2px;
-}
-
-p.prefix {
-    float: left;
-    margin: 0;
-    text-align: right;
-}
-p.label {
-    float: left;
-    margin: 5px 15px 0 0;
-}
-p.value {
-    float:left;
-    margin: 0 0 0 2px;
-}
-
-/* content_ispc
--------------------------------------------------------------- */
-.tipsy {
-    font-size: 10px;
-    position: absolute;
-    padding: 5px;
-    z-index: 100000;
-}
-.tipsy-inner {
-    background-color: #000;
-    color: #FFF;
-    max-width: 350px;
-    padding: 5px 8px 4px 8px;
-    text-align: left;
-}
-
-/* Rounded corners */
-.tipsy-inner {
-    border-radius: 5px;
-    -moz-border-radius: 5px;
-    -webkit-border-radius: 5px;
-}
-
-/* Uncomment for shadow */
-/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
-
-.tipsy-arrow {
-    position: absolute;
-    width: 0;
-    height: 0;
-    line-height: 0;
-    border: 5px dashed #000;
-}
-/* Rules to colour arrows */
-.tipsy-arrow-n { border-bottom-color: #000; }
-.tipsy-arrow-s { border-top-color: #000; }
-.tipsy-arrow-e { border-left-color: #000; }
-.tipsy-arrow-w { border-right-color: #000; }
-
-.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
-.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
-.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none;  border-left-color: transparent; border-right-color: transparent;}
-.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none;  border-left-color: transparent; border-right-color: transparent; }
-.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none;  border-left-color: transparent; border-right-color: transparent; }
-.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
-.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
-.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
-
-/* uni-form-generic
--------------------------------------------------------------- */
-
-/* Uni-Form by Dragan Babic [Superawesome Industries]  - http: //sprawsm.com/uni-form/ */ 
-/* Some rights reserved - http: //creativecommons.org/licenses/by-sa/2.5/ */
-/* Do not edit this file directly, make your changes to uni-form.css in the same folder */
-
-.uniForm{ margin: 0; padding: 0; position: relative; z-index: 1; } /* reset stuff */
-
-/* Some generals and more resets */
-.uniForm fieldset{ border: none; margin: 0; padding: 0; }
-.uniForm fieldset legend{ margin: 0; padding: 0; }
-
-/* This is the main unit that contains our form elements */
-.uniForm .ctrlHolder,
-.uniForm .buttonHolder{ margin: 0; padding: 0; clear: both; }
-
-/* Clear all floats */ 
-.uniForm:after,
-.uniForm .buttonHolder:after, 
-.uniForm .ctrlHolder:after, 
-.uniForm .ctrlHolder .multiField:after,
-.uniForm .inlineLabel:after{ content: "."; display: block; height: 0; line-height: 0; font-size: 0; clear: both; min-height: 0; visibility: hidden; }
-
-/* A class to be used on a label that contains a checkbox or a radio button */
-.uniForm .inlineLabel,
-.uniForm .inlineLabels .inlineLabel,
-.uniForm .blockLabels .inlineLabel{ width: auto; float: none; margin: 0; display: block; }
-/* IE shows borders & padding on checkboxes and radio buttons if they are declared on an input element, remove them */
-/* Legacy/Inheritance fix */
-.uniForm .inlineLabel input,
-.uniForm .inlineLabels .inlineLabel input,
-.uniForm .blockLabels .inlineLabel input{ border: none; padding: 0; margin: 0; }
-
-/* Styles for form controls where labels are above the input elements */
-/* Set the class of the parent (preferably to a fieldset) to .blockLabels */
-
-.uniForm label,
-.uniForm .label,
-.uniForm .blockLabels label,
-.uniForm .blockLabels .label{ display: block; float: none; padding: 0; line-height: 100%; width: auto; }
-
-/* Float the input elements */
-.uniForm .textInput,
-.uniForm .blockLabels .textInput,
-.uniForm .blockLabels .fileUpload,
-.uniForm .selectInput,
-.uniForm .blockLabels .selectInput,
-.uniForm .blockLabels select,
-.uniForm textarea,
-.uniForm .blockLabels textarea{ float: left; }
-
-/* Postition the hints */
-.uniForm .formHint,
-.uniForm .blockLabels .formHint{ float: right; margin: 0; clear: none; }
-
-/* Position the elements inside combo boxes (multiple selects/checkboxes/radio buttons per unit) */
-.uniForm .multiField,
-.uniForm .blockLabels .multiField{ width: auto; float: left; }
-.uniForm .multiField .inlineLabel,
-.uniForm .blockLabels .multiField .inlineLabel{ display: block; margin: 0 0 .5em 0; }
-.uniForm .multiField .blockLabel,
-.uniForm .blockLabels .multiField .blockLabel{ float: left; width: auto; margin: 0; }
-.uniForm .multiField .blockLabel .textInput,
-.uniForm .multiField .blockLabel .selectInput,
-.uniForm .multiField .blockLabel select,
-.uniForm .blockLabels .multiField .blockLabel .textInput,
-.uniForm .blockLabels .multiField .blockLabel .selectInput,
-.uniForm .blockLabels .multiField .blockLabel select{ width: 100%; margin: 0; }
-
-/* Styles for form controls where labels are in line with the input elements */
-/* Set the class of the parent (preferably to a fieldset) to .inlineLabels */
-.uniForm .inlineLabels label,
-.uniForm .inlineLabels .label{ float: left; margin: 0; padding: 0; line-height: 100%; position: relative; }
-
-/* Float the input elements */
-.uniForm .inlineLabels .textInput,
-.uniForm .inlineLabels .fileUpload,        
-.uniForm .inlineLabels .selectInput,
-.uniForm .inlineLabels select,
-.uniForm .inlineLabels textarea{ float: left; }
-
-/* Postition the hints */
-.uniForm .inlineLabels .formHint{ clear: both; float: none; }
-.uniForm .inlineLabels .multiField{ float: left; }
-.uniForm .inlineLabels .multiField .inlineLabel{}
-.uniForm .inlineLabels .multiField .blockLabel{}
-.uniForm .inlineLabels .multiField .blockLabel .textInput,
-.uniForm .inlineLabels .multiField .blockLabel .selectInput,
-.uniForm .inlineLabels .multiField .blockLabel select{ display: block; width: 100%; float: none; }
-.uniForm .inlineLabels .multiField select{ float: left; }
-
-/* Required fields asterisk styling for .blockLabels */
-.uniForm label em,
-.uniForm .label em,
-.uniForm .blockLabels label em,
-.uniForm .blockLabels .label em{ position: absolute; left: -7px; }
-
-/* Required fields asterisk styling for .inlineLabels */
-.uniForm .inlineLabels label em,
-.uniForm .inlineLabels .label em{ display: block; position: absolute; left: auto; right: 0; font-style: normal; font-weight: bold; }
-.uniForm .inlineLabel em{ position: absolute; left: 7px; }
-
-/* Messages */
-.uniForm #errorMsg,
-.uniForm .error{}
-.uniForm #errorMsg dt,
-.uniForm #errorMsg h3{}
-.uniForm #errorMsg dd{}
-.uniForm #errorMsg ol{}
-.uniForm #errorMsg ol li{}
-.uniForm .errorField{}
-.uniForm #OKMsg{}
-
-/* Columns */
-
-.uniForm .col{ float: left; }
-.uniForm .col.first{}
-.uniForm .col.last{}
-
-/* uni-form
--------------------------------------------------------------- */
-
-/* Keep in mind that wherever you see "Required property" it means that the property must exist */
-
-/* ------------------------------------------------------------------------------ */
-
-/* Generals */
-.uniForm fieldset{}
-.uniForm fieldset legend{ color: #333; font-weight: bold; font-size: 100%; margin: 0; padding: 1.5em 1.5em 1.5em 0; }
-
-/* This is the main unit that contains our form elements */
-.uniForm .ctrlHolder{ padding: 3px; border-bottom: 1px dotted #dfdfdf; }
-
-.uniForm .buttonHolder{ 
-    text-align: left; 
-    background: #CEDEEF url("../images/buttonHolder_bg.gif") no-repeat right;
-    margin: 3em 0 1em;
-    padding: 8px;
-}
-.uniForm .resetButton{ float: left; }
-.uniForm .primaryAction{ font-weight: bold; }
-
-/* This class gets added to div.ctrlHolder to highlight the row */
-.uniForm .focused{ background: #fffcdf; }
-
-/* .inlineLabel is used for inputs within labels - checkboxes and radio buttons */
-.uniForm .inlineLabel input,
-.uniForm .inlineLabels .inlineLabel input,
-.uniForm .blockLabels .inlineLabel input{ float: left; margin: 0 .4em 0 0; }
-.uniForm .inlineLabel span{ float: left; width: 90%; }
-
-/* ------------------------------------------------------------------------------ */
-
-/* .blockLabels (default style, will be applied even if you don"t class the parent element) */
-.uniForm .blockLabels .ctrlHolder{}
-
-.uniForm label,
-.uniForm .blockLabels label,
-.uniForm .blockLabels .label{ margin: 0 0 .5em 0; }
-
-.uniForm .textInput,
-.uniForm .blockLabels .textInput,
-.uniForm .blockLabels .fileUpload{ width: 43%; /* <- Required property */ }
-
-.uniForm .selectInput,
-.uniForm select,
-.uniForm .blockLabels .selectInput,
-.uniForm .blockLabels select{ width: 43.5%; /* <- Required property */ }
-.uniForm textarea,
-.uniForm .blockLabels textarea{ width: 43%; /* <- Required property */ height: 12em; }
-
-.uniForm .formHint,
-.uniForm .blockLabels .formHint{ width: 55%; /* <- Required property */ font-size: .9em; color: #777; position: relative; top: -.5em; }
-
-.uniForm .multiField,
-.uniForm .blockLabels .multiField{ width: 43%; }
-.uniForm .multiField .inlineLabel,
-.uniForm .blockLabels .multiField .inlineLabel{ display: block; margin: 0 0 .5em 0; }
-.uniForm .multiField .blockLabel,
-.uniForm .blockLabels .multiField .blockLabel{ width: 30%; margin: 0 10px 0 0; }
-.uniForm .multiField .blockLabel .textInput,
-.uniForm .multiField .blockLabel .selectInput,
-.uniForm .multiField .blockLabel select,
-.uniForm .blockLabels .multiField .blockLabel .textInput,
-.uniForm .blockLabels .multiField .blockLabel .selectInput,
-.uniForm .blockLabels .multiField .blockLabel select{ width: 100%; margin: .3em 0 0 0; }
-
-/* ------------------------------------------------------------------------------ */
-
-/* .inlineLabels */
-.uniForm .inlineLabels .ctrlHolder{}
-
-.uniForm .inlineLabels label,
-.uniForm .inlineLabels .label{ width: 20%; /* <- Required property */ margin: .3em 2% 0 0; /* <- Required property */ }
-
-.uniForm .inlineLabels .textInput,
-.uniForm .inlineLabels .fileUpload{ width: 35%; /* <- Required property */ }
-
-.uniForm .inlineLabels .selectInput,
-.uniForm .inlineLabels select{ width: 35%; /* <- Required property */ }
-
-.uniForm .inlineLabels textarea{  width: 35%; /* <- Required property */ height: 12em; }
-
-.uniForm .inlineLabels .formHint{ margin-top: 0; margin-left: 22%; font-size: .9em; color: #777; position: static; }
-
-.uniForm .inlineLabels .multiField{ width: 60%; /* <- Required property */ margin: 0 0 .3em 0; }
-.uniForm .inlineLabels .multiField .inlineLabel{ display: block; margin: 0 0 .5em 0; }
-.uniForm .inlineLabels .multiField .blockLabel{ float: left; width: 26%; margin: 0 3% 0 0; }
-.uniForm .inlineLabels .multiField .blockLabel .textInput,
-.uniForm .inlineLabels .multiField .blockLabel .selectInput,
-.uniForm .inlineLabels .multiField .blockLabel select{ width: 100%; margin: .3em 0 0 0; }
-
-/* Focus pseudoclasses */
-.uniForm .ctrlHolder .textInput:focus{ outline: none; /* Get rid of the "glow" effect in WebKit, optional */ }
-.uniForm .ctrlHolder textarea:focus{ outline: none; /* Get rid of the "glow" effect in WebKit, optional */ }
-.uniForm div.focused .formHint{ color: #333; }
-
-/* Columns (they are floated left by default) */
-.uniForm .col{ width: 37.9%; /* <- Required property */ margin: 0 2% 20px 0; }
-/* Use .first and .last classes to control the layout/spacing of your columns */
-.uniForm .col.first{ width: 39%; /* <- Required property */ float: left; clear: none; }
-.uniForm .col.last{ width: 39%; /* <- Required property */ float: right; clear: none; margin-right: 0; }
-
-/* Messages */
-.uniForm #errorMsg, .confirmpassworderror{ background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px; }
-.uniForm .error{ background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; }
-
-.uniForm #errorMsg dt, .uniForm #errorMsg h3{ margin: 0 0 .5em 0; font-size: 100%; line-height: 100%; font-weight: bold; }
-.uniForm #errorMsg dd{ margin: 0; padding: 0; }
-.uniForm #errorMsg ol{ margin: 0; padding: 0; list-style:none;}
-.uniForm #errorMsg ol li{ margin: 0; padding: 2px; list-style-position: inside; border-bottom: 1px dotted #df7d7d; position: relative; }
-.uniForm .errorField{ color: #af4c4c; margin: 0 0 6px 0; padding: 4px; background: #ffbfbf; }
-
-.uniForm #OKMsg, .confirmpasswordok{ background: #C8FFBF; border: 1px solid #A2EF95; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px; }
-.uniForm #OKMsg p{ margin: 0; }
-
-/* ------------------------------------------------------------------------------ */
-
-/* This is the main unit that contains our form elements */
-
-.uniForm .textInput, .uniForm .selectInput, .uniForm textarea {
-    background:#FFFFFF none repeat scroll 0 0;
-    color: #000000;
-    border: 1px solid #DFDFDF;
-    padding: 1px;
-}
-
-/* jquery-ui-custom
--------------------------------------------------------------- */
-.ui-datepicker-calendar thead tr th {
-    background-image:none;
-    background-color:#FFFFFF;
-    color:#000000;
-}
-.ui-widget { font-family: "Trebuchet MS", Arial, sans-serif; font-size: 100%; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: "Trebuchet MS", Arial, sans-serif; font-size: 100%; }
-ul.ui-autocomplete { max-height: 250px; overflow-y: auto; min-width: 85px;}
-.ui-combobox { position: relative; display: inline-block; margin-right: 17px; }
-.ui-combobox-toggle { position: absolute !important; top: 0; bottom: 0; margin-left: -1px; padding: 1px !important; background: none repeat scroll 0 0 #FFFFFF !important; border: 1px solid #DFDFDF !important;}
-.ui-combobox-input { background: none repeat scroll 0 0 #FFFFFF !important; border: 1px solid #DFDFDF !important; padding: 1px; font-weight: normal !important; }
-.panel_install_package .ui-combobox { float: left; }
-.clear-float { clear: both; }
-
-a.link-page, span.page-spacer {
-    display: inline-block;
-    text-align: center;
-    padding: 2px;
-    line-height: 16px;
-    text-decoration: none !important;
-    color: inherit !important;
-    min-width: 16px;
-}
-a.link-page {
-    border: 1px solid #FFFFFF;
-    margin: 0 5px;
-}
-
-a.link-page:hover {
-    background-color: #DFDFDF;
-}
-
-span.page-spacer {
-    margin: 0 -5px;
-}
-
-a.link-page.current-page {
-    background-color: #DFDFDF;
-    font-weight: bold;
+@charset "UTF-8";
+/* 
+    Document   : styles.css
+    Created on : 06.07.2012, 12:21:59
+    Author     : Christian Foellmann (foe-services.de)
+    Description:
+        Basis was css-code from the "ISPConfig 3: default theme" which was based on
+        "Yet Another Multicolumn Layout" - (X)HTML/CSS Framework 3.0.6
+        by Copyright 2005-2008, Dirk Jesse (http://www.yaml.de)
+*/
+
+/* overall
+-------------------------------------------------------------- */
+* {
+    margin: 0;
+    padding: 0;
+}
+html * { font-size: 100.01% }
+body {
+    font-family: "Trebuchet MS", sans-serif;
+    font-size: 75.00%; 
+    color: #444;
+    background: url("../images/screen_bg.png") repeat-x top left fixed #EEEEEE;
+    padding: 10px 0;
+}
+ul, ol, dl { line-height: 1.5em; margin: 0 0 1em 1em }
+li { margin-left: 1.5em; line-height: 1.5em }
+dt { font-weight: bold }
+dd { margin: 0 0 1em 2em }
+a {
+    color: #4D87C7;
+    text-decoration:none;
+}
+a:focus,
+a:hover,
+a:active {
+    color:#182E7A;
+    text-decoration:underline;
+}
+hr {
+    color: #fff;
+    background:transparent;
+    margin: 0 0 0.5em 0;
+    padding: 0 0 0.5em 0;
+    border:0;
+    border-bottom: 1px #eee solid;
+}
+textarea, pre, tt, code {
+    font-family: Consolas,"Lucida Console","Courier New",monospace;
+    font-size: 0.9em;	
+}
+
+h1,h2,h3,h4,h5,h6 { 
+    font-family: "Trebuchet MS", sans-serif;
+    font-weight:bold; 
+    color:#666;
+    margin: 0 0 0.25em 0; 
+}
+h1 { font-size: 200% }                        /* 24px */
+h2 { font-size: 200% }                        /* 24px */
+h3 { font-size: 150% }                        /* 18px */
+h4 { font-size: 133.33% }                     /* 16px */
+h5 { font-size: 116.67% }                     /* 14px */
+h6 { font-size: 116.67%; font-style:italic }  /* 14px */
+
+p { line-height: 1.5em; margin: 0 0 1em 0; }
+
+cite, blockquote { font-style:italic }
+blockquote { margin: 0 0 1em 1.5em }
+
+strong,b { font-weight: bold }
+em,i { font-style:italic }
+
+pre, code { font-family: monospace; font-size: 1.1em; }
+
+acronym, abbr {
+    letter-spacing: .07em;
+    border-bottom: .1em dashed #c00;
+    cursor: help;
+}
+
+header, #nav, #main, footer {
+    clear: both;
+}
+#page {
+    min-width: 980px;
+    max-width: 80%;
+    background: #fff;
+    text-align:left;
+    margin: 0 auto;
+    padding: 10px;
+}
+.skip, .hideme, .print {
+    height: 1px;
+    left: -1000em;
+    position: absolute;
+    top: -1000em;
+    width: 1px;
+}
+
+/* header
+-------------------------------------------------------------- */
+header {
+    position: relative;
+    color: #faf0e6;
+    padding: 15px 2em 5px 20px;
+    background: url("../images/header_bg.png") repeat-x top left #9a9a9a;
+}
+header h1 {
+    font-size:2.5em;
+    letter-spacing:-2px;
+    line-height:65%;
+    color: silver;
+}
+header span {
+    color: #333333;
+}
+
+/* header/topsubnav
+-------------------------------------------------------------- */
+#topsubnav {
+    position:absolute;
+    top: 10px;
+    right: 10px;
+    text-align: right;
+}
+#topsubnav a { 
+    color: #f0f8ff;
+    font-weight: normal;
+    background:transparent;
+    text-decoration:none;
+}
+#topsubnav a:focus, 
+#topsubnav a:hover,
+#topsubnav a:active {
+    text-decoration:underline;
+    background-color: transparent;
+}
+
+/* nav
+-------------------------------------------------------------- */
+#topNav ul {
+    list-style: none;
+    padding: 0 0 0 20px;
+    margin: 0;
+    background: #9a9a9a
+}
+
+#topNav ul li {
+    display: inline;
+    margin: 0 2px 0 0;
+}
+
+#topNav a {
+    background: url("../icons/x32_sprite.png") no-repeat #D3D3D3;
+    border-top-left-radius:5px;
+    border-top-right-radius:5px;
+    color:black;
+    display:inline-block;
+    height:20px;
+    padding-top:37px;
+    text-align:center;
+    text-decoration:none;
+    min-width:78px;
+}
+
+#topNav a:hover {
+    background-color: #eeeeee;
+    color: #000000;
+}
+
+#topNav #topNav_current a {
+    font-weight: bold;
+    color: black;
+    background-color: #ffffff;
+}
+.topnav-tools { background-position: 22px -10px !important; }
+.topnav-admin { background-position: 22px -74px !important; }
+.topnav-sites { background-position: 22px -523px !important; }
+.topnav-monitor { background-position: 22px -585px !important; }
+.topnav- { background-position: 22px -650px !important; }
+.topnav-help { background-position: 22px -715px !important; }
+.topnav-mail { background-position: 22px -780px !important; }
+.topnav-mailuser { background-position: 22px -780px !important; }
+.topnav-vm { background-position: 22px -842px !important; }
+.topnav-domain { background-position: 22px -905px !important; }
+.topnav-dns { background-position: 22px -970px !important; }
+.topnav-dashboard { background-position: 22px -1035px !important; }
+.topnav-client { background-position: 22px -1098px !important; }
+.topnav-billing { background-position: 22px -1162px !important; }
+#topNav a span {
+            padding: 0 3px;
+        }
+/* main
+-------------------------------------------------------------- */
+#main { 
+    background: #fff;
+    padding: 1em 0;
+}
+
+/* main/sideNav + submenu
+-------------------------------------------------------------- */
+#sideNav { 
+    width: 200px; 
+    float:left;
+    padding: 0 10px 0 0; 
+}
+
+#submenu {
+    width: 100%;
+    overflow: hidden;
+    margin: 0px;
+    list-style-type: none;
+    border-bottom: 2px #ddd solid;
+}
+
+#submenu ul {
+    list-style-type: none;
+    margin:0;
+    padding: 0;
+}
+#submenu li {
+    float:left;
+    width: 100%;
+    margin:0;
+    padding: 0;
+    font-size:0.9em;
+}
+
+#submenu a,
+#submenu strong {
+    display:block;
+    width: 90%;
+    padding: 2px 0px 2px 10%;
+    text-decoration: none;
+    background-color:#fff;
+    color: #444;
+    border-bottom: 1px #eee solid;
+}
+
+/* Menu Title */
+#submenu li.title {
+    width: 100%;
+    padding: 0px;
+    font-weight: bold;
+    color: #444;
+    background-color: #fff;
+    border-top: 2px #888 solid;
+    font-size: 1.1em;
+}
+
+#submenu li.title a {
+    background-color: #f0f8ff;
+    color: #444;
+}
+#submenu li.title a:hover {
+    color: white;
+}
+
+#submenu li span {
+    display:block;
+    width: 90%;
+    padding: 3px 0px 3px 10%;
+    font-weight: bold;
+    border-bottom: 1px #ddd solid;
+}
+
+/* Level 1 */
+#submenu li.active,
+#submenu li strong {
+    width: 90%;
+    padding: 3px 0px 3px 10%;
+    font-weight: bold;
+    color: #fff;
+    background-color:#aab;
+    border-bottom: 1px #eee solid;
+}
+
+#submenu li a {
+    width: 90%;
+    padding-left: 10%;
+    background-color:#fff;
+    color: #444;
+}
+#submenu li a:focus,
+#submenu li a:hover,
+#submenu li a:active {
+    background-color:#f63;
+    color: #fff;
+}
+
+/* Form-Elements in the Menu*/
+#submenu * select#server_id {
+    margin: 3px 10%;
+    padding: 1px;
+    width: 80%;
+}
+
+/* main/content
+-------------------------------------------------------------- */
+#content { 
+    margin-left: 200px; 
+    margin-right: 0;
+    padding: 0px 10px 10px 20px;
+    border-left: 1px #ddd solid;
+}
+
+/* footer
+-------------------------------------------------------------- */
+
+footer { 
+    color:#666; 
+    background: #f9f9f9;
+    padding: 10px 20px;
+    border-top: 5px #efefef solid;
+    font-size: 0.8em;
+    text-align: center;
+}
+footer a {
+    color: #999;
+    background:transparent;
+    font-weight: bold;
+}
+footer a:hover, footer a:active {
+    color: #4D87C7; 
+    background-color: transparent; 
+    text-decoration:underline;
+}
+
+/* Set a background-color, no system backgorund used anymore */
+select, input, textarea {
+    background: #FFFFFF;
+    border: 1px solid #DFDFDF;
+    padding: 1px;
+    outline:none;
+}
+
+table { width: auto; border-collapse:collapse; margin-bottom: 0.5em; }
+table.full { width: 100%; }
+table.fixed { table-layout:fixed }
+
+table.list td {
+    max-width: 350px;
+    min-width: 32px;
+    white-space: nowrap;
+    overflow:hidden;
+    text-overflow: ellipsis;
+    -o-text-overflow: ellipsis;
+    -icab-text-overflow: ellipsis;
+    -khtml-text-overflow: ellipsis;
+    -moz-text-overflow: ellipsis;
+    -webkit-text-overflow: ellipsis;
+}
+th,
+td {
+    padding: 0.5em;
+    text-align:left;
+}
+thead th {
+    background: #444 url("../images/lists_thead_bg.png") repeat-x;
+    color: #fff;
+}
+tbody th {
+    background: #ccc;
+    color: #333;
+}
+tbody th.sub {
+    background: #ddd;
+    color: #333;
+}
+table.list th[class$="_pid"],
+table.list td[class$="_pid"],
+table.list th[class$="_active"],
+table.list td[class$="_active"],
+table.list th.tbl_col_autoresponder,
+table.list td.tbl_col_autoresponder {
+    width: 70px;
+    text-align: center;
+}
+table.list .tbl_col_buttons,
+table.list .tbl_col_limit {
+    width: 150px;
+}
+.tbl_col_client_pid input {
+    width: 50px;
+}
+.pnl_listarea th[class^="tbl_col"] { cursor:pointer; }
+.pnl_listarea th[class^="tbl_col"]:hover { background-position:0 -15px!important; }
+.pnl_listarea th.tbl_col_nosort { cursor:default; }
+.pnl_listarea th.tbl_col_nosort:hover { background-position:0 0!important; }
+
+.pageForm_description { font-size: 12px; }
+
+/* Tab-Box */
+.tabbox_tabs { border-bottom: 1px solid #d3d3d3; }
+.tabbox_tabs ul {
+    list-style: none;
+    padding: 0;
+    margin: 0;
+}
+.tabbox_tabs li {
+    display: inline;
+    margin: 0 2px 0 0;
+}
+.tabbox_tabs a {
+    padding: 0 1em;
+    text-decoration: none;
+    color: black;
+    background: #d3d3d3;
+    border: 1px solid #d3d3d3;
+}
+.tabbox_tabs a:hover {
+    background: #fc0;
+    color: #540;
+}
+.tabbox_tabs .active a {
+    font-weight: bold;
+    color: #ff6600;
+    background: #ffffff;
+}
+.pnl_toolsarea fieldset, .pnl_listarea fieldset, .pnl_formsarea fieldset {
+    border-top: 1px solid #949494;
+    margin: 20px 0;
+}
+.pnl_toolsarea fieldset legend , .pnl_listarea fieldset legend {
+    font-weight: bold;
+    color: #6299c5;
+}
+.pnl_formarea fieldset {
+    font-weight: bold;
+}
+/* hide line and legend when inside tabbed content */
+#tabbox_content * .pnl_toolsarea fieldset, #tabbox_content * .pnl_listarea fieldset, #tabbox_content * .pnl_formsarea fieldset { border: none !important; }
+#tabbox_content * .pnl_toolsarea fieldset legend, #tabbox_content * .pnl_listarea fieldset legend, #tabbox_content * .pnl_formsarea fieldset legend { display: none !important; }
+.codeview {
+    margin:20px 0;
+    padding:2px;
+    border: 1px solid #ffcc00;
+    background: #fffaea;
+    font-family: Consolas, "Lucida Console", "Courier New", monospace;
+    font-size: 0.9em;
+}
+/* Lists */
+table.list {
+    width: 100%;
+    border: 1px solid #d3d3d3 !important;
+}
+table.list thead th { font-size: 10px; }
+table.list tbody { border: 1px solid #d3d3d3 !important; }
+table.list tfoot td { text-align: center;  background: #f8f8f8 url("../images/lists_tfoot_bg.png") repeat-x bottom left;  padding: 24px 8px 8px 8px; }
+table.list .tbl_paging img { vertical-align: top; }
+table.list .tbl_row_even { background: #fcfcfc; }
+table.list .tbl_row_uneven { background: #f0f8ff; }
+table.list tr:hover { background: #fffacd; }
+table.list td { word-wrap:break-word;white-space:pre-wrap; }
+table.list td.tbl_col_buttons { word-wrap:normal;white-space:normal;overflow:visible; }
+
+/* Password Strength */
+#passBar {
+    width: 101px; height: 10px;
+    background: url("../images/meter_bg.gif") repeat-x bottom left;
+    margin: 2px 0;
+    float: left;
+}
+#passText {
+    padding: 0;
+    float: left;
+}
+
+/* Systemmonitor */
+.systemmonitor-server,
+.systemmonitor-ve,
+.systemmonitor-state {
+    margin: 10px 5px;
+    font-family: Consolas, "Lucida Console", "Courier New", monospace;
+    font-size: 0.9em;
+    float: left;
+    width: 100%;
+}
+.systemmonitor-server:hover,
+.systemmonitor-vm:hover { background-color: #FFFACD; }
+.state-no_state,
+.state-no_state-ve {
+    border-top: 4px solid #95A19F;
+    background-color: #f8f8ff;
+}
+.state-unknown,
+.state-unknown-ve {
+    border-top: 4px solid #30302e;
+    background-color: #cecfc5;
+}
+.state-ok,
+.state-ok-ve {
+    border-top: 4px solid #23fb00;
+    background-color: #adffa2;
+}
+.state-info,
+.state-info-ve {
+    border-top: 4px solid #183e99;
+    background-color: #d4e2ff;
+}
+.state-warning,
+.state-warning-ve {
+    border-top: 4px solid #ffa800;
+    background-color: #ffda93;
+}
+.state-critical,
+.state-critical-ve {
+    border-top: 4px solid #ff0000;
+    background-color: #ffb9b9;
+}
+.state-error,
+.state-error-ve {
+    border-top: 4px solid #ff0000;
+    background-color: #ff7f7f;
+}       
+div.icoDevice {
+    float: left;
+    width: 64px;
+    height: 64px;
+    margin: 5px;
+    background: url("../icons/device_sprite.png") no-repeat transparent;
+}
+.systemmonitor-server div.icoDevice { background-position: 0 0; }
+.systemmonitor-ve div.icoDevice { background-position: -64px 0; }
+.systemmonitor-network div.icoDevice { background-position: -128px 0; }
+div.statusDevice,
+div.statusMsg { float: left; }
+div.statusMsg p { 
+    float: left;
+    padding: 5px;
+}
+.systemmonitor-state .status {
+    margin: 5px;
+}
+.status {
+    float: right;
+    width: 32px;
+    height: 32px;
+    background: url("../icons/x32_sprite.png") no-repeat transparent;
+}
+div.status {
+    float: left !important;
+}
+.state-warning .status,
+.state-warning-ve .status { background-position: 0 -143px; }
+.state-no_state .status,
+.state-no_state-ve .status,
+.state-unknown .status,
+.state-unknown-ve .status { background-position: 0 -207px; }
+.state-ok .status,
+.state-ok-ve .status { background-position: 0 -270px; }
+.state-info .status,
+.state-info-ve .status { background-position: 0 -336px; }
+.state-error .status,
+.state-error-ve .status { background-position: 0 -400px; }
+.state-critical .status,
+.state-critical-ve .status { background-position: 0 -463px; }
+
+/* Usage unknown  
+.systemmonitor-content table {
+    border: none;
+    margin-top: 10px;
+}
+
+.systemmonitor-content * .online {
+    border: 1px solid #ffffff;
+    background-color: #E3FFB8;
+    color: #000000;
+    padding:0px 5px;
+}
+.systemmonitor-content * .offline {
+    border: 1px solid #ffffff;
+    background-color: #d12f19; 
+    color:#ffffff;
+    padding:0px 5px;
+}*/
+
+/* Dashboard */
+.dashboard-modules {
+    float:left;
+    width:60px;
+    height: 60px;
+    border:1px dotted #888888;
+    border-radius:5px;
+    background-color: #cccccc;
+    margin:10px;
+    background-position: center 5px;
+    background-repeat: no-repeat;
+    text-align: center;
+}
+.dashboard-modules a, 
+.dashboard-modules a:hover {
+    background: url("../icons/x32_sprite.png") no-repeat transparent;
+    color:Black;
+    display:block;
+    font-weight:bold;
+    height:30px;
+    padding-top:42px;
+    width:60px;
+    text-decoration: none;
+}
+.dashboard-modules.tools a { background-position: 12px -9px; }
+.dashboard-modules.admin a { background-position: 12px -73px; }
+.dashboard-modules.sites a { background-position: 12px -520px; }
+.dashboard-modules.monitor a { background-position: 13px -585px; }
+.dashboard-modules.help a { background-position: 13px -716px; }
+.dashboard-modules.mail a { background-position: 12px -776px; }
+.dashboard-modules.vm a { background-position: 14px -842px; }
+.dashboard-modules.domain a { background-position: 12px -905px; }
+.dashboard-modules.dns a { background-position: 12px -970px; }
+.dashboard-modules.client a { background-position: 13px -1096px; }
+.dashboard-modules.billing a { background-position: 14px -1162px; }
+
+.panel_dashboard h2 { font-size:20px; }
+
+/* Image-Replacement */
+.swap { background-repeat:no-repeat; }
+.swap span { display:none; height:16px; } 
+#ir-HeaderLogo {
+    background-image: url("../images/header_logo.png");
+    height:32px;
+    margin:0 0 0.2em;
+} 
+div#ir-Yes,
+div#ir-No {
+    text-align: center;
+    background: url("../icons/x16_sprite.png") no-repeat transparent;
+}
+#ir-Yes {
+    background-position: center -342px !important;
+    height: 16px;
+}
+#ir-No {
+    background-position: center -362px !important;
+    height: 16px;
+}
+.swap {
+    background-repeat: no-repeat;
+}
+.swap span {
+    display: none;
+    height: 16px;
+}
+/* BUTTONS */
+a.button,
+.button,
+.buttons button {
+    display: inline-block;
+    margin: 0 2px;
+    padding: 2px 5px;
+    color: #525252;
+    text-shadow: 0px 1px 1px #fff;
+    border: 1px solid #c6c6c6;
+    border-radius: 4px;
+    background-color: #f7f7f7;
+    box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
+    -o-box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
+    -webkit-box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
+    -moz-box-shadow: 0 1px 1px 0 rgba(140, 140, 140, 0.3);
+    text-decoration: none;
+}
+a.button:focus,
+input.button:focus,
+.buttons button:focus {
+    border-color: #4fadd5;
+    box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
+    -moz-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
+    -webkit-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
+    -o-box-shadow: 0 0 2px 1px rgba(71,135,177, 0.6);
+    outline: none;
+}
+.buttons button[type]{
+    padding:5px 10px 5px 7px; /* Firefox */
+    line-height:17px; /* Safari */
+    white-space: nowrap;
+}
+*:first-child+html button[type]{
+    padding:4px 10px 3px 7px; /* IE7 */
+}
+.buttons button img,
+.buttons a img {
+    margin:0 3px -3px 0 !important;
+    padding:0;
+    border:none;
+    width:16px;
+    height:16px;
+}
+.topbuttons {
+    margin-bottom: 10px;
+}
+/* BUTTONS STANDARD */
+button:hover,
+.buttons a:hover {
+    background-color:#dff4ff;
+    border:1px solid #c2e1ef;
+    color:#336699;
+}
+.buttons a:active {
+    background-color:#6299c5;
+    border:1px solid #6299c5;
+    color:#fff;
+}
+
+/* BUTTONS POSITIVE */
+button.positive,
+.buttons a.positive { color:#529214; }
+.buttons a.positive:hover,
+button.positive:hover {
+    background-color:#E6EFC2;
+    border:1px solid #C6D880;
+    color:#529214;
+}
+.buttons a.positive:active {
+    background-color:#529214;
+    border:1px solid #529214;
+    color:#fff;
+}
+
+/* BUTTONS NEGATIVE */
+.buttons a.negative,
+button.negative {
+    color:#d12f19;
+}
+.buttons a.negative:hover,
+button.negative:hover {
+    background-color:#fbe3e4;
+    border:1px solid #fbc2c4;
+    color:#d12f19;
+}
+.buttons a.negative:active {
+    background-color:#d12f19;
+    border:1px solid #d12f19;
+    color:#fff;
+}
+
+/* Button with icon and text */
+.iconstxt { background: url("../icons/button_sprite.png") no-repeat transparent; }
+.iconstxt span { padding-left: 20px; font-weight: bold; }
+.iconstxt.icoPositive { background-position: 6px -130px; }
+.iconstxt.icoNegative { background-position: 6px -98px; }
+.iconstxt.icoAdd { background-position: 6px -66px; }
+.iconstxt.icoKey { background-position: 6px -1px; }
+.iconstxt.icoDelete { background-position: 6px -34px; }
+.iconstxt.icoDownload { background-position: 6px -1px; }
+.iconstxt.icoRestore { background-position: 6px -1px; }
+
+/* Button with icon and without text */
+.icons16 { position: relative; }
+.icons16>span {
+    opacity: 0;
+    visibility: hidden;
+    -webkit-transition: opacity 1s linear;
+    -moz-transition: opacity 1s linear;
+    -o-transition: opacity 1s linear;
+    -ms-transition: opacity 1s linear;
+    transition: opacity 1s linear;
+    position: absolute;
+    right: 23px;
+    top: -1px;
+    padding: 1px 2px;
+    border: 1px solid rgb(155,155,11);
+    background: rgb(255,255,111);
+    white-space: nowrap;
+}
+.icons16:hover>span {
+    opacity: 1.0;
+    visibility: visible;
+}
+a.icons16 {
+    height: 18px;
+    width: 18px;
+    padding: 0;
+    background: url("../icons/x16_sprite.png") no-repeat transparent;
+}
+button.icons16 {
+    height: 20px;
+    width: 20px;
+    padding: 0;
+    background: url("../icons/x16_sprite.png") no-repeat transparent;
+}
+.icons16.icoEdit { background-position: -1px -1px; }
+.icons16.icoLoginAs { background-position: -1px -21px; }
+.icons16.icoPDF { background-position: -1px -61px; }
+.icons16.icoDelete { background-position: -1px -81px; }
+.icons16.icoWebmailer { background-position: -1px -101px; }
+.icons16.icoFilter { background-position: -1px -161px; }
+.icons16.icoDbAdmin { background-position: -1px -221px; }
+.icons16.icoAction { background-position: -1px -241px; }
+.icons16.icoLink { background-position: -1px -422px; float: right; }
+
+div.group-icon {
+    float: left;
+    padding: 2px 0;
+}
+.group-admin,
+.group-user {
+    height: 20px;
+    width: 20px;
+    padding: 0;
+    float: left;
+    background: url("../icons/x16_sprite.png") no-repeat transparent;
+}
+.group-admin { background-position: 0 -380px; }
+.group-user { background-position: 0 -400px; }
+
+span.marked { color: #cc0000; }
+span.small { font-size: 0.9em; }
+
+#ajaxloader {
+    position: absolute;
+    width: 325px;
+    height: 150px;
+    background: #ffffff url('../images/ajax-loader.gif') no-repeat center center;
+    border: solid 2px #e1e1e1;
+    border-radius: 10px;
+    /*background: rgba(255, 255, 255, 0.85);*/
+    padding: 20px;
+    text-align:center;
+    z-index: 100;
+}
+.blockLabel.email_at {
+    width: 20px !important;
+    margin: 1.6em 0.3em 0 0 !important;
+}
+.textDisplay { display: block; }
+
+/* Form Length Classes */
+.textInput.formLengthBool { width: 25px !important; }
+.selectInput.formLengthBool { width: 60px !important; }
+.textInput.formLengthLimit { width: 50px !important; }
+.selectInput.formLengthLimit { width: 85px !important; }
+.formLengthDate { width: 75px !important; }
+.formLengthIPv4 { width: 125px !important; }
+.formLengthIPv6 { }
+.formLengthEmailUser { width: 30% !important; }
+.formLengthEmailDomain { width: 30% !important; }
+.formLengthHalf { width: 15% !important; }
+.formLengthDouble { width: 50% !important; }
+
+/* Individual Form Lengths */
+.textInput#username, 
+.textInput#password,
+.textInput#passwort,
+.textInput#source_password { width: 100px; }
+.selectInput#language {	width: 75px; }
+.selectInput#client_group_id, .selectInput#default_group { width: 125px; }
+input#refresh, input#retry, input#expire, input#minimum, input#ttl { width: 50px !important; }
+
+/* --- */
+
+a[href $="#logout"] {
+    padding-right: 20px;
+    background: url("../icons/x16_sprite.png") no-repeat right -143px transparent !important;
+}
+
+/* Select Menu with Images */
+select.withicons option {
+    background-repeat:no-repeat;
+    background-position: 1px;
+    padding-left:24px;
+}	
+div[class^=country-] {
+    background-image: url("../icons/flags_sprite.png");
+    background-repeat: no-repeat;
+    height: 20px;
+    width: 26px;
+}
+li[class^=country-] {
+    background-image: url("../icons/flags_sprite.png");
+    background-repeat: no-repeat;
+    text-indent: 24px;
+}
+li[class^=country-] a.ui-state-hover { background: transparent; }
+div[class^=country-] span {
+    display: none;
+}
+select.flags option {
+    background-image: url("../icons/flags_sprite.png");
+    background-repeat: no-repeat;
+    padding: 1px 0 1px 30px;
+}
+select.flags option[value=EL] {background-position:0 -1475px}
+select.flags option[value=AD], select.flags option[value=ad], .country-AD {background-position:0 -1px}
+select.flags option[value=AE], select.flags option[value=ae], .country-AE {background-position:0 -23px}
+select.flags option[value=AF], select.flags option[value=af], .country-AF {background-position:0 -45px}
+select.flags option[value=AG], select.flags option[value=ag], .country-AG {background-position:0 -67px}
+select.flags option[value=AI], select.flags option[value=ai], .country-AI {background-position:0 -89px}
+select.flags option[value=AL], select.flags option[value=al], .country-AL {background-position:0 -111px}
+select.flags option[value=AM], select.flags option[value=am], .country-AM {background-position:0 -133px}
+select.flags option[value=AN], select.flags option[value=an], .country-AN {background-position:0 -155px}
+select.flags option[value=AO], select.flags option[value=ao], .country-AO {background-position:0 -177px}
+select.flags option[value=AQ], select.flags option[value=aq], .country-AQ {background-position:0 -199px}
+select.flags option[value=AR], select.flags option[value=ar], .country-AR {background-position:0 -221px}
+select.flags option[value=AS], select.flags option[value=as], .country-AS {background-position:0 -243px}
+select.flags option[value=AT], select.flags option[value=at], .country-AT {background-position:0 -265px}
+select.flags option[value=AU], select.flags option[value=au], .country-AU {background-position:0 -287px}
+select.flags option[value=AW], select.flags option[value=aw], .country-AW {background-position:0 -309px}
+select.flags option[value=AX], select.flags option[value=ax], .country-AX {background-position:0 -331px}
+select.flags option[value=AZ], select.flags option[value=az], .country-AZ {background-position:0 -353px}
+select.flags option[value=BA], select.flags option[value=ba], .country-BA {background-position:0 -375px}
+select.flags option[value=BB], select.flags option[value=bb], .country-BB {background-position:0 -397px}
+select.flags option[value=BD], select.flags option[value=bd], .country-BD {background-position:0 -419px}
+select.flags option[value=BE], select.flags option[value=be], .country-BE {background-position:0 -441px}
+select.flags option[value=BF], select.flags option[value=bf], .country-BF {background-position:0 -463px}
+select.flags option[value=BG], select.flags option[value=bg], .country-BG {background-position:0 -485px}
+select.flags option[value=BH], select.flags option[value=bh], .country-BH {background-position:0 -507px}
+select.flags option[value=BI], select.flags option[value=bi], .country-BI {background-position:0 -529px}
+select.flags option[value=BJ], select.flags option[value=bj], .country-BJ {background-position:0 -551px}
+select.flags option[value=BM], select.flags option[value=bm], .country-BM {background-position:0 -573px}
+select.flags option[value=BN], select.flags option[value=bn], .country-BN {background-position:0 -595px}
+select.flags option[value=BO], select.flags option[value=bo], .country-BO {background-position:0 -617px}
+select.flags option[value=BR], select.flags option[value=br], .country-BR {background-position:0 -639px}
+select.flags option[value=BS], select.flags option[value=bs], .country-BS {background-position:0 -661px}
+select.flags option[value=BT], select.flags option[value=bt], .country-BT {background-position:0 -683px}
+select.flags option[value=BV], select.flags option[value=bv], .country-BV {background-position:0 -705px}
+select.flags option[value=BW], select.flags option[value=bw], .country-BW {background-position:0 -727px}
+select.flags option[value=BY], select.flags option[value=by], .country-BY {background-position:0 -749px}
+select.flags option[value=BZ], select.flags option[value=bz], .country-BZ {background-position:0 -771px}
+select.flags option[value=CA], select.flags option[value=ca], .country-CA {background-position:0 -793px}
+select.flags option[value=CC], select.flags option[value=cc], .country-CC {background-position:0 -837px}
+select.flags option[value=CD], select.flags option[value=cd], .country-CD {background-position:0 -859px}
+select.flags option[value=CF], select.flags option[value=cf], .country-CF {background-position:0 -881px}
+select.flags option[value=CG], select.flags option[value=cg], .country-CG {background-position:0 -903px}
+select.flags option[value=CH], select.flags option[value=ch], .country-CH {background-position:0 -925px}
+select.flags option[value=CI], select.flags option[value=ci], .country-CI {background-position:0 -947px}
+select.flags option[value=CK], select.flags option[value=ck], .country-CK {background-position:0 -969px}
+select.flags option[value=CL], select.flags option[value=cl], .country-CL {background-position:0 -991px}
+select.flags option[value=CM], select.flags option[value=cm], .country-CM {background-position:0 -1013px}
+select.flags option[value=CN], select.flags option[value=cn], .country-CN {background-position:0 -1035px}
+select.flags option[value=CO], select.flags option[value=co], .country-CO {background-position:0 -1057px}
+select.flags option[value=CR], select.flags option[value=cr], .country-CR {background-position:0 -1079px}
+select.flags option[value=CS], select.flags option[value=cs], .country-CS {background-position:0 -1101px}
+select.flags option[value=CU], select.flags option[value=cu], .country-CU {background-position:0 -1123px}
+select.flags option[value=CV], select.flags option[value=cv], .country-CV {background-position:0 -1145px}
+select.flags option[value=CX], select.flags option[value=cx], .country-CX {background-position:0 -1167px}
+select.flags option[value=CY], select.flags option[value=cy], .country-CY {background-position:0 -1189px}
+select.flags option[value=CZ], select.flags option[value=cz], .country-CZ {background-position:0 -1211px}
+select.flags option[value=DE], select.flags option[value=de], .country-DE {background-position:0 -1233px}
+select.flags option[value=DJ], select.flags option[value=dj], .country-DJ {background-position:0 -1255px}
+select.flags option[value=DK], select.flags option[value=dk], .country-DK {background-position:0 -1277px}
+select.flags option[value=DM], select.flags option[value=dm], .country-DM {background-position:0 -1299px}
+select.flags option[value=DO], select.flags option[value=do], .country-DO {background-position:0 -1321px}
+select.flags option[value=DZ], select.flags option[value=dz], .country-DZ {background-position:0 -1343px}
+select.flags option[value=EC], select.flags option[value=ec], .country-EC {background-position:0 -1365px}
+select.flags option[value=EE], select.flags option[value=ee], .country-EE {background-position:0 -1387px}
+select.flags option[value=EG], select.flags option[value=eg], .country-EG {background-position:0 -1409px}
+select.flags option[value=EH], select.flags option[value=eh], .country-EH {background-position:0 -1431px}
+select.flags option[value=ER], select.flags option[value=er], .country-ER {background-position:0 -1475px}
+select.flags option[value=ES], select.flags option[value=es], .country-ES {background-position:0 -1497px}
+select.flags option[value=ET], select.flags option[value=ET], select.flags option[value=et], .country-ET {background-position:0 -1519px}
+select.flags option[value=FI], select.flags option[value=fi], .country-FI {background-position:0 -1585px}
+select.flags option[value=FJ], select.flags option[value=fj], .country-FJ {background-position:0 -1607px}
+select.flags option[value=FK], select.flags option[value=fk], .country-FK {background-position:0 -1629px}
+select.flags option[value=FM], select.flags option[value=fm], .country-FM {background-position:0 -1651px}
+select.flags option[value=FO], select.flags option[value=fo], .country-FO {background-position:0 -1673px}
+select.flags option[value=FR], select.flags option[value=fr], .country-FR {background-position:0 -1695px}
+select.flags option[value=GA], select.flags option[value=ga], .country-GA {background-position:0 -1717px}
+select.flags option[value=GB], select.flags option[value=en], select.flags option[value=gb], .country-GB, .country-EN {background-position:0 -1739px}
+select.flags option[value=GD], select.flags option[value=gd], .country-GD {background-position:0 -1761px}
+select.flags option[value=GE], select.flags option[value=ge], .country-GE {background-position:0 -1783px}
+select.flags option[value=GF], select.flags option[value=gf], .country-GF {background-position:0 -1805px}
+select.flags option[value=GH], select.flags option[value=gh], .country-GH {background-position:0 -1827px}
+select.flags option[value=GI], select.flags option[value=gi], .country-GI {background-position:0 -1849px}
+select.flags option[value=GL], select.flags option[value=gl], .country-GL {background-position:0 -1871px}
+select.flags option[value=GM], select.flags option[value=gm], .country-GM {background-position:0 -1893px}
+select.flags option[value=GN], select.flags option[value=gn], .country-GN {background-position:0 -1915px}
+select.flags option[value=GP], select.flags option[value=gp], .country-GP {background-position:0 -1937px}
+select.flags option[value=GQ], select.flags option[value=gq], .country-GQ {background-position:0 -1959px}
+select.flags option[value=GR], select.flags option[value=el], select.flags option[value=gr], .country-GR, .country-EL {background-position:0 -1981px}
+select.flags option[value=GS], select.flags option[value=gs], .country-GS {background-position:0 -2003px}
+select.flags option[value=GT], select.flags option[value=gt], .country-GT {background-position:0 -2025px}
+select.flags option[value=GU], select.flags option[value=gu], .country-GU {background-position:0 -2047px}
+select.flags option[value=GW], select.flags option[value=gw], .country-GW {background-position:0 -2069px}
+select.flags option[value=GY], select.flags option[value=gy], .country-GY {background-position:0 -2091px}
+select.flags option[value=HK], select.flags option[value=hk], .country-HK {background-position:0 -2113px}
+select.flags option[value=HM], select.flags option[value=hm], .country-HM {background-position:0 -2135px}
+select.flags option[value=HN], select.flags option[value=hn], .country-HN {background-position:0 -2157px}
+select.flags option[value=HR], select.flags option[value=hr], .country-HR {background-position:0 -2179px}
+select.flags option[value=HT], select.flags option[value=ht], .country-HT {background-position:0 -2201px}
+select.flags option[value=HU], select.flags option[value=hu], .country-HU {background-position:0 -2223px}
+select.flags option[value=ID], select.flags option[value=id], .country-ID {background-position:0 -2245px}
+select.flags option[value=IE], select.flags option[value=ie], .country-IE {background-position:0 -2267px}
+select.flags option[value=IL], select.flags option[value=il], .country-IL {background-position:0 -2289px}
+select.flags option[value=IN], select.flags option[value=in], .country-IN {background-position:0 -2311px}
+select.flags option[value=IO], select.flags option[value=io], .country-IO {background-position:0 -2333px}
+select.flags option[value=IQ], select.flags option[value=iq], .country-IQ {background-position:0 -2355px}
+select.flags option[value=IR], select.flags option[value=ir], .country-IR {background-position:0 -2377px}
+select.flags option[value=IS], select.flags option[value=is], .country-IS {background-position:0 -2399px}
+select.flags option[value=IT], select.flags option[value=it], .country-IT {background-position:0 -2421px}
+select.flags option[value=JM], select.flags option[value=jm], .country-JM {background-position:0 -2443px}
+select.flags option[value=JO], select.flags option[value=jo], .country-JO {background-position:0 -2465px}
+select.flags option[value=JP], select.flags option[value=ja], select.flags option[value=jp], .country-JP, .country-JA {background-position:0 -2487px}
+select.flags option[value=KE], select.flags option[value=ke], .country-KE {background-position:0 -2509px}
+select.flags option[value=KG], select.flags option[value=kg], .country-KG {background-position:0 -2531px}
+select.flags option[value=KH], select.flags option[value=kh], .country-KH {background-position:0 -2553px}
+select.flags option[value=KI], select.flags option[value=ki], .country-KI {background-position:0 -2575px}
+select.flags option[value=KM], select.flags option[value=km], .country-KM {background-position:0 -2597px}
+select.flags option[value=KN], select.flags option[value=kn], .country-KN {background-position:0 -2619px}
+select.flags option[value=KP], select.flags option[value=kp], .country-KP {background-position:0 -2641px}
+select.flags option[value=KR], select.flags option[value=kr], .country-KR {background-position:0 -2663px}
+select.flags option[value=KW], select.flags option[value=kw], .country-KW {background-position:0 -2685px}
+select.flags option[value=KY], select.flags option[value=ky], .country-KY {background-position:0 -2707px}
+select.flags option[value=KZ], select.flags option[value=kz], .country-KZ {background-position:0 -2729px}
+select.flags option[value=LA], select.flags option[value=la], .country-LA {background-position:0 -2751px}
+select.flags option[value=LB], select.flags option[value=lb], .country-LB {background-position:0 -2773px}
+select.flags option[value=LC], select.flags option[value=lc], .country-LC {background-position:0 -2795px}
+select.flags option[value=LI], select.flags option[value=li], .country-LI {background-position:0 -2817px}
+select.flags option[value=LK], select.flags option[value=lk], .country-LK {background-position:0 -2839px}
+select.flags option[value=LR], select.flags option[value=lr], .country-LR {background-position:0 -2861px}
+select.flags option[value=LS], select.flags option[value=ls], .country-LS {background-position:0 -2883px}
+select.flags option[value=LT], select.flags option[value=lt], .country-LT {background-position:0 -2905px}
+select.flags option[value=LU], select.flags option[value=lu], .country-LU {background-position:0 -2927px}
+select.flags option[value=LV], select.flags option[value=lv], .country-LV {background-position:0 -2949px}
+select.flags option[value=LY], select.flags option[value=ly], .country-LY {background-position:0 -2971px}
+select.flags option[value=MA], select.flags option[value=ma], .country-MA {background-position:0 -2993px}
+select.flags option[value=MC], select.flags option[value=mc], .country-MC {background-position:0 -3015px}
+select.flags option[value=MD], select.flags option[value=md], .country-MD {background-position:0 -3037px}
+select.flags option[value=ME], select.flags option[value=me], .country-ME {background-position:0 -3059px}
+select.flags option[value=MG], select.flags option[value=mg], .country-MG {background-position:0 -3081px}
+select.flags option[value=MH], select.flags option[value=mh], .country-MH {background-position:0 -3103px}
+select.flags option[value=MK], select.flags option[value=mk], .country-MK {background-position:0 -3125px}
+select.flags option[value=ML], select.flags option[value=ml], .country-ML {background-position:0 -3147px}
+select.flags option[value=MM], select.flags option[value=mm], .country-MM {background-position:0 -3169px}
+select.flags option[value=MN], select.flags option[value=mn], .country-MN {background-position:0 -3191px}
+select.flags option[value=MO], select.flags option[value=mo], .country-MO {background-position:0 -3213px}
+select.flags option[value=MP], select.flags option[value=mp], .country-MP {background-position:0 -3235px}
+select.flags option[value=MQ], select.flags option[value=mq], .country-MQ {background-position:0 -3257px}
+select.flags option[value=MR], select.flags option[value=mr], .country-MR {background-position:0 -3279px}
+select.flags option[value=MS], select.flags option[value=ms], .country-MS {background-position:0 -3301px}
+select.flags option[value=MT], select.flags option[value=mt], .country-MT {background-position:0 -3323px}
+select.flags option[value=MU], select.flags option[value=mu], .country-MU {background-position:0 -3345px}
+select.flags option[value=MV], select.flags option[value=mv], .country-MV {background-position:0 -3367px}
+select.flags option[value=MW], select.flags option[value=mw], .country-MW {background-position:0 -3389px}
+select.flags option[value=MX], select.flags option[value=mx], .country-MX {background-position:0 -3411px}
+select.flags option[value=MY], select.flags option[value=my], .country-MY {background-position:0 -3433px}
+select.flags option[value=MZ], select.flags option[value=mz], .country-MZ {background-position:0 -3455px}
+select.flags option[value=NA], select.flags option[value=na], .country-NA {background-position:0 -3477px}
+select.flags option[value=NC], select.flags option[value=nc], .country-NC {background-position:0 -3499px}
+select.flags option[value=NE], select.flags option[value=ne], .country-NE {background-position:0 -3521px}
+select.flags option[value=NF], select.flags option[value=nf], .country-NF {background-position:0 -3543px}
+select.flags option[value=NG], select.flags option[value=ng], .country-NG {background-position:0 -3565px}
+select.flags option[value=NI], select.flags option[value=ni], .country-NI {background-position:0 -3587px}
+select.flags option[value=NL], select.flags option[value=nl], .country-NL {background-position:0 -3609px}
+select.flags option[value=NO], select.flags option[value=no], .country-NO {background-position:0 -3631px}
+select.flags option[value=NP], select.flags option[value=np], .country-NP {background-position:0 -3653px}
+select.flags option[value=NR], select.flags option[value=nr], .country-NR {background-position:0 -3675px}
+select.flags option[value=NU], select.flags option[value=nu], .country-NU {background-position:0 -3697px}
+select.flags option[value=NZ], select.flags option[value=nz], .country-NZ {background-position:0 -3719px}
+select.flags option[value=OM], select.flags option[value=om], .country-OM {background-position:0 -3741px}
+select.flags option[value=PA], select.flags option[value=pa], .country-PA {background-position:0 -3763px}
+select.flags option[value=PE], select.flags option[value=pe], .country-PE {background-position:0 -3785px}
+select.flags option[value=PF], select.flags option[value=pf], .country-PF {background-position:0 -3807px}
+select.flags option[value=PG], select.flags option[value=pg], .country-PG {background-position:0 -3829px}
+select.flags option[value=PH], select.flags option[value=ph], .country-PH {background-position:0 -3851px}
+select.flags option[value=PK], select.flags option[value=pk], .country-PK {background-position:0 -3873px}
+select.flags option[value=PL], select.flags option[value=pl], .country-PL {background-position:0 -3895px}
+select.flags option[value=PM], select.flags option[value=pm], .country-PM {background-position:0 -3917px}
+select.flags option[value=PN], select.flags option[value=pn], .country-PN {background-position:0 -3939px}
+select.flags option[value=PR], select.flags option[value=pr], .country-PR {background-position:0 -3961px}
+select.flags option[value=PS], select.flags option[value=ps], .country-PS {background-position:0 -3983px}
+select.flags option[value=PT], select.flags option[value=pt], .country-PT {background-position:0 -4005px}
+select.flags option[value=PW], select.flags option[value=pw], .country-PW {background-position:0 -4027px}
+select.flags option[value=PY], select.flags option[value=py], .country-PY {background-position:0 -4049px}
+select.flags option[value=QA], select.flags option[value=qa], .country-QA {background-position:0 -4071px}
+select.flags option[value=RE], select.flags option[value=re], .country-RE {background-position:0 -4093px}
+select.flags option[value=RO], select.flags option[value=ro], .country-RO {background-position:0 -4115px}
+select.flags option[value=RS], select.flags option[value=rs], .country-RS {background-position:0 -4137px}
+select.flags option[value=RU], select.flags option[value=ru], .country-RU {background-position:0 -4159px}
+select.flags option[value=RW], select.flags option[value=rw], .country-RW {background-position:0 -4181px}
+select.flags option[value=SA], select.flags option[value=sa], .country-SA {background-position:0 -4203px}
+select.flags option[value=SB], select.flags option[value=sb], .country-SB {background-position:0 -4225px}
+select.flags option[value=SC], select.flags option[value=sc], .country-SC {background-position:0 -4247px}
+select.flags option[value=SD], select.flags option[value=sd], .country-SD {background-position:0 -4291px}
+select.flags option[value=SE], select.flags option[value=se], .country-SE {background-position:0 -4313px}
+select.flags option[value=SG], select.flags option[value=sg], .country-SG {background-position:0 -4335px}
+select.flags option[value=SH], select.flags option[value=sh], .country-SH {background-position:0 -4357px}
+select.flags option[value=SI], select.flags option[value=si], .country-SI {background-position:0 -4379px}
+select.flags option[value=SJ], select.flags option[value=sj], .country-SJ {background-position:0 -4401px}
+select.flags option[value=SK], select.flags option[value=sk], .country-SK {background-position:0 -4423px}
+select.flags option[value=SL], select.flags option[value=sl], .country-SL {background-position:0 -4445px}
+select.flags option[value=SM], select.flags option[value=sm], .country-SM {background-position:0 -4467px}
+select.flags option[value=SN], select.flags option[value=sn], .country-SN {background-position:0 -4489px}
+select.flags option[value=SO], select.flags option[value=so], .country-SO {background-position:0 -4511px}
+select.flags option[value=SR], select.flags option[value=sr], .country-SR {background-position:0 -4533px}
+select.flags option[value=ST], select.flags option[value=st], .country-ST {background-position:0 -4555px}
+select.flags option[value=SV], select.flags option[value=sv], .country-SV {background-position:0 -4577px}
+select.flags option[value=SY], select.flags option[value=sy], .country-SY {background-position:0 -4599px}
+select.flags option[value=SZ], select.flags option[value=sz], .country-SZ {background-position:0 -4621px}
+select.flags option[value=TC], select.flags option[value=tc], .country-TC {background-position:0 -4643px}
+select.flags option[value=TD], select.flags option[value=td], .country-TD {background-position:0 -4665px}
+select.flags option[value=TF], select.flags option[value=tf], .country-TF {background-position:0 -4687px}
+select.flags option[value=TG], select.flags option[value=tg], .country-TG {background-position:0 -4709px}
+select.flags option[value=TH], select.flags option[value=th], .country-TH {background-position:0 -4731px}
+select.flags option[value=TJ], select.flags option[value=tj], .country-TJ {background-position:0 -4753px}
+select.flags option[value=TK], select.flags option[value=tk], .country-TK {background-position:0 -4775px}
+select.flags option[value=TL], select.flags option[value=tl], .country-TL {background-position:0 -4797px}
+select.flags option[value=TM], select.flags option[value=tm], .country-TM {background-position:0 -4819px}
+select.flags option[value=TN], select.flags option[value=tn], .country-TN {background-position:0 -4841px}
+select.flags option[value=TO], select.flags option[value=to], .country-TO {background-position:0 -4863px}
+select.flags option[value=TR], select.flags option[value=tr], .country-TR {background-position:0 -4885px}
+select.flags option[value=TT], select.flags option[value=tt], .country-TT {background-position:0 -4907px}
+select.flags option[value=TV], select.flags option[value=tv], .country-TV {background-position:0 -4929px}
+select.flags option[value=TW], select.flags option[value=tw], .country-TW {background-position:0 -4951px}
+select.flags option[value=TZ], select.flags option[value=tz], .country-TZ {background-position:0 -4973px}
+select.flags option[value=UA], select.flags option[value=ua], .country-UA {background-position:0 -4995px}
+select.flags option[value=UG], select.flags option[value=ug], .country-UG {background-position:0 -5017px}
+select.flags option[value=UM], select.flags option[value=um], .country-UM {background-position:0 -5039px}
+select.flags option[value=US], select.flags option[value=us], .country-US {background-position:0 -5061px}
+select.flags option[value=UY], select.flags option[value=uy], .country-UY {background-position:0 -5083px}
+select.flags option[value=UZ], select.flags option[value=uz], .country-UZ {background-position:0 -5105px}
+select.flags option[value=VA], select.flags option[value=va], .country-VA {background-position:0 -5127px}
+select.flags option[value=VC], select.flags option[value=vc], .country-VC {background-position:0 -5149px}
+select.flags option[value=VE], select.flags option[value=ve], .country-VE {background-position:0 -5171px}
+select.flags option[value=VG], select.flags option[value=vg], .country-VG {background-position:0 -5193px}
+select.flags option[value=VI], select.flags option[value=vi], .country-VI {background-position:0 -5215px}
+select.flags option[value=VN], select.flags option[value=vn], .country-VN {background-position:0 -5237px}
+select.flags option[value=VU], select.flags option[value=vu], .country-VU {background-position:0 -5259px}
+select.flags option[value=WF], select.flags option[value=wf], .country-WF {background-position:0 -5303px}
+select.flags option[value=WS], select.flags option[value=ws], .country-WS {background-position:0 -5325px}
+select.flags option[value=YE], select.flags option[value=ye], .country-YE {background-position:0 -5347px}
+select.flags option[value=YT], select.flags option[value=yt], .country-YT {background-position:0 -5369px}
+select.flags option[value=ZA], select.flags option[value=za], .country-ZA {background-position:0 -5391px}
+select.flags option[value=ZM], select.flags option[value=zm], .country-ZM {background-position:0 -5413px}
+select.flags option[value=ZW], select.flags option[value=zw], .country-ZW {background-position:0 -5435px}
+
+.panel_login {
+    max-width: 80%;
+    min-width: 680px;
+}
+div.subsectiontoggle {
+    border:1px solid #ccc;
+    font-weight:bold;
+    font-size:14px;
+    padding-top:10px;
+    padding-bottom:0;
+    margin-top:5px;
+    text-indent:15px;
+    cursor:pointer;
+    margin-bottom:10px;
+    background-color:#f4f4f4;
+    -moz-border-radius:5px;
+    -webkit-border-radius:5px;
+    -khtml-border-radius:5px;
+    -o-border-radius:5px;
+    -ms-border-radius:5px;
+    border-radius:5px;
+}
+div.subsectiontoggle span {
+    display:inline-block;
+    margin-bottom:-3px;
+    margin-right:10px;
+    width:16px;
+    height:16px;
+    background: url("../icons/button_sprite.png") 0 -72px no-repeat transparent;
+}
+div.subsectiontoggle span.showing{
+    background-position: 0 -40px;
+}
+div.subsectiontoggle em {
+    display:block;
+    position:relative;
+    left:425px;
+    top:-13px;
+    margin-bottom:-3px;
+    width:13px;
+    height:13px;
+    background:url("../images/chevron.png") top left no-repeat;
+    -webkit-transform:none;
+    -moz-transform:none;
+    -khtml-transform:none;
+    -o-transform:none;
+    -ms-transform:none;
+    transform:none;
+    -webkit-transition-duration: .2s;
+    -moz-transition-duration: .2s;
+    -khtml-transition-duration: .2s;
+    -o-transition-duration: .2s;
+    -ms-transition-duration: .2s;
+    transition-duration: .2s;
+    -webkit-transition-property: -webkit-transform;
+    -moz-transition-property: -moz-transform;
+    -khtml-transition-property: -khtml-transform;
+    -o-transition-property: -o-transform;
+    -ms-transition-property: -ms-transform;
+    transition-property: transform;
+}
+div.subsectiontoggle em.showing {
+    display:block;
+    position:relative;
+    left:425px;
+    top:-13px;
+    background:url("../images/chevron.png") top left no-repeat;
+    width:13px;
+    height:13px;
+    -webkit-transform:rotate(90deg);
+    -moz-transform:rotate(90deg);
+    -khtml-transform:rotate(90deg);
+    -o-transform:rotate(90deg);
+    -ms-transform:rotate(90deg);
+    transform:rotate(90deg);
+}
+div.subsectiontoggle:hover em {
+    -webkit-transform:rotate(90deg);
+    -moz-transform:rotate(90deg);
+    -khtml-transform:rotate(90deg);
+    -o-transform:rotate(90deg);
+    -ms-transform:rotate(90deg);
+    transform:rotate(90deg);
+}
+
+
+div.gs-container {
+    margin-top:10px;
+}
+div.gs-container * {
+    margin: 0;
+    padding: 0;
+    background-position: 0 0;
+    text-decoration: none;
+    font-size: 1em;
+}
+div.gs-container input {
+    background: url("../icons/x16_sprite.png") no-repeat 2px -119px #FFFFFF;
+    height:20px;
+    border:1px solid #444;
+    padding:0 22px 2px;
+    color:#444;
+    -moz-border-radius:5px;
+    -webkit-border-radius:5px;
+    -khtml-border-radius:5px;
+    -o-border-radius:5px;
+    -ms-border-radius:5px;
+    border-radius:5px;
+}
+input.gs-loading {
+    background-image: url("../images/loading.gif");
+    background-repeat: no-repeat;
+    background-position: center right;
+}
+ul.gs-resultbox {
+    margin: 0 !important;
+    padding: 0 !important;
+    width: 300px;
+    z-index: 999999;
+    border: 1px solid #777;
+    font-size: 11px;
+    background: #fff;
+    -moz-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -webkit-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -khtml-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -o-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -ms-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    box-shadow: 2px 2px 5px 0 #c5c5c5;
+    list-style: none;
+    -moz-border-radius:5px;
+    -webkit-border-radius:5px;
+    -khtml-border-radius:5px;
+    -o-border-radius:5px;
+    -ms-border-radius:5px;
+    border-radius:5px;
+    max-height:500px;
+    overflow:auto;
+}
+ul.gs-resultbox li {
+    float: left;
+    width: 100%;
+    clear: both;
+    cursor: pointer;
+}
+ul.gs-resultbox li.gs-cheader {
+    height: 13px;
+    overflow: hidden;
+    padding: 5px 0;
+    color: #fff;
+    background: #6ea6d1;
+    cursor:default;
+    padding-bottom:10px;
+}
+ul.gs-resultbox li.gs-cheader p.gs-cheader-title {
+    margin: 0 !important;
+    padding: 0 0 0 10px !important;
+    float: left;
+    font-size: 12px;
+    font-weight: bold;
+}
+ul.gs-resultbox li.gs-cheader p.gs-cheader-limit {
+    margin: 0 !important;
+    padding: 0 10px 0 0 !important;
+    float: right;
+    font-size: 11px;
+    font-weight: normal;
+}
+ul.gs-resultbox li.gs-cdata {
+    margin: 0 !important;
+    padding: 0 !important;
+    border-bottom: 1px solid #c5c5c5;
+}
+ul.gs-resultbox li.gs-cdata:last-child {
+    border-bottom: none;
+}
+ul.gs-resultbox li.gs-cdata:hover {
+    background: #eaf4fd;
+}
+ul.gs-resultbox li.gs-cdata a {
+    display: block;
+    padding: 5px 10px;
+    text-decoration: none !important;
+    background: #fff;
+}
+ul.gs-resultbox li.gs-cdata a:hover {
+    background: #cde0ff;
+}
+ul.gs-resultbox li.gs-cdata img {
+    margin-right: 12px;
+}
+ul.gs-resultbox li.gs-cdata p {
+    margin: 0 !important;
+    padding: 0 !important;
+    color: #444;
+    font-size: 10px;
+    min-height:30px;
+}
+ul.gs-resultbox li.gs-cdata p span.gs-cdata-title {
+    display: inline !important;
+    margin: 0 !important;
+    padding: 0 !important;
+    font-size: 11px;
+    font-weight: bold;
+    color: #000;
+}
+ul.gs-resultbox li:first-child {
+    -moz-border-radius:5px 5px 0 0;
+    -webkit-border-radius:5px 5px 0 0;
+    -khtml-border-radius:5px 5px 0 0;
+    -o-border-radius:5px 5px 0 0;
+    -ms-border-radius:5px 5px 0 0;
+    border-radius:5px 5px 0 0;
+}
+ul.gs-resultbox li:last-child {
+    -moz-border-radius:0 0 5px 5px;
+    -webkit-border-radius:0 0 5px 5px;
+    -khtml-border-radius:0 0 5px 5px;
+    -o-border-radius:0 0 5px 5px;
+    -ms-border-radius:0 0 5px 5px;
+    border-radius:0 0 5px 5px;
+}
+
+div.df-container {
+}
+div.df-container * {
+    margin: 0;
+    padding: 0;
+    background-position: 0 0;
+    text-decoration: none;
+    font-size: 1em;
+}
+div.df-container input {
+}
+input.df-loading {
+    background-image: url("../images/loading.gif");
+    background-repeat: no-repeat;
+    background-position: center right;
+}
+ul.df-resultbox {
+    margin: 0 !important;
+    padding: 0 !important;
+    min-width: 250px;
+    max-width: 500px;
+    z-index: 999999;
+    border: 1px solid #777;
+    font-size: 11px;
+    background: #fff;
+    -moz-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -webkit-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -khtml-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -o-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    -ms-box-shadow: 2px 2px 5px 0 #c5c5c5;
+    box-shadow: 2px 2px 5px 0 #c5c5c5;
+    list-style: none;
+    -moz-border-radius:5px;
+    -webkit-border-radius:5px;
+    -khtml-border-radius:5px;
+    -o-border-radius:5px;
+    -ms-border-radius:5px;
+    border-radius:5px;
+}
+ul.df-resultbox li {
+    float: left;
+    width: 100%;
+    clear: both;
+    cursor: pointer;
+}
+ul.df-resultbox li.df-cheader {
+    height: 13px;
+    overflow: hidden;
+    padding: 5px 0;
+    color: #fff;
+    background: #6ea6d1;
+    cursor:default;
+    padding-bottom:10px;
+}
+ul.df-resultbox li.df-cheader p.df-cheader-title {
+    margin: 0 !important;
+    padding: 0 0 0 10px !important;
+    float: left;
+    font-size: 12px;
+    font-weight: bold;
+}
+ul.df-resultbox li.df-cheader p.df-cheader-limit {
+    margin: 0 !important;
+    padding: 0 10px 0 0 !important;
+    float: right;
+    font-size: 11px;
+    font-weight: normal;
+}
+ul.df-resultbox li.df-cdata {
+    margin: 0 !important;
+    padding: 0 !important;
+    border-bottom: 1px solid #c5c5c5;
+}
+ul.df-resultbox li.df-cdata:last-child {
+    border-bottom: none;
+}
+ul.df-resultbox li.df-cdata:hover {
+    background: #eaf4fd;
+}
+ul.df-resultbox li.df-cdata a {
+    display: block;
+    padding: 5px 10px;
+    text-decoration: none !important;
+    background: #fff;
+}
+ul.df-resultbox li.df-cdata a:hover {
+    background: #cde0ff;
+}
+ul.df-resultbox li.df-cdata img {
+    margin-right: 12px;
+}
+ul.df-resultbox li.df-cdata p {
+    margin: 0 !important;
+    padding: 0 !important;
+    color: #444;
+    font-size: 10px;
+    min-height:30px;
+}
+ul.df-resultbox li.df-cdata p span.df-cdata-title {
+    display: inline !important;
+    margin: 0 !important;
+    padding: 0 !important;
+    font-size: 11px;
+    font-weight: bold;
+    color: #000;
+}
+ul.df-resultbox li:first-child {
+    -moz-border-radius:5px 5px 0 0;
+    -webkit-border-radius:5px 5px 0 0;
+    -khtml-border-radius:5px 5px 0 0;
+    -o-border-radius:5px 5px 0 0;
+    -ms-border-radius:5px 5px 0 0;
+    border-radius:5px 5px 0 0;
+}
+ul.df-resultbox li:last-child {
+    -moz-border-radius:0 0 5px 5px;
+    -webkit-border-radius:0 0 5px 5px;
+    -khtml-border-radius:0 0 5px 5px;
+    -o-border-radius:0 0 5px 5px;
+    -ms-border-radius:0 0 5px 5px;
+    border-radius:0 0 5px 5px;
+}
+
+span.icons16-empty {
+    float:left;
+    display:block;
+    height:20px;
+    width:20px;
+    margin:0 7px 0 0;
+}
+
+.ttip {
+    width:16px;
+    height:16px;
+    cursor:pointer;
+    background: url("../icons/x16_sprite.png") no-repeat -2px -42px transparent;
+    float:right;
+    display:inline;
+    position:relative;
+    right:-2px;
+    top:-2px;
+}
+
+p.prefix {
+    float: left;
+    margin: 0;
+    text-align: right;
+}
+p.label {
+    float: left;
+    margin: 5px 15px 0 0;
+}
+p.value {
+    float:left;
+    margin: 0 0 0 2px;
+}
+
+/* content_ispc
+-------------------------------------------------------------- */
+.tipsy {
+    font-size: 10px;
+    position: absolute;
+    padding: 5px;
+    z-index: 100000;
+}
+.tipsy-inner {
+    background-color: #000;
+    color: #FFF;
+    max-width: 350px;
+    padding: 5px 8px 4px 8px;
+    text-align: left;
+}
+
+/* Rounded corners */
+.tipsy-inner {
+    border-radius: 5px;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+}
+
+/* Uncomment for shadow */
+/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
+
+.tipsy-arrow {
+    position: absolute;
+    width: 0;
+    height: 0;
+    line-height: 0;
+    border: 5px dashed #000;
+}
+/* Rules to colour arrows */
+.tipsy-arrow-n { border-bottom-color: #000; }
+.tipsy-arrow-s { border-top-color: #000; }
+.tipsy-arrow-e { border-left-color: #000; }
+.tipsy-arrow-w { border-right-color: #000; }
+
+.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
+.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
+.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none;  border-left-color: transparent; border-right-color: transparent;}
+.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none;  border-left-color: transparent; border-right-color: transparent; }
+.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none;  border-left-color: transparent; border-right-color: transparent; }
+.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
+.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
+.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
+
+/* uni-form-generic
+-------------------------------------------------------------- */
+
+/* Uni-Form by Dragan Babic [Superawesome Industries]  - http: //sprawsm.com/uni-form/ */ 
+/* Some rights reserved - http: //creativecommons.org/licenses/by-sa/2.5/ */
+/* Do not edit this file directly, make your changes to uni-form.css in the same folder */
+
+.uniForm{ margin: 0; padding: 0; position: relative; z-index: 1; } /* reset stuff */
+
+/* Some generals and more resets */
+.uniForm fieldset{ border: none; margin: 0; padding: 0; }
+.uniForm fieldset legend{ margin: 0; padding: 0; }
+
+/* This is the main unit that contains our form elements */
+.uniForm .ctrlHolder,
+.uniForm .buttonHolder{ margin: 0; padding: 0; clear: both; }
+
+/* Clear all floats */ 
+.uniForm:after,
+.uniForm .buttonHolder:after, 
+.uniForm .ctrlHolder:after, 
+.uniForm .ctrlHolder .multiField:after,
+.uniForm .inlineLabel:after{ content: "."; display: block; height: 0; line-height: 0; font-size: 0; clear: both; min-height: 0; visibility: hidden; }
+
+/* A class to be used on a label that contains a checkbox or a radio button */
+.uniForm .inlineLabel,
+.uniForm .inlineLabels .inlineLabel,
+.uniForm .blockLabels .inlineLabel{ width: auto; float: none; margin: 0; display: block; }
+/* IE shows borders & padding on checkboxes and radio buttons if they are declared on an input element, remove them */
+/* Legacy/Inheritance fix */
+.uniForm .inlineLabel input,
+.uniForm .inlineLabels .inlineLabel input,
+.uniForm .blockLabels .inlineLabel input{ border: none; padding: 0; margin: 0; }
+
+/* Styles for form controls where labels are above the input elements */
+/* Set the class of the parent (preferably to a fieldset) to .blockLabels */
+
+.uniForm label,
+.uniForm .label,
+.uniForm .blockLabels label,
+.uniForm .blockLabels .label{ display: block; float: none; padding: 0; line-height: 100%; width: auto; }
+
+/* Float the input elements */
+.uniForm .textInput,
+.uniForm .blockLabels .textInput,
+.uniForm .blockLabels .fileUpload,
+.uniForm .selectInput,
+.uniForm .blockLabels .selectInput,
+.uniForm .blockLabels select,
+.uniForm textarea,
+.uniForm .blockLabels textarea{ float: left; }
+
+/* Postition the hints */
+.uniForm .formHint,
+.uniForm .blockLabels .formHint{ float: right; margin: 0; clear: none; }
+
+/* Position the elements inside combo boxes (multiple selects/checkboxes/radio buttons per unit) */
+.uniForm .multiField,
+.uniForm .blockLabels .multiField{ width: auto; float: left; }
+.uniForm .multiField .inlineLabel,
+.uniForm .blockLabels .multiField .inlineLabel{ display: block; margin: 0 0 .5em 0; }
+.uniForm .multiField .blockLabel,
+.uniForm .blockLabels .multiField .blockLabel{ float: left; width: auto; margin: 0; }
+.uniForm .multiField .blockLabel .textInput,
+.uniForm .multiField .blockLabel .selectInput,
+.uniForm .multiField .blockLabel select,
+.uniForm .blockLabels .multiField .blockLabel .textInput,
+.uniForm .blockLabels .multiField .blockLabel .selectInput,
+.uniForm .blockLabels .multiField .blockLabel select{ width: 100%; margin: 0; }
+
+/* Styles for form controls where labels are in line with the input elements */
+/* Set the class of the parent (preferably to a fieldset) to .inlineLabels */
+.uniForm .inlineLabels label,
+.uniForm .inlineLabels .label{ float: left; margin: 0; padding: 0; line-height: 100%; position: relative; }
+
+/* Float the input elements */
+.uniForm .inlineLabels .textInput,
+.uniForm .inlineLabels .fileUpload,        
+.uniForm .inlineLabels .selectInput,
+.uniForm .inlineLabels select,
+.uniForm .inlineLabels textarea{ float: left; }
+
+/* Postition the hints */
+.uniForm .inlineLabels .formHint{ clear: both; float: none; }
+.uniForm .inlineLabels .multiField{ float: left; }
+.uniForm .inlineLabels .multiField .inlineLabel{}
+.uniForm .inlineLabels .multiField .blockLabel{}
+.uniForm .inlineLabels .multiField .blockLabel .textInput,
+.uniForm .inlineLabels .multiField .blockLabel .selectInput,
+.uniForm .inlineLabels .multiField .blockLabel select{ display: block; width: 100%; float: none; }
+.uniForm .inlineLabels .multiField select{ float: left; }
+
+/* Required fields asterisk styling for .blockLabels */
+.uniForm label em,
+.uniForm .label em,
+.uniForm .blockLabels label em,
+.uniForm .blockLabels .label em{ position: absolute; left: -7px; }
+
+/* Required fields asterisk styling for .inlineLabels */
+.uniForm .inlineLabels label em,
+.uniForm .inlineLabels .label em{ display: block; position: absolute; left: auto; right: 0; font-style: normal; font-weight: bold; }
+.uniForm .inlineLabel em{ position: absolute; left: 7px; }
+
+/* Messages */
+.uniForm #errorMsg,
+.uniForm .error{}
+.uniForm #errorMsg dt,
+.uniForm #errorMsg h3{}
+.uniForm #errorMsg dd{}
+.uniForm #errorMsg ol{}
+.uniForm #errorMsg ol li{}
+.uniForm .errorField{}
+.uniForm #OKMsg{}
+
+/* Columns */
+
+.uniForm .col{ float: left; }
+.uniForm .col.first{}
+.uniForm .col.last{}
+
+/* uni-form
+-------------------------------------------------------------- */
+
+/* Keep in mind that wherever you see "Required property" it means that the property must exist */
+
+/* ------------------------------------------------------------------------------ */
+
+/* Generals */
+.uniForm fieldset{}
+.uniForm fieldset legend{ color: #333; font-weight: bold; font-size: 100%; margin: 0; padding: 1.5em 1.5em 1.5em 0; }
+
+/* This is the main unit that contains our form elements */
+.uniForm .ctrlHolder{ padding: 3px; border-bottom: 1px dotted #dfdfdf; }
+
+.uniForm .buttonHolder{ 
+    text-align: left; 
+    background: #CEDEEF url("../images/buttonHolder_bg.gif") no-repeat right;
+    margin: 3em 0 1em;
+    padding: 8px;
+}
+.uniForm .resetButton{ float: left; }
+.uniForm .primaryAction{ font-weight: bold; }
+
+/* This class gets added to div.ctrlHolder to highlight the row */
+.uniForm .focused{ background: #fffcdf; }
+
+/* .inlineLabel is used for inputs within labels - checkboxes and radio buttons */
+.uniForm .inlineLabel input,
+.uniForm .inlineLabels .inlineLabel input,
+.uniForm .blockLabels .inlineLabel input{ float: left; margin: 0 .4em 0 0; }
+.uniForm .inlineLabel span{ float: left; width: 90%; }
+
+/* ------------------------------------------------------------------------------ */
+
+/* .blockLabels (default style, will be applied even if you don"t class the parent element) */
+.uniForm .blockLabels .ctrlHolder{}
+
+.uniForm label,
+.uniForm .blockLabels label,
+.uniForm .blockLabels .label{ margin: 0 0 .5em 0; }
+
+.uniForm .textInput,
+.uniForm .blockLabels .textInput,
+.uniForm .blockLabels .fileUpload{ width: 43%; /* <- Required property */ }
+
+.uniForm .selectInput,
+.uniForm select,
+.uniForm .blockLabels .selectInput,
+.uniForm .blockLabels select{ width: 43.5%; /* <- Required property */ }
+.uniForm textarea,
+.uniForm .blockLabels textarea{ width: 43%; /* <- Required property */ height: 12em; }
+
+.uniForm .formHint,
+.uniForm .blockLabels .formHint{ width: 55%; /* <- Required property */ font-size: .9em; color: #777; position: relative; top: -.5em; }
+
+.uniForm .multiField,
+.uniForm .blockLabels .multiField{ width: 43%; }
+.uniForm .multiField .inlineLabel,
+.uniForm .blockLabels .multiField .inlineLabel{ display: block; margin: 0 0 .5em 0; }
+.uniForm .multiField .blockLabel,
+.uniForm .blockLabels .multiField .blockLabel{ width: 30%; margin: 0 10px 0 0; }
+.uniForm .multiField .blockLabel .textInput,
+.uniForm .multiField .blockLabel .selectInput,
+.uniForm .multiField .blockLabel select,
+.uniForm .blockLabels .multiField .blockLabel .textInput,
+.uniForm .blockLabels .multiField .blockLabel .selectInput,
+.uniForm .blockLabels .multiField .blockLabel select{ width: 100%; margin: .3em 0 0 0; }
+
+/* ------------------------------------------------------------------------------ */
+
+/* .inlineLabels */
+.uniForm .inlineLabels .ctrlHolder{}
+
+.uniForm .inlineLabels label,
+.uniForm .inlineLabels .label{ width: 20%; /* <- Required property */ margin: .3em 2% 0 0; /* <- Required property */ }
+
+.uniForm .inlineLabels .textInput,
+.uniForm .inlineLabels .fileUpload{ width: 35%; /* <- Required property */ }
+
+.uniForm .inlineLabels .selectInput,
+.uniForm .inlineLabels select{ width: 35%; /* <- Required property */ }
+
+.uniForm .inlineLabels textarea{  width: 35%; /* <- Required property */ height: 12em; }
+
+.uniForm .inlineLabels .formHint{ margin-top: 0; margin-left: 22%; font-size: .9em; color: #777; position: static; }
+
+.uniForm .inlineLabels .multiField{ width: 60%; /* <- Required property */ margin: 0 0 .3em 0; }
+.uniForm .inlineLabels .multiField .inlineLabel{ display: block; margin: 0 0 .5em 0; }
+.uniForm .inlineLabels .multiField .blockLabel{ float: left; width: 26%; margin: 0 3% 0 0; }
+.uniForm .inlineLabels .multiField .blockLabel .textInput,
+.uniForm .inlineLabels .multiField .blockLabel .selectInput,
+.uniForm .inlineLabels .multiField .blockLabel select{ width: 100%; margin: .3em 0 0 0; }
+
+/* Focus pseudoclasses */
+.uniForm .ctrlHolder .textInput:focus{ outline: none; /* Get rid of the "glow" effect in WebKit, optional */ }
+.uniForm .ctrlHolder textarea:focus{ outline: none; /* Get rid of the "glow" effect in WebKit, optional */ }
+.uniForm div.focused .formHint{ color: #333; }
+
+/* Columns (they are floated left by default) */
+.uniForm .col{ width: 37.9%; /* <- Required property */ margin: 0 2% 20px 0; }
+/* Use .first and .last classes to control the layout/spacing of your columns */
+.uniForm .col.first{ width: 39%; /* <- Required property */ float: left; clear: none; }
+.uniForm .col.last{ width: 39%; /* <- Required property */ float: right; clear: none; margin-right: 0; }
+
+/* Messages */
+.uniForm #errorMsg, .confirmpassworderror{ background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px; }
+.uniForm .error{ background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; }
+
+.uniForm #errorMsg dt, .uniForm #errorMsg h3{ margin: 0 0 .5em 0; font-size: 100%; line-height: 100%; font-weight: bold; }
+.uniForm #errorMsg dd{ margin: 0; padding: 0; }
+.uniForm #errorMsg ol{ margin: 0; padding: 0; list-style:none;}
+.uniForm #errorMsg ol li{ margin: 0; padding: 2px; list-style-position: inside; border-bottom: 1px dotted #df7d7d; position: relative; }
+.uniForm .errorField{ color: #af4c4c; margin: 0 0 6px 0; padding: 4px; background: #ffbfbf; }
+
+.uniForm #OKMsg, .confirmpasswordok{ background: #C8FFBF; border: 1px solid #A2EF95; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px; }
+.uniForm #OKMsg p{ margin: 0; }
+
+/* ------------------------------------------------------------------------------ */
+
+/* This is the main unit that contains our form elements */
+
+.uniForm .textInput, .uniForm .selectInput, .uniForm textarea {
+    background:#FFFFFF none repeat scroll 0 0;
+    color: #000000;
+    border: 1px solid #DFDFDF;
+    padding: 1px;
+}
+
+/* jquery-ui-custom
+-------------------------------------------------------------- */
+.ui-datepicker-calendar thead tr th {
+    background-image:none;
+    background-color:#FFFFFF;
+    color:#000000;
+}
+.ui-widget { font-family: "Trebuchet MS", Arial, sans-serif; font-size: 100%; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: "Trebuchet MS", Arial, sans-serif; font-size: 100%; }
+ul.ui-autocomplete { max-height: 250px; overflow-y: auto; min-width: 85px;}
+.ui-combobox { position: relative; display: inline-block; margin-right: 17px; }
+.ui-combobox-toggle { position: absolute !important; top: 0; bottom: 0; margin-left: -1px; padding: 1px !important; background: none repeat scroll 0 0 #FFFFFF !important; border: 1px solid #DFDFDF !important;}
+.ui-combobox-input { background: none repeat scroll 0 0 #FFFFFF !important; border: 1px solid #DFDFDF !important; padding: 1px; font-weight: normal !important; }
+.panel_install_package .ui-combobox { float: left; }
+.clear-float { clear: both; }
+
+a.link-page, span.page-spacer {
+    display: inline-block;
+    text-align: center;
+    padding: 2px;
+    line-height: 16px;
+    text-decoration: none !important;
+    color: inherit !important;
+    min-width: 16px;
+}
+a.link-page {
+    border: 1px solid #FFFFFF;
+    margin: 0 5px;
+}
+
+a.link-page:hover {
+    background-color: #DFDFDF;
+}
+
+span.page-spacer {
+    margin: 0 -5px;
+}
+
+a.link-page.current-page {
+    background-color: #DFDFDF;
+    font-weight: bold;
+}
+
+.command {
+    padding: 1em;
+    border: 1px dashed #2f6fab;
+    color: black;
+    background-color: #f9f9f9;
+    line-height: 1.1em;
+    font-family: Courier New, Courier, mono;
+    font-size: 12px;
+    font-style: italic;
+}
+.system {
+    color: black;
+    font-family: Courier New, Courier, mono;
+    font-size: 12px;
+    font-style: italic;
+}
+.highlight {
+    color: #FF0000;
+    font-family: Georgia, "Times New Roman", Times, serif;
+    font-size: 12px;
+    text-decoration: underline;
 }
\ No newline at end of file
diff --git a/interface/web/themes/default/templates/main.tpl.htm b/interface/web/themes/default/templates/main.tpl.htm
index 4ccb70a..d148a5f 100644
--- a/interface/web/themes/default/templates/main.tpl.htm
+++ b/interface/web/themes/default/templates/main.tpl.htm
@@ -50,6 +50,9 @@
 				
 				// Store password in browser; works in Firefox, but not Chrome
 				$('#username').live("blur", function(){
+					if($('#username').val() == '') {
+						return true;
+					}
 					if($('#dummy_username').val() == '' || $('#dummy_username').val() != $(this).val()){
 						$('#dummy_login').show();
 						$('#dummy_username').attr('value', $(this).val()).trigger('focus').trigger('blur');
diff --git a/interface/web/vm/openvz_ip_list.php b/interface/web/vm/openvz_ip_list.php
index 8892efc..804d60f 100644
--- a/interface/web/vm/openvz_ip_list.php
+++ b/interface/web/vm/openvz_ip_list.php
@@ -48,7 +48,7 @@
 $app->uses('listform_actions');
 
 // $app->listform_actions->SQLExtWhere = "limit_client = 0";
-$app->listform_actions->SQLOrderBy = 'ORDER BY server_id,ip_address';
+$app->listform_actions->SQLOrderBy = 'ORDER BY openvz_ip.server_id, openvz_ip.ip_address';
 $app->listform_actions->onLoad();
 
 
diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php
index f77d04c..83d530d 100644
--- a/interface/web/vm/openvz_vm_edit.php
+++ b/interface/web/vm/openvz_vm_edit.php
@@ -96,19 +96,19 @@
 			
 			//* Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id, CONCAT(client.company_name,' :: ',client.contact_name) as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			
 			
 			//* Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY sys_group.name";
 			$records = $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['name'].' :: '.$client['contactname'].'</option>';
+			$client_select = '<option value="'.$tmp['groupid'].'">'.$client['contactname'].'</option>';
 			//$tmp_data_record = $app->tform->getDataRecord($this->id);
 			if(is_array($records)) {
 				foreach( $records as $rec) {
 					$selected = @(is_array($this->dataRecord) && ($client["groupid"] == $this->dataRecord['client_group_id'] || $client["groupid"] == $this->dataRecord['sys_groupid']))?'SELECTED':'';
-					$client_select .= "<option value='$rec[groupid]' $selected>$rec[name] :: $rec[contactname]</option>\r\n";
+					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
@@ -132,14 +132,14 @@
 		} else {
 
 			//* Fill the client select field
-			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(client.company_name,' :: ',client.contact_name) as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.name";
+			$sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY sys_group.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] :: $client[contactname]</option>\r\n";
+					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
diff --git a/server/conf/getmail.conf.master b/server/conf/getmail.conf.master
index 029c6fe..7d2726e 100644
--- a/server/conf/getmail.conf.master
+++ b/server/conf/getmail.conf.master
@@ -1,6 +1,6 @@
 [options]
 # message_log = /var/log/getmail.log
-message_log_syslog = 1
+message_log_syslog = true
 delete = {DELETE}
 read_all = {READ_ALL}
 
diff --git a/server/conf/mail/mail_quota_notification_de.txt b/server/conf/mail/mail_quota_notification_de.txt
new file mode 100644
index 0000000..adb46cd
--- /dev/null
+++ b/server/conf/mail/mail_quota_notification_de.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: E-Mail Kontobelegungshinweis
+
+Ihr E-Mail Konto {email} hat den verfügbaren Speicherplatz (nahezu) ausgeschöpft.
+
+E-Mail Konto: 			{email}
+Name:				{name}
+Belegter Speicher:		{used}
+Verfügbarer Speicher:		{quota}
+Belegt:				{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/mail_quota_notification_en.txt b/server/conf/mail/mail_quota_notification_en.txt
new file mode 100644
index 0000000..74e03e6
--- /dev/null
+++ b/server/conf/mail/mail_quota_notification_en.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Mailbox quota notification
+
+The mailbox {email} is near or over quota.
+
+Mailbox:			{email}
+Name:				{name}
+Used space:			{used}
+Quota:				{quota}
+Usage ratio:			{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/mail_quota_ok_notification_de.txt b/server/conf/mail/mail_quota_ok_notification_de.txt
new file mode 100644
index 0000000..ee6bb73
--- /dev/null
+++ b/server/conf/mail/mail_quota_ok_notification_de.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: E-Mail Kontobelegungshinweis
+
+Der belegte Speicherplatz Ihres E-Mail Kontos {email} ist wieder ok.
+
+E-Mail Konto: 			{email}
+Name:				{name}
+Belegter Speicher:		{used}
+Verfügbarer Speicher:		{quota}
+Belegt:				{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/mail_quota_ok_notification_en.txt b/server/conf/mail/mail_quota_ok_notification_en.txt
new file mode 100644
index 0000000..ed5a2e3
--- /dev/null
+++ b/server/conf/mail/mail_quota_ok_notification_en.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Mailbox quota ok
+
+The mailbox {email} is no longer near or over quota.
+
+Mailbox:			{email}
+Name:				{name}
+Used space:			{used}
+Quota:				{quota}
+Usage ratio:			{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/web_quota_notification_de.txt b/server/conf/mail/web_quota_notification_de.txt
new file mode 100644
index 0000000..da73b78
--- /dev/null
+++ b/server/conf/mail/web_quota_notification_de.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Webseiten-Speicherhinweis
+
+Ihre Webseite {domain} hat den verfügbaren Speicherplatz (nahezu) ausgeschöpft.
+
+Webseite:						{domain}
+Belegter Speicherplatz:					{used}
+Verfügbarer Speicherplatz:				{soft}
+Verfügbarer Speicherplatz (hard quota):			{hard}
+Belegter Speicher in %:					{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/web_quota_notification_en.txt b/server/conf/mail/web_quota_notification_en.txt
new file mode 100644
index 0000000..9da1e96
--- /dev/null
+++ b/server/conf/mail/web_quota_notification_en.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Website quota notification
+
+The website {domain} is near or over quota.
+
+Domain: 		{domain}
+Used space:		{used}
+Soft limit:		{soft}
+Hard limit:		{hard}
+Usage ratio:		{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/web_quota_ok_notification_de.txt b/server/conf/mail/web_quota_ok_notification_de.txt
new file mode 100644
index 0000000..98f67d6
--- /dev/null
+++ b/server/conf/mail/web_quota_ok_notification_de.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Webseiten-Speicherhinweis
+
+Der belegte Speicherplatz Ihrer Webseite {domain} ist wieder ok.
+
+Webseite:						{domain}
+Belegter Speicherplatz:					{used}
+Verfügbarer Speicherplatz:				{soft}
+Verfügbarer Speicherplatz (hard quota):			{hard}
+Belegter Speicher in %:					{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/web_quota_ok_notification_en.txt b/server/conf/mail/web_quota_ok_notification_en.txt
new file mode 100644
index 0000000..693f676
--- /dev/null
+++ b/server/conf/mail/web_quota_ok_notification_en.txt
@@ -0,0 +1,14 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Website quota ok
+
+The website {domain} is no longer near or over quota.
+
+Domain: 		{domain}
+Used space:		{used}
+Soft limit:		{soft}
+Hard limit:		{hard}
+Usage ratio:		{ratio}
\ No newline at end of file
diff --git a/server/conf/mail/web_traffic_notification_de.txt b/server/conf/mail/web_traffic_notification_de.txt
new file mode 100644
index 0000000..b249121
--- /dev/null
+++ b/server/conf/mail/web_traffic_notification_de.txt
@@ -0,0 +1,8 @@
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Traffic-Warnung
+
+Ihre Webseite {domain} hat den verfügbaren Traffic ausgeschöpft und wurde vorrübergehend deaktiviert.
\ No newline at end of file
diff --git a/server/conf/mail/web_traffic_notification_en.txt b/server/conf/mail/web_traffic_notification_en.txt
index 9b91792..bae39cb 100644
--- a/server/conf/mail/web_traffic_notification_en.txt
+++ b/server/conf/mail/web_traffic_notification_en.txt
@@ -1,3 +1,8 @@
-Subject:Website traffic notification
+MIME-Version: 1.0
+Content-type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 8bit
+From: {admin_mail}
+Reply-To: {admin_mail}
+Subject: Website traffic notification
 
 The website {domain} is over traffic and has been disabled.
\ No newline at end of file
diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master
index 7217636..02ea5af 100644
--- a/server/conf/nginx_vhost.conf.master
+++ b/server/conf/nginx_vhost.conf.master
@@ -170,6 +170,10 @@
         }
 </tmpl_if>
 
+<tmpl_loop name="rewrite_rules">
+        <tmpl_var name='rewrite_rule'>
+</tmpl_loop>
+
 <tmpl_loop name="nginx_directives">
         <tmpl_var name='nginx_directive'>
 </tmpl_loop>
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 69c345f..9d7ca00 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -247,7 +247,7 @@
 // Create webalizer statistics
 #######################################################################################################
 
-function setConfigVar( $filename, $varName, $varValue ) {
+function setConfigVar( $filename, $varName, $varValue, $append = 0 ) {
 	if($lines = @file($filename)) {
 		$out = '';
 		$found = 0;
@@ -641,6 +641,64 @@
 	}
 }
 
+#########
+// function for sending notification emails
+#########
+function send_notification_email($template, $placeholders, $recipients) {
+    global $conf;
+    
+    if(!is_array($recipients) || count($recipients) < 1) return false;
+    if(!is_array($placeholders)) $placeholders = array();
+    
+    if(file_exists($conf['rootpath'].'/conf-custom/mail/' . $template . '_'.$conf['language'].'.txt')) {
+        $lines = file($conf['rootpath'].'/conf-custom/mail/' . $template . '_'.$conf['language'].'.txt');
+    } elseif(file_exists($conf['rootpath'].'/conf-custom/mail/' . $template . '_en.txt')) {
+        $lines = file($conf['rootpath'].'/conf-custom/mail/' . $template . '_en.txt');
+    } elseif(file_exists($conf['rootpath'].'/conf/mail/' . $template . '_'.$conf['language'].'.txt')) {
+        $lines = file($conf['rootpath'].'/conf/mail/' . $template . '_'.$conf['language'].'.txt');
+    } else {
+        $lines = file($conf['rootpath'].'/conf/mail/' . $template . '_en.txt');
+    }
+    
+    //* get mail headers, subject and body
+    $mailHeaders = '';
+    $mailBody = '';
+    $mailSubject = '';
+    $inHeader = true;
+    for($l = 0; $l < count($lines); $l++) {
+        if($lines[$l] == '') {
+            $inHeader = false;
+            continue;
+        }
+        if($inHeader == true) {
+            $parts = explode(':', $lines[$l], 2);
+            if(strtolower($parts[0]) == 'subject') $mailSubject = trim($parts[1]);
+            unset($parts);
+            $mailHeaders .= trim($lines[$l]) . "\n";
+        } else {
+            $mailBody .= trim($lines[$l]) . "\n";
+        }
+    }
+    $mailBody = trim($mailBody);
+    
+    //* Replace placeholders
+    $mailHeaders = strtr($mailHeaders, $placeholders);
+    $mailSubject = strtr($mailSubject, $placeholders);
+    $mailBody = strtr($mailBody, $placeholders);
+    
+    for($r = 0; $r < count($recipients); $r++) {
+        mail($recipients[$r], $mailSubject, $mailBody, $mailHeaders);
+    }
+
+    unset($mailSubject);
+    unset($mailHeaders);
+    unset($mailBody);
+    unset($lines);
+    
+    return true;
+}
+
+
 #######################################################################################################
 // enforce traffic quota (run only on the "master-server")
 #######################################################################################################
@@ -683,41 +741,15 @@
 				$app->log('Traffic quota for '.$rec['domain'].' exceeded. Disabling website.',LOGLEVEL_DEBUG);
 				
 				//* Send traffic notifications
-				if($web_config['overtraffic_notify_admin'] == 'y' || $web_config['overtraffic_notify_client'] == 'y') {
-					
-					if(file_exists($conf['rootpath'].'/conf-custom/mail/web_traffic_notification_'.$conf['language'].'.txt')) {
-						$lines = file($conf['rootpath'].'/conf-custom/mail/web_traffic_notification_'.$conf['language'].'.txt');
-					} elseif(file_exists($conf['rootpath'].'/conf-custom/mail/web_traffic_notification_en.txt')) {
-						$lines = file($conf['rootpath'].'/conf-custom/mail/web_traffic_notification_en.txt');
-					} elseif(file_exists($conf['rootpath'].'/conf/mail/web_traffic_notification_'.$conf['language'].'.txt')) {
-						$lines = file($conf['rootpath'].'/conf/mail/web_traffic_notification_'.$conf['language'].'.txt');
-					} else {
-						$lines = file($conf['rootpath'].'/conf/mail/web_traffic_notification_en.txt');
-					}
-					
-					//* Get subject
-					$parts = explode(':',trim($lines[0]));
-					unset($parts[0]);
-					$traffic_mail_subject  = implode(':',$parts);
-					unset($lines[0]);
-		
-					//* Get message
-					$traffic_mail_message = trim(implode($lines));
-					unset($tmp);
-					
-					//* Replace placeholders
-					$traffic_mail_message = str_replace('{domain}',$rec['domain'],$traffic_mail_message);
-						
-					$mailHeaders      = "MIME-Version: 1.0" . "\n";
-					$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
-					$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
-					$mailHeaders     .= "From: ". $global_config['admin_mail'] . "\n";
-					$mailHeaders     .= "Reply-To: ". $global_config['admin_mail'] . "\n";
-					$mailSubject      = "=?utf-8?B?".base64_encode($traffic_mail_subject)."?=";
-					
-					//* send email to admin
+				if($rec['traffic_quota_lock'] != 'y' && ($web_config['overtraffic_notify_admin'] == 'y' || $web_config['overtraffic_notify_client'] == 'y')) {
+                    
+                    $placeholders = array('{domain}' => $rec['domain'],
+                                          '{admin_mail}' => $global_config['admin_mail']);
+                    
+					$recipients = array();
+                    //* send email to admin
 					if($global_config['admin_mail'] != '' && $web_config['overtraffic_notify_admin'] == 'y') {
-						mail($global_config['admin_mail'], $mailSubject, $traffic_mail_message, $mailHeaders);
+						$recipients[] = $global_config['admin_mail'];
 					}
 					
 					//* Send email to client
@@ -725,10 +757,11 @@
 						$client_group_id = $rec["sys_groupid"];
 						$client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 						if($client['email'] != '') {
-							mail($client['email'], $mailSubject, $traffic_mail_message, $mailHeaders);
+							$recipients[] = $client['email'];
 						}
 					}
-					
+                    
+                    send_notification_email('web_traffic_notification', $placeholders, $recipients);
 				}
 				
 				
@@ -743,6 +776,283 @@
 	}
 
 
+}
+
+
+#######################################################################################################
+// send website quota warnings by email
+#######################################################################################################
+
+if ($app->dbmaster == $app->db) {
+
+	$global_config = $app->getconf->get_global_config('mail');
+
+	//* Check website disk quota
+	$sql = "SELECT domain_id,sys_groupid,domain,system_user,last_quota_notification,DATEDIFF(CURDATE(), last_quota_notification) as `notified_before` FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain')";
+	$records = $app->db->queryAllRecords($sql);
+	if(is_array($records) && !empty($records)) {
+	
+		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
+		$monitor_data = array();
+		if(is_array($tmp_rec)) {
+			foreach ($tmp_rec as $tmp_mon) {
+				$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+			}
+		}
+		
+		foreach($records as $rec) {
+
+			//$web_hd_quota = $rec['hd_quota'];
+			$domain = $rec['domain'];
+			
+			$username = $rec['system_user'];
+			$rec['used'] = $monitor_data['user'][$username]['used'];
+			$rec['soft'] = $monitor_data['user'][$username]['soft'];
+			$rec['hard'] = $monitor_data['user'][$username]['hard'];
+			$rec['files'] = $monitor_data['user'][$username]['files'];
+				
+			if (!is_numeric($rec['used'])){
+				if ($rec['used'][0] > $rec['used'][1]){
+					$rec['used'] = $rec['used'][0];
+				} else {
+					$rec['used'] = $rec['used'][1];
+				}
+			}
+			if (!is_numeric($rec['soft'])) $rec['soft']=$rec['soft'][1];
+			if (!is_numeric($rec['hard'])) $rec['hard']=$rec['hard'][1];
+			if (!is_numeric($rec['files'])) $rec['files']=$rec['files'][1];
+				
+			// used space ratio
+			if($rec['soft'] > 0){
+				$used_ratio = $rec['used']/$rec['soft'];
+			} else {
+				$used_ratio = 0;
+			}
+			
+			$rec['ratio'] = number_format($used_ratio * 100, 2, '.', '').'%';
+		
+			if($rec['used'] > 1024) {
+				$rec['used'] = round($rec['used'] / 1024,2).' MB';
+			} else {
+				if ($rec['used'] != '') $rec['used'] .= ' KB';
+			}
+		
+			if($rec['soft'] > 1024) {
+				$rec['soft'] = round($rec['soft'] / 1024,2).' MB';
+			} elseif($rec['soft'] == 0){
+				$rec['soft'] = '----';
+			} else {
+				$rec['soft'] .= ' KB';
+			}
+		
+			if($rec['hard'] > 1024) {
+				$rec['hard'] = round($rec['hard'] / 1024,2).' MB';
+			} elseif($rec['hard'] == 0){
+				$rec['hard'] = '----';
+			} else {
+				$rec['hard'] .= ' KB';
+			}
+			
+			// send notifications only if 90% or more of the quota are used
+			if($used_ratio < 0.9) {
+                // reset notification date
+                if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('web_domain', "last_quota_notification = NULL", 'domain_id', $rec['domain_id']);
+                
+                // send notification - everything ok again
+                if($rec['last_quota_notification'] && $web_config['overquota_notify_onok'] == 'y' && ($web_config['overquota_notify_admin'] == 'y' || $web_config['overquota_notify_client'] == 'y')) {
+                    $placeholders = array('{domain}' => $rec['domain'],
+                                          '{admin_mail}' => $global_config['admin_mail'],
+                                          '{used}' => $rec['used'],
+                                          '{soft}' => $rec['soft'],
+                                          '{hard}' => $rec['hard'],
+                                          '{ratio}' => $rec['ratio']);
+
+                    $recipients = array();
+                    
+                    //* send email to admin
+                    if($global_config['admin_mail'] != '' && $web_config['overquota_notify_admin'] == 'y') {
+                        $recipients[] = $global_config['admin_mail'];
+                    }
+                    
+                    //* Send email to client
+                    if($web_config['overquota_notify_client'] == 'y') {
+                        $client_group_id = $rec["sys_groupid"];
+                        $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+                        if($client['email'] != '') {
+                            $recipients[] = $client['email'];
+                        }
+                    }
+                    send_notification_email('web_quota_ok_notification', $placeholders, $recipients);
+                }
+                
+                continue;
+            }
+            
+            // could a notification be sent?
+            $send_notification = false;
+            if(!$rec['last_quota_notification']) $send_notification = true; // not yet notified
+            elseif($web_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $web_config['overquota_notify_freq']) $send_notification = true;
+            
+			//* Send quota notifications
+			if(($web_config['overquota_notify_admin'] == 'y' || $web_config['overquota_notify_client'] == 'y') && $send_notification == true) {
+				$app->dbmaster->datalogUpdate('web_domain', "last_quota_notification = CURDATE()", 'domain_id', $rec['domain_id']);
+                
+                $placeholders = array('{domain}' => $rec['domain'],
+                                      '{admin_mail}' => $global_config['admin_mail'],
+                                      '{used}' => $rec['used'],
+                                      '{soft}' => $rec['soft'],
+                                      '{hard}' => $rec['hard'],
+                                      '{ratio}' => $rec['ratio']);
+
+                $recipients = array();
+                
+                //* send email to admin
+                if($global_config['admin_mail'] != '' && $web_config['overquota_notify_admin'] == 'y') {
+                    $recipients[] = $global_config['admin_mail'];
+                }
+                
+                //* Send email to client
+                if($web_config['overquota_notify_client'] == 'y') {
+                    $client_group_id = $rec["sys_groupid"];
+                    $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+                    if($client['email'] != '') {
+                        $recipients[] = $client['email'];
+                    }
+                }
+                send_notification_email('web_quota_notification', $placeholders, $recipients);
+			}
+		}
+	}
+}
+
+
+#######################################################################################################
+// send mail quota warnings by email
+#######################################################################################################
+
+if ($app->dbmaster == $app->db) {
+
+	$global_config = $app->getconf->get_global_config('mail');
+	$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
+
+	//* Check email quota
+	$sql = "SELECT mailuser_id,sys_groupid,email,name,quota,last_quota_notification,DATEDIFF(CURDATE(), last_quota_notification) as `notified_before` FROM mail_user";
+	$records = $app->db->queryAllRecords($sql);
+	if(is_array($records) && !empty($records)) {
+	
+		$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'email_quota' ORDER BY created DESC");
+		$monitor_data = array();
+		if(is_array($tmp_rec)) {
+			foreach ($tmp_rec as $tmp_mon) {
+				//$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+				$tmp_array = unserialize($app->db->unquote($tmp_mon['data']));
+				if(is_array($tmp_array)) {
+					foreach($tmp_array as $username => $data) {
+						if(@!$monitor_data[$username]['used']) $monitor_data[$username]['used'] = $data['used'];
+					}
+				}
+			}
+		}
+		
+		foreach($records as $rec) {
+
+			$email = $rec['email'];
+		
+			$rec['used'] = isset($monitor_data[$email]['used']) ? $monitor_data[$email]['used'] : array(1 => 0);
+		
+			if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
+				
+			// used space ratio
+			if($rec['quota'] > 0){
+				$used_ratio = $rec['used']/$rec['quota'];
+			} else {
+				$used_ratio = 0;
+			}
+			
+			$rec['ratio'] = number_format($used_ratio * 100, 2, '.', '').'%';
+			
+			if($rec['quota'] > 0){
+				$rec['quota'] = round($rec['quota'] / 1048576,4).' MB';
+			} else {
+				$rec['quota'] = '----';
+			}
+
+			if($rec['used'] < 1544000) {
+				$rec['used'] = round($rec['used'] / 1024,4).' KB';
+			} else {
+				$rec['used'] = round($rec['used'] / 1048576,4).' MB';
+			} 
+			
+			// send notifications only if 90% or more of the quota are used
+			if($used_ratio < 0.9) {
+                // reset notification date
+                if($rec['last_quota_notification']) $app->dbmaster->datalogUpdate('mail_user', "last_quota_notification = NULL", 'mailuser_id', $rec['mailuser_id']);
+
+                // send notification - everything ok again
+                if($rec['last_quota_notification'] && $mail_config['overquota_notify_onok'] == 'y' && ($mail_config['overquota_notify_admin'] == 'y' || $mail_config['overquota_notify_client'] == 'y')) {
+                    $placeholders = array('{email}' => $rec['email'],
+                              '{admin_mail}' => $global_config['admin_mail'],
+                              '{used}' => $rec['used'],
+                              '{name}' => $rec['name'],
+                              '{quota}' => $rec['quota'],
+                              '{ratio}' => $rec['ratio']);
+        
+                    $recipients = array();
+                    //* send email to admin
+                    if($global_config['admin_mail'] != '' && $mail_config['overquota_notify_admin'] == 'y') {
+                        $recipients[] = $global_config['admin_mail'];
+                    }
+                    
+                    //* Send email to client
+                    if($mail_config['overquota_notify_client'] == 'y') {
+                        $client_group_id = $rec["sys_groupid"];
+                        $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+                        if($client['email'] != '') {
+                            $recipients[] = $client['email'];
+                        }
+                    }
+                    
+                    send_notification_email('mail_quota_ok_notification', $placeholders, $recipients);
+                }
+
+                continue;
+            }
+				
+			//* Send quota notifications
+            // could a notification be sent?
+            $send_notification = false;
+            if(!$rec['last_quota_notification']) $send_notification = true; // not yet notified
+            elseif($mail_config['overquota_notify_freq'] > 0 && $rec['notified_before'] >= $mail_config['overquota_notify_freq']) $send_notification = true;
+            
+            if(($mail_config['overquota_notify_admin'] == 'y' || $mail_config['overquota_notify_client'] == 'y') && $send_notification == true) {
+				$app->dbmaster->datalogUpdate('mail_user', "last_quota_notification = CURDATE()", 'mailuser_id', $rec['mailuser_id']);
+                
+                $placeholders = array('{email}' => $rec['email'],
+                          '{admin_mail}' => $global_config['admin_mail'],
+                          '{used}' => $rec['used'],
+                          '{name}' => $rec['name'],
+                          '{quota}' => $rec['quota'],
+                          '{ratio}' => $rec['ratio']);
+    
+                $recipients = array();
+                //* send email to admin
+                if($global_config['admin_mail'] != '' && $mail_config['overquota_notify_admin'] == 'y') {
+                    $recipients[] = $global_config['admin_mail'];
+                }
+                
+                //* Send email to client
+                if($mail_config['overquota_notify_client'] == 'y') {
+                    $client_group_id = $rec["sys_groupid"];
+                    $client = $app->db->queryOneRecord("SELECT client.email FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+                    if($client['email'] != '') {
+                        $recipients[] = $client['email'];
+                    }
+                }
+                
+                send_notification_email('mail_quota_notification', $placeholders, $recipients);
+			}	
+		}
+	}
 }
 
 
@@ -822,25 +1132,28 @@
 				if($backup_mode == 'userzip') {
 					//* Create a .zip backup as web user and include also files owned by apache / nginx user
 					$web_backup_file = 'web'.$web_id.'_'.date('Y-m-d_H-i').'.zip';
-					exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -group '.escapeshellarg($web_group).' -print 2> /dev/null | zip -b /tmp --exclude=backup\* --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@');
-					exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -user '.escapeshellarg($http_server_user).' -print 2> /dev/null | zip -b /tmp --exclude=backup\* --update --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@');
+					exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -group '.escapeshellarg($web_group).' -print 2> /dev/null | zip -b /tmp --exclude=backup\* --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@', $tmp_output, $retval);
+					if($retval == 0) exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -user '.escapeshellarg($http_server_user).' -print 2> /dev/null | zip -b /tmp --exclude=backup\* --update --symlinks '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' -@', $tmp_output, $retval);
 				} else {
 					//* Create a tar.gz backup as root user
 					$web_backup_file = 'web'.$web_id.'_'.date('Y-m-d_H-i').'.tar.gz';
-					exec('tar pczf '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' --exclude=backup\* --directory '.escapeshellarg($web_path).' .');
+					exec('tar pczf '.escapeshellarg($web_backup_dir.'/'.$web_backup_file).' --exclude=backup\* --directory '.escapeshellarg($web_path).' .', $tmp_output, $retval);
 				}
-				chown($web_backup_dir.'/'.$web_backup_file, 'root');
-				chgrp($web_backup_dir.'/'.$web_backup_file, 'root');
-				chmod($web_backup_dir.'/'.$web_backup_file, 0750);
+				if($retval == 0){
+					chown($web_backup_dir.'/'.$web_backup_file, 'root');
+					chgrp($web_backup_dir.'/'.$web_backup_file, 'root');
+					chmod($web_backup_dir.'/'.$web_backup_file, 0750);
 
-				//* Insert web backup record in database
-				//$insert_data = "(server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."')";
-				//$app->dbmaster->datalogInsert('web_backup', $insert_data, 'backup_id');
-
-				$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename,filesize) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."','".formatBytes(filesize($web_backup_dir.'/'.$web_backup_file))."')";
-				$app->db->query($sql);
-				if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
-				
+					//* Insert web backup record in database
+					//$insert_data = "(server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."')";
+					//$app->dbmaster->datalogInsert('web_backup', $insert_data, 'backup_id');
+					$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",".$web_id.",'web','".$backup_mode."',".time().",'".$app->db->quote($web_backup_file)."')";
+					$app->db->query($sql);
+					if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+				} else {
+					if(is_file($web_backup_dir.'/'.$web_backup_file)) unlink($web_backup_dir.'/'.$web_backup_file);
+				}
+				
 				//* Remove old backups
 				$backup_copies = intval($rec['backup_copies']);
 
@@ -924,23 +1237,28 @@
 				$db_name = $rec['database_name'];
 				$db_backup_file = 'db_'.$db_name.'_'.date('Y-m-d_H-i').'.sql';
 				$command = "mysqldump -h '".escapeshellcmd($clientdb_host)."' -u '".escapeshellcmd($clientdb_user)."' -p'".escapeshellcmd($clientdb_password)."' -c --add-drop-table --create-options --quick --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
-				exec($command);
+				exec($command, $tmp_output, $retval);
 
 				//* Compress the backup with gzip
-				exec("gzip -c '".escapeshellcmd($db_backup_dir.'/'.$db_backup_file)."' > '".escapeshellcmd($db_backup_dir.'/'.$db_backup_file).".gz'");
-				chmod($db_backup_dir.'/'.$db_backup_file.'.gz', 0750);
-				chown($db_backup_dir.'/'.$db_backup_file.'.gz', fileowner($db_backup_dir));
-				chgrp($db_backup_dir.'/'.$db_backup_file.'.gz', filegroup($db_backup_dir));
+				if($retval == 0) exec("gzip -c '".escapeshellcmd($db_backup_dir.'/'.$db_backup_file)."' > '".escapeshellcmd($db_backup_dir.'/'.$db_backup_file).".gz'", $tmp_output, $retval);
+				
+				if($retval == 0){
+					chmod($db_backup_dir.'/'.$db_backup_file.'.gz', 0750);
+					chown($db_backup_dir.'/'.$db_backup_file.'.gz', fileowner($db_backup_dir));
+					chgrp($db_backup_dir.'/'.$db_backup_file.'.gz', filegroup($db_backup_dir));
 
-				//* Insert web backup record in database
-				//$insert_data = "(server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz')";
-				//$app->dbmaster->datalogInsert('web_backup', $insert_data, 'backup_id');
-				$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz')";
-				$app->db->query($sql);
-				if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+					//* Insert web backup record in database
+					//$insert_data = "(server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz')";
+					//$app->dbmaster->datalogInsert('web_backup', $insert_data, 'backup_id');
+					$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz')";
+					$app->db->query($sql);
+					if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
 
+				} else {
+					if(is_file($db_backup_dir.'/'.$db_backup_file.'.gz')) unlink($db_backup_dir.'/'.$db_backup_file.'.gz');
+				}
 				//* Remove the uncompressed file
-				unlink($db_backup_dir.'/'.$db_backup_file);
+				if(is_file($db_backup_dir.'/'.$db_backup_file)) unlink($db_backup_dir.'/'.$db_backup_file);
 
 				//* Remove old backups
 				$backup_copies = intval($rec['backup_copies']);
diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php
index 87f964dc..11bf8da 100755
--- a/server/lib/app.inc.php
+++ b/server/lib/app.inc.php
@@ -102,28 +102,31 @@
         function log($msg, $priority = 0) {
 				
 		global $conf;
+		
+		switch ($priority) {
+			case 0:
+				$priority_txt = 'DEBUG';
+				break;
+			case 1:
+				$priority_txt = 'WARNING';
+				break;
+			case 2:
+				$priority_txt = 'ERROR';
+				break;
+		}
+		$log_msg = @date('d.m.Y-H:i').' - '.$priority_txt.' - '. $msg;
 
 		if($priority >= $conf['log_priority']) {
                         //if (is_writable($conf["log_file"])) {
                             if (!$fp = fopen ($conf['log_file'], 'a')) {
                                 die('Unable to open logfile.');
                             }
-						switch ($priority) {
-							case 0:
-								$priority_txt = 'DEBUG';
-								break;
-							case 1:
-								$priority_txt = 'WARNING';
-								break;
-							case 2:
-								$priority_txt = 'ERROR';
-								break;
-						}
 							
-                            if (!fwrite($fp, @date('d.m.Y-H:i').' - '.$priority_txt.' - '. $msg."\r\n")) {
+                            if (!fwrite($fp, $log_msg."\r\n")) {
                                 die('Unable to write to logfile.');
                             }
-				echo @date('d.m.Y-H:i').' - '.$priority_txt.' - '. $msg."\n";
+				
+				echo $log_msg."\n";
 				fclose($fp);
 
 					// Log to database
@@ -149,8 +152,24 @@
                         //} else {
                         //    die("Unable to write to logfile.");
                         //}
+					
+    
                 } // if
+				
+				if($priority >= $conf['admin_notify_priority'] && $conf['admin_mail'] != '') {
+					// send notification to admin
+					$mailBody = $log_msg;
+					$mailSubject = substr($log_msg,0,50).'...';
+					$mailHeaders      = "MIME-Version: 1.0" . "\n";
+					$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
+					$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
+					$mailHeaders     .= "From: ". $conf['admin_mail'] . "\n";
+					$mailHeaders     .= "Reply-To: ". $conf['admin_mail'] . "\n";
+
+					mail($conf['admin_mail'], $mailSubject, $mailBody, $mailHeaders);
+				}
         } // func
+		
 
         /*
          0 = DEBUG
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 6162024..9ce9556 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -132,7 +132,7 @@
 				$distver = 'Squeeze/Sid';
 				$distid = 'debian60';
 				$distbaseid = 'debian';
-			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
+			} elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || strstr(trim(file_get_contents('/etc/debian_version')), '7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 				$distname = 'Debian';
 				$distver = 'Wheezy/Sid';
 				$distid = 'debian60';
@@ -473,7 +473,7 @@
 	}
 
 	public function monitorDiskUsage() {
-		global $conf;
+		global $app,$conf;
 
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
@@ -485,7 +485,10 @@
 		$state = 'ok';
 
 		/** Fetch the data of ALL devices into a array (needed for monitoring!) */
-		$dfData = shell_exec('df -hT 2>/dev/null');
+		//$dfData = shell_exec('df -hT 2>/dev/null');
+		$app->uses('getconf');
+        $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+        $dfData = shell_exec('df -hT|grep -v "'.$web_config['website_basedir'].'/" 2>/dev/null');
 
 		// split into array
 		$df = explode("\n", $dfData);
diff --git a/server/lib/classes/services.inc.php b/server/lib/classes/services.inc.php
index d10abf2..cd53433 100644
--- a/server/lib/classes/services.inc.php
+++ b/server/lib/classes/services.inc.php
@@ -55,9 +55,10 @@
 			$function_name = $this->registered_services[$service_name]['function'];
 			$app->log("Calling function '$function_name' from module '$module_name'.",LOGLEVEL_DEBUG);
 			// call_user_method($function_name,$app->loaded_modules[$module_name],$action);
-			call_user_func(array($app->loaded_modules[$module_name],$function_name),$action);
+			return call_user_func(array($app->loaded_modules[$module_name],$function_name),$action);
 		} else {
 			$app->log("Unable to restart $service_name. Service not registered.",LOGLEVEL_WARNING);
+			return array('output' => '', 'retval' => 0);
 		}
 		
 	}
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index c958e8b..f6b52cf 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -780,7 +780,7 @@
 		if(substr($path,0,1) != '/') return false;
 		
 		//* We allow only some characters in the path
-		if(!preg_match('/[a-zA-Z0-9_\.\-]{1,}/',$path)) return false;
+		if(!preg_match('/^\/[a-zA-Z0-9_\/\.\-]{1,}$/',$path)) return false;
 		
 		//* Check path for symlinks
 		$path_parts = explode('/',$path);
diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php
index af2e0da..c3c16c9 100644
--- a/server/lib/classes/tpl.inc.php
+++ b/server/lib/classes/tpl.inc.php
@@ -928,9 +928,9 @@
                 $regex.=    '[\"\']?';
                 $regex.= ')?\s*';
                 $regex.= '(?:>|\/>|}|-->){1}';
-				$regex.= '/ie';
+				$regex.= '/i';
                 //$regex.= '([\r\n|\n|\r])?/ie';
-                $data = preg_replace($regex,"\$this->_parseTag(array('\\0','\\1','\\2','\\3','\\4','\\5','\\6','\\7','\\8','\\9'));",$data);
+                $data = preg_replace_callback($regex, array($this, '_parseTag'), $data);
 
                 if ($this->_cache) { // add cache if need be
                     $this->_createCache($data);
diff --git a/server/mods-available/dns_module.inc.php b/server/mods-available/dns_module.inc.php
index 01c4526..2fac7b5 100644
--- a/server/mods-available/dns_module.inc.php
+++ b/server/mods-available/dns_module.inc.php
@@ -128,12 +128,13 @@
 			$daemon = 'named';
 		}
 		
+		$retval = array('output' => '', 'retval' => 0);
 		if($action == 'restart') {
-			exec($conf['init_scripts'] . '/' . $daemon . ' restart');
+			exec($conf['init_scripts'] . '/' . $daemon . ' restart', $retval['output'], $retval['retval']);
 		} else {
-			exec($conf['init_scripts'] . '/' . $daemon . ' reload');
+			exec($conf['init_scripts'] . '/' . $daemon . ' reload', $retval['output'], $retval['retval']);
 		}
-		
+		return $retval;
 	}
 
 	function restartPowerDNS($action = 'restart') {
@@ -177,9 +178,11 @@
 			$daemon = 'pdns';
 		}
 
-		exec($conf['init_scripts'] . '/' . $daemon . ' restart');
+		$retval = array('output' => '', 'retval' => 0);
+		exec($conf['init_scripts'] . '/' . $daemon . ' restart', $retval['output'], $retval['retval']);
 
 //     unset $tmps;
+		return $retval;
 
 	}
 	
diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index 63a813c..2e66d64 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -37,6 +37,8 @@
 	var $actions_available = array();
 	/** The Tools */
 	private $_tools = null;
+    //** time the script was called
+    private $_run_time = null;
 
 	/**
 	 * This function is called during ispconfig installation to determine
@@ -52,11 +54,14 @@
 	 */
 	public function onLoad() {
 		global $app;
-
+        
+        //* store the running time
+        $this->_run_time = time();
+        
 		/*
 		 * Do the monitor every n minutes and write the result to the db
 		 */
-		$min = @date('i');
+		$min = @date('i', $this->_run_time);
 		if (($min % $this->interval) == 0) {
 			$this->_doMonitor();
 		}
@@ -122,7 +127,7 @@
         /*
 		 *  This monitoring is expensive, so do it only every 15 minutes
 		 */
-		$min = @date('i');
+		$min = @date('i', $this->_run_time);
 		if ($min % 15 != 0) return;
 		
 		$app->uses('getconf');
@@ -404,7 +409,7 @@
 		/*
 		 *  This monitoring is expensive, so do it only once an hour
 		 */
-		$min = @date('i');
+		$min = @date('i', $this->_run_time);
 		if ($min != 0)
 			return;
 
@@ -419,7 +424,8 @@
 		$res = $this->_tools->monitorSystemUpdate();
 		
 		//* Ensure that output is encoded so that it does not break the serialize
-		$res['data']['output'] = htmlentities($res['data']['output']);
+		//$res['data']['output'] = htmlentities($res['data']['output']);
+		$res['data']['output'] = htmlentities($res['data']['output'],ENT_QUOTES,'UTF-8');
 
 		/*
 		 * Insert the data into the database
@@ -492,8 +498,8 @@
 		/*
 		 *  This monitoring is expensive, so do it only once a day
 		 */
-		$min = @date('i');
-		$hour = @date('H');
+		$min = @date('i', $this->_run_time);
+		$hour = @date('H', $this->_run_time);
 		if (!($min == 0 && $hour == 23))
 			return;
 		/*
diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index dd7aba0..52d4aed 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -210,12 +210,13 @@
 				}
 		}
 
+		$retval = array('output' => '', 'retval' => 0);
 		if($action == 'restart') {
-			exec($conf['init_scripts'] . '/' . $daemon . ' restart');
+			exec($conf['init_scripts'] . '/' . $daemon . ' restart', $retval['output'], $retval['retval']);
 		} else {
-			exec($conf['init_scripts'] . '/' . $daemon . ' reload');
+			exec($conf['init_scripts'] . '/' . $daemon . ' reload', $retval['output'], $retval['retval']);
 		}
-		
+		return $retval;
 	}
 	
 	function restartPHP_FPM($action = 'restart') {
@@ -229,7 +230,9 @@
 		
 		if(!$init_script) $init_script = $conf['init_scripts'].'/'.$web_config['php_fpm_init_script'];
 		
-		exec($init_script.' '.$action);
+		$retval = array('output' => '', 'retval' => 0);
+		exec($init_script.' '.$action, $retval['output'], $retval['retval']);
+		return $retval;
 	}
 
 } // end class
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 58e941d..0107cbb 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -189,7 +189,7 @@
 		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
-			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.conf',LOGLEVEL_ERROR);	
+			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf',LOGLEVEL_ERROR);	
 		
 		//* Only vhosts can have a ssl cert
 		if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return;
@@ -336,6 +336,7 @@
 			//* Write the key file, if field is empty then import the key into the db
 			if(trim($data["new"]["ssl_key"]) != '') {
 				$app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]);
+				$app->system->chmod($key_file2,0400);
 			} else {
 				$ssl_key2 = $app->db->quote($app->system->file_get_contents($key_file2));
 				/* Update the DB of the (local) Server */
@@ -762,6 +763,9 @@
 				$this->_exec('chown root:root '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder);
 			}
 		}
+		
+		//* add the Apache user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update
+		if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user']));
 
 		//* If the security level is set to high
 		if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) {
@@ -805,9 +809,6 @@
 					$app->system->server_conf['group_datei'] = $tmp_groupfile;
 					unset($tmp_groupfile);
 				}
-
-				//* add the Apache user to the client group
-				$app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user']));
 				
 				//* Chown all default directories
 				$app->system->chown($data['new']['document_root'],'root');
@@ -1121,7 +1122,7 @@
 					
 				// Rewriting
 				if($alias['redirect_type'] != '' && $alias['redirect_path'] != '') {
-					if(substr($alias['redirect_path'],-1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $alias['redirect_path'] .= '/';
+					if(substr($alias['redirect_path'],-1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $alias['redirect_path'])) $alias['redirect_path'] .= '/';
 					if(substr($alias['redirect_path'],0,8) == '[scheme]'){
 						$rewrite_target = 'http'.substr($alias['redirect_path'],8);
 						$rewrite_target_ssl = 'https'.substr($alias['redirect_path'],8);
@@ -1352,9 +1353,9 @@
 
 			if (!is_dir($cgi_starter_path)) {
 				$app->system->mkdirpath($cgi_starter_path);
-				$app->system->chmod($cgi_starter_script,0755);
-				$app->system->chown($cgi_starter_script,$data['new']['system_user']);
-				$app->system->chgrp($cgi_starter_script,$data['new']['system_group']);
+				$app->system->chown($cgi_starter_path,$data['new']['system_user']);
+				$app->system->chgrp($cgi_starter_path,$data['new']['system_group']);
+				$app->system->chmod($cgi_starter_path,0755);
 
 				$app->log('Creating cgi starter script directory: '.$cgi_starter_path,LOGLEVEL_DEBUG);
 			}
@@ -1564,7 +1565,8 @@
 			$apache_online_status_before_restart = $this->_checkTcp('localhost',80);
 			$app->log('Apache status is: '.$apache_online_status_before_restart,LOGLEVEL_DEBUG);
 
-			$app->services->restartService('httpd','restart');
+			$retval = $app->services->restartService('httpd','restart'); // $retval['retval'] is 0 on success and > 0 on failure
+			$app->log('Apache restart return value is: '.$retval['retval'],LOGLEVEL_DEBUG);
 			
 			// wait a few seconds, before we test the apache status again
 			$apache_online_status_after_restart = false;
@@ -1576,8 +1578,41 @@
 			}
 			//* Check if apache restarted successfully if it was online before
 			$app->log('Apache online status after restart is: '.$apache_online_status_after_restart,LOGLEVEL_DEBUG);
-			if($apache_online_status_before_restart && !$apache_online_status_after_restart) {
-				$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);
+			if($apache_online_status_before_restart && !$apache_online_status_after_restart || $retval['retval'] > 0) {
+				$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);
+				if(is_array($retval['output']) && !empty($retval['output'])){
+					$app->log('Reason for Apache restart failure: '.implode("\n", $retval['output']),LOGLEVEL_WARN);
+				} else {
+					// if no output is given, check again
+					$webserver_binary = '';
+					exec('which apache2', $webserver_check_output, $webserver_check_retval);
+					if($webserver_check_retval == 0){
+						$webserver_binary = 'apache2';
+					} else {
+						unset($webserver_check_output, $webserver_check_retval);
+						exec('which httpd2', $webserver_check_output, $webserver_check_retval);
+						if($webserver_check_retval == 0){
+							$webserver_binary = 'httpd2';
+						} else {
+							unset($webserver_check_output, $webserver_check_retval);
+							exec('which httpd', $webserver_check_output, $webserver_check_retval);
+							if($webserver_check_retval == 0){
+								$webserver_binary = 'httpd';
+							} else {
+								unset($webserver_check_output, $webserver_check_retval);
+								exec('which apache', $webserver_check_output, $webserver_check_retval);
+								if($webserver_check_retval == 0){
+									$webserver_binary = 'apache';
+								}
+							}
+						}
+					}
+					if($webserver_binary != ''){
+						exec($webserver_binary.' -t 2>&1', $tmp_output, $tmp_retval);
+						if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)) $app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output),LOGLEVEL_WARN);
+						unset($tmp_output, $tmp_retval);
+					}
+				}
 				$app->system->copy($vhost_file,$vhost_file.'.err');
 				if(is_file($vhost_file.'~')) {
 					//* Copy back the last backup file
@@ -2855,8 +2890,10 @@
 				$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
 			}
 			
-			$this->_exec('groupdel client'.$client_id);
-			$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
+			if($app->system->is_group('client'.$client_id)){
+				$this->_exec('groupdel client'.$client_id);
+				$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
+			}
 		}
 		
 	}
diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php
index e4f6e6c..fd7f516 100644
--- a/server/plugins-available/bind_plugin.inc.php
+++ b/server/plugins-available/bind_plugin.inc.php
@@ -103,6 +103,11 @@
 			$tpl->setVar($zone);
 		
 			$records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y'");
+			if(is_array($records) && !empty($records)){
+				for($i=0;$i<sizeof($records);$i++){
+					if($records[$i]['ttl'] == 0) $records[$i]['ttl'] = '';
+				}
+			}
 			$tpl->setLoop('zones',$records);
 			
 			//TODO : change this when distribution information has been integrated into server record
diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php
index 4ccbcb2..cf9baa8 100644
--- a/server/plugins-available/cron_plugin.inc.php
+++ b/server/plugins-available/cron_plugin.inc.php
@@ -212,7 +212,7 @@
                     }
                     
                     $command .= "\t";
-                    if(substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
+                    if($job['type'] == 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
                     $command .= $job['command'];
                 }
                 
diff --git a/server/plugins-available/ftpuser_base_plugin.inc.php b/server/plugins-available/ftpuser_base_plugin.inc.php
index 1b4a016..66723d2 100644
--- a/server/plugins-available/ftpuser_base_plugin.inc.php
+++ b/server/plugins-available/ftpuser_base_plugin.inc.php
@@ -69,6 +69,8 @@
 	function insert($event_name,$data) {
 		global $app, $conf;
 		
+        $app->uses('system');
+        
     if(!is_dir($data['new']['dir'])) {
       $app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.",LOGLEVEL_DEBUG);
       
@@ -80,9 +82,11 @@
 		return false;
 	  }
 	  
+      $app->system->web_folder_protection($web['document_root'],false);
       exec('mkdir -p '.escapeshellcmd($data['new']['dir']));
       exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
-	  
+	  $app->system->web_folder_protection($web['document_root'],true);
+      
 	  $app->log("Added ftpuser_dir: ".$data['new']['dir'],LOGLEVEL_DEBUG);
     }
     
@@ -91,6 +95,8 @@
 	function update($event_name,$data) {
 		global $app, $conf;
 		
+        $app->uses('system');
+        
     if(!is_dir($data['new']['dir'])) {
       $app->log("FTP User directory '".$data['new']['dir']."' does not exist. Creating it now.",LOGLEVEL_DEBUG);
       
@@ -101,9 +107,11 @@
 		$app->log('User dir is outside of docroot.',LOGLEVEL_WARN);
 		return false;
 	  }
-	  
+
+      $app->system->web_folder_protection($web['document_root'],false);
       exec('mkdir -p '.escapeshellcmd($data['new']['dir']));
       exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
+	  $app->system->web_folder_protection($web['document_root'],true);
       
       $app->log("Added ftpuser_dir: ".$data['new']['dir'],LOGLEVEL_DEBUG);
     }
diff --git a/server/plugins-available/getmail_plugin.inc.php b/server/plugins-available/getmail_plugin.inc.php
index 759c219..eb2da0e 100644
--- a/server/plugins-available/getmail_plugin.inc.php
+++ b/server/plugins-available/getmail_plugin.inc.php
@@ -104,15 +104,15 @@
 			
 				// Shall emails be deleted after retrieval
 				if($data["new"]["source_delete"] == 'y') {
-					$tpl = str_replace('{DELETE}','1',$tpl);
+					$tpl = str_replace('{DELETE}','true',$tpl);
 				} else {
-					$tpl = str_replace('{DELETE}','0',$tpl);
+					$tpl = str_replace('{DELETE}','false',$tpl);
 				}
 
 				if($data["new"]["read_all"] == 'y') {
-					$tpl = str_replace('{READ_ALL}', '1', $tpl);
+					$tpl = str_replace('{READ_ALL}', 'true', $tpl);
 				} else {
-					$tpl = str_replace('{READ_ALL}', '0', $tpl);
+					$tpl = str_replace('{READ_ALL}', 'false', $tpl);
 				}
 				
 				// Set the data retriever
diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index 7fa2b7b..b4fa6d3 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -247,8 +247,10 @@
 			
             // get the users for this database
             $db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_user_id']) . "'");
+            $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
             
             $db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['new']['database_ro_user_id']) . "'");
+            $old_db_ro_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");
             
             $host_list = '';
             if($data['new']['remote_access'] == 'y') {
@@ -278,28 +280,28 @@
                     else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
                 }
 			} else if($data['new']['active'] == 'n' && $data['old']['active'] == 'y') { // revoke database user, if inactive
-                if($db_user) {
-                    if($db_user['database_user'] == 'root'){
+                if($old_db_user) {
+                    if($old_db_user['database_user'] == 'root'){
 						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                     } else {
 						// Find out users to drop and users to revoke
-						$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['new']['database_user_id'], $old_host_list);
-						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
+						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
 						
 						
 						//$this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $old_host_list, $link);
 						//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $old_host_list, $link);
 					}
                 }
-                if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    if($db_ro_user['database_user'] == 'root'){
+                if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
+                    if($old_db_ro_user['database_user'] == 'root'){
 						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                     } else {
 						// Find out users to drop and users to revoke
-						$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['new']['database_ro_user_id'], $old_host_list);
-						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $old_host_list);
+						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
 						
 						//$this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $old_host_list, $link);
 						//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $old_host_list, $link);
@@ -314,15 +316,14 @@
             //* selected Users have changed
             if($data['new']['database_user_id'] != $data['old']['database_user_id']) {
                 if($data['old']['database_user_id'] && $data['old']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                    $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
                     if($old_db_user) {
                         if($old_db_user['database_user'] == 'root'){
 							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                         } else {
 							// Find out users to drop and users to revoke
-							$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['old']['database_user_id'], $old_host_list);
-							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
+							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
 						
 							//$this->process_host_list('DROP', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
@@ -336,15 +337,14 @@
             }
             if($data['new']['database_ro_user_id'] != $data['old']['database_ro_user_id']) {
                 if($data['old']['database_ro_user_id'] && $data['old']['database_ro_user_id'] != $data['new']['database_user_id']) {
-                    $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");
-                    if($old_db_user) {
-                        if($old_db_user['database_user'] == 'root'){
+                    if($old_db_ro_user) {
+                        if($old_db_ro_user['database_user'] == 'root'){
 							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                         } else {
 							// Find out users to drop and users to revoke
-							$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['old']['database_user_id'], $old_host_list);
-							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
+							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
 							
 							//$this->process_host_list('DROP', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $old_host_list, $link);
@@ -377,27 +377,27 @@
                         else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['new']['remote_ips'], $link, '', true);
                     }
 				} else {
-                    if($db_user) {
-                        if($db_user['database_user'] == 'root'){
+                    if($old_db_user) {
+                        if($old_db_user['database_user'] == 'root'){
 							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                         } else {
 							// Find out users to drop and users to revoke
-							$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['new']['database_user_id'], $data['old']['remote_ips']);
-							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $data['old']['remote_ips']);
+							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
 							
 							//$this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['old']['remote_ips'], $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['old']['remote_ips'], $link);
 						}
                     }
-                    if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-                        if($db_ro_user['database_user'] == 'root'){
+                    if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
+                        if($old_db_ro_user['database_user'] == 'root'){
 							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                         } else {
 							// Find out users to drop and users to revoke
-							$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['new']['database_ro_user_id'], $data['old']['remote_ips']);
-							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+							$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $data['old']['remote_ips']);
+							if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+							if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
 							
 							//$this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['old']['remote_ips'], $link);
 							//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['old']['remote_ips'], $link);
@@ -407,31 +407,39 @@
 				$app->log('Changing MySQL remote access privileges for database: '.$data['new']['database_name'],LOGLEVEL_DEBUG);
 			} elseif($data['new']['remote_access'] == 'y' && $data['new']['remote_ips'] != $data['old']['remote_ips']) {
                 //* Change remote access list
+                if($old_db_user) {
+                    if($old_db_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
+                    } else {
+						// Find out users to drop and users to revoke
+						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $data['old']['remote_ips']);
+						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+                    }
+                }
                 if($db_user) {
                     if($db_user['database_user'] == 'root'){
 						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                     } else {
-						// Find out users to drop and users to revoke
-						$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['new']['database_user_id'], $data['old']['remote_ips']);
-						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-							
-                        //$this->process_host_list('DROP', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['old']['remote_ips'], $link);
-						//$this->process_host_list('REVOKE', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['old']['remote_ips'], $link);
                         $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['new']['remote_ips'], $link);
                     }
                 }
+                
+                if($old_db_ro_user && $data['old']['database_user_id'] != $data['old']['database_ro_user_id']) {
+                    if($old_db_ro_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
+                    } else {
+						// Find out users to drop and users to revoke
+						$drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $data['old']['remote_ips']);
+						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_ro_user['database_user'], $old_db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+                    }
+                }
+                
                 if($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
                     if($db_ro_user['database_user'] == 'root'){
 						$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
                     } else {
-						// Find out users to drop and users to revoke
-						$drop_or_revoke_user = $this->drop_or_revoke_user($data['new']['database_id'], $data['new']['database_user_id'], $data['old']['remote_ips']);
-						if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
-						if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
-						
-						//$this->process_host_list('DROP', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['old']['remote_ips'], $link);
-                        //$this->process_host_list('REVOKE', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['old']['remote_ips'], $link);
                         $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $data['new']['remote_ips'], $link, '', true);
                     }
                 }
@@ -460,6 +468,28 @@
 				return;
 			}
 			
+			$old_host_list = '';
+            if($data['old']['remote_access'] == 'y') {
+                $old_host_list = $data['old']['remote_ips'];
+                if($old_host_list == '') $old_host_list = '%';
+            }
+            if($old_host_list != '') $old_host_list .= ',';
+            $old_host_list .= 'localhost';
+            
+            if($data['old']['database_user_id']) {
+                $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");            
+                $drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_user_id'], $old_host_list);
+                if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+                if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+            }
+            if($data['old']['database_ro_user_id']) {
+                $old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_ro_user_id']) . "'");            
+                $drop_or_revoke_user = $this->drop_or_revoke_user($data['old']['database_id'], $data['old']['database_ro_user_id'], $old_host_list);
+                if($drop_or_revoke_user['drop_hosts'] != '') $this->process_host_list('DROP', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['drop_hosts'], $link);
+                if($drop_or_revoke_user['revoke_hosts'] != '') $this->process_host_list('REVOKE', $data['old']['database_name'], $old_db_user['database_user'], $old_db_user['database_password'], $drop_or_revoke_user['revoke_hosts'], $link);
+            }
+            
+            
 			if($link->query('DROP DATABASE '.$link->escape_string($data['old']['database_name']))) {
 				$app->log('Dropping MySQL database: '.$data['old']['database_name'],LOGLEVEL_DEBUG);
 			} else {
@@ -503,6 +533,8 @@
         $host_list = array('localhost');
         // get all databases this user was active for
         $db_list = $app->db->queryAllRecords("SELECT `remote_access`, `remote_ips` FROM `web_database` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
+        if(count($db_list) < 1) return; // nothing to do on this server for this db user
+        
         foreach($db_list as $database) {
             if($database['remote_access'] != 'y') continue;
             
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 2c347f4..dd9bcd7 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -99,7 +99,7 @@
 		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		if ($web_config['CA_path']!='' && !file_exists($web_config['CA_path'].'/openssl.cnf'))
-			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.conf',LOGLEVEL_ERROR);	
+			$app->log("CA path error, file does not exist:".$web_config['CA_path'].'/openssl.cnf',LOGLEVEL_ERROR);	
 		
 		//* Only vhosts can have a ssl cert
 		if($data["new"]["type"] != "vhost" && $data["new"]["type"] != "vhostsubdomain") return;
@@ -243,6 +243,7 @@
 			if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]);
 			//if(trim($data["new"]["ssl_bundle"]) != '') $app->system->file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
 			if(trim($data["new"]["ssl_key"]) != '') $app->system->file_put_contents($key_file2,$data["new"]["ssl_key"]);
+			$app->system->chmod($key_file2,0400);
 			
 			// for nginx, bundle files have to be appended to the certificate file
 			if(trim($data["new"]["ssl_bundle"]) != ''){				
@@ -678,6 +679,9 @@
 			}
 		}
 
+		//* add the nginx user to the client group if this is a vhost and security level is set to high, no matter if this is an insert or update and regardless of set_folder_permissions_on_update
+		if($data['new']['type'] == 'vhost' && $web_config['security_level'] == 20) $app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user']));
+		
 		//* If the security level is set to high
 		if(($this->action == 'insert' && $data['new']['type'] == 'vhost') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhost')) {
 		
@@ -716,13 +720,10 @@
 					//* add the nginx user to the client group in the chroot environment
 					$tmp_groupfile = $app->system->server_conf['group_datei'];
 					$app->system->server_conf['group_datei'] = $web_config['website_basedir'].'/etc/group';
-					$app->system->add_user_to_group($groupname, escapeshellcmd($web_config['user']));
+					$app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user']));
 					$app->system->server_conf['group_datei'] = $tmp_groupfile;
 					unset($tmp_groupfile);
 				}
-
-				//* add the nginx user to the client group
-				$app->system->add_user_to_group($groupname, escapeshellcmd($web_config['nginx_user']));
 				
 				//* Chown all default directories
 				$app->system->chown($data['new']['document_root'],'root');
@@ -937,6 +938,20 @@
 		
 		// backwards compatibility; since ISPConfig 3.0.5, the PHP mode for nginx is called 'php-fpm' instead of 'fast-cgi'. The following line makes sure that old web sites that have 'fast-cgi' in the database still get PHP-FPM support.
 		if($vhost_data['php'] == 'fast-cgi') $vhost_data['php'] = 'php-fpm';
+		
+		// Custom rewrite rules
+		$final_rewrite_rules = array();
+		$custom_rewrite_rules = $data['new']['rewrite_rules'];
+		// Make sure we only have Unix linebreaks
+		$custom_rewrite_rules = str_replace("\r\n", "\n", $custom_rewrite_rules);
+		$custom_rewrite_rules = str_replace("\r", "\n", $custom_rewrite_rules);
+		$custom_rewrite_rule_lines = explode("\n", $custom_rewrite_rules);
+		if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){
+			foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){
+				$final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
+			}
+		}
+		$tpl->setLoop('rewrite_rules', $final_rewrite_rules);
 		
 		// Custom nginx directives
 		$final_nginx_directives = array();
@@ -1525,7 +1540,8 @@
 			$nginx_online_status_before_restart = $this->_checkTcp('localhost',80);
 			$app->log('nginx status is: '.$nginx_online_status_before_restart,LOGLEVEL_DEBUG);
 
-			$app->services->restartService('httpd','restart');
+			$retval = $app->services->restartService('httpd','restart'); // $retval['retval'] is 0 on success and > 0 on failure
+			$app->log('nginx restart return value is: '.$retval['retval'],LOGLEVEL_DEBUG);
 			
 			// wait a few seconds, before we test the apache status again
 			sleep(2);
@@ -1533,9 +1549,18 @@
 			//* Check if nginx restarted successfully if it was online before
 			$nginx_online_status_after_restart = $this->_checkTcp('localhost',80);
 			$app->log('nginx online status after restart is: '.$nginx_online_status_after_restart,LOGLEVEL_DEBUG);
-			if($nginx_online_status_before_restart && !$nginx_online_status_after_restart) {
-				$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);
+			if($nginx_online_status_before_restart && !$nginx_online_status_after_restart || $retval['retval'] > 0) { 
+				$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].'. Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);
+				if(is_array($retval['output']) && !empty($retval['output'])){
+					$app->log('Reason for nginx restart failure: '.implode("\n", $retval['output']),LOGLEVEL_WARN);
+				} else {
+					// if no output is given, check again
+					exec('nginx -t 2>&1', $tmp_output, $tmp_retval);
+					if($tmp_retval > 0 && is_array($tmp_output) && !empty($tmp_output)) $app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output),LOGLEVEL_WARN);
+					unset($tmp_output, $tmp_retval);
+				}
 				$app->system->copy($vhost_file,$vhost_file.'.err');
+				
 				if(is_file($vhost_file.'~')) {
 					//* Copy back the last backup file
 					$app->system->copy($vhost_file.'~',$vhost_file);
@@ -1581,12 +1606,7 @@
 			}
 		} else {
 			//* We do not check the nginx config after changes (is faster)
-			if($nginx_chrooted) {
-				$app->services->restartServiceDelayed('httpd','reload');
-			} else {
-				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
-			}
+			$app->services->restartServiceDelayed('httpd','reload');
 		}
 		
 		//* The vhost is written and apache has been restarted, so we 
@@ -2400,6 +2420,12 @@
 		if(is_array($lines) && !empty($lines)){
 			$linecount = sizeof($lines);
 			for($h=0;$h<$linecount;$h++){
+				// remove comments
+				if(substr(trim($lines[$h]),0,1) == '#'){
+					unset($lines[$h]);
+					continue;
+				}
+				
 				$lines[$h] = rtrim($lines[$h]);
 				/*
 				if(substr(ltrim($lines[$h]), 0, 8) == 'location' && strpos($lines[$h], '{') !== false && strpos($lines[$h], ';') !== false){
@@ -2526,8 +2552,10 @@
 				$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
 			}
 			
-			$this->_exec('groupdel client'.$client_id);
-			$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
+			if($app->system->is_group('client'.$client_id)){
+				$this->_exec('groupdel client'.$client_id);
+				$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
+			}
 		}
 		
 	}
diff --git a/server/scripts/run-getmail.sh b/server/scripts/run-getmail.sh
index 0ab8cc5..81f897a 100644
--- a/server/scripts/run-getmail.sh
+++ b/server/scripts/run-getmail.sh
@@ -14,7 +14,7 @@
 else
   touch /tmp/.getmail_lock
   if [ "$rcfiles" != "" ]; then
-    /usr/bin/getmail -v -g /etc/getmail $rcfiles
+    /usr/bin/getmail -v -g /etc/getmail $rcfiles || true
   fi
   rm -f /tmp/.getmail_lock
 fi
diff --git a/server/server.php b/server/server.php
index 1cdcb85..38baa77 100644
--- a/server/server.php
+++ b/server/server.php
@@ -62,10 +62,20 @@
 
 	// Set the loglevel
 	$conf['log_priority'] = intval($conf['serverconfig']['server']['loglevel']);
+	
+	// Set level from which admin should be notified by email
+	if(!isset($conf['serverconfig']['server']['admin_notify_events']) || $conf['serverconfig']['server']['admin_notify_events'] == '') $conf['serverconfig']['server']['admin_notify_events'] = 3;
+	$conf['admin_notify_priority'] = intval($conf['serverconfig']['server']['admin_notify_events']);
 
 	// we do not need this variable anymore
 	unset($server_db_record);
 	
+	// retrieve admin email address for notifications
+	$sys_ini = $app->dbmaster->queryOneRecord("SELECT * FROM sys_ini WHERE sysini_id = 1");
+	$conf['sys_ini'] = $app->ini_parser->parse_ini_string(stripslashes($sys_ini['config']));
+	$conf['admin_mail'] = $conf['sys_ini']['mail']['admin_mail'];
+	unset($sys_ini);
+	
 	/*
 	 * Save the rescue-config, maybe we need it (because the database is down)
 	 */

--
Gitblit v1.9.1