diff --git a/helper_scripts/dns_export_to_bind.php b/helper_scripts/dns_export_to_bind.php
index ea5adf94c00b0695a7a5a566114e5d90c7f67911..6a3f59035a5d68810a957fab77e7800220985a8e 100644
--- a/helper_scripts/dns_export_to_bind.php
+++ b/helper_scripts/dns_export_to_bind.php
@@ -2,103 +2,103 @@
 $host="IP_ADDRESS";
 $user="USERNAME";
 $password="PASSWORD";
-mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_connect($host, $user, $password) or die(mysql_error());
 mysql_select_db("dbispconfig");
 $result = "";
 $result = mysql_query("SELECT id,origin,ns,ttl,mbox,serial,refresh,retry,expire,minimum FROM dns_soa;");
 function hostname2ipfunktion($tmp1, $timeout = 1)
-        {
-                if ($tmp1 == 0)
-                {
-                $query = `nslookup -timeout=$timeout -retry=0 $tmp1`;
-                if(preg_match('/\nAddress: (.*)\n/', $query, $matches))
-                return trim($matches[1]);
-                return $tmp1;
-                }
-        }
+{
+	if ($tmp1 == 0)
+	{
+		$query = `nslookup -timeout=$timeout -retry=0 $tmp1`;
+		if(preg_match('/\nAddress: (.*)\n/', $query, $matches))
+			return trim($matches[1]);
+		return $tmp1;
+	}
+}
 
 $serialsearch=date("Ymd");
 $resultx12 = mysql_query("SELECT origin,serial FROM dns_soa WHERE serial LIKE '$serialsearch%' ORDER BY origin ASC;");
 while ($rowx12=mysql_fetch_array($resultx12)) {
-        $zone=substr($rowx12["origin"],0,-1);
-        $filename_x1="/var/cache/bind/".$zone;
-        if (file_exists($filename_x1)) {
-        $serialvergleich[$zone]=exec("grep \";Serial\" /var/cache/bind/$zone |cut -d\" \" -f1 | awk '{print $1}'");
- }
+	$zone=substr($rowx12["origin"], 0, -1);
+	$filename_x1="/var/cache/bind/".$zone;
+	if (file_exists($filename_x1)) {
+		$serialvergleich[$zone]=exec("grep \";Serial\" /var/cache/bind/$zone |cut -d\" \" -f1 | awk '{print $1}'");
+	}
 }
 
 while($row = mysql_fetch_array($result))
-        {
-### Hier ALLES Aktivieren bei Primary Nameserver TEIL 1 #################################################################################
-        $varx11=substr($row["origin"],0,-1);
-        $filename="/var/cache/bind/".$varx11;
-        if (file_exists($filename)) {
-        unlink("/var/cache/bind/$varx11");
-        }
-        $arr1[$x11]="zone \"$varx11\" in { type master; file \"$varx11\"; };\n";
-        $x11=$x11+1;
-        $result2 = mysql_query("select name,type,aux,data from dns_rr where zone=$row[id] and active='Y' ORDER BY name ASC;");
-        $arr3[0]="\$TTL ".$row['ttl']."\n@ IN SOA ".$row['ns']." ".$row['mbox']." (\n           ".$row['serial']." ;Serial\n"."         ".$row['refresh']." ;Refresh\n"."               ".$row['retry']." ;Retry\n"."           ".$row['expire']." ;Expire\n"."         ".$row['minimum']." ) ;Minimum\n\n";
+{
+	//## Hier ALLES Aktivieren bei Primary Nameserver TEIL 1 #################################################################################
+	$varx11=substr($row["origin"], 0, -1);
+	$filename="/var/cache/bind/".$varx11;
+	if (file_exists($filename)) {
+		unlink("/var/cache/bind/$varx11");
+	}
+	$arr1[$x11]="zone \"$varx11\" in { type master; file \"$varx11\"; };\n";
+	$x11=$x11+1;
+	$result2 = mysql_query("select name,type,aux,data from dns_rr where zone=$row[id] and active='Y' ORDER BY name ASC;");
+	$arr3[0]="\$TTL ".$row['ttl']."\n@ IN SOA ".$row['ns']." ".$row['mbox']." (\n           ".$row['serial']." ;Serial\n"."         ".$row['refresh']." ;Refresh\n"."               ".$row['retry']." ;Retry\n"."           ".$row['expire']." ;Expire\n"."         ".$row['minimum']." ) ;Minimum\n\n";
 
-                $xx1=1;
-                while($row2 = mysql_fetch_row($result2))
-                {
-                $arr2[$xx1]=$row2['0']." IN ".$row2['1']." ";
+	$xx1=1;
+	while($row2 = mysql_fetch_row($result2))
+	{
+		$arr2[$xx1]=$row2['0']." IN ".$row2['1']." ";
 
-                        if ($row2['2']>0)
-                        {
-                        $arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n";
-                        }
-                        else
-                        {
-                        $arr3[$xx1]=$arr2[$xx1].$row2['3']."\n";
-                        }
-                $xx1=$xx1+1;
-                }
-        $f = fopen("/var/cache/bind/$varx11", "a+");
-        foreach($arr3 as $values) fputs($f, $values);
-        fclose($f);
-        $arr2=array();
-        $arr3=array();
-### ENDE Primärer Nameserver TEIL 2 #####################################################################################################
+		if ($row2['2']>0)
+		{
+			$arr3[$xx1]=$arr2[$xx1].$row2['2']." ".$row2['3']."\n";
+		}
+		else
+		{
+			$arr3[$xx1]=$arr2[$xx1].$row2['3']."\n";
+		}
+		$xx1=$xx1+1;
+	}
+	$f = fopen("/var/cache/bind/$varx11", "a+");
+	foreach($arr3 as $values) fputs($f, $values);
+	fclose($f);
+	$arr2=array();
+	$arr3=array();
+	//## ENDE Primärer Nameserver TEIL 2 #####################################################################################################
 
-### Hier ALLES Aktivieren bei Secondary Nameserver ######################################################################################
-#       $tmp1 = substr($row["ns"],0,-1);
-#       $tmp2 = substr($row["origin"],0,-1);
+	//## Hier ALLES Aktivieren bei Secondary Nameserver ######################################################################################
+	//       $tmp1 = substr($row["ns"],0,-1);
+	//       $tmp2 = substr($row["origin"],0,-1);
 
-#       if (!isset($dnscache[$tmp1])) $nsip = hostname2ipfunktion($tmp1) ;
-#       else $nsip=$dnscache[$tmp1] ;
+	//       if (!isset($dnscache[$tmp1])) $nsip = hostname2ipfunktion($tmp1) ;
+	//       else $nsip=$dnscache[$tmp1] ;
 
-#               if ($nsip == $tmp1) 
-#               {
-#               echo "$tmp2 $tmp1 Not a valid Nameserver";
-#               echo "\n";
-#               }
-#               else 
-#               {
-#               $dnscache[$tmp1]=$nsip;
-#               $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n";
-#               $x11=$x11+1;
-#               }
-### ENDE Secondary Nameserver ###########################################################################################################
-        }
+	//               if ($nsip == $tmp1)
+	//               {
+	//               echo "$tmp2 $tmp1 Not a valid Nameserver";
+	//               echo "\n";
+	//               }
+	//               else
+	//               {
+	//               $dnscache[$tmp1]=$nsip;
+	//               $arr1[$x11]="zone \"".$tmp2."\" in { type slave; file \"".$tmp2."\"; masters {".$nsip."; }; };\n";
+	//               $x11=$x11+1;
+	//               }
+	//## ENDE Secondary Nameserver ###########################################################################################################
+}
 
-unlink ("/etc/bind/named.conf.local");
+unlink("/etc/bind/named.conf.local");
 $fx = fopen("/etc/bind/named.conf.local", "a+");
 foreach($arr1 as $values) fputs($fx, $values);
 fclose($fx);
 system("rndc reconfig >/dev/null 2>&1");
 
-### ANFANG Primärer Namerserver TEIL 2 ##################################################################################################
+//## ANFANG Primärer Namerserver TEIL 2 ##################################################################################################
 $serialsearch=date("Ymd");
 $resultx13 = mysql_query("SELECT origin,serial FROM dns_soa WHERE serial LIKE '$serialsearch%' ORDER BY origin ASC;");
 while ($rowx13=mysql_fetch_array($resultx13)) {
-        $serial_ist=($rowx13["serial"]);
-        $zone=substr($rowx13["origin"],0,-1);
-#       echo "zone: ".$zone." ist: ".$serial_ist." vergleich: ".$serialvergleich[$zone]."\n";
-        if ($serialvergleich[$zone] != $serial_ist) {
-        $reload=system("rndc reload $zone >/dev/null 2>&1");
-        }
+	$serial_ist=($rowx13["serial"]);
+	$zone=substr($rowx13["origin"], 0, -1);
+	//       echo "zone: ".$zone." ist: ".$serial_ist." vergleich: ".$serialvergleich[$zone]."\n";
+	if ($serialvergleich[$zone] != $serial_ist) {
+		$reload=system("rndc reload $zone >/dev/null 2>&1");
+	}
 }
-### ENDE Primärer NamerserverTEIL 2 ######################################################################################################
-?>
\ No newline at end of file
+//## ENDE Primärer NamerserverTEIL 2 ######################################################################################################
+?>
diff --git a/helper_scripts/dns_export_to_bind_retrans_daily.php b/helper_scripts/dns_export_to_bind_retrans_daily.php
index 39faf14fe6dd55da98aba5cc19d05adbbe6ae451..a571367f690b760703d5dbe3e56bc56480c42378 100644
--- a/helper_scripts/dns_export_to_bind_retrans_daily.php
+++ b/helper_scripts/dns_export_to_bind_retrans_daily.php
@@ -2,13 +2,13 @@
 $host="IP_ADDRESS";
 $user="USERNAME";
 $password="PASSWORD";
-mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_connect($host, $user, $password) or die(mysql_error());
 mysql_select_db("dbispconfig");
 $result = "";
 $result = mysql_query("SELECT origin FROM dns_soa ORDER BY origin ASC;");
 while($row = mysql_fetch_array($result))
 {
-        $zone=substr($row["origin"],0,-1);
-        system("rndc retransfer ".$zone);
+	$zone=substr($row["origin"], 0, -1);
+	system("rndc retransfer ".$zone);
 }
-?>
\ No newline at end of file
+?>
diff --git a/helper_scripts/mydns_to_powerdns_migration.php b/helper_scripts/mydns_to_powerdns_migration.php
index 9c6526b972973cb407a03bd533fe05d92bd9ab8b..ffe9e4ae86aa846d4c988990fe370d265d9193fc 100644
--- a/helper_scripts/mydns_to_powerdns_migration.php
+++ b/helper_scripts/mydns_to_powerdns_migration.php
@@ -2,15 +2,15 @@
 $host="localhost";
 $user="root";
 $password="MYSQL-ROOT-PASSWD";
-mysql_connect($host,$user,$password) or die(mysql_error());
+mysql_connect($host, $user, $password) or die(mysql_error());
 
 mysql_select_db("dbispconfig");
 $sql1 = mysql_query("SELECT id, substr(origin,1, LENGTH(origin)-1) AS origin, substr(ns,1, LENGTH(ns)-1) AS ns, substr(mbox,1, LENGTH(mbox)-1) AS mbox,ttl FROM dns_soa order by id asc;");
 mysql_select_db("powerdns");
 while($row1 = mysql_fetch_array($sql1))
 {
-mysql_query("INSERT INTO domains (id,name,type,ispconfig_id) values ('$row1[id]','$row1[origin]','NATIVE','$row1[id]');");
-mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row1[id]','$row1[origin]','$row1[ns] $row1[mbox] 0','$row1[id]','SOA','$row1[ttl]','0','1260446221');");
+	mysql_query("INSERT INTO domains (id,name,type,ispconfig_id) values ('$row1[id]','$row1[origin]','NATIVE','$row1[id]');");
+	mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row1[id]','$row1[origin]','$row1[ns] $row1[mbox] 0','$row1[id]','SOA','$row1[ttl]','0','1260446221');");
 }
 
 mysql_select_db("dbispconfig");
@@ -18,44 +18,44 @@ $sql2 = mysql_query("SELECT id,zone,name,data,aux,ttl,type FROM dns_rr order by
 mysql_select_db("powerdns");
 while($row2 = mysql_fetch_array($sql2))
 {
-if (strlen($row2['name']))
-{
-$file1=substr($row2['data'], -1);
-if ($file1==".")
-{
-$text = $row2['data'];
-$laenge = strlen($row2['data'])-1;
-$file2 = substr($text, 0,strlen($text)-1);
-}
-else
-{
-$file2=$row2['data'];
-}
-mysql_select_db("dbispconfig");
-$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
-$row3 = mysql_fetch_array($sql3);
-mysql_select_db("powerdns");
-mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row2[name].$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
-}
-else
-{
-$file1=substr($row2['data'], -1);
-if ($file1==".")
-{
-$text = $row2['data'];
-$laenge = strlen($row2['data'])-1;
-$file2 = substr($text, 0,strlen($text)-1);
-}
-else
-{
-$file2=$row2['data'];
-}
-mysql_select_db("dbispconfig");
-$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
-$row3 = mysql_fetch_array($sql3);
-mysql_select_db("powerdns");
-mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
-}
+	if (strlen($row2['name']))
+	{
+		$file1=substr($row2['data'], -1);
+		if ($file1==".")
+		{
+			$text = $row2['data'];
+			$laenge = strlen($row2['data'])-1;
+			$file2 = substr($text, 0, strlen($text)-1);
+		}
+		else
+		{
+			$file2=$row2['data'];
+		}
+		mysql_select_db("dbispconfig");
+		$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
+		$row3 = mysql_fetch_array($sql3);
+		mysql_select_db("powerdns");
+		mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row2[name].$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
+	}
+	else
+	{
+		$file1=substr($row2['data'], -1);
+		if ($file1==".")
+		{
+			$text = $row2['data'];
+			$laenge = strlen($row2['data'])-1;
+			$file2 = substr($text, 0, strlen($text)-1);
+		}
+		else
+		{
+			$file2=$row2['data'];
+		}
+		mysql_select_db("dbispconfig");
+		$sql3 = mysql_query("SELECT substr(origin,1, LENGTH(origin)-1) AS origin FROM dns_soa where id=$row2[zone];");
+		$row3 = mysql_fetch_array($sql3);
+		mysql_select_db("powerdns");
+		mysql_query("INSERT INTO records (domain_id,name,content,ispconfig_id,type,ttl,prio,change_date) values ('$row2[zone]','$row3[origin]','$file2','$row2[id]','$row2[type]','$row2[ttl]','$row2[aux]','1260446221');");
+	}
 }
 
 mysql_select_db("powerdns");
@@ -63,8 +63,8 @@ $sql4 = mysql_query("SELECT records.id,records.content,records.type,domains.name
 
 while($row4 = mysql_fetch_array($sql4))
 {
-mysql_query("UPDATE records SET content = '$row4[content].$row4[name]' where id='$row4[id]';");
+	mysql_query("UPDATE records SET content = '$row4[content].$row4[name]' where id='$row4[id]';");
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/helper_scripts/recreate_webalizer_stats.php b/helper_scripts/recreate_webalizer_stats.php
index 2663bc26f6abdd33ff8092dd468b51892f672209..fbaef38097d01009ac947755644fbf20f17803c0 100644
--- a/helper_scripts/recreate_webalizer_stats.php
+++ b/helper_scripts/recreate_webalizer_stats.php
@@ -1,39 +1,39 @@
 <?php
 
-#######################################################################################################
+//######################################################################################################
 // Re-Create webalizer statistics
-#######################################################################################################
+//######################################################################################################
 
 
 $sql = "SELECT domain_id, domain, document_root FROM web_domain WHERE server_id = ".$conf["server_id"];
 $records = $app->db->queryAllRecords($sql);
 foreach($records as $rec) {
-$domain = escapeshellcmd($rec["domain"]);
-$logdir = escapeshellcmd($rec["document_root"].'/log');
-$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
-$webalizer = '/usr/bin/webalizer';
-
-$webalizer_conf_main = '/etc/webalizer/webalizer.conf';
-$webalizer_conf = escapeshellcmd($rec["document_root"].'/log/webalizer.conf');
-exec("rm -rf $webalizer_conf");
-if(!@is_file($webalizer_conf)) {
-exec("cp $webalizer_conf_main $webalizer_conf");
-
-setConfigVar($webalizer_conf, 'Incremental', 'yes');
-setConfigVar($webalizer_conf, 'IncrementalName', $logdir.'/webalizer.current');
-setConfigVar($webalizer_conf, 'HistoryName', $logdir.'/webalizer.hist');
-}
+	$domain = escapeshellcmd($rec["domain"]);
+	$logdir = escapeshellcmd($rec["document_root"].'/log');
+	$statsdir = escapeshellcmd($rec["document_root"].'/web/stats');
+	$webalizer = '/usr/bin/webalizer';
+
+	$webalizer_conf_main = '/etc/webalizer/webalizer.conf';
+	$webalizer_conf = escapeshellcmd($rec["document_root"].'/log/webalizer.conf');
+	exec("rm -rf $webalizer_conf");
+	if(!@is_file($webalizer_conf)) {
+		exec("cp $webalizer_conf_main $webalizer_conf");
+
+		setConfigVar($webalizer_conf, 'Incremental', 'yes');
+		setConfigVar($webalizer_conf, 'IncrementalName', $logdir.'/webalizer.current');
+		setConfigVar($webalizer_conf, 'HistoryName', $logdir.'/webalizer.hist');
+	}
 
-if(!@is_dir($statsdir)) mkdir($statsdir);
+	if(!@is_dir($statsdir)) mkdir($statsdir);
 
 
-echo "Remove stats dir $statsdir ...\n";
-exec("rm -rf $statsdir/*");
+	echo "Remove stats dir $statsdir ...\n";
+	exec("rm -rf $statsdir/*");
 
-echo "Re-Create stats for $domain...\n";
-exec("for logfile in $logdir/*access*; do\n$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir ".'$logfile'."\ndone");
-echo "done.\n";
+	echo "Re-Create stats for $domain...\n";
+	exec("for logfile in $logdir/*access*; do\n$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir ".'$logfile'."\ndone");
+	echo "done.\n";
 }
 
 die("finished.\n");
-?>
\ No newline at end of file
+?>
diff --git a/install/autoupdate.php b/install/autoupdate.php
index 52cab345d579b8dbf0c1c0b44b8fcb0111cda2f3..c716d1a76b4af2c5a5ae2b6712ec2696f251ab99 100644
--- a/install/autoupdate.php
+++ b/install/autoupdate.php
@@ -41,7 +41,7 @@ error_reporting(E_ALL|E_STRICT);
 if (!file_exists('autoupdate')) {
 
 	//** The banner on the command line
-	echo "\n\n".str_repeat('-',80)."\n";
+	echo "\n\n".str_repeat('-', 80)."\n";
 	echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -50,19 +50,19 @@ if (!file_exists('autoupdate')) {
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-	echo "\n".str_repeat('-',80)."\n";
+	echo "\n".str_repeat('-', 80)."\n";
 	echo "\n\n>>This script is for internal use only! Please use update.php!  \n\n";
 	exit;
 }
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the library with the basic updater functions
-require_once('lib/update.lib.php');
+require_once 'lib/update.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -75,16 +75,16 @@ define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../'));
 //** Get distribution identifier
 $dist = get_distname();
 
-include_once("/usr/local/ispconfig/server/lib/config.inc.php");
+include_once "/usr/local/ispconfig/server/lib/config.inc.php";
 $conf_old = $conf;
 unset($conf);
 
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
@@ -124,22 +124,22 @@ $inst->is_update = true;
 $inst->find_installed_apps();
 
 //** Initialize the MySQL server connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 
 //** Database update is a bit brute force and should be rebuild later ;)
 
 /*
  * Try to read the DB-admin settings
  */
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
-include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf");
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
+include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
 $conf["mysql"]["admin_user"] = $clientdb_user;
 $conf["mysql"]["admin_password"] = $clientdb_password;
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
 
 //** There is a error if user for mysql admin_password if empty
 if( empty($conf["mysql"]["admin_password"]) ) {
@@ -147,7 +147,7 @@ if( empty($conf["mysql"]["admin_password"]) ) {
 }
 
 //** Test mysql root connection
-if(!@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["mysql"]["admin_password"])) {
+if(!@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
 	die("internal error - MYSQL-Root passord wrong");
 }
 
@@ -157,7 +157,7 @@ if(!@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["my
 checkDbHealth();
 
 /*
- *  Prepare the dump of the database 
+ *  Prepare the dump of the database
 */
 prepareDBDump();
 
@@ -196,7 +196,7 @@ if($conf['services']['mail'] == true) {
 	//** Configure postfix
 	swriteln('Configuring Postfix');
 	$inst->configure_postfix('dont-create-certs');
-	
+
 	//** Configure mailman
 	swriteln('Configuring Mailman');
 	$inst->configure_mailman('update');
@@ -217,7 +217,7 @@ if($conf['services']['mail'] == true) {
 		//** Configure PAM
 		swriteln('Configuring PAM');
 		$inst->configure_pam();
-		
+
 		//* Configure courier
 		swriteln('Configuring Courier');
 		$inst->configure_courier();
@@ -261,7 +261,7 @@ if($conf['services']['web']) {
 		//** Configure Apache
 		swriteln('Configuring Apache');
 		$inst->configure_apache();
-       
+
 		//** Configure vlogger
 		swriteln('Configuring vlogger');
 		$inst->configure_vlogger();
@@ -270,7 +270,7 @@ if($conf['services']['web']) {
 		swriteln('Configuring nginx');
 		$inst->configure_nginx();
 	}
-	
+
 	//** Configure apps vhost
 	swriteln('Configuring Apps vhost');
 	$inst->configure_apps_vhost();
diff --git a/install/dist/conf/centos52.conf.php b/install/dist/conf/centos52.conf.php
index 1221a74e6c1e8974f4c15950668c73687a8edd2b..12044d3ce07d36d42e166c961c4939b4d82ba01f 100644
--- a/install/dist/conf/centos52.conf.php
+++ b/install/dist/conf/centos52.conf.php
@@ -63,14 +63,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/centos53.conf.php b/install/dist/conf/centos53.conf.php
index 1221a74e6c1e8974f4c15950668c73687a8edd2b..12044d3ce07d36d42e166c961c4939b4d82ba01f 100644
--- a/install/dist/conf/centos53.conf.php
+++ b/install/dist/conf/centos53.conf.php
@@ -63,14 +63,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/debian40.conf.php b/install/dist/conf/debian40.conf.php
index 7bdd238498d554ca780edfdb43875b34b0ff7083..3e9fe350065472b2d0a13613e2ad40ed8961c625 100644
--- a/install/dist/conf/debian40.conf.php
+++ b/install/dist/conf/debian40.conf.php
@@ -65,14 +65,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/debian60.conf.php b/install/dist/conf/debian60.conf.php
index 8eb3a2ca3ae0bcceab885d342a00b12975c2718a..a3819966b9dc640d42723450d3869f5905c64639 100644
--- a/install/dist/conf/debian60.conf.php
+++ b/install/dist/conf/debian60.conf.php
@@ -65,14 +65,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
@@ -223,4 +223,4 @@ $conf['cron']['crontab_dir'] = '/etc/cron.d';
 $conf['cron']['wget'] = '/usr/bin/wget';
 
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/conf/fedora9.conf.php b/install/dist/conf/fedora9.conf.php
index c988d3f3cdfd1cf75ba8e86140e3033056e82379..80539a78593827e76bb7828ee684833f557b9dd7 100644
--- a/install/dist/conf/fedora9.conf.php
+++ b/install/dist/conf/fedora9.conf.php
@@ -63,14 +63,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/gentoo.conf.php b/install/dist/conf/gentoo.conf.php
index 2a0471a5205088cea6ee54bd8d9659e1c3c044cd..2955cfa71dd391743f705449ea6849428005a367 100644
--- a/install/dist/conf/gentoo.conf.php
+++ b/install/dist/conf/gentoo.conf.php
@@ -63,14 +63,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* SuPHP
 $conf['suphp']['config_file'] = '/etc/suphp.conf';
@@ -85,7 +85,7 @@ $conf['apache']['config_dir'] = '/etc/apache2';
 $conf['apache']['config_file'] = $conf['apache']['config_dir'] .'/httpd.conf';
 $conf['apache']['ssl_dir'] = '/etc/ssl/apache2';
 $conf['apache']['vhost_conf_dir'] = $conf['apache']['config_dir'] . '/vhosts.d';
-$conf['apache']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_dir']; 
+$conf['apache']['vhost_conf_enabled_dir'] = $conf['apache']['vhost_conf_dir'];
 $conf['apache']['vhost_default'] = '00_default_vhost.conf';
 $conf['apache']['vhost_port'] = '8080';
 $conf['apache']['php_ini_path_apache'] = '/etc/php/apache2-php5/php.ini';
@@ -154,7 +154,7 @@ $conf['dovecot']['init_script'] = 'dovecot';
 //* SASL
 $conf['saslauthd']['installed'] = false; // will be detected automatically during installation
 $conf['saslauthd']['config_file'] = '/etc/conf.d/saslauthd';
-$conf['saslauthd']['config_dir'] = '/etc/sasl2'; 
+$conf['saslauthd']['config_dir'] = '/etc/sasl2';
 $conf['saslauthd']['init_script'] = 'saslauthd';
 
 //* Amavisd
diff --git a/install/dist/conf/opensuse110.conf.php b/install/dist/conf/opensuse110.conf.php
index fd8ef65439bb1d36adcaf19751291a2610ddff1e..e389c3b2a0ea727d619b453c477ef0a8f0964122 100644
--- a/install/dist/conf/opensuse110.conf.php
+++ b/install/dist/conf/opensuse110.conf.php
@@ -63,14 +63,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/conf/opensuse112.conf.php b/install/dist/conf/opensuse112.conf.php
index 96a37d6a57561a02127faf1e5eb310029d317bad..fa0504652e9e75d908186507a6c69c67c271f4b9 100644
--- a/install/dist/conf/opensuse112.conf.php
+++ b/install/dist/conf/opensuse112.conf.php
@@ -63,14 +63,14 @@ $conf['mysql']['admin_user'] = 'root';
 $conf['mysql']['admin_password'] = '';
 $conf['mysql']['charset'] = 'utf8';
 $conf['mysql']['ispconfig_user'] = 'ispconfig';
-$conf['mysql']['ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['ispconfig_password'] = md5(uniqid(rand()));
 $conf['mysql']['master_slave_setup'] = 'n';
 $conf['mysql']['master_host'] = '';
 $conf['mysql']['master_database'] = 'dbispconfig';
 $conf['mysql']['master_admin_user'] = 'root';
 $conf['mysql']['master_admin_password'] = '';
 $conf['mysql']['master_ispconfig_user'] = '';
-$conf['mysql']['master_ispconfig_password'] = md5 (uniqid (rand()));
+$conf['mysql']['master_ispconfig_password'] = md5(uniqid(rand()));
 
 //* Apache
 $conf['apache']['installed'] = false; // will be detected automatically during installation
diff --git a/install/dist/lib/centos52.lib.php b/install/dist/lib/centos52.lib.php
index a7e4f945c29e6b9f6682f6654e976984bbd4f802..f4aa4dfe9d676663b31ab348e4b82de150b94793 100644
--- a/install/dist/lib/centos52.lib.php
+++ b/install/dist/lib/centos52.lib.php
@@ -58,26 +58,26 @@ class installer extends installer_dist {
 				}
 			}
 		}
-		
+
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
-        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);
-		
+
+		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);
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
 
 		$virtual_domains = '';
@@ -87,13 +87,13 @@ class installer extends installer_dist {
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -109,55 +109,55 @@ class installer extends installer_dist {
 
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$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')) 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 = 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);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		$content = str_replace('{hostname}',$conf['hostname'],$content);
-		$content = str_replace('/var/spool/amavisd/clamd.sock','/tmp/clamd.socket',$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$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);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		$content = str_replace('/var/spool/amavisd/clamd.sock', '/tmp/clamd.socket', $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$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);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
-		removeLine('/etc/sysconfig/freshclam','FRESHCLAM_DELAY=disabled-warn   # REMOVE ME',1);
-		replaceLine('/etc/freshclam.conf','Example','# Example',1);
-		
-		
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+
+
 	}
 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/centos53.lib.php b/install/dist/lib/centos53.lib.php
index 91f1746c784d77f1b92c85b5da1bc562e222e9ff..93083b518865b19fd624f6354959f19e25760d33 100644
--- a/install/dist/lib/centos53.lib.php
+++ b/install/dist/lib/centos53.lib.php
@@ -58,26 +58,26 @@ class installer extends installer_dist {
 				}
 			}
 		}
-		
+
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
-        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);
-		
+
+		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);
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
 
 		$virtual_domains = '';
@@ -87,13 +87,13 @@ class installer extends installer_dist {
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -109,56 +109,56 @@ class installer extends installer_dist {
 
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$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')) 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 = 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);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		$content = str_replace('{hostname}',$conf['hostname'],$content);
-		$content = str_replace('/var/spool/amavisd/clamd.sock','/var/run/clamav/clamd.sock',$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$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);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		$content = str_replace('/var/spool/amavisd/clamd.sock', '/var/run/clamav/clamd.sock', $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$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);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
-		removeLine('/etc/sysconfig/freshclam','FRESHCLAM_DELAY=disabled-warn   # REMOVE ME',1);
-		replaceLine('/etc/freshclam.conf','Example','# Example',1);
-		
-		
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+
+
 	}
 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/debian40.lib.php b/install/dist/lib/debian40.lib.php
index cf8e864e6b00227b6730ef61a6c7aea8595dfe8f..b13b98c654b6437b1c67fb4f18981370e61da3d8 100644
--- a/install/dist/lib/debian40.lib.php
+++ b/install/dist/lib/debian40.lib.php
@@ -33,4 +33,4 @@ class installer extends installer_base {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/debian60.lib.php b/install/dist/lib/debian60.lib.php
index e1be29132be2ea226f984492330d9580ec6da05b..b3887cbd235513c726f07ba3315822359ac7d2b4 100644
--- a/install/dist/lib/debian60.lib.php
+++ b/install/dist/lib/debian60.lib.php
@@ -29,13 +29,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class installer extends installer_base {
-	
+
 	public function configure_dovecot()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['dovecot']['config_dir'];
-		
+
 		//* Configure master.cf and add a line for deliver
 		if(is_file($config_dir.'/master.cf')){
 			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
@@ -45,14 +45,14 @@ class installer extends installer_base {
 		}
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"dovecot/deliver")) {
+		if(!stristr($content, "dovecot/deliver")) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
-		
-		
+
+
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
@@ -61,44 +61,44 @@ class installer extends installer_base {
 			'smtpd_sasl_type = dovecot',
 			'smtpd_sasl_path = private/auth'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* copy dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file($config_dir.'/'.$configfile)){
 			copy($config_dir.'/'.$configfile, $config_dir.'/'.$configfile.'~');
 		}
-		
+
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
-		
+
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            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);
-            }
+			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 {
-            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);
-            }
+			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
 		$configfile = 'dovecot-sql.conf';
 		if(is_file($config_dir.'/'.$configfile)){
@@ -106,32 +106,33 @@ class installer extends installer_base {
 			chmod($config_dir.'/'.$configfile.'~', 0400);
 		}
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf($config_dir.'/'.$configfile, $content);
-		
+
 		chmod($config_dir.'/'.$configfile, 0600);
 		chown($config_dir.'/'.$configfile, 'root');
 		chgrp($config_dir.'/'.$configfile, 'root');
 
 	}
-	
+
 	public function configure_apache() {
 		global $conf;
-		
-		if(file_exists('/etc/apache2/mods-available/fcgid.conf')) replaceLine('/etc/apache2/mods-available/fcgid.conf','MaxRequestLen','MaxRequestLen 15728640',0,1);
-		
+
+		if(file_exists('/etc/apache2/mods-available/fcgid.conf')) replaceLine('/etc/apache2/mods-available/fcgid.conf', 'MaxRequestLen', 'MaxRequestLen 15728640', 0, 1);
+
 		parent::configure_apache();
 	}
 
-    public function configure_fail2ban() {
-	/*
+	public function configure_fail2ban() {
+		/*
         copy('tpl/dovecot-pop3imap.conf.master',"/etc/fail2ban/filter.d/dovecot-pop3imap.conf");
         copy('tpl/dovecot_fail2ban_jail.local.master','/etc/fail2ban/jail.local');
 	*/
-    }
+	}
+
 }
 
 ?>
diff --git a/install/dist/lib/fedora.lib.php b/install/dist/lib/fedora.lib.php
index 5e3ad3fc19d56ca4b0e391a146431021da81443c..ab25741ee9ace42cbd56be625b28ac24eb1b80d0 100644
--- a/install/dist/lib/fedora.lib.php
+++ b/install/dist/lib/fedora.lib.php
@@ -58,7 +58,7 @@ class installer_dist extends installer_base {
 				}
 			}
 		}
-		
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
@@ -69,13 +69,13 @@ class installer_dist extends installer_base {
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -87,90 +87,90 @@ class installer_dist extends installer_base {
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
 
 		wf($full_file_name, $content);
-		
+
 		//* Write virtual_to_transport.sh script
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
+
 		if(is_dir('/etc/mailman')) {
-            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);
+			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);
 		}
-		
+
 		//* Create aliasaes
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
-		
+
 	}
-	
+
 	function configure_postfix($options = '')
-    {
-        global $conf;
+	{
+		global $conf;
 		$cf = $conf['postfix'];
 		$config_dir = $cf['config_dir'];
-        
+
 		if(!is_dir($config_dir)){
-            $this->error("The postfix configuration directory '$config_dir' does not exist.");
-        }
-        
+			$this->error("The postfix configuration directory '$config_dir' does not exist.");
+		}
+
 		//* mysql-virtual_domains.cf
-        $this->process_postfix_config('mysql-virtual_domains.cf');
+		$this->process_postfix_config('mysql-virtual_domains.cf');
 
 		//* mysql-virtual_forwardings.cf
-        $this->process_postfix_config('mysql-virtual_forwardings.cf');
+		$this->process_postfix_config('mysql-virtual_forwardings.cf');
 
 		//* mysql-virtual_mailboxes.cf
-        $this->process_postfix_config('mysql-virtual_mailboxes.cf');
+		$this->process_postfix_config('mysql-virtual_mailboxes.cf');
 
 		//* mysql-virtual_email2email.cf
-        $this->process_postfix_config('mysql-virtual_email2email.cf');
+		$this->process_postfix_config('mysql-virtual_email2email.cf');
 
 		//* mysql-virtual_transports.cf
-        $this->process_postfix_config('mysql-virtual_transports.cf');
+		$this->process_postfix_config('mysql-virtual_transports.cf');
 
 		//* mysql-virtual_recipient.cf
-        $this->process_postfix_config('mysql-virtual_recipient.cf');
+		$this->process_postfix_config('mysql-virtual_recipient.cf');
 
 		//* mysql-virtual_sender.cf
-        $this->process_postfix_config('mysql-virtual_sender.cf');
+		$this->process_postfix_config('mysql-virtual_sender.cf');
 
 		//* mysql-virtual_client.cf
-        $this->process_postfix_config('mysql-virtual_client.cf');
-		
+		$this->process_postfix_config('mysql-virtual_client.cf');
+
 		//* mysql-virtual_relaydomains.cf
-        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
-		
+		$this->process_postfix_config('mysql-virtual_relaydomains.cf');
+
 		//* mysql-virtual_relayrecipientmaps.cf
-        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
+		$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
 
-	//* postfix-dkim
-	$full_file_name=$config_dir.'/tag_as_originating.re';
-	if(is_file($full_file_name)) {
-		copy($full_file_name, $config_dir.$configfile.'~');
-	}
-	wf($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10026');
+		//* postfix-dkim
+		$full_file_name=$config_dir.'/tag_as_originating.re';
+		if(is_file($full_file_name)) {
+			copy($full_file_name, $config_dir.$configfile.'~');
+		}
+		wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10026');
 
-	$full_file_name=$config_dir.'/tag_as_foreign.re';
-	if(is_file($full_file_name)) {
-		copy($full_file_name, $config_dir.$configfile.'~');
-	}
-	wf($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10024');
+		$full_file_name=$config_dir.'/tag_as_foreign.re';
+		if(is_file($full_file_name)) {
+			copy($full_file_name, $config_dir.$configfile.'~');
+		}
+		wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10024');
 
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-                 __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
-		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', 
-                __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
-		
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+
 		//* Creating virtual mail user and group
 		$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
 		if(!is_group($cf['vmail_groupname'])) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -186,7 +186,7 @@ class installer_dist extends installer_base {
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
 		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
-			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
+			$rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
 			}
@@ -195,130 +195,130 @@ class installer_dist extends installer_base {
 		unset($server_ini_array);
 
 		//* These postconf commands will be executed on installation and update
-        $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
-        
+		$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(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
-		
+
 		//* Create the header and body check files
 		touch($config_dir.'/header_checks');
 		touch($config_dir.'/mime_header_checks');
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
-		
+
 		//* Create the mailman files
 		if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data');
 		//if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
 		if(is_file('/var/lib/mailman/data/aliases')) unlink('/var/lib/mailman/data/aliases');
-		if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases','/var/lib/mailman/data/aliases');
+		if(!is_link('/var/lib/mailman/data/aliases')) symlink('/etc/mailman/aliases', '/var/lib/mailman/data/aliases');
 		exec('postalias /var/lib/mailman/data/aliases');
 		if(!is_file('/var/lib/mailman/data/virtual-mailman')) touch('/var/lib/mailman/data/virtual-mailman');
 		exec('postmap /var/lib/mailman/data/virtual-mailman');
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
-		
+
 		//* Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
-		if(!stristr($options,'dont-create-certs')) {
+
+		if(!stristr($options, 'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-                      .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
 			exec($command);
-		
+
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop.
 		$command = 'chmod 755 /var/spool/authdaemon';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
-		
+
 		//* Changing maildrop lines in posfix master.cf
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~');
+		}
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
 		// if postfix package is from fedora or centios main repo
-		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-					 
+		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
 		// If postfix package is from centos plus repo
-		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-					 
-		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-		
-		
-		$content = str_replace('#maildrop  unix  -       n       n       -       -       pipe', 
-                   'maildrop  unix  -       n       n       -       -       pipe',
-                     $content);
-		
+		$content = str_replace('#  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
+		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
+
+		$content = str_replace('#maildrop  unix  -       n       n       -       -       pipe',
+			'maildrop  unix  -       n       n       -       -       pipe',
+			$content);
+
 		wf($configfile, $content);
-		
+
 		//* Writing the Maildrop mailfilter file
 		$configfile = 'mailfilter';
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
-            copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
-        }
+			copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
+		}
 		$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);
-		
+
 		//* Create the directory for the custom mailfilters
 		$command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Chmod and chown the .mailfilter file
 		$command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
+
 	public function configure_saslauthd() {
 		global $conf;
-		
+
 		$configfile = 'tpl/fedora_saslauthd_smtpd_conf.master';
 		$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);
-		
+		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);
+
 	}
-	
+
 	public function configure_pam()
-    {
+	{
 		global $conf;
 		$pam = $conf['pam'];
 		//* configure pam for SMTP authentication agains the ispconfig database
@@ -336,68 +336,68 @@ class installer_dist extends installer_base {
 		if(is_file("$pam/smtp"))    exec("chmod o= $pam/smtp");
 		//exec("chmod 660 $pam/smtp");
 		//exec("chown root:root $pam/smtp");
-	
+
 	}
-	
+
 	public function configure_courier()
-    {
+	{
 		global $conf;
 		$config_dir = $conf['courier']['config_dir'];
 		//* authmysqlrc
 		$configfile = 'authmysqlrc';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		exec("chmod 400 $config_dir/$configfile~");
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 660 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		//* authdaemonrc
 		$configfile = $conf['courier']['config_dir'].'/authdaemonrc';
 		if(is_file($configfile)){
-            copy($configfile, $configfile.'~');
-        }
+			copy($configfile, $configfile.'~');
+		}
 		if(is_file($configfile.'~')){
-            exec('chmod 400 '.$configfile.'~');
-        }
+			exec('chmod 400 '.$configfile.'~');
+		}
 		$content = rf($configfile);
 		$content = str_replace('authmodulelist=', 'authmodulelist="authmysql"', $content);
 		wf($configfile, $content);
 	}
-	
+
 	public function configure_dovecot()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['dovecot']['config_dir'];
-		
+
 		//* Use /etc/dovecot as config dir if exists
 		if(is_dir('/etc/dovecot')) $config_dir = '/etc/dovecot';
-		
+
 		//* Configure master.cf and add a line for deliver
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~2');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~2');
+		}
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"dovecot/deliver")) {
+		if(!stristr($content, "dovecot/deliver")) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
-		
-		
+
+
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
@@ -407,119 +407,119 @@ class installer_dist extends installer_base {
 			'smtpd_sasl_path = private/auth',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* backup dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
-		
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
+
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
-		
+
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            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);
-            }
+			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 {
-            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);
-            }
+			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")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
 			exec("chmod 400 $config_dir/$configfile~");
-        }
-		
+		}
+
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
 
 	}
-	
+
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$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')) 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 = 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);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		$content = str_replace('{hostname}',$conf['hostname'],$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$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);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		$content = str_replace('{hostname}', $conf['hostname'], $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$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);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
-		removeLine('/etc/sysconfig/freshclam','FRESHCLAM_DELAY=disabled-warn   # REMOVE ME',1);
-		replaceLine('/etc/freshclam.conf','Example','# Example',1);
-		
+
+		removeLine('/etc/sysconfig/freshclam', 'FRESHCLAM_DELAY=disabled-warn   # REMOVE ME', 1);
+		replaceLine('/etc/freshclam.conf', 'Example', '# Example', 1);
+
 		// Add the clamav user to the vscan group
 		//exec('groupmod --add-user clamav vscan');
-		
-		
+
+
 	}
-	
+
 	public function configure_spamassassin()
-    {
+	{
 		global $conf;
-		
+
 		//* Enable spamasasssin on debian and ubuntu
 		/*
 		$configfile = '/etc/default/spamassassin';
@@ -531,40 +531,40 @@ class installer_dist extends installer_base {
 		wf($configfile, $content);
 		*/
 	}
-	
+
 	public function configure_getmail()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['getmail']['config_dir'];
-		
+
 		if(!is_dir($config_dir)) exec("mkdir -p ".escapeshellcmd($config_dir));
 
 		$command = "useradd -d $config_dir getmail";
 		if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chown -R getmail $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chmod -R 700 $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
-	
+
+
 	public function configure_pureftpd()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['pureftpd']['config_dir'];
 
 		//* configure pam for SMTP authentication agains the ispconfig database
 		$configfile = 'pureftpd-mysql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		if(is_file("$config_dir/$configfile~")){
-            exec("chmod 400 $config_dir/$configfile~");
-        }
+			exec("chmod 400 $config_dir/$configfile~");
+		}
 		$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);
@@ -574,45 +574,45 @@ class installer_dist extends installer_base {
 		wf("$config_dir/$configfile", $content);
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		// copy our customized copy of pureftpd.conf to the pure-ftpd config directory
 		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");
-        }
-		
+			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");
+		}
+
 	}
-	
+
 	public function configure_mydns()
-    {
+	{
 		global $conf;
-		
+
 		// configure mydns
 		$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)) 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 = 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);
-		$content = str_replace('{mysql_server_host}',$conf["mysql"]["host"],$content);
-		$content = str_replace('{server_id}',$conf["server_id"],$content);
-		wf($conf["mydns"]["config_dir"].'/'.$configfile,$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf["mysql"]["host"], $content);
+		$content = str_replace('{server_id}', $conf["server_id"], $content);
+		wf($conf["mydns"]["config_dir"].'/'.$configfile, $content);
 		exec('chmod 600 '.$conf["mydns"]["config_dir"].'/'.$configfile);
 		exec('chown root:root '.$conf["mydns"]["config_dir"].'/'.$configfile);
-	
+
 	}
-	
+
 	public function configure_bind() {
 		global $conf;
-		
+
 		// add the include line at the end of named.conf.
-		replaceLine('/etc/named.conf','include "/etc/named.conf.local";','include "/etc/named.conf.local";',0,1);
+		replaceLine('/etc/named.conf', 'include "/etc/named.conf.local";', 'include "/etc/named.conf.local";', 0, 1);
 
 		//* Check if the zonefile directory has a slash at the end
 		$content=$conf['bind']['bind_zonefiles_dir'];
-		if(substr($content,-1,1) != '/') {
+		if(substr($content, -1, 1) != '/') {
 			$content .= '/';
 		}
 
@@ -624,37 +624,37 @@ class installer_dist extends installer_base {
 		//* Chown the slave subdirectory to $conf['bind']['bind_user']
 		exec('chown '.$conf['bind']['bind_user'].':'.$conf['bind']['bind_group'].' '.$content);
 		exec('chmod 770 '.$content);
-		
+
 	}
-	
+
 	public function configure_apache()
-    {	
+	{
 		global $conf;
-		
+
 		if($conf['apache']['installed'] == false) return;
 		if(is_file('/etc/suphp.conf')) {
 			//replaceLine('/etc/suphp.conf','php=php:/usr/bin','x-httpd-suphp=php:/usr/bin/php-cgi',0);
-			replaceLine('/etc/suphp.conf','docroot=','docroot=/var/www',0);
-			replaceLine('/etc/suphp.conf','umask=0077','umask=0022',0);
+			replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/var/www', 0);
+			replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		}
-		
+
 		//* Create the logging directory for the vhost logfiles
 		exec('mkdir -p /var/log/ispconfig/httpd');
-		
+
 		// Sites enabled and avaulable dirs
 		exec('mkdir -p '.$conf['apache']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['apache']['vhost_conf_dir']);
-		
+
 		$content = rf('/etc/httpd/conf/httpd.conf');
-		if(!stristr($content,'Include /etc/httpd/conf/sites-enabled/')) {
-			af('/etc/httpd/conf/httpd.conf',"\nNameVirtualHost *:80\nNameVirtualHost *:443\nInclude /etc/httpd/conf/sites-enabled/\n\n");
+		if(!stristr($content, 'Include /etc/httpd/conf/sites-enabled/')) {
+			af('/etc/httpd/conf/httpd.conf', "\nNameVirtualHost *:80\nNameVirtualHost *:443\nInclude /etc/httpd/conf/sites-enabled/\n\n");
 		}
 		unset($content);
-		
+
 		//* Copy the ISPConfig configuration include
-        $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
-        $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
+		$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
+		$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
+
 		// copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
 		$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'");
@@ -666,7 +666,7 @@ class installer_dist extends installer_base {
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -677,138 +677,138 @@ class installer_dist extends installer_base {
 				}
 			}
 		}
-		
+
 		$content .= "\n";
-		wf($vhost_conf_dir.'/ispconfig.conf',$content);
-		
+		wf($vhost_conf_dir.'/ispconfig.conf', $content);
+
 		if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
 			exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
 		}
-		
+
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			exec('mkdir /etc/webalizer');
 			exec('ln -s /etc/webalizer.conf /etc/webalizer/webalizer.conf');
 		}
-		
+
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
+
 	public function configure_nginx(){
 		global $conf;
-		
+
 		if($conf['nginx']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
-		
+
 		// Sites enabled and avaulable dirs
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_dir']);
 
-		wf('/etc/nginx/conf.d/ispconfig_vhosts.conf',"include /etc/nginx/sites-enabled/*.vhost;");
+		wf('/etc/nginx/conf.d/ispconfig_vhosts.conf', "include /etc/nginx/sites-enabled/*.vhost;");
 
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
-		
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
+
 	public function configure_firewall()
 	{
 		global $conf;
-		
+
 		$dist_init_scripts = $conf['init_scripts'];
-  		
+
 		if(is_dir("/etc/Bastille.backup")) caselog("rm -rf /etc/Bastille.backup", __FILE__, __LINE__);
 		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__);
-  		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);
+		@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__);
+		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);
+
+		$tcp_public_services = '';
+		$udp_public_services = '';
 
-  		$tcp_public_services = '';
-  		$udp_public_services = '';
-		
 		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
-		
-  		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
-    		$tcp_public_services = trim(str_replace(',',' ',$row["tcp_port"]));
-    		$udp_public_services = trim(str_replace(',',' ',$row["udp_port"]));
-  		} else {
-    		$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
-    		$udp_public_services = '53';
-  		}
+
+		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
+			$tcp_public_services = trim(str_replace(',', ' ', $row["tcp_port"]));
+			$udp_public_services = trim(str_replace(',', ' ', $row["udp_port"]));
+		} else {
+			$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
+			$udp_public_services = '53';
+		}
 		if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
 			$tcp_public_services .= ' '.intval($conf['apache']['vhost_port']);
 			if($row["tcp_port"] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id']));
 		}
-		
-  		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
-  		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
 
-  		wf("/etc/Bastille/bastille-firewall.cfg", $content);
+		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
+		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
 
-  		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
-  		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
+		wf("/etc/Bastille/bastille-firewall.cfg", $content);
 
-  		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
+		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
+
+		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+
+		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
 
-  		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
-		
 		if(!@is_dir('/var/lock/subsys')) caselog("mkdir /var/lock/subsys", __FILE__, __LINE__);
 
-  		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
-  		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
-  		unset($ipchains_location);
-  		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
-  		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
-  		unset($iptables_location);
+		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
+		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
+		unset($ipchains_location);
+		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
+		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
+		unset($iptables_location);
 
 	}
-	
-	
+
+
 	public function install_ispconfig()
-    {
+	{
 		global $conf;
-		
+
 		$install_dir = $conf['ispconfig_install_dir'];
 
 		//* Create the ISPConfig installation directory
@@ -816,68 +816,68 @@ class installer_dist extends installer_base {
 			$command = "mkdir $install_dir";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Create a ISPConfig user and group
 		$command = 'groupadd ispconfig';
 		if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "useradd -g ispconfig -d $install_dir ispconfig";
 		if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig interface part
 		$command = "cp -rf ../interface $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig server part
 		$command = "cp -rf ../server $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create a symlink, so ISPConfig is accessible via web
 		// Replaced by a separate vhost definition for port 8080
 		// $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig";
 		// caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create the config file for ISPConfig interface
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/interface/lib/'.$configfile)){
-            copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$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_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
 		wf("$install_dir/interface/lib/$configfile", $content);
-		
+
 		//* Create the config file for ISPConfig server
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/server/lib/'.$configfile)){
-            copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$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);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
@@ -886,24 +886,24 @@ class installer_dist extends installer_base {
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
 
 		wf("$install_dir/server/lib/$configfile", $content);
-		
+
 		//* Create the config file for remote-actions (but only, if it does not exist, because
 		//  the value is a autoinc-value and so changed by the remoteaction_core_module
 		if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) {
 			$content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
 			wf($install_dir.'/server/lib/remote_action.inc.php', $content);
 		}
-		
-		
+
+
 		//* Enable the server modules and plugins.
 		// TODO: Implement a selector which modules and plugins shall be enabled.
 		$dir = $install_dir.'/server/mods-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file);
@@ -917,16 +917,16 @@ class installer_dist extends installer_base {
 				closedir($dh);
 			}
 		}
-		
+
 		$dir = $install_dir.'/server/plugins-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
@@ -940,7 +940,7 @@ class installer_dist extends installer_base {
 				closedir($dh);
 			}
 		}
-		
+
 		// Update the server config
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
 		$web_server_enabled = ($conf['services']['web'])?1:0;
@@ -949,14 +949,14 @@ class installer_dist extends installer_base {
 		$db_server_enabled = ($conf['services']['db'])?1:0;
 		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
 		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
-		
+
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$this->dbmaster->query($sql);
 			$this->db->query($sql);
 		} else {
 			$this->db->query($sql);
 		}
-		
+
 		//* Chmod the files
 		$command = "chmod -R 750 $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -964,48 +964,48 @@ class installer_dist extends installer_base {
 		//* chown the files to the ispconfig user and group
 		$command = "chown -R ispconfig:ispconfig $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Make the global language file directory group writable
 		exec("chmod -R 770 $install_dir/interface/lib/lang");
-		
+
 		//* Make the temp directory for language file exports writable
 		exec("chmod -R 770 $install_dir/interface/web/temp");
-		
+
 		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) { 
-	   		if ($file != '.' && $file != '..') {
-	        	if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
+		while ($file = @readdir($handle)) {
+			if ($file != '.' && $file != '..') {
+				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
 			}
 		}
-		
+
 		//* Make the APS directories group writable
 		exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
 		exec("chmod -R 770 $install_dir/server/aps_packages");
-		
+
 		//* make sure that the server config file (not the interface one) is only readable by the root user
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
 		chgrp($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
-		
+
 		if(@is_file("$install_dir/server/lib/mysql_clientdb.conf")) {
 			exec("chmod 600 $install_dir/server/lib/mysql_clientdb.conf");
 			exec("chown root:root $install_dir/server/lib/mysql_clientdb.conf");
 		}
-		
+
 		// TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
 		// and must be fixed as this will allow the apache user to read the ispconfig files.
 		// Later this must run as own apache server or via suexec!
@@ -1021,38 +1021,38 @@ class installer_dist extends installer_base {
 			$command = 'usermod -a -G ispconfig '.$conf['nginx']['user'];
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			//if(is_user('ispapps')){
-				// Allow the ispapps vhost access to /etc/squirrelmail
-				//$command = 'usermod -a -G '.$conf['apache']['group'].' ispapps';
-				//caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
+			// Allow the ispapps vhost access to /etc/squirrelmail
+			//$command = 'usermod -a -G '.$conf['apache']['group'].' ispapps';
+			//caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			//}
 			if(is_group('ispapps')){
 				$command = 'usermod -a -G ispapps '.$conf['nginx']['user'];
 				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
 		}
-		
+
 		//* Make the shell scripts executable
 		$command = "chmod +x $install_dir/server/scripts/*.sh";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			// TODO: These are missing! should they be "vhost_dist_*_dir" ?
 			$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
-        
+
+
 			// Dont just copy over the virtualhost template but add some custom settings
 			$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
 			if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
@@ -1063,39 +1063,39 @@ class installer_dist extends installer_base {
 			} else {
 				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
-		
+
 			wf("$vhost_conf_dir/ispconfig.vhost", $content);
-		
+
 			//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
 			//* and create the symlink
 			//if($this->is_update == false) {
-				if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
-				if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
-					exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
-				}
-			
-				/*
+			if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
+			if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
+				exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
+			}
+
+			/*
 				exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
 				exec('cp tpl/apache_ispconfig_fcgi_starter.master /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
 				exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
 				exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
 				exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
-			
+
 				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 = 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');
-					wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
-					exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
-					if(!is_link('/var/www/ispconfig')) exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
-					exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
-				//}
+			//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
+			$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');
+			wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
+			exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
+			if(!is_link('/var/www/ispconfig')) exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
+			exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
+			//}
 			//}
 		}
-		
+
 		if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			$vhost_conf_dir = $conf['nginx']['vhost_conf_dir'];
@@ -1104,7 +1104,7 @@ class installer_dist extends installer_base {
 			// Dont just copy over the virtualhost template but add some custom settings
 			$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')) {
 				$content = str_replace('{ssl_on}', ' on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
@@ -1114,19 +1114,19 @@ class installer_dist extends installer_base {
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
-			
+
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
-			
+
 			unset($content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
@@ -1142,18 +1142,18 @@ class installer_dist extends installer_base {
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
-			
+
 			// create symlink from /usr/share/phpmyadmin to /usr/share/phpMyAdmin, if it is installed
-			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/usr/share/phpMyAdmin')) symlink('/usr/share/phpMyAdmin/','/usr/share/phpmyadmin');
+			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/usr/share/phpMyAdmin')) symlink('/usr/share/phpMyAdmin/', '/usr/share/phpmyadmin');
 		}
-		
+
 		// Make the Clamav log files readable by ISPConfig
 		//exec('chmod +r /var/log/clamav/clamav.log');
 		//exec('chmod +r /var/log/clamav/freshclam.log');
-		
+
 		//* Install the update script
 		if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
 		exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
@@ -1164,98 +1164,98 @@ class installer_dist extends installer_base {
 		exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
-		
+
 		// set the fast cgi starter script to executable
 		// exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi');
-		
+
 		//* Make the logs readable for the ispconfig user
 		if(@is_file('/var/log/maillog')) exec('chmod +r /var/log/maillog');
 		//if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn');
 		//if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err');
 		if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages');
-		
+
 		//To enable apache to read the directories
 		// exec('chmod a+rx /usr/local/ispconfig');
 		// exec('chmod -R 751 /usr/local/ispconfig/interface');
 		// exec('chmod a+rx /usr/local/ispconfig/interface/web');
-		
+
 		//* Create the ispconfig log directory
 		if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
 		if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
-		
+
 		if(is_user('getmail')) {
 			exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
 			exec('chown getmail /usr/local/bin/run-getmail.sh');
 			exec('chmod 744 /usr/local/bin/run-getmail.sh');
 		}
-		
+
 		// Edit the file Edit the file /etc/sudoers and comment out the requiregetty line, otherwise the backup function will fail
-		replaceLine('/etc/sudoers','Defaults    requiretty','#Defaults    requiretty',0,0);
-		
+		replaceLine('/etc/sudoers', 'Defaults    requiretty', '#Defaults    requiretty', 0, 0);
+
 		if(is_dir($install_dir.'/interface/invoices')) {
 			exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices'));
 			exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices'));
 		}
-		
+
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
 		}
 		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-		
+
 	}
-	
+
 	public function configure_dbserver()
 	{
 		global $conf;
-		
+
 		//* If this server shall act as database server for client DB's, we configure this here
 		$install_dir = $conf['ispconfig_install_dir'];
-		
-		// Create a file with the database login details which 
+
+		// Create a file with the database login details which
 		// are used to create the client databases.
-		
+
 		if(!is_dir("$install_dir/server/lib")) {
 			$command = "mkdir $install_dir/server/lib";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		$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);
-		wf("$install_dir/server/lib/mysql_clientdb.conf",$content);
+		$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);
+		wf("$install_dir/server/lib/mysql_clientdb.conf", $content);
 		exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
 		exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
-		
+
 	}
-	
+
 	public function install_crontab()
-    {		
+	{
 		global $conf;
-		
+
 		//* Root Crontab
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
-		
+
 		// remove existing ispconfig cronjobs, in case the syntax has changed
 		foreach($existing_root_cron_jobs as $key => $val) {
-			if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
+			if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
 		}
-		
+
 		$root_cron_jobs = array(
 			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
 			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
 		);
-		
+
 		if ($conf['nginx']['installed'] == true) {
 			$root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null";
 		}
-		
+
 		foreach($root_cron_jobs as $cron_job) {
 			if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
 				$existing_root_cron_jobs[] = $cron_job."\n";
@@ -1264,22 +1264,22 @@ class installer_dist extends installer_base {
 		file_put_contents('crontab.txt', $existing_root_cron_jobs);
 		exec('crontab -u root crontab.txt &> /dev/null');
 		unlink('crontab.txt');
-		
+
 		//* Getmail crontab
 		if(is_user('getmail')) {
-        	$cf = $conf['getmail'];
+			$cf = $conf['getmail'];
 			exec('crontab -u getmail -l > crontab.txt');
 			$existing_cron_jobs = file('crontab.txt');
-		
+
 			$cron_jobs = array(
-                '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
-            );
-		
+				'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
+			);
+
 			// remove existing ispconfig cronjobs, in case the syntax has changed
 			foreach($existing_cron_jobs as $key => $val) {
-				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
+				if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
 			}
-		
+
 			foreach($cron_jobs as $cron_job) {
 				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
 					$existing_cron_jobs[] = $cron_job."\n";
@@ -1289,7 +1289,7 @@ class installer_dist extends installer_base {
 			exec('crontab -u getmail crontab.txt &> /dev/null');
 			unlink('crontab.txt');
 		}
-		
+
 		exec('touch /var/log/ispconfig/cron.log');
 		exec('chmod 660 /var/log/ispconfig/cron.log');
 	}
diff --git a/install/dist/lib/fedora9.lib.php b/install/dist/lib/fedora9.lib.php
index da77b423aecf247618a2647aa4b2663d64651ad4..aeda9b9fd1c6b83d7388fc91bde429a6e4dd5b81 100644
--- a/install/dist/lib/fedora9.lib.php
+++ b/install/dist/lib/fedora9.lib.php
@@ -33,4 +33,4 @@ class installer extends installer_dist {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/gentoo.lib.php b/install/dist/lib/gentoo.lib.php
index 60cadad754163c599a145802d80fedaa015ea978..99670eec1338e79223b66975dbb37c7fd4061179 100644
--- a/install/dist/lib/gentoo.lib.php
+++ b/install/dist/lib/gentoo.lib.php
@@ -28,47 +28,47 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-class installer extends installer_base 
+class installer extends installer_base
 {
 	public function configure_jailkit()
-    {
-        global $conf;
-		
+	{
+		global $conf;
+
 		if (is_dir($conf['jailkit']['config_dir']))
 		{
 			$jkinit_content = $this->get_template_file($conf['jailkit']['jk_init'], true); //* get contents
 			$this->write_config_file($conf['jailkit']['config_dir'] . '/' . $conf['jailkit']['jk_init'], $jkinit_content);
-			
+
 			$jkchroot_content = $this->get_template_file($conf['jailkit']['jk_chrootsh'], true); //* get contents
 			$this->write_config_file($conf['jailkit']['config_dir'] . '/' . $conf['jailkit']['jk_chrootsh'], $jkchroot_content);
 		}
-		
+
 		$command = 'chown root:root /var/www';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-    }
-	
+	}
+
 	public function configure_postfix($options = '')
-    {
-        global $conf;
-		
-        $cf = $conf['postfix'];
+	{
+		global $conf;
+
+		$cf = $conf['postfix'];
 		$config_dir = $cf['config_dir'];
-        
+
 		if(!is_dir($config_dir)){
-            $this->error("The postfix configuration directory '$config_dir' does not exist.");
-        }
-        
-        //* Install virtual mappings
-        foreach (glob('tpl/mysql-virtual_*.master') as $filename) {
-        	$this->process_postfix_config( basename($filename, '.master') );
-        }
-        
+			$this->error("The postfix configuration directory '$config_dir' does not exist.");
+		}
+
+		//* Install virtual mappings
+		foreach (glob('tpl/mysql-virtual_*.master') as $filename) {
+			$this->process_postfix_config( basename($filename, '.master') );
+		}
+
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-                 __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
-		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', 
-                __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
-		
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+
 		//* Creating virtual mail user and group
 		$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
 		if (!is_group($cf['vmail_groupname'])) {
@@ -77,81 +77,81 @@ class installer extends installer_base
 
 		$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
 		if (!is_user($cf['vmail_username'])) {
-			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");		
+			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_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
-		
+		$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) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
-		
+
 		//* Create the header and body check files
 		touch($config_dir.'/header_checks');
 		touch($config_dir.'/mime_header_checks');
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
-		
-		
+
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
-		
+
 		//* Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//* Create the SSL certificate
-		if (!stristr($options,'dont-create-certs'))  
+		if (!stristr($options, 'dont-create-certs'))
 		{
 			$command = 'cd '.$config_dir.'; '
-                      .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
 			exec($command);
-		
+
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//* We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop.
 		$command = 'chmod 755  /var/lib/courier/authdaemon/';
 		if (is_dir('/var/lib/courier/authdaemon')) {
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//* Changing maildrop lines in posfix master.cf
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
 
-        $content = preg_replace('/^#?maildrop/m', 'maildrop', $content);
-        $content = preg_replace('/^#?(\s+)flags=DRhu user=vmail argv=\/usr\/bin\/maildrop -d/m',
-        						'$1flags=DRhu user=vmail argv=/usr/bin/maildrop -d vmail \${extension} \${recipient} \${user} \${nexthop} \${sender}',
-        						$content);
-        						
+		$content = preg_replace('/^#?maildrop/m', 'maildrop', $content);
+		$content = preg_replace('/^#?(\s+)flags=DRhu user=vmail argv=\/usr\/bin\/maildrop -d/m',
+			'$1flags=DRhu user=vmail argv=/usr/bin/maildrop -d vmail \${extension} \${recipient} \${user} \${nexthop} \${sender}',
+			$content);
+
 		$this->write_config_file($configfile, $content);
-		
+
 		//* Writing the Maildrop mailfilter file
 		$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);
-		
+
 		//* Create the directory for the custom mailfilters
-		if (!is_dir($cf['vmail_mailbox_base'].'/mailfilters')) 
+		if (!is_dir($cf['vmail_mailbox_base'].'/mailfilters'))
 		{
 			$command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -161,127 +161,127 @@ class installer extends installer_base
 		$full_file_name=$config_dir.'/tag_as_originating.re';
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.$configfile.'~');
-	        }
-        	$this->write_config_file($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10026');
-
-	        $full_file_name=$config_dir.'/tag_as_foreign.re';
-        	if(is_file($full_file_name)) {
-                	copy($full_file_name, $config_dir.$configfile.'~');
-	        }
-		$this->write_config_file($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10024');
-		
+		}
+		$this->write_config_file($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10026');
+
+		$full_file_name=$config_dir.'/tag_as_foreign.re';
+		if(is_file($full_file_name)) {
+			copy($full_file_name, $config_dir.$configfile.'~');
+		}
+		$this->write_config_file($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10024');
+
 		//* Chmod and chown the .mailfilter file
 		$command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
-	public function configure_saslauthd() 
+
+	public function configure_saslauthd()
 	{
 		global $conf;
-	
+
 		$content = $this->get_template_file('sasl_smtpd.conf', true, true); //* get contents & insert db cred
 		$this->write_config_file($conf['saslauthd']['config_dir'].'/smtpd.conf', $content);
-		
+
 		//* Edit the file saslauthd config file
 		$content = rf($conf['saslauthd']['config_file']);
 		$content = preg_replace('/(?<=\n)SASLAUTHD_OPTS="\$\{SASLAUTHD_OPTS\}[^"]+"/', 'SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -a pam -r -c -s 128 -t 30 -n 5"', $content);
-		
+
 		$this->write_config_file($conf['saslauthd']['config_file'], $content);
 	}
-	
+
 	public function configure_courier()
-    {
-    	global $conf;
-    	
+	{
+		global $conf;
+
 		//* authmysqlrc
 		$content = $this->get_template_file('authmysqlrc', true, true); //* get contents & insert db cred
 		$this->write_config_file($conf['courier']['config_dir'].'/authmysqlrc', $content);
-		
+
 		//* authdaemonrc
 		$configfile = $conf['courier']['config_dir'].'/authdaemonrc';
 
 		$content = rf($configfile);
 		$content = preg_replace('/(?<=\n)authmodulelist="[^"]+"/', "authmodulelist=\"authmysql\"", $content);
 		$this->write_config_file($configfile, $content);
-		
+
 		//* create certificates
 		$command = 'mkimapdcert';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-			
+
 		$command = 'mkpop3dcert';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-    }
-    
-    public function configure_dovecot() 
-    {
-    	global $conf;
-    	
-    	$config_dir = $conf['dovecot']['config_dir'];
-    	
-    	$configfile = $conf['postfix']['config_dir'].'/master.cf';
-    	
-    	if(is_file($configfile)) {
+	}
+
+	public function configure_dovecot()
+	{
+		global $conf;
+
+		$config_dir = $conf['dovecot']['config_dir'];
+
+		$configfile = $conf['postfix']['config_dir'].'/master.cf';
+
+		if(is_file($configfile)) {
 			copy($configfile, $configfile.'~2');
 		}
 		if(is_file($configfile.'~2')) {
 			chmod($configfile.'~2', 0400);
 		}
-    	
-    	//* Configure master.cf and add a line for deliver
+
+		//* Configure master.cf and add a line for deliver
 		$content = rf($configfile);
-		
-    	if(!stristr($content,'dovecot/deliver')) {
+
+		if(!stristr($content, 'dovecot/deliver')) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf['postfix']['config_dir'].'/master.cf',$deliver_content);
+			af($conf['postfix']['config_dir'].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
 		unset($configfile);
-		
+
 		//* Reconfigure postfix to use dovecot authentication
 		$postconf_commands = array (
-				'dovecot_destination_recipient_limit = 1',
-				'virtual_transport = dovecot',
-				'smtpd_sasl_type = dovecot',
-				'smtpd_sasl_path = private/auth'
+			'dovecot_destination_recipient_limit = 1',
+			'virtual_transport = dovecot',
+			'smtpd_sasl_type = dovecot',
+			'smtpd_sasl_path = private/auth'
 		);
-		
+
 		//* Make a backup copy of the main.cf file
-		copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~3');
-		
-    	//* Executing the postconf commands
-		foreach($postconf_commands as $cmd) 
+		copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~3');
+
+		//* Executing the postconf commands
+		foreach($postconf_commands as $cmd)
 		{
 			$command = "postconf -e '$cmd'";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* copy dovecot.conf
 		$configfile = $config_dir.'/dovecot.conf';
 		$content = $this->get_template_file('dovecot.conf', true);
 		$this->write_config_file($configfile, $content);
-		
+
 		//* dovecot-sql.conf
 		$configfile = $config_dir.'/dovecot-sql.conf';
 		$content = $this->get_template_file('debian_dovecot-sql.conf', true, true);
 		$this->write_config_file($configfile, $content);
-    }
-	
+	}
+
 	public function configure_spamassassin()
-    {
+	{
 		return true;
-    }
-    
+	}
+
 	public function configure_getmail()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['getmail']['config_dir'];
-		
+
 		if (!is_dir($config_dir)) {
 			exec('mkdir -p '.escapeshellcmd($config_dir));
 		}
@@ -290,86 +290,86 @@ class installer extends installer_base
 		if (!is_user('getmail')) {
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		$command = "chown -R getmail $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chmod -R 700 $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Getmail will be run from cron. In order to have access to cron the getmail user needs to be part of the cron group.
 		$command = "gpasswd -a getmail " . $conf['cron']['group'];
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-    
-    public function configure_amavis() 
-    {
+
+	public function configure_amavis()
+	{
 		global $conf;
-		
+
 		//* Amavisd-new user config file
 		$conf_file = 'amavisd-ispconfig.conf';
 		$conf_path = dirname($conf['amavis']['config_file']) . '/' . $conf_file;
-		
+
 		$content = $this->get_template_file($conf_file, true, true); //* get contents & insert db cred
 		$this->write_config_file($conf_path, $content);
-		
+
 		//* Activate config directory in default file
 		$amavis_conf = rf($conf['amavis']['config_file']);
-		if (stripos($amavis_conf, $conf_path) === false) 
+		if (stripos($amavis_conf, $conf_path) === false)
 		{
 			$amavis_conf = preg_replace('/^(1;.*)$/m', "include_config_files('$conf_path');\n$1", $amavis_conf);
 			$this->write_config_file($conf['amavis']['config_file'], $amavis_conf);
 		}
-		
+
 		//* Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
-    	foreach($postconf_commands as $cmd) {
+
+		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Append the configuration for amavisd to the master.cf file
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
-		
-		if(!stristr($content,'127.0.0.1:10025')) //* Only add the content if we had not addded it before 
-		{ 
+
+		if(!stristr($content, '127.0.0.1:10025')) //* Only add the content if we had not addded it before
+			{
 			unset($content);
 			$content = $this->get_template_file('master_cf_amavis', true);
 			af($conf['postfix']['config_dir'].'/master.cf', $content);
 		}
 		unset($content);
-		
+
 		//* Add the clamav user to the amavis group
 		exec('usermod -a -G amavis clamav');
-    }
-    
-    public function configure_pureftpd()
-    {
+	}
+
+	public function configure_pureftpd()
+	{
 		global $conf;
-		
+
 		//* configure pure-ftpd for MySQL authentication against the ispconfig database
 		$content = $this->get_template_file('pureftpd_mysql.conf', true, true); //* get contents & insert db cred
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
-		
+
 		$this->write_config_file($conf['pureftpd']['mysql_config_file'], $content, 600, 'root', 'root');
-		
+
 		//* enable pure-ftpd and server settings
 		$content = rf($conf["pureftpd"]["config_file"]);
-		
+
 		$content = preg_replace('/#?IS_CONFIGURED="(?:yes|no)"/', 'IS_CONFIGURED="yes"', $content);
 		$content = str_replace('AUTH="-l unix"', 'AUTH="-l mysql:'.$conf['pureftpd']['mysql_config_file'].'"', $content);
-		
+
 		//* Logging defaults to syslog's ftp facility. Override this behaviour for better compatibility with debian/ubuntu
 		//* and specify the format.
 		$logdir = '/var/log/pure-ftpd';
 		if (!is_dir($logdir)) {
 			mkdir($logdir, 0755, true);
 		}
-		
+
 		/**
 		 * @link http://download.pureftpd.org/pub/pure-ftpd/doc/README
 		 * -b brokenclientscompatibility
@@ -377,45 +377,47 @@ class installer extends installer_base
 		 * -E noanonymous
 		 * -O altlog <format>:<log file>
 		 * -Z customerproof (Add safe guards against common customer mistakes ie. like chmod 0 on their own files)
-		 * -D displaydotfiles 
+		 * -D displaydotfiles
 		 * -H dontresolve
 		 */
+
+
 		$content = preg_replace('/MISC_OTHER="[^"]+"/', 'MISC_OTHER="-b -A -E -Z -D -H -O clf:'.$logdir.'/transfer.log"', $content);
-		
+
 		$this->write_config_file($conf['pureftpd']['config_file'], $content);
-    }
-    
-	public function configure_powerdns() 
+	}
+
+	public function configure_powerdns()
 	{
 		global $conf;
-		
+
 		//* Create the database
 		if(!$this->db->query('CREATE DATABASE IF NOT EXISTS '.$conf['powerdns']['database'].' DEFAULT CHARACTER SET '.$conf['mysql']['charset'])) {
 			$this->error('Unable to create MySQL database: '.$conf['powerdns']['database'].'.');
 		}
-		
+
 		//* Create the ISPConfig database user in the local database
-        $query = 'GRANT ALL ON `'.$conf['powerdns']['database'].'` . * TO \''.$conf['mysql']['ispconfig_user'].'\'@\'localhost\';';
+		$query = 'GRANT ALL ON `'.$conf['powerdns']['database'].'` . * TO \''.$conf['mysql']['ispconfig_user'].'\'@\'localhost\';';
 		if(!$this->db->query($query)) {
 			$this->error('Unable to create user for powerdns database Error: '.$this->db->errorMessage);
 		}
-		
+
 		//* Reload database privelages
 		$this->db->query('FLUSH PRIVILEGES;');
-		
+
 		//* load the powerdns databse dump
 		if($conf['mysql']['admin_password'] == '') {
-			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", 
-                    __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		} else {
-			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null", 
-                     __FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		}
-		
+
 		//* Create the powerdns config file
 		$content = $this->get_template_file('pdns.local', true, true); //* get contents & insert db cred
 		$content = str_replace('{powerdns_database}', $conf['powerdns']['database'], $content);
-		
+
 		$this->write_config_file($conf["powerdns"]["config_dir"].'/'.$conf["powerdns"]["config_file"], $content, 600, 'root', 'root');
 
 		//* Create symlink to init script to start the correct config file
@@ -423,26 +425,26 @@ class installer extends installer_base
 			symlink($conf['init_scripts'].'/pdns', $conf['init_scripts'].'/'.$conf['powerdns']['init_script']);
 		}
 	}
-	
+
 	public function configure_bind() {
 		global $conf;
 
-	    //* Check if the zonefile directory has a slash at the end
-	    $content=$conf['bind']['bind_zonefiles_dir'];
-	    if(substr($content,-1,1) != '/') {
-    	    $content .= '/';
+		//* Check if the zonefile directory has a slash at the end
+		$content=$conf['bind']['bind_zonefiles_dir'];
+		if(substr($content, -1, 1) != '/') {
+			$content .= '/';
 		}
-		
+
 		//* New default format of named.conf uses views. Check which version the system is using and include our zones file.
 		$named_conf = rf($conf['bind']['named_conf_path']);
-		if (stripos($named_conf, 'include "'.$conf['bind']['named_conf_local_path'].'";') === false) 
+		if (stripos($named_conf, 'include "'.$conf['bind']['named_conf_local_path'].'";') === false)
 		{
 			preg_match_all("/(?<=\n)view \"(?:public|internal)\" in \{.*\n\};/Us", $named_conf, $views);
 			if (count($views[0]) == 2) {
 				foreach ($views[0] as $view) {
 					$named_conf = str_replace($view, substr($view, 0, -2)."include \"{$conf['bind']['named_conf_local_path']}\";\n};", $named_conf);
 				}
-				
+
 				wf($conf['bind']['named_conf_path'], $named_conf);
 			}
 			else {
@@ -450,48 +452,48 @@ class installer extends installer_base
 			}
 		}
 	}
-	
+
 	public function configure_apache()
-    {	
+	{
 		global $conf;
-		
+
 		if($conf['apache']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		if (!is_dir($conf['ispconfig_log_dir'].'/httpd')) {
 			mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
 		}
-		
-		if (is_file($conf['suphp']['config_file'])) 
+
+		if (is_file($conf['suphp']['config_file']))
 		{
 			$content = rf($conf['suphp']['config_file']);
-			
+
 			if (!preg_match('|^x-httpd-suphp=php:/usr/bin/php-cgi$|m', $content))
 			{
-				$content = preg_replace('/;Handler for php-scripts/',";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
-				$content = preg_replace('/;?umask=\d+/','umask=0022', $content);
+				$content = preg_replace('/;Handler for php-scripts/', ";Handler for php-scripts\nx-httpd-suphp=php:/usr/bin/php-cgi", $content);
+				$content = preg_replace('/;?umask=\d+/', 'umask=0022', $content);
 			}
-			
+
 			$this->write_config_file($conf['suphp']['config_file'], $content);
 		}
-		
+
 		//* Enable ISPConfig default vhost settings
 		$default_vhost_path = $conf['apache']['vhost_conf_dir'].'/'.$conf['apache']['vhost_default'];
-		if (is_file($default_vhost_path)) 
+		if (is_file($default_vhost_path))
 		{
 			$content = rf($default_vhost_path);
-			
+
 			$content = preg_replace('/^#?\s*NameVirtualHost.*$/m', 'NameVirtualHost *:80', $content);
 			$content = preg_replace('/<VirtualHost[^>]+>/', '<VirtualHost *:80>', $content);
-			
+
 			$this->write_config_file($default_vhost_path, $content);
 		}
-		
+
 		//* Generate default ssl certificates
 		if (!is_dir($conf['apache']['ssl_dir'])) {
 			mkdir($conf['apache']['ssl_dir']);
 		}
-		
-		if ($conf['services']['mail'] == true) 
+
+		if ($conf['services']['mail'] == true)
 		{
 			copy($conf['postfix']['config_dir']."/smtpd.key", $conf['apache']['ssl_dir']."/server.key");
 			copy($conf['postfix']['config_dir']."/smtpd.cert", $conf['apache']['ssl_dir']."/server.crt");
@@ -502,76 +504,76 @@ class installer extends installer_base
 				exec("openssl req -new -outform PEM -out {$conf['apache']['ssl_dir']}/server.crt -newkey rsa:2048 -nodes -keyout {$conf['apache']['ssl_dir']}/server.key -keyform PEM -days 365 -x509");
 			}
 		}
-		
-		
-		
+
+
+
 		//* Copy the ISPConfig configuration include
 		$content = $this->get_template_file('apache_ispconfig.conf', true);
-		
+
 		$records = $this->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'");
-		if(is_array($records) && count($records) > 0) 
+		if(is_array($records) && count($records) > 0)
 		{
 			foreach($records as $rec) {
 				$content .= "NameVirtualHost ".$rec["ip_address"].":80\n";
 				$content .= "NameVirtualHost ".$rec["ip_address"].":443\n";
 			}
 		}
-		
+
 		$this->write_config_file($conf['apache']['vhost_conf_dir'].'/000-ispconfig.conf', $content);
-		
+
 		//* Gentoo by default does not include .vhost files. Add include line to config file.
 		$content = rf($conf['apache']['config_file']);
 		if ( strpos($content, 'Include /etc/apache2/vhosts.d/*.vhost') === false ) {
-			$content = preg_replace('|(Include /etc/apache2/vhosts.d/\*.conf)|',"$1\nInclude /etc/apache2/vhosts.d/*.vhost", $content);
+			$content = preg_replace('|(Include /etc/apache2/vhosts.d/\*.conf)|', "$1\nInclude /etc/apache2/vhosts.d/*.vhost", $content);
 		}
-		
+
 		$this->write_config_file($conf['apache']['config_file'], $content);
-		
+
 		//* make sure that webalizer finds its config file when it is directly in /etc
-		if(is_file('/etc/webalizer.conf') && !is_dir('/etc/webalizer')) 
+		if(is_file('/etc/webalizer.conf') && !is_dir('/etc/webalizer'))
 		{
 			mkdir('/etc/webalizer', 0755);
 			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
-		
-    	if(is_file('/etc/webalizer/webalizer.conf')) //* Change webalizer mode to incremental 
-    	{
-    		replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+
+		if(is_file('/etc/webalizer/webalizer.conf')) //* Change webalizer mode to incremental
+			{
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		//* add a sshusers group
-		if (!is_group('sshusers')) 
+		if (!is_group('sshusers'))
 		{
 			$command = 'groupadd sshusers';
 			caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-    }
-    
-    public function configure_apps_vhost()
+	}
+
+	public function configure_apps_vhost()
 	{
 		global $conf;
-		
+
 		//* Create the ispconfig apps vhost user and group
 		if($conf['apache']['installed'] == true){
 			$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
 			$apps_vhost_group = escapeshellcmd($conf['web']['apps_vhost_group']);
 			$install_dir = escapeshellcmd($conf['web']['website_basedir'].'/apps');
-		
+
 			$command = 'groupadd '.$apps_vhost_user;
 			if ( !is_group($apps_vhost_group) ) {
 				caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
-		
+
 			$command = "useradd -g '$apps_vhost_group' -d $install_dir $apps_vhost_group";
 			if ( !is_user($apps_vhost_user) ) {
 				caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
-		
+
 			$command = 'adduser '.$conf['apache']['user'].' '.$apps_vhost_group;
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 			if(!@is_dir($install_dir)){
 				mkdir($install_dir, 0755, true);
 			} else {
@@ -579,41 +581,41 @@ class installer extends installer_base
 			}
 			chown($install_dir, $apps_vhost_user);
 			chgrp($install_dir, $apps_vhost_group);
-		
+
 			//* Copy the apps vhost file
 			$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
 			$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 = $this->get_template_file('apache_apps.vhost', true);
-        
+
 			$content = str_replace('{apps_vhost_ip}', $conf['web']['apps_vhost_ip'], $content);
 			$content = str_replace('{apps_vhost_port}', $conf['web']['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $conf['web']['website_basedir'].'/apps', $content);
 			$content = str_replace('{website_basedir}', $conf['web']['website_basedir'], $content);
 			$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
-		
+
 			//* comment out the listen directive if port is 80 or 443
 			if($conf['web']['apps_vhost_ip'] == 80 or $conf['web']['apps_vhost_ip'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			$this->write_config_file("$vhost_conf_dir/apps.vhost", $content);
-		
-			//if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') ) 
+
+			//if ( !is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter') )
 			//{
-				$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);
-				//copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
-				wf($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter', $content);
-				exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
-				exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
-			
+			$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);
+			//copy('tpl/apache_apps_fcgi_starter.master',$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
+			wf($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter', $content);
+			exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
+			exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
+
 			//}
 		}
 		if($conf['nginx']['installed'] == true){
@@ -646,15 +648,15 @@ class installer extends installer_base
 
 			// Dont just copy over the virtualhost template but add some custom settings
 			$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 = '';
 			} else {
 				$apps_vhost_ip = $conf['web']['apps_vhost_ip'].':';
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'apps.sock';
 			$cgi_socket = escapeshellcmd($conf['nginx']['cgi_socket']);
@@ -668,7 +670,7 @@ class installer extends installer_base
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
 
 			wf($vhost_conf_dir.'/apps.vhost', $content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apps_php_fpm_pool.conf.master', 'tpl/apps_php_fpm_pool.conf.master');
@@ -683,84 +685,84 @@ class installer extends installer_base
 			//* and create the symlink
 			if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
 			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
-				symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
 			}
-			
+
 		}
 	}
-    
-    public function install_ispconfig()
-    {
+
+	public function install_ispconfig()
+	{
 		global $conf;
-		
+
 		$install_dir = $conf['ispconfig_install_dir'];
-		
-    	//* Create the ISPConfig installation directory
-		if(!is_dir($install_dir)) 
+
+		//* Create the ISPConfig installation directory
+		if(!is_dir($install_dir))
 		{
 			$command = "mkdir $install_dir";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Create a ISPConfig user and group
-		if (!is_group('ispconfig')) 
+		if (!is_group('ispconfig'))
 		{
 			$command = 'groupadd ispconfig';
 			caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
-		if (!is_user('ispconfig')) 
+
+		if (!is_user('ispconfig'))
 		{
 			$command = "useradd -g ispconfig -d $install_dir ispconfig";
 			caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* copy the ISPConfig interface part
 		$command = "cp -rf ../interface $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig server part
 		$command = "cp -rf ../server $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
-		
+
+
 		//* Create the config file for ISPConfig interface
 		$configfile = 'config.inc.php';
 		$content = $this->get_template_file($configfile, true, true); //* get contents & insert db cred
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
 		$this->write_config_file("$install_dir/interface/lib/$configfile", $content);
-		
+
 		//* Create the config file for ISPConfig server
 		$this->write_config_file("$install_dir/server/lib/$configfile", $content);
-		
+
 		//* Create the config file for remote-actions (but only, if it does not exist, because
 		//  the value is a autoinc-value and so changed by the remoteaction_core_module
 		if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) {
 			$content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
 			wf($install_dir.'/server/lib/remote_action.inc.php', $content);
 		}
-		
-    	// Enable the server modules and plugins.
+
+		// Enable the server modules and plugins.
 		// TODO: Implement a selector which modules and plugins shall be enabled.
 		$dir = $install_dir.'/server/mods-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) {
@@ -787,11 +789,11 @@ class installer extends installer_base
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
-						if(method_exists($tmp,'onInstall') && $tmp->onInstall()) {
+						if(method_exists($tmp, 'onInstall') && $tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) {
 								@symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
 							}
@@ -807,7 +809,7 @@ class installer extends installer_base
 				closedir($dh);
 			}
 		}
-		
+
 		//* Update the server config
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
 		$web_server_enabled = ($conf['services']['web'])?1:0;
@@ -815,16 +817,16 @@ class installer extends installer_base
 		$file_server_enabled = ($conf['services']['file'])?1:0;
 		$db_server_enabled = ($conf['services']['db'])?1:0;
 		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
-		
-    	$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
-		
+
+		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
+
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$this->dbmaster->query($sql);
 			$this->db->query($sql);
 		} else {
 			$this->db->query($sql);
 		}
-		
+
 		//* Chmod the files
 		$command = "chmod -R 750 $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -832,40 +834,40 @@ class installer extends installer_base
 		//* chown the files to the ispconfig user and group
 		$command = "chown -R ispconfig:ispconfig $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Make the global language file directory group writable
 		exec("chmod -R 770 $install_dir/interface/lib/lang");
-		
+
 		//* Make the temp directory for language file exports writable
 		if(is_dir($install_dir.'/interface/web/temp')) {
 			exec("chmod -R 770 $install_dir/interface/web/temp");
 		}
-		
-	    //* Make all interface language file directories group writable
+
+		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) { 
-	   		if ($file != '.' && $file != '..') {
-	        	if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
+		while ($file = @readdir($handle)) {
+			if ($file != '.' && $file != '..') {
+				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
 			}
 		}
-		
+
 		//* Make the APS directories group writable
 		exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
 		exec("chmod -R 770 $install_dir/server/aps_packages");
-		
-	    //* make sure that the server config file (not the interface one) is only readable by the root user
+
+		//* make sure that the server config file (not the interface one) is only readable by the root user
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
@@ -880,12 +882,12 @@ class installer extends installer_base
 			chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 			chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 		}
-		
+
 		if(is_dir($install_dir.'/interface/invoices')) {
 			exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices'));
 			exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices'));
 		}
-		
+
 		// TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
 		// and must be fixed as this will allow the apache user to read the ispconfig files.
 		// Later this must run as own apache server or via suexec!
@@ -905,23 +907,23 @@ class installer extends installer_base
 				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
 		}
-		
+
 		//* Make the shell scripts executable
 		$command = "chmod +x $install_dir/server/scripts/*.sh";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			$content = $this->get_template_file("apache_ispconfig.vhost", true);
 			$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
-		
+
 			//* comment out the listen directive if port is 80 or 443
 			if ($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
@@ -932,10 +934,10 @@ class installer extends installer_base
 			} else {
 				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
-		
+
 			$vhost_path = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost';
 			$this->write_config_file($vhost_path, $content);
-		
+
 			if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
 				$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);
@@ -944,7 +946,7 @@ class installer extends installer_base
 				wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
 				exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
 				chmod('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', 0755);
-				@symlink($install_dir.'/interface/web','/var/www/ispconfig');
+				@symlink($install_dir.'/interface/web', '/var/www/ispconfig');
 				exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
 			}
 		}
@@ -957,7 +959,7 @@ class installer extends installer_base
 			// Dont just copy over the virtualhost template but add some custom settings
 			$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')) {
 				$content = str_replace('{ssl_on}', ' on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
@@ -967,19 +969,19 @@ class installer extends installer_base
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
-			
+
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
-			
+
 			unset($content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
@@ -995,31 +997,31 @@ class installer extends installer_base
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
 		}
-		
+
 		//* Install the update script
 		if (is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) {
 			unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
 		}
-		
+
 		chown($install_dir.'/server/scripts/update_from_svn.sh', 'root');
 		chmod($install_dir.'/server/scripts/update_from_svn.sh', 0700);
 		chown($install_dir.'/server/scripts/update_from_tgz.sh', 'root');
 		chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
 		chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
 		chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
-		
+
 		if (!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) {
 			symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_svn.sh');
 		}
-		
+
 		if (!is_link('/usr/local/bin/ispconfig_update.sh')) {
 			symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update.sh');
 		}
-		
+
 		//* Make the logs readable for the ispconfig user
 		if (is_file('/var/log/maillog')) {
 			exec('chmod +r /var/log/maillog');
@@ -1033,7 +1035,7 @@ class installer extends installer_base
 		if (is_file('/var/log/clamav/freshclam.log')) {
 			exec('chmod +r /var/log/clamav/freshclam.log');
 		}
-		
+
 		//* Create the ispconfig log directory
 		if (!is_dir($conf['ispconfig_log_dir'])) {
 			mkdir($conf['ispconfig_log_dir']);
@@ -1041,25 +1043,26 @@ class installer extends installer_base
 		if (!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) {
 			touch($conf['ispconfig_log_dir'].'/ispconfig.log');
 		}
-		
+
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
 		}
 		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
-		
+
 		rename($install_dir.'/server/scripts/run-getmail.sh', '/usr/local/bin/run-getmail.sh');
-		
+
 		if (is_user('getmail')) {
 			chown('/usr/local/bin/run-getmail.sh', 'getmail');
 		}
 		chmod('/usr/local/bin/run-getmail.sh', 0744);
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-		
-    }
+
+	}
+
 }
 
 ?>
diff --git a/install/dist/lib/opensuse.lib.php b/install/dist/lib/opensuse.lib.php
index 1e536abd6489989ea42f48066b5e4c8a146c33d7..7663f7eb39cddbcb53732a0cdc8bc664dcef0368 100644
--- a/install/dist/lib/opensuse.lib.php
+++ b/install/dist/lib/opensuse.lib.php
@@ -58,7 +58,7 @@ class installer_dist extends installer_base {
 				}
 			}
 		}
-		
+
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
 
@@ -69,13 +69,13 @@ class installer_dist extends installer_base {
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -87,91 +87,91 @@ class installer_dist extends installer_base {
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
 
 		wf($full_file_name, $content);
-		
+
 		//* Write virtual_to_transport.sh script
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
+
 		if(is_dir('/etc/mailman')) {
 			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);
-		}
-		
+				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);
+		}
+
 		//* Create aliasaes
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
 	}
-	
+
 	function configure_postfix($options = '')
-    {
-        global $conf;
+	{
+		global $conf;
 		$cf = $conf['postfix'];
 		$config_dir = $cf['config_dir'];
-        
+
 		if(!is_dir($config_dir)){
-            $this->error("The postfix configuration directory '$config_dir' does not exist.");
-        }
-        
+			$this->error("The postfix configuration directory '$config_dir' does not exist.");
+		}
+
 		//* mysql-virtual_domains.cf
-        $this->process_postfix_config('mysql-virtual_domains.cf');
+		$this->process_postfix_config('mysql-virtual_domains.cf');
 
 		//* mysql-virtual_forwardings.cf
-        $this->process_postfix_config('mysql-virtual_forwardings.cf');
+		$this->process_postfix_config('mysql-virtual_forwardings.cf');
 
 		//* mysql-virtual_mailboxes.cf
-        $this->process_postfix_config('mysql-virtual_mailboxes.cf');
+		$this->process_postfix_config('mysql-virtual_mailboxes.cf');
 
 		//* mysql-virtual_email2email.cf
-        $this->process_postfix_config('mysql-virtual_email2email.cf');
+		$this->process_postfix_config('mysql-virtual_email2email.cf');
 
 		//* mysql-virtual_transports.cf
-        $this->process_postfix_config('mysql-virtual_transports.cf');
+		$this->process_postfix_config('mysql-virtual_transports.cf');
 
 		//* mysql-virtual_recipient.cf
-        $this->process_postfix_config('mysql-virtual_recipient.cf');
+		$this->process_postfix_config('mysql-virtual_recipient.cf');
 
 		//* mysql-virtual_sender.cf
-        $this->process_postfix_config('mysql-virtual_sender.cf');
+		$this->process_postfix_config('mysql-virtual_sender.cf');
 
 		//* mysql-virtual_client.cf
-        $this->process_postfix_config('mysql-virtual_client.cf');
-		
+		$this->process_postfix_config('mysql-virtual_client.cf');
+
 		//* mysql-virtual_relaydomains.cf
-        $this->process_postfix_config('mysql-virtual_relaydomains.cf');
-		
+		$this->process_postfix_config('mysql-virtual_relaydomains.cf');
+
 		//* mysql-virtual_relayrecipientmaps.cf
-        $this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
+		$this->process_postfix_config('mysql-virtual_relayrecipientmaps.cf');
 
-	//* postfix-dkim
-	$full_file_name=$config_dir.'/tag_as_originating.re';
-	if(is_file($full_file_name)) {
-		copy($full_file_name, $config_dir.$configfile.'~');
-	}
-	wf($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10026');
+		//* postfix-dkim
+		$full_file_name=$config_dir.'/tag_as_originating.re';
+		if(is_file($full_file_name)) {
+			copy($full_file_name, $config_dir.$configfile.'~');
+		}
+		wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10026');
 
-	$full_file_name=$config_dir.'/tag_as_foreign.re';
-	if(is_file($full_file_name)) {
-		copy($full_file_name, $config_dir.$configfile.'~');
-	}
-	wf($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10024');
+		$full_file_name=$config_dir.'/tag_as_foreign.re';
+		if(is_file($full_file_name)) {
+			copy($full_file_name, $config_dir.$configfile.'~');
+		}
+		wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10024');
 
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-                 __FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
-		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null', 
-                __FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
-		
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+
 		if(!is_dir($cf['vmail_mailbox_base'])) mkdir($cf['vmail_mailbox_base']);
-		
+
 		//* Creating virtual mail user and group
 		if(is_group($cf['vmail_groupname'])) {
 			$command = 'groupmod -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
@@ -180,7 +180,7 @@ class installer_dist extends installer_base {
 			$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		if(is_user($cf['vmail_username'])) {
 			$command = 'usermod -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' -d '.$cf['vmail_mailbox_base'].' -s /bin/bash '.$cf['vmail_username'];
 			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -188,9 +188,9 @@ class installer_dist extends installer_base {
 			$command = 'useradd -g '.$cf['vmail_groupname'].' -u '.$cf['vmail_userid'].' '.$cf['vmail_username'].' -d '.$cf['vmail_mailbox_base'].' -m';
 			caselog("$command &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		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
 		$server_ini_rec = $this->db->queryOneRecord("SELECT config FROM server WHERE server_id = ".$conf['server_id']);
 		$server_ini_array = ini_to_array(stripslashes($server_ini_rec['config']));
@@ -199,40 +199,40 @@ class installer_dist extends installer_base {
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
 		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
-			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
+			$rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
 			}
 		}
 		unset($rbl_hosts);
 		unset($server_ini_array);
-		
+
 		//* These postconf commands will be executed on installation and update
-        $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
-		
+		$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) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
-		
+
 		//* Create the header and body check files
 		touch($config_dir.'/header_checks');
 		touch($config_dir.'/mime_header_checks');
 		touch($config_dir.'/nested_header_checks');
 		touch($config_dir.'/body_checks');
-		
+
 		//* Create the mailman files
 		if(!is_dir('/var/lib/mailman/data')) exec('mkdir -p /var/lib/mailman/data');
 		if(!is_file('/var/lib/mailman/data/aliases')) touch('/var/lib/mailman/data/aliases');
@@ -241,78 +241,78 @@ class installer_dist extends installer_base {
 		exec('postmap /var/lib/mailman/data/virtual-mailman');
 		if(!is_file('/var/lib/mailman/data/transport-mailman')) touch('/var/lib/mailman/data/transport-mailman');
 		exec('/usr/sbin/postmap /var/lib/mailman/data/transport-mailman');
-		
+
 		//* Make a backup copy of the main.cf file
 		copy($config_dir.'/main.cf', $config_dir.'/main.cf~');
-		
+
 		//* Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
-		if(!stristr($options,'dont-create-certs')) {
+
+		if(!stristr($options, 'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-                      .'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509';
 			exec($command);
-		
+
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
-		
+
 		//** We have to change the permissions of the courier authdaemon directory to make it accessible for maildrop.
 		$command = 'chmod 755  /var/run/authdaemon.courier-imap';
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
-		
-		//* Changing maildrop lines in posfix master.cf 
+
+		//* Changing maildrop lines in posfix master.cf
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~');
+		}
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
-		
-		$content = str_replace('  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-		
-		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}', 
-                   '  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-                     $content);
-		
+
+		$content = str_replace('  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
+		$content = str_replace('  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}',
+			'  flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d ${recipient} ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
+
 		// enable tlsmanager
-		$content = str_replace('#tlsmgr    unix  -       -       n       1000?   1       tlsmgr','tlsmgr    unix  -       -       n       1000?   1       tlsmgr',$content);
-		
+		$content = str_replace('#tlsmgr    unix  -       -       n       1000?   1       tlsmgr', 'tlsmgr    unix  -       -       n       1000?   1       tlsmgr', $content);
+
 		wf($configfile, $content);
-		
+
 		//* Writing the Maildrop mailfilter file
 		$configfile = 'mailfilter';
 		if(is_file($cf['vmail_mailbox_base'].'/.'.$configfile)){
-            copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
-        }
+			copy($cf['vmail_mailbox_base'].'/.'.$configfile, $cf['vmail_mailbox_base'].'/.'.$configfile.'~');
+		}
 		$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);
-		
+
 		//* Create the directory for the custom mailfilters
 		$command = 'mkdir '.$cf['vmail_mailbox_base'].'/mailfilters';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Chmod and chown the .mailfilter file
 		$command = 'chown -R '.$cf['vmail_username'].':'.$cf['vmail_groupname'].' '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = 'chmod -R 600 '.$cf['vmail_mailbox_base'].'/.mailfilter';
 		caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 	}
-	
+
 	public function configure_saslauthd() {
 		global $conf;
-		
+
 		/*
 		$configfile = 'sasl_smtpd.conf';
 		if(is_file('/etc/sasl2/smtpd.conf')) copy('/etc/sasl2/smtpd.conf','/etc/sasl2/smtpd.conf~');
@@ -324,14 +324,14 @@ class installer_dist extends installer_base {
 		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
 		wf('/etc/sasl2/smtpd.conf',$content);
 		*/
-		
+
 		// TODO: Chmod and chown on the config file
-		
-		
+
+
 		/*
 		// Create the spool directory
 		exec('mkdir -p /var/spool/postfix/var/run/saslauthd');
-		
+
 		// Edit the file /etc/default/saslauthd
 		$configfile = $conf["saslauthd"]["config"];
 		if(is_file($configfile)) copy($configfile,$configfile.'~');
@@ -341,22 +341,22 @@ class installer_dist extends installer_base {
 		$content = str_replace('OPTIONS="-c"','OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"',$content);
 		wf($configfile,$content);
 		*/
-		
+
 		// Edit the file /etc/init.d/saslauthd
 		$configfile = $conf["init_scripts"].'/'.$conf["saslauthd"]["init_script"];
 		$content = rf($configfile);
-		$content = str_replace('/sbin/startproc $AUTHD_BIN -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1','/sbin/startproc $AUTHD_BIN -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1',$content);
-		$content = str_replace('/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1','/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1',$content);
-		
-		
-		if(is_file($configfile)) wf($configfile,$content);
-		
-		
-		
+		$content = str_replace('/sbin/startproc $AUTHD_BIN -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', '/sbin/startproc $AUTHD_BIN -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', $content);
+		$content = str_replace('/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', '/sbin/startproc $AUTHD_BIN $SASLAUTHD_PARAMS -r -a $SASLAUTHD_AUTHMECH -n $SASLAUTHD_THREADS > /dev/null 2>&1', $content);
+
+
+		if(is_file($configfile)) wf($configfile, $content);
+
+
+
 	}
-	
+
 	public function configure_pam()
-    {
+	{
 		global $conf;
 		$pam = $conf['pam'];
 		//* configure pam for SMTP authentication agains the ispconfig database
@@ -374,65 +374,65 @@ class installer_dist extends installer_base {
 		if(is_file("$pam/smtp"))    exec("chmod o= $pam/smtp");
 		//exec("chmod 660 $pam/smtp");
 		//exec("chown root:root $pam/smtp");
-	
+
 	}
-	
+
 	public function configure_courier()
-    {
+	{
 		global $conf;
 		$config_dir = $conf['courier']['config_dir'];
 		//* authmysqlrc
 		$configfile = 'authmysqlrc';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		exec("chmod 400 $config_dir/$configfile~");
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 660 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		//* authdaemonrc
 		$configfile = $conf['courier']['config_dir'].'/authdaemonrc';
 		if(is_file($configfile)){
-            copy($configfile, $configfile.'~');
-        }
+			copy($configfile, $configfile.'~');
+		}
 		if(is_file($configfile.'~')){
-            exec('chmod 400 '.$configfile.'~');
-        }
+			exec('chmod 400 '.$configfile.'~');
+		}
 		$content = rf($configfile);
 		$content = str_replace('authmodulelist=', 'authmodulelist="authmysql"', $content);
 		wf($configfile, $content);
 	}
-	
+
 	public function configure_dovecot()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['dovecot']['config_dir'];
-		
+
 		//* Configure master.cf and add a line for deliver
 		if(is_file($config_dir.'/master.cf')){
-            copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
-        }
+			copy($config_dir.'/master.cf', $config_dir.'/master.cf~2');
+		}
 		if(is_file($config_dir.'/master.cf~')){
-            exec('chmod 400 '.$config_dir.'/master.cf~2');
-        }
+			exec('chmod 400 '.$config_dir.'/master.cf~2');
+		}
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"dovecot/deliver")) {
+		if(!stristr($content, "dovecot/deliver")) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf["postfix"]["config_dir"].'/master.cf',$deliver_content);
+			af($conf["postfix"]["config_dir"].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
-		
-		
+
+
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
@@ -442,115 +442,115 @@ class installer_dist extends installer_base {
 			'smtpd_sasl_path = private/auth',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~3');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~3');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* backup dovecot.conf
 		$configfile = 'dovecot.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
-		
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
+
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
-		
+
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            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);
-            }
+			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 {
-            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);
-            }
+			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
 		$configfile = 'dovecot-sql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
 			exec("chmod 400 $config_dir/$configfile~");
-        }
-		
+		}
+
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf("$config_dir/$configfile", $content);
-		
+
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
 
 	}
-	
+
 	public function configure_amavis() {
 		global $conf;
-		
+
 		// amavisd user config file
 		$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')) @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 = 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);
-		$content = str_replace('{mysql_server_port}',$conf["mysql"]["port"],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		wf($conf["amavis"]["config_dir"].'/amavisd.conf',$content);
-		
-		
+		$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);
+		$content = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		wf($conf["amavis"]["config_dir"].'/amavisd.conf', $content);
+
+
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
 			'content_filter = amavis:[127.0.0.1]:10024',
 			'receive_override_options = no_address_mappings'
 		);
-		
+
 		// Make a backup copy of the main.cf file
-		copy($conf["postfix"]["config_dir"].'/main.cf',$conf["postfix"]["config_dir"].'/main.cf~2');
-		
+		copy($conf["postfix"]["config_dir"].'/main.cf', $conf["postfix"]["config_dir"].'/main.cf~2');
+
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
 			$command = "postconf -e '$cmd'";
 			caselog($command." &> /dev/null", __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf',$conf["postfix"]["config_dir"].'/master.cf~');
+		if(is_file($conf["postfix"]["config_dir"].'/master.cf')) copy($conf["postfix"]["config_dir"].'/master.cf', $conf["postfix"]["config_dir"].'/master.cf~');
 		$content = rf($conf["postfix"]["config_dir"].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,"127.0.0.1:10025")) {
+		if(!stristr($content, "127.0.0.1:10025")) {
 			unset($content);
 			$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);
+			af($conf["postfix"]["config_dir"].'/master.cf', $content);
 		}
 		unset($content);
-		
+
 		// Add the clamav user to the vscan group
 		exec('groupmod --add-user clamav vscan');
-		
-		
+
+
 	}
-	
+
 	public function configure_spamassassin()
-    {
+	{
 		global $conf;
-		
+
 		//* Enable spamasasssin on debian and ubuntu
 		/*
 		$configfile = '/etc/default/spamassassin';
@@ -562,40 +562,40 @@ class installer_dist extends installer_base {
 		wf($configfile, $content);
 		*/
 	}
-	
+
 	public function configure_getmail()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['getmail']['config_dir'];
-		
+
 		if(!is_dir($config_dir)) exec("mkdir -p ".escapeshellcmd($config_dir));
 
 		$command = "useradd -d $config_dir getmail";
 		if(!is_user('getmail')) caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chown -R getmail $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "chmod -R 700 $config_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
-	
+
+
 	public function configure_pureftpd()
-    {
+	{
 		global $conf;
-		
+
 		$config_dir = $conf['pureftpd']['config_dir'];
 
 		//* configure pam for SMTP authentication agains the ispconfig database
 		$configfile = 'db/mysql.conf';
 		if(is_file("$config_dir/$configfile")){
-            copy("$config_dir/$configfile", "$config_dir/$configfile~");
-        }
+			copy("$config_dir/$configfile", "$config_dir/$configfile~");
+		}
 		if(is_file("$config_dir/$configfile~")){
-            exec("chmod 400 $config_dir/$configfile~");
-        }
+			exec("chmod 400 $config_dir/$configfile~");
+		}
 		$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);
@@ -605,69 +605,69 @@ class installer_dist extends installer_base {
 		wf("$config_dir/$configfile", $content);
 		exec("chmod 600 $config_dir/$configfile");
 		exec("chown root:root $config_dir/$configfile");
-		
+
 		// copy our customized copy of pureftpd.conf to the pure-ftpd config directory
 		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");
-        }
-		
+			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");
+		}
+
 	}
-	
+
 	public function configure_mydns()
-    {
+	{
 		global $conf;
-		
+
 		// configure pam for SMTP authentication agains the ispconfig database
 		$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)) 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 = 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);
-		$content = str_replace('{mysql_server_host}',$conf["mysql"]["host"],$content);
-		$content = str_replace('{server_id}',$conf["server_id"],$content);
-		wf($conf["mydns"]["config_dir"].'/'.$configfile,$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf["mysql"]["host"], $content);
+		$content = str_replace('{server_id}', $conf["server_id"], $content);
+		wf($conf["mydns"]["config_dir"].'/'.$configfile, $content);
 		exec('chmod 600 '.$conf["mydns"]["config_dir"].'/'.$configfile);
 		exec('chown root:root '.$conf["mydns"]["config_dir"].'/'.$configfile);
-	
+
 	}
-	
+
 	public function configure_apache()
-    {	
+	{
 		global $conf;
-		
+
 		if($conf['apache']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		exec('mkdir -p /var/log/ispconfig/httpd');
-		
+
 		//if(is_file('/etc/suphp.conf')) {
-		replaceLine('/etc/suphp.conf','php=php','x-httpd-suphp="php:/srv/www/cgi-bin/php5"',0,0);
-		replaceLine('/etc/suphp.conf','php="php','x-httpd-suphp="php:/srv/www/cgi-bin/php5"',0,0);
-		replaceLine('/etc/suphp.conf','docroot=','docroot=/srv/www',0,0);
-		replaceLine('/etc/suphp.conf','umask=0077','umask=0022',0);
+		replaceLine('/etc/suphp.conf', 'php=php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0);
+		replaceLine('/etc/suphp.conf', 'php="php', 'x-httpd-suphp="php:/srv/www/cgi-bin/php5"', 0, 0);
+		replaceLine('/etc/suphp.conf', 'docroot=', 'docroot=/srv/www', 0, 0);
+		replaceLine('/etc/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		//}
-		
+
 		if(!file_exists('/srv/www/cgi-bin/php5') && file_exists('/srv/www/cgi-bin/php')) {
-			symlink('/srv/www/cgi-bin/php','/srv/www/cgi-bin/php5');
+			symlink('/srv/www/cgi-bin/php', '/srv/www/cgi-bin/php5');
 		}
-		
+
 		// Sites enabled and available dirs
 		exec('mkdir -p '.$conf['apache']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['apache']['vhost_conf_dir']);
-		
+
 		$content = rf('/etc/apache2/httpd.conf');
-		if(!stristr($content,'Include /etc/apache2/sites-enabled/')) {
-			af('/etc/apache2/httpd.conf',"\n<Directory /srv/www>\n    Options FollowSymlinks\n</Directory>\n\nInclude /etc/apache2/sites-enabled/\n\n");
+		if(!stristr($content, 'Include /etc/apache2/sites-enabled/')) {
+			af('/etc/apache2/httpd.conf', "\n<Directory /srv/www>\n    Options FollowSymlinks\n</Directory>\n\nInclude /etc/apache2/sites-enabled/\n\n");
 		}
 		unset($content);
-		
+
 		//* Copy the ISPConfig configuration include
-        $vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
-        $vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
+		$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
+		$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
+
 		//copy('tpl/apache_ispconfig.conf.master',$vhost_conf_dir.'/ispconfig.conf');
 		$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'");
@@ -679,7 +679,7 @@ class installer_dist extends installer_base {
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -690,37 +690,37 @@ class installer_dist extends installer_base {
 				}
 			}
 		}
-		
+
 		$content .= "\n";
-		wf($vhost_conf_dir.'/ispconfig.conf',$content);
-		
+		wf($vhost_conf_dir.'/ispconfig.conf', $content);
+
 		if(!@is_link($vhost_conf_enabled_dir."/000-ispconfig.conf")) {
 			exec("ln -s ".$vhost_conf_dir."/ispconfig.conf ".$vhost_conf_enabled_dir."/000-ispconfig.conf");
 		}
-		
+
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			exec('mkdir /etc/webalizer');
 			exec('ln -s /etc/webalizer.conf /etc/webalizer/webalizer.conf');
 		}
-		
+
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		// create PHP-FPM pool dir
 		exec('mkdir -p '.$conf['nginx']['php_fpm_pool_dir']);
-		
+
 		$content = rf('/etc/php5/fpm/php-fpm.conf');
 		if(stripos($content, 'include=/etc/php5/fpm/pool.d/*.conf') === false){
-			af('/etc/php5/fpm/php-fpm.conf',"\ninclude=/etc/php5/fpm/pool.d/*.conf");
+			af('/etc/php5/fpm/php-fpm.conf', "\ninclude=/etc/php5/fpm/pool.d/*.conf");
 		}
 		unset($content);
 		if(!@is_file($conf['nginx']['php_fpm_ini_path'])){
@@ -732,34 +732,34 @@ class installer_dist extends installer_base {
 				exec('cp -f /etc/php5/apache2/php.ini '.$conf['nginx']['php_fpm_ini_path']);
 			}
 		}
-		
+
 	}
-	
+
 	public function configure_nginx(){
 		global $conf;
-		
+
 		if($conf['nginx']['installed'] == false) return;
 		//* Create the logging directory for the vhost logfiles
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
-		
+
 		// Sites enabled and available dirs
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_enabled_dir']);
 		exec('mkdir -p '.$conf['nginx']['vhost_conf_dir']);
-		
+
 		$content = rf('/etc/nginx/nginx.conf');
 		if(stripos($content, 'include /etc/nginx/sites-enabled/*.vhost;') === false){
 			$content = trim($content);
-			$content = substr($content,0,-1)."\n    include /etc/nginx/sites-enabled/*.vhost;\n}";
-			wf('/etc/nginx/nginx.conf',$content);
+			$content = substr($content, 0, -1)."\n    include /etc/nginx/sites-enabled/*.vhost;\n}";
+			wf('/etc/nginx/nginx.conf', $content);
 		}
 		unset($content);
-		
+
 		// create PHP-FPM pool dir
 		exec('mkdir -p '.$conf['nginx']['php_fpm_pool_dir']);
-		
+
 		$content = rf('/etc/php5/fpm/php-fpm.conf');
 		if(stripos($content, 'include=/etc/php5/fpm/pool.d/*.conf') === false){
-			af('/etc/php5/fpm/php-fpm.conf',"\ninclude=/etc/php5/fpm/pool.d/*.conf");
+			af('/etc/php5/fpm/php-fpm.conf', "\ninclude=/etc/php5/fpm/pool.d/*.conf");
 		}
 		unset($content);
 		if(!@is_file($conf['nginx']['php_fpm_ini_path'])){
@@ -775,95 +775,95 @@ class installer_dist extends installer_base {
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
-		
+
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
-		
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
+
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
 		if(!is_group('sshusers')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 	}
-	
+
 	public function configure_firewall()
 	{
 		global $conf;
-		
+
 		$dist_init_scripts = $conf['init_scripts'];
-  		
+
 		if(is_dir("/etc/Bastille.backup")) caselog("rm -rf /etc/Bastille.backup", __FILE__, __LINE__);
 		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__);
-  		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);
+		@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__);
+		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);
+
+		$tcp_public_services = '';
+		$udp_public_services = '';
 
-  		$tcp_public_services = '';
-  		$udp_public_services = '';
-		
 		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
-		
-  		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
-    		$tcp_public_services = trim(str_replace(',',' ',$row["tcp_port"]));
-    		$udp_public_services = trim(str_replace(',',' ',$row["udp_port"]));
-  		} else {
-    		$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
-    		$udp_public_services = '53';
-  		}
-		
+
+		if(trim($row["tcp_port"]) != '' || trim($row["udp_port"]) != ''){
+			$tcp_public_services = trim(str_replace(',', ' ', $row["tcp_port"]));
+			$udp_public_services = trim(str_replace(',', ' ', $row["udp_port"]));
+		} else {
+			$tcp_public_services = '21 22 25 53 80 110 443 3306 8080 10000';
+			$udp_public_services = '53';
+		}
+
 		if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
 			$tcp_public_services .= ' '.intval($conf['apache']['vhost_port']);
 			if($row["tcp_port"] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ',".intval($conf['apache']['vhost_port'])."' WHERE server_id = ".intval($conf['server_id']));
 		}
 
-  		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
-  		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
-		
-  		wf("/etc/Bastille/bastille-firewall.cfg", $content);
+		$content = str_replace("{TCP_PUBLIC_SERVICES}", $tcp_public_services, $content);
+		$content = str_replace("{UDP_PUBLIC_SERVICES}", $udp_public_services, $content);
+
+		wf("/etc/Bastille/bastille-firewall.cfg", $content);
 
-  		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
-  		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
+		if(is_file($dist_init_scripts."/bastille-firewall")) caselog("mv -f $dist_init_scripts/bastille-firewall $dist_init_scripts/bastille-firewall.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-firewall $dist_init_scripts", __FILE__, __LINE__);
+		caselog("chmod 700 $dist_init_scripts/bastille-firewall", __FILE__, __LINE__);
 
-  		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+		if(is_file("/sbin/bastille-ipchains")) caselog("mv -f /sbin/bastille-ipchains /sbin/bastille-ipchains.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-ipchains /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-ipchains", __FILE__, __LINE__);
+
+		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
+		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
+		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
 
-  		if(is_file("/sbin/bastille-netfilter")) caselog("mv -f /sbin/bastille-netfilter /sbin/bastille-netfilter.backup", __FILE__, __LINE__);
-  		caselog("cp -f apps/bastille-netfilter /sbin", __FILE__, __LINE__);
-  		caselog("chmod 700 /sbin/bastille-netfilter", __FILE__, __LINE__);
-		
 		if(!@is_dir('/var/lock/subsys')) caselog("mkdir /var/lock/subsys", __FILE__, __LINE__);
 
-  		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
-  		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
-  		unset($ipchains_location);
-  		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
-  		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
-  		unset($iptables_location);
+		exec("which ipchains &> /dev/null", $ipchains_location, $ret_val);
+		if(!is_file("/sbin/ipchains") && !is_link("/sbin/ipchains") && $ret_val == 0) phpcaselog(@symlink(shell_exec("which ipchains"), "/sbin/ipchains"), 'create symlink', __FILE__, __LINE__);
+		unset($ipchains_location);
+		exec("which iptables &> /dev/null", $iptables_location, $ret_val);
+		if(!is_file("/sbin/iptables") && !is_link("/sbin/iptables") && $ret_val == 0) phpcaselog(@symlink(trim(shell_exec("which iptables")), "/sbin/iptables"), 'create symlink', __FILE__, __LINE__);
+		unset($iptables_location);
 
 	}
 
 	public function install_ispconfig()
-    {
+	{
 		global $conf;
-		
+
 		$install_dir = $conf['ispconfig_install_dir'];
 
 		//* Create the ISPConfig installation directory
@@ -871,93 +871,93 @@ class installer_dist extends installer_base {
 			$command = "mkdir $install_dir";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		//* Create a ISPConfig user and group
 		$command = 'groupadd ispconfig';
 		if(!is_group('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		$command = "useradd -g ispconfig -d $install_dir ispconfig";
 		if(!is_user('ispconfig')) caselog($command.' &> /dev/null 2> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig interface part
 		$command = "cp -rf ../interface $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* copy the ISPConfig server part
 		$command = "cp -rf ../server $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create a symlink, so ISPConfig is accessible via web
 		// Replaced by a separate vhost definition for port 8080
 		// $command = "ln -s $install_dir/interface/web/ /var/www/ispconfig";
 		// caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Create the config file for ISPConfig interface
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/interface/lib/'.$configfile)){
-            copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/interface/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$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_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
 		wf("$install_dir/interface/lib/$configfile", $content);
-		
+
 		//* Create the config file for ISPConfig server
 		$configfile = 'config.inc.php';
 		if(is_file($install_dir.'/server/lib/'.$configfile)){
-            copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
-        }
+			copy("$install_dir/server/lib/$configfile", "$install_dir/interface/lib/$configfile~");
+		}
 		$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);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
-		
+
 		$content = str_replace('{mysql_master_server_ispconfig_user}', $conf['mysql']['master_ispconfig_user'], $content);
 		$content = str_replace('{mysql_master_server_ispconfig_password}', $conf['mysql']['master_ispconfig_password'], $content);
 		$content = str_replace('{mysql_master_server_database}', $conf['mysql']['master_database'], $content);
 		$content = str_replace('{mysql_master_server_host}', $conf['mysql']['master_host'], $content);
-		
+
 		$content = str_replace('{server_id}', $conf['server_id'], $content);
 		$content = str_replace('{ispconfig_log_priority}', $conf['ispconfig_log_priority'], $content);
 		$content = str_replace('{language}', $conf['language'], $content);
 		$content = str_replace('{timezone}', $conf['timezone'], $content);
 		$content = str_replace('{theme}', $conf['theme'], $content);
 		$content = str_replace('{language_file_import_enabled}', ($conf['language_file_import_enabled'] == true)?'true':'false', $content);
-		
+
 		wf("$install_dir/server/lib/$configfile", $content);
-		
+
 		//* Create the config file for remote-actions (but only, if it does not exist, because
 		//  the value is a autoinc-value and so changed by the remoteaction_core_module
 		if (!file_exists($install_dir.'/server/lib/remote_action.inc.php')) {
 			$content = '<?php' . "\n" . '$maxid_remote_action = 0;' . "\n" . '?>';
 			wf($install_dir.'/server/lib/remote_action.inc.php', $content);
 		}
-		
+
 		//* Enable the server modules and plugins.
 		// TODO: Implement a selector which modules and plugins shall be enabled.
 		$dir = $install_dir.'/server/mods-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) @symlink($install_dir.'/server/mods-available/'.$file, $install_dir.'/server/mods-enabled/'.$file);
@@ -971,16 +971,16 @@ class installer_dist extends installer_base {
 				closedir($dh);
 			}
 		}
-		
+
 		$dir = $install_dir.'/server/plugins-available/';
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) @symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
@@ -994,7 +994,7 @@ class installer_dist extends installer_base {
 				closedir($dh);
 			}
 		}
-		
+
 		// Update the server config
 		$mail_server_enabled = ($conf['services']['mail'])?1:0;
 		$web_server_enabled = ($conf['services']['web'])?1:0;
@@ -1003,14 +1003,14 @@ class installer_dist extends installer_base {
 		$db_server_enabled = ($conf['services']['db'])?1:0;
 		$vserver_server_enabled = ($conf['services']['vserver'])?1:0;
 		$sql = "UPDATE `server` SET mail_server = '$mail_server_enabled', web_server = '$web_server_enabled', dns_server = '$dns_server_enabled', file_server = '$file_server_enabled', db_server = '$db_server_enabled', vserver_server = '$vserver_server_enabled' WHERE server_id = ".intval($conf['server_id']);
-		
+
 		if($conf['mysql']['master_slave_setup'] == 'y') {
 			$this->dbmaster->query($sql);
 			$this->db->query($sql);
 		} else {
 			$this->db->query($sql);
 		}
-		
+
 		//* Chmod the files
 		$command = "chmod -R 750 $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
@@ -1018,48 +1018,48 @@ class installer_dist extends installer_base {
 		//* chown the files to the ispconfig user and group
 		$command = "chown -R ispconfig:ispconfig $install_dir";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
+
 		//* Make the global language file directory group writable
 		exec("chmod -R 770 $install_dir/interface/lib/lang");
-		
+
 		//* Make the temp directory for language file exports writable
 		exec("chmod -R 770 $install_dir/interface/web/temp");
-		
+
 		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) { 
-	   		if ($file != '.' && $file != '..') {
-	        	if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
+		while ($file = @readdir($handle)) {
+			if ($file != '.' && $file != '..') {
+				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
 			}
 		}
-		
+
 		//* Make the APS directories group writable
 		exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
 		exec("chmod -R 770 $install_dir/server/aps_packages");
-		
+
 		//* make sure that the server config file (not the interface one) is only readable by the root user
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
 		chgrp($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
-		
+
 		if(@is_file("$install_dir/server/lib/mysql_clientdb.conf")) {
 			exec("chmod 600 $install_dir/server/lib/mysql_clientdb.conf");
 			exec("chown root:root $install_dir/server/lib/mysql_clientdb.conf");
 		}
-		
+
 		// TODO: FIXME: add the www-data user to the ispconfig group. This is just for testing
 		// and must be fixed as this will allow the apache user to read the ispconfig files.
 		// Later this must run as own apache server or via suexec!
@@ -1079,31 +1079,31 @@ class installer_dist extends installer_base {
 				caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 			}
 		}
-		
+
 		//* Make the shell scripts executable
 		$command = "chmod +x $install_dir/server/scripts/*.sh";
 		caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
-		
-		
+
+
 		if($conf['apache']['installed'] == true && $this->install_ispconfig_interface == true){
 			//* Copy the ISPConfig vhost for the controlpanel
 			// TODO: These are missing! should they be "vhost_dist_*_dir" ?
 			$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
-        
-        
+
+
 			// Dont just copy over the virtualhost template but add some custom settings
-         
+
 			$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
 			if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-		
+
 			if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) {
 				$content = str_replace('{ssl_comment}', '', $content);
 			} else {
@@ -1114,23 +1114,23 @@ class installer_dist extends installer_base {
 			} else {
 				$content = str_replace('{ssl_bundle_comment}', '#', $content);
 			}
-		
+
 			$content = str_replace('/var/www/', '/srv/www/', $content);
-		
+
 			wf("$vhost_conf_dir/ispconfig.vhost", $content);
-		
+
 			//if(!is_file('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$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');
-				wf('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
-				exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
-				exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
-				exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
-			
+			$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');
+			wf('/srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
+			exec('chmod +x /srv/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
+			exec('ln -s /usr/local/ispconfig/interface/web /srv/www/ispconfig');
+			exec('chown -R ispconfig:ispconfig /srv/www/php-fcgi-scripts/ispconfig');
+
 			//}
-		
+
 			//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
 			//* and create the symlink
 			if($this->is_update == false) {
@@ -1138,11 +1138,11 @@ class installer_dist extends installer_base {
 				if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
 					exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
 				}
-			
+
 			}
-		
+
 			// Fix a setting in vhost master file for suse
-			replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master',"suPHP_UserGroup","        suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>",0);
+			replaceLine('/usr/local/ispconfig/server/conf/vhost.conf.master', "suPHP_UserGroup", "        suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>", 0);
 		}
 
 		if($conf['nginx']['installed'] == true && $this->install_ispconfig_interface == true){
@@ -1153,7 +1153,7 @@ class installer_dist extends installer_base {
 			// Dont just copy over the virtualhost template but add some custom settings
 			$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')) {
 				$content = str_replace('{ssl_on}', ' on', $content);
 				$content = str_replace('{ssl_comment}', '', $content);
@@ -1163,19 +1163,19 @@ class installer_dist extends installer_base {
 				$content = str_replace('{ssl_comment}', '#', $content);
 				$content = str_replace('{fastcgi_ssl}', 'off', $content);
 			}
-			
+
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
-			
+
 			//$content = str_replace('{fpm_port}', $conf['nginx']['php_fpm_start_port'], $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 
 			wf($vhost_conf_dir.'/ispconfig.vhost', $content);
-			
+
 			unset($content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/php_fpm_pool.conf.master', 'tpl/php_fpm_pool.conf.master');
@@ -1191,20 +1191,20 @@ class installer_dist extends installer_base {
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
-			
+
 			// create symlinks from /usr/share to phpMyAdmin and SquirrelMail, if they are installed
-			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/srv/www/htdocs/phpMyAdmin')) symlink('/srv/www/htdocs/phpMyAdmin/','/usr/share/phpmyadmin');
-			if(!@file_exists('/usr/share/squirrelmail') && @is_dir('/srv/www/htdocs/squirrelmail')) symlink('/srv/www/htdocs/squirrelmail/','/usr/share/squirrelmail');
+			if(!@file_exists('/usr/share/phpmyadmin') && @is_dir('/srv/www/htdocs/phpMyAdmin')) symlink('/srv/www/htdocs/phpMyAdmin/', '/usr/share/phpmyadmin');
+			if(!@file_exists('/usr/share/squirrelmail') && @is_dir('/srv/www/htdocs/squirrelmail')) symlink('/srv/www/htdocs/squirrelmail/', '/usr/share/squirrelmail');
 		}
-		
-		
+
+
 		// Make the Clamav log files readable by ISPConfig
 		//exec('chmod +r /var/log/clamav/clamav.log');
 		//exec('chmod +r /var/log/clamav/freshclam.log');
-		
+
 		//* Install the update script
 		if(is_file('/usr/local/bin/ispconfig_update_from_svn.sh')) unlink('/usr/local/bin/ispconfig_update_from_svn.sh');
 		exec('chown root /usr/local/ispconfig/server/scripts/update_from_svn.sh');
@@ -1215,96 +1215,96 @@ class installer_dist extends installer_base {
 		exec('chmod 700 /usr/local/ispconfig/server/scripts/ispconfig_update.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update_from_svn.sh');
 		if(!is_link('/usr/local/bin/ispconfig_update.sh')) exec('ln -s /usr/local/ispconfig/server/scripts/ispconfig_update.sh /usr/local/bin/ispconfig_update.sh');
-		
+
 		//set the fast cgi starter script to executable
 		//exec('chmod 755 '.$install_dir.'/interface/bin/php-fcgi');
-		
+
 		//* Make the logs readable for the ispconfig user
 		if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log');
 		if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn');
 		if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err');
 		if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages');
-		
+
 		//To enable apache to read the directories
 		exec('chmod a+rx /usr/local/ispconfig');
 		exec('chmod -R 751 /usr/local/ispconfig/interface');
 		exec('chmod a+rx /usr/local/ispconfig/interface/web');
-		
+
 		//* Create the ispconfig log directory
 		if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
 		if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
-		
+
 		if(is_user('getmail')) {
 			exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
 			exec('chown getmail /usr/local/bin/run-getmail.sh');
 			exec('chmod 744 /usr/local/bin/run-getmail.sh');
 		}
-		
+
 		if(is_dir($install_dir.'/interface/invoices')) {
 			exec('chmod -R 770 '.escapeshellarg($install_dir.'/interface/invoices'));
 			exec('chown -R ispconfig:ispconfig '.escapeshellarg($install_dir.'/interface/invoices'));
 		}
-		
+
 		//* Create the ispconfig auth log file and set uid/gid
 		if(!is_file($conf['ispconfig_log_dir'].'/auth.log')) {
 			touch($conf['ispconfig_log_dir'].'/auth.log');
 		}
 		exec('chown ispconfig:ispconfig '. $conf['ispconfig_log_dir'].'/auth.log');
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-		
-		
+
+
 	}
-	
+
 	public function configure_dbserver()
 	{
 		global $conf;
-		
+
 		//* If this server shall act as database server for client DB's, we configure this here
 		$install_dir = $conf['ispconfig_install_dir'];
-		
-		// Create a file with the database login details which 
+
+		// Create a file with the database login details which
 		// are used to create the client databases.
-		
+
 		if(!is_dir("$install_dir/server/lib")) {
 			$command = "mkdir $install_dir/server/lib";
 			caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
 		}
-		
+
 		$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);
-		wf("$install_dir/server/lib/mysql_clientdb.conf",$content);
+		$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);
+		wf("$install_dir/server/lib/mysql_clientdb.conf", $content);
 		exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
 		exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
-		
+
 	}
-	
+
 	public function install_crontab()
-    {		
+	{
 		global $conf;
-		
+
 		//* Root Crontab
 		exec('crontab -u root -l > crontab.txt');
 		$existing_root_cron_jobs = file('crontab.txt');
-		
+
 		// remove existing ispconfig cronjobs, in case the syntax has changed
 		foreach($existing_root_cron_jobs as $key => $val) {
-			if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
+			if(stristr($val, '/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
 		}
-		
+
 		$root_cron_jobs = array(
 			'* * * * * /usr/local/ispconfig/server/server.sh &> /dev/null',
 			'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh &> /dev/null'
 		);
-		
+
 		if ($conf['nginx']['installed'] == true) {
 			$root_cron_jobs[] = "0 0 * * * /usr/local/ispconfig/server/scripts/create_daily_nginx_access_logs.sh &> /dev/null";
 		}
-		
+
 		foreach($root_cron_jobs as $cron_job) {
 			if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
 				$existing_root_cron_jobs[] = $cron_job."\n";
@@ -1313,22 +1313,22 @@ class installer_dist extends installer_base {
 		file_put_contents('crontab.txt', $existing_root_cron_jobs);
 		exec('crontab -u root crontab.txt &> /dev/null');
 		unlink('crontab.txt');
-		
+
 		//* Getmail crontab
 		if(is_user('getmail')) {
-        	$cf = $conf['getmail'];
+			$cf = $conf['getmail'];
 			exec('crontab -u getmail -l > crontab.txt');
 			$existing_cron_jobs = file('crontab.txt');
-		
+
 			$cron_jobs = array(
-                '*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
-            );
-		
+				'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
+			);
+
 			// remove existing ispconfig cronjobs, in case the syntax has changed
 			foreach($existing_cron_jobs as $key => $val) {
-				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
+				if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
 			}
-		
+
 			foreach($cron_jobs as $cron_job) {
 				if(!in_array($cron_job."\n", $existing_cron_jobs)) {
 					$existing_cron_jobs[] = $cron_job."\n";
@@ -1338,7 +1338,7 @@ class installer_dist extends installer_base {
 			exec('crontab -u getmail crontab.txt &> /dev/null');
 			unlink('crontab.txt');
 		}
-		
+
 		exec('touch /var/log/ispconfig/cron.log');
 		exec('chmod 660 /var/log/ispconfig/cron.log');
 	}
diff --git a/install/dist/lib/opensuse110.lib.php b/install/dist/lib/opensuse110.lib.php
index da77b423aecf247618a2647aa4b2663d64651ad4..aeda9b9fd1c6b83d7388fc91bde429a6e4dd5b81 100644
--- a/install/dist/lib/opensuse110.lib.php
+++ b/install/dist/lib/opensuse110.lib.php
@@ -33,4 +33,4 @@ class installer extends installer_dist {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/dist/lib/opensuse112.lib.php b/install/dist/lib/opensuse112.lib.php
index da77b423aecf247618a2647aa4b2663d64651ad4..aeda9b9fd1c6b83d7388fc91bde429a6e4dd5b81 100644
--- a/install/dist/lib/opensuse112.lib.php
+++ b/install/dist/lib/opensuse112.lib.php
@@ -33,4 +33,4 @@ class installer extends installer_dist {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/install/install.php b/install/install.php
index 170cbdcea1c777fc4fcd5b28af9efc09e3507f33..9add1b3c60ed75f1cc2ca339213dd55cdd0ab1bd 100644
--- a/install/install.php
+++ b/install/install.php
@@ -37,7 +37,7 @@ error_reporting(E_ALL|E_STRICT);
 define('INSTALLER_RUN', true);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -46,14 +46,14 @@ echo " _____ ___________   _____              __ _         ____
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Initial configuration  \n\n";
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -76,12 +76,12 @@ $dist = get_distname();
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //****************************************************************************************************
-//** Installer Interface 
+//** Installer Interface
 //****************************************************************************************************
 $inst = new installer();
 swriteln($inst->lng('    Following will be a few questions for primary configuration so be careful.'));
@@ -90,7 +90,7 @@ swriteln($inst->lng('    Tap in "quit" (without the quotes) to stop the installe
 
 //** Check log file is writable (probably not root or sudo)
 if(!is_writable(dirname(ISPC_LOG_FILE))){
-    die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n");
+	die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n");
 }
 
 if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) {
@@ -105,7 +105,7 @@ if(is_dir('/usr/local/ispconfig')) {
 $inst->find_installed_apps();
 
 //** Select the language and set default timezone
-$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
+$conf['language'] = $inst->simple_query('Select language', array('en', 'de'), 'en');
 $conf['timezone'] = get_system_timezone();
 
 //* Set default theme
@@ -113,7 +113,7 @@ $conf['theme'] = 'default';
 $conf['language_file_import_enabled'] = true;
 
 //** Select installation mode
-$install_mode = $inst->simple_query('Installation mode', array('standard','expert'), 'standard');
+$install_mode = $inst->simple_query('Installation mode', array('standard', 'expert'), 'standard');
 
 
 //** Get the hostname
@@ -133,13 +133,13 @@ do {
 	$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
 	$tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database']);
 	$tmp_mysql_server_charset = $inst->free_query('MySQL charset', $conf['mysql']['charset']);
-	
+
 	if($install_mode == 'expert') {
 		swriteln("The next two questions are about the internal ISPConfig database user and password.\nIt is recommended to accept the defaults which are 'ispconfig' as username and a random password.\nIf you use a different password, use only numbers and chars for the password.\n");
 		$conf['mysql']['ispconfig_user'] = $inst->free_query('ISPConfig mysql database username', $conf['mysql']['ispconfig_user']);
 		$conf['mysql']['ispconfig_password'] = $inst->free_query('ISPConfig mysql database password', $conf['mysql']['ispconfig_password']);
 	}
-	
+
 	//* Initialize the MySQL server connection
 	if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
 		$conf['mysql']['host'] = $tmp_mysql_server_host;
@@ -155,44 +155,44 @@ do {
 unset($finished);
 
 // Resolve the IP address of the MySQL hostname.
-$tmp = explode(':',$conf['mysql']['host']);
+$tmp = explode(':', $conf['mysql']['host']);
 if(!$conf['mysql']['ip'] = gethostbyname($tmp[0])) die('Unable to resolve hostname'.$tmp[0]);
 unset($tmp);
 
 
 //** Initializing database connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 $inst->db = new db();
 
 //** Begin with standard or expert installation
 if($install_mode == 'standard') {
-	
+
 	//* Create the MySQL database
 	$inst->configure_database();
-	
+
 	//* Configure Webserver - Apache or nginx
 	if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
-		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache','nginx'), 'apache');
+		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache');
 		if($http_server_to_use == 'apache'){
 			$conf['nginx']['installed'] = false;
 		} else {
 			$conf['apache']['installed'] = false;
 		}
 	}
-	
+
 	//* Insert the Server record into the database
 	$inst->add_database_server_record();
 
 	//* Configure Postfix
 	$inst->configure_postfix();
-	
+
 	//* Configure Mailman
 	$inst->configure_mailman('install');
-	
+
 	//* Configure jailkit
 	swriteln('Configuring Jailkit');
 	$inst->configure_jailkit();
-	
+
 	if($conf['dovecot']['installed'] == true) {
 		//* Configure Dovecot
 		swriteln('Configuring Dovecot');
@@ -205,7 +205,7 @@ if($install_mode == 'standard') {
 		//* Configure PAM
 		swriteln('Configuring PAM');
 		$inst->configure_pam();
-		
+
 		//* Configure Courier
 		swriteln('Configuring Courier');
 		$inst->configure_courier();
@@ -222,7 +222,7 @@ if($install_mode == 'standard') {
 	//* Configure Getmail
 	swriteln('Configuring Getmail');
 	$inst->configure_getmail();
-	
+
 	//* Configure Pureftpd
 	swriteln('Configuring Pureftpd');
 	$inst->configure_pureftpd();
@@ -238,29 +238,29 @@ if($install_mode == 'standard') {
 		swriteln('Configuring MyDNS');
 		$inst->configure_mydns();
 	}
-	
+
 	//* Configure Apache
 	if($conf['apache']['installed'] == true){
 		swriteln('Configuring Apache');
 		$inst->configure_apache();
 	}
-	
+
 	//* Configure nginx
 	if($conf['nginx']['installed'] == true){
 		swriteln('Configuring nginx');
 		$inst->configure_nginx();
 	}
-	
-    //** Configure Vlogger
-    swriteln('Configuring Vlogger');
-    $inst->configure_vlogger();
-	
+
+	//** Configure Vlogger
+	swriteln('Configuring Vlogger');
+	$inst->configure_vlogger();
+
 	//** Configure apps vhost
 	swriteln('Configuring Apps vhost');
 	$inst->configure_apps_vhost();
-    
+
 	//* Configure Firewall
-	if($conf['ufw']['installed'] == true) { 
+	if($conf['ufw']['installed'] == true) {
 		//* Configure Ubuntu Firewall
 		$conf['services']['firewall'] = true;
 		swriteln('Configuring Ubuntu Firewall');
@@ -272,12 +272,12 @@ if($install_mode == 'standard') {
 		$inst->configure_bastille_firewall();
 	}
 
-    //* Configure Fail2ban
-    if($conf['fail2ban']['installed'] == true) {
-        swriteln('Configuring Fail2ban');
-        $inst->configure_fail2ban();
-    }
-	
+	//* Configure Fail2ban
+	if($conf['fail2ban']['installed'] == true) {
+		swriteln('Configuring Fail2ban');
+		$inst->configure_fail2ban();
+	}
+
 	/*
 	if($conf['squid']['installed'] == true) {
 		$conf['services']['proxy'] = true;
@@ -289,22 +289,22 @@ if($install_mode == 'standard') {
 		$inst->configure_nginx();
 	}
 	*/
-	
+
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig');
-	
+
 	//** Customize the port ISPConfig runs on
 	$ispconfig_vhost_port = $inst->free_query('ISPConfig Port', '8080');
 	if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
 	if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
 	unset($ispconfig_vhost_port);
 
-	if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface',array('y','n'),'y')) == 'y') {
-	  $inst->make_ispconfig_ssl_cert();
+	if(strtolower($inst->simple_query('Do you want a secure (SSL) connection to the ISPConfig web interface', array('y', 'n'), 'y')) == 'y') {
+		$inst->make_ispconfig_ssl_cert();
 	}
 
 	$inst->install_ispconfig();
-	
+
 	//* Configure DBServer
 	swriteln('Configuring DBServer');
 	$inst->configure_dbserver();
@@ -312,7 +312,7 @@ if($install_mode == 'standard') {
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig crontab');
 	$inst->install_crontab();
-	
+
 	swriteln('Restarting services ...');
 	if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart'));
 	if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
@@ -338,10 +338,10 @@ if($install_mode == 'standard') {
 	if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null');
 	if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null');
 	if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
-	//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script']))					system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
+	//if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_file($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
 	if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
 	if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '') system($inst->getinitcommand($conf['ufw']['init_script'], 'restart').' &> /dev/null');
-	
+
 	//* In expert mode, we select the services in the following steps, only db is always available
 	$conf['services']['mail'] = false;
 	$conf['services']['web'] = false;
@@ -349,23 +349,23 @@ if($install_mode == 'standard') {
 	$conf['services']['db'] = true;
 	$conf['services']['firewall'] = false;
 	$conf['services']['proxy'] = false;
-	
-	
+
+
 	//** Get Server ID
 	// $conf['server_id'] = $inst->free_query('Unique Numeric ID of the server','1');
 	// Server ID is an autoInc value of the mysql database now
-	
-	if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup',array('y','n'),'n')) == 'y') {
+
+	if(strtolower($inst->simple_query('Shall this server join an existing ISPConfig multiserver setup', array('y', 'n'), 'n')) == 'y') {
 		$conf['mysql']['master_slave_setup'] = 'y';
-		
+
 		//** Get MySQL root credentials
 		$finished = false;
 		do {
 			$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']);
 			$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']);
 			$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']);
-    		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
-	
+			$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
+
 			//* Initialize the MySQL server connection
 			if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
 				$conf['mysql']['master_host'] = $tmp_mysql_server_host;
@@ -378,7 +378,7 @@ if($install_mode == 'standard') {
 			}
 		} while ($finished == false);
 		unset($finished);
-		
+
 		// initialize the connection to the master database
 		$inst->dbmaster = new db();
 		if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
@@ -386,39 +386,39 @@ if($install_mode == 'standard') {
 		$inst->dbmaster->dbName = $conf['mysql']["master_database"];
 		$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
 		$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
-		
+
 	} else {
 		// the master DB is the same then the slave DB
 		$inst->dbmaster = $inst->db;
 	}
-	
+
 	//* Create the mysql database
 	$inst->configure_database();
-	
+
 	//* Configure Webserver - Apache or nginx
 	if($conf['apache']['installed'] == true && $conf['nginx']['installed'] == true) {
-		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache','nginx'), 'apache');
+		$http_server_to_use = $inst->simple_query('Apache and nginx detected. Select server to use for ISPConfig:', array('apache', 'nginx'), 'apache');
 		if($http_server_to_use == 'apache'){
 			$conf['nginx']['installed'] = false;
 		} else {
 			$conf['apache']['installed'] = false;
 		}
 	}
-		
+
 	//* Insert the Server record into the database
 	swriteln('Adding ISPConfig server record to database.');
 	swriteln('');
 	$inst->add_database_server_record();
 
-	
-	if(strtolower($inst->simple_query('Configure Mail', array('y','n') ,'y') ) == 'y') {
-		
+
+	if(strtolower($inst->simple_query('Configure Mail', array('y', 'n') , 'y') ) == 'y') {
+
 		$conf['services']['mail'] = true;
-		
+
 		//* Configure Postfix
 		swriteln('Configuring Postfix');
 		$inst->configure_postfix();
-		
+
 		//* Configure Mailman
 		swriteln('Configuring Mailman');
 		$inst->configure_mailman();
@@ -428,15 +428,15 @@ if($install_mode == 'standard') {
 			swriteln('Configuring Dovecot');
 			$inst->configure_dovecot();
 		} else {
-		
+
 			//* Configure saslauthd
 			swriteln('Configuring SASL');
 			$inst->configure_saslauthd();
-		
+
 			//* Configure PAM
 			swriteln('Configuring PAM');
 			$inst->configure_pam();
-			
+
 			//* Configure courier
 			swriteln('Configuring Courier');
 			$inst->configure_courier();
@@ -453,7 +453,7 @@ if($install_mode == 'standard') {
 		//* Configure Getmail
 		swriteln('Configuring Getmail');
 		$inst->configure_getmail();
-		
+
 		if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart'));
 		if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart'));
 		if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart'));
@@ -468,22 +468,22 @@ if($install_mode == 'standard') {
 		if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart'));
 		if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &');
 	}
-	
+
 	//** Configure Jailkit
-	if(strtolower($inst->simple_query('Configure Jailkit', array('y','n'),'y') ) == 'y') {	
+	if(strtolower($inst->simple_query('Configure Jailkit', array('y', 'n'), 'y') ) == 'y') {
 		swriteln('Configuring Jailkit');
 		$inst->configure_jailkit();
 	}
-	
+
 	//** Configure Pureftpd
-	if(strtolower($inst->simple_query('Configure FTP Server', array('y','n'),'y') ) == 'y') {	
+	if(strtolower($inst->simple_query('Configure FTP Server', array('y', 'n'), 'y') ) == 'y') {
 		swriteln('Configuring Pureftpd');
 		$inst->configure_pureftpd();
 		if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart'));
 	}
-	
+
 	//** Configure DNS
-	if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') {
+	if(strtolower($inst->simple_query('Configure DNS Server', array('y', 'n'), 'y')) == 'y') {
 		$conf['services']['dns'] = true;
 		//* Configure DNS
 		if($conf['powerdns']['installed'] == true) {
@@ -499,12 +499,12 @@ if($install_mode == 'standard') {
 			$inst->configure_mydns();
 			if($conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null');
 		}
-		
+
 	}
-	
+
 	/*
 	//** Configure Squid
-	if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') {	
+	if(strtolower($inst->simple_query('Configure Proxy Server', array('y','n'),'y') ) == 'y') {
 		if($conf['squid']['installed'] == true) {
 			$conf['services']['proxy'] = true;
 			swriteln('Configuring Squid');
@@ -518,45 +518,45 @@ if($install_mode == 'standard') {
 		}
 	}
 	*/
-	
+
 	//** Configure Apache
 	if($conf['apache']['installed'] == true){
 		swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure Apache Server' option.\n");
-		if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {	
+		if(strtolower($inst->simple_query('Configure Apache Server', array('y', 'n'), 'y')) == 'y') {
 			$conf['services']['web'] = true;
 			swriteln('Configuring Apache');
 			$inst->configure_apache();
-       
+
 			//** Configure Vlogger
 			swriteln('Configuring Vlogger');
 			$inst->configure_vlogger();
-	
+
 			//** Configure apps vhost
 			swriteln('Configuring Apps vhost');
 			$inst->configure_apps_vhost();
 		}
 	}
-	
+
 	//** Configure nginx
 	if($conf['nginx']['installed'] == true){
 		swriteln("\nHint: If this server shall run the ISPConfig interface, select 'y' in the 'Configure nginx Server' option.\n");
-		if(strtolower($inst->simple_query('Configure nginx Server',array('y','n'),'y')) == 'y') {	
+		if(strtolower($inst->simple_query('Configure nginx Server', array('y', 'n'), 'y')) == 'y') {
 			$conf['services']['web'] = true;
 			swriteln('Configuring nginx');
 			$inst->configure_nginx();
-       
+
 			//** Configure Vlogger
 			//swriteln('Configuring Vlogger');
 			//$inst->configure_vlogger();
-	
+
 			//** Configure apps vhost
 			swriteln('Configuring Apps vhost');
 			$inst->configure_apps_vhost();
 		}
 	}
-	
+
 	//** Configure Firewall
-	if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {	
+	if(strtolower($inst->simple_query('Configure Firewall Server', array('y', 'n'), 'y')) == 'y') {
 		if($conf['ufw']['installed'] == true) {
 			//* Configure Ubuntu Firewall
 			$conf['services']['firewall'] = true;
@@ -569,18 +569,18 @@ if($install_mode == 'standard') {
 			$inst->configure_bastille_firewall();
 		}
 	}
-	
+
 	//** Configure Firewall
-	/*if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {	
+	/*if(strtolower($inst->simple_query('Configure Firewall Server',array('y','n'),'y')) == 'y') {
 		swriteln('Configuring Firewall');
 		$inst->configure_firewall();
 	}*/
-	
+
 	//** Configure ISPConfig :-)
 	$install_ispconfig_interface_default = ($conf['mysql']['master_slave_setup'] == 'y')?'n':'y';
-	if(strtolower($inst->simple_query('Install ISPConfig Web Interface',array('y','n'),$install_ispconfig_interface_default)) == 'y') {
+	if(strtolower($inst->simple_query('Install ISPConfig Web Interface', array('y', 'n'), $install_ispconfig_interface_default)) == 'y') {
 		swriteln('Installing ISPConfig');
-		
+
 		//** We want to check if the server is a module or cgi based php enabled server
 		//** TODO: Don't always ask for this somehow ?
 		/*
@@ -600,23 +600,23 @@ if($install_mode == 'standard') {
 		if($conf['apache']['installed'] == true) $conf['apache']['vhost_port']  = $ispconfig_vhost_port;
 		if($conf['nginx']['installed'] == true) $conf['nginx']['vhost_port']  = $ispconfig_vhost_port;
 		unset($ispconfig_vhost_port);
-		
-		if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface',array('y','n'),'y')) == 'y') {
+
+		if(strtolower($inst->simple_query('Enable SSL for the ISPConfig web interface', array('y', 'n'), 'y')) == 'y') {
 			$inst->make_ispconfig_ssl_cert();
 		}
-		
+
 		$inst->install_ispconfig_interface = true;
-			
+
 	} else {
 		$inst->install_ispconfig_interface = false;
 	}
-	
+
 	$inst->install_ispconfig();
-	
+
 	//* Configure DBServer
 	swriteln('Configuring DBServer');
 	$inst->configure_dbserver();
-		
+
 	//* Configure ISPConfig
 	swriteln('Installing ISPConfig crontab');
 	$inst->install_crontab();
@@ -626,9 +626,9 @@ if($install_mode == 'standard') {
 		if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload'));
 		if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload'));
 	}
-	
-	
-	
+
+
+
 } //* << $install_mode / 'Standard' or Genius
 
 
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 9c61759c71d2ae6a39c2fb2f698c866f8f70d2bf..30ba04ea1110d938a5a57ab0dd2dad8398a4d726 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -79,66 +79,66 @@ function get_distname() {
 			$distname = 'Ubuntu';
 			$distid = 'debian40';
 			$distbaseid = 'debian';
-			$ver = explode(' ',$issue);
+			$ver = explode(' ', $issue);
 			$ver = array_filter($ver);
 			$ver = next($ver);
-			$mainver = explode('.',$ver);
+			$mainver = explode('.', $ver);
 			$mainver = array_filter($mainver);
 			$mainver = current($mainver).'.'.next($mainver);
 			switch ($mainver){
-				case "12.10":
-					$relname = "(Quantal Quetzal)";
+			case "12.10":
+				$relname = "(Quantal Quetzal)";
 				break;
-				case "12.04":
-					$relname = "(Precise Pangolin)";
+			case "12.04":
+				$relname = "(Precise Pangolin)";
 				break;
-				case "11.10":
-					$relname = "(Oneiric Ocelot)";
+			case "11.10":
+				$relname = "(Oneiric Ocelot)";
 				break;
-				case "11.14":
-					$relname = "(Natty Narwhal)";
+			case "11.14":
+				$relname = "(Natty Narwhal)";
 				break;
-				case "10.10":
-					$relname = "(Maverick Meerkat)";
+			case "10.10":
+				$relname = "(Maverick Meerkat)";
 				break;
-				case "10.04":
-					$relname = "(Lucid Lynx)";
+			case "10.04":
+				$relname = "(Lucid Lynx)";
 				break;
-				case "9.10":
-					$relname = "(Karmic Koala)";
+			case "9.10":
+				$relname = "(Karmic Koala)";
 				break;
-				case "9.04":
-					$relname = "(Jaunty Jackpole)";
+			case "9.04":
+				$relname = "(Jaunty Jackpole)";
 				break;
-				case "8.10":
+			case "8.10":
 				$relname = "(Intrepid Ibex)";
 				break;
-				case "8.04":
-					$relname = "(Hardy Heron)";
+			case "8.04":
+				$relname = "(Hardy Heron)";
 				break;
-				case "7.10":
-					$relname = "(Gutsy Gibbon)";
+			case "7.10":
+				$relname = "(Gutsy Gibbon)";
 				break;
-				case "7.04":
-					$relname = "(Feisty Fawn)";
+			case "7.04":
+				$relname = "(Feisty Fawn)";
 				break;
-				case "6.10":
-					$relname = "(Edgy Eft)";
+			case "6.10":
+				$relname = "(Edgy Eft)";
 				break;
-				case "6.06":
-					$relname = "(Dapper Drake)";
+			case "6.06":
+				$relname = "(Dapper Drake)";
 				break;
-				case "5.10":
-					$relname = "(Breezy Badger)";
+			case "5.10":
+				$relname = "(Breezy Badger)";
 				break;
-				case "5.04":
-					$relname = "(Hoary Hedgehog)";
+			case "5.04":
+				$relname = "(Hoary Hedgehog)";
 				break;
-				case "4.10":
-					$relname = "(Warty Warthog)";
+			case "4.10":
+				$relname = "(Warty Warthog)";
 				break;
-				default:
-					$relname = "UNKNOWN";
+			default:
+				$relname = "UNKNOWN";
 			}
 			$distver = $ver.$lts." ".$relname;
 			swriteln("Operating System: ".$distver."\n");
@@ -148,19 +148,19 @@ function get_distname() {
 			$distid = 'debian40';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian 4.0 or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'5.0')) {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '5.0')) {
 			$distname = 'Debian';
 			$distver = 'Lenny';
 			$distid = 'debian40';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian Lenny or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')), '6.0') || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
 			$distname = 'Debian';
 			$distver = 'Squeeze/Sid';
 			$distid = 'debian60';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian 6.0 (Squeeze/Sid) or compatible\n");
-		} 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') {
+		} 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';
@@ -177,19 +177,19 @@ function get_distname() {
 
 	//** OpenSuSE
 	elseif(file_exists('/etc/SuSE-release')) {
-		if(stristr(file_get_contents('/etc/SuSE-release'),'11.0')) {
+		if(stristr(file_get_contents('/etc/SuSE-release'), '11.0')) {
 			$distname = 'openSUSE';
 			$distver = '11.0';
 			$distid = 'opensuse110';
 			$distbaseid = 'opensuse';
 			swriteln("Operating System: openSUSE 11.0 or compatible\n");
-		} elseif(stristr(file_get_contents('/etc/SuSE-release'),'11.1')) {
+		} elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.1')) {
 			$distname = 'openSUSE';
 			$distver = '11.1';
 			$distid = 'opensuse110';
 			$distbaseid = 'opensuse';
 			swriteln("Operating System: openSUSE 11.1 or compatible\n");
-		} elseif(stristr(file_get_contents('/etc/SuSE-release'),'11.2')) {
+		} elseif(stristr(file_get_contents('/etc/SuSE-release'), '11.2')) {
 			$distname = 'openSUSE';
 			$distver = '11.2';
 			$distid = 'opensuse112';
@@ -210,37 +210,37 @@ function get_distname() {
 
 		$content = file_get_contents('/etc/redhat-release');
 
-		if(stristr($content,'Fedora release 9 (Sulphur)')) {
+		if(stristr($content, 'Fedora release 9 (Sulphur)')) {
 			$distname = 'Fedora';
 			$distver = '9';
 			$distid = 'fedora9';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: Fedora 9 or compatible\n");
-		} elseif(stristr($content,'Fedora release 10 (Cambridge)')) {
+		} elseif(stristr($content, 'Fedora release 10 (Cambridge)')) {
 			$distname = 'Fedora';
 			$distver = '10';
 			$distid = 'fedora9';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: Fedora 10 or compatible\n");
-		} elseif(stristr($content,'Fedora release 10')) {
+		} elseif(stristr($content, 'Fedora release 10')) {
 			$distname = 'Fedora';
 			$distver = '11';
 			$distid = 'fedora9';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: Fedora 11 or compatible\n");
-		} elseif(stristr($content,'CentOS release 5.2 (Final)')) {
+		} elseif(stristr($content, 'CentOS release 5.2 (Final)')) {
 			$distname = 'CentOS';
 			$distver = '5.2';
 			$distid = 'centos52';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 5.2 or compatible\n");
-		} elseif(stristr($content,'CentOS release 5.3 (Final)')) {
+		} elseif(stristr($content, 'CentOS release 5.3 (Final)')) {
 			$distname = 'CentOS';
 			$distver = '5.3';
 			$distid = 'centos53';
 			$distbaseid = 'fedora';
 			swriteln("Operating System: CentOS 5.3 or compatible\n");
-		} elseif(stristr($content,'CentOS release 5')) {
+		} elseif(stristr($content, 'CentOS release 5')) {
 			$distname = 'CentOS';
 			$distver = 'Unknown';
 			$distid = 'centos53';
@@ -260,7 +260,7 @@ function get_distname() {
 
 		$content = file_get_contents('/etc/gentoo-release');
 
-				preg_match_all('/([0-9]{1,2})/', $content, $version);
+		preg_match_all('/([0-9]{1,2})/', $content, $version);
 		$distname = 'Gentoo';
 		$distver = $version[0][0].$version[0][1];
 		$distid = 'gentoo';
@@ -275,8 +275,8 @@ function get_distname() {
 }
 
 function sread() {
-		$input = fgets(STDIN);
-		return rtrim($input);
+	$input = fgets(STDIN);
+	return rtrim($input);
 }
 
 function swrite($text = '') {
@@ -288,7 +288,7 @@ function swriteln($text = '') {
 }
 
 function ilog($msg){
-		exec("echo `date` \"- [ISPConfig] - \"".$msg.' >> '.ISPC_LOG_FILE);
+	exec("echo `date` \"- [ISPConfig] - \"".$msg.' >> '.ISPC_LOG_FILE);
 }
 
 function error($msg){
@@ -297,7 +297,7 @@ function error($msg){
 }
 
 function caselog($command, $file = '', $line = '', $success = '', $failure = ''){
-	exec($command,$arr,$ret_val);
+	exec($command, $arr, $ret_val);
 	$arr = NULL;
 	if(!empty($file) && !empty($line)){
 		$pre = $file.', Line '.$line.': ';
@@ -346,15 +346,15 @@ function mkdirs($strPath, $mode = '0755'){
 }
 
 function rfsel($file, $file2) {
-    clearstatcache();
-    if(is_file($file)) return rf($file);
-    else return rf($file2);
+	clearstatcache();
+	if(is_file($file)) return rf($file);
+	else return rf($file2);
 }
 
 function rf($file){
 	clearstatcache();
 	if(is_file($file)) {
-		if(!$fp = fopen ($file, 'rb')){
+		if(!$fp = fopen($file, 'rb')){
 			ilog('WARNING: could not open file '.$file);
 		}
 		return filesize($file) > 0 ? fread($fp, filesize($file)) : '';
@@ -365,7 +365,7 @@ function rf($file){
 
 function wf($file, $content){
 	mkdirs(dirname($file));
-	if(!$fp = fopen ($file, 'wb')){
+	if(!$fp = fopen($file, 'wb')){
 		ilog('WARNING: could not open file '.$file);
 	}
 	fwrite($fp, $content);
@@ -374,18 +374,18 @@ function wf($file, $content){
 
 function af($file, $content){
 	mkdirs(dirname($file));
-	if(!$fp = fopen ($file, 'ab')){
+	if(!$fp = fopen($file, 'ab')){
 		ilog('WARNING: could not open file '.$file);
 	}
-	fwrite($fp,$content);
+	fwrite($fp, $content);
 	fclose($fp);
 }
 
 function aftsl($file, $content){
-	if(!$fp = fopen ($file, 'ab')){
+	if(!$fp = fopen($file, 'ab')){
 		ilog('WARNING: could not open file '.$file);
 	}
-	fwrite($fp,$content);
+	fwrite($fp, $content);
 	fclose($fp);
 }
 
@@ -428,7 +428,7 @@ function no_comments($file, $comment = '#'){
 			if(strstr($line, $comment)){
 				$pos = strpos($line, $comment);
 				if($pos != 0){
-					$new_lines[] = substr($line,0,$pos);
+					$new_lines[] = substr($line, 0, $pos);
 				}else{
 					$new_lines[] = '';
 				}
@@ -508,7 +508,7 @@ function grep($content, $string, $params = ''){
 	}
 	if(is_array($find)){
 		$ret_val = implode("\n", $find);
-		if(substr($ret_val,-1) != "\n") $ret_val .= "\n";
+		if(substr($ret_val, -1) != "\n") $ret_val .= "\n";
 		$find = NULL;
 		return $ret_val;
 	} else {
@@ -555,7 +555,7 @@ function ini_to_array($ini) {
 	$ini = str_replace("\r\n", "\n", $ini);
 	$lines = explode("\n", $ini);
 	foreach($lines as $line) {
-				$line = trim($line);
+		$line = trim($line);
 		if($line != '') {
 			if(preg_match("/^\[([\w\d_]+)\]$/", $line, $matches)) {
 				$section = strtolower($matches[1]);
@@ -577,8 +577,8 @@ function array_to_ini($config_array = '') {
 		$content .= "[$section]\n";
 		foreach($data as $item => $value) {
 			if($item != ''){
-								$content .= "$item=$value\n";
-						}
+				$content .= "$item=$value\n";
+			}
 		}
 		$content .= "\n";
 	}
@@ -617,13 +617,13 @@ function is_group($group){
 	return false;
 }
 
-function replaceLine($filename,$search_pattern,$new_line,$strict = 0,$append = 1) {
+function replaceLine($filename, $search_pattern, $new_line, $strict = 0, $append = 1) {
 	if($lines = @file($filename)) {
 		$out = '';
 		$found = 0;
 		foreach($lines as $line) {
 			if($strict == 0) {
-				if(stristr($line,$search_pattern)) {
+				if(stristr($line, $search_pattern)) {
 					$out .= $new_line."\n";
 					$found = 1;
 				} else {
@@ -640,20 +640,20 @@ function replaceLine($filename,$search_pattern,$new_line,$strict = 0,$append = 1
 		}
 		if($found == 0) {
 			//* add \n if the last line does not end with \n or \r
-			if(substr($out,-1) != "\n" && substr($out,-1) != "\r") $out .= "\n";
+			if(substr($out, -1) != "\n" && substr($out, -1) != "\r") $out .= "\n";
 			//* add the new line at the end of the file
 			if($append == 1) $out .= $new_line."\n";
 		}
-		file_put_contents($filename,$out);
+		file_put_contents($filename, $out);
 	}
 }
 
-function removeLine($filename,$search_pattern,$strict = 0) {
+function removeLine($filename, $search_pattern, $strict = 0) {
 	if($lines = @file($filename)) {
 		$out = '';
 		foreach($lines as $line) {
 			if($strict == 0) {
-				if(!stristr($line,$search_pattern)) {
+				if(!stristr($line, $search_pattern)) {
 					$out .= $line;
 				}
 			} else {
@@ -662,13 +662,13 @@ function removeLine($filename,$search_pattern,$strict = 0) {
 				}
 			}
 		}
-		file_put_contents($filename,$out);
+		file_put_contents($filename, $out);
 	}
 }
 
 function is_installed($appname) {
-	exec('which '.escapeshellcmd($appname).' 2> /dev/null',$out,$returncode);
-	if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) {
+	exec('which '.escapeshellcmd($appname).' 2> /dev/null', $out, $returncode);
+	if(isset($out[0]) && stristr($out[0], $appname) && $returncode == 0) {
 		return true;
 	} else {
 		return false;
@@ -683,12 +683,12 @@ function is_installed($appname) {
  * 1 $current version is older then new version (update)
 
 */
-function compare_ispconfig_version($current,$new) {
+function compare_ispconfig_version($current, $new) {
 	if( $current == $new) {
 		return 0;
 	}
 
-	$p = explode('.',$current);
+	$p = explode('.', $current);
 	$tmp = '';
 	$tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
 	$tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
@@ -696,7 +696,7 @@ function compare_ispconfig_version($current,$new) {
 	$tmp .= (isset($p[3]))?str_pad(intval($p[3]), 3, '0', STR_PAD_LEFT):'000';
 	$current = $tmp;
 
-	$p = explode('.',$new);
+	$p = explode('.', $new);
 	$tmp = '';
 	$tmp .= str_pad(intval($p[0]), 3, '0', STR_PAD_LEFT);
 	$tmp .= (isset($p[1]))?str_pad(intval($p[1]), 3, '0', STR_PAD_LEFT):'000';
@@ -728,7 +728,7 @@ function get_ispconfig_port_number() {
 
 	if(is_file($ispconfig_vhost_file)) {
 		$tmp = file_get_contents($ispconfig_vhost_file);
-		preg_match($regex,$tmp,$matches);
+		preg_match($regex, $tmp, $matches);
 		$port_number = @intval($matches[1]);
 		if($port_number > 0) {
 			return $port_number;
@@ -748,7 +748,7 @@ function is_ispconfig_ssl_enabled() {
 
 	if(is_file($ispconfig_vhost_file)) {
 		$tmp = file_get_contents($ispconfig_vhost_file);
-		if(stristr($tmp,'SSLCertificateFile')) {
+		if(stristr($tmp, 'SSLCertificateFile')) {
 			return true;
 		} else {
 			return false;
@@ -756,60 +756,63 @@ function is_ispconfig_ssl_enabled() {
 	}
 }
 
-/** 
-  Function to find the hash file for timezone detection
-  (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
-*/
+/**
+ Function to find the hash file for timezone detection
+ (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
+ */
+
+
 function find_hash_file($hash, $dir, $basedir = '') {
-    $res = opendir($dir);
-    if(!$res) return false;
-   
-    if(substr($basedir, -1) === '/') $basedir = substr($basedir, 0, strlen($basedir) - 1);
-    if(substr($dir, -1) === '/') $dir = substr($dir, 0, strlen($dir) - 1);
-    if($basedir === '') $basedir = $dir;
-   
-    while($cur = readdir($res)) {
-        if($cur == '.' || $cur == '..') continue;
-        $entry = $dir.'/'.$cur;
-        if(is_dir($entry)) {
-            $result = find_hash_file($hash, $entry, $basedir);
-            if($result !== false) return $result;
-        } elseif(md5_file($entry) === $hash) {
-            $entry = substr($entry, strlen($basedir) + 1);
-            if(substr($entry, 0, 7) === '/posix/') $entry = substr($entry, 7);
-            return $entry;
-        }
-    }
-    closedir($res);
-    return false;
-}
-
-/** 
-  Function to get the timezone of the Linux system
-  (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
-*/
+	$res = opendir($dir);
+	if(!$res) return false;
+
+	if(substr($basedir, -1) === '/') $basedir = substr($basedir, 0, strlen($basedir) - 1);
+	if(substr($dir, -1) === '/') $dir = substr($dir, 0, strlen($dir) - 1);
+	if($basedir === '') $basedir = $dir;
+
+	while($cur = readdir($res)) {
+		if($cur == '.' || $cur == '..') continue;
+		$entry = $dir.'/'.$cur;
+		if(is_dir($entry)) {
+			$result = find_hash_file($hash, $entry, $basedir);
+			if($result !== false) return $result;
+		} elseif(md5_file($entry) === $hash) {
+			$entry = substr($entry, strlen($basedir) + 1);
+			if(substr($entry, 0, 7) === '/posix/') $entry = substr($entry, 7);
+			return $entry;
+		}
+	}
+	closedir($res);
+	return false;
+}
+
+
+/**
+ Function to get the timezone of the Linux system
+ (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
+ */
 function get_system_timezone() {
-    $timezone = false;
-    if(file_exists('/etc/timezone') && is_readable('/etc/timezone')) {
-        $timezone = trim(file_get_contents('/etc/timezone'));
-        if(file_exists('/usr/share/zoneinfo/' . $timezone) == false) $timezone = false;
-    }
-    
-    if(!$timezone && is_link('/etc/localtime')) {
-        $timezone = readlink('/etc/localtime');
-        $timezone = str_replace('/usr/share/zoneinfo/', '', $timezone);
-        if(substr($timezone, 0, 6) === 'posix/') $timezone = substr($timezone, 6);
-    } elseif(!$timezone) {
-        $hash = md5_file('/etc/localtime');
-        $timezone = find_hash_file($hash, '/usr/share/zoneinfo');
-    }
-
-    if(!$timezone) {
-        exec('date +%Z', $tzinfo);
-        $timezone = $tzinfo[0];
-    }
-
-    return $timezone;
+	$timezone = false;
+	if(file_exists('/etc/timezone') && is_readable('/etc/timezone')) {
+		$timezone = trim(file_get_contents('/etc/timezone'));
+		if(file_exists('/usr/share/zoneinfo/' . $timezone) == false) $timezone = false;
+	}
+
+	if(!$timezone && is_link('/etc/localtime')) {
+		$timezone = readlink('/etc/localtime');
+		$timezone = str_replace('/usr/share/zoneinfo/', '', $timezone);
+		if(substr($timezone, 0, 6) === 'posix/') $timezone = substr($timezone, 6);
+	} elseif(!$timezone) {
+		$hash = md5_file('/etc/localtime');
+		$timezone = find_hash_file($hash, '/usr/share/zoneinfo');
+	}
+
+	if(!$timezone) {
+		exec('date +%Z', $tzinfo);
+		$timezone = $tzinfo[0];
+	}
+
+	return $timezone;
 }
 
 
diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index e46d977829f4e14679b4ce77d856d6e64a7d34a1..ab0c963092916004f58287c32f9fe6764f9cd991 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -53,7 +53,7 @@ class installer_base {
 	}
 
 	public function warning($msg) {
-		echo('WARNING: '.$msg."\n");
+		echo 'WARNING: '.$msg."\n";
 	}
 
 	public function simple_query($query, $answers, $default) {
@@ -86,7 +86,7 @@ class installer_base {
 		return $answer;
 	}
 
-	public function free_query($query,$default) {
+	public function free_query($query, $default) {
 		swrite($this->lng($query).' ['.$default.']: ');
 		$input = sread();
 
@@ -141,6 +141,8 @@ class installer_base {
 	}
 
 	/** Create the database for ISPConfig */
+
+
 	public function configure_database() {
 		global $conf;
 
@@ -159,10 +161,10 @@ class installer_base {
 		} else {
 			if($conf['mysql']['admin_password'] == '') {
 				caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
-						__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
+					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			} else {
 				caselog("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < '".ISPC_INSTALL_ROOT."/install/sql/ispconfig3.sql' &> /dev/null",
-						__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
+					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
 			}
 			$db_tables = $this->db->getTables();
 			if(count($db_tables) == 0) {
@@ -194,8 +196,8 @@ class installer_base {
 
 		//* Create the ISPConfig database user in the local database
 		$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['database'].".* "
-				."TO '".$conf['mysql']['ispconfig_user']."'@'".$from_host."' "
-				."IDENTIFIED BY '".$conf['mysql']['ispconfig_password']."';";
+			."TO '".$conf['mysql']['ispconfig_user']."'@'".$from_host."' "
+			."IDENTIFIED BY '".$conf['mysql']['ispconfig_password']."';";
 		if(!$this->db->query($query)) {
 			$this->error('Unable to create database user: '.$conf['mysql']['ispconfig_user'].' Error: '.$this->db->errorMessage);
 		}
@@ -360,140 +362,140 @@ class installer_base {
 		}
 
 		if(count($hosts) > 0) {
-		foreach($hosts as $host => $value) {
-			/*
+			foreach($hosts as $host => $value) {
+				/*
 			 * If a pwd exists, this means, we have to add the new user (and his pwd).
 			 * if not, the user already exists and we do not need the pwd
 			 */
-			if ($value['pwd'] != ''){
-				$query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'";
-				if ($verbose){
-					echo "\n\n" . $query ."\n";
+				if ($value['pwd'] != ''){
+					$query = "CREATE USER '".$value['user']."'@'".$host."' IDENTIFIED BY '" . $value['pwd'] . "'";
+					if ($verbose){
+						echo "\n\n" . $query ."\n";
+					}
+					$this->dbmaster->query($query); // ignore the error
 				}
-				$this->dbmaster->query($query); // ignore the error
-			}
 
-			/*
+				/*
 			 *  Try to delete all rights of the user in case that it exists.
 			 *  In Case that it will not exist, do nothing (ignore the error!)
 			 */
-			$query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' ";
-			if ($verbose){
+				$query = "REVOKE ALL PRIVILEGES, GRANT OPTION FROM '".$value['user']."'@'".$host."' ";
+				if ($verbose){
 					echo "\n\n" . $query ."\n";
-			}
-			$this->dbmaster->query($query); // ignore the error
+				}
+				$this->dbmaster->query($query); // ignore the error
 
-			//* Create the ISPConfig database user in the remote database
-			$query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				//* Create the ISPConfig database user in the remote database
+				$query = "GRANT SELECT ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, INSERT ON ".$value['db'].".`sys_log` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, UPDATE(`status`, `error`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, UPDATE(`status`, `error`) ON ".$value['db'].".`sys_datalog` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, UPDATE(`status`) ON ".$value['db'].".`software_update_inst` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, UPDATE(`updated`) ON ".$value['db'].".`server` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, UPDATE (`ssl_request`, `ssl_cert`, `ssl_action`, `ssl_key`) ON ".$value['db'].".`web_domain` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT ON ".$value['db'].".`sys_group` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, UPDATE (`action_state`, `response`) ON ".$value['db'].".`sys_remoteaction` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, INSERT , DELETE ON ".$value['db'].".`monitor_data` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`mail_traffic` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, INSERT, UPDATE ON ".$value['db'].".`web_traffic` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-			$query = "GRANT SELECT, UPDATE ON ".$value['db'].".`aps_instances` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
-			
-			$query = "GRANT SELECT, INSERT, DELETE ON ".$value['db'].".`web_backup` TO '".$value['user']."'@'".$host."' ";
-			if ($verbose){
-				echo $query ."\n";
-			}
-			if(!$this->dbmaster->query($query)) {
-				$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
-			}
+				$query = "GRANT SELECT, UPDATE ON ".$value['db'].".`aps_instances` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-		}
+				$query = "GRANT SELECT, INSERT, DELETE ON ".$value['db'].".`web_backup` TO '".$value['user']."'@'".$host."' ";
+				if ($verbose){
+					echo $query ."\n";
+				}
+				if(!$this->dbmaster->query($query)) {
+					$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
+				}
 
-		/*
+			}
+
+			/*
 		 * It is all done. Relod the rights...
 		 */
-		$this->dbmaster->query('FLUSH PRIVILEGES;');
+			$this->dbmaster->query('FLUSH PRIVILEGES;');
 		}
 
 	}
@@ -528,17 +530,17 @@ class installer_base {
 		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.'~');
-            
-            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);
-            }
+
+			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
@@ -583,13 +585,13 @@ class installer_base {
 			$domainAll = $this->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 
 			if(is_array($domainAll)) {
-			foreach($domainAll as $domain)
-			{
-				if ($domainAll[0]['domain'] == $domain['domain'])
-					$virtual_domains .= "'".$domain['domain']."'";
-				else
-					$virtual_domains .= ", '".$domain['domain']."'";
-			}
+				foreach($domainAll as $domain)
+				{
+					if ($domainAll[0]['domain'] == $domain['domain'])
+						$virtual_domains .= "'".$domain['domain']."'";
+					else
+						$virtual_domains .= ", '".$domain['domain']."'";
+				}
 			}
 		}
 		else
@@ -599,31 +601,31 @@ class installer_base {
 		if(!isset($old_options['DEFAULT_SERVER_LANGUAGE'])) $old_options['DEFAULT_SERVER_LANGUAGE'] = '';
 		$content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
-		
+
 		wf($full_file_name, $content);
-		
+
 		//* Write virtual_to_transport.sh script
 		$config_dir = $conf['mailman']['config_dir'].'/';
 		$full_file_name = $config_dir.'virtual_to_transport.sh';
-		
+
 		//* Backup exiting virtual_to_transport.sh script
 		if(is_file($full_file_name)) {
 			copy($full_file_name, $config_dir.'virtual_to_transport.sh~');
 		}
-		
+
 		if(is_dir('/etc/mailman')) {
 			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);
-		}
-		
+				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);
+		}
+
 		//* Create aliasaes
 		exec('/usr/lib/mailman/bin/genaliases 2>/dev/null');
-		
+
 	}
 
 	public function configure_postfix($options = '') {
@@ -667,18 +669,18 @@ class installer_base {
 
 		//* postfix-dkim
 		$full_file_name=$config_dir.'/tag_as_originating.re';
-                if(is_file($full_file_name)) copy($full_file_name, $config_dir.$configfile.'~');
-		wf($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10026');
+		if(is_file($full_file_name)) copy($full_file_name, $config_dir.$configfile.'~');
+		wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10026');
 
 		$full_file_name=$config_dir.'/tag_as_foreign.re';
-                if(is_file($full_file_name)) copy($full_file_name, $config_dir.$configfile.'~');
-		wf($full_file_name,'/^/ FILTER amavis:[127.0.0.1]:10024');
+		if(is_file($full_file_name)) copy($full_file_name, $config_dir.$configfile.'~');
+		wf($full_file_name, '/^/ FILTER amavis:[127.0.0.1]:10024');
 
 		//* Changing mode and group of the new created config files.
 		caselog('chmod o= '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-				__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
+			__FILE__, __LINE__, 'chmod on mysql-virtual_*.cf*', 'chmod on mysql-virtual_*.cf* failed');
 		caselog('chgrp '.$cf['group'].' '.$config_dir.'/mysql-virtual_*.cf* &> /dev/null',
-				__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
+			__FILE__, __LINE__, 'chgrp on mysql-virtual_*.cf*', 'chgrp on mysql-virtual_*.cf* failed');
 
 		//* Creating virtual mail user and group
 		$command = 'groupadd -g '.$cf['vmail_groupid'].' '.$cf['vmail_groupname'];
@@ -695,31 +697,31 @@ class installer_base {
 		//* If there are RBL's defined, format the list and add them to smtp_recipient_restrictions to prevent removeal after an update
 		$rbl_list = '';
 		if (@isset($server_ini_array['mail']['realtime_blackhole_list']) && $server_ini_array['mail']['realtime_blackhole_list'] != '') {
-			$rbl_hosts = explode(",",str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
+			$rbl_hosts = explode(",", str_replace(" ", "", $server_ini_array['mail']['realtime_blackhole_list']));
 			foreach ($rbl_hosts as $key => $value) {
 				$rbl_list .= ", reject_rbl_client ". $value;
 			}
 		}
 		unset($rbl_hosts);
 		unset($server_ini_array);
-        
-        $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
+
+		$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) {
-			$postconf_commands = array_merge($postconf_commands,array(
-				'myhostname = '.$conf['hostname'],
-				'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
-				'mynetworks = 127.0.0.0/8 [::1]/128'
-			));
+			$postconf_commands = array_merge($postconf_commands, array(
+					'myhostname = '.$conf['hostname'],
+					'mydestination = '.$conf['hostname'].', localhost, localhost.localdomain',
+					'mynetworks = 127.0.0.0/8 [::1]/128'
+				));
 		}
 
 		//* Create the header and body check files
@@ -746,10 +748,10 @@ class installer_base {
 			caselog($command." &> /dev/null", __FILE__, __LINE__, 'EXECUTED: '.$command, 'Failed to execute the command '.$command);
 		}
 
-		if(!stristr($options,'dont-create-certs')) {
+		if(!stristr($options, 'dont-create-certs')) {
 			//* Create the SSL certificate
 			$command = 'cd '.$config_dir.'; '
-					.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
+				.'openssl req -new -outform PEM -out smtpd.cert -newkey rsa:4096 -nodes -keyout smtpd.key -keyform PEM -days 3650 -x509';
 			exec($command);
 
 			$command = 'chmod o= '.$config_dir.'/smtpd.key';
@@ -770,8 +772,8 @@ class installer_base {
 		$configfile = $config_dir.'/master.cf';
 		$content = rf($configfile);
 		$content = str_replace('flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}',
-				'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}',
-				$content);
+			'flags=DRhu user='.$cf['vmail_username'].' argv=/usr/bin/maildrop -d '.$cf['vmail_username'].' ${extension} ${recipient} ${user} ${nexthop} ${sender}',
+			$content);
 		wf($configfile, $content);
 
 		//* Writing the Maildrop mailfilter file
@@ -802,8 +804,8 @@ class installer_base {
 		global $conf;
 
 		//* Get saslsauthd version
-		exec('saslauthd -v 2>&1',$out);
-		$parts = explode(' ',$out[0]);
+		exec('saslauthd -v 2>&1', $out);
+		$parts = explode(' ', $out[0]);
 		$saslversion = $parts[1];
 		unset($parts);
 		unset($out);
@@ -816,14 +818,14 @@ class installer_base {
 			$configfile = 'sasl_smtpd.conf';
 		}
 
-		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')) 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 = 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);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf',$content);
+		$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);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		wf($conf['postfix']['config_dir'].'/sasl/smtpd.conf', $content);
 
 		// TODO: Chmod and chown on the config file
 
@@ -833,21 +835,21 @@ class installer_base {
 
 		// Edit the file /etc/default/saslauthd
 		$configfile = $conf['saslauthd']['config'];
-		if(is_file($configfile)) copy($configfile,$configfile.'~');
+		if(is_file($configfile)) copy($configfile, $configfile.'~');
 		if(is_file($configfile.'~')) chmod($configfile.'~', 0400);
 		$content = rf($configfile);
-		$content = str_replace('START=no','START=yes',$content);
+		$content = str_replace('START=no', 'START=yes', $content);
 		// Debian
-		$content = str_replace('OPTIONS="-c"','OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"',$content);
+		$content = str_replace('OPTIONS="-c"', 'OPTIONS="-m /var/spool/postfix/var/run/saslauthd -r"', $content);
 		// Ubuntu
-		$content = str_replace('OPTIONS="-c -m /var/run/saslauthd"','OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"',$content);
-		wf($configfile,$content);
+		$content = str_replace('OPTIONS="-c -m /var/run/saslauthd"', 'OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"', $content);
+		wf($configfile, $content);
 
 		// Edit the file /etc/init.d/saslauthd
 		$configfile = $conf['init_scripts'].'/'.$conf['saslauthd']['init_script'];
 		$content = rf($configfile);
-		$content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid','PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"',$content);
-		wf($configfile,$content);
+		$content = str_replace('PIDFILE=$RUN_DIR/saslauthd.pid', 'PIDFILE="/var/spool/postfix/var/run/${NAME}/saslauthd.pid"', $content);
+		wf($configfile, $content);
 
 		// add the postfix user to the sasl group (at least necessary for Ubuntu 8.04 and most likely Debian Lenny as well.
 		exec('adduser postfix sasl');
@@ -887,10 +889,10 @@ class installer_base {
 		}
 		chmod($config_dir.'/'.$configfile.'~', 0400);
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf($config_dir.'/'.$configfile, $content);
 
 		chmod($config_dir.'/'.$configfile, 0660);
@@ -924,9 +926,9 @@ class installer_base {
 		}
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,'dovecot/deliver')) {
+		if(!stristr($content, 'dovecot/deliver')) {
 			$deliver_content = 'dovecot   unix  -       n       n       -       -       pipe'."\n".'  flags=DROhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}';
-			af($conf['postfix']['config_dir'].'/master.cf',$deliver_content);
+			af($conf['postfix']['config_dir'].'/master.cf', $deliver_content);
 		}
 		unset($content);
 		unset($deliver_content);
@@ -935,14 +937,14 @@ class installer_base {
 		//* Reconfigure postfix to use dovecot authentication
 		// Adding the amavisd commands to the postfix configuration
 		$postconf_commands = array (
-				'dovecot_destination_recipient_limit = 1',
-				'virtual_transport = dovecot',
-				'smtpd_sasl_type = dovecot',
-				'smtpd_sasl_path = private/auth'
+			'dovecot_destination_recipient_limit = 1',
+			'virtual_transport = dovecot',
+			'smtpd_sasl_type = dovecot',
+			'smtpd_sasl_path = private/auth'
 		);
 
 		// Make a backup copy of the main.cf file
-		copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~3');
+		copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~3');
 
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
@@ -957,25 +959,25 @@ class installer_base {
 		}
 
 		//* Get the dovecot version
-		exec('dovecot --version',$tmp);
-		$parts = explode('.',trim($tmp[0]));
+		exec('dovecot --version', $tmp);
+		$parts = explode('.', trim($tmp[0]));
 		$dovecot_version = $parts[0];
 		unset($tmp);
 		unset($parts);
 
 		//* Copy dovecot configuration file
 		if($dovecot_version == 2) {
-            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);
-            }
+			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 {
-            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);
-            }
+			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
@@ -985,10 +987,10 @@ class installer_base {
 		}
 		if(is_file($config_dir.'/'.$configfile.'~')) chmod($config_dir.'/'.$configfile.'~', 0400);
 		$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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 		wf($config_dir.'/'.$configfile, $content);
 
 		chmod($config_dir.'/'.$configfile, 0600);
@@ -1002,15 +1004,15 @@ class installer_base {
 
 		// amavisd user config file
 		$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')) 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 = 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);
-		$content = str_replace('{mysql_server_port}',$conf['mysql']['port'],$content);
-		$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
-		wf($conf['amavis']['config_dir'].'/conf.d/50-user',$content);
+		$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);
+		$content = str_replace('{mysql_server_port}', $conf['mysql']['port'], $content);
+		$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
+		wf($conf['amavis']['config_dir'].'/conf.d/50-user', $content);
 
 		// TODO: chmod and chown on the config file
 
@@ -1026,7 +1028,7 @@ class installer_base {
 		}
 
 		// Make a backup copy of the main.cf file
-		copy($conf['postfix']['config_dir'].'/main.cf',$conf['postfix']['config_dir'].'/main.cf~2');
+		copy($conf['postfix']['config_dir'].'/main.cf', $conf['postfix']['config_dir'].'/main.cf~2');
 
 		// Executing the postconf commands
 		foreach($postconf_commands as $cmd) {
@@ -1035,13 +1037,13 @@ class installer_base {
 		}
 
 		// Append the configuration for amavisd to the master.cf file
-		if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf',$conf['postfix']['config_dir'].'/master.cf~');
+		if(is_file($conf['postfix']['config_dir'].'/master.cf')) copy($conf['postfix']['config_dir'].'/master.cf', $conf['postfix']['config_dir'].'/master.cf~');
 		$content = rf($conf['postfix']['config_dir'].'/master.cf');
 		// Only add the content if we had not addded it before
-		if(!stristr($content,'127.0.0.1:10025')) {
+		if(!stristr($content, '127.0.0.1:10025')) {
 			unset($content);
 			$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);
+			af($conf['postfix']['config_dir'].'/master.cf', $content);
 		}
 		unset($content);
 
@@ -1049,17 +1051,17 @@ class installer_base {
 		exec('adduser clamav amavis');
 
 		// Create the director for DKIM-Keys
-		mkdir("/var/lib/amavis/dkim",0750);
+		mkdir("/var/lib/amavis/dkim", 0750);
 		// get shell-user for amavis
 		$amavis_user=exec('grep -o "^amavis:\|^vscan:" /etc/passwd');
 		if(!empty($amavis_user)) {
-			$amavis_user=rtrim($amavis_user,":");
+			$amavis_user=rtrim($amavis_user, ":");
 			exec('chown '.$amavis_user.'/var/lib/amavis/dkim');
 		}
 		// get shell-group for amavis
 		$amavis_group=exec('grep -o "^amavis:\|^vscan:" /etc/group');
 		if(!empty($amavis_group)) {
-			$amavis_group=rtrim($amavis_group,":");
+			$amavis_group=rtrim($amavis_group, ":");
 			exec('chgrp '.$amavis_group.'/var/lib/amavis/dkim');
 		}
 	}
@@ -1125,12 +1127,12 @@ class installer_base {
 		exec('echo "yes" > '.$config_dir.'/conf/DisplayDotFiles');
 
 		if(is_file('/etc/default/pure-ftpd-common')) {
-			replaceLine('/etc/default/pure-ftpd-common','STANDALONE_OR_INETD=inetd','STANDALONE_OR_INETD=standalone',1,0);
-			replaceLine('/etc/default/pure-ftpd-common','VIRTUALCHROOT=false','VIRTUALCHROOT=true',1,0);
+			replaceLine('/etc/default/pure-ftpd-common', 'STANDALONE_OR_INETD=inetd', 'STANDALONE_OR_INETD=standalone', 1, 0);
+			replaceLine('/etc/default/pure-ftpd-common', 'VIRTUALCHROOT=false', 'VIRTUALCHROOT=true', 1, 0);
 		}
 
 		if(is_file('/etc/inetd.conf')) {
-			replaceLine('/etc/inetd.conf','/usr/sbin/pure-ftpd-wrapper','#ftp     stream  tcp     nowait  root    /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper',0,0);
+			replaceLine('/etc/inetd.conf', '/usr/sbin/pure-ftpd-wrapper', '#ftp     stream  tcp     nowait  root    /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper', 0, 0);
 			exec($this->getinitcommand('openbsd-inetd', 'restart'));
 			//if(is_file($conf['init_scripts'].'/'.'openbsd-inetd')) exec($conf['init_scripts'].'/'.'openbsd-inetd restart');
 		}
@@ -1143,15 +1145,15 @@ class installer_base {
 
 		// configure pam for SMTP authentication agains the ispconfig database
 		$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)) 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 = 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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
-		$content = str_replace('{server_id}',$conf['server_id'],$content);
-		wf($conf['mydns']['config_dir'].'/'.$configfile,$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
+		$content = str_replace('{server_id}', $conf['server_id'], $content);
+		wf($conf['mydns']['config_dir'].'/'.$configfile, $content);
 		chmod($conf['mydns']['config_dir'].'/'.$configfile, 0600);
 		chown($conf['mydns']['config_dir'].'/'.$configfile, 'root');
 		chgrp($conf['mydns']['config_dir'].'/'.$configfile, 'root');
@@ -1178,22 +1180,22 @@ class installer_base {
 		//* load the powerdns databse dump
 		if($conf['mysql']['admin_password'] == '') {
 			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
-					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		} else {
 			caselog("mysql --default-character-set=".$conf['mysql']['charset']." -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' '".$conf['powerdns']['database']."' < '".ISPC_INSTALL_ROOT."/install/sql/powerdns.sql' &> /dev/null",
-					__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
+				__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in powerdns.sql');
 		}
 
 		//* Create the powerdns config file
 		$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)) 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 = 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);
-		$content = str_replace('{mysql_server_host}',$conf['mysql']['host'],$content);
-		wf($conf['powerdns']['config_dir'].'/'.$configfile,$content);
+		$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);
+		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
+		wf($conf['powerdns']['config_dir'].'/'.$configfile, $content);
 		chmod($conf['powerdns']['config_dir'].'/'.$configfile, 0600);
 		chown($conf['powerdns']['config_dir'].'/'.$configfile, 'root');
 		chgrp($conf['powerdns']['config_dir'].'/'.$configfile, 'root');
@@ -1204,19 +1206,19 @@ class installer_base {
 	public function configure_bind() {
 		global $conf;
 
-	    //* Check if the zonefile directory has a slash at the end
-	    $content=$conf['bind']['bind_zonefiles_dir'];
-	    if(substr($content,-1,1) != '/') {
-    	    $content .= '/';
+		//* Check if the zonefile directory has a slash at the end
+		$content=$conf['bind']['bind_zonefiles_dir'];
+		if(substr($content, -1, 1) != '/') {
+			$content .= '/';
 		}
 
 		//* Create the slave subdirectory
-	    $content .= 'slave';
-	    if(!@is_dir($content)) mkdir($content, 0770, true);
+		$content .= 'slave';
+		if(!@is_dir($content)) mkdir($content, 0770, true);
 
-	    //* Chown the slave subdirectory to $conf['bind']['bind_user']
-	    chown($content, $conf['bind']['bind_user']);
-	    chgrp($content, $conf['bind']['bind_group']);
+		//* Chown the slave subdirectory to $conf['bind']['bind_user']
+		chown($content, $conf['bind']['bind_user']);
+		chgrp($content, $conf['bind']['bind_group']);
 
 	}
 
@@ -1230,19 +1232,19 @@ class installer_base {
 		if(!@is_dir($conf['ispconfig_log_dir'].'/httpd')) mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
 
 		if(is_file('/etc/suphp/suphp.conf')) {
-			replaceLine('/etc/suphp/suphp.conf','php=php:/usr/bin','x-httpd-suphp="php:/usr/bin/php-cgi"',0);
+			replaceLine('/etc/suphp/suphp.conf', 'php=php:/usr/bin', 'x-httpd-suphp="php:/usr/bin/php-cgi"', 0);
 			//replaceLine('/etc/suphp/suphp.conf','docroot=','docroot=/var/clients',0);
-			replaceLine('/etc/suphp/suphp.conf','umask=0077','umask=0022',0);
+			replaceLine('/etc/suphp/suphp.conf', 'umask=0077', 'umask=0022', 0);
 		}
 
 		if(is_file('/etc/apache2/sites-enabled/000-default')) {
-			replaceLine('/etc/apache2/sites-available/000-default','NameVirtualHost *','NameVirtualHost *:80',1,0);
-			replaceLine('/etc/apache2/sites-available/000-default','<VirtualHost *>','<VirtualHost *:80>',1,0);
+			replaceLine('/etc/apache2/sites-available/000-default', 'NameVirtualHost *', 'NameVirtualHost *:80', 1, 0);
+			replaceLine('/etc/apache2/sites-available/000-default', '<VirtualHost *>', '<VirtualHost *:80>', 1, 0);
 		}
 
 		if(is_file('/etc/apache2/ports.conf')) {
 			// add a line "Listen 443" to ports conf if line does not exist
-			replaceLine('/etc/apache2/ports.conf','Listen 443','Listen 443',1);
+			replaceLine('/etc/apache2/ports.conf', 'Listen 443', 'Listen 443', 1);
 		}
 
 
@@ -1262,7 +1264,7 @@ class installer_base {
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -1275,29 +1277,29 @@ class installer_base {
 		}
 
 		$content .= "\n";
-		wf($vhost_conf_dir.'/ispconfig.conf',$content);
+		wf($vhost_conf_dir.'/ispconfig.conf', $content);
 
 		if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.conf')) {
-			symlink($vhost_conf_dir.'/ispconfig.conf',$vhost_conf_enabled_dir.'/000-ispconfig.conf');
+			symlink($vhost_conf_dir.'/ispconfig.conf', $vhost_conf_enabled_dir.'/000-ispconfig.conf');
 		}
 
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
 
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
 
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
@@ -1315,20 +1317,20 @@ class installer_base {
 		//* make sure that webalizer finds its config file when it is directly in /etc
 		if(@is_file('/etc/webalizer.conf') && !@is_dir('/etc/webalizer')) {
 			mkdir('/etc/webalizer');
-			symlink('/etc/webalizer.conf','/etc/webalizer/webalizer.conf');
+			symlink('/etc/webalizer.conf', '/etc/webalizer/webalizer.conf');
 		}
 
 		if(is_file('/etc/webalizer/webalizer.conf')) {
 			// Change webalizer mode to incremental
-			replaceLine('/etc/webalizer/webalizer.conf','#IncrementalName','IncrementalName webalizer.current',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#Incremental','Incremental     yes',0,0);
-			replaceLine('/etc/webalizer/webalizer.conf','#HistoryName','HistoryName     webalizer.hist',0,0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#IncrementalName', 'IncrementalName webalizer.current', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#Incremental', 'Incremental     yes', 0, 0);
+			replaceLine('/etc/webalizer/webalizer.conf', '#HistoryName', 'HistoryName     webalizer.hist', 0, 0);
 		}
 
 		// Check the awsatst script
 		if(!is_dir('/usr/share/awstats/tools')) exec('mkdir -p /usr/share/awstats/tools');
-		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl','/usr/share/awstats/tools/awstats_buildstaticpages.pl');
-		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local','LogFormat=4','LogFormat=1',0,1);
+		if(!file_exists('/usr/share/awstats/tools/awstats_buildstaticpages.pl') && file_exists('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl')) symlink('/usr/share/doc/awstats/examples/awstats_buildstaticpages.pl', '/usr/share/awstats/tools/awstats_buildstaticpages.pl');
+		if(file_exists('/etc/awstats/awstats.conf.local')) replaceLine('/etc/awstats/awstats.conf.local', 'LogFormat=4', 'LogFormat=1', 0, 1);
 
 		//* add a sshusers group
 		$command = 'groupadd sshusers';
@@ -1366,8 +1368,8 @@ class installer_base {
 	}
 
 	public function configure_fail2ban() {
-        // To Do
-    }
+		// To Do
+	}
 
 	public function configure_squid()
 	{
@@ -1377,13 +1379,13 @@ class installer_base {
 		$server_name = $row["server_name"];
 
 		$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)) 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 = 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);
-		wf($conf["squid"]["config_dir"].'/'.$configfile,$content);
+		$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);
+		wf($conf["squid"]["config_dir"].'/'.$configfile, $content);
 		exec('chmod 600 '.$conf["squid"]["config_dir"].'/'.$configfile);
 		exec('chown root:root '.$conf["squid"]["config_dir"].'/'.$configfile);
 	}
@@ -1391,9 +1393,9 @@ class installer_base {
 	public function configure_ufw_firewall()
 	{
 		$configfile = 'ufw.conf';
-		if(is_file('/etc/ufw/ufw.conf')) copy('/etc/ufw/ufw.conf','/etc/ufw/ufw.conf~');
+		if(is_file('/etc/ufw/ufw.conf')) copy('/etc/ufw/ufw.conf', '/etc/ufw/ufw.conf~');
 		$content = rf("tpl/".$configfile.".master");
-		wf('/etc/ufw/ufw.conf',$content);
+		wf('/etc/ufw/ufw.conf', $content);
 		exec('chmod 600 /etc/ufw/ufw.conf');
 		exec('chown root:root /etc/ufw/ufw.conf');
 	}
@@ -1408,10 +1410,10 @@ class installer_base {
 		@mkdir('/etc/Bastille', 0700);
 		if(is_dir('/etc/Bastille.backup/firewall.d')) caselog('cp -pfr /etc/Bastille.backup/firewall.d /etc/Bastille/', __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('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);
@@ -1422,8 +1424,8 @@ class installer_base {
 		$row = $this->db->queryOneRecord('SELECT * FROM '.$conf["mysql"]["database"].'.firewall WHERE server_id = '.intval($conf['server_id']));
 
 		if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') {
-			$tcp_public_services = trim(str_replace(',',' ',$row['tcp_port']));
-			$udp_public_services = trim(str_replace(',',' ',$row['udp_port']));
+			$tcp_public_services = trim(str_replace(',', ' ', $row['tcp_port']));
+			$udp_public_services = trim(str_replace(',', ' ', $row['udp_port']));
 		} else {
 			$tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000';
 			$udp_public_services = '53';
@@ -1467,21 +1469,21 @@ class installer_base {
 
 		//** Configure vlogger to use traffic logging to mysql (master) db
 		$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)) 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 = 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);
-			$content = str_replace('{mysql_server_database}',$conf['mysql']['master_database'],$content);
-			$content = str_replace('{mysql_server_ip}',$conf['mysql']['master_host'],$content);
+			$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);
+			$content = str_replace('{mysql_server_database}', $conf['mysql']['master_database'], $content);
+			$content = str_replace('{mysql_server_ip}', $conf['mysql']['master_host'], $content);
 		} else {
-			$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);
-			$content = str_replace('{mysql_server_ip}',$conf['mysql']['ip'],$content);
+			$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);
+			$content = str_replace('{mysql_server_ip}', $conf['mysql']['ip'], $content);
 		}
-		wf($conf['vlogger']['config_dir'].'/'.$configfile,$content);
+		wf($conf['vlogger']['config_dir'].'/'.$configfile, $content);
 		chmod($conf['vlogger']['config_dir'].'/'.$configfile, 0600);
 		chown($conf['vlogger']['config_dir'].'/'.$configfile, 'root');
 		chgrp($conf['vlogger']['config_dir'].'/'.$configfile, 'root');
@@ -1543,7 +1545,7 @@ class installer_base {
 			//* and create the symlink
 			if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
 			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
-				symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
 			}
 
 			if(!is_file($conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter')) {
@@ -1556,7 +1558,7 @@ class installer_base {
 				exec('chmod +x '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps/.php-fcgi-starter');
 				exec('chown -R ispapps:ispapps '.$conf['web']['website_basedir'].'/php-fcgi-scripts/apps');
 
-			}			
+			}
 		}
 		if($conf['nginx']['installed'] == true){
 			$apps_vhost_user = escapeshellcmd($conf['web']['apps_vhost_user']);
@@ -1596,7 +1598,7 @@ class installer_base {
 			}
 
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'apps.sock';
 			$cgi_socket = escapeshellcmd($conf['nginx']['cgi_socket']);
@@ -1608,7 +1610,7 @@ class installer_base {
 			//$content = str_replace('{fpm_port}', ($conf['nginx']['php_fpm_start_port']+1), $content);
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
-			
+
 			if(file_exists('/var/run/php5-fpm.sock')){
 				$use_tcp = '#';
 				$use_socket = '';
@@ -1635,7 +1637,7 @@ class installer_base {
 			//* and create the symlink
 			if(@is_link($vhost_conf_enabled_dir.'/apps.vhost')) unlink($vhost_conf_enabled_dir.'/apps.vhost');
 			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost')) {
-				symlink($vhost_conf_dir.'/apps.vhost',$vhost_conf_enabled_dir.'/000-apps.vhost');
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
 			}
 
 		}
@@ -1652,13 +1654,13 @@ class installer_base {
 
 		if(!@is_dir($install_dir.'/interface/ssl')) mkdir($install_dir.'/interface/ssl', 0755, true);
 
-		$ssl_pw = substr(md5(mt_rand()),0,6);
+		$ssl_pw = substr(md5(mt_rand()), 0, 6);
 		exec("openssl genrsa -des3 -passout pass:$ssl_pw -out $ssl_key_file 4096");
 		exec("openssl req -new -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -out $ssl_csr_file");
 		exec("openssl req -x509 -passin pass:$ssl_pw -passout pass:$ssl_pw -key $ssl_key_file -in $ssl_csr_file -out $ssl_crt_file -days 3650");
 		exec("openssl rsa -passin pass:$ssl_pw -in $ssl_key_file -out $ssl_key_file.insecure");
-		rename($ssl_key_file,$ssl_key_file.'.secure');
-		rename($ssl_key_file.'.insecure',$ssl_key_file);
+		rename($ssl_key_file, $ssl_key_file.'.secure');
+		rename($ssl_key_file.'.insecure', $ssl_key_file);
 
 	}
 
@@ -1700,7 +1702,7 @@ class installer_base {
 		}
 		$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_ispconfig_password}', $conf['mysql']['ispconfig_password'], $content);
 		$content = str_replace('{mysql_server_database}', $conf['mysql']['database'], $content);
 		$content = str_replace('{mysql_server_host}', $conf['mysql']['host'], $content);
 
@@ -1756,9 +1758,9 @@ class installer_base {
 		if (is_dir($dir)) {
 			if ($dh = opendir($dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/mods-available/'.$file);
-						$module_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/mods-available/'.$file;
+						$module_name = substr($file, 0, -8);
 						$tmp = new $module_name;
 						if($tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/mods-enabled/'.$file)) {
@@ -1785,11 +1787,11 @@ class installer_base {
 				while (($file = readdir($dh)) !== false) {
 					if($conf['apache']['installed'] == true && $file == 'nginx_plugin.inc.php') continue;
 					if($conf['nginx']['installed'] == true && $file == 'apache2_plugin.inc.php') continue;
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						include_once($install_dir.'/server/plugins-available/'.$file);
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						include_once $install_dir.'/server/plugins-available/'.$file;
+						$plugin_name = substr($file, 0, -8);
 						$tmp = new $plugin_name;
-						if(method_exists($tmp,'onInstall') && $tmp->onInstall()) {
+						if(method_exists($tmp, 'onInstall') && $tmp->onInstall()) {
 							if(!@is_link($install_dir.'/server/plugins-enabled/'.$file)) {
 								@symlink($install_dir.'/server/plugins-available/'.$file, $install_dir.'/server/plugins-enabled/'.$file);
 								//@symlink($install_dir.'/server/plugins-available/'.$file, '../plugins-enabled/'.$file);
@@ -1844,14 +1846,14 @@ class installer_base {
 
 		//* Make all interface language file directories group writable
 		$handle = @opendir($install_dir.'/interface/web');
-		while ($file = @readdir ($handle)) {
+		while ($file = @readdir($handle)) {
 			if ($file != '.' && $file != '..') {
 				if(@is_dir($install_dir.'/interface/web'.'/'.$file.'/lib/lang')) {
 					$handle2 = opendir($install_dir.'/interface/web'.'/'.$file.'/lib/lang');
-					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang',0770);
-					while ($lang_file = @readdir ($handle2)) {
+					chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang', 0770);
+					while ($lang_file = @readdir($handle2)) {
 						if ($lang_file != '.' && $lang_file != '..') {
-							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file,0770);
+							chmod($install_dir.'/interface/web'.'/'.$file.'/lib/lang/'.$lang_file, 0770);
 						}
 					}
 				}
@@ -1866,7 +1868,7 @@ class installer_base {
 		chmod($install_dir.'/server/lib/config.inc.php', 0600);
 		chown($install_dir.'/server/lib/config.inc.php', 'root');
 		chgrp($install_dir.'/server/lib/config.inc.php', 'root');
-		
+
 		//* Make sure thet the interface config file is readable by user ispconfig only
 		chmod($install_dir.'/interface/lib/config.inc.php', 0600);
 		chown($install_dir.'/interface/lib/config.inc.php', 'ispconfig');
@@ -1945,18 +1947,18 @@ class installer_base {
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
 			//if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
-				$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);
-				wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
-				exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
-				@symlink($install_dir.'/interface/web','/var/www/ispconfig');
-				exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
+			$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);
+			wf('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter', $content);
+			exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
+			@symlink($install_dir.'/interface/web', '/var/www/ispconfig');
+			exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
 			//}
 		}
 
@@ -1980,7 +1982,7 @@ class installer_base {
 			}
 
 			$socket_dir = escapeshellcmd($conf['nginx']['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'ispconfig.sock';
 
@@ -2006,7 +2008,7 @@ class installer_base {
 			if($this->is_update == false) {
 				if(@is_link($vhost_conf_enabled_dir.'/ispconfig.vhost')) unlink($vhost_conf_enabled_dir.'/ispconfig.vhost');
 				if(!@is_link($vhost_conf_enabled_dir.'/000-ispconfig.vhost')) {
-					symlink($vhost_conf_dir.'/ispconfig.vhost',$vhost_conf_enabled_dir.'/000-ispconfig.vhost');
+					symlink($vhost_conf_dir.'/ispconfig.vhost', $vhost_conf_enabled_dir.'/000-ispconfig.vhost');
 				}
 			}
 		}
@@ -2019,8 +2021,8 @@ class installer_base {
 		chmod($install_dir.'/server/scripts/update_from_tgz.sh', 0700);
 		chown($install_dir.'/server/scripts/ispconfig_update.sh', 'root');
 		chmod($install_dir.'/server/scripts/ispconfig_update.sh', 0700);
-		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update_from_svn.sh');
-		if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh','/usr/local/bin/ispconfig_update.sh');
+		if(!is_link('/usr/local/bin/ispconfig_update_from_svn.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update_from_svn.sh');
+		if(!is_link('/usr/local/bin/ispconfig_update.sh')) symlink($install_dir.'/server/scripts/ispconfig_update.sh', '/usr/local/bin/ispconfig_update.sh');
 
 		//* Make the logs readable for the ispconfig user
 		if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log');
@@ -2044,7 +2046,7 @@ class installer_base {
 		exec('chmod 660 '. $conf['ispconfig_log_dir'].'/auth.log');
 
 		if(is_user('getmail')) {
-			rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh');
+			rename($install_dir.'/server/scripts/run-getmail.sh', '/usr/local/bin/run-getmail.sh');
 			if(is_user('getmail')) chown('/usr/local/bin/run-getmail.sh', 'getmail');
 			chmod('/usr/local/bin/run-getmail.sh', 0744);
 		}
@@ -2072,11 +2074,11 @@ class installer_base {
 			fclose($fh);
 			*/
 		}
-		
+
 		//* Remove Domain module as its functions are available in the client module now
 		if(@is_dir('/usr/local/ispconfig/interface/web/domain')) exec('rm -rf /usr/local/ispconfig/interface/web/domain');
-	
-	
+
+
 	}
 
 	public function configure_dbserver() {
@@ -2094,10 +2096,10 @@ class installer_base {
 		}
 
 		$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);
-		wf($install_dir.'/server/lib/mysql_clientdb.conf',$content);
+		$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);
+		wf($install_dir.'/server/lib/mysql_clientdb.conf', $content);
 		chmod($install_dir.'/server/lib/mysql_clientdb.conf', 0600);
 		chown($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
 		chgrp($install_dir.'/server/lib/mysql_clientdb.conf', 'root');
@@ -2115,12 +2117,12 @@ class installer_base {
 
 		// remove existing ispconfig cronjobs, in case the syntax has changed
 		foreach($existing_root_cron_jobs as $key => $val) {
-			if(stristr($val,$install_dir)) unset($existing_root_cron_jobs[$key]);
+			if(stristr($val, $install_dir)) unset($existing_root_cron_jobs[$key]);
 		}
 
 		$root_cron_jobs = array(
-				"* * * * * ".$install_dir."/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done",
-				"30 00 * * * ".$install_dir."/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done"
+			"* * * * * ".$install_dir."/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done",
+			"30 00 * * * ".$install_dir."/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` \"\$line\" >> ".$conf['ispconfig_log_dir']."/cron.log; done"
 		);
 
 		if ($conf['nginx']['installed'] == true) {
@@ -2143,12 +2145,12 @@ class installer_base {
 			$existing_cron_jobs = file('crontab.txt');
 
 			$cron_jobs = array(
-					'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
+				'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /dev/null'
 			);
 
 			// remove existing ispconfig cronjobs, in case the syntax has changed
 			foreach($existing_cron_jobs as $key => $val) {
-				if(stristr($val,'getmail')) unset($existing_cron_jobs[$key]);
+				if(stristr($val, 'getmail')) unset($existing_cron_jobs[$key]);
 			}
 
 			foreach($cron_jobs as $cron_job) {
@@ -2165,7 +2167,7 @@ class installer_base {
 		chmod($conf['ispconfig_log_dir'].'/cron.log', 0660);
 
 	}
-	
+
 	public function getinitcommand($servicename, $action, $init_script_directory = ''){
 		global $conf;
 		// systemd
@@ -2202,17 +2204,17 @@ class installer_base {
 		global $conf, $dist;
 
 		$final_path = '';
-        $dist_template = $conf['ispconfig_install_dir'] . '/server/conf-custom/install/' . $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 {
-            $dist_template = 'dist/tpl/'.strtolower($dist['name'])."/$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;
@@ -2250,21 +2252,21 @@ class installer_base {
 		wf($tConf, $tContents); // write file
 
 		if (func_num_args() >= 4) // override rights and/or ownership
-		{
+			{
 			$args = func_get_args();
 			$output = array_slice($args, 2);
 
 			switch (sizeof($output)) {
-				case 3:
-					$umask = array_shift($output);
-					if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) {
-						$access = $umask;
-					}
-				case 2:
-					if (is_user($output[0]) && is_group($output[1])) {
-						list($user,$group) = $output;
-					}
-					break;
+			case 3:
+				$umask = array_shift($output);
+				if (is_numeric($umask) && preg_match('/^0?[0-7]{3}$/', $umask)) {
+					$access = $umask;
+				}
+			case 2:
+				if (is_user($output[0]) && is_group($output[1])) {
+					list($user, $group) = $output;
+				}
+				break;
 			}
 		}
 
@@ -2293,11 +2295,12 @@ class installer_base {
 		$tContents = str_replace('{mysql_server_ispconfig_password}', $conf["mysql"]["ispconfig_password"], $tContents);
 		$tContents = str_replace('{mysql_server_database}', $conf["mysql"]["database"], $tContents);
 		$tContents = str_replace('{mysql_server_ip}', $conf["mysql"]["ip"], $tContents);
-		$tContents = str_replace('{mysql_server_host}',$conf['mysql']['host'], $tContents);
-		$tContents = str_replace('{mysql_server_port}',$conf["mysql"]["port"], $tContents);
+		$tContents = str_replace('{mysql_server_host}', $conf['mysql']['host'], $tContents);
+		$tContents = str_replace('{mysql_server_port}', $conf["mysql"]["port"], $tContents);
 
 		return $tContents;
 	}
+
 }
 
 ?>
diff --git a/install/lib/mysql.lib.php b/install/lib/mysql.lib.php
index b7f1ae8726373e0913d66b71f2b5c91505d0765f..c5c2a83a68681ac18a7c3036307c6f0b4423fa49 100644
--- a/install/lib/mysql.lib.php
+++ b/install/lib/mysql.lib.php
@@ -30,25 +30,25 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class db
 {
-	var $dbHost = "";		  // hostname of the MySQL server
-	var $dbName = "";		  // logical database name on that server
-	var $dbUser = "";		  // database authorized user
-	var $dbPass = "";		  // user's password
+	var $dbHost = "";    // hostname of the MySQL server
+	var $dbName = "";    // logical database name on that server
+	var $dbUser = "";    // database authorized user
+	var $dbPass = "";    // user's password
 	var $dbCharset = "";      // what charset comes and goes to mysql: utf8 / latin1
-	var $linkId = false;		  // last result of mysql_connect()
-	var $queryId = 0;		  // last result of mysql_query()
-	var $record	= array();	  // last record fetched
-    var $autoCommit = 1;      // Autocommit Transactions
-	var $currentRow;		  // current row number
-	var $errorNumber = 0;	  // last error number
-	var $errorMessage = "";	  // last error message
+	var $linkId = false;    // last result of mysql_connect()
+	var $queryId = 0;    // last result of mysql_query()
+	var $record = array();   // last record fetched
+	var $autoCommit = 1;      // Autocommit Transactions
+	var $currentRow;    // current row number
+	var $errorNumber = 0;   // last error number
+	var $errorMessage = "";   // last error message
 	var $errorLocation = "";  // last error location
 	var $show_error_messages = false;
 
 	// constructor
 	function db()
 	{
-		
+
 		global $conf;
 		$this->dbHost = $conf["mysql"]["host"];
 		//$this->dbName = $conf["mysql"]["database"];
@@ -66,7 +66,7 @@ class db
 		$this->errorLocation = $location;
 		if($this->errorNumber && $this->show_error_messages)
 		{
-			echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
+			echo '<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage;
 			flush();
 		}
 	}
@@ -138,7 +138,7 @@ class db
 	// returns the next record in an array
 	function nextRecord()
 	{
-        $this->record = mysqli_fetch_assoc($this->queryId);
+		$this->record = mysqli_fetch_assoc($this->queryId);
 		$this->updateError('DB::nextRecord()<br />mysqli_fetch_array');
 		if(!$this->record || !is_array($this->record))
 		{
@@ -153,37 +153,37 @@ class db
 	{
 		return mysqli_num_rows($this->queryId);
 	}
-	
+
 	function affectedRows()
 	{
 		return mysqli_affected_rows($this->linkId);
 	}
-	
+
 	// returns mySQL insert id
 	function insertID()
 	{
 		return mysqli_insert_id($this->linkId);
 	}
-    
-    // Check der variablen
+
+	// Check der variablen
 	// deprecated, now use quote
-    function check($formfield)
-    {
-        return $this->quote($formfield);
-    }
-	
+	function check($formfield)
+	{
+		return $this->quote($formfield);
+	}
+
 	// Check der variablen
-    function quote($formfield)
-    {
-        return mysqli_real_escape_string($this->linkId, $formfield);
-    }
-	
+	function quote($formfield)
+	{
+		return mysqli_real_escape_string($this->linkId, $formfield);
+	}
+
 	// Check der variablen
-    function unquote($formfield)
-    {
-        return stripslashes($formfield);
-    }
-	
+	function unquote($formfield)
+	{
+		return stripslashes($formfield);
+	}
+
 	function toLower($record) {
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
@@ -191,64 +191,64 @@ class db
 				$out[$key] = $val;
 			}
 		}
-	return $out;
+		return $out;
 	}
-   
-   
-   function insert($tablename,$form,$debug = 0)
-   {
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $sql_key .= "$key, ";
-        $sql_value .= "'".$this->check($value)."', ";
-  		 }
-   	$sql_key = substr($sql_key,0,strlen($sql_key) - 2);
-    $sql_value = substr($sql_value,0,strlen($sql_value) - 2);
-    
-   	$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
-   
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-      }
-   }
-   
-   function update($tablename,$form,$bedingung,$debug = 0)
-   {
-   
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $insql .= "$key = '".$this->check($value)."', ";
-  		 }
-   	        $insql = substr($insql,0,strlen($insql) - 2);
-   	        $sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-       }
-   }
-   
-   function closeConn() {
-   
-   }
-   
-   function freeResult() {
-   
-   
-   }
-   
-   function delete() {
-   
-   }
-   
-   function Transaction($action) {
-   //action = begin, commit oder rollback
-   
-   }
-   
-   /*
+
+
+	function insert($tablename, $form, $debug = 0)
+	{
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$sql_key .= "$key, ";
+				$sql_value .= "'".$this->check($value)."', ";
+			}
+			$sql_key = substr($sql_key, 0, strlen($sql_key) - 2);
+			$sql_value = substr($sql_value, 0, strlen($sql_value) - 2);
+
+			$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
+
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
+		}
+	}
+
+	function update($tablename, $form, $bedingung, $debug = 0)
+	{
+
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$insql .= "$key = '".$this->check($value)."', ";
+			}
+			$insql = substr($insql, 0, strlen($insql) - 2);
+			$sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
+		}
+	}
+
+	function closeConn() {
+
+	}
+
+	function freeResult() {
+
+
+	}
+
+	function delete() {
+
+	}
+
+	function Transaction($action) {
+		//action = begin, commit oder rollback
+
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -258,49 +258,49 @@ class db
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   
-   function createTable($table_name,$columns) {
-   $index = "";
-   $sql = "CREATE TABLE $table_name (";
-   foreach($columns as $col){
-        $sql .= $col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-   
-        if($col["defaultValue"] != "") {
-			if($col["defaultValue"] == "NULL" or $col["defaultValue"] == "NOT NULL") {
-				$sql .= "DEFAULT ".$col["defaultValue"]." ";
-			} else {
-				$sql .= "DEFAULT '".$col["defaultValue"]."' ";
+
+	function createTable($table_name, $columns) {
+		$index = "";
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col["name"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+
+			if($col["defaultValue"] != "") {
+				if($col["defaultValue"] == "NULL" or $col["defaultValue"] == "NOT NULL") {
+					$sql .= "DEFAULT ".$col["defaultValue"]." ";
+				} else {
+					$sql .= "DEFAULT '".$col["defaultValue"]."' ";
+				}
+
+			} elseif($col["defaultValue"] != false) {
+				$sql .= "DEFAULT '' ";
 			}
-			
-		} elseif($col["defaultValue"] != false) {
-			$sql .= "DEFAULT '' ";
-		}
-		if($col["defaultValue"] != "NULL" && $col["defaultValue"] != "NOT NULL") {
-        	if($col["notNull"] == true) {
-            	$sql .= "NOT NULL ";
-        	} else {
-            	$sql .= "NULL ";
-        	}
+			if($col["defaultValue"] != "NULL" && $col["defaultValue"] != "NOT NULL") {
+				if($col["notNull"] == true) {
+					$sql .= "NOT NULL ";
+				} else {
+					$sql .= "NULL ";
+				}
+			}
+			if($col["autoInc"] == true) $sql .= "auto_increment ";
+			$sql.= ",";
+			// key Definitionen
+			if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
+			if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
+			if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
 		}
-        if($col["autoInc"] == true) $sql .= "auto_increment ";
-        $sql.= ",";
-        // key Definitionen
-        if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
-        if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
-        if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
-   }
-   $sql .= $index;
-   $sql = substr($sql,0,-1);
-   $sql .= ")";
-   
-   $this->query($sql);
-   return true;
-   }
-   
-   /*
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ")";
+
+		$this->query($sql);
+		return true;
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -310,56 +310,56 @@ class db
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   function alterTable($table_name,$columns) {
-   $index = "";
-   $sql = "ALTER TABLE $table_name ";
-   foreach($columns as $col){
-        if($col["action"] == 'add') {
-            $sql .= "ADD ".$col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-        } elseif ($col["action"] == 'alter') {
-            $sql .= "CHANGE ".$col["name"]." ".$col["name_new"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-        } elseif ($col["action"] == 'drop') {
-            $sql .= "DROP ".$col["name"]." ";
-        }
-        if($col["action"] != 'drop') {  
-        if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
-        if($col["notNull"] == true) {
-            $sql .= "NOT NULL ";
-        } else {
-            $sql .= "NULL ";
-        }
-        if($col["autoInc"] == true) $sql .= "auto_increment ";
-        $sql.= ",";
-        // key Definitionen
-        if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
-        if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
-        if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
-        }
-   }
-   $sql .= $index;
-   $sql = substr($sql,0,-1);
-   
-   //die($sql);
-   $this->query($sql);
-   return true;
-   }
-   
-   function dropTable($table_name) {
-   $this->check($table_name);
-   $sql = "DROP TABLE '". $table_name."'";
-   return $this->query($sql);
-   }
-   
-   // gibt Array mit Tabellennamen zur�ck
-   function getTables($database_name = '') {
-   	
+	function alterTable($table_name, $columns) {
+		$index = "";
+		$sql = "ALTER TABLE $table_name ";
+		foreach($columns as $col){
+			if($col["action"] == 'add') {
+				$sql .= "ADD ".$col["name"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+			} elseif ($col["action"] == 'alter') {
+				$sql .= "CHANGE ".$col["name"]." ".$col["name_new"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+			} elseif ($col["action"] == 'drop') {
+				$sql .= "DROP ".$col["name"]." ";
+			}
+			if($col["action"] != 'drop') {
+				if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
+				if($col["notNull"] == true) {
+					$sql .= "NOT NULL ";
+				} else {
+					$sql .= "NULL ";
+				}
+				if($col["autoInc"] == true) $sql .= "auto_increment ";
+				$sql.= ",";
+				// key Definitionen
+				if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
+				if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
+				if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
+			}
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+
+		//die($sql);
+		$this->query($sql);
+		return true;
+	}
+
+	function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
+	}
+
+	// gibt Array mit Tabellennamen zur�ck
+	function getTables($database_name = '') {
+
 		if($database_name == ''){
-            $database_name = $this->dbName;
-        }
-		
+			$database_name = $this->dbName;
+		}
+
 		$tables = $this->queryAllRecords("SHOW TABLES FROM `$database_name`");
 		$tb_names = array();
 		if(is_array($tables) && !empty($tables)){
@@ -367,7 +367,7 @@ class db
 				$tb_names[$i] = $tables[$i]['Tables_in_'.$database_name];
 			}
 		}
-		
+
 		/*
         $result = mysqli_query("SHOW TABLES FROM `$database_name`");
         $tb_names = array();
@@ -375,11 +375,11 @@ class db
             $tb_names[$i] = mysql_tablename($result, $i);
         }
 		*/
-        return $tb_names;       
-   }
-   
-   // gibt Feldinformationen zur Tabelle zur�ck
-   /*
+		return $tb_names;
+	}
+
+	// gibt Feldinformationen zur Tabelle zur�ck
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -389,101 +389,101 @@ class db
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   
-   function tableInfo($table_name) {
-   
-   global $go_api,$go_info;
-   // Tabellenfelder einlesen
-    
-    if($rows = $go_api->db->queryAllRecords("SHOW FIELDS FROM ".$table_name)){
-    foreach($rows as $row) {
-        $name = $row[0];
-        $default = $row[4];
-        $key = $row[3];
-        $extra = $row[5];
-        $isnull = $row[2];
-        $type = $row[1];
-    
-        
-        $column = array();
-    
-        $column["name"] = $name;
-        //$column["type"] = $type;
-        $column["defaultValue"] = $default;
-        if(stristr($key,"PRI")) $column["option"] = "primary";
-        if(stristr($isnull,"YES")) {
-            $column["notNull"] = false;
-        } else {
-           $column["notNull"] = true; 
-        }
-        if($extra == 'auto_increment') $column["autoInc"] = true;
-        
-        
-        // Type in Metatype umsetzen
-        
-        if(stristr($type,"int(")) $metaType = 'int32';
-        if(stristr($type,"bigint")) $metaType = 'int64';
-        if(stristr($type,"char")) {
-            $metaType = 'char';
-            $tmp_typeValue = explode('(',$type);
-            $column["typeValue"] = substr($tmp_typeValue[1],0,-1);  
-        }
-        if(stristr($type,"varchar")) {
-            $metaType = 'varchar';
-            $tmp_typeValue = explode('(',$type);
-            $column["typeValue"] = substr($tmp_typeValue[1],0,-1);  
-        }
-        if(stristr($type,"text")) $metaType = 'text';
-        if(stristr($type,"double")) $metaType = 'double';
-        if(stristr($type,"blob")) $metaType = 'blob';
-        
-        
-        $column["type"] = $metaType;
-        
-    $columns[] = $column;
-    }
-        return $columns;
-    } else {
-        return false;
-    }
-
-   }
-   
-   function mapType($metaType,$typeValue) {
-   global $go_api;
-   $metaType = strtolower($metaType);
-   switch ($metaType) {
-   case 'int16':
-        return 'smallint';
-   break;
-   case 'int32':
-        return 'int';
-   break;
-   case 'int64':
-        return 'bigint';
-   break;
-   case 'double':
-        return 'double';
-   break;
-   case 'char':
-        return 'char';
-   break;
-   case 'varchar':
-        if($typeValue < 1) die("Datenbank Fehler: F�r diesen Datentyp ist eine L�ngenangabe notwendig.");
-        return 'varchar('.$typeValue.')';
-   break;
-   case 'text':
-        return 'text';
-   break;
-   case 'blob':
-        return 'blob';
-   break;
-   }
-   }
-	
+
+	function tableInfo($table_name) {
+
+		global $go_api, $go_info;
+		// Tabellenfelder einlesen
+
+		if($rows = $go_api->db->queryAllRecords("SHOW FIELDS FROM ".$table_name)){
+			foreach($rows as $row) {
+				$name = $row[0];
+				$default = $row[4];
+				$key = $row[3];
+				$extra = $row[5];
+				$isnull = $row[2];
+				$type = $row[1];
+
+
+				$column = array();
+
+				$column["name"] = $name;
+				//$column["type"] = $type;
+				$column["defaultValue"] = $default;
+				if(stristr($key, "PRI")) $column["option"] = "primary";
+				if(stristr($isnull, "YES")) {
+					$column["notNull"] = false;
+				} else {
+					$column["notNull"] = true;
+				}
+				if($extra == 'auto_increment') $column["autoInc"] = true;
+
+
+				// Type in Metatype umsetzen
+
+				if(stristr($type, "int(")) $metaType = 'int32';
+				if(stristr($type, "bigint")) $metaType = 'int64';
+				if(stristr($type, "char")) {
+					$metaType = 'char';
+					$tmp_typeValue = explode('(', $type);
+					$column["typeValue"] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, "varchar")) {
+					$metaType = 'varchar';
+					$tmp_typeValue = explode('(', $type);
+					$column["typeValue"] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, "text")) $metaType = 'text';
+				if(stristr($type, "double")) $metaType = 'double';
+				if(stristr($type, "blob")) $metaType = 'blob';
+
+
+				$column["type"] = $metaType;
+
+				$columns[] = $column;
+			}
+			return $columns;
+		} else {
+			return false;
+		}
+
+	}
+
+	function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) die("Datenbank Fehler: F�r diesen Datentyp ist eine L�ngenangabe notwendig.");
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
+
 }
 
 ?>
diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php
index b4e73abb1d0694dbec42a6c1fca688836beeb5cc..bc0453f7f63df24fbe45fef5e219131f297c45ef 100644
--- a/install/lib/update.lib.php
+++ b/install/lib/update.lib.php
@@ -29,10 +29,12 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 //* Installer patch stub class
 class installer_patch_update {
-   protected function onBeforeSQL() {
-   }
-   protected function onAfterSQL() {
-   }
+	protected function onBeforeSQL() {
+	}
+
+	protected function onAfterSQL() {
+	}
+
 }
 
 //* DB dump function
@@ -70,25 +72,25 @@ function prepareDBDump() {
 	} else {
 		$backup_db_name = '/root/ispconfig_db_backup_'.@date('Y-m-d_H-i').'.sql';
 	}
-	copy('existing_db.sql',$backup_db_name);
+	copy('existing_db.sql', $backup_db_name);
 	chmod($backup_db_name, 0700);
 	chown($backup_db_name, 'root');
 	chgrp($backup_db_name, 'root');
 
 	if ($conf['powerdns']['installed']) {
 		//** export the current PowerDNS database data
-        	if( !empty($conf["mysql"]["admin_password"]) ) {
-            		system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
-        	} else {
-            		system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
-        	}
+		if( !empty($conf["mysql"]["admin_password"]) ) {
+			system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
+		} else {
+			system("mysqldump -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -c -t --add-drop-table --create-options --quick --result-file=existing_powerdns_db.sql ".$conf['powerdns']['database']);
+		}
 
 		// create a backup copy of the PowerDNS database in the root folder
 		$backup_db_name = '/root/ispconfig_powerdns_db_backup_'.@date('Y-m-d_h-i').'.sql';
-	        copy('existing_powerdns_db.sql',$backup_db_name);
+		copy('existing_powerdns_db.sql', $backup_db_name);
 		chmod($backup_db_name, 0700);
-	        chown($backup_db_name, 'root');
-	        chgrp($backup_db_name, 'root');
+		chown($backup_db_name, 'root');
+		chgrp($backup_db_name, 'root');
 	}
 }
 
@@ -115,7 +117,7 @@ function checkDbHealth() {
 		sread();
 	}
 	else
-	  echo "OK\n";
+		echo "OK\n";
 }
 
 function updateDbAndIni() {
@@ -136,9 +138,9 @@ function updateDbAndIni() {
 	$conf['services']['vserver'] = ($tmp['vserver_server'] == 1)?true:false;
 	$conf['services']['proxy'] = (isset($tmp['proxy_server']) && $tmp['proxy_server'] == 1)?true:false;
 	$conf['services']['firewall'] = (isset($tmp['firewall_server']) && $tmp['firewall_server'] == 1)?true:false;
-	
+
 	$conf['postfix']['vmail_mailbox_base'] = $ini_array['mail']['homedir_path'];
-	
+
 	if(isset($ini_array['web']['server_type']) && $ini_array['web']['server_type'] != ''){
 		$conf['webserver']['server_type'] = $ini_array['web']['server_type'];
 		if($conf['webserver']['server_type'] == 'nginx'){
@@ -150,38 +152,38 @@ function updateDbAndIni() {
 		$conf['webserver']['server_type'] = 'apache';
 		$conf['nginx']['installed'] = false;
 	}
-	
+
 	//* Do incremental DB updates only on installed ISPConfig versions > 3.0.3
-	if(compare_ispconfig_version('3.0.3',ISPC_APP_VERSION) >= 0) {
-		
+	if(compare_ispconfig_version('3.0.3', ISPC_APP_VERSION) >= 0) {
+
 		swriteln($inst->lng('Starting incremental database update.'));
-		
-		//* get the version of the db schema from the server table 
+
+		//* get the version of the db schema from the server table
 		$found = true;
 		while($found == true) {
 			$next_db_version = intval($current_db_version + 1);
 			$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
 			$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
-			
+
 			if(is_file($sql_patch_filename)) {
-				
+
 				//* Load php patch file and instantiate object
 				if(is_file($php_patch_filename)) {
 					$php_patch_class_name = 'upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT);
-					include_once($php_patch_filename);
+					include_once $php_patch_filename;
 					if(class_exists($php_patch_class_name)) {
 						$php_patch = new $php_patch_class_name;
 					} else {
 						swriteln($inst->lng('WARNING: PHP patch file').': '.$php_patch_filename.' '.$inst->lng('contains errors.'));
 					}
 				}
-				
+
 				//* Exec onBeforeSQL function
 				if(isset($php_patch) && is_object($php_patch)) {
 					$php_patch->onBeforeSQL();
 					swriteln($inst->lng('Executing PHP patch file').': '.$php_patch_filename);
 				}
-				
+
 				//* Load patch file into database
 				if( !empty($conf["mysql"]["admin_password"]) ) {
 					system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
@@ -189,32 +191,32 @@ function updateDbAndIni() {
 					system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
 				}
 				swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
-				
+
 				//* Exec onAfterSQL function
 				if(isset($php_patch) && is_object($php_patch)) {
 					$php_patch->onAfterSQL();
 				}
-				
+
 				$current_db_version = $next_db_version;
 				if(isset($php_patch)) unset($php_patch);
 			} else {
 				$found = false;
 			}
 		}
-		
+
 		//* update the database version in server table
 		$inst->db->query("UPDATE ".$conf["mysql"]["database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 		if($inst->db->dbHost != $inst->dbmaster->dbHost) $inst->dbmaster->query("UPDATE ".$conf["mysql"]["master_database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
-		
-	
-	//* If ISPConfig Version < 3.0.3, we will do a full db update
+
+
+		//* If ISPConfig Version < 3.0.3, we will do a full db update
 	} else {
-		
+
 		swriteln($inst->lng('Starting full database update.'));
-		
+
 		//** Delete the old database
 		if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['mysql']['database']) ) {
-		$inst->error('Unable to drop MySQL database: '.$conf['mysql']['database'].'.');
+			$inst->error('Unable to drop MySQL database: '.$conf['mysql']['database'].'.');
 		}
 
 		//** Create the mysql database
@@ -233,7 +235,7 @@ function updateDbAndIni() {
 		} else {
 			system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < existing_db.sql");
 		}
-		
+
 		//** Get the database version number based on the patchfile
 		$found = true;
 		while($found == true) {
@@ -245,29 +247,29 @@ function updateDbAndIni() {
 				$found = false;
 			}
 		}
-		
+
 		//* update the database version in server table
 		$inst->db->query("UPDATE ".$conf["mysql"]["database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 		if($inst->db->dbHost != $inst->dbmaster->dbHost) $inst->dbmaster->query("UPDATE ".$conf["mysql"]["master_database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']);
 
 		if ($conf['powerdns']['installed']) {
-                                                 
+
 			swriteln($inst->lng('Starting full PowerDNS database update.'));
 
-            //** Delete the old PowerDNS database
-            if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['powerdns']['database']) ) {
+			//** Delete the old PowerDNS database
+			if( !$inst->db->query('DROP DATABASE IF EXISTS '.$conf['powerdns']['database']) ) {
 				$inst->error('Unable to drop MySQL database: '.$conf['powerdns']['database'].'.');
-            }
+			}
 
-            //** Create the mysql database
-            $inst->configure_powerdns();
+			//** Create the mysql database
+			$inst->configure_powerdns();
 
-            //** load old data back into the PowerDNS database
-            if( !empty($conf["mysql"]["admin_password"]) ) {
-            	system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
-            } else {
-            	system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
-            }
+			//** load old data back into the PowerDNS database
+			if( !empty($conf["mysql"]["admin_password"]) ) {
+				system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
+			} else {
+				system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['powerdns']['database'])." < existing_powerdns_db.sql");
+			}
 		}
 	}
 
@@ -277,7 +279,7 @@ function updateDbAndIni() {
 	$old_ini_array = ini_to_array(stripslashes($tmp_server_rec['config']));
 	unset($tmp_server_rec);
 	$tpl_ini_array = ini_to_array(rf('tpl/server.ini.master'));
-	
+
 	//* Update further distribution specific parameters for server config here
 	//* HINT: Every line added here has to be added in installer_base.lib.php too!!
 	$tpl_ini_array['jailkit']['jailkit_chroot_app_programs'] = $conf['jailkit']['jailkit_chroot_app_programs'];
@@ -302,7 +304,7 @@ function updateDbAndIni() {
 	$tpl_ini_array['dns']['bind_zonefiles_dir'] = $conf['bind']['bind_zonefiles_dir'];
 	$tpl_ini_array['dns']['named_conf_path'] = $conf['bind']['named_conf_path'];
 	$tpl_ini_array['dns']['named_conf_local_path'] = $conf['bind']['named_conf_local_path'];
-	
+
 	$tpl_ini_array['web']['nginx_vhost_conf_dir'] = $conf['nginx']['vhost_conf_dir'];
 	$tpl_ini_array['web']['nginx_vhost_conf_enabled_dir'] = $conf['nginx']['vhost_conf_enabled_dir'];
 	$tpl_ini_array['web']['nginx_user'] = $conf['nginx']['user'];
@@ -313,7 +315,7 @@ function updateDbAndIni() {
 	$tpl_ini_array['web']['php_fpm_pool_dir'] = $conf['nginx']['php_fpm_pool_dir'];
 	$tpl_ini_array['web']['php_fpm_start_port'] = $conf['nginx']['php_fpm_start_port'];
 	$tpl_ini_array['web']['php_fpm_socket_dir'] = $conf['nginx']['php_fpm_socket_dir'];
-		
+
 	if ($conf['nginx']['installed'] == true) {
 		$tpl_ini_array['web']['server_type'] = 'nginx';
 		$tpl_ini_array['global']['webserver'] = 'nginx';
@@ -331,7 +333,7 @@ function updateDbAndIni() {
 	$new_ini = array_to_ini($tpl_ini_array);
 	$sql = "UPDATE ".$conf["mysql"]["database"].".server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id'];
 	$inst->db->query($sql);
-	
+
 	if($inst->db->dbHost != $inst->dbmaster->dbHost) {
 		$sql = "UPDATE ".$conf["mysql"]["master_database"].".server SET config = '".mysql_real_escape_string($new_ini)."' WHERE server_id = ".$conf['server_id'];
 		$inst->dbmaster->query($sql);
diff --git a/install/patches/upd_0001.php b/install/patches/upd_0001.php
index 93d6967b9d2f5d77b69e57466548daf9560df71c..596bef596406fff80925416d18e80426c8ce267e 100644
--- a/install/patches/upd_0001.php
+++ b/install/patches/upd_0001.php
@@ -1,6 +1,6 @@
 <?php
 
-if(!defined('INSTALLER_RUN')) die('Patch update file access violation.'); 
+if(!defined('INSTALLER_RUN')) die('Patch update file access violation.');
 
 /*
 	Example installer patch update class. the classname must match
@@ -10,12 +10,14 @@ if(!defined('INSTALLER_RUN')) die('Patch update file access violation.');
 
 class upd_0001 extends installer_patch_update {
 
-   public function onBeforeSQL() {
-     // Do something
-   }
-   public function onAfterSQL() {
-     // Do something
-   }
+	public function onBeforeSQL() {
+		// Do something
+	}
+
+	public function onAfterSQL() {
+		// Do something
+	}
+
 }
 
 ?>
diff --git a/install/setrights.php b/install/setrights.php
index 1124136baaee5ec95f7981bd050bd318094bfba8..275401a91f247201f764fc92c50167f7aef5e033 100644
--- a/install/setrights.php
+++ b/install/setrights.php
@@ -34,7 +34,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 error_reporting(E_ALL|E_STRICT);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -43,17 +43,17 @@ echo " _____ ___________   _____              __ _         ____
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-	echo "\n".str_repeat('-',80)."\n";
-	echo "\n\n>>This script tries to repair the client rights  \n\n";
+echo "\n".str_repeat('-', 80)."\n";
+echo "\n\n>>This script tries to repair the client rights  \n\n";
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the library with the basic updater functions
-require_once('lib/update.lib.php');
+require_once 'lib/update.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -62,16 +62,16 @@ if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update
 //** Get distribution identifier
 $dist = get_distname();
 
-include_once("/usr/local/ispconfig/server/lib/config.inc.php");
+include_once "/usr/local/ispconfig/server/lib/config.inc.php";
 $conf_old = $conf;
 unset($conf);
 
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
@@ -87,15 +87,15 @@ if($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql
 /*
  * Try to read the DB-admin settings
  */
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
-include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf");
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
+include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
 $conf["mysql"]["admin_user"] = $clientdb_user;
 $conf["mysql"]["admin_password"] = $clientdb_password;
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
 
 //** There is a error if user for mysql admin_password if empty
 if( empty($conf["mysql"]["admin_password"]) ) {
@@ -105,7 +105,7 @@ if( empty($conf["mysql"]["admin_password"]) ) {
 $inst = new installer();
 
 //** Initialize the MySQL server connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 
 //* initialize the database
 $inst->db = new db();
diff --git a/install/uninstall-fedora.php b/install/uninstall-fedora.php
index 4da434787a285c1ef092b69f8063785dee89b389..66eb3003f60b35250c10e31d9b71c971467811a4 100644
--- a/install/uninstall-fedora.php
+++ b/install/uninstall-fedora.php
@@ -35,7 +35,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 error_reporting(E_ALL|E_STRICT);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -44,11 +44,11 @@ echo " _____ ___________   _____              __ _         ____
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Uninstall  \n\n";
 
-require("/usr/local/ispconfig/server/lib/config.inc.php");
-require("/usr/local/ispconfig/server/lib/app.inc.php");
+require "/usr/local/ispconfig/server/lib/config.inc.php";
+require "/usr/local/ispconfig/server/lib/app.inc.php";
 
 // Delete the ISPConfig database
 // $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
diff --git a/install/uninstall.php b/install/uninstall.php
index 415ecf4f0fb1399c17b6be8200763dbe064f96e1..96d98c7cad6b3e922f1ca66d916c587a66d5e3db 100644
--- a/install/uninstall.php
+++ b/install/uninstall.php
@@ -35,7 +35,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 error_reporting(E_ALL|E_STRICT);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -44,11 +44,11 @@ echo " _____ ___________   _____              __ _         ____
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Uninstall  \n\n";
 
-require("/usr/local/ispconfig/server/lib/config.inc.php");
-require("/usr/local/ispconfig/server/lib/app.inc.php");
+require "/usr/local/ispconfig/server/lib/config.inc.php";
+require "/usr/local/ispconfig/server/lib/app.inc.php";
 
 // Delete the ISPConfig database
 // $app->db->query("DROP DATABASE '".$conf["db_database"]."'");
diff --git a/install/update.php b/install/update.php
index a7c8a931222e8184db1bfe75c3be176abcd2d8a8..2788998dc578dbe365ef6c7729622b056223fa4c 100644
--- a/install/update.php
+++ b/install/update.php
@@ -37,7 +37,7 @@ error_reporting(E_ALL|E_STRICT);
 define('INSTALLER_RUN', true);
 
 //** The banner on the command line
-echo "\n\n".str_repeat('-',80)."\n";
+echo "\n\n".str_repeat('-', 80)."\n";
 echo " _____ ___________   _____              __ _         ____
 |_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
   | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
@@ -46,17 +46,17 @@ echo " _____ ___________   _____              __ _         ____
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Update  \n\n";
 
 //** Include the library with the basic installer functions
-require_once('lib/install.lib.php');
+require_once 'lib/install.lib.php';
 
 //** Include the library with the basic updater functions
-require_once('lib/update.lib.php');
+require_once 'lib/update.lib.php';
 
 //** Include the base class of the installer class
-require_once('lib/installer_base.lib.php');
+require_once 'lib/installer_base.lib.php';
 
 //** Ensure that current working directory is install directory
 $cur_dir = getcwd();
@@ -74,16 +74,16 @@ if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) {
 //** Get distribution identifier
 $dist = get_distname();
 
-include_once("/usr/local/ispconfig/server/lib/config.inc.php");
+include_once "/usr/local/ispconfig/server/lib/config.inc.php";
 $conf_old = $conf;
 unset($conf);
 
 if($dist['id'] == '') die('Linux distribution or version not recognized.');
 
 //** Include the distribution-specific installer class library and configuration
-if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once('dist/lib/'.$dist['baseid'].'.lib.php');
-include_once('dist/lib/'.$dist['id'].'.lib.php');
-include_once('dist/conf/'.$dist['id'].'.conf.php');
+if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php';
+include_once 'dist/lib/'.$dist['id'].'.lib.php';
+include_once 'dist/conf/'.$dist['id'].'.conf.php';
 
 //** Get hostname
 exec('hostname -f', $tmp_out);
@@ -128,52 +128,52 @@ $inst->find_installed_apps();
 echo "This application will update ISPConfig 3 on your server.\n\n";
 
 //* Make a backup before we start the update
-$do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes','no'),'yes');
+$do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes', 'no'), 'yes');
 if($do_backup == 'yes') {
-	
+
 	//* Create the backup directory
 	$backup_path = '/var/backup/ispconfig_'.@date('Y-m-d_H-i');
 	$conf['backup_path'] = $backup_path;
 	exec("mkdir -p $backup_path");
 	exec("chown root:root $backup_path");
 	exec("chmod 700 $backup_path");
-	
+
 	//* Do the backup
 	swriteln('Creating backup of "/usr/local/ispconfig" directory...');
-	exec("tar pcfz $backup_path/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null",$out,$returnvar);
+	exec("tar pcfz $backup_path/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null", $out, $returnvar);
 	if($returnvar != 0) die("Backup failed. We stop here...\n");
-	
+
 	swriteln('Creating backup of "/etc" directory...');
-	exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null",$out,$returnvar);
+	exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null", $out, $returnvar);
 	if($returnvar != 0) die("Backup failed. We stop here...\n");
-	
+
 	exec("chown root:root $backup_path/*.tar.gz");
 	exec("chmod 700 $backup_path/*.tar.gz");
 }
 
 
 //** Initialize the MySQL server connection
-include_once('lib/mysql.lib.php');
+include_once 'lib/mysql.lib.php';
 
 //** Database update is a bit brute force and should be rebuild later ;)
 
 /*
  * Try to read the DB-admin settings
  */
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
-include_once("/usr/local/ispconfig/server/lib/mysql_clientdb.conf");
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
+include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf";
 $conf["mysql"]["admin_user"] = $clientdb_user;
 $conf["mysql"]["admin_password"] = $clientdb_password;
-$clientdb_host			= '';
-$clientdb_user			= '';
-$clientdb_password		= '';
+$clientdb_host   = '';
+$clientdb_user   = '';
+$clientdb_password  = '';
 
 //** Test mysql root connection
 $finished = false;
 do {
-	if(@mysql_connect($conf["mysql"]["host"],$conf["mysql"]["admin_user"],$conf["mysql"]["admin_password"])) {
+	if(@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
 		$finished = true;
 	} else {
 		swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
@@ -183,7 +183,7 @@ do {
 unset($finished);
 
 /*
- *  Prepare the dump of the database 
+ *  Prepare the dump of the database
  */
 prepareDBDump();
 
@@ -192,34 +192,34 @@ $inst->db = new db();
 
 //* initialize the master DB, if we have a multiserver setup
 if($conf['mysql']['master_slave_setup'] == 'y') {
-		//** Get MySQL root credentials
-		$finished = false;
-		do {
-			$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']);
-			$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']);
-			$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']);
-    		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
-	
-			//* Initialize the MySQL server connection
-			if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
-				$conf['mysql']['master_host'] = $tmp_mysql_server_host;
-				$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
-				$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
-				$conf['mysql']['master_database'] = $tmp_mysql_server_database;
-				$finished = true;
-			} else {
-				swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
-			}
-		} while ($finished == false);
-		unset($finished);
-		
-		// initialize the connection to the master database
-		$inst->dbmaster = new db();
-		if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
-		$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
-		$inst->dbmaster->dbName = $conf['mysql']["master_database"];
-		$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
-		$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
+	//** Get MySQL root credentials
+	$finished = false;
+	do {
+		$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host']);
+		$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user']);
+		$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password']);
+		$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database']);
+
+		//* Initialize the MySQL server connection
+		if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
+			$conf['mysql']['master_host'] = $tmp_mysql_server_host;
+			$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
+			$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password;
+			$conf['mysql']['master_database'] = $tmp_mysql_server_database;
+			$finished = true;
+		} else {
+			swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());
+		}
+	} while ($finished == false);
+	unset($finished);
+
+	// initialize the connection to the master database
+	$inst->dbmaster = new db();
+	if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
+	$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
+	$inst->dbmaster->dbName = $conf['mysql']["master_database"];
+	$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
+	$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
 } else {
 	$inst->dbmaster = $inst->db;
 }
@@ -240,28 +240,28 @@ updateDbAndIni();
  * If this is done at server side, all clients are updated.
  */
 //if($conf_old['dbmaster_user'] != '' or $conf_old['dbmaster_host'] != '') {
-	//** Update master database rights
-	$reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes','no'),'no');
+//** Update master database rights
+$reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes', 'no'), 'no');
 
-	if($reconfigure_master_database_rights_answer == 'yes') {
-		$inst->grant_master_database_rights();
-	}
+if($reconfigure_master_database_rights_answer == 'yes') {
+	$inst->grant_master_database_rights();
+}
 //}
 
 //** Shall the services be reconfigured during update
-$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes','no'),'yes');
+$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no'), 'yes');
 
 if($reconfigure_services_answer == 'yes') {
-	
+
 	if($conf['services']['mail']) {
 		//** Configure postfix
 		swriteln('Configuring Postfix');
 		$inst->configure_postfix('dont-create-certs');
-		
+
 		//** Configure mailman
 		swriteln('Configuring Mailman');
 		$inst->configure_mailman('update');
-	
+
 		//* Configure Jailkit
 		swriteln('Configuring Jailkit');
 		$inst->configure_jailkit();
@@ -274,11 +274,11 @@ if($reconfigure_services_answer == 'yes') {
 			//** Configure saslauthd
 			swriteln('Configuring SASL');
 			$inst->configure_saslauthd();
-	
+
 			//** Configure PAM
 			swriteln('Configuring PAM');
 			$inst->configure_pam();
-		
+
 			//* Configure courier
 			swriteln('Configuring Courier');
 			$inst->configure_courier();
@@ -296,13 +296,13 @@ if($reconfigure_services_answer == 'yes') {
 		swriteln('Configuring Getmail');
 		$inst->configure_getmail();
 	}
-	
+
 	if($conf['services']['web'] && $conf['pureftpd']['installed'] == true) {
 		//** Configure Pureftpd
 		swriteln('Configuring Pureftpd');
 		$inst->configure_pureftpd();
 	}
-	
+
 	if($conf['services']['dns']) {
 		//* Configure DNS
 		if($conf['powerdns']['installed'] == true) {
@@ -316,13 +316,13 @@ if($reconfigure_services_answer == 'yes') {
 			$inst->configure_mydns();
 		}
 	}
-	
+
 	if($conf['services']['web']) {
 		if($conf['webserver']['server_type'] == 'apache'){
 			//** Configure Apache
 			swriteln('Configuring Apache');
 			$inst->configure_apache();
-        
+
 			//** Configure vlogger
 			swriteln('Configuring vlogger');
 			$inst->configure_vlogger();
@@ -331,7 +331,7 @@ if($reconfigure_services_answer == 'yes') {
 			swriteln('Configuring nginx');
 			$inst->configure_nginx();
 		}
-		
+
 		//** Configure apps vhost
 		swriteln('Configuring Apps vhost');
 		$inst->configure_apps_vhost();
@@ -342,7 +342,7 @@ if($reconfigure_services_answer == 'yes') {
 	swriteln('Configuring Database');
 	$inst->configure_dbserver();
 
-	
+
 	if($conf['services']['firewall']) {
 		if($conf['ufw']['installed'] == true) {
 			//* Configure Ubuntu Firewall
@@ -355,7 +355,7 @@ if($reconfigure_services_answer == 'yes') {
 			$inst->configure_bastille_firewall();
 		}
 	}
-	
+
 	/*
 	if($conf['squid']['installed'] == true) {
 		swriteln('Configuring Squid');
@@ -384,10 +384,10 @@ if ($conf['services']['web'] && $inst->install_ispconfig_interface) {
 	} else {
 		$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number);
 	}
-	
-	
+
+
 	// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n';
-	if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate',array('yes','no'),'no')) == 'yes') {
+	if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate', array('yes', 'no'), 'no')) == 'yes') {
 		$inst->make_ispconfig_ssl_cert();
 	}
 }
@@ -395,7 +395,7 @@ if ($conf['services']['web'] && $inst->install_ispconfig_interface) {
 $inst->install_ispconfig();
 
 //** Configure Crontab
-$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes','no'),'yes');
+$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes', 'no'), 'yes');
 if($update_crontab_answer == 'yes') {
 	swriteln('Updating Crontab');
 	$inst->install_crontab();
@@ -434,14 +434,14 @@ if($reconfigure_services_answer == 'yes') {
 		if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null');
 		if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null');
 	}
-	
+
 	if($conf['services']['proxy']) {
-		// if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))					system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
+		// if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script']))     system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null');
 		if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null');
 	}
-	
+
 	if($conf['services']['firewall']) {
-		if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script']))					system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
+		if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script']))     system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null');
 	}
 }
 
diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index e0b237b3b635b29d4f3d4c8a4bb5701216c86081..e1929d3aa71aea4d415bf6615b5c3a8d679dfbbd 100755
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -64,15 +64,15 @@ class app {
 
 		//* Start the session
 		if($this->_conf['start_session'] == true) {
-			
+
 			$this->uses('session');
-			session_set_save_handler(	array($this->session, 'open'),
-										array($this->session, 'close'),
-										array($this->session, 'read'),
-										array($this->session, 'write'),
-										array($this->session, 'destroy'),
-										array($this->session, 'gc'));
-			
+			session_set_save_handler( array($this->session, 'open'),
+				array($this->session, 'close'),
+				array($this->session, 'read'),
+				array($this->session, 'write'),
+				array($this->session, 'destroy'),
+				array($this->session, 'gc'));
+
 			session_start();
 
 			//* Initialize session variables
@@ -81,10 +81,10 @@ class app {
 			if(empty($_SESSION['s']['language'])) $_SESSION['s']['language'] = $conf['language'];
 		}
 
-        $this->uses('functions'); // we need this before all others!
+		$this->uses('functions'); // we need this before all others!
 		$this->uses('auth,plugin');
 	}
-	
+
 	public function __destruct() {
 		session_write_close();
 	}
@@ -96,7 +96,7 @@ class app {
 				$classname = trim($classname);
 				//* Class is not loaded so load it
 				if(!array_key_exists($classname, $this->_loaded_classes)) {
-					include_once(ISPC_CLASS_PATH."/$classname.inc.php");
+					include_once ISPC_CLASS_PATH."/$classname.inc.php";
 					$this->$classname = new $classname();
 					$this->_loaded_classes[$classname] = true;
 				}
@@ -109,12 +109,14 @@ class app {
 		if(is_array($fl)) {
 			foreach($fl as $file) {
 				$file = trim($file);
-				include_once(ISPC_CLASS_PATH."/$file.inc.php");
+				include_once ISPC_CLASS_PATH."/$file.inc.php";
 			}
 		}
 	}
 
 	/** Priority values are: 0 = DEBUG, 1 = WARNING,  2 = ERROR */
+
+
 	public function log($msg, $priority = 0) {
 		global $conf;
 		if($priority >= $this->_conf['log_priority']) {
@@ -196,12 +198,12 @@ class app {
 	//** Helper function to load the language files.
 	public function load_language_file($filename) {
 		$filename = ISPC_ROOT_PATH.'/'.$filename;
-		if(substr($filename,-4) != '.lng') $this->error('Language file has wrong extension.');
+		if(substr($filename, -4) != '.lng') $this->error('Language file has wrong extension.');
 		if(file_exists($filename)) {
-			@include($filename);
+			@include $filename;
 			if(is_array($wb)) {
 				if(is_array($this->_wb)) {
-					$this->_wb = array_merge($this->_wb,$wb);
+					$this->_wb = array_merge($this->_wb, $wb);
 				} else {
 					$this->_wb = $wb;
 				}
@@ -213,12 +215,12 @@ class app {
 		$this->tpl->setVar('app_title', $this->_conf['app_title']);
 		if(isset($_SESSION['s']['user'])) {
 			$this->tpl->setVar('app_version', $this->_conf['app_version']);
-            // get pending datalog changes
-            $datalog = $this->db->datalogStatus();
-            $this->tpl->setVar('datalog_changes_txt', $this->lng('datalog_changes_txt'));
-            $this->tpl->setVar('datalog_changes_end_txt', $this->lng('datalog_changes_end_txt'));
-            $this->tpl->setVar('datalog_changes_count', $datalog['count']);
-            $this->tpl->setLoop('datalog_changes', $datalog['entries']);
+			// get pending datalog changes
+			$datalog = $this->db->datalogStatus();
+			$this->tpl->setVar('datalog_changes_txt', $this->lng('datalog_changes_txt'));
+			$this->tpl->setVar('datalog_changes_end_txt', $this->lng('datalog_changes_end_txt'));
+			$this->tpl->setVar('datalog_changes_count', $datalog['count']);
+			$this->tpl->setLoop('datalog_changes', $datalog['entries']);
 		} else {
 			$this->tpl->setVar('app_version', '');
 		}
@@ -253,13 +255,13 @@ class app {
 			$this->tpl->setVar('cpuser', $_SESSION['s']['user']['username']);
 			$this->tpl->setVar('logout_txt', $this->lng('logout_txt'));
 			/* Show search field only for normal users, not mail users */
-			if(stristr($_SESSION['s']['user']['username'],'@')){
+			if(stristr($_SESSION['s']['user']['username'], '@')){
 				$this->tpl->setVar('usertype', 'mailuser');
 			} else {
 				$this->tpl->setVar('usertype', 'normaluser');
 			}
 		}
-		
+
 		/* Global Search */
 		$this->tpl->setVar('globalsearch_resultslimit_of_txt', $this->lng('globalsearch_resultslimit_of_txt'));
 		$this->tpl->setVar('globalsearch_resultslimit_results_txt', $this->lng('globalsearch_resultslimit_results_txt'));
diff --git a/interface/lib/classes/aps_base.inc.php b/interface/lib/classes/aps_base.inc.php
index 4c1512ba2a018e45f9aee6ef758be1c65e767b70..c4aaf52fd8074046b3ba24929b4e02f71e48bf83 100644
--- a/interface/lib/classes/aps_base.inc.php
+++ b/interface/lib/classes/aps_base.inc.php
@@ -43,61 +43,69 @@ define('PACKAGE_ERROR_NOMETA', 4);
 
 class ApsBase
 {
-    protected $log_prefix = '';
-    protected $fetch_url = '';
-    protected $aps_version = '';
-    protected $packages_dir = '';
-    protected $temp_pkg_dir = '';
-    protected $interface_pkg_dir = '';
-    protected $interface_mode = false; // server mode by default
-
-    /**
-     * Constructor
-     *
-     * @param $app the application instance (db handle + log method)
-     * @param $interface_mode act in interface (true) or server mode (false)
-     * @param $log_prefix a prefix to set before all log entries
-     */
-    public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
-    {
-        $this->log_prefix = $log_prefix;
-        $this->interface_mode = $interface_mode;
-        $this->fetch_url = 'apscatalog.com';
-        $this->aps_version = '1';
-        $this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
-        $this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
-    }
-    
-    /**
-     * Converts a given value to it's native representation in 1024 units
-     * 
-     * @param $value the size to convert
-     * @return integer and string 
-     */
-    public function convertSize($value)
-    {
-        $unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
-        return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
-    }
-    
-    /**
-     * Determine a specific xpath from a given SimpleXMLElement handle. If the
-     * element is found, it's string representation is returned. If not,
-     * the return value will stay empty
-     *
-     * @param $xml_handle the SimpleXMLElement handle
-     * @param $query the XPath query
-     * @param $array define whether to return an array or a string
-     * @return $ret the return string
-     */
-    protected function getXPathValue($xml_handle, $query, $array = false)
-    {
-        $ret = '';
-        
-        $xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
-        if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
-        
-        return $ret;
-    }
+	protected $log_prefix = '';
+	protected $fetch_url = '';
+	protected $aps_version = '';
+	protected $packages_dir = '';
+	protected $temp_pkg_dir = '';
+	protected $interface_pkg_dir = '';
+	protected $interface_mode = false; // server mode by default
+
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 * @param $log_prefix a prefix to set before all log entries
+	 */
+
+
+	public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
+	{
+		$this->log_prefix = $log_prefix;
+		$this->interface_mode = $interface_mode;
+		$this->fetch_url = 'apscatalog.com';
+		$this->aps_version = '1';
+		$this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
+		$this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
+	}
+
+
+
+	/**
+	 * Converts a given value to it's native representation in 1024 units
+	 *
+	 * @param $value the size to convert
+	 * @return integer and string
+	 */
+	public function convertSize($value)
+	{
+		$unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
+		return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
+	}
+
+
+
+	/**
+	 * Determine a specific xpath from a given SimpleXMLElement handle. If the
+	 * element is found, it's string representation is returned. If not,
+	 * the return value will stay empty
+	 *
+	 * @param $xml_handle the SimpleXMLElement handle
+	 * @param $query the XPath query
+	 * @param $array define whether to return an array or a string
+	 * @return $ret the return string
+	 */
+	protected function getXPathValue($xml_handle, $query, $array = false)
+	{
+		$ret = '';
+
+		$xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
+		if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
+
+		return $ret;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/aps_crawler.inc.php b/interface/lib/classes/aps_crawler.inc.php
index 2c6906efda50d4716a66c664dc3ab04ef78cc4d4..8260f340973be59fa6b68fc9e24b9aff601593f8 100644
--- a/interface/lib/classes/aps_crawler.inc.php
+++ b/interface/lib/classes/aps_crawler.inc.php
@@ -27,264 +27,277 @@ 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('aps_base.inc.php');
+require_once 'aps_base.inc.php';
 
 @set_time_limit(0);
 @ignore_user_abort(1);
 
 class ApsCrawler extends ApsBase
 {
-   
-   //public $app_download_url_list = array();
-   
-   /**
-    * Constructor
-    *
-    * @param $app the application instance (db handle + log method)
-    * @param $interface_mode act in interface (true) or server mode (false)
-    */
-    public function __construct($app, $interface_mode = false)
-    {
-        parent::__construct($app, 'APS crawler: ', $interface_mode);
-    }
-    
-    /**
-     * Before the cron is executed, make sure all necessary options are set
-     * and all functions (i.e. cURL) are available
-     */
-    private function checkRequirements()
-    {
-        global $app;
-        
-        try
-        {
-            // Check if allow_url_fopen is enabled
-            if(!@ini_get('allow_url_fopen')) throw new Exception('allow_url_fopen is not enabled');
-            // Check if the cURL module is available
-            if(!function_exists('curl_version')) throw new Exception('cURL is not available');
-            
-            // Check if used folders are writable
-            if($this->interface_mode)
-            {
-                if(!is_writable($this->interface_pkg_dir)) 
-                    throw new Exception('the folder '.basename($this->interface_pkg_dir).' is not writable');  
-            }   
-            else 
-            {
-                if(!is_writable($this->packages_dir)) 
-                    throw new Exception('the folder '.basename($this->packages_dir).' is not writable');
-            }
-            
-            return true;
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.'Aborting execution because '.$e->getMessage(), LOGLEVEL_ERROR);
-            return false;
-        }
-    }
-    
-    /**
-     * Remove a directory recursively
-     * In case of error be silent
-     * 
-     * @param $dir the directory to remove
-     */
-    private function removeDirectory($dir)
-    {
-        if(is_dir($dir))
-        {
-            $files = scandir($dir);
-            foreach($files as $file)
-            {
-                if($file != '.' && $file != '..')
-                    if(filetype($dir.'/'.$file) == 'dir') $this->removeDirectory($dir.'/'.$file); 
-                    else @unlink($dir.'/'.$file);
-            }
-            reset($files);
-            @rmdir($dir);
-        }
-    }
-
-    
-    /**
-     * Fetch HTML data from one or more given URLs
-     * If a string is given, a string is returned, if an array of URLs should
-     * be fetched, the responses of the parallel queries are returned as array
-     *
-     * @param $input the string or array to fetch
-     * @return $ret a query response string or array
-     */
-    private function fetchPage($input)
-    {
-        $ret = array();
-        $url = array();
-        $conn = array();
-
-        // Make sure we are working with an array, further on
-        if(!is_array($input)) $url[] = $input;
-        else $url = $input;
-        
-        // Build the single cURL handles and add them to a multi handle
-        $mh = curl_multi_init();
-        for($i = 0; $i < count($url); $i++)
-        {
-            $conn[$i] = curl_init('http://'.$this->fetch_url.$url[$i]);
-            curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, true);
-            curl_multi_add_handle($mh, $conn[$i]);
-        }
-        
-        $active = 0;
-        do curl_multi_exec($mh, $active);
-        while($active > 0);
-
-        // Get the response(s)
-        for($i = 0; $i < count($url); $i++)
-        {
-            $ret[$i] = curl_multi_getcontent($conn[$i]);
-            curl_multi_remove_handle($mh, $conn[$i]);
-            curl_close($conn[$i]);
-        }
-        curl_multi_close($mh);
-        
-        if(count($url) == 1) $ret = $ret[0];
-        
-        return $ret;
-    }
-    
-    /**
-     * Fetch binary data from a given array
-     * The data is retrieved in binary mode and 
-     * then directly written to an output file
-     *
-     * @param $input a specially structed array
-     * @see $this->startUpdate()
-     */
-    private function fetchFiles($input)
-    {
-        $fh = array();
-        $url = array();
-        $conn = array();
-
-        // Build the single cURL handles and add them to a multi handle
-        $mh = curl_multi_init();
-        
-        // Process each app 
-        for($i = 0; $i < count($input); $i++)
-        {
-            $conn[$i] = curl_init($input[$i]['url']);
-            $fh[$i] = fopen($input[$i]['localtarget'], 'wb'); 
-            
-            curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
-            curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
-            curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
-            curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
-            curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1); 
-            
-            curl_multi_add_handle($mh, $conn[$i]);
-        }
-        
-        $active = 0;
-        do curl_multi_exec($mh, $active);
-        while($active > 0);
-
-        // Close the handles
-        for($i = 0; $i < count($input); $i++)
-        {
-            fclose($fh[$i]);
-            curl_multi_remove_handle($mh, $conn[$i]);
-            curl_close($conn[$i]);
-        }
-        curl_multi_close($mh);
-    }
-    
-    /**
-     * A method to build query URLs out of a list of vendors
-     *
-    */
-    private function formatVendorCallback($array_item)
-    {
-        $array_item = str_replace(' ', '%20', $array_item);
-        $array_item = str_replace('http://', '', $array_item);
-        $array_item = '/'.$this->aps_version.'.atom?vendor='.$array_item.'&pageSize=100';
-		return($array_item);
-    }
-    
-    /**
-     * The main method which performs the actual crawling
-     */    
-    public function startCrawler() 
-    {
-        global $app;
-
-        try
-        {
-            // Make sure the requirements are given so that this script can execute
-            $req_ret = $this->checkRequirements();
-            if(!$req_ret) return false;
-            
-            // Execute the open task and first fetch all vendors (APS catalog API 1.1, p. 12)
-            $app->log($this->log_prefix.'Fetching data from '.$this->fetch_url);
-
-            $vendor_page = $this->fetchPage('/all-app/'); //$vendor_page = $this->fetchPage('/'.$this->aps_version.'/');
-            preg_match_all("/\<a href=\"(.+)\/\" class=\"vendor\"/i", $vendor_page, $matches);
-            $vendors = array_map('urldecode', $matches[1]);
-            if(!$vendors) throw new Exception('Unable to fetch vendors. Aborting');
-
-            // Format all vendors for further processing (i.e. typo3.org -> /1.atom?vendor=typo3.org&pageSize=100
-            //array_walk($vendors, array($this, 'formatVendorCallback'));
+
+	//public $app_download_url_list = array();
+
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 */
+
+
+	public function __construct($app, $interface_mode = false)
+	{
+		parent::__construct($app, 'APS crawler: ', $interface_mode);
+	}
+
+
+
+	/**
+	 * Before the cron is executed, make sure all necessary options are set
+	 * and all functions (i.e. cURL) are available
+	 */
+	private function checkRequirements()
+	{
+		global $app;
+
+		try
+		{
+			// Check if allow_url_fopen is enabled
+			if(!@ini_get('allow_url_fopen')) throw new Exception('allow_url_fopen is not enabled');
+			// Check if the cURL module is available
+			if(!function_exists('curl_version')) throw new Exception('cURL is not available');
+
+			// Check if used folders are writable
+			if($this->interface_mode)
+			{
+				if(!is_writable($this->interface_pkg_dir))
+					throw new Exception('the folder '.basename($this->interface_pkg_dir).' is not writable');
+			}
+			else
+			{
+				if(!is_writable($this->packages_dir))
+					throw new Exception('the folder '.basename($this->packages_dir).' is not writable');
+			}
+
+			return true;
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.'Aborting execution because '.$e->getMessage(), LOGLEVEL_ERROR);
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Remove a directory recursively
+	 * In case of error be silent
+	 *
+	 * @param $dir the directory to remove
+	 */
+	private function removeDirectory($dir)
+	{
+		if(is_dir($dir))
+		{
+			$files = scandir($dir);
+			foreach($files as $file)
+			{
+				if($file != '.' && $file != '..')
+					if(filetype($dir.'/'.$file) == 'dir') $this->removeDirectory($dir.'/'.$file);
+					else @unlink($dir.'/'.$file);
+			}
+			reset($files);
+			@rmdir($dir);
+		}
+	}
+
+
+	/**
+	 * Fetch HTML data from one or more given URLs
+	 * If a string is given, a string is returned, if an array of URLs should
+	 * be fetched, the responses of the parallel queries are returned as array
+	 *
+	 * @param $input the string or array to fetch
+	 * @return $ret a query response string or array
+	 */
+	private function fetchPage($input)
+	{
+		$ret = array();
+		$url = array();
+		$conn = array();
+
+		// Make sure we are working with an array, further on
+		if(!is_array($input)) $url[] = $input;
+		else $url = $input;
+
+		// Build the single cURL handles and add them to a multi handle
+		$mh = curl_multi_init();
+		for($i = 0; $i < count($url); $i++)
+		{
+			$conn[$i] = curl_init('http://'.$this->fetch_url.$url[$i]);
+			curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, true);
+			curl_multi_add_handle($mh, $conn[$i]);
+		}
+
+		$active = 0;
+		do curl_multi_exec($mh, $active);
+		while($active > 0);
+
+		// Get the response(s)
+		for($i = 0; $i < count($url); $i++)
+		{
+			$ret[$i] = curl_multi_getcontent($conn[$i]);
+			curl_multi_remove_handle($mh, $conn[$i]);
+			curl_close($conn[$i]);
+		}
+		curl_multi_close($mh);
+
+		if(count($url) == 1) $ret = $ret[0];
+
+		return $ret;
+	}
+
+
+
+	/**
+	 * Fetch binary data from a given array
+	 * The data is retrieved in binary mode and
+	 * then directly written to an output file
+	 *
+	 * @param $input a specially structed array
+	 * @see $this->startUpdate()
+	 */
+	private function fetchFiles($input)
+	{
+		$fh = array();
+		$url = array();
+		$conn = array();
+
+		// Build the single cURL handles and add them to a multi handle
+		$mh = curl_multi_init();
+
+		// Process each app
+		for($i = 0; $i < count($input); $i++)
+		{
+			$conn[$i] = curl_init($input[$i]['url']);
+			$fh[$i] = fopen($input[$i]['localtarget'], 'wb');
+
+			curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
+			curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
+			curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
+			curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
+			curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1);
+
+			curl_multi_add_handle($mh, $conn[$i]);
+		}
+
+		$active = 0;
+		do curl_multi_exec($mh, $active);
+		while($active > 0);
+
+		// Close the handles
+		for($i = 0; $i < count($input); $i++)
+		{
+			fclose($fh[$i]);
+			curl_multi_remove_handle($mh, $conn[$i]);
+			curl_close($conn[$i]);
+		}
+		curl_multi_close($mh);
+	}
+
+
+
+	/**
+	 * A method to build query URLs out of a list of vendors
+	 *
+	 */
+	private function formatVendorCallback($array_item)
+	{
+		$array_item = str_replace(' ', '%20', $array_item);
+		$array_item = str_replace('http://', '', $array_item);
+		$array_item = '/'.$this->aps_version.'.atom?vendor='.$array_item.'&pageSize=100';
+		return $array_item;
+	}
+
+
+
+	/**
+	 * The main method which performs the actual crawling
+	 */
+	public function startCrawler()
+	{
+		global $app;
+
+		try
+		{
+			// Make sure the requirements are given so that this script can execute
+			$req_ret = $this->checkRequirements();
+			if(!$req_ret) return false;
+
+			// Execute the open task and first fetch all vendors (APS catalog API 1.1, p. 12)
+			$app->log($this->log_prefix.'Fetching data from '.$this->fetch_url);
+
+			$vendor_page = $this->fetchPage('/all-app/'); //$vendor_page = $this->fetchPage('/'.$this->aps_version.'/');
+			preg_match_all("/\<a href=\"(.+)\/\" class=\"vendor\"/i", $vendor_page, $matches);
+			$vendors = array_map('urldecode', $matches[1]);
+			if(!$vendors) throw new Exception('Unable to fetch vendors. Aborting');
+
+			// Format all vendors for further processing (i.e. typo3.org -> /1.atom?vendor=typo3.org&pageSize=100
+			//array_walk($vendors, array($this, 'formatVendorCallback'));
 			if(is_array($vendors)) {
 				foreach($vendors as $key => $array_item) {
 					$vendors[$key] = $this->formatVendorCallback($array_item);
 				}
 			}
-            
-            // Process all vendors in chunks of 50 entries
-            $vendor_chunks = array_chunk($vendors, 50);
-            //var_dump($vendor_chunks); 
-
-            // Get all known apps from the database and the highest known version
-            // Note: A dirty hack is used for numerical sorting of the VARCHAR field Version: +0 -> cast
-            // A longer but typesafe way would be: ORDER BY CAST(REPLACE(Version, '.', '') AS UNSIGNED) DESC
-            $existing_apps = $app->db->queryAllRecords("SELECT * FROM (
-                SELECT name AS Name, CONCAT(version, '-', CAST(`release` AS CHAR)) AS CurrentVersion 
+
+			// Process all vendors in chunks of 50 entries
+			$vendor_chunks = array_chunk($vendors, 50);
+			//var_dump($vendor_chunks);
+
+			// Get all known apps from the database and the highest known version
+			// Note: A dirty hack is used for numerical sorting of the VARCHAR field Version: +0 -> cast
+			// A longer but typesafe way would be: ORDER BY CAST(REPLACE(Version, '.', '') AS UNSIGNED) DESC
+			$existing_apps = $app->db->queryAllRecords("SELECT * FROM (
+                SELECT name AS Name, CONCAT(version, '-', CAST(`release` AS CHAR)) AS CurrentVersion
                 FROM aps_packages ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC
                 ) as Versions GROUP BY name");
-            //var_dump($existing_apps); 
-            
-            // Used for statistics later
-            $apps_in_repo = 0; 
-            $apps_updated = 0;
-            $apps_downloaded = 0;
-            
-            $apps_to_dl = array();
-            
-            for($i = 0; $i < count($vendor_chunks); $i++)
-            {
-                // Fetch all apps for the current chunk of vendors
-                $apps = $this->fetchPage($vendor_chunks[$i]);
-                
-                for($j = 0; $j < count($apps); $j++)
-                {
-                    // Before parsing, make sure it's worth the work by checking if at least one app exists
-                    $apps_count = substr_count($apps[$j], '<opensearch:totalResults>0</opensearch:totalResults>');
-                    if($apps_count == 0) // obviously this vendor provides one or more apps
-                    {
-                        // Rename namespaces and register them 
-                        $xml = str_replace("xmlns=", "ns=", $apps[$j]);
-                        $sxe = new SimpleXMLElement($xml);
-                        $namespaces = $sxe->getDocNamespaces(true);
-                        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
-                        
-                        // Fetching values of interest
-                        $app_name = parent::getXPathValue($sxe, 'entry[position()=1]/a:name');
-                        $app_version = parent::getXPathValue($sxe, 'entry[position()=1]/a:version');
-                        $app_release = parent::getXPathValue($sxe, 'entry[position()=1]/a:release');
-                        
-                        // Find out a (possibly) existing package version
-                        $ex_ver = '';
+			//var_dump($existing_apps);
+
+			// Used for statistics later
+			$apps_in_repo = 0;
+			$apps_updated = 0;
+			$apps_downloaded = 0;
+
+			$apps_to_dl = array();
+
+			for($i = 0; $i < count($vendor_chunks); $i++)
+			{
+				// Fetch all apps for the current chunk of vendors
+				$apps = $this->fetchPage($vendor_chunks[$i]);
+
+				for($j = 0; $j < count($apps); $j++)
+				{
+					// Before parsing, make sure it's worth the work by checking if at least one app exists
+					$apps_count = substr_count($apps[$j], '<opensearch:totalResults>0</opensearch:totalResults>');
+					if($apps_count == 0) // obviously this vendor provides one or more apps
+						{
+						// Rename namespaces and register them
+						$xml = str_replace("xmlns=", "ns=", $apps[$j]);
+						$sxe = new SimpleXMLElement($xml);
+						$namespaces = $sxe->getDocNamespaces(true);
+						foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+						// Fetching values of interest
+						$app_name = parent::getXPathValue($sxe, 'entry[position()=1]/a:name');
+						$app_version = parent::getXPathValue($sxe, 'entry[position()=1]/a:version');
+						$app_release = parent::getXPathValue($sxe, 'entry[position()=1]/a:release');
+
+						// Find out a (possibly) existing package version
+						$ex_ver = '';
 						/*
-                        array_walk($existing_apps, 
+                        array_walk($existing_apps,
                             create_function('$v, $k, $ex_ver', 'if($v["Name"] == "'.$app_name.'") $ex_ver = $v["CurrentVersion"];'), &$ex_ver);
                         */
 						if(is_array($existing_apps)) {
@@ -292,286 +305,292 @@ class ApsCrawler extends ApsBase
 								if($v["Name"] == $app_name) $ex_ver = $v["CurrentVersion"];
 							}
 						}
-						
-                        $new_ver = $app_version.'-'.$app_release;
-                        $local_intf_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$new_ver.'.app.zip/';
-
-                        // Proceed if a newer or at least equal version has been found with server mode or 
-                        // interface mode is activated and there are no valid APP-META.xml and PKG_URL existing yet
-                        if((!$this->interface_mode && version_compare($new_ver, $ex_ver) >= 0) || ($this->interface_mode && (!file_exists($local_intf_folder.'APP-META.xml') || filesize($local_intf_folder.'APP-META.xml') == 0 || !file_exists($local_intf_folder.'PKG_URL') || filesize($local_intf_folder.'PKG_URL') == 0))){
-                            // Check if we already have an old version of this app
-                            if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1) $apps_updated++; 
-
-                            $app_dl = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@href");
-                            $app_filesize = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@length");
-                            $app_metafile = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='meta']/@href");
-							
+
+						$new_ver = $app_version.'-'.$app_release;
+						$local_intf_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$new_ver.'.app.zip/';
+
+						// Proceed if a newer or at least equal version has been found with server mode or
+						// interface mode is activated and there are no valid APP-META.xml and PKG_URL existing yet
+						if((!$this->interface_mode && version_compare($new_ver, $ex_ver) >= 0) || ($this->interface_mode && (!file_exists($local_intf_folder.'APP-META.xml') || filesize($local_intf_folder.'APP-META.xml') == 0 || !file_exists($local_intf_folder.'PKG_URL') || filesize($local_intf_folder.'PKG_URL') == 0))){
+							// Check if we already have an old version of this app
+							if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1) $apps_updated++;
+
+							$app_dl = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@href");
+							$app_filesize = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@length");
+							$app_metafile = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='meta']/@href");
+
 							//$this->app_download_url_list[$app_name.'-'.$new_ver.'.app.zip'] = $app_dl;
-                            // Skip ASP.net packages because they can't be used at all
-                            $asp_handler = parent::getXPathValue($sxe, '//aspnet:handler');
-                            $asp_permissions = parent::getXPathValue($sxe, '//aspnet:permissions');
-                            $asp_version = parent::getXPathValue($sxe, '//aspnet:version');
-                            if(!empty($asp_handler) || !empty($asp_permissions) || !empty($asp_version)) continue;
-
-                            // Interface mode (download only parts)
-                            if($this->interface_mode)
-                            {
-                                // Delete an obviously out-dated version from the system and DB
-                                if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
-                                {
-                                    $old_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
-                                    if(file_exists($old_folder)) $this->removeDirectory($old_folder);
-                                    
+							// Skip ASP.net packages because they can't be used at all
+							$asp_handler = parent::getXPathValue($sxe, '//aspnet:handler');
+							$asp_permissions = parent::getXPathValue($sxe, '//aspnet:permissions');
+							$asp_version = parent::getXPathValue($sxe, '//aspnet:version');
+							if(!empty($asp_handler) || !empty($asp_permissions) || !empty($asp_version)) continue;
+
+							// Interface mode (download only parts)
+							if($this->interface_mode)
+							{
+								// Delete an obviously out-dated version from the system and DB
+								if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
+								{
+									$old_folder = $this->interface_pkg_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
+									if(file_exists($old_folder)) $this->removeDirectory($old_folder);
+
 									/*
                                     $app->db->query("UPDATE aps_packages SET package_status = '".PACKAGE_OUTDATED."' WHERE name = '".
                                         $app->db->quote($app_name)."' AND CONCAT(version, '-', CAST(`release` AS CHAR)) = '".
                                         $app->db->quote($ex_ver)."';");
 									*/
 									$tmp = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE name = '".
-                                        $app->db->quote($app_name)."' AND CONCAT(version, '-', CAST(`release` AS CHAR)) = '".
-                                        $app->db->quote($ex_ver)."';");
+										$app->db->quote($app_name)."' AND CONCAT(version, '-', CAST(`release` AS CHAR)) = '".
+										$app->db->quote($ex_ver)."';");
 									$app->db->datalogUpdate('aps_packages', "package_status = ".PACKAGE_OUTDATED, 'id', $tmp['id']);
 									unset($tmp);
-                                }
-                                
-                                // Create the local folder if not yet existing
-                                if(!file_exists($local_intf_folder)) @mkdir($local_intf_folder, 0777, true);
-								
+								}
+
+								// Create the local folder if not yet existing
+								if(!file_exists($local_intf_folder)) @mkdir($local_intf_folder, 0777, true);
+
 								// Save the package URL in an extra file because it's not part of the APP-META.xml file
 								@file_put_contents($local_intf_folder.'PKG_URL', $app_dl);
-                                
-                                // Download the meta file
-                                $local_metafile = $local_intf_folder.'APP-META.xml';
-                                if(!file_exists($local_metafile) || filesize($local_metafile) == 0) 
-                                {
-                                    $apps_to_dl[] = array('name' => 'APP-META.xml', 
-                                                          'url' => $app_metafile, 
-                                                          'filesize' => 0, 
-                                                          'localtarget' => $local_metafile);
-                                    $apps_downloaded++;
-                                }
-                                
-                                // Download package license
-                                $license = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='eula']/@href");
-                                if($license != '')
-                                {
-                                    $local_license = $local_intf_folder.'LICENSE';
-                                    if(!file_exists($local_license) || filesize($local_license) == 0)
-                                    {
-                                        $apps_to_dl[] = array('name' => basename($license), 
-                                                              'url' => $license, 
-                                                              'filesize' => 0, 
-                                                              'localtarget' => $local_license);
-                                    }
-                                }
-                                
-                                // Download package icon
-                                $icon = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='icon']/@href");
-                                if($icon != '')
-                                {
-                                    $local_icon = $local_intf_folder.basename($icon);
-                                    if(!file_exists($local_icon) || filesize($local_icon) == 0)
-                                    {
-                                        $apps_to_dl[] = array('name' => basename($icon), 
-                                                              'url' => $icon, 
-                                                              'filesize' => 0, 
-                                                              'localtarget' => $local_icon);
-                                    }
-                                }
-                                
-                                // Download available screenshots
-                                $screenshots = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='screenshot']", true);
-                                if(!empty($screenshots))
-                                {
-                                    foreach($screenshots as $screen)
-                                    {
-                                        $local_screen = $local_intf_folder.basename($screen['href']);
-                                        if(!file_exists($local_screen) || filesize($local_screen) == 0)
-                                        {
-                                            $apps_to_dl[] = array('name' => basename($screen['href']), 
-                                                                  'url' => $screen['href'], 
-                                                                  'filesize' => 0, 
-                                                                  'localtarget' => $local_screen);
-                                        }
-                                    }
-                                }
-                            }
-                            else // Server mode (download whole ZIP archive)
-                            {
-                                // Delete an obviously out-dated version from the system
-                                if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
-                                {
-                                    $old_file = $this->packages_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
-                                    if(file_exists($old_file)) $this->removeDirectory($old_file);
-                                }
-                                
-                                // Attention: $new_ver can also be == $ex_ver (according to version_compare >= 0)
-                                $local_zip = $this->packages_dir.'/'.$app_name.'-'.$new_ver.'.app.zip';
-                            
-                                // Before re-downloading a file, make sure it's not yet existing on HDD (due to DB inconsistency)
-                                if((file_exists($local_zip) && (filesize($local_zip) == $app_filesize)) === false)
-                                {
-                                    $apps_to_dl[] = array('name' => $app_name, 
-                                                          'url' => $app_dl, 
-                                                          'filesize' => $app_filesize, 
-                                                          'localtarget' => $local_zip);
-                                    $apps_downloaded++;
-                                }
-                            }
-                        }
-                        
-                        unset($sxe);
-                        $apps_in_repo++;
-                    }
-                }
-                //var_dump($apps);
-                
-                // For memory reasons, unset the current vendor and his apps
-                unset($apps);
-            }
-            
-            // Shuffle the download array (in order to compensate unexpected php aborts)
-            shuffle($apps_to_dl);
-            
-            // After collecting all provisioned apps, download them
-            $apps_to_dl_chunks = array_chunk($apps_to_dl, 10);
-
-            for($i = 0; $i < count($apps_to_dl_chunks); $i++)
-            {
-                $this->fetchFiles($apps_to_dl_chunks[$i]);
-                
-                // Check the integrity of all downloaded files
-                // but exclude cases where no filesize is available (i.e. screenshot or metafile download)
-                for($j = 0; $j < count($apps_to_dl_chunks[$i]); $j++)
-                {
-                    if($apps_to_dl_chunks[$i][$j]['filesize'] != 0 &&
-                       $apps_to_dl_chunks[$i][$j]['filesize'] != filesize($apps_to_dl_chunks[$i][$j]['localtarget']))
-                    {
-                            $app->log($this->log_prefix.' The filesize of the package "'.
-                                $apps_to_dl_chunks[$i][$j]['name'].'" is wrong. Download failure?', LOGLEVEL_WARN);
-                    }
-                }
-            }
-            
-            $app->log($this->log_prefix.'Processed '.$apps_in_repo.
-                ' apps from the repo. Downloaded '.$apps_updated.
-                ' updates, '.$apps_downloaded.' new apps');
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
-            return false;
-        }
-    }
-    
-    /**
-     * Read in all possible packages from the interface packages folder and 
-     * check if they are not ASP.net code (as this can't be processed).
-     * 
-     * Note: There's no need to check if the packages to register are newer
-     * than those in the database because this already happended in startCrawler()
-     */
-    public function parseFolderToDB()
-    {
-        global $app;
-        
-        try
-        {
-            // This method must be used in interface mode
-            if(!$this->interface_mode) return false; 
-            
-            $pkg_list = array();
-        
-            // Read in every package having a correct filename
-            $temp_handle = @dir($this->interface_pkg_dir);
-            if(!$temp_handle) throw new Exception('The temp directory is not accessible');
-            while($folder = $temp_handle->read()) 
-                if(substr($folder, -8) == '.app.zip') $pkg_list[] = $folder;
-            $temp_handle->close();
-            
-            // If no packages are available -> exception (because at this point there should exist packages)
-            if(empty($pkg_list)) throw new Exception('No packages to read in');
-            
-            // Get registered packages and mark non-existant packages with an error code to omit the install
-            $existing_packages = array();
-            $path_query = $app->db->queryAllRecords('SELECT path AS Path FROM aps_packages;');
-            foreach($path_query as $path) $existing_packages[] = $path['Path']; 
-            $diff = array_diff($existing_packages, $pkg_list);
-            foreach($diff as $todelete) {
-                /*$app->db->query("UPDATE aps_packages SET package_status = '".PACKAGE_ERROR_NOMETA."' 
+
+								// Download the meta file
+								$local_metafile = $local_intf_folder.'APP-META.xml';
+								if(!file_exists($local_metafile) || filesize($local_metafile) == 0)
+								{
+									$apps_to_dl[] = array('name' => 'APP-META.xml',
+										'url' => $app_metafile,
+										'filesize' => 0,
+										'localtarget' => $local_metafile);
+									$apps_downloaded++;
+								}
+
+								// Download package license
+								$license = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='eula']/@href");
+								if($license != '')
+								{
+									$local_license = $local_intf_folder.'LICENSE';
+									if(!file_exists($local_license) || filesize($local_license) == 0)
+									{
+										$apps_to_dl[] = array('name' => basename($license),
+											'url' => $license,
+											'filesize' => 0,
+											'localtarget' => $local_license);
+									}
+								}
+
+								// Download package icon
+								$icon = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='icon']/@href");
+								if($icon != '')
+								{
+									$local_icon = $local_intf_folder.basename($icon);
+									if(!file_exists($local_icon) || filesize($local_icon) == 0)
+									{
+										$apps_to_dl[] = array('name' => basename($icon),
+											'url' => $icon,
+											'filesize' => 0,
+											'localtarget' => $local_icon);
+									}
+								}
+
+								// Download available screenshots
+								$screenshots = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='screenshot']", true);
+								if(!empty($screenshots))
+								{
+									foreach($screenshots as $screen)
+									{
+										$local_screen = $local_intf_folder.basename($screen['href']);
+										if(!file_exists($local_screen) || filesize($local_screen) == 0)
+										{
+											$apps_to_dl[] = array('name' => basename($screen['href']),
+												'url' => $screen['href'],
+												'filesize' => 0,
+												'localtarget' => $local_screen);
+										}
+									}
+								}
+							}
+							else // Server mode (download whole ZIP archive)
+								{
+								// Delete an obviously out-dated version from the system
+								if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1)
+								{
+									$old_file = $this->packages_dir.'/'.$app_name.'-'.$ex_ver.'.app.zip';
+									if(file_exists($old_file)) $this->removeDirectory($old_file);
+								}
+
+								// Attention: $new_ver can also be == $ex_ver (according to version_compare >= 0)
+								$local_zip = $this->packages_dir.'/'.$app_name.'-'.$new_ver.'.app.zip';
+
+								// Before re-downloading a file, make sure it's not yet existing on HDD (due to DB inconsistency)
+								if((file_exists($local_zip) && (filesize($local_zip) == $app_filesize)) === false)
+								{
+									$apps_to_dl[] = array('name' => $app_name,
+										'url' => $app_dl,
+										'filesize' => $app_filesize,
+										'localtarget' => $local_zip);
+									$apps_downloaded++;
+								}
+							}
+						}
+
+						unset($sxe);
+						$apps_in_repo++;
+					}
+				}
+				//var_dump($apps);
+
+				// For memory reasons, unset the current vendor and his apps
+				unset($apps);
+			}
+
+			// Shuffle the download array (in order to compensate unexpected php aborts)
+			shuffle($apps_to_dl);
+
+			// After collecting all provisioned apps, download them
+			$apps_to_dl_chunks = array_chunk($apps_to_dl, 10);
+
+			for($i = 0; $i < count($apps_to_dl_chunks); $i++)
+			{
+				$this->fetchFiles($apps_to_dl_chunks[$i]);
+
+				// Check the integrity of all downloaded files
+				// but exclude cases where no filesize is available (i.e. screenshot or metafile download)
+				for($j = 0; $j < count($apps_to_dl_chunks[$i]); $j++)
+				{
+					if($apps_to_dl_chunks[$i][$j]['filesize'] != 0 &&
+						$apps_to_dl_chunks[$i][$j]['filesize'] != filesize($apps_to_dl_chunks[$i][$j]['localtarget']))
+					{
+						$app->log($this->log_prefix.' The filesize of the package "'.
+							$apps_to_dl_chunks[$i][$j]['name'].'" is wrong. Download failure?', LOGLEVEL_WARN);
+					}
+				}
+			}
+
+			$app->log($this->log_prefix.'Processed '.$apps_in_repo.
+				' apps from the repo. Downloaded '.$apps_updated.
+				' updates, '.$apps_downloaded.' new apps');
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Read in all possible packages from the interface packages folder and
+	 * check if they are not ASP.net code (as this can't be processed).
+	 *
+	 * Note: There's no need to check if the packages to register are newer
+	 * than those in the database because this already happended in startCrawler()
+	 */
+	public function parseFolderToDB()
+	{
+		global $app;
+
+		try
+		{
+			// This method must be used in interface mode
+			if(!$this->interface_mode) return false;
+
+			$pkg_list = array();
+
+			// Read in every package having a correct filename
+			$temp_handle = @dir($this->interface_pkg_dir);
+			if(!$temp_handle) throw new Exception('The temp directory is not accessible');
+			while($folder = $temp_handle->read())
+				if(substr($folder, -8) == '.app.zip') $pkg_list[] = $folder;
+				$temp_handle->close();
+
+			// If no packages are available -> exception (because at this point there should exist packages)
+			if(empty($pkg_list)) throw new Exception('No packages to read in');
+
+			// Get registered packages and mark non-existant packages with an error code to omit the install
+			$existing_packages = array();
+			$path_query = $app->db->queryAllRecords('SELECT path AS Path FROM aps_packages;');
+			foreach($path_query as $path) $existing_packages[] = $path['Path'];
+			$diff = array_diff($existing_packages, $pkg_list);
+			foreach($diff as $todelete) {
+				/*$app->db->query("UPDATE aps_packages SET package_status = '".PACKAGE_ERROR_NOMETA."'
                     WHERE path = '".$app->db->quote($todelete)."';");*/
 				$tmp = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE path = '".$app->db->quote($todelete)."';");
 				$app->db->datalogUpdate('aps_packages', "package_status = ".PACKAGE_ERROR_NOMETA, 'id', $tmp['id']);
 				unset($tmp);
 			}
-            
-            // Register all new packages
-            $new_packages = array_diff($pkg_list, $existing_packages);
-            foreach($new_packages as $pkg)
-            {
-                // Load in meta file if existing and register its namespaces
-                $metafile = $this->interface_pkg_dir.'/'.$pkg.'/APP-META.xml';
-                if(!file_exists($metafile)) 
-                {
-                    $app->log($this->log_prefix.'Cannot read metadata from '.$pkg, LOGLEVEL_ERROR);
-                    continue;
-                }
-        
-                $metadata = file_get_contents($metafile);
-                $metadata = str_replace("xmlns=", "ns=", $metadata);
-                $sxe = new SimpleXMLElement($metadata);
-                $namespaces = $sxe->getDocNamespaces(true);
-                foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
-                
-                // Insert the new package
-                $pkg_name = parent::getXPathValue($sxe, 'name');
-                $pkg_category = parent::getXPathValue($sxe, '//category');
-                $pkg_version = parent::getXPathValue($sxe, 'version');
-                $pkg_release = parent::getXPathValue($sxe, 'release');
+
+			// Register all new packages
+			$new_packages = array_diff($pkg_list, $existing_packages);
+			foreach($new_packages as $pkg)
+			{
+				// Load in meta file if existing and register its namespaces
+				$metafile = $this->interface_pkg_dir.'/'.$pkg.'/APP-META.xml';
+				if(!file_exists($metafile))
+				{
+					$app->log($this->log_prefix.'Cannot read metadata from '.$pkg, LOGLEVEL_ERROR);
+					continue;
+				}
+
+				$metadata = file_get_contents($metafile);
+				$metadata = str_replace("xmlns=", "ns=", $metadata);
+				$sxe = new SimpleXMLElement($metadata);
+				$namespaces = $sxe->getDocNamespaces(true);
+				foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+				// Insert the new package
+				$pkg_name = parent::getXPathValue($sxe, 'name');
+				$pkg_category = parent::getXPathValue($sxe, '//category');
+				$pkg_version = parent::getXPathValue($sxe, 'version');
+				$pkg_release = parent::getXPathValue($sxe, 'release');
 				//$pkg_url = $this->app_download_url_list[$pkg];
 				$pkg_url = @file_get_contents($this->interface_pkg_dir.'/'.$pkg.'/PKG_URL');
-                
+
 				/*
-                $app->db->query("INSERT INTO `aps_packages` 
-                    (`path`, `name`, `category`, `version`, `release`, `package_status`) VALUES 
+                $app->db->query("INSERT INTO `aps_packages`
+                    (`path`, `name`, `category`, `version`, `release`, `package_status`) VALUES
                     ('".$app->db->quote($pkg)."', '".$app->db->quote($pkg_name)."',
                     '".$app->db->quote($pkg_category)."', '".$app->db->quote($pkg_version)."',
                     ".$app->db->quote($pkg_release).", ".PACKAGE_ENABLED.");");
 				*/
 				// Insert only if data is complete
 				if($pkg != '' && $pkg_name != '' && $pkg_category != '' && $pkg_version != '' && $pkg_release != '' && $pkg_url){
-					$insert_data = "(`path`, `name`, `category`, `version`, `release`, `package_url`, `package_status`) VALUES 
+					$insert_data = "(`path`, `name`, `category`, `version`, `release`, `package_url`, `package_status`) VALUES
                     ('".$app->db->quote($pkg)."', '".$app->db->quote($pkg_name)."',
                     '".$app->db->quote($pkg_category)."', '".$app->db->quote($pkg_version)."',
                     ".$app->db->quote($pkg_release).", '".$app->db->quote($pkg_url)."', ".PACKAGE_ENABLED.");";
-				
+
 					$app->db->datalogInsert('aps_packages', $insert_data, 'id');
 				} else {
 					if(file_exists($this->interface_pkg_dir.'/'.$pkg)) $this->removeDirectory($this->interface_pkg_dir.'/'.$pkg);
 				}
-            }
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
+			}
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
 			$app->error($e->getMessage());
-            return false;
-        }
-    }
-	
+			return false;
+		}
+	}
+
+
+
 	/**
-     * Add missing package URLs to database
-     */
-    public function fixURLs()
-    {
-        global $app;
-        
-        try
-        {
-            // This method must be used in interface mode
-            if(!$this->interface_mode) return false; 
-            
-            $incomplete_pkgs = $app->db->queryAllRecords("SELECT * FROM aps_packages WHERE package_url = ''");
+	 * Add missing package URLs to database
+	 */
+	public function fixURLs()
+	{
+		global $app;
+
+		try
+		{
+			// This method must be used in interface mode
+			if(!$this->interface_mode) return false;
+
+			$incomplete_pkgs = $app->db->queryAllRecords("SELECT * FROM aps_packages WHERE package_url = ''");
 			if(is_array($incomplete_pkgs) && !empty($incomplete_pkgs)){
 				foreach($incomplete_pkgs as $incomplete_pkg){
 					$pkg_url = @file_get_contents($this->interface_pkg_dir.'/'.$incomplete_pkg['path'].'/PKG_URL');
@@ -580,13 +599,16 @@ class ApsCrawler extends ApsBase
 					}
 				}
 			}
-        }
-        catch(Exception $e)
-        {
-            $app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
+		}
+
+		catch(Exception $e)
+		{
+			$app->log($this->log_prefix.$e->getMessage(), LOGLEVEL_ERROR);
 			$app->error($e->getMessage());
-            return false;
-        }
-    }
+			return false;
+		}
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/aps_guicontroller.inc.php b/interface/lib/classes/aps_guicontroller.inc.php
index 453caef0062b0ff321f6233936176827de453d74..47f5bd25fbf59955c802d8e07bb03bd9bfad294c 100644
--- a/interface/lib/classes/aps_guicontroller.inc.php
+++ b/interface/lib/classes/aps_guicontroller.inc.php
@@ -27,199 +27,215 @@ 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('aps_base.inc.php');
+require_once 'aps_base.inc.php';
 
 class ApsGUIController extends ApsBase
 {
-    /**
-    * Constructor
-    *
-    * @param $app the application instance (db handle)
-    */
-    public function __construct($app)
-    {
-        parent::__construct($app);
-    }
-    
-    /**
-     * Reads in a package metadata file and registers it's namespaces
-     * 
-     * @param $filename the file to read
-     * @return $sxe a SimpleXMLElement handle
-     */
-    private function readInMetaFile($filename)
-    {
-        $metadata = file_get_contents($filename);
-        $metadata = str_replace("xmlns=", "ns=", $metadata);
-        $sxe = new SimpleXMLElement($metadata);
-        $namespaces = $sxe->getDocNamespaces(true);
-        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
-        
-        return $sxe; 
-    }
-    
-    /**
-     * Applies a RegEx pattern onto a location path in order to secure it against 
-     * code injections and invalid input
-     * 
-     * @param $location_unfiltered the file path to secure
-     * @return $location
-     */
-    private function secureLocation($location_unfiltered)
-    {
-        // Filter invalid slashes from string
-        $location = preg_replace(array('#/+#', '#\.+#', '#\0+#', '#\\\\+#'), 
-                                 array('/', '', '', '/'), 
-                                 $location_unfiltered);
-
-        // Remove a beginning or trailing slash
-        if(substr($location, -1) == '/') $location = substr($location, 0, strlen($location) - 1);
-        if(substr($location, 0, 1) == '/') $location = substr($location, 1);
-        
-        return $location;
-    }
-    
-    /**
-     * Gets the CustomerID (ClientID) which belongs to a specific domain
-     * 
-     * @param $domain the domain
-     * @return $customerid
-     */
-    private function getCustomerIDFromDomain($domain)
-    {
-        global $app;
-        $customerid = 0;
-        
-        $customerdata = $app->db->queryOneRecord("SELECT client_id FROM sys_group, web_domain
-            WHERE web_domain.sys_groupid = sys_group.groupid 
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle)
+	 */
+
+
+	public function __construct($app)
+	{
+		parent::__construct($app);
+	}
+
+
+
+	/**
+	 * Reads in a package metadata file and registers it's namespaces
+	 *
+	 * @param $filename the file to read
+	 * @return $sxe a SimpleXMLElement handle
+	 */
+	private function readInMetaFile($filename)
+	{
+		$metadata = file_get_contents($filename);
+		$metadata = str_replace("xmlns=", "ns=", $metadata);
+		$sxe = new SimpleXMLElement($metadata);
+		$namespaces = $sxe->getDocNamespaces(true);
+		foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+		return $sxe;
+	}
+
+
+
+	/**
+	 * Applies a RegEx pattern onto a location path in order to secure it against
+	 * code injections and invalid input
+	 *
+	 * @param $location_unfiltered the file path to secure
+	 * @return $location
+	 */
+	private function secureLocation($location_unfiltered)
+	{
+		// Filter invalid slashes from string
+		$location = preg_replace(array('#/+#', '#\.+#', '#\0+#', '#\\\\+#'),
+			array('/', '', '', '/'),
+			$location_unfiltered);
+
+		// Remove a beginning or trailing slash
+		if(substr($location, -1) == '/') $location = substr($location, 0, strlen($location) - 1);
+		if(substr($location, 0, 1) == '/') $location = substr($location, 1);
+
+		return $location;
+	}
+
+
+
+	/**
+	 * Gets the CustomerID (ClientID) which belongs to a specific domain
+	 *
+	 * @param $domain the domain
+	 * @return $customerid
+	 */
+	private function getCustomerIDFromDomain($domain)
+	{
+		global $app;
+		$customerid = 0;
+
+		$customerdata = $app->db->queryOneRecord("SELECT client_id FROM sys_group, web_domain
+            WHERE web_domain.sys_groupid = sys_group.groupid
             AND web_domain.domain = '".$app->db->quote($domain)."';");
-        if(!empty($customerdata)) $customerid = $customerdata['client_id'];
-        
-        return $customerid;
-    }
-    
-    /**
-     * Returns the server_id for an already installed instance. Is actually 
-     * just a little helper method to avoid redundant code
-     * 
-     * @param $instanceid the instance to process
-     * @return $webserver_id the server_id
-     */
-    private function getInstanceDataForDatalog($instanceid)
-    {
-        global $app;
-        $webserver_id = '';
-        
-        $websrv = $app->db->queryOneRecord("SELECT server_id FROM web_domain 
-            WHERE domain = (SELECT value FROM aps_instances_settings 
+		if(!empty($customerdata)) $customerid = $customerdata['client_id'];
+
+		return $customerid;
+	}
+
+
+
+	/**
+	 * Returns the server_id for an already installed instance. Is actually
+	 * just a little helper method to avoid redundant code
+	 *
+	 * @param $instanceid the instance to process
+	 * @return $webserver_id the server_id
+	 */
+	private function getInstanceDataForDatalog($instanceid)
+	{
+		global $app;
+		$webserver_id = '';
+
+		$websrv = $app->db->queryOneRecord("SELECT server_id FROM web_domain
+            WHERE domain = (SELECT value FROM aps_instances_settings
                 WHERE name = 'main_domain' AND instance_id = ".$app->db->quote($instanceid).");");
 
-        // If $websrv is empty, an error has occured. Domain no longer existing? Settings table damaged?
-        // Anyhow, remove this instance record because it's not useful at all
-        if(empty($websrv)) 
-        {
-            $app->db->query("DELETE FROM aps_instances WHERE id = ".$app->db->quote($instanceid).";");
-            $app->db->query("DELETE FROM aps_instances_settings WHERE instance_id = ".$app->db->quote($instanceid).";");
-        }
-        else $webserver_id = $websrv['server_id'];
-        
-        return $webserver_id;
-    } 
-    
-    /**
-     * Finds out if there is a newer package version for 
-     * a given (possibly valid) package ID
-     * 
-     * @param $id the ID to check
-     * @return $newer_pkg_id the newer package ID
-     */ 
-    public function getNewestPackageID($id)
-    {
-        global $app;
-        
-        if(preg_match('/^[0-9]+$/', $id) != 1) return 0;
-        
-        $result = $app->db->queryOneRecord("SELECT id, name, 
-            CONCAT(version, '-', CAST(`release` AS CHAR)) AS current_version 
-            FROM aps_packages 
-            WHERE name = (SELECT name FROM aps_packages WHERE id = ".$app->db->quote($id).")  
+		// If $websrv is empty, an error has occured. Domain no longer existing? Settings table damaged?
+		// Anyhow, remove this instance record because it's not useful at all
+		if(empty($websrv))
+		{
+			$app->db->query("DELETE FROM aps_instances WHERE id = ".$app->db->quote($instanceid).";");
+			$app->db->query("DELETE FROM aps_instances_settings WHERE instance_id = ".$app->db->quote($instanceid).";");
+		}
+		else $webserver_id = $websrv['server_id'];
+
+		return $webserver_id;
+	}
+
+
+
+	/**
+	 * Finds out if there is a newer package version for
+	 * a given (possibly valid) package ID
+	 *
+	 * @param $id the ID to check
+	 * @return $newer_pkg_id the newer package ID
+	 */
+	public function getNewestPackageID($id)
+	{
+		global $app;
+
+		if(preg_match('/^[0-9]+$/', $id) != 1) return 0;
+
+		$result = $app->db->queryOneRecord("SELECT id, name,
+            CONCAT(version, '-', CAST(`release` AS CHAR)) AS current_version
+            FROM aps_packages
+            WHERE name = (SELECT name FROM aps_packages WHERE id = ".$app->db->quote($id).")
             ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC");
-            
-        if(!empty($result) && ($id != $result['id'])) return $result['id'];
-        
-        return 0; 
-    }
-
-    /**
-     * Validates a given package ID
-     *
-     * @param $id the ID to check
-     * @param $is_admin a flag to allow locked IDs too (for admin calls)
-     * @return boolean
-     */
-    public function isValidPackageID($id, $is_admin = false)
-    {
-        global $app;
-        
-         if(preg_match('/^[0-9]+$/', $id) != 1) return false;
-         
-         $sql_ext = (!$is_admin) ? 
-            'package_status = '.PACKAGE_ENABLED.' AND' :  
-            '(package_status = '.PACKAGE_ENABLED.' OR package_status = '.PACKAGE_LOCKED.') AND'; 
-
-         $result = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE ".$sql_ext." id = ".$app->db->quote($id).";");
-         if(!$result) return false;
-         
-         return true;
-    }
-    
-    /**
-     * Validates a given instance ID
-     *
-     * @param $id the ID to check
-     * @param $client_id the calling client ID
-     * @param $is_admin a flag to ignore the client ID check for admins
-     * @return boolean
-     */
-    public function isValidInstanceID($id, $client_id, $is_admin = false)
-    {
-        global $app;
-        
-         if(preg_match('/^[0-9]+$/', $id) != 1) return false;
-         
-         // Only filter if not admin
-         $sql_ext = (!$is_admin) ? 'customer_id = '.$app->db->quote($client_id).' AND' : ''; 
-
-         $result = $app->db->queryOneRecord('SELECT id FROM aps_instances WHERE '.$sql_ext.' id = '.$app->db->quote($id).';');
-         if(!$result) return false;
-         
-         return true;
-    }    
-    
-    /**
-     * Creates a new database record for the package instance and
-     * an install task
-     * 
-     * @param $settings the settings to enter into the DB
-     * @param $packageid the PackageID
-     */
-    public function createPackageInstance($settings, $packageid)
-    {
+
+		if(!empty($result) && ($id != $result['id'])) return $result['id'];
+
+		return 0;
+	}
+
+	/**
+	 * Validates a given package ID
+	 *
+	 * @param $id the ID to check
+	 * @param $is_admin a flag to allow locked IDs too (for admin calls)
+	 * @return boolean
+	 */
+	public function isValidPackageID($id, $is_admin = false)
+	{
 		global $app;
-		
+
+		if(preg_match('/^[0-9]+$/', $id) != 1) return false;
+
+		$sql_ext = (!$is_admin) ?
+			'package_status = '.PACKAGE_ENABLED.' AND' :
+			'(package_status = '.PACKAGE_ENABLED.' OR package_status = '.PACKAGE_LOCKED.') AND';
+
+		$result = $app->db->queryOneRecord("SELECT id FROM aps_packages WHERE ".$sql_ext." id = ".$app->db->quote($id).";");
+		if(!$result) return false;
+
+		return true;
+	}
+
+
+
+	/**
+	 * Validates a given instance ID
+	 *
+	 * @param $id the ID to check
+	 * @param $client_id the calling client ID
+	 * @param $is_admin a flag to ignore the client ID check for admins
+	 * @return boolean
+	 */
+	public function isValidInstanceID($id, $client_id, $is_admin = false)
+	{
+		global $app;
+
+		if(preg_match('/^[0-9]+$/', $id) != 1) return false;
+
+		// Only filter if not admin
+		$sql_ext = (!$is_admin) ? 'customer_id = '.$app->db->quote($client_id).' AND' : '';
+
+		$result = $app->db->queryOneRecord('SELECT id FROM aps_instances WHERE '.$sql_ext.' id = '.$app->db->quote($id).';');
+		if(!$result) return false;
+
+		return true;
+	}
+
+
+
+	/**
+	 * Creates a new database record for the package instance and
+	 * an install task
+	 *
+	 * @param $settings the settings to enter into the DB
+	 * @param $packageid the PackageID
+	 */
+	public function createPackageInstance($settings, $packageid)
+	{
+		global $app;
+
 		$app->uses('tools_sites');
-        
+
 		$webserver_id = 0;
-        $websrv = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '".$app->db->quote($settings['main_domain'])."';");
-        if(!empty($websrv)) $webserver_id = $websrv['server_id'];
-        $customerid = $this->getCustomerIDFromDomain($settings['main_domain']);
-        
-        if(empty($settings) || empty($webserver_id)) return false;
-		
+		$websrv = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '".$app->db->quote($settings['main_domain'])."';");
+		if(!empty($websrv)) $webserver_id = $websrv['server_id'];
+		$customerid = $this->getCustomerIDFromDomain($settings['main_domain']);
+
+		if(empty($settings) || empty($webserver_id)) return false;
+
 		//* Get server config of the web server
 		$app->uses("getconf");
-		$web_config = $app->getconf->get_server_config($app->functions->intval($websrv["server_id"]),'web');
-			
+		$web_config = $app->getconf->get_server_config($app->functions->intval($websrv["server_id"]), 'web');
+
 		//* Set PHP mode to php-fcgi and enable suexec in website on apache servers / set PHP mode to PHP-FPM on nginx servers
 		if($web_config['server_type'] == 'apache') {
 			if(($websrv['php'] != 'fast-cgi' || $websrv['suexec'] != 'y') && $websrv['php'] != 'php-fpm') {
@@ -231,59 +247,59 @@ class ApsGUIController extends ApsBase
 				$app->db->datalogUpdate('web_domain', "php = 'php-fpm'", 'domain_id', $websrv['domain_id']);
 			}
 		}
-		
-		
+
+
 		//* Create the MySQL database for the application
 		$pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($packageid).';');
 		$metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
 		$sxe = $this->readInMetaFile($metafile);
-		
+
 		$db_id = parent::getXPathValue($sxe, '//db:id');
 		if (!empty($db_id)) {
 			$global_config = $app->getconf->get_global_config('sites');
-			
+
 			$tmp = array();
 			$tmp['parent_domain_id'] = $websrv['domain_id'];
 			$tmp['sys_groupid'] = $websrv['sys_groupid'];
 			$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $tmp);
 			$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $tmp);
 			unset($tmp);
-			
-            // get information if the webserver is a db server, too
-            $web_server = $app->db->queryOneRecord("SELECT server_id,server_name,db_server FROM server WHERE server_id  = ".$websrv['server_id']);
-            if($web_server['db_server'] == 1) {
-                // create database on "localhost" (webserver)
+
+			// get information if the webserver is a db server, too
+			$web_server = $app->db->queryOneRecord("SELECT server_id,server_name,db_server FROM server WHERE server_id  = ".$websrv['server_id']);
+			if($web_server['db_server'] == 1) {
+				// create database on "localhost" (webserver)
 				$mysql_db_server_id = $websrv['server_id'];
 				$mysql_db_host = 'localhost';
 				$mysql_db_remote_access = 'n';
 				$mysql_db_remote_ips = '';
-            } else {
-                //* get the default database server of the client
-                $client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']);
-                if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) {
-                    $mysql_db_server_id =  $client['default_dbserver'];
-                    $dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id),'server');
-                    $mysql_db_host = $dbserver_config['ip_address'];
-                    $mysql_db_remote_access = 'y';
-                    $webserver_config = $app->getconf->get_server_config($app->functions->intval($websrv['server_id']),'server');
-                    $mysql_db_remote_ips = $webserver_config['ip_address'];
-                } else {
-                    /* I left this in place for a fallback that should NEVER! happen.
+			} else {
+				//* get the default database server of the client
+				$client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']);
+				if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) {
+					$mysql_db_server_id =  $client['default_dbserver'];
+					$dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id), 'server');
+					$mysql_db_host = $dbserver_config['ip_address'];
+					$mysql_db_remote_access = 'y';
+					$webserver_config = $app->getconf->get_server_config($app->functions->intval($websrv['server_id']), 'server');
+					$mysql_db_remote_ips = $webserver_config['ip_address'];
+				} else {
+					/* I left this in place for a fallback that should NEVER! happen.
                      * if we reach this point it means that there is NO default db server for the client
                      * AND the webserver has NO db service enabled.
                      * We have to abort the aps installation here... so I added a return false
                      * although this does not present any error message to the user.
                      */
-                    return false;
-                    
-                    /*$mysql_db_server_id = $websrv['server_id'];
+					return false;
+
+					/*$mysql_db_server_id = $websrv['server_id'];
                     $mysql_db_host = 'localhost';
                     $mysql_db_remote_access = 'n';
                     $mysql_db_remote_ips = '';*/
-                }
-            }
-			
-            //* Find a free db name for the app
+				}
+			}
+
+			//* Find a free db name for the app
 			for($n = 1; $n <= 1000; $n++) {
 				$mysql_db_name = ($dbname_prefix != '' ? $dbname_prefix.'aps'.$n : uniqid('aps'));
 				$tmp = $app->db->queryOneRecord("SELECT count(database_id) as number FROM web_database WHERE database_name = '".$app->db->quote($mysql_db_name)."'");
@@ -295,30 +311,30 @@ class ApsGUIController extends ApsBase
 				$tmp = $app->db->queryOneRecord("SELECT count(database_user_id) as number FROM web_database_user WHERE database_user = '".$app->db->quote($mysql_db_user)."'");
 				if($tmp['number'] == 0) break;
 			}
-			
+
 			$mysql_db_password = $settings['main_database_password'];
-			
+
 			//* Create the mysql database user
-			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_user_prefix`, `database_password`) 
+			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `database_user`, `database_user_prefix`, `database_password`)
 					  VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', 0, '$mysql_db_user', '".$app->db->quote($dbuser_prefix) . "', PASSWORD('$mysql_db_password'))";
 			$mysql_db_user_id = $app->db->datalogInsert('web_database_user', $insert_data, 'database_user_id');
-            
+
 			//* Create the mysql database
-			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_name_prefix`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`) 
+			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `parent_domain_id`, `type`, `database_name`, `database_name_prefix`, `database_user_id`, `database_ro_user_id`, `database_charset`, `remote_access`, `remote_ips`, `backup_copies`, `active`, `backup_interval`)
 					  VALUES( ".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', $mysql_db_server_id, ".$websrv['domain_id'].", 'mysql', '$mysql_db_name', '" . $app->db->quote($dbname_prefix) . "', '$mysql_db_user_id', 0, '', '$mysql_db_remote_access', '$mysql_db_remote_ips', ".$websrv['backup_copies'].", 'y', '".$websrv['backup_interval']."')";
 			$app->db->datalogInsert('web_database', $insert_data, 'database_id');
-			
+
 			//* Add db details to package settings
 			$settings['main_database_host'] = $mysql_db_host;
 			$settings['main_database_name'] = $mysql_db_name;
 			$settings['main_database_login'] = $mysql_db_user;
-		
+
 		}
-		
+
 		//* Insert new package instance
 		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `customer_id`, `package_id`, `instance_status`) VALUES (".$websrv['sys_userid'].", ".$websrv['sys_groupid'].", 'riud', '".$websrv['sys_perm_group']."', '', ".$app->db->quote($webserver_id).",".$app->db->quote($customerid).", ".$app->db->quote($packageid).", ".INSTANCE_PENDING.")";
 		$InstanceID = $app->db->datalogInsert('aps_instances', $insert_data, 'id');
-		
+
 		//* Insert all package settings
 		if(is_array($settings)) {
 			foreach($settings as $key => $value) {
@@ -326,520 +342,530 @@ class ApsGUIController extends ApsBase
 				$app->db->datalogInsert('aps_instances_settings', $insert_data, 'id');
 			}
 		}
-		
+
 		//* Set package status to install afetr we inserted the settings
 		$app->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_INSTALL, 'id', $InstanceID);
-    }
-    
-    /**
-     * Sets the status of an instance to "should be removed" and creates a 
-     * datalog entry to give the ISPConfig server a real removal advice 
-     * 
-     * @param $instanceid the instance to delete
-     */
-    public function deleteInstance($instanceid)
-    {
-        global $app;
+	}
+
+
+
+	/**
+	 * Sets the status of an instance to "should be removed" and creates a
+	 * datalog entry to give the ISPConfig server a real removal advice
+	 *
+	 * @param $instanceid the instance to delete
+	 */
+	public function deleteInstance($instanceid)
+	{
+		global $app;
 		/*
 		$app->db->query("UPDATE aps_instances SET instance_status = ".INSTANCE_REMOVE." WHERE id = ".$instanceid.";");
-        
+
         $webserver_id = $this->getInstanceDataForDatalog($instanceid);
         if($webserver_id == '') return;
-        
+
         // Create a sys_datalog entry for deletion
         $datalog = array('Instance_id' => $instanceid, 'server_id' => $webserver_id);
         $app->db->datalogSave('aps', 'DELETE', 'id', $instanceid, array(), $datalog);
 		*/
-		
+
 		$sql = "SELECT web_database.database_id as database_id, web_database.database_user_id as `database_user_id` FROM aps_instances_settings, web_database WHERE aps_instances_settings.value = web_database.database_name AND aps_instances_settings.name = 'main_database_name' AND aps_instances_settings.instance_id = ".$instanceid." LIMIT 0,1";
 		$tmp = $app->db->queryOneRecord($sql);
 		if($tmp['database_id'] > 0) $app->db->datalogDelete('web_database', 'database_id', $tmp['database_id']);
-		
-        $database_user = $tmp['database_user_id'];
-        $tmp = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'");
-        if($tmp['cnt'] < 1) $app->db->datalogDelete('web_database_user', 'database_user_id', $database_user);
-        
+
+		$database_user = $tmp['database_user_id'];
+		$tmp = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'");
+		if($tmp['cnt'] < 1) $app->db->datalogDelete('web_database_user', 'database_user_id', $database_user);
+
 		$app->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_REMOVE, 'id', $instanceid);
 
-    }
-    
-    /**
-     * Sets the status of an instance to "installation planned" and creates a 
-     * datalog entry to re-install the package. The existing package is simply overwritten. 
-     * 
-     * @param $instanceid the instance to delete
-     */
-    public function reinstallInstance($instanceid)
-    {
-        global $app;
-        
-        /*
+	}
+
+
+
+	/**
+	 * Sets the status of an instance to "installation planned" and creates a
+	 * datalog entry to re-install the package. The existing package is simply overwritten.
+	 *
+	 * @param $instanceid the instance to delete
+	 */
+	public function reinstallInstance($instanceid)
+	{
+		global $app;
+
+		/*
 		$app->db->query("UPDATE aps_instances SET instance_status = ".INSTANCE_INSTALL." WHERE id = ".$instanceid.";");
-        
+
         $webserver_id = $this->getInstanceDataForDatalog($instanceid);
         if($webserver_id == '') return;
-        
+
         // Create a sys_datalog entry for re-installation
         $datalog = array('instance_id' => $instanceid, 'server_id' => $webserver_id);
         $app->db->datalogSave('aps', 'INSERT', 'id', $instanceid, array(), $datalog);
 		*/
-		
+
 		$sql = "SELECT web_database.database_id as database_id FROM aps_instances_settings, web_database WHERE aps_instances_settings.value = web_database.database_name AND aps_instances_settings.value =  aps_instances_settings.name = 'main_database_name' AND aps_instances_settings.instance_id = ".$instanceid." LIMIT 0,1";
 		$tmp = $app->db->queryOneRecord($sql);
 		if($tmp['database_id'] > 0) $app->db->datalogDelete('web_database', 'database_id', $tmp['database_id']);
-		
+
 		$app->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_INSTALL, 'id', $instanceid);
-    }
-
-    /**
-     * Read the settings to be filled when installing
-     * 
-     * @param $id the internal ID of the package
-     * @return array
-     */
-    public function getPackageSettings($id)    
-    {
-        global $app;
-        
-        $pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
-        
-        // Load in meta file if existing and register its namespaces
-        $metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
-        if(!file_exists($metafile)) 
-            return array('error' => 'The metafile for '.$settings['Name'].' couldn\'t be found');
-        
-        $sxe = $this->readInMetaFile($metafile);
-        
-        $groupsettings = parent::getXPathValue($sxe, '//settings/group/setting', true);
-        if(empty($groupsettings)) return array();
-        
-        $settings = array();
-        foreach($groupsettings as $setting)
-        {
-            $setting_id = strval($setting['id']);
-            
-            if($setting['type'] == 'string' || $setting['type'] == 'email' || $setting['type'] == 'integer'
-            || $setting['type'] == 'float' || $setting['type'] == 'domain-name')
-            {
-                $settings[] = array('SettingID' => $setting_id,
-                                    'SettingName' => $setting->name,
-                                    'SettingDescription' => $setting->description,
-                                    'SettingType' => $setting['type'],
-                                    'SettingInputType' => 'string',
-                                    'SettingDefaultValue' => strval($setting['default-value']),
-                                    'SettingRegex' => $setting['regex'],
-                                    'SettingMinLength' => $setting['min-length'],
-                                    'SettingMaxLength' => $setting['max-length']);
-            }
-            else if($setting['type'] == 'password')
-            {
-                $settings[] = array('SettingID' => $setting_id,
-                                    'SettingName' => $setting->name,
-                                    'SettingDescription' => $setting->description,
-                                    'SettingType' => 'password',
-                                    'SettingInputType' => 'password',
-                                    'SettingDefaultValue' => '',
-                                    'SettingRegex' => $setting['regex'],
-                                    'SettingMinLength' => $setting['min-length'],
-                                    'SettingMaxLength' => $setting['max-length']);
-            }
-            else if($setting['type'] == 'boolean')
-            {
-                $settings[] = array('SettingID' => $setting_id,
-                                    'SettingName' => $setting->name,
-                                    'SettingDescription' => $setting->description,
-                                    'SettingType' => 'boolean',
-                                    'SettingInputType' => 'checkbox',
-                                    'SettingDefaultValue' => strval($setting['default-value']));
-            }
-            else if($setting['type'] == 'enum')
-            {
-              $choices = array();
-              foreach($setting->choice as $choice)
-              {
-                $choices[] = array('EnumID' => strval($choice['id']),
-                                   'EnumName' => $choice->name);
-              }
-              $settings[] = array('SettingID' => $setting_id,
-                                  'SettingName' => $setting->name,
-                                  'SettingDescription' => $setting->description,
-                                  'SettingType' => 'enum',
-                                  'SettingInputType' => 'select',
-                                  'SettingDefaultValue' => strval($setting['default-value']),
-                                  'SettingChoices' => $choices);
-            }
-        }
-
-        return $settings;
-    }
-    
-    /**
-     * Validates the user input according to the settings array and
-     * delivers errors if occurring
-     * 
-     * @param $input the user $_POST array
-     * @param $pkg_details the package details
-     * @param $settings the package settings array
-     * @return array in this structure:
-     *               array(2) {
-     *                  ["input"]=> ...
-     *                  ["errors"]=> ...
-     *               }
-     */
-    public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array())
-    {
-        global $app;
-        
-        $ret = array();
-        $input = array(); 
-        $error = array();
-        
-        // Main domain (obligatory)
-        if(isset($postinput['main_domain']))
-        {
-            if(!in_array($postinput['main_domain'], $domains)) $error[] = $app->lng('error_main_domain');
-            else $input['main_domain'] = $postinput['main_domain'];
-        }
-        else $error[] = $app->lng('error_main_domain'); 
-        
-        // Main location (not obligatory but must be supplied)
-        if(isset($postinput['main_location']))
-        {
-            $temp_errstr = '';
-            // It can be empty but if the user did write something, check it
-            $userinput = false;
-            if(strlen($postinput['main_location']) > 0) $userinput = true; 
-            
-            // Filter invalid input slashes (twice!)
-            $main_location = $this->secureLocation($postinput['main_location']);
-            $main_location = $this->secureLocation($main_location);
-            // Only allow digits, words, / and -
-            $main_location = preg_replace("/[^\d\w\/\-]/i", "", $main_location);
-            if($userinput && (strlen($main_location) == 0)) $temp_errstr = $app->lng('error_inv_main_location');
-            
-            // Find out document_root and make sure no apps are installed twice to one location
-            if(in_array($postinput['main_domain'], $domains))
-            {
-                $docroot = $app->db->queryOneRecord("SELECT document_root FROM web_domain 
+	}
+
+	/**
+	 * Read the settings to be filled when installing
+	 *
+	 * @param $id the internal ID of the package
+	 * @return array
+	 */
+	public function getPackageSettings($id)
+	{
+		global $app;
+
+		$pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
+
+		// Load in meta file if existing and register its namespaces
+		$metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
+		if(!file_exists($metafile))
+			return array('error' => 'The metafile for '.$settings['Name'].' couldn\'t be found');
+
+		$sxe = $this->readInMetaFile($metafile);
+
+		$groupsettings = parent::getXPathValue($sxe, '//settings/group/setting', true);
+		if(empty($groupsettings)) return array();
+
+		$settings = array();
+		foreach($groupsettings as $setting)
+		{
+			$setting_id = strval($setting['id']);
+
+			if($setting['type'] == 'string' || $setting['type'] == 'email' || $setting['type'] == 'integer'
+				|| $setting['type'] == 'float' || $setting['type'] == 'domain-name')
+			{
+				$settings[] = array('SettingID' => $setting_id,
+					'SettingName' => $setting->name,
+					'SettingDescription' => $setting->description,
+					'SettingType' => $setting['type'],
+					'SettingInputType' => 'string',
+					'SettingDefaultValue' => strval($setting['default-value']),
+					'SettingRegex' => $setting['regex'],
+					'SettingMinLength' => $setting['min-length'],
+					'SettingMaxLength' => $setting['max-length']);
+			}
+			else if($setting['type'] == 'password')
+				{
+					$settings[] = array('SettingID' => $setting_id,
+						'SettingName' => $setting->name,
+						'SettingDescription' => $setting->description,
+						'SettingType' => 'password',
+						'SettingInputType' => 'password',
+						'SettingDefaultValue' => '',
+						'SettingRegex' => $setting['regex'],
+						'SettingMinLength' => $setting['min-length'],
+						'SettingMaxLength' => $setting['max-length']);
+				}
+			else if($setting['type'] == 'boolean')
+				{
+					$settings[] = array('SettingID' => $setting_id,
+						'SettingName' => $setting->name,
+						'SettingDescription' => $setting->description,
+						'SettingType' => 'boolean',
+						'SettingInputType' => 'checkbox',
+						'SettingDefaultValue' => strval($setting['default-value']));
+				}
+			else if($setting['type'] == 'enum')
+				{
+					$choices = array();
+					foreach($setting->choice as $choice)
+					{
+						$choices[] = array('EnumID' => strval($choice['id']),
+							'EnumName' => $choice->name);
+					}
+					$settings[] = array('SettingID' => $setting_id,
+						'SettingName' => $setting->name,
+						'SettingDescription' => $setting->description,
+						'SettingType' => 'enum',
+						'SettingInputType' => 'select',
+						'SettingDefaultValue' => strval($setting['default-value']),
+						'SettingChoices' => $choices);
+				}
+		}
+
+		return $settings;
+	}
+
+
+
+	/**
+	 * Validates the user input according to the settings array and
+	 * delivers errors if occurring
+	 *
+	 * @param $input the user $_POST array
+	 * @param $pkg_details the package details
+	 * @param $settings the package settings array
+	 * @return array in this structure:
+	 *               array(2) {
+	 *                  ["input"]=> ...
+	 *                  ["errors"]=> ...
+	 *               }
+	 */
+	public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array())
+	{
+		global $app;
+
+		$ret = array();
+		$input = array();
+		$error = array();
+
+		// Main domain (obligatory)
+		if(isset($postinput['main_domain']))
+		{
+			if(!in_array($postinput['main_domain'], $domains)) $error[] = $app->lng('error_main_domain');
+			else $input['main_domain'] = $postinput['main_domain'];
+		}
+		else $error[] = $app->lng('error_main_domain');
+
+		// Main location (not obligatory but must be supplied)
+		if(isset($postinput['main_location']))
+		{
+			$temp_errstr = '';
+			// It can be empty but if the user did write something, check it
+			$userinput = false;
+			if(strlen($postinput['main_location']) > 0) $userinput = true;
+
+			// Filter invalid input slashes (twice!)
+			$main_location = $this->secureLocation($postinput['main_location']);
+			$main_location = $this->secureLocation($main_location);
+			// Only allow digits, words, / and -
+			$main_location = preg_replace("/[^\d\w\/\-]/i", "", $main_location);
+			if($userinput && (strlen($main_location) == 0)) $temp_errstr = $app->lng('error_inv_main_location');
+
+			// Find out document_root and make sure no apps are installed twice to one location
+			if(in_array($postinput['main_domain'], $domains))
+			{
+				$docroot = $app->db->queryOneRecord("SELECT document_root FROM web_domain
                     WHERE domain = '".$app->db->quote($postinput['main_domain'])."';");
-                $new_path = $docroot['document_root'];
-                if(substr($new_path, -1) != '/') $new_path .= '/';
-                $new_path .= $main_location;
-                
-                // Get the $customerid which belongs to the selected domain
-                $customerid = $this->getCustomerIDFromDomain($postinput['main_domain']);
-                
-                // First get all domains used for an install, then their loop them
-                // and get the corresponding document roots as well as the defined
-                // locations. If an existing doc_root + location matches with the
-                // new one -> error
-                $instance_domains = $app->db->queryAllRecords("SELECT instance_id, s.value AS domain 
-                    FROM aps_instances AS i, aps_instances_settings AS s 
-                    WHERE i.id = s.instance_id AND s.name = 'main_domain' 
+				$new_path = $docroot['document_root'];
+				if(substr($new_path, -1) != '/') $new_path .= '/';
+				$new_path .= $main_location;
+
+				// Get the $customerid which belongs to the selected domain
+				$customerid = $this->getCustomerIDFromDomain($postinput['main_domain']);
+
+				// First get all domains used for an install, then their loop them
+				// and get the corresponding document roots as well as the defined
+				// locations. If an existing doc_root + location matches with the
+				// new one -> error
+				$instance_domains = $app->db->queryAllRecords("SELECT instance_id, s.value AS domain
+                    FROM aps_instances AS i, aps_instances_settings AS s
+                    WHERE i.id = s.instance_id AND s.name = 'main_domain'
                         AND i.customer_id = '".$app->db->quote($customerid)."';");
-                for($i = 0; $i < count($instance_domains); $i++)
-                {
-                    $used_path = '';
-                    
-                    $doc_root = $app->db->queryOneRecord("SELECT document_root FROM web_domain 
+				for($i = 0; $i < count($instance_domains); $i++)
+				{
+					$used_path = '';
+
+					$doc_root = $app->db->queryOneRecord("SELECT document_root FROM web_domain
                         WHERE domain = '".$app->db->quote($instance_domains[$i]['domain'])."';");
 
-                    // Probably the domain settings were changed later, so make sure the doc_root
-                    // is not empty for further validation
-                    if(!empty($doc_root))
-                    {
-                        $used_path = $doc_root['document_root'];
-                        if(substr($used_path, -1) != '/') $used_path .= '/';
-                        
-                        $location_for_domain = $app->db->queryOneRecord("SELECT value 
-                            FROM aps_instances_settings WHERE name = 'main_location' 
+					// Probably the domain settings were changed later, so make sure the doc_root
+					// is not empty for further validation
+					if(!empty($doc_root))
+					{
+						$used_path = $doc_root['document_root'];
+						if(substr($used_path, -1) != '/') $used_path .= '/';
+
+						$location_for_domain = $app->db->queryOneRecord("SELECT value
+                            FROM aps_instances_settings WHERE name = 'main_location'
                             AND instance_id = '".$app->db->quote($instance_domains[$i]['instance_id'])."';");
-                        
-                        // The location might be empty but the DB return must not be false!
-                        if($location_for_domain) $used_path .= $location_for_domain['value'];  						
-
-                        if($new_path == $used_path)
-                        {
-                            $temp_errstr = $app->lng('error_used_location');
-                            break;
-                        }
-                    }
-                }
-            }
-            else $temp_errstr = $app->lng('error_main_domain');
-            
-            if($temp_errstr == '') $input['main_location'] = htmlspecialchars($main_location);
-            else $error[] = $temp_errstr;            
-        }
-        else $error[] = $app->lng('error_no_main_location');
-        
-        // License (the checkbox must be set)
-        if(isset($pkg_details['License need agree']) 
-        && $pkg_details['License need agree'] == 'true')
-        {
-            if(isset($postinput['license']) && $postinput['license'] == 'on') $input['license'] = 'true';
-            else $error[] = $app->lng('error_license_agreement');
-        } 
-        
-        // Database
-        if(isset($pkg_details['Requirements Database'])
-        && $pkg_details['Requirements Database'] != '')
-        {
-            if(isset($postinput['main_database_password']))
-            {
-                if($postinput['main_database_password'] == '') $error[] = $app->lng('error_no_database_pw');
-                else if(strlen($postinput['main_database_password']) > 8) 
-                    $input['main_database_password'] = htmlspecialchars($postinput['main_database_password']);
-                else $error[] = $app->lng('error_short_database_pw');
-            }
-            else $error[] = $app->lng('error_no_database_pw');
-        }
-        
-        // Validate the package settings 
-        foreach($settings as $setting)
-        {
-            $temp_errstr = '';
-            $setting_id = strval($setting['SettingID']); 
-            
-            // We assume that every setting must be set
-            if((isset($postinput[$setting_id]) && ($postinput[$setting_id] != ''))
-            || ($setting['SettingType'] == 'boolean'))
-            {
-                if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password')
-                {
-                    if($app->functions->intval($setting['SettingMinLength'], true) != 0 
-                    && strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true))
-                        $temp_errstr = sprintf($app->lng('error_short_value_for'), $setting['setting_name']);
-                        
-                    if($app->functions->intval($setting['SettingMaxLength'], true) != 0 
-                    && strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true))
-                        $temp_errstr = sprintf($app->lng('error_long_value_for'), $setting['setting_name']);
-
-                    if(isset($setting['SettingRegex'])
-                    && !preg_match("/".$setting['SettingRegex']."/", $postinput[$setting_id]))
-                        $temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'email')
-                {
-                    if(filter_var(strtolower($postinput[$setting_id]), FILTER_VALIDATE_EMAIL) === false)
-                        $temp_errstr = sprintf($app->lng('error_inv_email_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'domain-name')
-                {
-                    if(!preg_match("^(http|https)\://([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\.\,\?\'\\\+&%\$#\=~_\-]+))*$", 
-                        $postinput[$setting_id]))
-                    $temp_errstr = sprintf($app->lng('error_inv_domain_for'), $setting['setting_name']);    
-                }
-                else if($setting['SettingType'] == 'integer')
-                {
-                    if(filter_var($postinput[$setting_id], FILTER_VALIDATE_INT) === false)
-                        $temp_errstr = sprintf($app->lng('error_inv_integer_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'float')
-                {
-                    if(filter_var($postinput[$setting_id], FILTER_VALIDATE_FLOAT) === false)
-                        $temp_errstr = sprintf($app->lng('error_inv_float_for'), $setting['setting_name']);
-                }
-                else if($setting['SettingType'] == 'boolean')
-                {
-                    // If we have a boolean value set, it must be either true or false
-                    if(!isset($postinput[$setting_id])) $postinput[$setting_id] = 'false';
-                    else if(isset($postinput[$setting_id]) && $postinput[$setting_id] != 'true') 
-                        $postinput[$setting_id] = 'true';
-                }
-                else if($setting['SettingType'] == 'enum')
-                {
-                    $found = false;
-                    for($i = 0; $i < count($setting['SettingChoices']); $i++)
-                    {
-                        if($setting['SettingChoices'][$i]['EnumID'] == $postinput[$setting_id])
-                            $found = true;
-                    }
-                    if(!$found) $temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['SettingName']);
-                }
-                
-                if($temp_errstr == '') $input[$setting_id] = $postinput[$setting_id];
-                else $error[] = $temp_errstr;
-            }
-            else $error[] = sprintf($app->lng('error_no_value_for'), $setting['SettingName']);
-        }
-        
-        $ret['input'] = $input;
-        $ret['error'] = array_unique($error);
-        
-        return $ret;
-    }
-    
-    /**
-     * Read the metadata of a package and returns some content
-     * 
-     * @param $id the internal ID of the package
-     * @return array
-     */
-    public function getPackageDetails($id)
-    {
-        global $app;
-        
-        $pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
-        
-        // Load in meta file if existing and register its namespaces
-        $metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
-        if(!file_exists($metafile)) 
-            return array('error' => 'The metafile for '.$pkg['name'].' couldn\'t be found');
-        
-        $metadata = file_get_contents($metafile);
-        $metadata = str_replace("xmlns=", "ns=", $metadata);
-        $sxe = new SimpleXMLElement($metadata);
-        $namespaces = $sxe->getDocNamespaces(true);
-        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url); 
-
-        $pkg['Summary'] = htmlspecialchars(parent::getXPathValue($sxe, '//summary'));
-        $pkg['Homepage'] = parent::getXPathValue($sxe, '//homepage');
-        $pkg['Description'] = nl2br(htmlspecialchars(trim(parent::getXPathValue($sxe, '//description'))));
-        $pkg['Config script'] = strtoupper(parent::getXPathValue($sxe, '//configuration-script-language'));
-        $installed_size = parent::getXPathValue($sxe, '//installed-size');
-        $pkg['Installed Size'] = (!empty($installed_size)) ? parent::convertSize((int)$installed_size) : '';        
-        
-        // License
-        $pkg['License need agree'] = parent::getXPathValue($sxe, '//license/@must-accept');
-        $pkg['License name'] = parent::getXPathValue($sxe, '//license/text/name'); // might be empty
-        $pkg['License type'] = 'file'; // default type
-        $pkg['License content'] = ''; // default license filename on local system
-        $license_url = parent::getXPathValue($sxe, '//license/text/url');
-        if(!empty($license_url)) 
-        {
-            $pkg['License type'] = 'url';
-            $pkg['License content'] = htmlspecialchars($license_url);
-        }
-        else
-        {
-            $lic = @file_get_contents($this->interface_pkg_dir.'/'.$pkg['path'].'/LICENSE');
-            $pkg['License content'] = htmlentities($lic, ENT_QUOTES, 'ISO-8859-1');
-        }  
-        
-        // Languages
-        $languages = parent::getXPathValue($sxe, '//languages/language', true);
-        $pkg['Languages'] = (is_array($languages)) ? implode(' ', $languages) : '';
-        
-        // Icon
-        $icon = parent::getXPathValue($sxe, '//icon/@path');
-        if(!empty($icon))
-        {
-            // Using parse_url() to filter malformed URLs
-            $path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
-                    basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$icon);
+
+						// The location might be empty but the DB return must not be false!
+						if($location_for_domain) $used_path .= $location_for_domain['value'];
+
+						if($new_path == $used_path)
+						{
+							$temp_errstr = $app->lng('error_used_location');
+							break;
+						}
+					}
+				}
+			}
+			else $temp_errstr = $app->lng('error_main_domain');
+
+			if($temp_errstr == '') $input['main_location'] = htmlspecialchars($main_location);
+			else $error[] = $temp_errstr;
+		}
+		else $error[] = $app->lng('error_no_main_location');
+
+		// License (the checkbox must be set)
+		if(isset($pkg_details['License need agree'])
+			&& $pkg_details['License need agree'] == 'true')
+		{
+			if(isset($postinput['license']) && $postinput['license'] == 'on') $input['license'] = 'true';
+			else $error[] = $app->lng('error_license_agreement');
+		}
+
+		// Database
+		if(isset($pkg_details['Requirements Database'])
+			&& $pkg_details['Requirements Database'] != '')
+		{
+			if(isset($postinput['main_database_password']))
+			{
+				if($postinput['main_database_password'] == '') $error[] = $app->lng('error_no_database_pw');
+				else if(strlen($postinput['main_database_password']) > 8)
+						$input['main_database_password'] = htmlspecialchars($postinput['main_database_password']);
+					else $error[] = $app->lng('error_short_database_pw');
+			}
+			else $error[] = $app->lng('error_no_database_pw');
+		}
+
+		// Validate the package settings
+		foreach($settings as $setting)
+		{
+			$temp_errstr = '';
+			$setting_id = strval($setting['SettingID']);
+
+			// We assume that every setting must be set
+			if((isset($postinput[$setting_id]) && ($postinput[$setting_id] != ''))
+				|| ($setting['SettingType'] == 'boolean'))
+			{
+				if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password')
+				{
+					if($app->functions->intval($setting['SettingMinLength'], true) != 0
+						&& strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true))
+						$temp_errstr = sprintf($app->lng('error_short_value_for'), $setting['setting_name']);
+
+					if($app->functions->intval($setting['SettingMaxLength'], true) != 0
+						&& strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true))
+						$temp_errstr = sprintf($app->lng('error_long_value_for'), $setting['setting_name']);
+
+					if(isset($setting['SettingRegex'])
+						&& !preg_match("/".$setting['SettingRegex']."/", $postinput[$setting_id]))
+						$temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['setting_name']);
+				}
+				else if($setting['SettingType'] == 'email')
+					{
+						if(filter_var(strtolower($postinput[$setting_id]), FILTER_VALIDATE_EMAIL) === false)
+							$temp_errstr = sprintf($app->lng('error_inv_email_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'domain-name')
+					{
+						if(!preg_match("^(http|https)\://([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\.\,\?\'\\\+&%\$#\=~_\-]+))*$",
+								$postinput[$setting_id]))
+							$temp_errstr = sprintf($app->lng('error_inv_domain_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'integer')
+					{
+						if(filter_var($postinput[$setting_id], FILTER_VALIDATE_INT) === false)
+							$temp_errstr = sprintf($app->lng('error_inv_integer_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'float')
+					{
+						if(filter_var($postinput[$setting_id], FILTER_VALIDATE_FLOAT) === false)
+							$temp_errstr = sprintf($app->lng('error_inv_float_for'), $setting['setting_name']);
+					}
+				else if($setting['SettingType'] == 'boolean')
+					{
+						// If we have a boolean value set, it must be either true or false
+						if(!isset($postinput[$setting_id])) $postinput[$setting_id] = 'false';
+						else if(isset($postinput[$setting_id]) && $postinput[$setting_id] != 'true')
+								$postinput[$setting_id] = 'true';
+					}
+				else if($setting['SettingType'] == 'enum')
+					{
+						$found = false;
+						for($i = 0; $i < count($setting['SettingChoices']); $i++)
+						{
+							if($setting['SettingChoices'][$i]['EnumID'] == $postinput[$setting_id])
+								$found = true;
+						}
+						if(!$found) $temp_errstr = sprintf($app->lng('error_inv_value_for'), $setting['SettingName']);
+					}
+
+				if($temp_errstr == '') $input[$setting_id] = $postinput[$setting_id];
+				else $error[] = $temp_errstr;
+			}
+			else $error[] = sprintf($app->lng('error_no_value_for'), $setting['SettingName']);
+		}
+
+		$ret['input'] = $input;
+		$ret['error'] = array_unique($error);
+
+		return $ret;
+	}
+
+
+
+	/**
+	 * Read the metadata of a package and returns some content
+	 *
+	 * @param $id the internal ID of the package
+	 * @return array
+	 */
+	public function getPackageDetails($id)
+	{
+		global $app;
+
+		$pkg = $app->db->queryOneRecord('SELECT * FROM aps_packages WHERE id = '.$app->db->quote($id).';');
+
+		// Load in meta file if existing and register its namespaces
+		$metafile = $this->interface_pkg_dir.'/'.$pkg['path'].'/APP-META.xml';
+		if(!file_exists($metafile))
+			return array('error' => 'The metafile for '.$pkg['name'].' couldn\'t be found');
+
+		$metadata = file_get_contents($metafile);
+		$metadata = str_replace("xmlns=", "ns=", $metadata);
+		$sxe = new SimpleXMLElement($metadata);
+		$namespaces = $sxe->getDocNamespaces(true);
+		foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+		$pkg['Summary'] = htmlspecialchars(parent::getXPathValue($sxe, '//summary'));
+		$pkg['Homepage'] = parent::getXPathValue($sxe, '//homepage');
+		$pkg['Description'] = nl2br(htmlspecialchars(trim(parent::getXPathValue($sxe, '//description'))));
+		$pkg['Config script'] = strtoupper(parent::getXPathValue($sxe, '//configuration-script-language'));
+		$installed_size = parent::getXPathValue($sxe, '//installed-size');
+		$pkg['Installed Size'] = (!empty($installed_size)) ? parent::convertSize((int)$installed_size) : '';
+
+		// License
+		$pkg['License need agree'] = parent::getXPathValue($sxe, '//license/@must-accept');
+		$pkg['License name'] = parent::getXPathValue($sxe, '//license/text/name'); // might be empty
+		$pkg['License type'] = 'file'; // default type
+		$pkg['License content'] = ''; // default license filename on local system
+		$license_url = parent::getXPathValue($sxe, '//license/text/url');
+		if(!empty($license_url))
+		{
+			$pkg['License type'] = 'url';
+			$pkg['License content'] = htmlspecialchars($license_url);
+		}
+		else
+		{
+			$lic = @file_get_contents($this->interface_pkg_dir.'/'.$pkg['path'].'/LICENSE');
+			$pkg['License content'] = htmlentities($lic, ENT_QUOTES, 'ISO-8859-1');
+		}
+
+		// Languages
+		$languages = parent::getXPathValue($sxe, '//languages/language', true);
+		$pkg['Languages'] = (is_array($languages)) ? implode(' ', $languages) : '';
+
+		// Icon
+		$icon = parent::getXPathValue($sxe, '//icon/@path');
+		if(!empty($icon))
+		{
+			// Using parse_url() to filter malformed URLs
+			$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
+				basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$icon);
 			// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
 			$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
-            $pkg['Icon'] = $path;
-        }
-        else $pkg['Icon'] = '';
-        
-        // Screenshots
-        $screenshots = parent::getXPathValue($sxe, '//screenshot', true);
-        if(!empty($screenshots))
-        {
-            foreach($screenshots as $screen)
-            {
-                // Using parse_url() to filter malformed URLs
-                $path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
-                        basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$screen['path']);
-				// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path		
+			$pkg['Icon'] = $path;
+		}
+		else $pkg['Icon'] = '';
+
+		// Screenshots
+		$screenshots = parent::getXPathValue($sxe, '//screenshot', true);
+		if(!empty($screenshots))
+		{
+			foreach($screenshots as $screen)
+			{
+				// Using parse_url() to filter malformed URLs
+				$path = dirname(parse_url($_SERVER['PHP_SELF'], PHP_URL_PATH)).'/'.
+					basename($this->interface_pkg_dir).'/'.$pkg['path'].'/'.basename((string)$screen['path']);
+				// nginx: if $_SERVER['PHP_SELF'] is doubled, remove /sites/aps_packagedetails_show.php from beginning of path
 				$path = preg_replace('@^/sites/aps_packagedetails_show.php(.*)@', '$1', $path);
 
-                $pkg['Screenshots'][] = array('ScreenPath' => $path,
-                                              'ScreenDescription' => htmlspecialchars(trim((string)$screen->description)));
-            }
-        }
-        else $pkg['Screenshots'] = ''; // if no screenshots are available, set the variable though
-                
-        // Changelog
-        $changelog = parent::getXPathValue($sxe, '//changelog/version', true);
-        if(!empty($changelog))
-        {
-            foreach($changelog as $change)
-            {
-                $entries = array(); 
-                foreach($change->entry as $entry) $entries[] = htmlspecialchars(trim((string)$entry)); 
-
-                $pkg['Changelog'][] = array('ChangelogVersion' => (string)$change['version'], 
-                                            'ChangelogDescription' => implode('<br />', $entries));
-            }
-        }
-		
-        else $pkg['Changelog'] = '';
-        
-        // PHP extensions
-        $php_extensions = parent::getXPathValue($sxe, '//php:extension', true);
-        $php_ext = '';
-        if(!empty($php_extensions))
-        {
-            foreach($php_extensions as $extension)
-            {
-                if(strtolower($extension) == 'php') continue;
-                $php_ext .= $extension.' ';
-            }
-        }
-        $pkg['Requirements PHP extensions'] = trim($php_ext);
-        
-        // PHP bool options
-        $pkg['Requirements PHP settings'] = '';
-        $php_bool_options = array('allow-url-fopen', 'file-uploads', 'magic-quotes-gpc', 
-                                  'register-globals', 'safe-mode', 'short-open-tag');
-        foreach($php_bool_options as $option)
-        {
-            $value = parent::getXPathValue($sxe, '//php:'.$option);
-            if(!empty($value))
-            {
-                $option = str_replace('-', '_', $option);
-                $value = str_replace(array('false', 'true'), array('off', 'on'), $value);
-                $pkg['Requirements PHP settings'][] = array('PHPSettingName' => $option,
-                                                            'PHPSettingValue' => $value);
-            }
-        }
-        
-        // PHP integer value settings
-        $memory_limit = parent::getXPathValue($sxe, '//php:memory-limit');
-        if(!empty($memory_limit))
-            $pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'memory_limit',
-                                                        'PHPSettingValue' => parent::convertSize((int)$memory_limit));
-
-        $max_exec_time = parent::getXPathValue($sxe, '//php:max-execution-time');
-        if(!empty($max_exec_time))
-            $pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'max-execution-time',
-                                                        'PHPSettingValue' => $max_exec_time);
-        
-        $post_max_size = parent::getXPathValue($sxe, '//php:post-max-size');
-        if(!empty($post_max_size))
-            $pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'post_max_size',
-                                                        'PHPSettingValue' => parent::convertSize((int)$post_max_size));
-        
-        // Get supported PHP versions
-        $pkg['Requirements Supported PHP versions'] = '';
-        $php_min_version = parent::getXPathValue($sxe, '//php:version/@min');
-        $php_max_not_including = parent::getXPathValue($sxe, '//php:version/@max-not-including');
-        if(!empty($php_min_version) && !empty($php_max_not_including)) 
-            $pkg['Requirements Supported PHP versions'] = $php_min_version.' - '.$php_max_not_including;
-        else if(!empty($php_min_version)) 
-            $pkg['Requirements Supported PHP versions'] = '> '.$php_min_version;
-        else if(!empty($php_max_not_including))
-            $pkg['Requirements Supported PHP versions'] = '< '.$php_min_version;
-        
-        // Database
-        $db_id = parent::getXPathValue($sxe, '//db:id');
-        $db_server_type = parent::getXPathValue($sxe, '//db:server-type');
-        $db_min_version = parent::getXPathValue($sxe, '//db:server-min-version'); 
-        if(!empty($db_id))
-        {
-            $db_server_type = str_replace('postgresql', 'PostgreSQL', $db_server_type);
-            $db_server_type = str_replace('microsoft:sqlserver', 'MSSQL', $db_server_type);
-            $db_server_type = str_replace('mysql', 'MySQL', $db_server_type);
-            
-            $pkg['Requirements Database'] = $db_server_type;
-            if(!empty($db_min_version)) $pkg['Requirements Database'] .= ' > '.$db_min_version;
-        }
-        else $pkg['Requirements Database'] = '';
-        
-        return $pkg;
-    }
+				$pkg['Screenshots'][] = array('ScreenPath' => $path,
+					'ScreenDescription' => htmlspecialchars(trim((string)$screen->description)));
+			}
+		}
+		else $pkg['Screenshots'] = ''; // if no screenshots are available, set the variable though
+
+		// Changelog
+		$changelog = parent::getXPathValue($sxe, '//changelog/version', true);
+		if(!empty($changelog))
+		{
+			foreach($changelog as $change)
+			{
+				$entries = array();
+				foreach($change->entry as $entry) $entries[] = htmlspecialchars(trim((string)$entry));
+
+				$pkg['Changelog'][] = array('ChangelogVersion' => (string)$change['version'],
+					'ChangelogDescription' => implode('<br />', $entries));
+			}
+		}
+
+		else $pkg['Changelog'] = '';
+
+		// PHP extensions
+		$php_extensions = parent::getXPathValue($sxe, '//php:extension', true);
+		$php_ext = '';
+		if(!empty($php_extensions))
+		{
+			foreach($php_extensions as $extension)
+			{
+				if(strtolower($extension) == 'php') continue;
+				$php_ext .= $extension.' ';
+			}
+		}
+		$pkg['Requirements PHP extensions'] = trim($php_ext);
+
+		// PHP bool options
+		$pkg['Requirements PHP settings'] = '';
+		$php_bool_options = array('allow-url-fopen', 'file-uploads', 'magic-quotes-gpc',
+			'register-globals', 'safe-mode', 'short-open-tag');
+		foreach($php_bool_options as $option)
+		{
+			$value = parent::getXPathValue($sxe, '//php:'.$option);
+			if(!empty($value))
+			{
+				$option = str_replace('-', '_', $option);
+				$value = str_replace(array('false', 'true'), array('off', 'on'), $value);
+				$pkg['Requirements PHP settings'][] = array('PHPSettingName' => $option,
+					'PHPSettingValue' => $value);
+			}
+		}
+
+		// PHP integer value settings
+		$memory_limit = parent::getXPathValue($sxe, '//php:memory-limit');
+		if(!empty($memory_limit))
+			$pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'memory_limit',
+				'PHPSettingValue' => parent::convertSize((int)$memory_limit));
+
+		$max_exec_time = parent::getXPathValue($sxe, '//php:max-execution-time');
+		if(!empty($max_exec_time))
+			$pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'max-execution-time',
+				'PHPSettingValue' => $max_exec_time);
+
+		$post_max_size = parent::getXPathValue($sxe, '//php:post-max-size');
+		if(!empty($post_max_size))
+			$pkg['Requirements PHP settings'][] = array('PHPSettingName' => 'post_max_size',
+				'PHPSettingValue' => parent::convertSize((int)$post_max_size));
+
+		// Get supported PHP versions
+		$pkg['Requirements Supported PHP versions'] = '';
+		$php_min_version = parent::getXPathValue($sxe, '//php:version/@min');
+		$php_max_not_including = parent::getXPathValue($sxe, '//php:version/@max-not-including');
+		if(!empty($php_min_version) && !empty($php_max_not_including))
+			$pkg['Requirements Supported PHP versions'] = $php_min_version.' - '.$php_max_not_including;
+		else if(!empty($php_min_version))
+				$pkg['Requirements Supported PHP versions'] = '> '.$php_min_version;
+			else if(!empty($php_max_not_including))
+					$pkg['Requirements Supported PHP versions'] = '< '.$php_min_version;
+
+				// Database
+				$db_id = parent::getXPathValue($sxe, '//db:id');
+			$db_server_type = parent::getXPathValue($sxe, '//db:server-type');
+		$db_min_version = parent::getXPathValue($sxe, '//db:server-min-version');
+		if(!empty($db_id))
+		{
+			$db_server_type = str_replace('postgresql', 'PostgreSQL', $db_server_type);
+			$db_server_type = str_replace('microsoft:sqlserver', 'MSSQL', $db_server_type);
+			$db_server_type = str_replace('mysql', 'MySQL', $db_server_type);
+
+			$pkg['Requirements Database'] = $db_server_type;
+			if(!empty($db_min_version)) $pkg['Requirements Database'] .= ' > '.$db_min_version;
+		}
+		else $pkg['Requirements Database'] = '';
+
+		return $pkg;
+	}
+
 }
+
 ?>
diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php
index 50d49503e2f224f5fa00e4ce49a7c174822b6853..96e30b4da6cd671ab66569b2c858bb6951e2256e 100644
--- a/interface/lib/classes/auth.inc.php
+++ b/interface/lib/classes/auth.inc.php
@@ -35,18 +35,18 @@ class auth {
 	{
 		return $_SESSION['s']['user']['userid'];
 	}
-	
+
 	public function is_admin() {
 		if($_SESSION['s']['user']['typ'] == 'admin') {
 			return true;
 		} else {
 			return false;
 		}
-	}	
-	
+	}
+
 	public function has_clients($userid) {
 		global $app, $conf;
-		
+
 		$userid = $app->functions->intval($userid);
 		$client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
 		if($client['limit_client'] > 0) {
@@ -55,19 +55,19 @@ class auth {
 			return false;
 		}
 	}
-	
+
 	//** This function adds a given group id to a given user.
-	public function add_group_to_user($userid,$groupid) {
+	public function add_group_to_user($userid, $groupid) {
 		global $app;
-		
+
 		$userid = $app->functions->intval($userid);
 		$groupid = $app->functions->intval($groupid);
-		
+
 		if($userid > 0 && $groupid > 0) {
 			$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid");
-			$groups = explode(',',$user['groups']);
-			if(!in_array($groupid,$groups)) $groups[] = $groupid;
-			$groups_string = implode(',',$groups);
+			$groups = explode(',', $user['groups']);
+			if(!in_array($groupid, $groups)) $groups[] = $groupid;
+			$groups_string = implode(',', $groups);
 			$sql = "UPDATE sys_user SET groups = '$groups_string' WHERE userid = $userid";
 			$app->db->query($sql);
 			return true;
@@ -80,33 +80,33 @@ class auth {
 	public function get_client_limit($userid, $limitname)
 	{
 		global $app;
-		
+
 		// simple query cache
-		if($this->client_limits===null) 
+		if($this->client_limits===null)
 			$this->client_limits = $app->db->queryOneRecord("SELECT client.* FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id");
-		
+
 		// isn't client -> no limit
 		if(!$this->client_limits)
 			return -1;
-		
+
 		if(isset($this->client_limits['limit_'.$limitname])) {
 			return $this->client_limits['limit_'.$limitname];
-		}		
-	}	
-	
+		}
+	}
+
 	//** This function removes a given group id from a given user.
-	public function remove_group_from_user($userid,$groupid) {
+	public function remove_group_from_user($userid, $groupid) {
 		global $app;
-		
+
 		$userid = $app->functions->intval($userid);
 		$groupid = $app->functions->intval($groupid);
-		
+
 		if($userid > 0 && $groupid > 0) {
 			$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid");
-			$groups = explode(',',$user['groups']);
-			$key = array_search($groupid,$groups);
+			$groups = explode(',', $user['groups']);
+			$key = array_search($groupid, $groups);
 			unset($groups[$key]);
-			$groups_string = implode(',',$groups);
+			$groups_string = implode(',', $groups);
 			$sql = "UPDATE sys_user SET groups = '$groups_string' WHERE userid = $userid";
 			$app->db->query($sql);
 			return true;
@@ -114,35 +114,35 @@ class auth {
 			return false;
 		}
 	}
-	
+
 	public function check_module_permissions($module) {
 		// Check if the current user has the permissions to access this module
-		if(!stristr($_SESSION["s"]["user"]["modules"],$module)) {
+		if(!stristr($_SESSION["s"]["user"]["modules"], $module)) {
 			// echo "LOGIN_REDIRECT:/index.php";
 			header("Location: /index.php");
 			exit;
 		}
 	}
-	
+
 	public function get_random_password($length = 8) {
 		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 		$password = '';
 		for ($n=0;$n<$length;$n++) {
-			$password.=$base64_alphabet[mt_rand(0,63)];
+			$password.=$base64_alphabet[mt_rand(0, 63)];
 		}
 		return $password;
 	}
-	
+
 	public function crypt_password($cleartext_password) {
 		$salt="$1$";
 		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 		for ($n=0;$n<8;$n++) {
-			$salt.=$base64_alphabet[mt_rand(0,63)];
+			$salt.=$base64_alphabet[mt_rand(0, 63)];
 		}
 		$salt.="$";
-		return crypt($cleartext_password,$salt);
+		return crypt($cleartext_password, $salt);
 	}
-		
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php
index cdd9ea952ba25ab5291c19c1ea1ea4b428675d29..77f6af5642dd0f823c834d9de80383a314bcf4c2 100644
--- a/interface/lib/classes/client_templates.inc.php
+++ b/interface/lib/classes/client_templates.inc.php
@@ -1,236 +1,239 @@
 <?php
 /**
  * client_templates
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG
  * @author (original tools.inc.php) Till Brehm, projektfarm Gmbh
  * @author (original tools.inc.php) Oliver Vogel www.muv.com
  */
- 
+
+
 class client_templates {
 
-    /** 
-     *  - check for old-style templates and change to new style
-     *  - update assigned templates
-     */
+
+	/**
+	 *  - check for old-style templates and change to new style
+	 *  - update assigned templates
+	 */
 	function update_client_templates($clientId, $templates = array()) {
-        global $app, $conf;
-        
-        if(!is_array($templates)) return false;
-        
-        $new_tpl = array();
-        $used_assigned = array();
-        $needed_types = array();
-        $old_style = true;
-        foreach($templates as $item) {
-            $item = trim($item);
-            if($item == '') continue;
-            
-            $tpl_id = 0;
-            $assigned_id = 0;
-            if(strpos($item, ':') === false) {
-                $tpl_id = $item;
-            } else {
-                $old_style = false; // has new-style assigns
-                list($assigned_id, $tpl_id) = explode(':', $item, 2);
-                if(substr($assigned_id, 0, 1) === 'n') $assigned_id = 0; // newly inserted items
-            }
-            if(array_key_exists($tpl_id, $needed_types) == false) $needed_types[$tpl_id] = 0;
-            $needed_types[$tpl_id]++;
-            
-            if($assigned_id > 0) {
-                $used_assigned[] = $assigned_id; // for comparison with database
-            } else {
-                $new_tpl[] = $tpl_id;
-            }
-        }
-        
-        if($old_style == true) {
-            // we have to take care of this in an other way
-            $in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
-            if(is_array($in_db) && count($in_db) > 0) {
-                foreach($in_db as $item) {
-                    if(array_key_exists($item['client_template_id'], $needed_types) == false) $needed_types[$item['client_template_id']] = 0;
-                    $needed_types[$item['client_template_id']]--;
-                }
-            }
-            
-            foreach($needed_types as $tpl_id => $count) {
-                if($count > 0) {
-                    // add new template to client (includes those from old-style without assigned_template_id)
-                    for($i = $count; $i > 0; $i--) {
-                        $app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $tpl_id . ')');
-                    }
-                } elseif($count < 0) {
-                    // remove old ones
-                    for($i = $count; $i < 0; $i++) {
-                        $app->db->query('DELETE FROM `client_template_assigned` WHERE client_id = ' . $clientId . ' AND client_template_id = ' . $tpl_id . ' LIMIT 1');
-                    }
-                }
-            }
-        } else {
-            // we have to take care of this in an other way
-            $in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
-            if(is_array($in_db) && count($in_db) > 0) {
-                // check which templates were removed from this client
-                foreach($in_db as $item) {
-                    if(in_array($item['assigned_template_id'], $used_assigned) == false) {
-                        // delete this one
-                        $app->db->query('DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $item['assigned_template_id']);
-                    }
-                }
-            }
-            
-            if(count($new_tpl) > 0) {
-                foreach($new_tpl as $item) {
-                    // add new template to client (includes those from old-style without assigned_template_id)
-                    $app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $item . ')');
-                }
-            }
-        }
-        
-        unset($new_tpl);
-        unset($in_db);
-        unset($templates);
-        unset($used_assigned);
-        return true;
-    }
-    
-    function apply_client_templates($clientId) {
-        global $app;
-        
-        include('../client/form/client.tform.php');
-        
-        /*
+		global $app, $conf;
+
+		if(!is_array($templates)) return false;
+
+		$new_tpl = array();
+		$used_assigned = array();
+		$needed_types = array();
+		$old_style = true;
+		foreach($templates as $item) {
+			$item = trim($item);
+			if($item == '') continue;
+
+			$tpl_id = 0;
+			$assigned_id = 0;
+			if(strpos($item, ':') === false) {
+				$tpl_id = $item;
+			} else {
+				$old_style = false; // has new-style assigns
+				list($assigned_id, $tpl_id) = explode(':', $item, 2);
+				if(substr($assigned_id, 0, 1) === 'n') $assigned_id = 0; // newly inserted items
+			}
+			if(array_key_exists($tpl_id, $needed_types) == false) $needed_types[$tpl_id] = 0;
+			$needed_types[$tpl_id]++;
+
+			if($assigned_id > 0) {
+				$used_assigned[] = $assigned_id; // for comparison with database
+			} else {
+				$new_tpl[] = $tpl_id;
+			}
+		}
+
+		if($old_style == true) {
+			// we have to take care of this in an other way
+			$in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
+			if(is_array($in_db) && count($in_db) > 0) {
+				foreach($in_db as $item) {
+					if(array_key_exists($item['client_template_id'], $needed_types) == false) $needed_types[$item['client_template_id']] = 0;
+					$needed_types[$item['client_template_id']]--;
+				}
+			}
+
+			foreach($needed_types as $tpl_id => $count) {
+				if($count > 0) {
+					// add new template to client (includes those from old-style without assigned_template_id)
+					for($i = $count; $i > 0; $i--) {
+						$app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $tpl_id . ')');
+					}
+				} elseif($count < 0) {
+					// remove old ones
+					for($i = $count; $i < 0; $i++) {
+						$app->db->query('DELETE FROM `client_template_assigned` WHERE client_id = ' . $clientId . ' AND client_template_id = ' . $tpl_id . ' LIMIT 1');
+					}
+				}
+			}
+		} else {
+			// we have to take care of this in an other way
+			$in_db = $app->db->queryAllRecords('SELECT `assigned_template_id`, `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $clientId);
+			if(is_array($in_db) && count($in_db) > 0) {
+				// check which templates were removed from this client
+				foreach($in_db as $item) {
+					if(in_array($item['assigned_template_id'], $used_assigned) == false) {
+						// delete this one
+						$app->db->query('DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $item['assigned_template_id']);
+					}
+				}
+			}
+
+			if(count($new_tpl) > 0) {
+				foreach($new_tpl as $item) {
+					// add new template to client (includes those from old-style without assigned_template_id)
+					$app->db->query('INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (' . $clientId . ', ' . $item . ')');
+				}
+			}
+		}
+
+		unset($new_tpl);
+		unset($in_db);
+		unset($templates);
+		unset($used_assigned);
+		return true;
+	}
+
+	function apply_client_templates($clientId) {
+		global $app;
+
+		include '../client/form/client.tform.php';
+
+		/*
          * Get the master-template for the client
          */
-        $sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId);
-        $record = $app->db->queryOneRecord($sql);
-        $masterTemplateId = $record['template_master'];
-        
-        if($record['template_additional'] != '') {
-            // we have to call the update_client_templates function
-            $templates = explode('/', $record['template_additional']);
-            $this->update_client_templates($clientId, $templates);
-            $app->db->query('UPDATE `client` SET `template_additional` = \'\' WHERE `client_id` = ' . $app->functions->intval($clientId));
-        }
-        
-        /*
+		$sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId);
+		$record = $app->db->queryOneRecord($sql);
+		$masterTemplateId = $record['template_master'];
+
+		if($record['template_additional'] != '') {
+			// we have to call the update_client_templates function
+			$templates = explode('/', $record['template_additional']);
+			$this->update_client_templates($clientId, $templates);
+			$app->db->query('UPDATE `client` SET `template_additional` = \'\' WHERE `client_id` = ' . $app->functions->intval($clientId));
+		}
+
+		/*
          * if the master-Template is custom there is NO changing
          */
-        if ($masterTemplateId > 0){
-            $sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($masterTemplateId);
-            $limits = $app->db->queryOneRecord($sql);
-        } else {
-            // if there is no master template it makes NO SENSE adding sub templates.
-            // adding subtemplates are stored in client limits, so they would add up
-            // on every save action for the client -> too high limits!
-            return;
-        }
-
-        /*
+		if ($masterTemplateId > 0){
+			$sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($masterTemplateId);
+			$limits = $app->db->queryOneRecord($sql);
+		} else {
+			// if there is no master template it makes NO SENSE adding sub templates.
+			// adding subtemplates are stored in client limits, so they would add up
+			// on every save action for the client -> too high limits!
+			return;
+		}
+
+		/*
          * Process the additional tempaltes here (add them to the limits
          * if != -1)
          */
-        $addTpl = explode('/', $additionalTemplateStr);
-        $addTpls = $app->db->queryAllRecords('SELECT `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $app->functions->intval($clientId));
-        foreach ($addTpls as $addTpl){
-            $item = $addTpl['client_template_id'];
-            $sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($item);
-            $addLimits = $app->db->queryOneRecord($sql);
-            $app->log('Template processing subtemplate ' . $item . ' for client ' . $clientId, LOGLEVEL_DEBUG);
-            /* maybe the template is deleted in the meantime */
-            if (is_array($addLimits)){
-                foreach($addLimits as $k => $v){
-                    /* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
-                    if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
-                        $app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);
-
-                        /* process the numerical limits */
-                        if (is_numeric($v)){
-                            /* switch for special cases */
-                            switch ($k){
-                            case 'limit_cron_frequency':
-                                if ($v < $limits[$k]) $limits[$k] = $v;
-                                /* silent adjustment of the minimum cron frequency to 1 minute */
-                                /* maybe this control test should be done via validator definition in tform.php file, but I don't know how */
-                                if ($limits[$k] < 1) $limits[$k] = 1;
-                            break;
-
-                            default:
-                                if ($limits[$k] > -1){
-                                    if ($v == -1){
-                                        $limits[$k] = -1;
-                                    }
-                                    else {
-                                        $limits[$k] += $v;
-                                    }
-                                }
-                            }
-                        }
-                        /* process the string limits (CHECKBOXARRAY, SELECT etc.) */
-                        elseif (is_string($v)){
-                            switch ($form["tabs"]["limits"]["fields"][$k]['formtype']){
-                            case 'CHECKBOXARRAY':
-                                if (!isset($limits[$k])){
-                                    $limits[$k] = array();
-                                }
-
-                                $limits_values = $limits[$k];
-                                if (is_string($limits[$k])){
-                                    $limits_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"],$limits[$k]);
-                                }
-                                $additional_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"],$v);
-                                $app->log('Template processing key ' . $k . ' type CHECKBOXARRAY, lim / add: ' . implode(',', $limits_values) . ' / ' . implode(',', $additional_values) . ' for client ' . $clientId, LOGLEVEL_DEBUG);
-                                /* unification of limits_values (master template) and additional_values (additional template) */
-                                $limits_unified = array();
-                                foreach($form["tabs"]["limits"]["fields"][$k]["value"] as $key => $val){
-                                    if (in_array($key,$limits_values) || in_array($key,$additional_values)) $limits_unified[] = $key;
-                                }
-                                $limits[$k] = implode($form["tabs"]["limits"]["fields"][$k]["separator"],$limits_unified);
-                            break;
-                            case 'CHECKBOX':
-                                if($k == 'force_suexec') {
-                                    // 'n' is less limited than y
-                                    if (!isset($limits[$k])){
-                                        $limits[$k] = 'y';
-                                    }
-                                    if($limits[$k] == 'n' || $v == 'n') $limits[$k] = 'n';
-                                } else {
-                                    // 'y' is less limited than n
-                                    if (!isset($limits[$k])){
-                                        $limits[$k] = 'n';
-                                    }
-                                    if($limits[$k] == 'y' || $v == 'y') $limits[$k] = 'y';
-                                }
-                            break;
-                            case 'SELECT':
-                                $limit_values = array_keys($form["tabs"]["limits"]["fields"][$k]["value"]);
-                                /* choose the lower index of the two SELECT items */
-                                $limits[$k] = $limit_values[min(array_search($limits[$k], $limit_values), array_search($v, $limit_values))];
-                            break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        /*
+		$addTpl = explode('/', $additionalTemplateStr);
+		$addTpls = $app->db->queryAllRecords('SELECT `client_template_id` FROM `client_template_assigned` WHERE `client_id` = ' . $app->functions->intval($clientId));
+		foreach ($addTpls as $addTpl){
+			$item = $addTpl['client_template_id'];
+			$sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($item);
+			$addLimits = $app->db->queryOneRecord($sql);
+			$app->log('Template processing subtemplate ' . $item . ' for client ' . $clientId, LOGLEVEL_DEBUG);
+			/* maybe the template is deleted in the meantime */
+			if (is_array($addLimits)){
+				foreach($addLimits as $k => $v){
+					/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
+					if (strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec'){
+						$app->log('Template processing key ' . $k . ' for client ' . $clientId, LOGLEVEL_DEBUG);
+
+						/* process the numerical limits */
+						if (is_numeric($v)){
+							/* switch for special cases */
+							switch ($k){
+							case 'limit_cron_frequency':
+								if ($v < $limits[$k]) $limits[$k] = $v;
+								/* silent adjustment of the minimum cron frequency to 1 minute */
+								/* maybe this control test should be done via validator definition in tform.php file, but I don't know how */
+								if ($limits[$k] < 1) $limits[$k] = 1;
+								break;
+
+							default:
+								if ($limits[$k] > -1){
+									if ($v == -1){
+										$limits[$k] = -1;
+									}
+									else {
+										$limits[$k] += $v;
+									}
+								}
+							}
+						}
+						/* process the string limits (CHECKBOXARRAY, SELECT etc.) */
+						elseif (is_string($v)){
+							switch ($form["tabs"]["limits"]["fields"][$k]['formtype']){
+							case 'CHECKBOXARRAY':
+								if (!isset($limits[$k])){
+									$limits[$k] = array();
+								}
+
+								$limits_values = $limits[$k];
+								if (is_string($limits[$k])){
+									$limits_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"], $limits[$k]);
+								}
+								$additional_values = explode($form["tabs"]["limits"]["fields"][$k]["separator"], $v);
+								$app->log('Template processing key ' . $k . ' type CHECKBOXARRAY, lim / add: ' . implode(',', $limits_values) . ' / ' . implode(',', $additional_values) . ' for client ' . $clientId, LOGLEVEL_DEBUG);
+								/* unification of limits_values (master template) and additional_values (additional template) */
+								$limits_unified = array();
+								foreach($form["tabs"]["limits"]["fields"][$k]["value"] as $key => $val){
+									if (in_array($key, $limits_values) || in_array($key, $additional_values)) $limits_unified[] = $key;
+								}
+								$limits[$k] = implode($form["tabs"]["limits"]["fields"][$k]["separator"], $limits_unified);
+								break;
+							case 'CHECKBOX':
+								if($k == 'force_suexec') {
+									// 'n' is less limited than y
+									if (!isset($limits[$k])){
+										$limits[$k] = 'y';
+									}
+									if($limits[$k] == 'n' || $v == 'n') $limits[$k] = 'n';
+								} else {
+									// 'y' is less limited than n
+									if (!isset($limits[$k])){
+										$limits[$k] = 'n';
+									}
+									if($limits[$k] == 'y' || $v == 'y') $limits[$k] = 'y';
+								}
+								break;
+							case 'SELECT':
+								$limit_values = array_keys($form["tabs"]["limits"]["fields"][$k]["value"]);
+								/* choose the lower index of the two SELECT items */
+								$limits[$k] = $limit_values[min(array_search($limits[$k], $limit_values), array_search($v, $limit_values))];
+								break;
+							}
+						}
+					}
+				}
+			}
+		}
+
+		/*
          * Write all back to the database
          */
-        $update = '';
-        foreach($limits as $k => $v){
-            if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
-                if ($update != '') $update .= ', ';
-                $update .= '`' . $k . "`='" . $v . "'";
-            }
-        }
-        $app->log('Template processed for client ' . $clientId . ', update string: ' . $update, LOGLEVEL_DEBUG);
-        if($update != '') {
-            $sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . $app->functions->intval($clientId);
-            $app->db->query($sql);
-        }
-        unset($form);
-    }
-}
\ No newline at end of file
+		$update = '';
+		foreach($limits as $k => $v){
+			if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
+				if ($update != '') $update .= ', ';
+				$update .= '`' . $k . "`='" . $v . "'";
+			}
+		}
+		$app->log('Template processed for client ' . $clientId . ', update string: ' . $update, LOGLEVEL_DEBUG);
+		if($update != '') {
+			$sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . $app->functions->intval($clientId);
+			$app->db->query($sql);
+		}
+		unset($form);
+	}
+
+}
diff --git a/interface/lib/classes/cmstree.inc.php b/interface/lib/classes/cmstree.inc.php
index d83fb297e50c81dbfce1826aa3a52b35881fc5b9..ead780ebf26c65fd01d97a10a5f0f640ca54e9be 100644
--- a/interface/lib/classes/cmstree.inc.php
+++ b/interface/lib/classes/cmstree.inc.php
@@ -48,13 +48,13 @@ class cmstree
     // - icon       :icon im node-tree, optional
     // - modul      :modul des Eintrages, noch nicht verwendet
     // - doc_id     :id des zugeh�rigen Dokumentes
-    
+
     public function node_list()
     {
         global $app;
-    
+
 	    $nodes = $app->db->queryAllRecords('SELECT * FROM media_cat order by sort, name');
-        
+
         $optionlist = array();
         $my0 = new nodetree();
 
@@ -74,11 +74,11 @@ class cmstree
                 $$ordner->childs[] = &$$id;
             }
         }
-       
-        $this->ptree($my0, 0, $optionlist);       
+
+        $this->ptree($my0, 0, $optionlist);
         return is_array($nodes) ?  $optionlist : false;
     }
-    
+
     private function ptree($myobj, $tiefe, &$optionlist){
      	global $_SESSION;
 		$tiefe += 1;
@@ -87,7 +87,7 @@ class cmstree
         if(is_array($myobj->childs) and ($_SESSION['s']['cat_open'][$id] == 1 or $tiefe <= 1)) {
         	foreach($myobj->childs as $val) {
 				// kategorie 		=> str_repeat('- &nbsp;',$tiefe) . $val->btext,
-				
+
 				// Ergebnisse Formatieren
 				/*
 				if($tiefe == 0) {
@@ -104,7 +104,7 @@ class cmstree
 				} else {
 					$kategorie = "<div class='mnuLevel".$tiefe."'>&nbsp; <a href='treenavi.php?kat=".$val->id."' class='navtext' onclick=\"parent.content.location='media_list.php?search_media_cat_id=".$val->id."'\" style=\"text-decoration: none;\"><img src='../themes/default/icons/folder_closed.png' border='0'> ".$val->btext."</a></div>";
 				}
-				
+
 				$optionlist[] = array( 	media_cat 		=> $kategorie,
                                    		media_cat_id 	=> $val->id,
 										depth			=> $tiefe);
@@ -114,4 +114,4 @@ class cmstree
     }
 
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/custom_datasource.inc.php b/interface/lib/classes/custom_datasource.inc.php
index 44fee19d9171cd26b846ccbcf36c852f962d91a6..fda355cfcd8076b3af89b38eccc43febcee39b20 100644
--- a/interface/lib/classes/custom_datasource.inc.php
+++ b/interface/lib/classes/custom_datasource.inc.php
@@ -29,7 +29,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class custom_datasource {
-	
+
 	function master_templates($field, $record) {
 		global $app, $conf;
 		$records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m'");
@@ -40,10 +40,10 @@ class custom_datasource {
 		}
 		return $records_new;
 	}
-	
+
 	function dns_servers($field, $record) {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -62,10 +62,10 @@ class custom_datasource {
 		}
 		return $records_new;
 	}
-	
+
 	function slave_dns_servers($field, $record) {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -84,10 +84,10 @@ class custom_datasource {
 		}
 		return $records_new;
 	}
-	
+
 	function webdav_domains($field, $record) {
 		global $app, $conf;
-		
+
 		$servers = $app->db->queryAllRecords("SELECT * FROM server WHERE active = 1 AND mirror_server_id = 0");
 		$server_ids = array();
 		$app->uses('getconf');
@@ -100,7 +100,7 @@ class custom_datasource {
 		if(count($server_ids) == 0) return array();
 		$server_ids = implode(',', $server_ids);
 		$records = $app->db->queryAllRecords("SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id IN (".$server_ids.") AND web_domain.server_id = server.server_id AND ".$app->tform->getAuthSQL('r', 'web_domain')." ORDER BY web_domain.domain");
-		
+
 		$records_new = array();
 		if(is_array($records)) {
 			foreach($records as $rec) {
@@ -110,40 +110,40 @@ class custom_datasource {
 		}
 		return $records_new;
 	}
-	
-	
+
+
 	function client_servers($field, $record) {
 		global $app, $conf;
-		
+
 		$server_type = $field['name'];
-		
+
 		switch($server_type) {
-			case 'default_mailserver':
-				$field = 'mail_server';
+		case 'default_mailserver':
+			$field = 'mail_server';
 			break;
-			case 'default_webserver':
-				$field = 'web_server';
+		case 'default_webserver':
+			$field = 'web_server';
 			break;
-			case 'default_dnsserver':
-				$field = 'dns_server';
+		case 'default_dnsserver':
+			$field = 'dns_server';
 			break;
-			case 'default_slave_dnsserver':
-				$field = 'dns_server';
+		case 'default_slave_dnsserver':
+			$field = 'dns_server';
 			break;
-			case 'default_fileserver':
-				$field = 'file_server';
+		case 'default_fileserver':
+			$field = 'file_server';
 			break;
-			case 'default_dbserver':
-				$field = 'db_server';
+		case 'default_dbserver':
+			$field = 'db_server';
 			break;
-			case 'default_vserverserver':
-				$field = 'vserver_server';
+		case 'default_vserverserver':
+			$field = 'vserver_server';
 			break;
-			default:
-				$field = 'web_server';
+		default:
+			$field = 'web_server';
 			break;
 		}
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -154,14 +154,14 @@ class custom_datasource {
 				$sql = "SELECT server_id,server_name FROM server WHERE server_id = ".$client['server_id'];
 			} else {
 				//* Not able to find the clients defaults, use this as fallback and add a warning message to the log
-				$app->log('Unable to find default server for client in custom_datasource.inc.php',1);
+				$app->log('Unable to find default server for client in custom_datasource.inc.php', 1);
 				$sql = "SELECT server_id,server_name FROM server WHERE $field = 1 ORDER BY server_name";
 			}
 		} else {
 			//* The logged in user is admin, so we show him all available servers of a specific type.
 			$sql = "SELECT server_id,server_name FROM server WHERE $field = 1 ORDER BY server_name";
 		}
-		
+
 		$records = $app->db->queryAllRecords($sql);
 		$records_new = array();
 		if(is_array($records)) {
@@ -172,9 +172,9 @@ class custom_datasource {
 		}
 		return $records_new;
 	}
-	
-	
+
+
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/db_firebird.inc.php b/interface/lib/classes/db_firebird.inc.php
index 883e7ba0e87b9429f7842b69fa06d620a731f944..fda4ef8e64081c954c12a0fa5cb000e2c0242270 100644
--- a/interface/lib/classes/db_firebird.inc.php
+++ b/interface/lib/classes/db_firebird.inc.php
@@ -29,17 +29,17 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class db {
-	var $dbHost = "";		// hostname of the MySQL server
-	var $dbName = "";		// logical database name on that server
-	var $dbUser = "";		// database authorized user
-	var $dbPass = "";		// user's password
-	var $linkId = 0;		// last result of mysql_connect()
-	var $queryId = 0;		// last result of mysql_query()
-	var $record	= array();	// last record fetched
-    var $autoCommit = 1;    // Autocommit Transactions
-	var $currentRow;		// current row number
-	var $errorNumber = 0;	// last error number
-	var $errorMessage = "";	// last error message
+	var $dbHost = "";  // hostname of the MySQL server
+	var $dbName = "";  // logical database name on that server
+	var $dbUser = "";  // database authorized user
+	var $dbPass = "";  // user's password
+	var $linkId = 0;  // last result of mysql_connect()
+	var $queryId = 0;  // last result of mysql_query()
+	var $record = array(); // last record fetched
+	var $autoCommit = 1;    // Autocommit Transactions
+	var $currentRow;  // current row number
+	var $errorNumber = 0; // last error number
+	var $errorMessage = ""; // last error message
 	var $errorLocation = "";// last error location
 	var $show_error_messages = false;
 	var $transID;
@@ -47,7 +47,7 @@ class db {
 	// constructor
 	function __construct()
 	{
-		
+
 		global $conf;
 		$this->dbHost = $conf["db_host"];
 		$this->dbName = $conf["db_database"];
@@ -55,9 +55,10 @@ class db {
 		$this->dbPass = $conf["db_password"];
 		$this->connect();
 	}
+
 	function __destruct() {
 		$this->closeConn();
-        }
+	}
 
 	// error handler
 	function updateError($location)
@@ -67,7 +68,7 @@ class db {
 		$this->errorLocation = $location;
 		if($this->errorNumber && $this->show_error_messages)
 		{
-			echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
+			echo '<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage;
 			flush();
 		}
 	}
@@ -76,7 +77,7 @@ class db {
 	{
 		if($this->linkId == 0)
 		{
-			$this->linkId = ibase_connect( $this->dbHost.":".$this->dbName , $this->dbUser, $this->dbPass,'ISO8859_1',0,3 );
+			$this->linkId = ibase_connect( $this->dbHost.":".$this->dbName , $this->dbUser, $this->dbPass, 'ISO8859_1', 0, 3 );
 			if(!$this->linkId)
 			{
 				$this->updateError('DB::connect()<br />ibase_pconnect');
@@ -91,16 +92,16 @@ class db {
 		if(!$this->connect()) {
 			return false;
 		}
-		
+
 		if($this->autoCommit == 1) {
 			//$transID = ibase_trans();
-			$this->queryId = @ibase_query($this->linkId,$queryString);
+			$this->queryId = @ibase_query($this->linkId, $queryString);
 			//ibase_commit();
 		} else {
-			$this->queryId = @ibase_query($this->linkId,$queryString);
+			$this->queryId = @ibase_query($this->linkId, $queryString);
 		}
-		
-		
+
+
 		$this->updateError('DB::query('.$queryString.')<br />ibase_query');
 		if(!$this->queryId) {
 			return false;
@@ -141,7 +142,7 @@ class db {
 	// returns the next record in an array
 	function nextRecord()
 	{
-        $this->record = ibase_fetch_assoc($this->queryId);
+		$this->record = ibase_fetch_assoc($this->queryId);
 		$this->updateError('DB::nextRecord()<br />ibase_fetch_assoc');
 		if(!$this->record || !is_array($this->record))
 		{
@@ -156,32 +157,32 @@ class db {
 	{
 		return false;
 	}
-	
+
 	// returns mySQL insert id
 	function insertID()
 	{
 		return false;
 	}
-    
-    // Check der variablen
+
+	// Check der variablen
 	// deprecated, now use quote
-    function check($formfield)
-    {
-        return $this->quote($formfield);
-    }
-	
+	function check($formfield)
+	{
+		return $this->quote($formfield);
+	}
+
 	// Check der variablen
-    function quote($formfield)
-    {
-        return str_replace("'","''",$formfield);
-    }
-	
+	function quote($formfield)
+	{
+		return str_replace("'", "''", $formfield);
+	}
+
 	// Check der variablen
-    function unquote($formfield)
-    {
-        return str_replace("''","'",$formfield);
-    }
-	
+	function unquote($formfield)
+	{
+		return str_replace("''", "'", $formfield);
+	}
+
 	function toLower($record) {
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
@@ -189,76 +190,76 @@ class db {
 				$out[$key] = $val;
 			}
 		}
-	return $out;
+		return $out;
+	}
+
+
+	function insert($tablename, $form, $debug = 0)
+	{
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$sql_key .= "$key, ";
+				$sql_value .= "'".$this->quote($value)."', ";
+			}
+			$sql_key = substr($sql_key, 0, strlen($sql_key) - 2);
+			$sql_value = substr($sql_value, 0, strlen($sql_value) - 2);
+
+			$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
+
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
+		}
+	}
+
+	function update($tablename, $form, $bedingung, $debug = 0)
+	{
+
+		if(is_array($form)){
+			foreach($form as $key => $value)
+			{
+				$insql .= "$key = '".$this->quote($value)."', ";
+			}
+			$insql = substr($insql, 0, strlen($insql) - 2);
+			$sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
+			if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
+			$this->query($sql);
+			if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
+		}
+	}
+
+	function closeConn() {
+		ibase_close($this->linkId);
+	}
+
+	function freeResult() {
+		//ibase_free_result();
+	}
+
+	function delete() {
+
 	}
-   
-   
-   function insert($tablename,$form,$debug = 0)
-   {
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $sql_key .= "$key, ";
-        $sql_value .= "'".$this->quote($value)."', ";
-  		 }
-   	$sql_key = substr($sql_key,0,strlen($sql_key) - 2);
-    $sql_value = substr($sql_value,0,strlen($sql_value) - 2);
-    
-   	$sql = "INSERT INTO $tablename (" . $sql_key . ") VALUES (" . $sql_value .")";
-   
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-      }
-   }
-   
-   function update($tablename,$form,$bedingung,$debug = 0)
-   {
-   
-     if(is_array($form)){
-       foreach($form as $key => $value) 
-	    {
-	    $insql .= "$key = '".$this->quote($value)."', ";
-  		 }
-   	        $insql = substr($insql,0,strlen($insql) - 2);
-   	        $sql = "UPDATE $tablename SET " . $insql . " WHERE $bedingung";
-  		 if($debug == 1) echo "SQL-Statement: ".$sql."<br><br>";
-  		 $this->query($sql);
-  		 if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
-       }
-   }
-   
-   function closeConn() {
-   	ibase_close($this->linkId);
-   }
-   
-   function freeResult() {
-   	//ibase_free_result();
-   }
-   
-   function delete() {
-   
-   }
-   
-   function trans($action,$transID = null) {
-   //action = begin, commit oder rollback
-   
-   		if($action == 'begin') {
-   			$this->transID = ibase_trans($this->linkId);
+
+	function trans($action, $transID = null) {
+		//action = begin, commit oder rollback
+
+		if($action == 'begin') {
+			$this->transID = ibase_trans($this->linkId);
 			return $this->transID;
-   		}
-		
+		}
+
 		if($action == 'commit' and !empty($this->transID)) {
-			ibase_commit($this->linkId,$this->transID);
+			ibase_commit($this->linkId, $this->transID);
 		}
-	
+
 		if($action == 'rollback') {
-			ibase_rollback($this->linkId,$this->transID);
+			ibase_rollback($this->linkId, $this->transID);
 		}
-		
-   }
-   
-   /*
+
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -268,38 +269,38 @@ class db {
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   
-   function createTable($table_name,$columns) {
-   $index = "";
-   $sql = "CREATE TABLE $table_name (";
-   foreach($columns as $col){
-        $sql .= $col["name"]." ".$this->mapType($col["type"],$col["typeValue"])." ";
-   
-        if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
-        if($col["notNull"] == true) {
-            $sql .= "NOT NULL ";
-        } else {
-            $sql .= "NULL ";
-        }
-        if($col["autoInc"] == true) $sql .= "auto_increment ";
-        $sql.= ",";
-        // key Definitionen
-        if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
-        if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
-        if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
-   }
-   $sql .= $index;
-   $sql = substr($sql,0,-1);
-   $sql .= ")";
-   
-   $this->query($sql);
-   return true;
-   }
-   
-   /*
+
+	function createTable($table_name, $columns) {
+		$index = "";
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col["name"]." ".$this->mapType($col["type"], $col["typeValue"])." ";
+
+			if($col["defaultValue"] != "") $sql .= "DEFAULT '".$col["defaultValue"]."' ";
+			if($col["notNull"] == true) {
+				$sql .= "NOT NULL ";
+			} else {
+				$sql .= "NULL ";
+			}
+			if($col["autoInc"] == true) $sql .= "auto_increment ";
+			$sql.= ",";
+			// key Definitionen
+			if($col["option"] == "primary") $index .= "PRIMARY KEY (".$col["name"]."),";
+			if($col["option"] == "index") $index .= "INDEX (".$col["name"]."),";
+			if($col["option"] == "unique") $index .= "UNIQUE (".$col["name"]."),";
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ")";
+
+		$this->query($sql);
+		return true;
+	}
+
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -309,26 +310,26 @@ class db {
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   function alterTable($table_name,$columns) {
-   		return false;
-   }
-   
-   function dropTable($table_name) {
-   		$this->check($table_name);
-   		$sql = "DROP TABLE '". $table_name."'";
-  		return $this->query($sql);
-   }
-   
-   // gibt Array mit Tabellennamen zurück
-   function getTables($database_name) {
-        return false;       
-   }
-   
-   // gibt Feldinformationen zur Tabelle zurück
-   /*
+	function alterTable($table_name, $columns) {
+		return false;
+	}
+
+	function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
+	}
+
+	// gibt Array mit Tabellennamen zurück
+	function getTables($database_name) {
+		return false;
+	}
+
+	// gibt Feldinformationen zur Tabelle zurück
+	/*
    $columns = array(action =>   add | alter | drop
                     name =>     Spaltenname
                     name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -338,46 +339,46 @@ class db {
                     notNull =>   true | false
                     autoInc =>   true | false
                     option =>   unique | primary | index)
-   
-   
+
+
    */
-   
-   function tableInfo($table_name) {
-        return false;
-   }
-   
-   function mapType($metaType,$typeValue) {
-   global $go_api;
-   $metaType = strtolower($metaType);
-   switch ($metaType) {
-   case 'int16':
-        return 'smallint';
-   break;
-   case 'int32':
-        return 'int';
-   break;
-   case 'int64':
-        return 'bigint';
-   break;
-   case 'double':
-        return 'double';
-   break;
-   case 'char':
-        return 'char';
-   break;
-   case 'varchar':
-        if($typeValue < 1) $go_api->errorMessage("Datenbank Fehler: Für diesen Datentyp ist eine Längenangabe notwendig.");
-        return 'varchar('.$typeValue.')';
-   break;
-   case 'text':
-        return 'text';
-   break;
-   case 'blob':
-        return 'blob';
-   break;
-   }
-   }
-	
+
+	function tableInfo($table_name) {
+		return false;
+	}
+
+	function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) $go_api->errorMessage("Datenbank Fehler: Für diesen Datentyp ist eine Längenangabe notwendig.");
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 46729988e6a30223d66fd60e5fac1234e9c3fddd..1636cab5d38700c4370fca09f083e713d0cec0e2 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -29,64 +29,64 @@
 
 class db extends mysqli
 {
-  private $dbHost = '';		// hostname of the MySQL server
-  private $dbName = '';		// logical database name on that server
-  private $dbUser = '';		// database authorized user
-  private $dbPass = '';		// user's password
-  private $dbCharset = 'utf8';// Database charset
-  private $dbNewLink = false; // Return a new linkID when connect is called again
-  private $dbClientFlags = 0; // MySQL Client falgs
-  private $linkId = 0;		// last result of mysqli_connect()
-  private $queryId = 0;		// last result of mysqli_query()
-  private $record	= array();	// last record fetched
-  private $autoCommit = 1;    // Autocommit Transactions
-  private $currentRow;		// current row number
-  private $errorNumber = 0;	// last error number
-  public $errorMessage = '';	// last error message
-  private $errorLocation = '';// last error location
-  public $show_error_messages = false; // false in server, true in interface
-  private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
-
-  // constructor
-  public function __construct($prefix = '') {
-    global $conf;
-    if($prefix != '') $prefix .= '_';
-    $this->dbHost = $conf[$prefix.'db_host'];
-    $this->dbName = $conf[$prefix.'db_database'];
-    $this->dbUser = $conf[$prefix.'db_user'];
-    $this->dbPass = $conf[$prefix.'db_password'];
-    $this->dbCharset = $conf[$prefix.'db_charset'];
-    $this->dbNewLink = $conf[$prefix.'db_new_link'];
-    $this->dbClientFlags = $conf[$prefix.'db_client_flags'];
-    parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
-    $try = 0;
-    //while(!is_null($this->connect_error) && $try < 5) {
-	while(mysqli_connect_error() && $try < 5) {
-      if($try > 0) sleep(1);
-      
-      $try++;
-      $this->updateError('DB::__construct');
-      
-      parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
-    }
-    
-    //if(is_null($this->connect_error)) $this->isConnected = true;
-    //else return false;
-	if(!mysqli_connect_error()) $this->isConnected = true;
-    else return false;
-    
-    $this->setCharacterEncoding();
-  }
-
-  public function __destruct() {
-    $this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
-  }
-
-  // error handler
-  public function updateError($location) {
-    global $app, $conf;
+	private $dbHost = '';  // hostname of the MySQL server
+	private $dbName = '';  // logical database name on that server
+	private $dbUser = '';  // database authorized user
+	private $dbPass = '';  // user's password
+	private $dbCharset = 'utf8';// Database charset
+	private $dbNewLink = false; // Return a new linkID when connect is called again
+	private $dbClientFlags = 0; // MySQL Client falgs
+	private $linkId = 0;  // last result of mysqli_connect()
+	private $queryId = 0;  // last result of mysqli_query()
+	private $record = array(); // last record fetched
+	private $autoCommit = 1;    // Autocommit Transactions
+	private $currentRow;  // current row number
+	private $errorNumber = 0; // last error number
+	public $errorMessage = ''; // last error message
+	private $errorLocation = '';// last error location
+	public $show_error_messages = false; // false in server, true in interface
+	private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
+
+	// constructor
+	public function __construct($prefix = '') {
+		global $conf;
+		if($prefix != '') $prefix .= '_';
+		$this->dbHost = $conf[$prefix.'db_host'];
+		$this->dbName = $conf[$prefix.'db_database'];
+		$this->dbUser = $conf[$prefix.'db_user'];
+		$this->dbPass = $conf[$prefix.'db_password'];
+		$this->dbCharset = $conf[$prefix.'db_charset'];
+		$this->dbNewLink = $conf[$prefix.'db_new_link'];
+		$this->dbClientFlags = $conf[$prefix.'db_client_flags'];
+		parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'], $conf[$prefix.'db_password'], $conf[$prefix.'db_database']);
+		$try = 0;
+		//while(!is_null($this->connect_error) && $try < 5) {
+		while(mysqli_connect_error() && $try < 5) {
+			if($try > 0) sleep(1);
+
+			$try++;
+			$this->updateError('DB::__construct');
+
+			parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'], $conf[$prefix.'db_password'], $conf[$prefix.'db_database']);
+		}
 
-	/*
+		//if(is_null($this->connect_error)) $this->isConnected = true;
+		//else return false;
+		if(!mysqli_connect_error()) $this->isConnected = true;
+		else return false;
+
+		$this->setCharacterEncoding();
+	}
+
+	public function __destruct() {
+		$this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
+	}
+
+	// error handler
+	public function updateError($location) {
+		global $app, $conf;
+
+		/*
     if(!is_null($this->connect_error)) {
       $this->errorNumber = $this->connect_errno;
       $this->errorMessage = $this->connect_error;
@@ -95,183 +95,183 @@ class db extends mysqli
       $this->errorMessage = $this->error;
     }
 	*/
-	if(mysqli_connect_error()) {
-      $this->errorNumber = mysqli_connect_errno();
-      $this->errorMessage = mysqli_connect_error();
-    } else {
-      $this->errorNumber = mysqli_errno($this);
-      $this->errorMessage = mysqli_error($this);
-    }
+		if(mysqli_connect_error()) {
+			$this->errorNumber = mysqli_connect_errno();
+			$this->errorMessage = mysqli_connect_error();
+		} else {
+			$this->errorNumber = mysqli_errno($this);
+			$this->errorMessage = mysqli_error($this);
+		}
 
 
-    $this->errorLocation = $location;
-    if($this->errorNumber) {
-      $error_msg = $this->errorLocation .' '. $this->errorMessage;
-      // This right here will allow us to use the same file for server & interface
-      if($this->show_error_messages && $conf['demo_mode'] === false) {
-		echo $error_msg;
-      } else if(is_object($app) && method_exists($app, 'log')) {
-		$app->log($error_msg, LOGLEVEL_WARN);
-      }
-    }
-  }
-  
-  private function setCharacterEncoding() {
-    if($this->isConnected == false) return false;
-    parent::query( 'SET NAMES '.$this->dbCharset); 
-    parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
-  }
-
-  public function query($queryString) {
-    global $conf;
-	if($this->isConnected == false) return false;
-    $try = 0;
-    do {
-        $try++;
-        $ok = $this->ping();
-        if(!$ok) {
-            if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
-                if($try > 4) {
-                    $this->updateError('DB::query -> reconnect');
-                    return false;
-                } else {
-                    sleep(1);
-                }
-            } else {
-                $this->setCharacterEncoding();
-                $ok = true;
-            }
-        }
-    } while($ok == false);
-	$this->queryId = parent::query($queryString);
-    $this->updateError('DB::query('.$queryString.') -> mysqli_query');
-    if($this->errorNumber && $conf['demo_mode'] === false) debug_print_backtrace();
-    if(!$this->queryId) {
-      return false;
-    }
-    $this->currentRow = 0;
-    return $this->queryId;
-  }
-
-  // returns all records in an array
-  public function queryAllRecords($queryString) {
-    if(!$this->query($queryString))
-    {
-      return false;
-    }
-    $ret = array();
-    while($line = $this->nextRecord())
-    {
-      $ret[] = $line;
-    }
-    return $ret;
-  }
-
-  // returns one record in an array
-  public function queryOneRecord($queryString) {
-    if(!$this->query($queryString) || $this->numRows() == 0)
-    {
-      return false;
-    }
-    return $this->nextRecord();
-  }
-
-  // returns the next record in an array
-  public function nextRecord() {
-    $this->record = $this->queryId->fetch_assoc();
-    $this->updateError('DB::nextRecord()-> mysql_fetch_array');
-    if(!$this->record || !is_array($this->record))
-    {
-      return false;
-    }
-    $this->currentRow++;
-    return $this->record;
-  }
-
-  // returns number of rows returned by the last select query
-  public function numRows() {
-    return intval($this->queryId->num_rows);
-  }
-  
-  public function affectedRows() {
-	return intval($this->queryId->affected_rows);
-  }
-
-  // returns mySQL insert id
-  public function insertID() {
-    return $this->insert_id;
-  }
-
-
-  //* Function to quote strings
-  public function quote($formfield) {
-    return $this->escape_string($formfield);
-  }
-
-  //* Function to unquotae strings
-  public function unquote($formfield) {
-    return stripslashes($formfield);
-  }
-
-public function toLower($record) {
-    if(is_array($record)) {
-      foreach($record as $key => $val) {
-	$key = strtolower($key);
-	$out[$key] = $val;
-      }
-    }
-    return $out;
-  }
-
-  public function diffrec($record_old, $record_new) {
-    $diffrec_full = array();
-    $diff_num = 0;
-
-    if(is_array($record_old) && count($record_old) > 0) {
-      foreach($record_old as $key => $val) {
-	// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
-	if(@$record_new[$key] != $val) {
-	  // Record has changed
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = @$record_new[$key];
-	  $diff_num++;
-	} else {
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = $val;
+		$this->errorLocation = $location;
+		if($this->errorNumber) {
+			$error_msg = $this->errorLocation .' '. $this->errorMessage;
+			// This right here will allow us to use the same file for server & interface
+			if($this->show_error_messages && $conf['demo_mode'] === false) {
+				echo $error_msg;
+			} else if(is_object($app) && method_exists($app, 'log')) {
+					$app->log($error_msg, LOGLEVEL_WARN);
+				}
+		}
 	}
-      }
-      } elseif(is_array($record_new)) {
-	foreach($record_new as $key => $val) {
-	  if(isset($record_new[$key]) && @$record_old[$key] != $val) {
-	    // Record has changed
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = @$record_old[$key];
-	    $diff_num++;
-	  } else {
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = $val;
-	  }
+
+	private function setCharacterEncoding() {
+		if($this->isConnected == false) return false;
+		parent::query( 'SET NAMES '.$this->dbCharset);
+		parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
 	}
-      }
 
-      return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+	public function query($queryString) {
+		global $conf;
+		if($this->isConnected == false) return false;
+		$try = 0;
+		do {
+			$try++;
+			$ok = $this->ping();
+			if(!$ok) {
+				if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
+					if($try > 4) {
+						$this->updateError('DB::query -> reconnect');
+						return false;
+					} else {
+						sleep(1);
+					}
+				} else {
+					$this->setCharacterEncoding();
+					$ok = true;
+				}
+			}
+		} while($ok == false);
+		$this->queryId = parent::query($queryString);
+		$this->updateError('DB::query('.$queryString.') -> mysqli_query');
+		if($this->errorNumber && $conf['demo_mode'] === false) debug_print_backtrace();
+		if(!$this->queryId) {
+			return false;
+		}
+		$this->currentRow = 0;
+		return $this->queryId;
+	}
 
-    }
+	// returns all records in an array
+	public function queryAllRecords($queryString) {
+		if(!$this->query($queryString))
+		{
+			return false;
+		}
+		$ret = array();
+		while($line = $this->nextRecord())
+		{
+			$ret[] = $line;
+		}
+		return $ret;
+	}
+
+	// returns one record in an array
+	public function queryOneRecord($queryString) {
+		if(!$this->query($queryString) || $this->numRows() == 0)
+		{
+			return false;
+		}
+		return $this->nextRecord();
+	}
+
+	// returns the next record in an array
+	public function nextRecord() {
+		$this->record = $this->queryId->fetch_assoc();
+		$this->updateError('DB::nextRecord()-> mysql_fetch_array');
+		if(!$this->record || !is_array($this->record))
+		{
+			return false;
+		}
+		$this->currentRow++;
+		return $this->record;
+	}
+
+	// returns number of rows returned by the last select query
+	public function numRows() {
+		return intval($this->queryId->num_rows);
+	}
+
+	public function affectedRows() {
+		return intval($this->queryId->affected_rows);
+	}
 
-    //** Function to fill the datalog with a full differential record.
-    public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
-      global $app,$conf;
+	// returns mySQL insert id
+	public function insertID() {
+		return $this->insert_id;
+	}
+
+
+	//* Function to quote strings
+	public function quote($formfield) {
+		return $this->escape_string($formfield);
+	}
 
-      // Insert backticks only for incomplete table names.
-      if(stristr($db_table,'.')) {
-	$escape = '';
-      } else {
-	$escape = '`';
-      }
+	//* Function to unquotae strings
+	public function unquote($formfield) {
+		return stripslashes($formfield);
+	}
+
+	public function toLower($record) {
+		if(is_array($record)) {
+			foreach($record as $key => $val) {
+				$key = strtolower($key);
+				$out[$key] = $val;
+			}
+		}
+		return $out;
+	}
+
+	public function diffrec($record_old, $record_new) {
+		$diffrec_full = array();
+		$diff_num = 0;
+
+		if(is_array($record_old) && count($record_old) > 0) {
+			foreach($record_old as $key => $val) {
+				// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
+				if(@$record_new[$key] != $val) {
+					// Record has changed
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = @$record_new[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = $val;
+				}
+			}
+		} elseif(is_array($record_new)) {
+			foreach($record_new as $key => $val) {
+				if(isset($record_new[$key]) && @$record_old[$key] != $val) {
+					// Record has changed
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = @$record_old[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = $val;
+				}
+			}
+		}
+
+		return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+
+	}
+
+	//** Function to fill the datalog with a full differential record.
+	public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
+		global $app, $conf;
+
+		// Insert backticks only for incomplete table names.
+		if(stristr($db_table, '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
 
 		if($force_update == true) {
 			//* We force a update even if no record has changed
-			$diffrec_full = array('new' => $record_new,'old' => $record_old);
+			$diffrec_full = array('new' => $record_new, 'old' => $record_old);
 			$diff_num = count($record_new);
 		} else {
 			//* get the difference record between old and new record
@@ -281,135 +281,135 @@ public function toLower($record) {
 			unset($tmp);
 		}
 
-      // Insert the server_id, if the record has a server_id
-      $server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
-      if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
+		// Insert the server_id, if the record has a server_id
+		$server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
+		if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
 
 
-      if($diff_num > 0) {
-	//print_r($diff_num);
-	//print_r($diffrec_full);
-	$diffstr = $app->db->quote(serialize($diffrec_full));
-	$username = $app->db->quote($_SESSION['s']['user']['username']);
-	$dbidx = $primary_field.':'.$primary_id;
+		if($diff_num > 0) {
+			//print_r($diff_num);
+			//print_r($diffrec_full);
+			$diffstr = $app->db->quote(serialize($diffrec_full));
+			$username = $app->db->quote($_SESSION['s']['user']['username']);
+			$dbidx = $primary_field.':'.$primary_id;
 
-	if($action == 'INSERT') $action = 'i';
-	if($action == 'UPDATE') $action = 'u';
-	if($action == 'DELETE') $action = 'd';
-	$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
-	$app->db->query($sql);
-      }
+			if($action == 'INSERT') $action = 'i';
+			if($action == 'UPDATE') $action = 'u';
+			if($action == 'DELETE') $action = 'd';
+			$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+			$app->db->query($sql);
+		}
 
-      return true;
-    }
+		return true;
+	}
 
-    //** Inserts a record and saves the changes into the datalog
-    public function datalogInsert($tablename, $insert_data, $index_field) {
-      global $app;
-	  
-	  if(is_array($insert_data)) {
+	//** Inserts a record and saves the changes into the datalog
+	public function datalogInsert($tablename, $insert_data, $index_field) {
+		global $app;
+
+		if(is_array($insert_data)) {
 			$key_str = '';
 			$val_str = '';
 			foreach($insert_data as $key => $val) {
 				$key_str .= "`".$key ."`,";
 				$val_str .= "'".$this->quote($val)."',";
 			}
-			$key_str = substr($key_str,0,-1);
-			$val_str = substr($val_str,0,-1);
+			$key_str = substr($key_str, 0, -1);
+			$val_str = substr($val_str, 0, -1);
 			$insert_data_str = '('.$key_str.') VALUES ('.$val_str.')';
 		} else {
 			$insert_data_str = $insert_data;
 		}
 
-      $old_rec = array();
-      $this->query("INSERT INTO $tablename $insert_data_str");
-      $index_value = $this->insertID();
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
+		$old_rec = array();
+		$this->query("INSERT INTO $tablename $insert_data_str");
+		$index_value = $this->insertID();
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
 
-      return $index_value;
-    }
+		return $index_value;
+	}
 
-    //** Updates a record and saves the changes into the datalog
-    public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
+	//** Updates a record and saves the changes into the datalog
+	public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
 		global $app;
-      
-	  $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-	  
-	  if(is_array($update_data)) {
+
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+
+		if(is_array($update_data)) {
 			$update_data_str = '';
 			foreach($update_data as $key => $val) {
 				$update_data_str .= "`".$key ."` = '".$this->quote($val)."',";
 			}
-			$update_data_str = substr($update_data_str,0,-1);
+			$update_data_str = substr($update_data_str, 0, -1);
 		} else {
 			$update_data_str = $update_data;
 		}
-		
-      $this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-      return true;
-    }
+		$this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-    //** Deletes a record and saves the changes into the datalog
-    public function datalogDelete($tablename, $index_field, $index_value) {
-      global $app;
+		return true;
+	}
 
-      $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
-      $new_rec = array();
-      $this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
+	//** Deletes a record and saves the changes into the datalog
+	public function datalogDelete($tablename, $index_field, $index_value) {
+		global $app;
 
-      return true;
-    }
-    
-    //* get the current datalog status for the specified login (or currently logged in user)
-    public function datalogStatus($login = '') {
-        global $app;
-        
-        $return = array('count' => 0, 'entries' => array());
-        if($_SESSION['s']['user']['typ'] == 'admin') return $return; // these information should not be displayed to admin users
-        
-        if($login == '' && isset($_SESSION['s']['user'])) {
-            $login = $_SESSION['s']['user']['username'];
-        }
-        
-        $result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = '" . $this->quote($login) . "' AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action");
-        foreach($result as $row) {
-            if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come
-            $return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable']));
-            $return['count'] += $row['cnt'];
-        }
-        unset($result);
-        
-        return $return;
-    }
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
+		$new_rec = array();
+		$this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
 
+		return true;
+	}
 
-    public function freeResult($query) 
-    {
-      if(is_object($query) && (get_class($query) == "mysqli_result")) {
-	$query->free();
-	return true;
-      } else {
-	return false;
-      }
-    }
+	//* get the current datalog status for the specified login (or currently logged in user)
+	public function datalogStatus($login = '') {
+		global $app;
 
-    /* TODO: Does anything use this? */
-    public function delete() {
+		$return = array('count' => 0, 'entries' => array());
+		if($_SESSION['s']['user']['typ'] == 'admin') return $return; // these information should not be displayed to admin users
 
-    }
+		if($login == '' && isset($_SESSION['s']['user'])) {
+			$login = $_SESSION['s']['user']['username'];
+		}
 
-    /* TODO: Does anything use this? */
-    public function Transaction($action) {
-      //action = begin, commit oder rollback
+		$result = $this->queryAllRecords("SELECT COUNT( * ) AS cnt, sys_datalog.action, sys_datalog.dbtable FROM sys_datalog, server WHERE server.server_id = sys_datalog.server_id AND sys_datalog.user = '" . $this->quote($login) . "' AND sys_datalog.datalog_id > server.updated GROUP BY sys_datalog.dbtable, sys_datalog.action");
+		foreach($result as $row) {
+			if(!$row['dbtable'] || in_array($row['dbtable'], array('aps_instances', 'aps_instances_settings', 'mail_access', 'mail_content_filter'))) continue; // ignore some entries, maybe more to come
+			$return['entries'][] = array('table' => $row['dbtable'], 'action' => $row['action'], 'count' => $row['cnt'], 'text' => $app->lng('datalog_status_' . $row['action'] . '_' . $row['dbtable']));
+			$return['count'] += $row['cnt'];
+		}
+		unset($result);
 
-    }
+		return $return;
+	}
+
+
+	public function freeResult($query)
+	{
+		if(is_object($query) && (get_class($query) == "mysqli_result")) {
+			$query->free();
+			return true;
+		} else {
+			return false;
+		}
+	}
 
-    /*
+	/* TODO: Does anything use this? */
+	public function delete() {
+
+	}
+
+	/* TODO: Does anything use this? */
+	public function Transaction($action) {
+		//action = begin, commit oder rollback
+
+	}
+
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -423,33 +423,33 @@ public function toLower($record) {
 
      */
 
-    public function createTable($table_name,$columns) {
-      $index = '';
-      $sql = "CREATE TABLE $table_name (";
-      foreach($columns as $col){
-	$sql .= $col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-
-	if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	if($col['notNull'] == true) {
-	  $sql .= 'NOT NULL ';
-	} else {
-	  $sql .= 'NULL ';
+	public function createTable($table_name, $columns) {
+		$index = '';
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+
+			if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+			if($col['notNull'] == true) {
+				$sql .= 'NOT NULL ';
+			} else {
+				$sql .= 'NULL ';
+			}
+			if($col['autoInc'] == true) $sql .= 'auto_increment ';
+			$sql.= ',';
+			// key Definitionen
+			if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+			if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+			if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ')';
+		$this->query($sql);
+		return true;
 	}
-	if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	$sql.= ',';
-	// key Definitionen
-	if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
-      $sql .= ')';
-      $this->query($sql);
-      return true;
-    }
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -462,59 +462,59 @@ public function toLower($record) {
 
 
      */
-    public function alterTable($table_name,$columns) {
-      $index = '';
-      $sql = "ALTER TABLE $table_name ";
-      foreach($columns as $col){
-	if($col['action'] == 'add') {
-	  $sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'alter') {
-	  $sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'drop') {
-	  $sql .= 'DROP '.$col['name'].' ';
-	}
-	if($col['action'] != 'drop') {  
-	  if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	  if($col['notNull'] == true) {
-	    $sql .= 'NOT NULL ';
-	  } else {
-	    $sql .= 'NULL ';
-	  }
-	  if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	  $sql.= ',';
-	  // Index definitions
-	  if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	  if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	  if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
-	}
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
+	public function alterTable($table_name, $columns) {
+		$index = '';
+		$sql = "ALTER TABLE $table_name ";
+		foreach($columns as $col){
+			if($col['action'] == 'add') {
+				$sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'alter') {
+				$sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'drop') {
+				$sql .= 'DROP '.$col['name'].' ';
+			}
+			if($col['action'] != 'drop') {
+				if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+				if($col['notNull'] == true) {
+					$sql .= 'NOT NULL ';
+				} else {
+					$sql .= 'NULL ';
+				}
+				if($col['autoInc'] == true) $sql .= 'auto_increment ';
+				$sql.= ',';
+				// Index definitions
+				if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+				if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+				if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+			}
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
 
-      //die($sql);
-      $this->query($sql);
-      return true;
-    }
+		//die($sql);
+		$this->query($sql);
+		return true;
+	}
 
-    public function dropTable($table_name) {
-      $this->check($table_name);
-      $sql = "DROP TABLE '". $table_name."'";
-      return $this->query($sql);
-    }
+	public function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
+	}
 
-    // gibt Array mit Tabellennamen zur�ck
-    public function getTables($database_name = '') {
-      if($this->isConnected == false) return false;
-      if($database_name == '') $database_name = $this->dbName;
-      $result = parent::query("SHOW TABLES FROM $database_name");
-      for ($i = 0; $i < $result->num_rows; $i++) {
-	$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
-      }
-      return $tb_names;       
-    }
+	// gibt Array mit Tabellennamen zur�ck
+	public function getTables($database_name = '') {
+		if($this->isConnected == false) return false;
+		if($database_name == '') $database_name = $this->dbName;
+		$result = parent::query("SHOW TABLES FROM $database_name");
+		for ($i = 0; $i < $result->num_rows; $i++) {
+			$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
+		}
+		return $tb_names;
+	}
 
-    // gibt Feldinformationen zur Tabelle zur�ck
-    /*
+	// gibt Feldinformationen zur Tabelle zur�ck
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -528,14 +528,14 @@ public function toLower($record) {
 
      */
 
-    function tableInfo($table_name) {
+	function tableInfo($table_name) {
 
-      global $go_api,$go_info,$app;
-      // Tabellenfelder einlesen
+		global $go_api, $go_info, $app;
+		// Tabellenfelder einlesen
 
-      if($rows = $app->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
-	foreach($rows as $row) {
-	  /*
+		if($rows = $app->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
+			foreach($rows as $row) {
+				/*
 	  $name = $row[0];
 	  $default = $row[4];
 	  $key = $row[3];
@@ -543,61 +543,61 @@ public function toLower($record) {
 	  $isnull = $row[2];
 	  $type = $row[1];
 	  */
-	  
-	  $name = $row['Field'];
-	  $default = $row['Default'];
-	  $key = $row['Key'];
-	  $extra = $row['Extra'];
-	  $isnull = $row['Null'];
-	  $type = $row['Type'];
-
-
-	  $column = array();
-
-	  $column['name'] = $name;
-	  //$column['type'] = $type;
-	  $column['defaultValue'] = $default;
-	  if(stristr($key,'PRI')) $column['option'] = 'primary';
-	  if(stristr($isnull,'YES')) {
-	    $column['notNull'] = false;
-	  } else {
-	    $column['notNull'] = true; 
-	  }
-	  if($extra == 'auto_increment') $column['autoInc'] = true;
-
-
-	  // Type in Metatype umsetzen
-
-	  if(stristr($type,'int(')) $metaType = 'int32';
-	      if(stristr($type,'bigint')) $metaType = 'int64';
-	      if(stristr($type,'char')) {
-	      $metaType = 'char';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'varchar')) {
-	      $metaType = 'varchar';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'text')) $metaType = 'text';
-	      if(stristr($type,'double')) $metaType = 'double';
-	      if(stristr($type,'blob')) $metaType = 'blob';
-
-
-	      $column['type'] = $metaType;
-
-	      $columns[] = $column;
-	      }
-	return $columns;
-      } else {
-	return false;
-      }
-
-
-      //$this->createTable('tester',$columns);
-
-      /*
+
+				$name = $row['Field'];
+				$default = $row['Default'];
+				$key = $row['Key'];
+				$extra = $row['Extra'];
+				$isnull = $row['Null'];
+				$type = $row['Type'];
+
+
+				$column = array();
+
+				$column['name'] = $name;
+				//$column['type'] = $type;
+				$column['defaultValue'] = $default;
+				if(stristr($key, 'PRI')) $column['option'] = 'primary';
+				if(stristr($isnull, 'YES')) {
+					$column['notNull'] = false;
+				} else {
+					$column['notNull'] = true;
+				}
+				if($extra == 'auto_increment') $column['autoInc'] = true;
+
+
+				// Type in Metatype umsetzen
+
+				if(stristr($type, 'int(')) $metaType = 'int32';
+				if(stristr($type, 'bigint')) $metaType = 'int64';
+				if(stristr($type, 'char')) {
+					$metaType = 'char';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'varchar')) {
+					$metaType = 'varchar';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'text')) $metaType = 'text';
+				if(stristr($type, 'double')) $metaType = 'double';
+				if(stristr($type, 'blob')) $metaType = 'blob';
+
+
+				$column['type'] = $metaType;
+
+				$columns[] = $column;
+			}
+			return $columns;
+		} else {
+			return false;
+		}
+
+
+		//$this->createTable('tester',$columns);
+
+		/*
 	 $result = mysql_list_fields($go_info["server"]["db_name"],$table_name);
 	 $fields = mysql_num_fields ($result);
 	 $i = 0;
@@ -622,40 +622,40 @@ public function toLower($record) {
 
 
 
-    }
+	}
+
+	public function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) die('Database failure: Lenght required for these data types.');
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
+
+}
 
-    public function mapType($metaType,$typeValue) {
-      global $go_api;
-      $metaType = strtolower($metaType);
-      switch ($metaType) {
-	case 'int16':
-	  return 'smallint';
-	  break;
-	case 'int32':
-	  return 'int';
-	  break;
-	case 'int64':
-	  return 'bigint';
-	  break;
-	case 'double':
-	  return 'double';
-	  break;
-	case 'char':
-	  return 'char';
-	  break;
-	case 'varchar':
-	  if($typeValue < 1) die('Database failure: Lenght required for these data types.');
-	  return 'varchar('.$typeValue.')';
-	      break;
-	      case 'text':
-	      return 'text';
-	      break;
-	      case 'blob':
-	      return 'blob';
-	      break;
-	      }
-	      }
-
-	      }
-
-	      ?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/form.inc.php b/interface/lib/classes/form.inc.php
index 898cbe6c05570771383033a58b6c36ccb20c9c6d..34c0b626c3c0b379f0b91ea8443ee07d8472fce0 100644
--- a/interface/lib/classes/form.inc.php
+++ b/interface/lib/classes/form.inc.php
@@ -29,165 +29,192 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 /**
-* Formularbehandlung
-*
-* Funktionen zur Umwandlung von Formulardaten
-* sowie zum vorbereiten von HTML und SQL
-* Ausgaben
-*
-*	Tabellendefinition
-*	
-*	Datentypen:
-*	- INTEGER (Wandelt Ausdrücke in Int um)
-*	- DOUBLE
-*	- CURRENCY (Formatiert Zahlen nach Währungsnotation)
-*	- VARCHAR (kein weiterer Format Check)
-*	- DATE (Datumsformat, Timestamp Umwandlung)
-*	
-*	Formtype:
-*	- TEXT (normales Textfeld)
-*	- PASSWORD (Feldinhalt wird nicht angezeigt)
-*	- SELECT (Gibt Werte als option Feld aus)
-*	- MULTIPLE (Select-Feld mit nehreren Werten)
-*	
-*	VALUE:
-*	- Wert oder Array
-*	
-*	SEPARATOR
-*	- Trennzeichen für multiple Felder
-*
-*	Hinweis:
-*	Das ID-Feld ist nicht bei den Table Values einzufügen.
-*
-* @package form
-* @author Till Brehm
-* @version 1.1
-*/
+ * Formularbehandlung
+ *
+ * Funktionen zur Umwandlung von Formulardaten
+ * sowie zum vorbereiten von HTML und SQL
+ * Ausgaben
+ *
+ * Tabellendefinition
+ *
+ * Datentypen:
+ * - INTEGER (Wandelt Ausdrücke in Int um)
+ * - DOUBLE
+ * - CURRENCY (Formatiert Zahlen nach Währungsnotation)
+ * - VARCHAR (kein weiterer Format Check)
+ * - DATE (Datumsformat, Timestamp Umwandlung)
+ *
+ * Formtype:
+ * - TEXT (normales Textfeld)
+ * - PASSWORD (Feldinhalt wird nicht angezeigt)
+ * - SELECT (Gibt Werte als option Feld aus)
+ * - MULTIPLE (Select-Feld mit nehreren Werten)
+ *
+ * VALUE:
+ * - Wert oder Array
+ *
+ * SEPARATOR
+ * - Trennzeichen für multiple Felder
+ *
+ * Hinweis:
+ * Das ID-Feld ist nicht bei den Table Values einzufügen.
+ *
+ * @package form
+ * @author Till Brehm
+ * @version 1.1
+ */
+
 
 class form {
-	
+
+
+
 	/**
-	* Definition der Tabelle (array)
-	* @var tableDef
-	*/
+	 * Definition der Tabelle (array)
+	 * @var tableDef
+	 */
 	var $tableDef;
-	
+
+
+
 	/**
-	* Private
-	* @var action
-	*/
+	 * Private
+	 * @var action
+	 */
 	var $action;
-	
+
+
+
 	/**
-	* Tabellenname (String)
-	* @var table_name
-	*/
+	 * Tabellenname (String)
+	 * @var table_name
+	 */
 	var $table_name;
-	
+
+
+
 	/**
-	* Debug Variable
-	* @var debug
-	*/
+	 * Debug Variable
+	 * @var debug
+	 */
 	var $debug = 0;
-	
+
+
+
 	/**
-	* name des primary Field der Tabelle (string)
-	* @var table_index
-	*/
+	 * name des primary Field der Tabelle (string)
+	 * @var table_index
+	 */
 	var $table_index;
-	
+
+
+
 	/**
-	* enthält die Fehlermeldung bei Überprüfung
-	* der Variablen mit Regex
-	* @var errorMessage
-	*/
+	 * enthält die Fehlermeldung bei Überprüfung
+	 * der Variablen mit Regex
+	 * @var errorMessage
+	 */
 	var $errorMessage;
-	
+
 	var $dateformat = "d.m.Y";
-    var $formDef;
-	
+	var $formDef;
+
+
+
+
+
 	/**
-	* Laden der Tabellendefinition
-	*
-	* @param file: Pfad zur Tabellendefinition
-	* @return true
-	*/
+	 * Laden der Tabellendefinition
+	 *
+	 * @param file: Pfad zur Tabellendefinition
+	 * @return true
+	 */
 	function loadTableDef($file) {
-		global $app,$conf;
-		
-		include_once($file);
+		global $app, $conf;
+
+		include_once $file;
 		$this->tableDef = $table;
 		$this->table_name = $table_name;
 		$this->table_index = $table_index;
 		return true;
 	}
-    
-    function loadFormDef($file) {
-		global $app,$conf;
-		
-		include_once($file);
+
+	function loadFormDef($file) {
+		global $app, $conf;
+
+		include_once $file;
 		$this->formDef = $form;
 		return true;
 	}
-	
-	
+
+
+
+
+
+
+
+
 	/**
-	* Konvertiert die Daten des übergebenen assoziativen
-	* Arrays in "menschenlesbare" Form.
-	* Datentyp Konvertierung, z.B. für Ausgabe in Listen.
-	*
-	* @param record
-	* @return record
-	*/
+	 * Konvertiert die Daten des übergebenen assoziativen
+	 * Arrays in "menschenlesbare" Form.
+	 * Datentyp Konvertierung, z.B. für Ausgabe in Listen.
+	 *
+	 * @param record
+	 * @return record
+	 */
 	function decode($record) {
-        global $app;
+		global $app;
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
 				switch ($this->tableDef[$key]['datatype']) {
 				case 'VARCHAR':
 					$new_record[$key] = stripslashes($val);
-				break;
-				
+					break;
+
 				case 'DATE':
 					if($val > 0) {
-						$new_record[$key] = date($this->dateformat,$val);
+						$new_record[$key] = date($this->dateformat, $val);
 					}
-				break;
-				
+					break;
+
 				case 'INTEGER':
 					$new_record[$key] = $app->functions->intval($val);
-				break;
-				
+					break;
+
 				case 'DOUBLE':
 					$new_record[$key] = $val;
-				break;
-				
+					break;
+
 				case 'CURRENCY':
 					$new_record[$key] = number_format($val, 2, ',', '');
-				break;
-				
+					break;
+
 				default:
 					$new_record[$key] = stripslashes($val);
 				}
 			}
-			
+
 		}
-	return $new_record;
+		return $new_record;
 	}
-	
+
+
+
+
+
 	/**
-	* Record für Ausgabe in Formularen vorbereiten.
-	*
-	* @param record = Datensatz als Array
-	* @param action = NEW oder EDIT 
-	* @return record
-	*/
-	function getHTML($record,$action = 'NEW') {
-		
+	 * Record für Ausgabe in Formularen vorbereiten.
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = NEW oder EDIT
+	 * @return record
+	 */
+	function getHTML($record, $action = 'NEW') {
+
 		global $app;
-		
+
 		if(!is_array($this->tableDef)) $app->error("Keine Tabellendefinition vorhanden.");
-		
+
 		$new_record = array();
 		if($action == 'EDIT') {
 			$record = $this->decode($record);
@@ -203,32 +230,32 @@ class form {
 							}
 						}
 						$new_record[$key] = $out;
-					break;
+						break;
 					case 'MULTIPLE':
 						if(is_array($this->tableDef[$key]['value'])) {
-							
+
 							// aufsplitten ergebnisse
-							$vals = explode($this->tableDef[$key]['separator'],$val);
-							
+							$vals = explode($this->tableDef[$key]['separator'], $val);
+
 							// HTML schreiben
 							$out = '';
 							foreach($this->tableDef[$key]['value'] as $k => $v) {
-								
+
 								$selected = '';
 								foreach($vals as $tvl) {
 									if(trim($tvl) == trim($k)) $selected = ' SELECTED';
 								}
-								
+
 								$out .= "<option value='$k'$selected>$v</option>\r\n";
 							}
 						}
 						$new_record[$key] = $out;
-					break;
-					
+						break;
+
 					case 'PASSWORD':
 						$new_record[$key] = '';
-					break;
-					
+						break;
+
 					default:
 						$new_record[$key] = htmlspecialchars($val);
 					}
@@ -246,50 +273,54 @@ class form {
 						}
 					}
 					$new_record[$key] = $out;
-				break;
+					break;
 				case 'MULTIPLE':
-						if(is_array($this->tableDef[$key]['value'])) {
-							
-							// aufsplitten ergebnisse
-							$vals = explode($this->tableDef[$key]['separator'],$val);
-							
-							// HTML schreiben
-							$out = '';
-							foreach($this->tableDef[$key]['value'] as $k => $v) {
-								
-								$out .= "<option value='$k'>$v</option>\r\n";
-							}
+					if(is_array($this->tableDef[$key]['value'])) {
+
+						// aufsplitten ergebnisse
+						$vals = explode($this->tableDef[$key]['separator'], $val);
+
+						// HTML schreiben
+						$out = '';
+						foreach($this->tableDef[$key]['value'] as $k => $v) {
+
+							$out .= "<option value='$k'>$v</option>\r\n";
 						}
-						$new_record[$key] = $out;
+					}
+					$new_record[$key] = $out;
 					break;
-				
+
 				case 'PASSWORD':
 					$new_record[$key] = '';
-				break;
-				
+					break;
+
 				default:
 					$new_record[$key] = htmlspecialchars($this->tableDef[$key]['value']);
 				}
 			}
-		
+
 		}
-		
+
 		if($this->debug == 1) $this->dbg($new_record);
-		
+
 		return $new_record;
 	}
-	
+
+
+
+
+
 	/**
-	* Record in "maschinen lesbares" Format überführen
-	* und Werte gegen reguläre Ausdrücke prüfen.
-	*
-	* @param record = Datensatz als Array
-	* @return record
-	*/
+	 * Record in "maschinen lesbares" Format überführen
+	 * und Werte gegen reguläre Ausdrücke prüfen.
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
 	function encode($record) {
 		global $app;
 		$this->errorMessage = '';
-		
+
 		if(is_array($record)) {
 			foreach($record as $key => $val) {
 				switch ($this->tableDef[$key]['datatype']) {
@@ -297,26 +328,26 @@ class form {
 					if(!is_array($val)) {
 						$new_record[$key] = $app->db->quote($val);
 					} else {
-						$new_record[$key] = implode($this->tableDef[$key]['separator'],$val);
+						$new_record[$key] = implode($this->tableDef[$key]['separator'], $val);
 					}
-				break;
+					break;
 				case 'DATE':
 					if($val > 0) {
-						list($tag,$monat,$jahr) = explode('.',$val);
-						$new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
+						list($tag, $monat, $jahr) = explode('.', $val);
+						$new_record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
 					}
-				break;
+					break;
 				case 'INTEGER':
 					$new_record[$key] = $app->functions->intval($val);
-				break;
+					break;
 				case 'DOUBLE':
 					$new_record[$key] = $app->db->quote($val);
-				break;
+					break;
 				case 'CURRENCY':
-					$new_record[$key] = str_replace(",",".",$val);
-				break;
+					$new_record[$key] = str_replace(",", ".", $val);
+					break;
 				}
-				
+
 				if($this->tableDef[$key]['regex'] != '') {
 					// Enable that "." matches also newlines
 					$this->tableDef[$key]['regex'] .= 's';
@@ -325,152 +356,160 @@ class form {
 					}
 				}
 			}
-			
+
 		}
 		return $new_record;
 	}
-	
+
+
+
+
+
 	/**
-	* SQL Statement für Record erzeugen.
-	*
-	* @param record = Datensatz als Array
-	* @param action = INSERT oder UPDATE
-	* @param primary_id
-	* @return record
-	*/
+	 * SQL Statement für Record erzeugen.
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
 	function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
-		
+
 		global $app;
-		
+
 		$record = $this->encode($record);
 		$sql_insert_key = '';
 		$sql_insert_val = '';
 		$sql_update = '';
-		
+
 		if(!is_array($this->tableDef)) $app->error("Keine Tabellendefinition vorhanden.");
-		
+
 		// gehe durch alle Felder des Records
 		if(is_array($record)) {
-        foreach($record as $key => $val) {
-			// Wenn es kein leeres Passwortfeld ist
-			if (!($this->tableDef[$key]['formtype'] == 'PASSWORD' and $val == '')) {
-				// gehe durch alle Felder der TableDef
-				foreach($this->tableDef as $tk => $tv) {
-					// Wenn Feld in TableDef enthalten ist
-					if($tk == $key) {
-						// Erzeuge Insert oder Update Quelltext
-						if($action == "INSERT") {
-							
-							if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
-								$sql_insert_key .= "`$key`, ";
-								$sql_insert_val .= "md5('$val'), ";
-							//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
-							//	$val = implode($this->tableDef[$key]['separator'],$val);
-							//	$sql_insert_key .= "`$key`, ";
-							//	$sql_insert_val .= "'$val', ";
-							} else {
-								$sql_insert_key .= "`$key`, ";
-								$sql_insert_val .= "'$val', ";
-							}
-							
-						} else {
-							
-							if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
-								$sql_update .= "`$key` = md5('$val'), ";
-							//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
-							//	$val = implode($this->tableDef[$key]['separator'],$val);
-							//	$sql_update .= "`$key` = '$val', ";
+			foreach($record as $key => $val) {
+				// Wenn es kein leeres Passwortfeld ist
+				if (!($this->tableDef[$key]['formtype'] == 'PASSWORD' and $val == '')) {
+					// gehe durch alle Felder der TableDef
+					foreach($this->tableDef as $tk => $tv) {
+						// Wenn Feld in TableDef enthalten ist
+						if($tk == $key) {
+							// Erzeuge Insert oder Update Quelltext
+							if($action == "INSERT") {
+
+								if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
+									$sql_insert_key .= "`$key`, ";
+									$sql_insert_val .= "md5('$val'), ";
+									//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
+									// $val = implode($this->tableDef[$key]['separator'],$val);
+									// $sql_insert_key .= "`$key`, ";
+									// $sql_insert_val .= "'$val', ";
+								} else {
+									$sql_insert_key .= "`$key`, ";
+									$sql_insert_val .= "'$val', ";
+								}
+
 							} else {
-								$sql_update .= "`$key` = '$val', ";
+
+								if($this->tableDef[$key]['formtype'] == 'PASSWORD') {
+									$sql_update .= "`$key` = md5('$val'), ";
+									//} elseif($this->tableDef[$key]['formtype'] == 'MULTIPLE') {
+									// $val = implode($this->tableDef[$key]['separator'],$val);
+									// $sql_update .= "`$key` = '$val', ";
+								} else {
+									$sql_update .= "`$key` = '$val', ";
+								}
+
 							}
-							
 						}
 					}
 				}
 			}
 		}
-        }
-		
+
 		// Füge Backticks nur bei unvollständigen Tabellennamen ein
-		if(stristr($this->table_name,'.')) {
+		if(stristr($this->table_name, '.')) {
 			$escape = '';
 		} else {
 			$escape = '`';
 		}
-		
-		
+
+
 		if($action == "INSERT") {
-			$sql_insert_key = substr($sql_insert_key,0,-2);
-			$sql_insert_val = substr($sql_insert_val,0,-2);
+			$sql_insert_key = substr($sql_insert_key, 0, -2);
+			$sql_insert_val = substr($sql_insert_val, 0, -2);
 			$sql = "INSERT INTO ".$escape.$this->table_name.$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
 		} else {
 			if($primary_id != 0) {
-				$sql_update = substr($sql_update,0,-2);
+				$sql_update = substr($sql_update, 0, -2);
 				$sql = "UPDATE ".$escape.$this->table_name.$escape." SET ".$sql_update." WHERE ".$this->table_index ." = ".$primary_id;
 				if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
 			} else {
 				$app->error("Primary ID fehlt!");
 			}
 		}
-		
+
 		return $sql;
 	}
-	
+
+
+
+
+
 	/**
-	* Debugging arrays.
-	*
-	* @param array_data
-	*/
+	 * Debugging arrays.
+	 *
+	 * @param array_data
+	 */
 	function dbg($array_data) {
-		
+
 		echo "<pre>";
 		print_r($array_data);
 		echo "</pre>";
-		
+
 	}
-    
-    
-    function showForm() {
-    	global $app,$conf;
-        
-        if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
-        
-        if($this->errorMessage == '') {
-        	// wenn kein Fehler vorliegt
+
+
+	function showForm() {
+		global $app, $conf;
+
+		if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
+
+		if($this->errorMessage == '') {
+			// wenn kein Fehler vorliegt
 			if($_REQUEST["next_tab"] != '') {
-            	// wenn nächster Tab bekannt
-            	$active_tab = $_REQUEST["next_tab"];
-            } else {
-            	// ansonsten ersten tab nehmen
-            	$active_tab = $this->formDef["tabs"][0]["name"];
-            }
+				// wenn nächster Tab bekannt
+				$active_tab = $_REQUEST["next_tab"];
+			} else {
+				// ansonsten ersten tab nehmen
+				$active_tab = $this->formDef["tabs"][0]["name"];
+			}
 		} else {
-        	// bei Fehlern den gleichen Tab nochmal anzeigen
-            $active_tab = $_SESSION["s"]["form"]["tab"];
+			// bei Fehlern den gleichen Tab nochmal anzeigen
+			$active_tab = $_SESSION["s"]["form"]["tab"];
+		}
+
+		// definiere Tabs
+		foreach( $this->formDef["tabs"] as $tab) {
+
+			if($tab["name"] == $active_tab) {
+				$app->tpl->setInclude('content_tpl', $tab["template"]);
+				$tab["active"] = 1;
+				$_SESSION["s"]["form"]["tab"] = $tab["name"];
+			} else {
+				$tab["active"] = 0;
+			}
+
+			$frmTab[] = $tab;
 		}
-        
-        // definiere Tabs
-        foreach( $this->formDef["tabs"] as $tab) {
-            
-            if($tab["name"] == $active_tab) {
-            	$app->tpl->setInclude('content_tpl',$tab["template"]);
-                $tab["active"] = 1;
-                $_SESSION["s"]["form"]["tab"] = $tab["name"];
-            } else {
-            	$tab["active"] = 0;
-            }
-			
-            $frmTab[] = $tab;
-        }
-        
-        // setze Loop
-        $app->tpl->setLoop("formTab", $frmTab);
+
+		// setze Loop
+		$app->tpl->setLoop("formTab", $frmTab);
 
 		// Formular action setzen
-		$app->tpl->setVar('form_action',$this->formDef["action"]);
-    }
-	
-	
+		$app->tpl->setVar('form_action', $this->formDef["action"]);
+	}
+
+
 }
 
 ?>
diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 0028b3974be50bf36c25fddbaf766e97c8a9bca2..48aa3619fdab5be7bedf287b11e9540cf7975e62 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -33,14 +33,14 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class functions {
 	var $idn_converter = null;
-    var $idn_converter_name = '';
+	var $idn_converter_name = '';
 
 	public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'application/pdf', $filename = '', $cc = '', $bcc = '', $from_name = '') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($conf['demo_mode'] == true) $app->error("Mail sending disabled in demo mode.");
-		
-        $app->uses('getconf,ispcmail');
+
+		$app->uses('getconf,ispcmail');
 		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config['smtp_enabled'] == 'y') {
 			$mail_config['use_smtp'] = true;
@@ -49,58 +49,58 @@ class functions {
 		$app->ispcmail->setSender($from, $from_name);
 		$app->ispcmail->setSubject($subject);
 		$app->ispcmail->setMailText($text);
-		
+
 		if($filepath != '') {
 			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
 			$app->ispcmail->readAttachFile($filepath);
 		}
-		
+
 		if($cc != '') $app->ispcmail->setHeader('Cc', $cc);
 		if($bcc != '') $app->ispcmail->setHeader('Bcc', $bcc);
-		
+
 		$app->ispcmail->send($to);
 		$app->ispcmail->finish();
-		
+
 		return true;
 	}
-	
-	public function array_merge($array1,$array2) {
+
+	public function array_merge($array1, $array2) {
 		$out = $array1;
 		foreach($array2 as $key => $val) {
 			$out[$key] = $val;
 		}
 		return $out;
 	}
-	
+
 	public function currency_format($number, $view = '') {
 		global $app;
 		if($view != '') $number_format_decimals = (int)$app->lng('number_format_decimals_'.$view);
-        if(!$number_format_decimals) $number_format_decimals = (int)$app->lng('number_format_decimals');
-        
+		if(!$number_format_decimals) $number_format_decimals = (int)$app->lng('number_format_decimals');
+
 		$number_format_dec_point = $app->lng('number_format_dec_point');
 		$number_format_thousands_sep = $app->lng('number_format_thousands_sep');
 		if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
 		return number_format((double)$number, $number_format_decimals, $number_format_dec_point, $number_format_thousands_sep);
 	}
-	
+
 	//* convert currency formatted number back to floating number
 	public function currency_unformat($number) {
 		global $app;
-        
+
 		$number_format_dec_point = $app->lng('number_format_dec_point');
 		$number_format_thousands_sep = $app->lng('number_format_thousands_sep');
 		if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
-		
+
 		if($number_format_thousands_sep != '') $number = str_replace($number_format_thousands_sep, '', $number);
 		if($number_format_dec_point != '.' && $number_format_dec_point != '') $number = str_replace($number_format_dec_point, '.', $number);
-		
+
 		return (double)$number;
 	}
-	
+
 	public function get_ispconfig_url() {
 		global $app;
-		
-		$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
+
+		$url = (stristr($_SERVER['SERVER_PROTOCOL'], 'HTTPS') || stristr($_SERVER['HTTPS'], 'on'))?'https':'http';
 		if($_SERVER['SERVER_NAME'] != '_') {
 			$url .= '://'.$_SERVER['SERVER_NAME'];
 			if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
@@ -108,7 +108,7 @@ class functions {
 			}
 		} else {
 			$app->uses("getconf");
-			$server_config = $app->getconf->get_server_config(1,'server');
+			$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'];
@@ -116,53 +116,53 @@ class functions {
 		}
 		return $url;
 	}
-	
-    public function json_encode($data) {
+
+	public function json_encode($data) {
 		if(!function_exists('json_encode')){
 			if(is_array($data) || is_object($data)){
-				$islist = is_array($data) && (empty($data) || array_keys($data) === range(0,count($data)-1));
+				$islist = is_array($data) && (empty($data) || array_keys($data) === range(0, count($data)-1));
 
 				if($islist){
 					$json = '[' . implode(',', array_map(array($this, "json_encode"), $data) ) . ']';
 				} else {
-					$items = Array();
+					$items = array();
 					foreach( $data as $key => $value ) {
 						$items[] = $this->json_encode("$key") . ':' . $this->json_encode($value);
 					}
 					$json = '{' . implode(',', $items) . '}';
 				}
 			} elseif(is_string($data)){
-				# Escape non-printable or Non-ASCII characters.
-				# I also put the \\ character first, as suggested in comments on the 'addclashes' page.
+				// Escape non-printable or Non-ASCII characters.
+				// I also put the \\ character first, as suggested in comments on the 'addclashes' page.
 				$string = '"'.addcslashes($data, "\\\"\n\r\t/".chr(8).chr(12)).'"';
 				$json = '';
 				$len = strlen($string);
-				# Convert UTF-8 to Hexadecimal Codepoints.
+				// Convert UTF-8 to Hexadecimal Codepoints.
 				for($i = 0; $i < $len; $i++){
 					$char = $string[$i];
 					$c1 = ord($char);
 
-					# Single byte;
+					// Single byte;
 					if($c1 <128){
 						$json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
 						continue;
 					}
 
-					# Double byte
+					// Double byte
 					$c2 = ord($string[++$i]);
 					if(($c1 & 32) === 0){
 						$json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
 						continue;
 					}
 
-					# Triple
+					// Triple
 					$c3 = ord($string[++$i]);
 					if(($c1 & 16) === 0){
 						$json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
 						continue;
 					}
 
-					# Quadruple
+					// Quadruple
 					$c4 = ord($string[++$i]);
 					if(($c1 & 8) === 0){
 						$u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
@@ -173,25 +173,25 @@ class functions {
 					}
 				}
 			} else {
-				# int, floats, bools, null
+				// int, floats, bools, null
 				$json = strtolower(var_export($data, true));
 			}
 			return $json;
 		} else {
 			return json_encode($data);
 		}
-    }
-	
+	}
+
 	public function suggest_ips($type = 'IPv4'){
 		global $app;
-	
+
 		if($type == 'IPv4'){
 			$regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/";
 		} else {
 			// IPv6
 			$regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i";
 		}
-		
+
 		$server_by_id = array();
 		$server_by_ip = array();
 		$servers = $app->db->queryAllRecords("SELECT * FROM server");
@@ -200,7 +200,7 @@ class functions {
 				$server_by_id[$server['server_id']] = $server['server_name'];
 			}
 		}
-	
+
 		$ips = array();
 		$results = $app->db->queryAllRecords("SELECT ip_address AS ip, server_id FROM server_ip WHERE ip_type = '".$type."'");
 		if(!empty($results) && is_array($results)){
@@ -229,7 +229,7 @@ class functions {
 				if(preg_match($regex, $result['ip'])) $ips[] = $result['ip'];
 			}
 		}
-	
+
 		$results = $app->db->queryAllRecords("SELECT xfer FROM dns_slave WHERE xfer != ''");
 		if(!empty($results) && is_array($results)){
 			foreach($results as $result){
@@ -274,117 +274,119 @@ class functions {
 		sort($ips, SORT_NUMERIC);
 
 		$result_array = array('cheader' => array(), 'cdata' => array());
-	
+
 		if(!empty($ips)){
 			$result_array['cheader'] = array('title' => 'IPs',
-											'total' => count($ips),
-											'limit' => count($ips)
-											);
-	
+				'total' => count($ips),
+				'limit' => count($ips)
+			);
+
 			foreach($ips as $ip){
-				$result_array['cdata'][] = array(	'title' => $ip,
-													'description' => $type.($server_by_ip[$ip] != ''? ' &gt; '.$server_by_ip[$ip] : ''),
-													'onclick' => '',
-													'fill_text' => $ip
-												);
+				$result_array['cdata'][] = array( 'title' => $ip,
+					'description' => $type.($server_by_ip[$ip] != ''? ' &gt; '.$server_by_ip[$ip] : ''),
+					'onclick' => '',
+					'fill_text' => $ip
+				);
 			}
 		}
-	
+
 		return $result_array;
 	}
 
-    public function intval($string, $force_numeric = false) {
-        if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
-            if($force_numeric == true) return floatval($string);
-            elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
-            else return 0;
-        } else {
-            return intval($string);
-        }
-    }
-    
-    /**
-    * Function to change bytes to kB, MB, GB or TB
-    * @param int $size - size in bytes
-    * @param int precicion - after-comma-numbers (default: 2)
-    * @return string - formated bytes
-    */
-    public function formatBytes($size, $precision = 2) {
-        $base=log($size)/log(1024);
-        $suffixes=array('','k','M','G','T');
-        return round(pow(1024,$base-floor($base)),$precision).$suffixes[floor($base)];
-    }
-
-    /** IDN converter wrapper.
-     * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
-     */
-    private function _idn_encode_decode($domain, $encode = true) {
-        if($domain == '') return '';
-        if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
-        
-        // get domain and user part if it is an email
-        $user_part = false;
-        if(strpos($domain, '@') !== false) {
-            $user_part = substr($domain, 0, strrpos($domain, '@'));
-            $domain = substr($domain, strrpos($domain, '@') + 1);
-        }
-        
-        if($encode == true) {
-            if(function_exists('idn_to_ascii')) {
-                $domain = idn_to_ascii($domain);
-            } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
-                 /* use idna class:
+	public function intval($string, $force_numeric = false) {
+		if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
+			if($force_numeric == true) return floatval($string);
+			elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
+			else return 0;
+		} else {
+			return intval($string);
+		}
+	}
+
+	/**
+	 * Function to change bytes to kB, MB, GB or TB
+	 * @param int $size - size in bytes
+	 * @param int precicion - after-comma-numbers (default: 2)
+	 * @return string - formated bytes
+	 */
+
+
+	public function formatBytes($size, $precision = 2) {
+		$base=log($size)/log(1024);
+		$suffixes=array('', 'k', 'M', 'G', 'T');
+		return round(pow(1024, $base-floor($base)), $precision).$suffixes[floor($base)];
+	}
+
+	/** IDN converter wrapper.
+	 * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
+	 */
+	private function _idn_encode_decode($domain, $encode = true) {
+		if($domain == '') return '';
+		if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
+
+		// get domain and user part if it is an email
+		$user_part = false;
+		if(strpos($domain, '@') !== false) {
+			$user_part = substr($domain, 0, strrpos($domain, '@'));
+			$domain = substr($domain, strrpos($domain, '@') + 1);
+		}
+
+		if($encode == true) {
+			if(function_exists('idn_to_ascii')) {
+				$domain = idn_to_ascii($domain);
+			} elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+				/* use idna class:
                  * @author  Matthias Sommerfeld <mso@phlylabs.de>
                  * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
                  * @version 0.8.0 2011-03-11
                  */
-                
-                if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
-                    include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
-                    $this->idn_converter = new idna_convert(array('idn_version' => 2008));
-                    $this->idn_converter_name = 'idna_convert.class';
-                }
-                $domain = $this->idn_converter->encode($domain);
-            }
-        } else {
-            if(function_exists('idn_to_utf8')) {
-                $domain = idn_to_utf8($domain);
-            } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
-                 /* use idna class:
+
+				if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+					include_once ISPC_CLASS_PATH.'/idn/idna_convert.class.php';
+					$this->idn_converter = new idna_convert(array('idn_version' => 2008));
+					$this->idn_converter_name = 'idna_convert.class';
+				}
+				$domain = $this->idn_converter->encode($domain);
+			}
+		} else {
+			if(function_exists('idn_to_utf8')) {
+				$domain = idn_to_utf8($domain);
+			} elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+				/* use idna class:
                  * @author  Matthias Sommerfeld <mso@phlylabs.de>
                  * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
                  * @version 0.8.0 2011-03-11
                  */
-                
-                if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
-                    include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
-                    $this->idn_converter = new idna_convert(array('idn_version' => 2008));
-                    $this->idn_converter_name = 'idna_convert.class';
-                }
-                $domain = $this->idn_converter->decode($domain);
-            }
-        }
-        
-        if($user_part !== false) return $user_part . '@' . $domain;
-        else return $domain;
-    }
-     
-    public function idn_encode($domain) {
-        $domains = explode("\n", $domain);
-        for($d = 0; $d < count($domains); $d++) {
-            $domains[$d] = $this->_idn_encode_decode($domains[$d], true);
-        }
-        return implode("\n", $domains);
-    }
-    
-    public function idn_decode($domain) {
-        $domains = explode("\n", $domain);
-        for($d = 0; $d < count($domains); $d++) {
-            $domains[$d] = $this->_idn_encode_decode($domains[$d], false);
-        }
-        return implode("\n", $domains);
-    }
-		
+
+				if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+					include_once ISPC_CLASS_PATH.'/idn/idna_convert.class.php';
+					$this->idn_converter = new idna_convert(array('idn_version' => 2008));
+					$this->idn_converter_name = 'idna_convert.class';
+				}
+				$domain = $this->idn_converter->decode($domain);
+			}
+		}
+
+		if($user_part !== false) return $user_part . '@' . $domain;
+		else return $domain;
+	}
+
+	public function idn_encode($domain) {
+		$domains = explode("\n", $domain);
+		for($d = 0; $d < count($domains); $d++) {
+			$domains[$d] = $this->_idn_encode_decode($domains[$d], true);
+		}
+		return implode("\n", $domains);
+	}
+
+	public function idn_decode($domain) {
+		$domains = explode("\n", $domain);
+		for($d = 0; $d < count($domains); $d++) {
+			$domains[$d] = $this->_idn_encode_decode($domains[$d], false);
+		}
+		return implode("\n", $domains);
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/getconf.inc.php b/interface/lib/classes/getconf.inc.php
index ad2a30231b1b4e7c31896a9cb4efc80f367f07f9..45fefa601b503a46b57898046183cafd5f96d556 100644
--- a/interface/lib/classes/getconf.inc.php
+++ b/interface/lib/classes/getconf.inc.php
@@ -31,7 +31,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 class getconf {
 
 	private $config;
-	
+
 	public function get_server_config($server_id, $section = '') {
 		global $app;
 
@@ -43,10 +43,10 @@ class getconf {
 		}
 		return ($section == '') ? $this->config[$server_id] : $this->config[$server_id][$section];
 	}
-	
+
 	public function get_global_config($section = '') {
 		global $app;
-		
+
 		if(!isset($this->config['global'])) {
 			$app->uses('ini_parser');
 			$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
@@ -54,6 +54,7 @@ class getconf {
 		}
 		return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
 	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/importer.inc.php b/interface/lib/classes/importer.inc.php
index e74c0993ab4a3b3b003b760d9e929ce9747ee983..f6cbab570cd1ef1b072b8f3bf09876ca3dab31f1 100644
--- a/interface/lib/classes/importer.inc.php
+++ b/interface/lib/classes/importer.inc.php
@@ -30,56 +30,59 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-require_once(realpath(dirname(__FILE__)) . '/remoting.inc.php');
+require_once realpath(dirname(__FILE__)) . '/remoting.inc.php';
 
 class fakeserver {
-    private $faultMessage;
-    private $faultText;
-    public function fault($message = '', $text = '') {
-        $this->faultMessage = $message;
-        $this->faultText = $text;
-    }
-    
-    public function getFault() {
-        $ret = $this->faultMessage . ' (' . $this->faultText . ')';
-        $this->faultMessage = null;
-        $this->faultText = null;
-        return $ret;
-    }
+	private $faultMessage;
+	private $faultText;
+	public function fault($message = '', $text = '') {
+		$this->faultMessage = $message;
+		$this->faultText = $text;
+	}
+
+	public function getFault() {
+		$ret = $this->faultMessage . ' (' . $this->faultText . ')';
+		$this->faultMessage = null;
+		$this->faultText = null;
+		return $ret;
+	}
+
 }
 
 class importer extends remoting {
 	public function __construct()
-    {
-        $this->server = new fakeserver();
-    }
+	{
+		$this->server = new fakeserver();
+	}
 
 	//* remote login function - overridden just to make sure it cannot be called from importer scripts
 	public function login($username, $password)
-    {
-		
+	{
+
 	}
-	
+
 	//* remote logout function - overridden just to make sure it cannot be called from importer scripts
 	public function logout($session_id)
-    {		
-		
+	{
+
 	}
-	
+
 	public function getFault() {
-        return $this->server->getFault();
-    }
-	
+		return $this->server->getFault();
+	}
+
 	protected function checkPerm($session_id, $function_name)
-    {
-        // always return true as this is used from inside the application not through remote calls
-        return true;
+	{
+		// always return true as this is used from inside the application not through remote calls
+		return true;
 	}
-	
-	
+
+
 	protected function getSession($session_id)
-    {	
+	{
 		return array(); // we have no sessions here
 	}
+
 }
+
 ?>
diff --git a/interface/lib/classes/ini_parser.inc.php b/interface/lib/classes/ini_parser.inc.php
index 6303115753d2f628b4210b84f73a4bfc896eaa3d..b8dffbafa5cd57b316c3d16241ae867abc798fa3 100644
--- a/interface/lib/classes/ini_parser.inc.php
+++ b/interface/lib/classes/ini_parser.inc.php
@@ -59,8 +59,8 @@ class ini_parser{
 			$content .= "[$section]\n";
 			foreach($data as $item => $value) {
 				if($item != ''){
-					$value 	= trim($value);
-					$item 	= trim($item);
+					$value  = trim($value);
+					$item  = trim($item);
 					$content .= "$item=$value\n";
 				}
 			}
diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php
index d49af96fc6100135f24ce0078325247382ea2b88..dff71f3b89a70473e7e5f788d8fab4ffede0acb7 100644
--- a/interface/lib/classes/ispcmail.inc.php
+++ b/interface/lib/classes/ispcmail.inc.php
@@ -30,498 +30,544 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /**
  * email class
- * 
+ *
  * @package pxFramework
  *
  */
+
+
 class ispcmail {
-    
-    /**#@+
+
+	/**#@+
      * @access private
      */
-    private $html_part;
-    private $text_part;
-    
-    private $headers;
-    
-    private $_logged_in = false;
-    private $_smtp_conn = null;
-    
-    private $_crlf = "\n";
-    
-    private $attach_type = 'application/octet-stream';
-    private $attachments;
-    private $mime_boundary;
-    private $body = '';
-    private $_mail_sender = '';
-    private $_sent_mails = 0;
-    private $user_agent = 'ISPConfig/3 (Mailer Class)';
-    /**#@-*/
-    
-    /**
-     * set the mail charset
-     */
-    private $mail_charset  = 'UTF-8';//'ISO-8859-1';
-    
-    /**#@+
+	private $html_part;
+	private $text_part;
+
+	private $headers;
+
+	private $_logged_in = false;
+	private $_smtp_conn = null;
+
+	private $_crlf = "\n";
+
+	private $attach_type = 'application/octet-stream';
+	private $attachments;
+	private $mime_boundary;
+	private $body = '';
+	private $_mail_sender = '';
+	private $_sent_mails = 0;
+	private $user_agent = 'ISPConfig/3 (Mailer Class)';
+	/**#@-*/
+
+
+
+	/**
+	 * set the mail charset
+	 */
+	private $mail_charset  = 'UTF-8';//'ISO-8859-1';
+
+	/**#@+
      * Provide smtp credentials for smtp mail sending
      *
      * @access public
      */
-    /**
-     * if set to true smtp is used instead of mail() to send emails
-     * @see mail
-     */
-    private $use_smtp = false;
-    /**
-     * the smtp helo string - use the mail server name here!
-     */
-    private $smtp_helo = '';
-    /**
-     * the smtp server to send mails
-     */
-    private $smtp_host = '';
-    /**
-     * the smtp port
-     */
-    private $smtp_port = 25;
-    /**
-     * if the smtp server needs authentication you can set the smtp user here
-     */
-    private $smtp_user = '';
-    /**
-     * if the smtp server needs authentication you can set the smtp password here
-     */
-    private $smtp_pass = '';
-    /**
-     * If you want to use tls/ssl specify it here
-     */
-    private $smtp_crypt = ''; // tls or ssl
-    /**
-     * How many mails should be sent via one single smtp connection
-     */
-    private $smtp_max_mails = 20;
-    /**
-     * Should the mail be signed
-     */
-    private $sign_email = false;
-    /**
-     * The cert and key to use for email signing
-     */
-    private $sign_key = '';
-    private $sign_key_pass = '';
-    private $sign_cert = '';
-    private $sign_bundle = '';
-    private $_is_signed = false;
-    /**
-     * get disposition notification
-     */
-    private $notification = false;
-    /**#@-*/
-    
-    public function __construct($options = array()) {
-        $rand = md5(microtime());
-        $this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
-        
-        $this->headers = array();
-        $this->attachments = array();
-        
-        $this->headers['MIME-Version'] = '1.0';
-        $this->headers['User-Agent'] = $this->user_agent;
-        if(is_array($options) && count($options) > 0) $this->setOptions($options);
-    }
-    
-    public function __destruct() {
-        $this->finish();
-    }
-    
-    /**
-     * Set option
-     * 
-     * @param string $key the option to set
-     * @param string $value the option value to set
-     */
-    public function setOption($key, $value) {
-        switch($key) {
-            case 'smtp_helo':
-                $this->smtp_helo = $value;
-                break;
-            case 'smtp_host':
-                $this->smtp_host = $value;
-                break;
-            case 'smtp_server':
-                $this->smtp_host = $value;
-                break;
-            case 'smtp_port':
-                $this->smtp_port = $value;
-                break;
-            case 'smtp_user':
-                $this->smtp_user = $value;
-                break;
-            case 'smtp_pass':
-                $this->smtp_pass = $value;
-                break;
-            case 'smtp_max_mails':
-                $this->smtp_max_mails = intval($value);
-                if($this->smtp_max_mails < 1) $this->smtp_max_mails = 1;
-                break;
-            case 'use_smtp':
-                $this->use_smtp = ($value == true ? true : false);
-                if($value == true) $this->_crlf = "\r\n";
-                break;
-            case 'smtp_crypt':
-                if($value != 'ssl' && $value != 'tls') $value = '';
-                $this->smtp_crypt = $value;
-                break;
-            case 'sign_email':
-                $this->sign_email = ($value == true ? true : false);
-                break;
-            case 'sign_key':
-                $this->sign_key = $value;
-                break;
-            case 'sign_key_pass':
-                $this->sign_key_pass = $value;
-                break;
-            case 'sign_cert':
-                $this->sign_cert = $value;
-                break;
-            case 'sign_bundle':
-                $this->sign_bundle = $value;
-                break;
-            case 'mail_charset':
-                $this->mail_charset = $value;
-                break;
-            case 'notify':
-                $this->notification = ($value == true ? true : false);
-                break;
-        }
-    }
-    
-    /** Detect the helo string if none given
-     * 
-     */
-    private function detectHelo() {
-        if(isset($_SERVER['HTTP_HOST'])) $this->smtp_helo = $_SERVER['HTTP_HOST'];
-        elseif(isset($_SERVER['SERVER_NAME'])) $this->smtp_helo = $_SERVER['SERVER_NAME'];
-        else $this->smtp_helo = php_uname('n');
-        if($this->smtp_helo == '') $this->smtp_helo = 'localhost';
-    }
-    
-    /**
-     * Set options
-     * 
-     * @param array $options the options to set as an associative array key => value
-     */
-    public function setOptions($options) {
-        foreach($options as $key => $value) $this->setOption($key, $value);
-    }
-    
-    /**
-     * Read a file's contents
-     *
-     * Simply gets the file's content
-     *
-     * @access public
-     * @param string $filename name and path of file to read
-     * @return string file content (can be binary)
-     */
-    public function read_File($filename) {
-        $content = '';
-        
-        $fp = fopen($filename, 'r');
-        if(!$fp) return false;
-        
-        while(!feof($fp)) {
-            $content .= fread($fp, 1024);
-        }
-        fclose($fp);
-        
-        return $content;
-    }
-    
-    /**
-     * set smtp connection encryption
-     * 
-     * @access public
-     * @param string $mode encryption mode (tls, ssl or empty string)
-     */
-    public function setSMTPEncryption($mode = '') {
-        if($mode != 'ssl' && $mode != 'tls') $mode = '';
-        $this->smtp_crypt = $mode;
-    }
 
-    /**
-     * set a mail header
-     *
-     * Sets a single mail header to a given value
-     *
-     * @access public
-     * @param string $header header name to set
-     * @param string $value value to set in header field
-     */
-    public function setHeader($header, $value) {
-        if(strtolower($header) == 'bcc') $header = 'Bcc';
-        elseif(strtolower($header) == 'cc') $header = 'Cc';
-        elseif(strtolower($header) == 'from') $header = 'From';
-        $this->headers["$header"] = $value;
-    }
-    
-    /**
-     * get a mail header value
-     *
-     * Returns a value of a single mail header
-     *
-     * @access public
-     * @param string $header header name to get
-     * @return string header value
-     */
-    public function getHeader($header) {
-        if(strtolower($header) == 'bcc') $header = 'Bcc';
-        elseif(strtolower($header) == 'cc') $header = 'Cc';
-        elseif(strtolower($header) == 'from') $header = 'From';
-        return (isset($this->headers["$header"]) ? $this->headers["$header"] : '');
-    }
-    
-    /**
-     * Set email sender
-     *
-     * Sets the email sender and optionally the sender's name
-     *
-     * @access public
-     * @param string $email sender email address
-     * @param string $name sender name
-     */
-    public function setSender($email, $name = '') {
-        if($name) $header = '"' . $name . '" <' . $email . '>';
-        else $header = '<' . $email . '>';
-        
-        $this->_mail_sender = $email;
-        
-        $this->setHeader('From', $header);
-    }
-    
-    /**
-     * Set mail subject
-     *
-     * @access public
-     * @param string $subject the mail subject
-     * @return string where-string for db query
-     */
-    public function setSubject($subject) {
-        $this->setHeader('Subject', $subject);
-    }
-    
-    /**
-     * Get current mail subject
-     *
-     * @access public
-     * @return string mail subject
-     */
-    public function getSubject() {
-        return $this->headers['Subject'];
-    }
-    
-    /**
-     * Set mail content
-     *
-     * Sets the mail html and plain text content
-     *
-     * @access public
-     * @param string $text plain text mail content (can be empty)
-     * @param string $html html mail content
-     */
-    public function setMailText($text, $html = '') {
-        $this->text_part = $text;
-        $this->html_part = $html;
-    }
-    
-    /**
-     * Read and attach a file
-     *
-     * Reads a file and attaches it to the current email
-     *
-     * @access public
-     * @param string $filename the file to read and attach
-     * @param string $display_name the name that will be displayed in the mail
-     * @see read_File
-     */
-    public function readAttachFile($filename, $display_name = '') {
-        if($display_name == '') {
-            $path_parts = pathinfo($filename);
-            $display_name = $path_parts["basename"];
-            unset($path_parts);
-        }
-        $this->attachFile($this->read_File($filename), $display_name);
-    }
-    
-    /**
-     * Attach a file
-     *
-     * Attaches a string (can be binary) as a file to the mail
-     *
-     * @access public
-     * @param string $content attachment data string
-     * @param string $filename name for file attachment
-     */
-    public function attachFile($content, $filename) {
-        $attachment = array('content' => $content,
-                            'filename' => $filename,
-                            'type' => 'application/octet-stream',
-                            'encoding' => 'base64'
-                           );
-        $this->attachments[] = $attachment;
-    }
-    
-    /**
-     * @access private
-     */
-    private function create() {
-        $attach = false;
-        $html = false;
-        $text = false;
-        
-        if($this->html_part) $html = true;
-        if($this->text_part) $text = true;
-        if(count($this->attachments) > 0) $attach = true;
-        
-        $textonly = false;
-        $htmlonly = false;
-        if($text == true && $html == false && $attach == false) {
-            // only text
-            $content_type = 'text/plain; charset="' . strtolower($this->mail_charset) . '"';
-            $textonly = true;
-        } elseif($text == true && $html == false && $attach == true) {
-            // text and attachment
-            $content_type = 'multipart/mixed;';
-            $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
-        } elseif($html == true && $text == true && $attach == false) {
-            // html only (or text too)
-            $content_type = 'multipart/alternative;';
-            $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
-        } elseif($html == true && $text == false && $attach == false) {
-            // html only (or text too)
-            $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"';
-            $htmlonly = true;
-        } elseif($html == true && $attach == true) {
-            // html and attachments
-            $content_type = 'multipart/mixed;';
-            $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
-        }
-        
-        $this->headers['Content-Type'] = $content_type;
-        
-        if($textonly == false && $htmlonly == false) {
-            $this->body = "This is a multi-part message in MIME format.\n\n";
-            
-            if($text) {
-                /*$this->body .= "--{$this->mime_boundary}\n" .
+	/**
+	 * if set to true smtp is used instead of mail() to send emails
+	 * @see mail
+	 */
+	private $use_smtp = false;
+
+	/**
+	 * the smtp helo string - use the mail server name here!
+	 */
+	private $smtp_helo = '';
+
+	/**
+	 * the smtp server to send mails
+	 */
+	private $smtp_host = '';
+
+	/**
+	 * the smtp port
+	 */
+	private $smtp_port = 25;
+
+	/**
+	 * if the smtp server needs authentication you can set the smtp user here
+	 */
+	private $smtp_user = '';
+
+	/**
+	 * if the smtp server needs authentication you can set the smtp password here
+	 */
+	private $smtp_pass = '';
+
+	/**
+	 * If you want to use tls/ssl specify it here
+	 */
+	private $smtp_crypt = ''; // tls or ssl
+	/**
+	 * How many mails should be sent via one single smtp connection
+	 */
+	private $smtp_max_mails = 20;
+
+	/**
+	 * Should the mail be signed
+	 */
+	private $sign_email = false;
+
+	/**
+	 * The cert and key to use for email signing
+	 */
+	private $sign_key = '';
+	private $sign_key_pass = '';
+	private $sign_cert = '';
+	private $sign_bundle = '';
+	private $_is_signed = false;
+
+	/**
+	 * get disposition notification
+	 */
+	private $notification = false;
+	/**#@-*/
+
+	public function __construct($options = array()) {
+		$rand = md5(microtime());
+		$this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
+
+		$this->headers = array();
+		$this->attachments = array();
+
+		$this->headers['MIME-Version'] = '1.0';
+		$this->headers['User-Agent'] = $this->user_agent;
+		if(is_array($options) && count($options) > 0) $this->setOptions($options);
+	}
+
+	public function __destruct() {
+		$this->finish();
+	}
+
+
+
+	/**
+	 * Set option
+	 *
+	 * @param string $key the option to set
+	 * @param string $value the option value to set
+	 */
+	public function setOption($key, $value) {
+		switch($key) {
+		case 'smtp_helo':
+			$this->smtp_helo = $value;
+			break;
+		case 'smtp_host':
+			$this->smtp_host = $value;
+			break;
+		case 'smtp_server':
+			$this->smtp_host = $value;
+			break;
+		case 'smtp_port':
+			$this->smtp_port = $value;
+			break;
+		case 'smtp_user':
+			$this->smtp_user = $value;
+			break;
+		case 'smtp_pass':
+			$this->smtp_pass = $value;
+			break;
+		case 'smtp_max_mails':
+			$this->smtp_max_mails = intval($value);
+			if($this->smtp_max_mails < 1) $this->smtp_max_mails = 1;
+			break;
+		case 'use_smtp':
+			$this->use_smtp = ($value == true ? true : false);
+			if($value == true) $this->_crlf = "\r\n";
+			break;
+		case 'smtp_crypt':
+			if($value != 'ssl' && $value != 'tls') $value = '';
+			$this->smtp_crypt = $value;
+			break;
+		case 'sign_email':
+			$this->sign_email = ($value == true ? true : false);
+			break;
+		case 'sign_key':
+			$this->sign_key = $value;
+			break;
+		case 'sign_key_pass':
+			$this->sign_key_pass = $value;
+			break;
+		case 'sign_cert':
+			$this->sign_cert = $value;
+			break;
+		case 'sign_bundle':
+			$this->sign_bundle = $value;
+			break;
+		case 'mail_charset':
+			$this->mail_charset = $value;
+			break;
+		case 'notify':
+			$this->notification = ($value == true ? true : false);
+			break;
+		}
+	}
+
+
+
+	/** Detect the helo string if none given
+	 *
+	 */
+	private function detectHelo() {
+		if(isset($_SERVER['HTTP_HOST'])) $this->smtp_helo = $_SERVER['HTTP_HOST'];
+		elseif(isset($_SERVER['SERVER_NAME'])) $this->smtp_helo = $_SERVER['SERVER_NAME'];
+		else $this->smtp_helo = php_uname('n');
+		if($this->smtp_helo == '') $this->smtp_helo = 'localhost';
+	}
+
+
+
+	/**
+	 * Set options
+	 *
+	 * @param array $options the options to set as an associative array key => value
+	 */
+	public function setOptions($options) {
+		foreach($options as $key => $value) $this->setOption($key, $value);
+	}
+
+
+
+	/**
+	 * Read a file's contents
+	 *
+	 * Simply gets the file's content
+	 *
+	 * @access public
+	 * @param string $filename name and path of file to read
+	 * @return string file content (can be binary)
+	 */
+	public function read_File($filename) {
+		$content = '';
+
+		$fp = fopen($filename, 'r');
+		if(!$fp) return false;
+
+		while(!feof($fp)) {
+			$content .= fread($fp, 1024);
+		}
+		fclose($fp);
+
+		return $content;
+	}
+
+
+
+	/**
+	 * set smtp connection encryption
+	 *
+	 * @access public
+	 * @param string $mode encryption mode (tls, ssl or empty string)
+	 */
+	public function setSMTPEncryption($mode = '') {
+		if($mode != 'ssl' && $mode != 'tls') $mode = '';
+		$this->smtp_crypt = $mode;
+	}
+
+	/**
+	 * set a mail header
+	 *
+	 * Sets a single mail header to a given value
+	 *
+	 * @access public
+	 * @param string $header header name to set
+	 * @param string $value value to set in header field
+	 */
+	public function setHeader($header, $value) {
+		if(strtolower($header) == 'bcc') $header = 'Bcc';
+		elseif(strtolower($header) == 'cc') $header = 'Cc';
+		elseif(strtolower($header) == 'from') $header = 'From';
+		$this->headers["$header"] = $value;
+	}
+
+
+
+	/**
+	 * get a mail header value
+	 *
+	 * Returns a value of a single mail header
+	 *
+	 * @access public
+	 * @param string $header header name to get
+	 * @return string header value
+	 */
+	public function getHeader($header) {
+		if(strtolower($header) == 'bcc') $header = 'Bcc';
+		elseif(strtolower($header) == 'cc') $header = 'Cc';
+		elseif(strtolower($header) == 'from') $header = 'From';
+		return isset($this->headers["$header"]) ? $this->headers["$header"] : '';
+	}
+
+
+
+	/**
+	 * Set email sender
+	 *
+	 * Sets the email sender and optionally the sender's name
+	 *
+	 * @access public
+	 * @param string $email sender email address
+	 * @param string $name sender name
+	 */
+	public function setSender($email, $name = '') {
+		if($name) $header = '"' . $name . '" <' . $email . '>';
+		else $header = '<' . $email . '>';
+
+		$this->_mail_sender = $email;
+
+		$this->setHeader('From', $header);
+	}
+
+
+
+	/**
+	 * Set mail subject
+	 *
+	 * @access public
+	 * @param string $subject the mail subject
+	 * @return string where-string for db query
+	 */
+	public function setSubject($subject) {
+		$this->setHeader('Subject', $subject);
+	}
+
+
+
+	/**
+	 * Get current mail subject
+	 *
+	 * @access public
+	 * @return string mail subject
+	 */
+	public function getSubject() {
+		return $this->headers['Subject'];
+	}
+
+
+
+	/**
+	 * Set mail content
+	 *
+	 * Sets the mail html and plain text content
+	 *
+	 * @access public
+	 * @param string $text plain text mail content (can be empty)
+	 * @param string $html html mail content
+	 */
+	public function setMailText($text, $html = '') {
+		$this->text_part = $text;
+		$this->html_part = $html;
+	}
+
+
+
+	/**
+	 * Read and attach a file
+	 *
+	 * Reads a file and attaches it to the current email
+	 *
+	 * @access public
+	 * @param string $filename the file to read and attach
+	 * @param string $display_name the name that will be displayed in the mail
+	 * @see read_File
+	 */
+	public function readAttachFile($filename, $display_name = '') {
+		if($display_name == '') {
+			$path_parts = pathinfo($filename);
+			$display_name = $path_parts["basename"];
+			unset($path_parts);
+		}
+		$this->attachFile($this->read_File($filename), $display_name);
+	}
+
+
+
+	/**
+	 * Attach a file
+	 *
+	 * Attaches a string (can be binary) as a file to the mail
+	 *
+	 * @access public
+	 * @param string $content attachment data string
+	 * @param string $filename name for file attachment
+	 */
+	public function attachFile($content, $filename) {
+		$attachment = array('content' => $content,
+			'filename' => $filename,
+			'type' => 'application/octet-stream',
+			'encoding' => 'base64'
+		);
+		$this->attachments[] = $attachment;
+	}
+
+
+
+	/**
+	 * @access private
+	 */
+	private function create() {
+		$attach = false;
+		$html = false;
+		$text = false;
+
+		if($this->html_part) $html = true;
+		if($this->text_part) $text = true;
+		if(count($this->attachments) > 0) $attach = true;
+
+		$textonly = false;
+		$htmlonly = false;
+		if($text == true && $html == false && $attach == false) {
+			// only text
+			$content_type = 'text/plain; charset="' . strtolower($this->mail_charset) . '"';
+			$textonly = true;
+		} elseif($text == true && $html == false && $attach == true) {
+			// text and attachment
+			$content_type = 'multipart/mixed;';
+			$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
+		} elseif($html == true && $text == true && $attach == false) {
+			// html only (or text too)
+			$content_type = 'multipart/alternative;';
+			$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
+		} elseif($html == true && $text == false && $attach == false) {
+			// html only (or text too)
+			$content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"';
+			$htmlonly = true;
+		} elseif($html == true && $attach == true) {
+			// html and attachments
+			$content_type = 'multipart/mixed;';
+			$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
+		}
+
+		$this->headers['Content-Type'] = $content_type;
+
+		if($textonly == false && $htmlonly == false) {
+			$this->body = "This is a multi-part message in MIME format.\n\n";
+
+			if($text) {
+				/*$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";*/
 				$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";
+					"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" .
-                               "Content-Type:text/html; charset=\"" . strtolower($this->mail_charset) . "\"\n" . 
+
+			if($html) {
+				/*$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";*/
 				$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";
+					"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) {
-                    $this->body .= "--{$this->mime_boundary}\n" .
-                                   "Content-Type: " . $att['type'] . ";\n" .
-                                   " name=\"" . $att['filename'] . "\"\n" .
-                                   "Content-Transfer-Encoding: base64\n" . 
-                                   "Content-Disposition: attachment;\n\n" .
-                                   chunk_split(base64_encode($att['content'])) . "\n\n";
-                }
-            }
-            $this->body .= "--{$this->mime_boundary}--\n";
-        } elseif($htmlonly == true) {
-            $this->body = $this->html_part;
-        } else {
-            $this->body = $this->text_part;
-        }
-        
-        if (isset($this->body)) {
-            // Add message ID header
-            $message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), $this->smtp_helo != '' ? $this->smtp_helo : $this->detectHelo());
-            $this->headers['Message-ID'] = $message_id;
-            return true;
-        } else {
-            return false;
-        }
-    }
-    
-    /**
-     * Function to sign an email body
-     */
-    private function sign() {
-        if($this->sign_email == false || $this->sign_key == '' || $this->sign_cert == '') return false;
-        if(function_exists('openssl_pkcs7_sign') == false) return false;
-        
-        $tmpin = tempnam(sys_get_temp_dir(), 'sign');
-        $tmpout = tempnam(sys_get_temp_dir(), 'sign');
-        if(!file_exists($tmpin) || !is_writable($tmpin)) return false;
-        
-        file_put_contents($tmpin, 'Content-Type: ' . $this->getHeader('Content-Type') . "\n\n" . $this->body);
-        $tmpf_key = tempnam(sys_get_temp_dir(), 'sign');
-        file_put_contents($tmpf_key, $this->sign_key);
-        $tmpf_cert = tempnam(sys_get_temp_dir(), 'sign');
-        file_put_contents($tmpf_cert, $this->sign_cert);
-        if($this->sign_bundle != '')  {
-            $tmpf_bundle = tempnam(sys_get_temp_dir(), 'sign');
-            file_put_contents($tmpf_bundle, $this->sign_bundle);
-            openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array(), PKCS7_DETACHED, realpath($tmpf_bundle));
-        } else {
-            openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array());
-        }
-        unlink($tmpin);
-        unlink($tmpf_cert);
-        unlink($tmpf_key);
-        if(file_exists($tmpf_bundle)) unlink($tmpf_bundle);
-        
-        if(!file_exists($tmpout) || !is_readable($tmpout)) return false;
-        $this->body = file_get_contents($tmpout);
-        unlink($tmpout);
-        
-        unset($this->headers['Content-Type']);
-        unset($this->headers['MIME-Version']);
-        
-        $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') {
+
+			if($attach) {
+				foreach($this->attachments as $att) {
+					$this->body .= "--{$this->mime_boundary}\n" .
+						"Content-Type: " . $att['type'] . ";\n" .
+						" name=\"" . $att['filename'] . "\"\n" .
+						"Content-Transfer-Encoding: base64\n" .
+						"Content-Disposition: attachment;\n\n" .
+						chunk_split(base64_encode($att['content'])) . "\n\n";
+				}
+			}
+			$this->body .= "--{$this->mime_boundary}--\n";
+		} elseif($htmlonly == true) {
+			$this->body = $this->html_part;
+		} else {
+			$this->body = $this->text_part;
+		}
+
+		if (isset($this->body)) {
+			// Add message ID header
+			$message_id = sprintf('<%s.%s@%s>', base_convert(time(), 10, 36), base_convert(rand(), 10, 36), $this->smtp_helo != '' ? $this->smtp_helo : $this->detectHelo());
+			$this->headers['Message-ID'] = $message_id;
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Function to sign an email body
+	 */
+	private function sign() {
+		if($this->sign_email == false || $this->sign_key == '' || $this->sign_cert == '') return false;
+		if(function_exists('openssl_pkcs7_sign') == false) return false;
+
+		$tmpin = tempnam(sys_get_temp_dir(), 'sign');
+		$tmpout = tempnam(sys_get_temp_dir(), 'sign');
+		if(!file_exists($tmpin) || !is_writable($tmpin)) return false;
+
+		file_put_contents($tmpin, 'Content-Type: ' . $this->getHeader('Content-Type') . "\n\n" . $this->body);
+		$tmpf_key = tempnam(sys_get_temp_dir(), 'sign');
+		file_put_contents($tmpf_key, $this->sign_key);
+		$tmpf_cert = tempnam(sys_get_temp_dir(), 'sign');
+		file_put_contents($tmpf_cert, $this->sign_cert);
+		if($this->sign_bundle != '')  {
+			$tmpf_bundle = tempnam(sys_get_temp_dir(), 'sign');
+			file_put_contents($tmpf_bundle, $this->sign_bundle);
+			openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array(), PKCS7_DETACHED, realpath($tmpf_bundle));
+		} else {
+			openssl_pkcs7_sign($tmpin, $tmpout, 'file://' . realpath($tmpf_cert), array('file://' . realpath($tmpf_key), $this->sign_key_pass), array());
+		}
+		unlink($tmpin);
+		unlink($tmpf_cert);
+		unlink($tmpf_key);
+		if(file_exists($tmpf_bundle)) unlink($tmpf_bundle);
+
+		if(!file_exists($tmpout) || !is_readable($tmpout)) return false;
+		$this->body = file_get_contents($tmpout);
+		unlink($tmpout);
+
+		unset($this->headers['Content-Type']);
+		unset($this->headers['MIME-Version']);
+
+		$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_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') {
-        /*
+
+		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 {
@@ -532,204 +578,213 @@ class ispcmail {
 			}
 		}*/
 		$input='=?UTF-8?B?'.base64_encode($input).'?=';
-        
-        return $input;
-    }
-    
-    /**
-     * @access private
-     */
-    private function _smtp_login() {
-        $this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'ssl://' : '') . $this->smtp_host, $this->smtp_port, $errno, $errstr, 30);
-        $response = fgets($this->_smtp_conn, 515);
-        if(empty($this->_smtp_conn)) return false;
-        
-        // ENCRYPTED?
-        if($this->smtp_crypt == 'tls') {
-            fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
-            fgets($this->_smtp_conn, 515);
-            stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
-        }
-        
-        //Say Hello to SMTP
-        if($this->smtp_helo == '') $this->detectHelo();
-        fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        //AUTH LOGIN
-        fputs($this->_smtp_conn, 'AUTH LOGIN' . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        //Send username
-        fputs($this->_smtp_conn, base64_encode($this->smtp_user) . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        //Send password
-        fputs($this->_smtp_conn, base64_encode($this->smtp_pass) . $this->_crlf);
-        $response = fgets($this->_smtp_conn, 515);
-        
-        $this->_logged_in = true;
-        return true;
-    }
-    
-    /**
-     * @access private
-     */
-    private function _smtp_close() {
-        $this->_logged_in = false;
-        
-        if(empty($this->_smtp_conn)) {
-            return false;
-        }
-        
-        fputs($this->_smtp_conn, 'QUIT' . $this->_crlf);
-        $response = @fgets($this->_smtp_conn, 515);
-        return true;
-    }
-    
-    /**
-     * Send the mail to one or more recipients
-     *
-     * The recipients can be either a string (1 recipient email without name) or an associative array of recipients with names as keys and email addresses as values.
-     *
-     * @access public
-     * @param mixed $recipients one email address or array of recipients with names as keys and email addresses as values
-     */
-    public function send($recipients) {
-        if(!is_array($recipients)) $recipients = array($recipients);
-        
-        if($this->use_smtp == true) $this->_crlf = "\r\n";
-        else $this->_crlf = "\n";
-        
-        $this->create();
-        if($this->sign_email == true) $this->sign();
-        
-        $subject = '';
-        if (!empty($this->headers['Subject'])) {
-            //$subject = $this->_encodeHeader($this->headers['Subject'], $this->mail_charset);
-            $subject = $this->headers['Subject'];
-            
-            //$enc_subject = $this->_encodeHeader($subject, $this->mail_charset);
+
+		return $input;
+	}
+
+
+
+	/**
+	 * @access private
+	 */
+	private function _smtp_login() {
+		$this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'ssl://' : '') . $this->smtp_host, $this->smtp_port, $errno, $errstr, 30);
+		$response = fgets($this->_smtp_conn, 515);
+		if(empty($this->_smtp_conn)) return false;
+
+		// ENCRYPTED?
+		if($this->smtp_crypt == 'tls') {
+			fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
+			fgets($this->_smtp_conn, 515);
+			stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
+		}
+
+		//Say Hello to SMTP
+		if($this->smtp_helo == '') $this->detectHelo();
+		fputs($this->_smtp_conn, 'HELO ' . $this->smtp_helo . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		//AUTH LOGIN
+		fputs($this->_smtp_conn, 'AUTH LOGIN' . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		//Send username
+		fputs($this->_smtp_conn, base64_encode($this->smtp_user) . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		//Send password
+		fputs($this->_smtp_conn, base64_encode($this->smtp_pass) . $this->_crlf);
+		$response = fgets($this->_smtp_conn, 515);
+
+		$this->_logged_in = true;
+		return true;
+	}
+
+
+
+	/**
+	 * @access private
+	 */
+	private function _smtp_close() {
+		$this->_logged_in = false;
+
+		if(empty($this->_smtp_conn)) {
+			return false;
+		}
+
+		fputs($this->_smtp_conn, 'QUIT' . $this->_crlf);
+		$response = @fgets($this->_smtp_conn, 515);
+		return true;
+	}
+
+
+
+	/**
+	 * Send the mail to one or more recipients
+	 *
+	 * The recipients can be either a string (1 recipient email without name) or an associative array of recipients with names as keys and email addresses as values.
+	 *
+	 * @access public
+	 * @param mixed $recipients one email address or array of recipients with names as keys and email addresses as values
+	 */
+	public function send($recipients) {
+		if(!is_array($recipients)) $recipients = array($recipients);
+
+		if($this->use_smtp == true) $this->_crlf = "\r\n";
+		else $this->_crlf = "\n";
+
+		$this->create();
+		if($this->sign_email == true) $this->sign();
+
+		$subject = '';
+		if (!empty($this->headers['Subject'])) {
+			//$subject = $this->_encodeHeader($this->headers['Subject'], $this->mail_charset);
+			$subject = $this->headers['Subject'];
+
+			//$enc_subject = $this->_encodeHeader($subject, $this->mail_charset);
 			$enc_subject = $this->_encodeSubject($subject, $this->mail_charset);
-            unset($this->headers['Subject']);
-        }
-        
-        if($this->notification == true) $this->setHeader('Disposition-Notification-To', $this->getHeader('From'));
-        
-        unset($this->headers['To']); // always reset the To header to prevent from sending to multiple users at once
-        $this->headers['Date'] = date('r'); //date('D, d M Y H:i:s O');
-
-        // Get flat representation of headers
-        foreach ($this->headers as $name => $value) {
-            if(strtolower($name) == 'to' || strtolower($name) == 'cc' || strtolower($name) == 'bcc') continue; // never add the To header
-            $headers[] = $name . ': ' . $this->_encodeHeader($value, $this->mail_charset);
-        }
-        
-        if($this->use_smtp == true) {
-            if(!$this->_logged_in || !$this->_smtp_conn) {
-                $result = $this->_smtp_login();
-                if(!$result) return false;
-            }
-            foreach($recipients as $recipname => $recip) {
-                if($this->_sent_mails >= $this->smtp_max_mails) {
-                    // close connection to smtp and reconnect
-                    $this->_sent_mails = 0;
-                    $this->_smtp_close();
-                    $result = $this->_smtp_login();
-                    if(!$result) return false;
-                }
-                $this->_sent_mails += 1;
-                
-                $recipname = trim(str_replace('"', '', $recipname));
-                $recip = $this->_encodeHeader($recip, $this->mail_charset);
-                $recipname = $this->_encodeHeader($recipname, $this->mail_charset);
-                
-                //Email From
-                fputs($this->_smtp_conn, 'MAIL FROM: ' . $this->_mail_sender . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                //Email To
-                fputs($this->_smtp_conn, 'RCPT TO: ' . $recip . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                //The Email
-                fputs($this->_smtp_conn, 'DATA' . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                //Construct Headers
-                if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>');
-                else $this->setHeader('To', $recip);
-                
-                $mail_content = 'Subject: ' . $enc_subject . $this->_crlf;
-                $mail_content .= 'To: ' . $this->getHeader('To') . $this->_crlf;
-                if($this->getHeader('Bcc') != '') $mail_content .= 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset) . $this->_crlf;
-                if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf;
-                $mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body;
-                
-                fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf);
-                $response = fgets($this->_smtp_conn, 515);
-                
-                // hopefully message was correctly sent now
-                $result = true;
-            }
-        } else {
-            if($this->getHeader('Bcc') != '') $headers[] = 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset);
-            if($this->getHeader('Cc') != '') $headers[] = 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset);
-            $rec_string = '';
-            foreach($recipients as $recipname => $recip) {
-                $recipname = trim(str_replace('"', '', $recipname));
-                
-                if($rec_string != '') $rec_string .= ', ';
-                if($recipname && !is_numeric($recipname)) $rec_string .= $recipname . '<' . $recip . '>';
-                else $rec_string .= $recip;
-            }
-            $to = $this->_encodeHeader($rec_string, $this->mail_charset);
-            //$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers));
+			unset($this->headers['Subject']);
+		}
+
+		if($this->notification == true) $this->setHeader('Disposition-Notification-To', $this->getHeader('From'));
+
+		unset($this->headers['To']); // always reset the To header to prevent from sending to multiple users at once
+		$this->headers['Date'] = date('r'); //date('D, d M Y H:i:s O');
+
+		// Get flat representation of headers
+		foreach ($this->headers as $name => $value) {
+			if(strtolower($name) == 'to' || strtolower($name) == 'cc' || strtolower($name) == 'bcc') continue; // never add the To header
+			$headers[] = $name . ': ' . $this->_encodeHeader($value, $this->mail_charset);
+		}
+
+		if($this->use_smtp == true) {
+			if(!$this->_logged_in || !$this->_smtp_conn) {
+				$result = $this->_smtp_login();
+				if(!$result) return false;
+			}
+			foreach($recipients as $recipname => $recip) {
+				if($this->_sent_mails >= $this->smtp_max_mails) {
+					// close connection to smtp and reconnect
+					$this->_sent_mails = 0;
+					$this->_smtp_close();
+					$result = $this->_smtp_login();
+					if(!$result) return false;
+				}
+				$this->_sent_mails += 1;
+
+				$recipname = trim(str_replace('"', '', $recipname));
+				$recip = $this->_encodeHeader($recip, $this->mail_charset);
+				$recipname = $this->_encodeHeader($recipname, $this->mail_charset);
+
+				//Email From
+				fputs($this->_smtp_conn, 'MAIL FROM: ' . $this->_mail_sender . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				//Email To
+				fputs($this->_smtp_conn, 'RCPT TO: ' . $recip . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				//The Email
+				fputs($this->_smtp_conn, 'DATA' . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				//Construct Headers
+				if($recipname && !is_numeric($recipname)) $this->setHeader('To', $recipname . ' <' . $recip . '>');
+				else $this->setHeader('To', $recip);
+
+				$mail_content = 'Subject: ' . $enc_subject . $this->_crlf;
+				$mail_content .= 'To: ' . $this->getHeader('To') . $this->_crlf;
+				if($this->getHeader('Bcc') != '') $mail_content .= 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset) . $this->_crlf;
+				if($this->getHeader('Cc') != '') $mail_content .= 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset) . $this->_crlf;
+				$mail_content .= implode($this->_crlf, $headers) . $this->_crlf . ($this->_is_signed == false ? $this->_crlf : '') . $this->body;
+
+				fputs($this->_smtp_conn, $mail_content . $this->_crlf . '.' . $this->_crlf);
+				$response = fgets($this->_smtp_conn, 515);
+
+				// hopefully message was correctly sent now
+				$result = true;
+			}
+		} else {
+			if($this->getHeader('Bcc') != '') $headers[] = 'Bcc: ' . $this->_encodeHeader($this->getHeader('Bcc'), $this->mail_charset);
+			if($this->getHeader('Cc') != '') $headers[] = 'Cc: ' . $this->_encodeHeader($this->getHeader('Cc'), $this->mail_charset);
+			$rec_string = '';
+			foreach($recipients as $recipname => $recip) {
+				$recipname = trim(str_replace('"', '', $recipname));
+
+				if($rec_string != '') $rec_string .= ', ';
+				if($recipname && !is_numeric($recipname)) $rec_string .= $recipname . '<' . $recip . '>';
+				else $rec_string .= $recip;
+			}
+			$to = $this->_encodeHeader($rec_string, $this->mail_charset);
+			//$result = mail($to, $subject, $this->body, implode($this->_crlf, $headers));
 			$result = mail($to, $enc_subject, $this->body, implode($this->_crlf, $headers));
-        }
-        
-        // Reset the subject in case mail is resent
-        if ($subject !== '') {
-            $this->headers['Subject'] = $subject;
-        }
-        
-        // Return
-        return $result;
-    }
-    
-    /**
-     * Close mail connections
-     *
-     * This closes an open smtp connection so you should always call this function in your script if you have finished sending all emails
-     *
-     * @access public
-     */
-    public function finish() {
-        if($this->use_smtp == true) $this->_smtp_close();
-        
-        $rand = md5(microtime());
-        $this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
-        
-        $this->headers = array();
-        $this->attachments = array();
-        $this->text_part = '';
-        $this->html_part = '';
-        
-        $this->headers['MIME-Version'] = '1.0';
-        $this->headers['User-Agent'] = $this->user_agent;
-        
-        $this->smtp_helo = '';
-        $this->smtp_host = '';
-        $this->smtp_port = '';
-        $this->smtp_user = '';
-        $this->smtp_pass = '';
-        $this->use_smtp = false;
-        $this->smtp_crypt = false;
-        $this->mail_charset = 'UTF-8';
-        $this->_sent_mails = 0;
-        
-        return;
-    }
+		}
+
+		// Reset the subject in case mail is resent
+		if ($subject !== '') {
+			$this->headers['Subject'] = $subject;
+		}
+
+		// Return
+		return $result;
+	}
+
+
+
+	/**
+	 * Close mail connections
+	 *
+	 * This closes an open smtp connection so you should always call this function in your script if you have finished sending all emails
+	 *
+	 * @access public
+	 */
+	public function finish() {
+		if($this->use_smtp == true) $this->_smtp_close();
+
+		$rand = md5(microtime());
+		$this->mime_boundary = '==Multipart_Boundary_x' . $rand . 'x';
+
+		$this->headers = array();
+		$this->attachments = array();
+		$this->text_part = '';
+		$this->html_part = '';
+
+		$this->headers['MIME-Version'] = '1.0';
+		$this->headers['User-Agent'] = $this->user_agent;
+
+		$this->smtp_helo = '';
+		$this->smtp_host = '';
+		$this->smtp_port = '';
+		$this->smtp_user = '';
+		$this->smtp_pass = '';
+		$this->use_smtp = false;
+		$this->smtp_crypt = false;
+		$this->mail_charset = 'UTF-8';
+		$this->_sent_mails = 0;
+
+		return;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/ispconfig_request.inc.php b/interface/lib/classes/ispconfig_request.inc.php
index 75e06eef97e9ac50e4777e52de6c963663e39ba2..b29ae2398c7e359bd17dd19bb1c2b202703429da 100644
--- a/interface/lib/classes/ispconfig_request.inc.php
+++ b/interface/lib/classes/ispconfig_request.inc.php
@@ -32,229 +32,232 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //* This class is loaded automatically by the ispconfig framework.
 
 abstract class ISPConfigRequest {
-    /**
-     * Get header data and contents from an url
-     *
-     * Calls an url and returns an array containing the http header and the page content
-     *
-     * @access public
-     * @param string $url the url to call
-     * @param string $store_in the file to store the data in instead of returning them
-     * @return array The array with header data at index 0 and page content at index 1, returns boolean false on error. If $store_in is set only the headers are returned
-     */
-    public static function get_with_headers($url, $store_in = null, $follow_redirects = false, $user_agent = false) {
-        if($follow_redirects === true) $follow_redirects = 5;
-        elseif($follow_redirects !== false) $follow_redirects--;
-        
-        if(!$user_agent) $user_agent = 'pxFW GET proxy';
-        
-        $url_info = parse_url($url);
-        if(isset($url_info['scheme']) && $url_info['scheme'] == 'https') {
-            $port = isset($url_info['port']) ? $url_info['port'] : 443;
-            //@$fp = stream_socket_client('ssl://' . $url_info['host'] . ':' . $port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, stream_context_create(array('ssl' => array('ciphers' => 'ALL:!AES:!3DES:!RC4:@STRENGTH'))));
-            @$fp = fsockopen('sslv3://' . $url_info['host'], $port, $errno, $errstr, 10);
-        } else {
-            $port = isset($url_info['port']) ? $url_info['port'] : 80;
-            @$fp = fsockopen($url_info['host'], $port, $errno, $errstr, 10);
-        }
-        
-        if($store_in) {
-            $outfp = fopen($store_in, 'w');
-            if(!$outfp) return false;
-        }
-        if($fp) {
-            stream_set_timeout($fp, 10);
-            $head = 'GET ' . (isset($url_info['path']) ? $url_info['path'] : '/') . (isset($url_info['query']) ? '?' . $url_info['query'] : '');
-            $head .= " HTTP/1.0\r\nHost: " . (isset($url_info['host']) ? $url_info['host'] : '') . "\r\n";
-            $head .= "User-Agent: " . $user_agent . "\r\n";
-            if(isset($url_info['user'])) {
-                if(!array_key_exists('pass', $url_info)) $url_info['pass'] = '';
-                $head .= "Authorization: basic " . base64_encode($url_info['user'] . ':' . $url_info['pass']) . "\r\n"; 
-            }
-            $head .= "Connection: Close\r\n";
-            $head .= "Accept: */*\r\n\r\n";
-            
-            $data = '';
-            $eoheader = false;
-            fputs($fp, $head);
-            while(!feof($fp)) {
-                if($header = fgets($fp, 1024)) {
-                    if($eoheader == true) {
-                        if($store_in) fputs($outfp, $header);
-                        else $data .= $header;
-                        continue;
-                    }
-                
-                    if ($header == "\r\n") {
-                        $eoheader = true;
-                        continue;
-                    } else {
-                        $header = trim($header);
-                    }
-                    $sc_pos = strpos($header, ':');
-                    if($sc_pos === false) {
-                        $headers['status'] = $header;
-                        $headers['http_code'] = intval(preg_replace('/^HTTP\/\d+\.\d+\s+(\d+)\s+.*$/', '$1', $header));
-                    } else {
-                        $label = substr($header, 0, $sc_pos);
-                        $value = substr($header, $sc_pos + 1);
-                        $headers[strtolower($label)] = trim($value);
-                    }
-                }
-            }
-            fclose($fp);
-            if(isset($headers['http_code']) && isset($headers['location']) && ($headers['http_code'] == 301 || $headers['http_code'] == 302) && $follow_redirects > 0) {
-                if($store_in) fclose($outfp);
-                return $self::get_with_headers($headers['location'], $store_in, $follow_redirects);
-            }
-            if($store_in) {
-                fclose($outfp);
-                
-                $code = intval(preg_replace('/^HTTP\/\d+\.\d+\s+(\d+)\s+.*$/', '$1', $headers['status']));
-                if($code != 200) {
-                    return false;
-                }
-                return $headers;
-            } else {
-                return array($headers, $data);
-            }
-        } else {
-            if($store_in) {
-                fclose($outfp);
-                @unlink($store_in);
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Gets the content of an url
-     *
-     * Checks for the php function file_get_contents and uses an alternative if not found
-     *
-     * @access public
-     * @param string $url url to get
-     * @return string url data including headers
-     * @see file_get_contents
-     */
-    public static function get($url) {
-        if(function_exists('file_get_contents')) return file_get_contents($url);
-        
-        $fp = fopen($url, 'r');
-        $data = '';
-        while(!feof($fp)) {
-            $data .= fgets($fp, 8192);
-        }
-        fclose($fp);
-        
-        return $data;
-    }
-
-
-    /**
-     * Make a post request and get data
-     *
-     * Calls an url with a post request and returns the data - and optionally the header content
-     *
-     * @access public
-     * @param string $url the url to call
-     * @param string $data the post data to send
-     * @param bool $get_headers if true, the function will return an array like PXUrl::get_with_headers(), otherwise the content is returned as a string
-     * @return mixed Content data as string or - if get_headers is true - the array with header data at index 0 and page content at index 1
-     * @see get_url_and_headers
-     */
-    public static function post($url, $data, $get_headers = false, $user_agent = false) {
-        $url_info = parse_url($url);
-        if((isset($url_info['scheme']) && $url_info['scheme'] == 'https') || $url_info['port'] == 443) {
-            $port = (!isset($url_info['port']) || !$url_info['port'] || $url_info['port'] == 443 || $url_info['port'] == 80) ? 443 : $url_info['port'];
-            //@$fp = stream_socket_client('ssl://' . $url_info['host'] . ':' . $port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, stream_context_create(array('ssl' => array('ciphers' => 'ALL:!AES:!3DES:!RC4:@STRENGTH'))));
-            @$fp = fsockopen('sslv3://' . $url_info['host'], $port, $errno, $errstr, 10);
-        } else {
-            $port = isset($url_info['port']) ? $url_info['port'] : 80;
-            @$fp = fsockopen($url_info['host'], $port, $errno, $errstr, 10);
-        }
-        
-        if(!$fp) return '';
-        
-        if(!$user_agent) $user_agent = 'pxFW GET proxy';
-                
-        $header = 'POST ' . (isset($url_info['path']) ? $url_info['path'] : '/') . (isset($url_info['query']) ? '?' . @$url_info['query'] : '') . " HTTP/1.1\r\n";
-        $header .= "Host: " . @$url_info['host'] . "\r\n";
-        $header .= "User-Agent: " . $user_agent . "\r\n";
-        if(isset($url_info['user'])) {
-            if(!array_key_exists('pass', $url_info)) $url_info['pass'] = '';
-            $header .= "Authorization: basic " . base64_encode($url_info['user'] . ':' . $url_info['pass']) . "\r\n"; 
-        }
-        $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
-        $header .= "Content-Length: " . strlen($data) . "\r\n";
-        $header .= "Connection: close\r\n\r\n";
-        $header .= $data . "\r\n\r\n";
-        
-        fwrite($fp, $header);
-        
-        $response = '';
-        $eoheader = false;
-        $header = '';
-        $tmpdata = '';
-        $chunked = false;
-        $chunklen = 0;
-        
-        while(!feof($fp)) {
-            if($header = @fgets($fp, 1024)) {
-                if($eoheader == true) {
-                    $response .= $header;
-                    continue;
-                }
-            
-                if ($header == "\r\n") {
-                    $eoheader = true;
-                    continue;
-                } else {
-                    $tmpdata .= $header;
-                    if(preg_match('/Transfer-Encoding:\s+chunked/i', $tmpdata)) $chunked = true;
-                }
-            }
-        }
-        //var_dump($response, $chunked, $header);
-        if($chunked == true) {
-            $lines = explode("\n", $response);
-            $response = '';
-            $chunklen = 0;
-            foreach($lines as $line) {
-                $line .= "\n";
-                if($chunklen <= 0) {
-                    if(preg_match('/^([0-9a-f]+)\s*$/is', $line, $matches)) {
-                        $chunklen = hexdec($matches[1]);
-                    }
-                    continue;
-                }
-                
-                if(strlen($line) > $chunklen) {
-                    //echo "Warnung: " . strlen($line) . " > " . $chunklen . "\n";
-                    $line = substr($line, 0, $chunklen);
-                }
-                $response .= $line;
-                $chunklen -= strlen($line);
-            }
-            
-            $start = strpos($response,'<?xml');
-            $end = strrpos($response,'>');
-            if($start !== false && $end !== false) $response = substr($response, $start, $end - $start + 1);
-        }
-        
-        fclose($fp);
-        
-        if($get_headers == true) {
-            $tmpheaders = explode("\n", $tmpdata);
-            $headers = array();
-            foreach($tmpheaders as $cur) {
-                if(preg_match('/^(\w+)\:\s*(.*)$/is', $cur, $matches)) {
-                    $headers["$matches[1]"] = trim($matches[2]);
-                }
-            }
-            return array($headers, $response);
-        } else return $response;
-    }
+	/**
+	 * Get header data and contents from an url
+	 *
+	 * Calls an url and returns an array containing the http header and the page content
+	 *
+	 * @access public
+	 * @param string $url the url to call
+	 * @param string $store_in the file to store the data in instead of returning them
+	 * @return array The array with header data at index 0 and page content at index 1, returns boolean false on error. If $store_in is set only the headers are returned
+	 */
+
+
+	public static function get_with_headers($url, $store_in = null, $follow_redirects = false, $user_agent = false) {
+		if($follow_redirects === true) $follow_redirects = 5;
+		elseif($follow_redirects !== false) $follow_redirects--;
+
+		if(!$user_agent) $user_agent = 'pxFW GET proxy';
+
+		$url_info = parse_url($url);
+		if(isset($url_info['scheme']) && $url_info['scheme'] == 'https') {
+			$port = isset($url_info['port']) ? $url_info['port'] : 443;
+			//@$fp = stream_socket_client('ssl://' . $url_info['host'] . ':' . $port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, stream_context_create(array('ssl' => array('ciphers' => 'ALL:!AES:!3DES:!RC4:@STRENGTH'))));
+			@$fp = fsockopen('sslv3://' . $url_info['host'], $port, $errno, $errstr, 10);
+		} else {
+			$port = isset($url_info['port']) ? $url_info['port'] : 80;
+			@$fp = fsockopen($url_info['host'], $port, $errno, $errstr, 10);
+		}
+
+		if($store_in) {
+			$outfp = fopen($store_in, 'w');
+			if(!$outfp) return false;
+		}
+		if($fp) {
+			stream_set_timeout($fp, 10);
+			$head = 'GET ' . (isset($url_info['path']) ? $url_info['path'] : '/') . (isset($url_info['query']) ? '?' . $url_info['query'] : '');
+			$head .= " HTTP/1.0\r\nHost: " . (isset($url_info['host']) ? $url_info['host'] : '') . "\r\n";
+			$head .= "User-Agent: " . $user_agent . "\r\n";
+			if(isset($url_info['user'])) {
+				if(!array_key_exists('pass', $url_info)) $url_info['pass'] = '';
+				$head .= "Authorization: basic " . base64_encode($url_info['user'] . ':' . $url_info['pass']) . "\r\n";
+			}
+			$head .= "Connection: Close\r\n";
+			$head .= "Accept: */*\r\n\r\n";
+
+			$data = '';
+			$eoheader = false;
+			fputs($fp, $head);
+			while(!feof($fp)) {
+				if($header = fgets($fp, 1024)) {
+					if($eoheader == true) {
+						if($store_in) fputs($outfp, $header);
+						else $data .= $header;
+						continue;
+					}
+
+					if ($header == "\r\n") {
+						$eoheader = true;
+						continue;
+					} else {
+						$header = trim($header);
+					}
+					$sc_pos = strpos($header, ':');
+					if($sc_pos === false) {
+						$headers['status'] = $header;
+						$headers['http_code'] = intval(preg_replace('/^HTTP\/\d+\.\d+\s+(\d+)\s+.*$/', '$1', $header));
+					} else {
+						$label = substr($header, 0, $sc_pos);
+						$value = substr($header, $sc_pos + 1);
+						$headers[strtolower($label)] = trim($value);
+					}
+				}
+			}
+			fclose($fp);
+			if(isset($headers['http_code']) && isset($headers['location']) && ($headers['http_code'] == 301 || $headers['http_code'] == 302) && $follow_redirects > 0) {
+				if($store_in) fclose($outfp);
+				return $self::get_with_headers($headers['location'], $store_in, $follow_redirects);
+			}
+			if($store_in) {
+				fclose($outfp);
+
+				$code = intval(preg_replace('/^HTTP\/\d+\.\d+\s+(\d+)\s+.*$/', '$1', $headers['status']));
+				if($code != 200) {
+					return false;
+				}
+				return $headers;
+			} else {
+				return array($headers, $data);
+			}
+		} else {
+			if($store_in) {
+				fclose($outfp);
+				@unlink($store_in);
+			}
+			return false;
+		}
+	}
+
+	/**
+	 * Gets the content of an url
+	 *
+	 * Checks for the php function file_get_contents and uses an alternative if not found
+	 *
+	 * @access public
+	 * @param string $url url to get
+	 * @return string url data including headers
+	 * @see file_get_contents
+	 */
+	public static function get($url) {
+		if(function_exists('file_get_contents')) return file_get_contents($url);
+
+		$fp = fopen($url, 'r');
+		$data = '';
+		while(!feof($fp)) {
+			$data .= fgets($fp, 8192);
+		}
+		fclose($fp);
+
+		return $data;
+	}
+
+
+	/**
+	 * Make a post request and get data
+	 *
+	 * Calls an url with a post request and returns the data - and optionally the header content
+	 *
+	 * @access public
+	 * @param string $url the url to call
+	 * @param string $data the post data to send
+	 * @param bool $get_headers if true, the function will return an array like PXUrl::get_with_headers(), otherwise the content is returned as a string
+	 * @return mixed Content data as string or - if get_headers is true - the array with header data at index 0 and page content at index 1
+	 * @see get_url_and_headers
+	 */
+	public static function post($url, $data, $get_headers = false, $user_agent = false) {
+		$url_info = parse_url($url);
+		if((isset($url_info['scheme']) && $url_info['scheme'] == 'https') || $url_info['port'] == 443) {
+			$port = (!isset($url_info['port']) || !$url_info['port'] || $url_info['port'] == 443 || $url_info['port'] == 80) ? 443 : $url_info['port'];
+			//@$fp = stream_socket_client('ssl://' . $url_info['host'] . ':' . $port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, stream_context_create(array('ssl' => array('ciphers' => 'ALL:!AES:!3DES:!RC4:@STRENGTH'))));
+			@$fp = fsockopen('sslv3://' . $url_info['host'], $port, $errno, $errstr, 10);
+		} else {
+			$port = isset($url_info['port']) ? $url_info['port'] : 80;
+			@$fp = fsockopen($url_info['host'], $port, $errno, $errstr, 10);
+		}
+
+		if(!$fp) return '';
+
+		if(!$user_agent) $user_agent = 'pxFW GET proxy';
+
+		$header = 'POST ' . (isset($url_info['path']) ? $url_info['path'] : '/') . (isset($url_info['query']) ? '?' . @$url_info['query'] : '') . " HTTP/1.1\r\n";
+		$header .= "Host: " . @$url_info['host'] . "\r\n";
+		$header .= "User-Agent: " . $user_agent . "\r\n";
+		if(isset($url_info['user'])) {
+			if(!array_key_exists('pass', $url_info)) $url_info['pass'] = '';
+			$header .= "Authorization: basic " . base64_encode($url_info['user'] . ':' . $url_info['pass']) . "\r\n";
+		}
+		$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
+		$header .= "Content-Length: " . strlen($data) . "\r\n";
+		$header .= "Connection: close\r\n\r\n";
+		$header .= $data . "\r\n\r\n";
+
+		fwrite($fp, $header);
+
+		$response = '';
+		$eoheader = false;
+		$header = '';
+		$tmpdata = '';
+		$chunked = false;
+		$chunklen = 0;
+
+		while(!feof($fp)) {
+			if($header = @fgets($fp, 1024)) {
+				if($eoheader == true) {
+					$response .= $header;
+					continue;
+				}
+
+				if ($header == "\r\n") {
+					$eoheader = true;
+					continue;
+				} else {
+					$tmpdata .= $header;
+					if(preg_match('/Transfer-Encoding:\s+chunked/i', $tmpdata)) $chunked = true;
+				}
+			}
+		}
+		//var_dump($response, $chunked, $header);
+		if($chunked == true) {
+			$lines = explode("\n", $response);
+			$response = '';
+			$chunklen = 0;
+			foreach($lines as $line) {
+				$line .= "\n";
+				if($chunklen <= 0) {
+					if(preg_match('/^([0-9a-f]+)\s*$/is', $line, $matches)) {
+						$chunklen = hexdec($matches[1]);
+					}
+					continue;
+				}
+
+				if(strlen($line) > $chunklen) {
+					//echo "Warnung: " . strlen($line) . " > " . $chunklen . "\n";
+					$line = substr($line, 0, $chunklen);
+				}
+				$response .= $line;
+				$chunklen -= strlen($line);
+			}
+
+			$start = strpos($response, '<?xml');
+			$end = strrpos($response, '>');
+			if($start !== false && $end !== false) $response = substr($response, $start, $end - $start + 1);
+		}
+
+		fclose($fp);
+
+		if($get_headers == true) {
+			$tmpheaders = explode("\n", $tmpdata);
+			$headers = array();
+			foreach($tmpheaders as $cur) {
+				if(preg_match('/^(\w+)\:\s*(.*)$/is', $cur, $matches)) {
+					$headers["$matches[1]"] = trim($matches[2]);
+				}
+			}
+			return array($headers, $response);
+		} else return $response;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/json_handler.inc.php b/interface/lib/classes/json_handler.inc.php
index 9f34522073ff3bced03471f9cad637842082d159..1df58980fe6a49be4d62189a33fb7c2ac1cb4eb1 100644
--- a/interface/lib/classes/json_handler.inc.php
+++ b/interface/lib/classes/json_handler.inc.php
@@ -31,91 +31,92 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 class ISPConfigJSONHandler {
-    private $methods = array();
-    private $classes = array();
-
-    public function __construct() {
-        global $app;
-        
-        // load main remoting file
-        $app->load('remoting');
-        
-        // load all remote classes and get their methods
-        $dir = dirname(realpath(__FILE__)) . '/remote.d';
-        $d = opendir($dir);
-        while($f = readdir($d)) {
-            if($f == '.' || $f == '..') continue;
-            if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
-            
-            $name = substr($f, 0, strpos($f, '.'));
-            
-            include($dir . '/' . $f);
-            $class_name = 'remoting_' . $name;
-            if(class_exists($class_name, false)) {
-                $this->classes[$class_name] = new $class_name();
-                foreach(get_class_methods($this->classes[$class_name]) as $method) {
-                    $this->methods[$method] = $class_name;
-                }
-            }
-        }
-        closedir($d);
-        
-        // add main methods
-        $this->methods['login'] = 'remoting';
-        $this->methods['logout'] = 'remoting';
-        $this->methods['get_function_list'] = 'remoting';
-        
-        // create main class
-        $this->classes['remoting'] = new remoting(array_keys($this->methods));
-    }
-    
-    private function _return_json($code, $message, $data = false) {
-        $ret = new stdClass;
-        $ret->code = $code;
-        $ret->message = $message;
-        $ret->response = $data;
-        
-        header('Content-Type: application/json; charset="utf-8"');
-        print json_encode($ret);
-        exit;
-    }
-    
-    public function run() {
-        
-        if(!isset($_GET) || !is_array($_GET) || count($_GET) < 1) {
-            $this->_return_json('invalid_method', 'Method not provided in json call');
-        }
-        $keys = array_keys($_GET);
-        $method = reset($keys);
-        $params = array();
-
-        if(is_array($_POST)) {
-            foreach($_POST as $key => $val) {
-                $tmp = json_decode($val);
-                if(!$tmp) $params[] = $val;
-                else $params[] = (array)$tmp;
-            }
-        }
-        
-        if(array_key_exists($method, $this->methods) == false) {
-            $this->_return_json('invalid_method', 'Method ' . $method . ' does not exist');
-        }
-        
-        $class_name = $this->methods[$method];
-        if(array_key_exists($class_name, $this->classes) == false) {
-            $this->_return_json('invalid_class', 'Class ' . $class_name . ' does not exist');
-        }
-        
-        if(method_exists($this->classes[$class_name], $method) == false) {
-            $this->_return_json('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')');
-        }
-        
-        try {
-            $this->_return_json('ok', '', call_user_func_array(array($this->classes[$class_name], $method), $params));
-        } catch(SoapFault $e) {
-            $this->_return_json('remote_fault', $e->getMessage());
-        }
-    }
+	private $methods = array();
+	private $classes = array();
+
+	public function __construct() {
+		global $app;
+
+		// load main remoting file
+		$app->load('remoting');
+
+		// load all remote classes and get their methods
+		$dir = dirname(realpath(__FILE__)) . '/remote.d';
+		$d = opendir($dir);
+		while($f = readdir($d)) {
+			if($f == '.' || $f == '..') continue;
+			if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
+
+			$name = substr($f, 0, strpos($f, '.'));
+
+			include $dir . '/' . $f;
+			$class_name = 'remoting_' . $name;
+			if(class_exists($class_name, false)) {
+				$this->classes[$class_name] = new $class_name();
+				foreach(get_class_methods($this->classes[$class_name]) as $method) {
+					$this->methods[$method] = $class_name;
+				}
+			}
+		}
+		closedir($d);
+
+		// add main methods
+		$this->methods['login'] = 'remoting';
+		$this->methods['logout'] = 'remoting';
+		$this->methods['get_function_list'] = 'remoting';
+
+		// create main class
+		$this->classes['remoting'] = new remoting(array_keys($this->methods));
+	}
+
+	private function _return_json($code, $message, $data = false) {
+		$ret = new stdClass;
+		$ret->code = $code;
+		$ret->message = $message;
+		$ret->response = $data;
+
+		header('Content-Type: application/json; charset="utf-8"');
+		print json_encode($ret);
+		exit;
+	}
+
+	public function run() {
+
+		if(!isset($_GET) || !is_array($_GET) || count($_GET) < 1) {
+			$this->_return_json('invalid_method', 'Method not provided in json call');
+		}
+		$keys = array_keys($_GET);
+		$method = reset($keys);
+		$params = array();
+
+		if(is_array($_POST)) {
+			foreach($_POST as $key => $val) {
+				$tmp = json_decode($val);
+				if(!$tmp) $params[] = $val;
+				else $params[] = (array)$tmp;
+			}
+		}
+
+		if(array_key_exists($method, $this->methods) == false) {
+			$this->_return_json('invalid_method', 'Method ' . $method . ' does not exist');
+		}
+
+		$class_name = $this->methods[$method];
+		if(array_key_exists($class_name, $this->classes) == false) {
+			$this->_return_json('invalid_class', 'Class ' . $class_name . ' does not exist');
+		}
+
+		if(method_exists($this->classes[$class_name], $method) == false) {
+			$this->_return_json('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')');
+		}
+
+		try {
+			$this->_return_json('ok', '', call_user_func_array(array($this->classes[$class_name], $method), $params));
+		} catch(SoapFault $e) {
+			$this->_return_json('remote_fault', $e->getMessage());
+		}
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php
index cf8f6410f415b18acc94e713735c9719db4086f7..14c1a13f75fa2e5a2d59bd4e3a7dcc6eb4438eef 100644
--- a/interface/lib/classes/listform.inc.php
+++ b/interface/lib/classes/listform.inc.php
@@ -30,158 +30,160 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class listform {
 
-    private $debug = 0;
-    private $errorMessage;
-    public  $listDef;
-    public  $searchValues;
-    public  $pagingHTML;
-    private $pagingValues;
-    private $searchChanged = 0;
-    private $module;
+	private $debug = 0;
+	private $errorMessage;
+	public  $listDef;
+	public  $searchValues;
+	public  $pagingHTML;
+	private $pagingValues;
+	private $searchChanged = 0;
+	private $module;
 	public $wordbook;
 
-    public function loadListDef($file, $module = '')
-    {
-        global $app,$conf;
-        if(!is_file($file)){
-            die("List-Definition: $file not found.");
-        }
-        require_once($file);
-        $this->listDef = $liste;
-        $this->module = $module;
-		
+	public function loadListDef($file, $module = '')
+	{
+		global $app, $conf;
+		if(!is_file($file)){
+			die("List-Definition: $file not found.");
+		}
+		require_once $file;
+		$this->listDef = $liste;
+		$this->module = $module;
+
 		//* Fill datasources
-        if(@is_array($this->listDef['item'])) {
-		    foreach($this->listDef['item'] as $key => $field) {
-			    if(@is_array($field['datasource'])) {
-                    $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
-                }
-		    }
+		if(@is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $key => $field) {
+				if(@is_array($field['datasource'])) {
+					$this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
+				}
+			}
 		}
-        
+
 		//* Set local Language File
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_'.$this->listDef['name'].'_list.lng';
 		if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$this->listDef['name'].'_list.lng';
-		include($lng_file);
-		
+		include $lng_file;
+
 		$this->wordbook = $wb;
-		
-        return true;
-    }
-		
+
+		return true;
+	}
+
 	/**
-    * Get the key => value array of a form filed from a datasource definitiom
-    *
-    * @param field = array with field definition
-    * @param record = Dataset as array
-    * @return array key => value array for the value field of a form
-    */
-    private function getDatasourceData($field)
-    {
-        global $app;
-        $values = array();
-
-        if($field['datasource']['type'] == 'SQL') {
-
-            //** Preparing SQL string. We will replace some common placeholders
-            $querystring = $field['datasource']['querystring'];
-            $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
-            $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
-            $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
-            //TODO:
-            //$table_idx = $this->formDef['db_table_idx'];
-            //$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
+	 * Get the key => value array of a form filed from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return array key => value array for the value field of a form
+	 */
+
+
+	private function getDatasourceData($field)
+	{
+		global $app;
+		$values = array();
+
+		if($field['datasource']['type'] == 'SQL') {
+
+			//** Preparing SQL string. We will replace some common placeholders
+			$querystring = $field['datasource']['querystring'];
+			$querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
+			$querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
+			$querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
+			//TODO:
+			//$table_idx = $this->formDef['db_table_idx'];
+			//$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
 			$app->uses('tform');
-            $querystring = str_replace("{AUTHSQL}",$app->tform->getAuthSQL('r'),$querystring);
-            $querystring = str_replace("{AUTHSQL-A}",$app->tform->getAuthSQL('r','a'),$querystring);
-            $querystring = str_replace("{AUTHSQL-B}",$app->tform->getAuthSQL('r','b'),$querystring);
-
-            //* Getting the records
-            $tmp_records = $app->db->queryAllRecords($querystring);
-            if($app->db->errorMessage != '') die($app->db->errorMessage);
-            if(is_array($tmp_records)) {
-                $key_field = $field['datasource']['keyfield'];
-                $value_field = $field['datasource']['valuefield'];
-                foreach($tmp_records as $tmp_rec) {
-                    $tmp_id = $tmp_rec[$key_field];
-                    $values[$tmp_id] = $tmp_rec[$value_field];
-                }
-            }
-        }
-
-        if($field['datasource']['type'] == 'CUSTOM') {
-            //* Calls a custom class to validate this record
-            if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
-                $datasource_class = $field['datasource']['class'];
-                $datasource_function = $field['datasource']['function'];
-                $app->uses($datasource_class);
+			$querystring = str_replace("{AUTHSQL}", $app->tform->getAuthSQL('r'), $querystring);
+			$querystring = str_replace("{AUTHSQL-A}", $app->tform->getAuthSQL('r', 'a'), $querystring);
+			$querystring = str_replace("{AUTHSQL-B}", $app->tform->getAuthSQL('r', 'b'), $querystring);
+
+			//* Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+			if(is_array($tmp_records)) {
+				$key_field = $field['datasource']['keyfield'];
+				$value_field = $field['datasource']['valuefield'];
+				foreach($tmp_records as $tmp_rec) {
+					$tmp_id = $tmp_rec[$key_field];
+					$values[$tmp_id] = $tmp_rec[$value_field];
+				}
+			}
+		}
+
+		if($field['datasource']['type'] == 'CUSTOM') {
+			//* Calls a custom class to validate this record
+			if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
+				$datasource_class = $field['datasource']['class'];
+				$datasource_function = $field['datasource']['function'];
+				$app->uses($datasource_class);
 				$record = array();
-                $values = $app->$datasource_class->$datasource_function($field, $record);
-            } else {
-                $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
-            }
-        }
-        return $values;
-    }
-
-    public function getSearchSQL($sql_where = '') 
-    {
-        global $app, $db;
-
-        //* Get config variable
-        $list_name = $this->listDef['name'];
-        $search_prefix = $this->listDef['search_prefix'];
-		
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			} else {
+				$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
+			}
+		}
+		return $values;
+	}
+
+	public function getSearchSQL($sql_where = '')
+	{
+		global $app, $db;
+
+		//* Get config variable
+		$list_name = $this->listDef['name'];
+		$search_prefix = $this->listDef['search_prefix'];
+
 		if(isset($_REQUEST['Filter']) && !isset($_SESSION['search'][$list_name])) {
 			//* Jump back to page 1 of the list when a new search gets started.
 			$_SESSION['search'][$list_name]['page'] = 0;
 		}
 
-        //* store retrieval query
-        if(@is_array($this->listDef['item'])) { 
-            foreach($this->listDef['item'] as $i) {
-                $field = $i['field'];
-
-                //* The search string has been changed
-                if(isset($_REQUEST[$search_prefix.$field]) && isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_REQUEST[$search_prefix.$field] != $_SESSION['search'][$list_name][$search_prefix.$field]){
-                        $this->searchChanged = 1;
-					    
-					    //* Jump back to page 1 of the list when search has changed.
-					    $_SESSION['search'][$list_name]['page'] = 0;
-                }
-
-                //* Store field in session
-                if(isset($_REQUEST[$search_prefix.$field]) && !stristr($_REQUEST[$search_prefix.$field],"'")){
-                    $_SESSION['search'][$list_name][$search_prefix.$field] = $_REQUEST[$search_prefix.$field];
+		//* store retrieval query
+		if(@is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $i) {
+				$field = $i['field'];
+
+				//* The search string has been changed
+				if(isset($_REQUEST[$search_prefix.$field]) && isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_REQUEST[$search_prefix.$field] != $_SESSION['search'][$list_name][$search_prefix.$field]){
+					$this->searchChanged = 1;
+
+					//* Jump back to page 1 of the list when search has changed.
+					$_SESSION['search'][$list_name]['page'] = 0;
+				}
+
+				//* Store field in session
+				if(isset($_REQUEST[$search_prefix.$field]) && !stristr($_REQUEST[$search_prefix.$field], "'")){
+					$_SESSION['search'][$list_name][$search_prefix.$field] = $_REQUEST[$search_prefix.$field];
 					if(preg_match("/['\\\\]/", $_SESSION['search'][$list_name][$search_prefix.$field])) $_SESSION['search'][$list_name][$search_prefix.$field] = '';
 				}
 
-                if(isset($i['formtype']) && $i['formtype'] == 'SELECT'){
-                    if(is_array($i['value'])) {
-                        $out = '<option value=""></option>';
-                        foreach($i['value'] as $k => $v) {
-                            // TODO: this could be more elegant
-                            $selected = (isset($_SESSION['search'][$list_name][$search_prefix.$field]) 
-                                            && $k == $_SESSION['search'][$list_name][$search_prefix.$field] 
-                                            && $_SESSION['search'][$list_name][$search_prefix.$field] != '')
-                                            ? ' SELECTED' : '';
-                            $out .= "<option value='$k'$selected>$v</option>\r\n";
-                        }
-                    }
-                        $this->searchValues[$search_prefix.$field] = $out;
-                } else {
-                    if(isset($_SESSION['search'][$list_name][$search_prefix.$field])){
-                        $this->searchValues[$search_prefix.$field] = htmlspecialchars($_SESSION['search'][$list_name][$search_prefix.$field]);
-                    }
-                }
-            }
-        }
-        //* Store variables in object | $this->searchValues = $_SESSION["search"][$list_name];
-        if(@is_array($this->listDef['item'])) { 
-            foreach($this->listDef['item'] as $i) {
-                $field = $i['field'];
+				if(isset($i['formtype']) && $i['formtype'] == 'SELECT'){
+					if(is_array($i['value'])) {
+						$out = '<option value=""></option>';
+						foreach($i['value'] as $k => $v) {
+							// TODO: this could be more elegant
+							$selected = (isset($_SESSION['search'][$list_name][$search_prefix.$field])
+								&& $k == $_SESSION['search'][$list_name][$search_prefix.$field]
+								&& $_SESSION['search'][$list_name][$search_prefix.$field] != '')
+								? ' SELECTED' : '';
+							$out .= "<option value='$k'$selected>$v</option>\r\n";
+						}
+					}
+					$this->searchValues[$search_prefix.$field] = $out;
+				} else {
+					if(isset($_SESSION['search'][$list_name][$search_prefix.$field])){
+						$this->searchValues[$search_prefix.$field] = htmlspecialchars($_SESSION['search'][$list_name][$search_prefix.$field]);
+					}
+				}
+			}
+		}
+		//* Store variables in object | $this->searchValues = $_SESSION["search"][$list_name];
+		if(@is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $i) {
+				$field = $i['field'];
 				$table = $i['table'];
-				
+
 				$searchval = $_SESSION['search'][$list_name][$search_prefix.$field];
 				// format user date format to MySQL date format 0000-00-00
 				if($i['datatype'] == 'DATE' && $this->lng('conf_format_dateshort') != 'Y-m-d'){
@@ -189,15 +191,15 @@ class listform {
 					$yearpos = strpos($dateformat, 'Y') + 1;
 					$monthpos = strpos($dateformat, 'm') + 1;
 					$daypos = strpos($dateformat, 'd') + 1;
-						
-					$full_date_trans = array	('Y' => '((?:19|20)\d\d)',
-									 'm' => '(0[1-9]|1[012])',
-									 'd' => '(0[1-9]|[12][0-9]|3[01])'
-									);
-					// d.m.Y  Y/m/d				
+
+					$full_date_trans = array ('Y' => '((?:19|20)\d\d)',
+						'm' => '(0[1-9]|1[012])',
+						'd' => '(0[1-9]|[12][0-9]|3[01])'
+					);
+					// d.m.Y  Y/m/d
 					$full_date_regex = strtr(preg_replace("@[^Ymd]@", "[^0-9]", $this->lng('conf_format_dateshort')), $full_date_trans);
 					//echo $full_date_regex;
-					
+
 					if (preg_match("@^\d+$@", $_SESSION['search'][$list_name][$search_prefix.$field])) { // we just have digits
 						$searchval = $_SESSION['search'][$list_name][$search_prefix.$field];
 					} elseif(preg_match("@^[^0-9]?\d+[^0-9]?$@", $_SESSION['search'][$list_name][$search_prefix.$field])){ // 10. or .10.
@@ -212,8 +214,8 @@ class listform {
 						$searchval = $year.'-'.$month;
 					} elseif(preg_match("@^[^0-9]?(\d{1,2})[^0-9](\d{1,2})[^0-9]?$@", $_SESSION['search'][$list_name][$search_prefix.$field], $matches)){ // 04.10.
 						if($monthpos < $daypos){
-						$month = $matches[1];
-						$day = $matches[2];
+							$month = $matches[1];
+							$day = $matches[2];
 						} else {
 							$month = $matches[2];
 							$day = $matches[1];
@@ -227,332 +229,332 @@ class listform {
 						$searchval = $year.'-'.$month.'-'.$day;
 					}
 				}
-				
-                // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
-		        if(isset($searchval) && $searchval != ''){
-                    $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and";
-                }
-            }
-        }
-        return ( $sql_where != '' ) ? $sql_where = substr($sql_where,0,-3) : '1';
-    }
-	
+
+				// if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
+				if(isset($searchval) && $searchval != ''){
+					$sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$searchval.$i['suffix'])."' and";
+				}
+			}
+		}
+		return ( $sql_where != '' ) ? $sql_where = substr($sql_where, 0, -3) : '1';
+	}
+
 	public function getPagingValue($key) {
 		if(!is_array($this->pagingValues)) return null;
 		if(!array_key_exists($key, $this->pagingValues)) return null;
 		return $this->pagingValues[$key];
 	}
-	
-    public function getPagingSQL($sql_where = '1') 
-    {
-        global $app, $conf;
-		
+
+	public function getPagingSQL($sql_where = '1')
+	{
+		global $app, $conf;
+
 		//* Add Global Limit from selectbox
-        if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit']) > 0){
+		if(!empty($_POST['search_limit']) and $app->functions->intval($_POST['search_limit']) > 0){
 			$_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']);
 		}
-		
+
 		//if(preg_match('{^[0-9]$}',$_SESSION['search']['limit'])){
-		//	$_SESSION['search']['limit'] = 15;
+		// $_SESSION['search']['limit'] = 15;
 		//}
 		if(intval($_SESSION['search']['limit']) < 1) $_SESSION['search']['limit'] = 15;
 
-        //* Get Config variables
-        $list_name          = $this->listDef['name'];
-        $search_prefix      = $this->listDef['search_prefix'];
-        $records_per_page   = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
-        $table              = $this->listDef['table'];
-
-        //* set PAGE to zero, if in session not set
-        if(!isset($_SESSION['search'][$list_name]['page']) || $_SESSION['search'][$list_name]['page'] == ''){
-            $_SESSION['search'][$list_name]['page'] = 0;
-        }
-
-        //* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
-        if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
-
-        //* PAGE to 0 set, if look for themselves ?  page auf 0 setzen, wenn suche sich ge�ndert hat.
-        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".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where");
-        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
-
-
-        $vars['list_file']      = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
-        $vars['page']           = $_SESSION['search'][$list_name]['page'];
-        $vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
-        $vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
-        $vars['pages']          = $pages;
-        $vars['max_pages']      = $pages + 1;
-        $vars['records_gesamt'] = $record_count['anzahl'];
-        $vars['page_params']    = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
-        $vars['offset'] 		= $sql_von;
-        $vars['records_per_page'] = $records_per_page;
-        //$vars['module'] = $_SESSION['s']['module']['name'];
-
-        if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
-        if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
-
-        $this->pagingValues = $vars;
-        $this->pagingHTML = $this->getPagingHTML($vars);
-
-        //* Return limit sql
-        return "LIMIT $sql_von, $records_per_page";
-    }
-
-    public function getPagingHTML($vars)
-    {
-        global $app;
-        
-        // we want to show at max 17 page numbers (8 left, current, 8 right)
-        $show_pages_count = 17;
-        
-        $show_pages = array(0); // first page
-        if($vars['pages'] > 0) $show_pages[] = $vars['pages']; // last page
-        for($p = $vars['page'] - 2; $p <= $vars['page'] + 2; $p++) { // surrounding pages
-            if($p > 0 && $p < $vars['pages']) $show_pages[] = $p;
-        }
-        
-        $l_start = $vars['page'] - 13;
-        $l_start -= ($l_start % 10) + 1;
-        $h_end = $vars['page'] + 23;
-        $h_end -= ($h_end % 10) + 1;
-        for($p = $l_start; $p <= $h_end; $p += 10) { // surrounding pages
-            if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
-        }
-        
-        $l_start = $vars['page'] - 503;
-        $l_start -= ($l_start % 100) + 1;
-        $h_end = $vars['page'] + 603;
-        $h_end -= ($h_end % 100) + 1;
-        for($p = $l_start; $p <= $h_end; $p += 100) { // surrounding pages
-            if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
-        }
-        
-        $l_start = $vars['page'] - 203;
-        $l_start -= ($l_start % 25) + 1;
-        $h_end = $vars['page'] + 228;
-        $h_end -= ($h_end % 25) + 1;
-        for($p = $l_start; $p <= $h_end; $p += 25) { // surrounding pages
-            if($p > 0 && $p < $vars['pages'] && abs($p - $vars['page']) > 30 && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
-        }
-        
-        sort($show_pages);
-        $show_pages = array_unique($show_pages);
-        
-        //* Show Back 
-        if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){
-        $content = '<a class="btn-page first-page" href="'."javascript:loadContent('".$vars['list_file'].'?page=0'.$vars['page_params']."');".'">'
-                    .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop_180.png"></a> &nbsp; ';
-            $content .= '<a class="btn-page previous-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params']."');".'">'
-                        .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_180.png"></a> &nbsp; ';
-        }
-        $content .= ' '.$this->lng('page_txt').' ';
-        $prev = -1;
-        foreach($show_pages as $p) {
-            if($prev != -1 && $p > $prev + 1) $content .= '<span class="page-spacer">...</span>';
-            $content .= '<a class="link-page' . ($p == $vars['page'] ? ' current-page' : '') . '" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$p.$vars['page_params']."');".'">'. ($p+1) .'</a>';
-            $prev = $p;
-        }
-        //.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' &nbsp; ';
-        //* Show Next
-        if(isset($vars['show_page_next']) && $vars['show_page_next'] == 1){
-            $content .= '<a class="btn-page next-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params']."');".'">'
-                        .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow.png"></a> &nbsp; ';
-        $content .= '<a class="btn-page last-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['pages'].$vars['page_params']."');".'">'
-                    .'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop.png"></a>';
-        }
-        return $content;
-    }
-		
+		//* Get Config variables
+		$list_name          = $this->listDef['name'];
+		$search_prefix      = $this->listDef['search_prefix'];
+		$records_per_page   = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ;
+		$table              = $this->listDef['table'];
+
+		//* set PAGE to zero, if in session not set
+		if(!isset($_SESSION['search'][$list_name]['page']) || $_SESSION['search'][$list_name]['page'] == ''){
+			$_SESSION['search'][$list_name]['page'] = 0;
+		}
+
+		//* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page"
+		if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]);
+
+		//* PAGE to 0 set, if look for themselves ?  page auf 0 setzen, wenn suche sich ge�ndert hat.
+		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".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where");
+		$pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
+
+
+		$vars['list_file']      = $_SESSION['s']['module']['name'].'/'.$this->listDef['file'];
+		$vars['page']           = $_SESSION['search'][$list_name]['page'];
+		$vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
+		$vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
+		$vars['pages']          = $pages;
+		$vars['max_pages']      = $pages + 1;
+		$vars['records_gesamt'] = $record_count['anzahl'];
+		$vars['page_params']    = (isset($this->listDef['page_params'])) ? $this->listDef['page_params'] : '';
+		$vars['offset']   = $sql_von;
+		$vars['records_per_page'] = $records_per_page;
+		//$vars['module'] = $_SESSION['s']['module']['name'];
+
+		if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
+		if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
+
+		$this->pagingValues = $vars;
+		$this->pagingHTML = $this->getPagingHTML($vars);
+
+		//* Return limit sql
+		return "LIMIT $sql_von, $records_per_page";
+	}
+
+	public function getPagingHTML($vars)
+	{
+		global $app;
+
+		// we want to show at max 17 page numbers (8 left, current, 8 right)
+		$show_pages_count = 17;
+
+		$show_pages = array(0); // first page
+		if($vars['pages'] > 0) $show_pages[] = $vars['pages']; // last page
+		for($p = $vars['page'] - 2; $p <= $vars['page'] + 2; $p++) { // surrounding pages
+			if($p > 0 && $p < $vars['pages']) $show_pages[] = $p;
+		}
+
+		$l_start = $vars['page'] - 13;
+		$l_start -= ($l_start % 10) + 1;
+		$h_end = $vars['page'] + 23;
+		$h_end -= ($h_end % 10) + 1;
+		for($p = $l_start; $p <= $h_end; $p += 10) { // surrounding pages
+			if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
+		}
+
+		$l_start = $vars['page'] - 503;
+		$l_start -= ($l_start % 100) + 1;
+		$h_end = $vars['page'] + 603;
+		$h_end -= ($h_end % 100) + 1;
+		for($p = $l_start; $p <= $h_end; $p += 100) { // surrounding pages
+			if($p > 0 && $p < $vars['pages'] && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
+		}
+
+		$l_start = $vars['page'] - 203;
+		$l_start -= ($l_start % 25) + 1;
+		$h_end = $vars['page'] + 228;
+		$h_end -= ($h_end % 25) + 1;
+		for($p = $l_start; $p <= $h_end; $p += 25) { // surrounding pages
+			if($p > 0 && $p < $vars['pages'] && abs($p - $vars['page']) > 30 && !in_array($p, $show_pages, true) && count($show_pages) < $show_pages_count) $show_pages[] = $p;
+		}
+
+		sort($show_pages);
+		$show_pages = array_unique($show_pages);
+
+		//* Show Back
+		if(isset($vars['show_page_back']) && $vars['show_page_back'] == 1){
+			$content = '<a class="btn-page first-page" href="'."javascript:loadContent('".$vars['list_file'].'?page=0'.$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop_180.png"></a> &nbsp; ';
+			$content .= '<a class="btn-page previous-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_180.png"></a> &nbsp; ';
+		}
+		$content .= ' '.$this->lng('page_txt').' ';
+		$prev = -1;
+		foreach($show_pages as $p) {
+			if($prev != -1 && $p > $prev + 1) $content .= '<span class="page-spacer">...</span>';
+			$content .= '<a class="link-page' . ($p == $vars['page'] ? ' current-page' : '') . '" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$p.$vars['page_params']."');".'">'. ($p+1) .'</a>';
+			$prev = $p;
+		}
+		//.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' &nbsp; ';
+		//* Show Next
+		if(isset($vars['show_page_next']) && $vars['show_page_next'] == 1){
+			$content .= '<a class="btn-page next-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow.png"></a> &nbsp; ';
+			$content .= '<a class="btn-page last-page" href="'."javascript:loadContent('".$vars['list_file'].'?page='.$vars['pages'].$vars['page_params']."');".'">'
+				.'<img src="themes/'.$_SESSION['s']['theme'].'/icons/x16/arrow_stop.png"></a>';
+		}
+		return $content;
+	}
+
 	public function getPagingHTMLasTXT($vars)
-    {
-        global $app;
-        $content = '[<a href="'.$vars['list_file'].'?page=0'.$vars['page_params'].'">|&lt;&lt; </a>]';
-        if($vars['show_page_back'] == 1){
-            $content .= '[<< <a href="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'">'.$app->lng('page_back_txt').'</a>] ';
-        }
-        $content .= ' '.$this->lng('page_txt').' '.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' ';
-        if($vars['show_page_next'] == 1){
-            $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params'].'">'.$app->lng('page_next_txt').' >></a>] ';
-        }
-        $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['pages'].$vars['page_params'].'"> &gt;&gt;|</a>]';
-        return $content;
-    }
-
-    public function getSortSQL()
-    {
-        global $app, $conf;
-        //* Get config vars
-        $sort_field = $this->listDef['sort_field'];
-        $sort_direction = $this->listDef['sort_direction'];
-        return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
-    }
-
-    public function decode($record) 
-    {
-        global $conf, $app;
-        if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
-            foreach($this->listDef['item'] as $field){
-                $key = $field['field'];
-                //* Apply filter to record value.
-                if(isset($field['filters']) && is_array($field['filters'])) {
-                    $app->uses('tform');
-                    $record[$key] = $app->tform->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
-                }
+	{
+		global $app;
+		$content = '[<a href="'.$vars['list_file'].'?page=0'.$vars['page_params'].'">|&lt;&lt; </a>]';
+		if($vars['show_page_back'] == 1){
+			$content .= '[<< <a href="'.$vars['list_file'].'?page='.$vars['last_page'].$vars['page_params'].'">'.$app->lng('page_back_txt').'</a>] ';
+		}
+		$content .= ' '.$this->lng('page_txt').' '.$vars['next_page'].' '.$this->lng('page_of_txt').' '.$vars['max_pages'].' ';
+		if($vars['show_page_next'] == 1){
+			$content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$vars['page_params'].'">'.$app->lng('page_next_txt').' >></a>] ';
+		}
+		$content .= '[<a href="'.$vars['list_file'].'?page='.$vars['pages'].$vars['page_params'].'"> &gt;&gt;|</a>]';
+		return $content;
+	}
+
+	public function getSortSQL()
+	{
+		global $app, $conf;
+		//* Get config vars
+		$sort_field = $this->listDef['sort_field'];
+		$sort_direction = $this->listDef['sort_direction'];
+		return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
+	}
+
+	public function decode($record)
+	{
+		global $conf, $app;
+		if(is_array($record) && count($record) > 0 && is_array($this->listDef['item'])) {
+			foreach($this->listDef['item'] as $field){
+				$key = $field['field'];
+				//* Apply filter to record value.
+				if(isset($field['filters']) && is_array($field['filters'])) {
+					$app->uses('tform');
+					$record[$key] = $app->tform->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
+				}
 				if(isset($record[$key])) {
-                	switch ($field['datatype']){
-                    case 'VARCHAR':
-                    case 'TEXT':
-                        $record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
-                         break;
-
-                    case 'DATETSTAMP':
-                        if ($record[$key] > 0) {
+					switch ($field['datatype']){
+					case 'VARCHAR':
+						case 'TEXT':
+						$record[$key] = htmlentities(stripslashes($record[$key]), ENT_QUOTES, $conf["html_content_encoding"]);
+						break;
+
+					case 'DATETSTAMP':
+						if ($record[$key] > 0) {
 							// is value int?
 							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+								$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
 							} else {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+								$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
 							}
 						}
-                        break;
+						break;
 					case 'DATETIMETSTAMP':
-                        if ($record[$key] > 0) {
+						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]);
+								$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
 							} else {
-	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+								$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
 							}
 						}
-                        break;
+						break;
 					case 'DATE':
-                        if ($record[$key] > 0) {
+						if ($record[$key] > 0) {
 							// is value int?
 							if (preg_match("/^[0-9]+[\.]?[0-9]*$/", $record[$key], $p)) {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
+								$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
 							} else {
-	                        	$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
+								$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
 							}
 						}
-                        break;
-                        
-                    case 'DATETIME':
-                        if ($record[$key] > 0) {
+						break;
+
+					case 'DATETIME':
+						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]);
+								$record[$key] = date($this->lng('conf_format_datetime'), $record[$key]);
 							} else {
-	                        	$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
+								$record[$key] = date($this->lng('conf_format_datetime'), strtotime($record[$key]));
 							}
 						}
-                        break;
+						break;
 
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
+					case 'INTEGER':
+						$record[$key] = $app->functions->intval($record[$key]);
+						break;
 
-                    case 'DOUBLE':
-                        $record[$key] = htmlentities($record[$key],ENT_QUOTES,$conf["html_content_encoding"]);
-                        break;
+					case 'DOUBLE':
+						$record[$key] = htmlentities($record[$key], ENT_QUOTES, $conf["html_content_encoding"]);
+						break;
 
-                    case 'CURRENCY':
-                        $record[$key] = $app->functions->currency_format($record[$key]);
-                        break;
+					case 'CURRENCY':
+						$record[$key] = $app->functions->currency_format($record[$key]);
+						break;
 
-                    default:
-                        $record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
-                	}
+					default:
+						$record[$key] = htmlentities(stripslashes($record[$key]), ENT_QUOTES, $conf["html_content_encoding"]);
+					}
 				}
-            }
-        }
-        return $record;
-    }
-
-    public function encode($record)
-    {
-	global $app;
-        if(is_array($record)) {
-            foreach($this->listDef['item'] as $field){
-                $key = $field['field'];
-                switch($field['datatype']){
-
-                    case 'VARCHAR':
-                    case 'TEXT':
-                        if(!is_array($record[$key])) {
-                            $record[$key] = $app->db->quote($record[$key]);
-                        } else {
-                            $record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
-                        }
-                        break;
-                    
-					case 'DATETSTAMP':
-                        if($record[$key] > 0) {
-						    $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') {
-						    $record[$key] = $record[$key];
-                        }
-                        break;
-
-                    case 'DATETIME':
-                        if($record[$key] > 0) {
-						    $record[$key] = date('Y-m-d H:i:s',strtotime($record[$key]));
-                        }
-                        break;
-
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
-
-                    case 'DOUBLE':
-                        $record[$key] = $app->db->quote($record[$key]);
-                        break;
-
-                    case 'CURRENCY':
-                        $record[$key] = str_replace(',', '.', $record[$key]);
-                        break;
-                }
-            }
-        }
-        return $record;
-    }
-	
+			}
+		}
+		return $record;
+	}
+
+	public function encode($record)
+	{
+		global $app;
+		if(is_array($record)) {
+			foreach($this->listDef['item'] as $field){
+				$key = $field['field'];
+				switch($field['datatype']){
+
+				case 'VARCHAR':
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$record[$key] = $app->db->quote($record[$key]);
+					} else {
+						$record[$key] = implode($this->tableDef[$key]['separator'], $record[$key]);
+					}
+					break;
+
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						$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') {
+						$record[$key] = $record[$key];
+					}
+					break;
+
+				case 'DATETIME':
+					if($record[$key] > 0) {
+						$record[$key] = date('Y-m-d H:i:s', strtotime($record[$key]));
+					}
+					break;
+
+				case 'INTEGER':
+					$record[$key] = $app->functions->intval($record[$key]);
+					break;
+
+				case 'DOUBLE':
+					$record[$key] = $app->db->quote($record[$key]);
+					break;
+
+				case 'CURRENCY':
+					$record[$key] = str_replace(',', '.', $record[$key]);
+					break;
+				}
+			}
+		}
+		return $record;
+	}
+
 	function lng($msg) {
 		global $app;
-			
+
 		if(isset($this->wordbook[$msg])) {
 			return $this->wordbook[$msg];
 		} else {
 			return $app->lng($msg);
-		}	
+		}
 	}
-	
+
 	function escapeArrayValues($search_values) {
-	    global $conf;
-		
+		global $conf;
+
 		$out = array();
 		if(is_array($search_values)) {
 			foreach($search_values as $key => $val) {
-				$out[$key] = htmlentities($val,ENT_QUOTES,$conf["html_content_encoding"]);
+				$out[$key] = htmlentities($val, ENT_QUOTES, $conf["html_content_encoding"]);
 			}
 		}
-		
+
 		return $out;
-		
+
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/listform_actions.inc.php b/interface/lib/classes/listform_actions.inc.php
index fe167a90a59ca70641c8d68e836f921f98209444..0062d8e3ae6725eb8e3f3b912d6666f2f3dc2e85 100644
--- a/interface/lib/classes/listform_actions.inc.php
+++ b/interface/lib/classes/listform_actions.inc.php
@@ -29,7 +29,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class listform_actions {
-	
+
 	private $id;
 	public $idx_key;
 	public $DataRowColor;
@@ -37,139 +37,139 @@ class listform_actions {
 	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;
-    }
-    
+
+	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;
-		
+
 		$app->uses('tpl,listform,tform');
-		
+
 		//* Clear session variable that is used when lists are embedded with the listview plugin
 		$_SESSION['s']['form']['return_to'] = '';
-		
+
 		// Load list definition
 		$app->listform->loadListDef($list_def_file);
-		
+
 		if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) {
 			$app->uses('listform_tpl_generator');
 			$app->listform_tpl_generator->buildHTML($app->listform->listDef);
 		}
-		
+
 		$app->tpl->newTemplate("listpage.tpl.htm");
-		$app->tpl->setInclude('content_tpl','templates/'.$app->listform->listDef["name"].'_list.htm');
-		
+		$app->tpl->setInclude('content_tpl', 'templates/'.$app->listform->listDef["name"].'_list.htm');
+
 		//* Manipulate order by for sorting / Every list has a stored value
 		//* Against notice error
 		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'] = '';
+			$_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'] = '';
 		}
-        
-        $php_sort = false;
-        
+
+		$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(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'][$_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;
-		  }
+			$order = str_replace('tbl_col_', '', $_GET['orderby']);
+
+			//* Check the css class submited value
+			if (preg_match("/^[a-z\_]{1,}$/", $order)) {
+
+				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'][$_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'][$_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'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ',$this->SQLOrderBy);
-		  }
+			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'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'].', ', $this->SQLOrderBy);
+			}
 		}
-		
+
 		if($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order_in_php']) $php_sort = true;
-		
+
 		// Getting Datasets from DB
 		$records = $app->db->queryAllRecords($this->getQueryString($php_sort));
 
 		$this->DataRowColor = "#FFFFFF";
 		$records_new = '';
 		if(is_array($records)) {
-			$this->idx_key = $app->listform->listDef["table_idx"]; 
+			$this->idx_key = $app->listform->listDef["table_idx"];
 			foreach($records as $rec) {
 				$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'));
-        }
-        if($php_sort) {
+
+		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'));
+		}
+		if($php_sort) {
 			$records_new = array_slice($records_new, $app->listform->getPagingValue('offset'), $app->listform->getPagingValue('records_per_page'));
 		}
-        
-		$app->tpl->setLoop('records',$records_new);
+
+		$app->tpl->setLoop('records', $records_new);
 
 		$this->onShow();
-		
-		
+
+
 	}
-	
+
 	public function prepareDataRow($rec)
-    {
+	{
 		global $app;
-		
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
-		
+
 		//* substitute value for select fields
 		if(is_array($app->listform->listDef['item']) && count($app->listform->listDef['item']) > 0) {
 			foreach($app->listform->listDef['item'] as $field) {
@@ -184,12 +184,12 @@ class listform_actions {
 				}
 			}
 		}
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
-	
+
 	public function getQueryString($no_limit = false) {
 		global $app;
 		$sql_where = '';
@@ -199,32 +199,32 @@ class listform_actions {
 			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';
+				$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);
+		$app->tpl->setVar('paging', $app->listform->pagingHTML);
 
 		$extselect = '';
 		$join = '';
-		
+
 		if($this->SQLExtSelect != '') {
-			if(substr($this->SQLExtSelect,0,1) != ',') $this->SQLExtSelect = ','.$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']);
@@ -241,53 +241,54 @@ class listform_actions {
 		//echo $sql;
 		return $sql;
 	}
-	
-	
+
+
 	public function onShow()
-    {
+	{
 		global $app;
-		
+
 		//* Set global Language File
 		$lng_file = ISPC_LIB_PATH.'/lang/'.$_SESSION['s']['language'].'.lng';
 		if(!file_exists($lng_file))
-		$lng_file = ISPC_LIB_PATH.'/lang/en.lng';
-		include($lng_file);
+			$lng_file = ISPC_LIB_PATH.'/lang/en.lng';
+		include $lng_file;
 		$app->tpl->setVar($wb);
-		
+
 		//* Limit each page
-		$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
+		$limits = array('5'=>'5', '15'=>'15', '25'=>'25', '50'=>'50', '100'=>'100', '999999999' => 'all');
 
 		//* create options and set selected, if default -> 15 is selected
 
 		$options = '';
 		foreach($limits as $key => $val){
-		  $options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
+			$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
 		}
-		$app->tpl->setVar('search_limit','<select name="search_limit" class="search_limit">'.$options.'</select>');
-		
-		$app->tpl->setVar('toolsarea_head_txt',$app->lng('toolsarea_head_txt'));
+		$app->tpl->setVar('search_limit', '<select name="search_limit" class="search_limit">'.$options.'</select>');
+
+		$app->tpl->setVar('toolsarea_head_txt', $app->lng('toolsarea_head_txt'));
 		$app->tpl->setVar($app->listform->wordbook);
 		$app->tpl->setVar('form_action', $app->listform->listDef['file']);
-		
-        if(isset($_SESSION['show_info_msg'])) {
-            $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-            unset($_SESSION['show_info_msg']);
-        }
-        if(isset($_SESSION['show_error_msg'])) {
-            $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-            unset($_SESSION['show_error_msg']);
-        }
-        
+
+		if(isset($_SESSION['show_info_msg'])) {
+			$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+			unset($_SESSION['show_info_msg']);
+		}
+		if(isset($_SESSION['show_error_msg'])) {
+			$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+			unset($_SESSION['show_error_msg']);
+		}
+
 		//* Parse the templates and send output to the browser
 		$this->onShowEnd();
 	}
-	
+
 	public function onShowEnd()
-    {
+	{
 		global $app;
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/listform_tpl_generator.inc.php b/interface/lib/classes/listform_tpl_generator.inc.php
index e19b52c3ff66a511c54b2f5b60deb2dee6f7e8b9..b8a26a73ae71bdd3a125895ba9e887e3daf046f0 100644
--- a/interface/lib/classes/listform_tpl_generator.inc.php
+++ b/interface/lib/classes/listform_tpl_generator.inc.php
@@ -29,11 +29,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class listform_tpl_generator {
-	
-	function buildHTML($listDef,$module = '') {
-		
+
+	function buildHTML($listDef, $module = '') {
+
 		global $app;
-		
+
 		if($module == '') $module = $_SESSION["s"]["module"]["name"];
 
 		$lang = array();
@@ -57,22 +57,22 @@ class listform_tpl_generator {
         <thead>
           <tr>
 ';
-		
+
 		$lang["list_head_txt"] = $listDef["name"];
-      $colcount = 0;
+		$colcount = 0;
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			$html .= "            <th class=\"tbl_col_".$key."\" scope=\"col\"><tmpl_var name=\"".$key."_txt\"></th>\n";
 			$lang[$key."_txt"] = $key;
-         $colcount++;
+			$colcount++;
 		}
-		
+
 		$html .= '            <th class="tbl_col_buttons" scope="col">&nbsp;</th>
           </tr>
           <tr>
 ';
-  
-  		foreach($listDef["item"] as $field) {
+
+		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			if($field["formtype"] == 'SELECT') {
 				$html .= "            <td class=\"tbl_col_".$key."\"><select name=\"".$listDef["search_prefix"].$key."\" onChange=\"submitForm('pageForm','".$module."/".$listDef["file"]."');\">{tmpl_var name='".$listDef["search_prefix"].$key."'}</select></td>\n";
@@ -80,7 +80,7 @@ class listform_tpl_generator {
 				$html .= "            <td class=\"tbl_col_".$key."\"><input type=\"text\" name=\"".$listDef["search_prefix"].$key."\" value=\"{tmpl_var name='".$listDef["search_prefix"].$key."'}\" /></td>\n";
 			}
 		}
-		
+
 		$html .= '            <td class="tbl_col_buttons"><div class="buttons"><button type="button" class="icons16 icoFilter" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" onclick="'."submitForm('pageForm','".$module."/".$listDef["file"]."');".'"><span>{tmpl_var name="filter_txt"}</span></button></div></td>
           </tr>
         </thead>
@@ -88,14 +88,14 @@ class listform_tpl_generator {
           <tmpl_loop name="records">
           <tr class="tbl_row_<tmpl_if name=\'__EVEN__\'}even<tmpl_else>uneven</tmpl_if>">
 ';
-		
+
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			$html .= "            <td class=\"tbl_col_".$key."\"><a href=\"#\" onclick=\"loadContent('".$module."/".$listDef["edit_file"]."?id={tmpl_var name='id'}');\">{tmpl_var name=\"".$key."\"}</a></td>\n";
 		}
-		
+
 		$html .= "            <td class=\"tbl_col_buttons\">
-              <div class=\"buttons icons16\">    
+              <div class=\"buttons icons16\">
                 <a class=\"button icons16 icoDelete\" href=\"javascript: del_record('".$module."/".$listDef["delete_file"]."?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');\"><span>{tmpl_var name='delete_txt'}</span></a>
               </div>
             </td>
@@ -107,7 +107,7 @@ class listform_tpl_generator {
               </tr>
           </tmpl_unless>
         </tbody>";
-  $html .= '
+		$html .= '
         <tfoot>
           <tr>
             <td class="tbl_footer tbl_paging" colspan="'.(count($listDef["item"])+1).'"><tmpl_var name="paging"></td>
@@ -119,26 +119,26 @@ class listform_tpl_generator {
 
 </div>
 ';
-		
+
 		if($module == '') {
 			$filename = 'templates/'.$listDef["name"].'_list.htm';
 		} else {
 			$filename = '../'.$module.'/templates/'.$listDef["name"].'_list.htm';
 		}
-		
-		
+
+
 		// save template
-		if (!$handle = fopen($filename, 'w')) { 
-        	print "Cannot open file ($filename)"; 
-        	exit; 
-   		} 
- 
-   		if (!fwrite($handle, $html)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $html)) {
+			print "Cannot write to file ($filename)";
+			exit;
 		}
 		fclose($handle);
-		
+
 		/*$lang["page_txt"] = 'Page';
 		$lang["page_of_txt"] = 'of';
 		$lang["page_next_txt"] = 'Next';
@@ -147,41 +147,41 @@ class listform_tpl_generator {
 		$lang["filter_txt"] = 'Filter';
 		$lang["add_new_record_txt"] = 'Add new record';
 		*/
-		
+
 		// save language file
-		$this->lng_add($lang,$listDef,$module);
-    }
-	
-	function lng_add($lang,$listDef,$module = '') {
-		global $go_api, $go_info,$conf;
-		
+		$this->lng_add($lang, $listDef, $module);
+	}
+
+	function lng_add($lang, $listDef, $module = '') {
+		global $go_api, $go_info, $conf;
+
 		if($module == '') {
 			$lng_file = "lib/lang/".$conf["language"]."_".$listDef['name']."_list.lng";
 		} else {
 			$lng_file = '../'.$module."/lib/lang/en_".$listDef['name']."_list.lng";
 		}
-		
+
 		if(is_file($lng_file)) {
-			include_once($lng_file);
+			include_once $lng_file;
 		} else {
 			$wb = array();
 		}
-		
-		$wb_out = array_merge($lang,$wb);
-		
+
+		$wb_out = array_merge($lang, $wb);
+
 		if(is_array($wb_out)) {
-			$fp = fopen ($lng_file, "w");
-			fwrite($fp,"<?php\n");
+			$fp = fopen($lng_file, "w");
+			fwrite($fp, "<?php\n");
 			foreach($wb_out as $key => $val) {
 				$new_line = '$wb["'.$key.'"] = '."'$val';\n";
-				fwrite($fp,$new_line);
-				
+				fwrite($fp, $new_line);
+
 			}
-			fwrite($fp,"?>");
+			fwrite($fp, "?>");
 			fclose($fp);
 		}
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin.inc.php b/interface/lib/classes/plugin.inc.php
index 341b186223d5f9c9381f3774e1c3f0bc7f6d6f5c..aaaf56797cf9a18c77ed5bc2cd3d2d912f752a1f 100644
--- a/interface/lib/classes/plugin.inc.php
+++ b/interface/lib/classes/plugin.inc.php
@@ -29,92 +29,92 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class plugin {
-	
+
 	private $subscribed_events = array();
 	private $debug = false;
-	
-	
+
+
 	/*
 	 This function is called to load the plugins from the plugins folder and update the plugin cache
 	*/
-	
+
 	private function loadPluginCache() {
-		global $app,$conf;
-		
-		
+		global $app, $conf;
+
+
 		if(isset($_SESSION['s']['plugin_cache'])) unset($_SESSION['s']['plugin_cache']);
-		
+
 		$plugins_dir = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV;
 		$_SESSION['s']['plugin_cache'] = array();
 		$tmp_plugins = array();
-		
+
 		if (is_dir($plugins_dir)) {
 			if ($dh = opendir($plugins_dir)) {
 				//** Go trough all files in the plugin dir
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						$plugin_name = substr($file, 0, -8);
 						$tmp_plugins[$plugin_name] = $file;
 					}
 				}
 				//** sort the plugins by name
 				ksort($tmp_plugins);
-				
+
 				//** load the plugins
 				foreach($tmp_plugins as $plugin_name => $file) {
-					include_once($plugins_dir.$file);
-					if($this->debug) $app->log('Loading plugin: '.$plugin_name,LOGLEVEL_DEBUG);
+					include_once $plugins_dir.$file;
+					if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
 					$app->loaded_plugins[$plugin_name] = new $plugin_name;
 					$app->loaded_plugins[$plugin_name]->onLoad();
 				}
 			} else {
-				$app->log('Unable to open the plugins directory: '.$plugins_dir,LOGLEVEL_ERROR);
+				$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log('Plugins directory missing: '.$plugins_dir,LOGLEVEL_ERROR);
+			$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
 		}
-		
+
 	}
-	
+
 	/*
-	 This function is called by the plugin to register for an event which is saved into the plugin cache 
+	 This function is called by the plugin to register for an event which is saved into the plugin cache
 	 for faster lookups without the need to load all plugins for every page.
 	*/
-	
-	public function registerEvent($event_name,$plugin_name,$function_name) {
+
+	public function registerEvent($event_name, $plugin_name, $function_name) {
 		global $app;
-		
+
 		$_SESSION['s']['plugin_cache'][$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
-		if($this->debug) $app->log("Plugin '$plugin_name' has registered the function '$function_name' for the event '$event_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Plugin '$plugin_name' has registered the function '$function_name' for the event '$event_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	/*
 		This function is called when a certian action occurs, e.g. a form gets saved or a user is logged in.
 	*/
-	
-	public function raiseEvent($event_name,$data) {
+
+	public function raiseEvent($event_name, $data) {
 		global $app;
-		
+
 		if(!isset($_SESSION['s']['plugin_cache'])) {
 			$this->loadPluginCache();
-			if($this->debug) $app->log('Loaded the plugin cache.',LOGLEVEL_DEBUG);
+			if($this->debug) $app->log('Loaded the plugin cache.', LOGLEVEL_DEBUG);
 		}
-		
-		
-		$sub_events = explode(':',$event_name);
-		
+
+
+		$sub_events = explode(':', $event_name);
+
 		if(is_array($sub_events)) {
 			if(count($sub_events) == 3) {
 				$tmp_event = $sub_events[2];
-				if($this->debug) $app->log("Called Event '$tmp_event'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($tmp_event,$data);
+				if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($tmp_event, $data);
 				$tmp_event = $sub_events[0].':'.$sub_events[2];
-				if($this->debug) $app->log("Called Event '$tmp_event'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($tmp_event,$data);
+				if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($tmp_event, $data);
 				$tmp_event = $sub_events[0].':'.$sub_events[1].':'.$sub_events[2];
-				if($this->debug) $app->log("Called Event '$tmp_event'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($tmp_event,$data);
-				
+				if($this->debug) $app->log("Called Event '$tmp_event'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($tmp_event, $data);
+
 				/*$sub_events = array_reverse($sub_events);
 				$tmp_event = '';
 				foreach($sub_events as $n => $sub_event) {
@@ -124,44 +124,44 @@ class plugin {
 				}
 				*/
 			} else {
-				if($this->debug) $app->log("Called Event '$sub_events[0]'",LOGLEVEL_DEBUG);
-				$this->callPluginEvent($sub_events[0],$data);
+				if($this->debug) $app->log("Called Event '$sub_events[0]'", LOGLEVEL_DEBUG);
+				$this->callPluginEvent($sub_events[0], $data);
 			}
 		}
-		
-	 } // end function raiseEvent
-	
-	 //* Internal function to load the plugin and call the event function in the plugin.
-	 private function callPluginEvent($event_name,$data) {
-	 	global $app;
-
-	 	//* execute the functions for the events
+
+	} // end function raiseEvent
+
+	//* Internal function to load the plugin and call the event function in the plugin.
+	private function callPluginEvent($event_name, $data) {
+		global $app;
+
+		//* execute the functions for the events
 		if(@is_array($_SESSION['s']['plugin_cache'][$event_name])) {
 			foreach($_SESSION['s']['plugin_cache'][$event_name] as $rec) {
 				$plugin_name = $rec['plugin'];
 				$function_name = $rec['function'];
 				$plugin_file = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV.$plugin_name.'.inc.php';
-		
-				
+
+
 				if(is_file($plugin_file)) {
 					if(!isset($app->loaded_plugins[$plugin_name])) {
-						include_once($plugin_file);
+						include_once $plugin_file;
 						$app->loaded_plugins[$plugin_name] = new $plugin_name;
 					}
-					
-					if($this->debug) $app->log("Called method: '$function_name' in plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG);
+
+					if($this->debug) $app->log("Called method: '$function_name' in plugin '$plugin_name' for event '$event_name'", LOGLEVEL_DEBUG);
 					// call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
 
-					call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$event_name,$data);
-	
+					call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
+
 				}
 			}
-			
+
 		}
-		
-	 } // end functiom callPluginEvent
-	
-	
+
+	} // end functiom callPluginEvent
+
+
 }
 
 ?>
diff --git a/interface/lib/classes/plugin_backuplist.inc.php b/interface/lib/classes/plugin_backuplist.inc.php
index 1f90496142764792f74927646484e1e636ad2e93..6d3cdd3a0927100755ea33fdc3e93a0a0f0343e5 100644
--- a/interface/lib/classes/plugin_backuplist.inc.php
+++ b/interface/lib/classes/plugin_backuplist.inc.php
@@ -30,121 +30,121 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class plugin_backuplist extends plugin_base {
 
-        var $module;
-        var $form;
-        var $tab;
-        var $record_id;
-        var $formdef;
-        var $options;
-
-        function onShow() {
-
-                global $app;
-				
-				$listTpl = new tpl;
-                $listTpl->newTemplate('templates/web_backup_list.htm');
-				
-				//* Loading language file
-                $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng";
-                include($lng_file);
-                $listTpl->setVar($wb);
-				
-				$message = '';
-				$error = '';
-				
-				if(isset($_GET['backup_action'])) {
-					$backup_id = $app->functions->intval($_GET['backup_id']);
-					
-					//* check if the user is  owner of the parent domain
-					$domain_backup = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_backup WHERE backup_id = ".$backup_id);
-					
-                    $check_perm = 'u';
-                    if($_GET['backup_action'] == 'download') $check_perm = 'r'; // only check read permissions on download, not update permissions
-                    
-					$get_domain = $app->db->queryOneRecord("SELECT domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($domain_backup["parent_domain_id"])." AND ".$app->tform->getAuthSQL($check_perm));
-					if(empty($get_domain) || !$get_domain) {
-						$app->error($app->tform->lng('no_domain_perm'));
-					}
-					
-					if($_GET['backup_action'] == 'download' && $backup_id > 0) {
-						$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
-						$tmp = $app->db->queryOneRecord($sql);
-						if($tmp['number'] == 0) {
-							$message .= $wb['download_info_txt'];
-							$sql = 	"INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-								"VALUES (".
-								(int)$this->form->dataRecord['server_id'] . ", " .
-								time() . ", " .
-								"'backup_download', " .
-								"'".$backup_id."', " .
-								"'pending', " .
-								"''" .
-								")";
-							$app->db->query($sql);
-						} else {
-							$error .= $wb['download_pending_txt'];
-						}
-					}
-					if($_GET['backup_action'] == 'restore' && $backup_id > 0) {
-						$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
-						$tmp = $app->db->queryOneRecord($sql);
-						if($tmp['number'] == 0) {
-							$message .= $wb['restore_info_txt'];
-							$sql = 	"INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-								"VALUES (".
-								(int)$this->form->dataRecord['server_id'] . ", " .
-								time() . ", " .
-								"'backup_restore', " .
-								"'".$backup_id."', " .
-								"'pending', " .
-								"''" .
-								")";
-						$app->db->query($sql);
-						} else {
-							$error .= $wb['restore_pending_txt'];
-						}
-					}
-					
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
+
+	function onShow() {
+
+		global $app;
+
+		$listTpl = new tpl;
+		$listTpl->newTemplate('templates/web_backup_list.htm');
+
+		//* Loading language file
+		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_web_backup_list.lng";
+		include $lng_file;
+		$listTpl->setVar($wb);
+
+		$message = '';
+		$error = '';
+
+		if(isset($_GET['backup_action'])) {
+			$backup_id = $app->functions->intval($_GET['backup_id']);
+
+			//* check if the user is  owner of the parent domain
+			$domain_backup = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_backup WHERE backup_id = ".$backup_id);
+
+			$check_perm = 'u';
+			if($_GET['backup_action'] == 'download') $check_perm = 'r'; // only check read permissions on download, not update permissions
+
+			$get_domain = $app->db->queryOneRecord("SELECT domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($domain_backup["parent_domain_id"])." AND ".$app->tform->getAuthSQL($check_perm));
+			if(empty($get_domain) || !$get_domain) {
+				$app->error($app->tform->lng('no_domain_perm'));
+			}
+
+			if($_GET['backup_action'] == 'download' && $backup_id > 0) {
+				$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'";
+				$tmp = $app->db->queryOneRecord($sql);
+				if($tmp['number'] == 0) {
+					$message .= $wb['download_info_txt'];
+					$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
+						"VALUES (".
+						(int)$this->form->dataRecord['server_id'] . ", " .
+						time() . ", " .
+						"'backup_download', " .
+						"'".$backup_id."', " .
+						"'pending', " .
+						"''" .
+						")";
+					$app->db->query($sql);
+				} else {
+					$error .= $wb['download_pending_txt'];
+				}
+			}
+			if($_GET['backup_action'] == 'restore' && $backup_id > 0) {
+				$sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_restore' AND action_param = '$backup_id'";
+				$tmp = $app->db->queryOneRecord($sql);
+				if($tmp['number'] == 0) {
+					$message .= $wb['restore_info_txt'];
+					$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
+						"VALUES (".
+						(int)$this->form->dataRecord['server_id'] . ", " .
+						time() . ", " .
+						"'backup_restore', " .
+						"'".$backup_id."', " .
+						"'pending', " .
+						"''" .
+						")";
+					$app->db->query($sql);
+				} else {
+					$error .= $wb['restore_pending_txt'];
 				}
-				
-				//* Get the data
-				$web = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$this->form->id);
-				$sql = "SELECT * FROM web_backup WHERE parent_domain_id = ".$this->form->id." AND server_id = ".$web['server_id']." ORDER BY tstamp DESC, backup_type ASC";
-                $records = $app->db->queryAllRecords($sql);
-
-                $bgcolor = "#FFFFFF";
-                if(is_array($records)) {
-                        foreach($records as $rec) {
-
-                                // Change of color
-                                $bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
-                                $rec["bgcolor"] = $bgcolor;
-								
-								$rec['date'] = date($app->lng('conf_format_datetime'),$rec['tstamp']);
-								$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])];
-
-                                $records_new[] = $rec;
-                        }
-                }
-
-                $listTpl->setLoop('records',@$records_new);
-				
-				$listTpl->setVar('parent_id',$this->form->id);
-				$listTpl->setVar('msg',$message);
-				$listTpl->setVar('error',$error);
-				
-				// Setting Returnto information in the session
-                $list_name = 'backup_list';
-                // $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
-				$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
-				$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
-                $_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
-                $_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
-                $_SESSION["s"]["form"]["return_to"] = $list_name;
-				
-				return $listTpl->grab();
-        }
-		
+			}
+
+		}
+
+		//* Get the data
+		$web = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$this->form->id);
+		$sql = "SELECT * FROM web_backup WHERE parent_domain_id = ".$this->form->id." AND server_id = ".$web['server_id']." ORDER BY tstamp DESC, backup_type ASC";
+		$records = $app->db->queryAllRecords($sql);
+
+		$bgcolor = "#FFFFFF";
+		if(is_array($records)) {
+			foreach($records as $rec) {
+
+				// Change of color
+				$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
+				$rec["bgcolor"] = $bgcolor;
+
+				$rec['date'] = date($app->lng('conf_format_datetime'), $rec['tstamp']);
+				$rec['backup_type'] = $wb[('backup_type_'.$rec['backup_type'])];
+
+				$records_new[] = $rec;
+			}
+		}
+
+		$listTpl->setLoop('records', @$records_new);
+
+		$listTpl->setVar('parent_id', $this->form->id);
+		$listTpl->setVar('msg', $message);
+		$listTpl->setVar('error', $error);
+
+		// Setting Returnto information in the session
+		$list_name = 'backup_list';
+		// $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
+		$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
+		$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
+		$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
+		$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
+		$_SESSION["s"]["form"]["return_to"] = $list_name;
+
+		return $listTpl->grab();
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin_base.inc.php b/interface/lib/classes/plugin_base.inc.php
index 5b69e03c4040ba8368b5ed9207c65d8b7f40b5bc..92b874437e03c93c034a220738a6a2c3ce4a3643 100644
--- a/interface/lib/classes/plugin_base.inc.php
+++ b/interface/lib/classes/plugin_base.inc.php
@@ -29,31 +29,31 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class plugin_base {
-	
+
 	var $plugin_name;
 	var $options;
 	var $form;
-	
+
 	function onLoad() {
-	
+
 	}
-	
+
 	function onShow() {
-	
+
 	}
-	
+
 	function onInsert() {
-	
+
 	}
-	
+
 	function onUpdate() {
-	
+
 	}
-	
+
 	function onDelete() {
-	
+
 	}
-	
+
 	function setOptions($plugin_name, $options) {
 		$this->options = $options;
 		$this->plugin_name = $plugin_name;
@@ -61,4 +61,4 @@ class plugin_base {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin_dbhistory.inc.php b/interface/lib/classes/plugin_dbhistory.inc.php
index ebd9e745e64fae91adae9f9a188a35ca281c4365..c6547311106ab330d4cee9975af6b18711f9b4b8 100644
--- a/interface/lib/classes/plugin_dbhistory.inc.php
+++ b/interface/lib/classes/plugin_dbhistory.inc.php
@@ -30,40 +30,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class plugin_dbhistory extends plugin_base {
 
-        var $module;
-        var $form;
-        var $tab;
-        var $record_id;
-        var $formdef;
-        var $options;
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
 
-        function onShow() {
-		
-			global $app, $conf;
-			
-			$content = '';
-			
-			$db_table = $app->tform->formDef["db_table"];
-			$db_table_idx = $app->tform->formDef["db_table_idx"];
-			$primary_id = $this->form->id;
-			if($_SESSION["s"]["user"]["typ"] == 'admin') {
-				$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
-			} else {
-				$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE user = '".$_SESSION["s"]["user"]["username"]."' dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
-			}
-			
-			$records = $app->db->queryAllRecords($sql);
-			if(is_array($records)) {
-				$content .= '<table>';
-				foreach($records as $rec) {
-					$content .= "<tr><td>".date("d.m.Y",$rec["tstamp"])."</td><td>".$rec["user"]."</td></tr>";
-				}
-				$content .= '</table>';
+	function onShow() {
+
+		global $app, $conf;
+
+		$content = '';
+
+		$db_table = $app->tform->formDef["db_table"];
+		$db_table_idx = $app->tform->formDef["db_table_idx"];
+		$primary_id = $this->form->id;
+		if($_SESSION["s"]["user"]["typ"] == 'admin') {
+			$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
+		} else {
+			$sql = "SELECT action, tstamp, user, data FROM sys_datalog WHERE user = '".$_SESSION["s"]["user"]["username"]."' dbtable = '".$db_table."' AND dbidx = '".$db_table_idx.":".$primary_id."'";
+		}
+
+		$records = $app->db->queryAllRecords($sql);
+		if(is_array($records)) {
+			$content .= '<table>';
+			foreach($records as $rec) {
+				$content .= "<tr><td>".date("d.m.Y", $rec["tstamp"])."</td><td>".$rec["user"]."</td></tr>";
 			}
-			
-			return $content;
+			$content .= '</table>';
+		}
+
+		return $content;
+
+	}
 
-        }
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/plugin_listview.inc.php b/interface/lib/classes/plugin_listview.inc.php
index 30932b90f0946561029fe6ca03b534e8ab1f0de6..e7d576cd17a58c9af14ac3e4f7761ed4ea520bbb 100644
--- a/interface/lib/classes/plugin_listview.inc.php
+++ b/interface/lib/classes/plugin_listview.inc.php
@@ -30,153 +30,154 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class plugin_listview extends plugin_base {
 
-        var $module;
-        var $form;
-        var $tab;
-        var $record_id;
-        var $formdef;
-        var $options;
-
-        function onShow() {
-
-                global $app;
-
-                $app->uses('listform');
-                $app->listform->loadListDef($this->options["listdef"]);
-
-                //$app->listform->SQLExtWhere = "type = 'alias'";
-
-                $listTpl = new tpl;
-                $listTpl->newTemplate('templates/'.$app->listform->listDef["name"].'_list.htm');
-				
-				//die(print_r($app->tform_actions));
-
-                // Changing some of the list values to reflect that the list is called within a tform page
-                $app->listform->listDef["file"] = $app->tform->formDef["action"];
-                // $app->listform->listDef["page_params"] = "&id=".$app->tform_actions->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
-				$app->listform->listDef["page_params"] = "&id=".$this->form->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
-				$listTpl->setVar('parent_id',$this->form->id);
-				$listTpl->setVar('theme', $_SESSION['s']['theme']);
-
-                // Generate the SQL for searching
-                $sql_where = "";
-                if($app->listform->listDef["auth"] != 'no') {
-                        if($_SESSION["s"]["user"]["typ"] != "admin") {
+	var $module;
+	var $form;
+	var $tab;
+	var $record_id;
+	var $formdef;
+	var $options;
+
+	function onShow() {
+
+		global $app;
+
+		$app->uses('listform');
+		$app->listform->loadListDef($this->options["listdef"]);
+
+		//$app->listform->SQLExtWhere = "type = 'alias'";
+
+		$listTpl = new tpl;
+		$listTpl->newTemplate('templates/'.$app->listform->listDef["name"].'_list.htm');
+
+		//die(print_r($app->tform_actions));
+
+		// Changing some of the list values to reflect that the list is called within a tform page
+		$app->listform->listDef["file"] = $app->tform->formDef["action"];
+		// $app->listform->listDef["page_params"] = "&id=".$app->tform_actions->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
+		$app->listform->listDef["page_params"] = "&id=".$this->form->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
+		$listTpl->setVar('parent_id', $this->form->id);
+		$listTpl->setVar('theme', $_SESSION['s']['theme']);
+
+		// Generate the SQL for searching
+		$sql_where = "";
+		if($app->listform->listDef["auth"] != 'no') {
+			if($_SESSION["s"]["user"]["typ"] != "admin") {
 				$sql_where = $app->tform->getAuthSQL('r')." and";
-                        }
-                }
-
-                if($this->options["sqlextwhere"] != '') {
-                        $sql_where .= " ".$this->options["sqlextwhere"]." and";
-                }
-
-                $sql_where = $app->listform->getSearchSQL($sql_where);
-                $listTpl->setVar($app->listform->searchValues);
-
-                // Generate SQL for paging
-                $limit_sql = $app->listform->getPagingSQL($sql_where);
-                $listTpl->setVar("paging",$app->listform->pagingHTML);
-				
-				$sql_order_by = '';
-				if(isset($this->options["sql_order_by"])) {
-					$sql_order_by = $this->options["sql_order_by"];
-				}
+			}
+		}
+
+		if($this->options["sqlextwhere"] != '') {
+			$sql_where .= " ".$this->options["sqlextwhere"]." and";
+		}
+
+		$sql_where = $app->listform->getSearchSQL($sql_where);
+		$listTpl->setVar($app->listform->searchValues);
+
+		// Generate SQL for paging
+		$limit_sql = $app->listform->getPagingSQL($sql_where);
+		$listTpl->setVar("paging", $app->listform->pagingHTML);
+
+		$sql_order_by = '';
+		if(isset($this->options["sql_order_by"])) {
+			$sql_order_by = $this->options["sql_order_by"];
+		}
 
 		//* Limit each page
-		$limits = array('5'=>'5','15'=>'15','25'=>'25','50'=>'50','100'=>'100','999999999' => 'all');
+		$limits = array('5'=>'5', '15'=>'15', '25'=>'25', '50'=>'50', '100'=>'100', '999999999' => 'all');
 
 		//* create options and set selected, if default -> 15 is selected
 		$options='';
 		foreach($limits as $key => $val){
-		  $options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
+			$options .= '<option value="'.$key.'" '.(isset($_SESSION['search']['limit']) &&  $_SESSION['search']['limit'] == $key ? 'selected="selected"':'' ).(!isset($_SESSION['search']['limit']) && $key == '15' ? 'selected="selected"':'').'>'.$val.'</option>';
 		}
-		$listTpl->setVar('search_limit','<select name="search_limit" style="width:50px">'.$options.'</select>');
+		$listTpl->setVar('search_limit', '<select name="search_limit" style="width:50px">'.$options.'</select>');
 
 
 		//Sorting
 		if(!isset($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
-		  $_SESSION['search'][$app->listform->listDef["name"]]['order'] = '';
+			$_SESSION['search'][$app->listform->listDef["name"]]['order'] = '';
 		}
 
 		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"]]['order'] == $order){
-		      $_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order.' DESC';
-		    } else {
-		      $_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order;
-		    }
-		  }
+			$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"]]['order'] == $order){
+					$_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order.' DESC';
+				} else {
+					$_SESSION['search'][$app->listform->listDef["name"]]['order'] = $order;
+				}
+			}
 		}
 
 		// If a manuel oder by like customers isset the sorting will be infront
 		if(!empty($_SESSION['search'][$app->listform->listDef["name"]]['order'])){
-		  if(empty($sql_order_by)){
-		    $sql_order_by = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'];
-		  } else {
-		    $sql_order_by = str_replace("ORDER BY ","ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'].', ',$sql_order_by);
-		  }
+			if(empty($sql_order_by)){
+				$sql_order_by = "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'];
+			} else {
+				$sql_order_by = str_replace("ORDER BY ", "ORDER BY ".$_SESSION['search'][$app->listform->listDef["name"]]['order'].', ', $sql_order_by);
+			}
 		}
-		
-				// Loading language field
-                $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
-                include($lng_file);
-                $listTpl->setVar($wb);
-				
-
-                // Get the data
-                $records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $sql_order_by $limit_sql");
-
-                $bgcolor = "#FFFFFF";
-                if(is_array($records)) {
-                        $idx_key = $app->listform->listDef["table_idx"];
-                        foreach($records as $rec) {
-
-                                $rec = $app->listform->decode($rec);
-
-                                // Change of color
-                                $bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
-                                $rec["bgcolor"] = $bgcolor;
-								
-								// substitute value for select fields
-								foreach($app->listform->listDef["item"] as $field) {
-									$key = $field["field"];
-									if($field['formtype'] == "SELECT") {
-										if(strtolower($rec[$key]) == 'y' or strtolower($rec[$key]) == 'n') {
-											// Set a additional image variable for bolean fields
-											$rec['_'.$key.'_'] = (strtolower($rec[$key]) == 'y')?'x16/tick_circle.png':'x16/cross_circle.png';
-										}
-										//* substitute value for select field
-										@$rec[$key] = $field['value'][$rec[$key]];
-									}
-									// Create a lowercase version of every item
-									$rec[$key.'_lowercase'] = strtolower($rec[$key]);
-								}
-
-                                // The variable "id" contains always the index field
-                                $rec["id"] = $rec[$idx_key];
-								$rec["delete_confirmation"] = $wb['delete_confirmation'];
-
-                                $records_new[] = $rec;
-                        }
-                }
-
-                $listTpl->setLoop('records',@$records_new);
-
-                // Setting Returnto information in the session
-                $list_name = $app->listform->listDef["name"];
-                // $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
-				$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
-				$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
-                $_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
-                $_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
-                $_SESSION["s"]["form"]["return_to"] = $list_name;
-				//die(print_r($_SESSION["s"]["list"][$list_name]));
-
-                return $listTpl->grab();
-
-        }
+
+		// Loading language field
+		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
+		include $lng_file;
+		$listTpl->setVar($wb);
+
+
+		// Get the data
+		$records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $sql_order_by $limit_sql");
+
+		$bgcolor = "#FFFFFF";
+		if(is_array($records)) {
+			$idx_key = $app->listform->listDef["table_idx"];
+			foreach($records as $rec) {
+
+				$rec = $app->listform->decode($rec);
+
+				// Change of color
+				$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
+				$rec["bgcolor"] = $bgcolor;
+
+				// substitute value for select fields
+				foreach($app->listform->listDef["item"] as $field) {
+					$key = $field["field"];
+					if($field['formtype'] == "SELECT") {
+						if(strtolower($rec[$key]) == 'y' or strtolower($rec[$key]) == 'n') {
+							// Set a additional image variable for bolean fields
+							$rec['_'.$key.'_'] = (strtolower($rec[$key]) == 'y')?'x16/tick_circle.png':'x16/cross_circle.png';
+						}
+						//* substitute value for select field
+						@$rec[$key] = $field['value'][$rec[$key]];
+					}
+					// Create a lowercase version of every item
+					$rec[$key.'_lowercase'] = strtolower($rec[$key]);
+				}
+
+				// The variable "id" contains always the index field
+				$rec["id"] = $rec[$idx_key];
+				$rec["delete_confirmation"] = $wb['delete_confirmation'];
+
+				$records_new[] = $rec;
+			}
+		}
+
+		$listTpl->setLoop('records', @$records_new);
+
+		// Setting Returnto information in the session
+		$list_name = $app->listform->listDef["name"];
+		// $_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
+		$_SESSION["s"]["list"][$list_name]["parent_id"] = $this->form->id;
+		$_SESSION["s"]["list"][$list_name]["parent_name"] = $app->tform->formDef["name"];
+		$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
+		$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
+		$_SESSION["s"]["form"]["return_to"] = $list_name;
+		//die(print_r($_SESSION["s"]["list"][$list_name]));
+
+		return $listTpl->grab();
+
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/client.inc.php b/interface/lib/classes/remote.d/client.inc.php
index ae5086b0f86278cd892c8fe16d1ff2540384cfb0..e0dcad83f1c6d024ca7e55e8e7e61c53e34a9cde 100644
--- a/interface/lib/classes/remote.d/client.inc.php
+++ b/interface/lib/classes/remote.d/client.inc.php
@@ -39,19 +39,19 @@ by Marius Cramer <m.cramer@pixcept.de>
 */
 
 class remoting_client extends remoting {
-/* 
- * 
- * 
- * 
+	/*
+ *
+ *
+ *
  * 	 * Client functions
- * 
- * 
+ *
+ *
  */
 	//* Get client details
 	public function client_get($session_id, $client_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'client_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -59,51 +59,51 @@ class remoting_client extends remoting {
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../client/form/client.tform.php');
 		$data = $app->remoting_lib->getDataRecord($client_id);
-        
-        // we need to get the new-style templates for backwards-compatibility - maybe we remove this in a later version
-        if(is_array($data) && count($data) > 0) {
-            if(isset($data['client_id'])) {
-                // this is a single record
-                if($data['template_additional'] == '') {
-                    $tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $data['client_id']);
-                    $tpl_arr = array();
-                    if($tpls) {
-                        foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
-                    }
-                    $data['template_additional'] = implode('/', $tpl_arr);
-                    unset($tpl_arr);
-                    unset($tpls);
-                }
-            } elseif(isset($data[0]['client_id'])) {
-                // multiple client records
-                foreach($data as $index => $client) {
-                    if($client['template_additional'] == '') {
-                        $tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $client['client_id']);
-                        $tpl_arr = array();
-                        if($tpls) {
-                            foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
-                        }
-                        $data[$index]['template_additional'] = implode('/', $tpl_arr); // dont use the $client array here - changes would not be returned to soap
-                    }
-                    unset($tpl_arr);
-                    unset($tpls);
-                }
-            }
-        }
-        
-        return $data;
+
+		// we need to get the new-style templates for backwards-compatibility - maybe we remove this in a later version
+		if(is_array($data) && count($data) > 0) {
+			if(isset($data['client_id'])) {
+				// this is a single record
+				if($data['template_additional'] == '') {
+					$tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $data['client_id']);
+					$tpl_arr = array();
+					if($tpls) {
+						foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
+					}
+					$data['template_additional'] = implode('/', $tpl_arr);
+					unset($tpl_arr);
+					unset($tpls);
+				}
+			} elseif(isset($data[0]['client_id'])) {
+				// multiple client records
+				foreach($data as $index => $client) {
+					if($client['template_additional'] == '') {
+						$tpls = $app->db->queryAllRecords('SELECT CONCAT(`assigned_template_id`, \':\', `client_template_id`) as `item` FROM `client_template_assigned` WHERE `client_id` = ' . $client['client_id']);
+						$tpl_arr = array();
+						if($tpls) {
+							foreach($tpls as $tpl) $tpl_arr[] = $tpl['item'];
+						}
+						$data[$index]['template_additional'] = implode('/', $tpl_arr); // dont use the $client array here - changes would not be returned to soap
+					}
+					unset($tpl_arr);
+					unset($tpls);
+				}
+			}
+		}
+
+		return $data;
 	}
-	
+
 	public function client_get_id($session_id, $sys_userid)
-    {
+	{
 		global $app;
 		if(!$this->checkPerm($session_id, 'client_get_id')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$sys_userid = $app->functions->intval($sys_userid);
-		
+
 		$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid);
 		if(isset($rec['client_id'])) {
 			return $app->functions->intval($rec['client_id']);
@@ -111,19 +111,19 @@ class remoting_client extends remoting {
 			throw new SoapFault('no_client_found', 'There is no sysuser account for this client ID.');
 			return false;
 		}
-		
+
 	}
-	
+
 	public function client_get_groupid($session_id, $client_id)
-    {
+	{
 		global $app;
 		if(!$this->checkPerm($session_id, 'client_get_id')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$client_id = $app->functions->intval($client_id);
-		
+
 		$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client_id);
 		if(isset($rec['groupid'])) {
 			return $app->functions->intval($rec['groupid']);
@@ -131,228 +131,228 @@ class remoting_client extends remoting {
 			throw new SoapFault('no_group_found', 'There is no group for this client ID.');
 			return false;
 		}
-		
+
 	}
-	
-	
+
+
 	public function client_add($session_id, $reseller_id, $params)
 	{
 		if (!$this->checkPerm($session_id, 'client_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-        if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
-		$affected_rows = $this->klientadd('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php',$reseller_id, $params);
-		return $affected_rows;  
-				  
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+		$affected_rows = $this->klientadd('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $params);
+		return $affected_rows;
+
 	}
-	
+
 	public function client_update($session_id, $client_id, $reseller_id, $params)
 	{
-			global $app;
-			
-			if (!$this->checkPerm($session_id, 'client_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
+		global $app;
+
+		if (!$this->checkPerm($session_id, 'client_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		$app->uses('remoting_lib');
+		$app->remoting_lib->loadFormDef('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php');
+		$old_rec = $app->remoting_lib->getDataRecord($client_id);
+
+		// we need the previuos templates assigned here
+		$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
+		if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
+			// check previous type of storing templates
+			$tpls = explode('/', $old_rec['template_additional']);
+			$this->oldTemplatesAssigned = array();
+			foreach($tpls as $item) {
+				$item = trim($item);
+				if(!$item) continue;
+				$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
 			}
-            
-            $app->uses('remoting_lib');
-            $app->remoting_lib->loadFormDef('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php');
-            $old_rec = $app->remoting_lib->getDataRecord($client_id);
-            
-            // we need the previuos templates assigned here
-            $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
-            if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
-                // check previous type of storing templates
-                $tpls = explode('/', $old_rec['template_additional']);
-                $this->oldTemplatesAssigned = array();
-                foreach($tpls as $item) {
-                    $item = trim($item);
-                    if(!$item) continue;
-                    $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
-                }
-                unset($tpls);
-            }
-            if(isset($params['template_additional'])) {
-                $app->uses('client_templates');
-                $templates = explode('/', $params['template_additional']);
-                $params['template_additional'] = '';
-                $app->client_templates->update_client_templates($client_id, $templates);
-                unset($templates);
-            }
-
-            
-            if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
-			$affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params, 'client:' . ($reseller_id ? 'reseller' : 'client') . ':on_after_update');
-			
-			$app->remoting_lib->ispconfig_sysuser_update($params,$client_id);
-			
-			return $affected_rows;
+			unset($tpls);
+		}
+		if(isset($params['template_additional'])) {
+			$app->uses('client_templates');
+			$templates = explode('/', $params['template_additional']);
+			$params['template_additional'] = '';
+			$app->client_templates->update_client_templates($client_id, $templates);
+			unset($templates);
+		}
+
+
+		if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+		$affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params, 'client:' . ($reseller_id ? 'reseller' : 'client') . ':on_after_update');
+
+		$app->remoting_lib->ispconfig_sysuser_update($params, $client_id);
+
+		return $affected_rows;
 	}
-    
-    public function client_template_additional_get($session_id, $client_id) {
-        global $app;
+
+	public function client_template_additional_get($session_id, $client_id) {
+		global $app;
 
 		if(!$this->checkPerm($session_id, 'client_get')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        if(@is_numeric($client_id)) {
-            $sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ".$client_id;
-            return $app->db->queryOneRecord($sql);
-        } else {
-            $this->server->fault('The ID must be an integer.');
-            return array();
-        }
-    }
-    
-    private function _set_client_formdata($client_id) {
-        global $app;
-        
-        $this->id = $client_id;
-        $this->dataRecord = $app->db->queryOneRecord('SELECT * FROM `client` WHERE `client_id` = ' . $client_id);
-        $this->oldDataRecord = $this->dataRecord;
-        
-        $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
-        if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
-            // check previous type of storing templates
-            $tpls = explode('/', $this->oldDataRecord['template_additional']);
-            $this->oldTemplatesAssigned = array();
-            foreach($tpls as $item) {
-                $item = trim($item);
-                if(!$item) continue;
-                $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
-            }
-            unset($tpls);
-        }
-    }
-    
-    public function client_template_additional_add($session_id, $client_id, $template_id) {
-        global $app;
-        
+
+		if(@is_numeric($client_id)) {
+			$sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ".$client_id;
+			return $app->db->queryOneRecord($sql);
+		} else {
+			$this->server->fault('The ID must be an integer.');
+			return array();
+		}
+	}
+
+	private function _set_client_formdata($client_id) {
+		global $app;
+
+		$this->id = $client_id;
+		$this->dataRecord = $app->db->queryOneRecord('SELECT * FROM `client` WHERE `client_id` = ' . $client_id);
+		$this->oldDataRecord = $this->dataRecord;
+
+		$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);
+		if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
+			// check previous type of storing templates
+			$tpls = explode('/', $this->oldDataRecord['template_additional']);
+			$this->oldTemplatesAssigned = array();
+			foreach($tpls as $item) {
+				$item = trim($item);
+				if(!$item) continue;
+				$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $client_id);
+			}
+			unset($tpls);
+		}
+	}
+
+	public function client_template_additional_add($session_id, $client_id, $template_id) {
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'client_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        if(@is_numeric($client_id) && @is_numeric($template_id)) {
-            // check if client exists
-            $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
-            if(!$check) {
-                $this->server->fault('Invalid client');
-                return false;
-            }
-            // check if template exists
-            $check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ' . $template_id);
-            if(!$check) {
-                $this->server->fault('Invalid template');
-                return false;
-            }
-            
-            // for the update event we have to cheat a bit
-            $this->_set_client_formdata($client_id);
-            
-            $sql = "INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (" . $client_id . ", " . $template_id . ")";
-            $app->db->query($sql);
-            $insert_id = $app->db->insertID();
-            
-            $app->plugin->raiseEvent('client:client:on_after_update',$this);
-            
-            return $insert_id;
-        } else {
-            $this->server->fault('The IDs must be of type integer.');
-            return false;
-        }
-    }
-
-    public function client_template_additional_delete($session_id, $client_id, $assigned_template_id) {
-        global $app;
-        
+
+		if(@is_numeric($client_id) && @is_numeric($template_id)) {
+			// check if client exists
+			$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
+			if(!$check) {
+				$this->server->fault('Invalid client');
+				return false;
+			}
+			// check if template exists
+			$check = $app->db->queryOneRecord('SELECT `template_id` FROM `client_template` WHERE `template_id` = ' . $template_id);
+			if(!$check) {
+				$this->server->fault('Invalid template');
+				return false;
+			}
+
+			// for the update event we have to cheat a bit
+			$this->_set_client_formdata($client_id);
+
+			$sql = "INSERT INTO `client_template_assigned` (`client_id`, `client_template_id`) VALUES (" . $client_id . ", " . $template_id . ")";
+			$app->db->query($sql);
+			$insert_id = $app->db->insertID();
+
+			$app->plugin->raiseEvent('client:client:on_after_update', $this);
+
+			return $insert_id;
+		} else {
+			$this->server->fault('The IDs must be of type integer.');
+			return false;
+		}
+	}
+
+	public function client_template_additional_delete($session_id, $client_id, $assigned_template_id) {
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'client_update')) {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        if(@is_numeric($client_id) && @is_numeric($template_id)) {
-            // check if client exists
-            $check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
-            if(!$check) {
-                $this->server->fault('Invalid client');
-                return false;
-            }
-            // check if template exists
-            $check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $assigned_template_id);
-            if(!$check) {
-                $this->server->fault('Invalid template');
-                return false;
-            }
-            
-            // for the update event we have to cheat a bit
-            $this->_set_client_formdata($client_id);
-            
-            $sql = "DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = " . $template_id . " AND `client_id` = " . $client_id;
-            $app->db->query($sql);
-            $affected_rows = $app->db->affectedRows();
-            
-            $app->plugin->raiseEvent('client:client:on_after_update',$this);
-            
-            return $affected_rows;
-        } else {
-            $this->server->fault('The IDs must be of type integer.');
-            return false;
-        }
-    }
-
-	public function client_delete($session_id,$client_id)
-	{
-			global $app;
-			
-			if (!$this->checkPerm($session_id, 'client_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
+
+		if(@is_numeric($client_id) && @is_numeric($template_id)) {
+			// check if client exists
+			$check = $app->db->queryOneRecord('SELECT `client_id` FROM `client` WHERE `client_id` = ' . $client_id);
+			if(!$check) {
+				$this->server->fault('Invalid client');
+				return false;
+			}
+			// check if template exists
+			$check = $app->db->queryOneRecord('SELECT `assigned_template_id` FROM `client_template_assigned` WHERE `assigned_template_id` = ' . $assigned_template_id);
+			if(!$check) {
+				$this->server->fault('Invalid template');
+				return false;
 			}
-			$affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id);
-			
-			$app->remoting_lib->ispconfig_sysuser_delete($client_id);
-			
+
+			// for the update event we have to cheat a bit
+			$this->_set_client_formdata($client_id);
+
+			$sql = "DELETE FROM `client_template_assigned` WHERE `assigned_template_id` = " . $template_id . " AND `client_id` = " . $client_id;
+			$app->db->query($sql);
+			$affected_rows = $app->db->affectedRows();
+
+			$app->plugin->raiseEvent('client:client:on_after_update', $this);
+
 			return $affected_rows;
+		} else {
+			$this->server->fault('The IDs must be of type integer.');
+			return false;
+		}
 	}
-	
+
+	public function client_delete($session_id, $client_id)
+	{
+		global $app;
+
+		if (!$this->checkPerm($session_id, 'client_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../client/form/client.tform.php', $client_id);
+
+		$app->remoting_lib->ispconfig_sysuser_delete($client_id);
+
+		return $affected_rows;
+	}
+
 	// -----------------------------------------------------------------------------------------------
-	
+
 	public function client_delete_everything($session_id, $client_id)
-    {
-        global $app, $conf;
-		
+	{
+		global $app, $conf;
+
 		if(!$this->checkPerm($session_id, 'client_delete_everything')) {
-        	throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        
+
 		$client_id = $app->functions->intval($client_id);
 
-		if($client_id > 0) {			
+		if($client_id > 0) {
 			//* remove the group of the client from the resellers group
 			$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
 			$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
 			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-			$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
-			
+			$app->auth->remove_group_from_user($parent_user['userid'], $client_group['groupid']);
+
 			//* delete the group of the client
 			$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
-			
+
 			//* delete the sys user(s) of the client
 			$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
-			
+
 			//* Delete all records (sub-clients, mail, web, etc....)  of this client.
 			$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic';
-			$tables_array = explode(',',$tables);
+			$tables_array = explode(',', $tables);
 			$client_group_id = $app->functions->intval($client_group['groupid']);
-			
+
 			if($client_group_id > 1) {
 				foreach($tables_array as $table) {
 					if($table != '') {
@@ -380,112 +380,116 @@ class remoting_client extends remoting {
 								}
 							}
 						}
-						
+
 					}
 				}
 			}
-			
+
 		}
-        
+
 		if (!$this->checkPerm($session_id, 'client_delete')) {
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../client/form/client.tform.php',$client_id);
+		$affected_rows = $this->deleteQuery('../client/form/client.tform.php', $client_id);
 
-        return $affected_rows;
+		return $affected_rows;
 	}
+
 	/**
 	 * Get sys_user information by username
-	 * @param	int		session id
-	 * @param	string	user's name  
-	 * @return	mixed	false if error
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * @param int  session id
+	 * @param string user's name
+	 * @return mixed false if error
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
+
+
 	public function client_get_by_username($session_id, $username) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'client_get_by_username')) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get_by_username')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
-        }
-        $username = $app->db->quote($username);
-        $rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$username."'");
-        if (isset($rec)) {
+		}
+		$username = $app->db->quote($username);
+		$rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '".$username."'");
+		if (isset($rec)) {
 			return $rec;
-        } else {
+		} else {
 			throw new SoapFault('no_client_found', 'There is no user account for this user name.');
 			return false;
-        }
-    }
-      /**
-       * Get All client_id's from database
-       * @param int	session_id
-       * @return Array of all client_id's
-       */
+		}
+	}
+
+	/**
+	 * Get All client_id's from database
+	 * @param int session_id
+	 * @return Array of all client_id's
+	 */
 	public function client_get_all($session_id) {
-	  global $app;
-	  if(!$this->checkPerm($session_id, 'client_get_all')) {
-	    throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-	    return false;
-	  }
-	  $result = $app->db->queryAllRecords("SELECT client_id FROM client WHERE 1");
-	  if(!$result) {
-	    return false;
-	  }
-	  foreach( $result as $record) {
-	    $rarrary[] = $record['client_id'];
-	  }
-	  return $rarrary;
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get_all')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$result = $app->db->queryAllRecords("SELECT client_id FROM client WHERE 1");
+		if(!$result) {
+			return false;
+		}
+		foreach( $result as $record) {
+			$rarrary[] = $record['client_id'];
+		}
+		return $rarrary;
 	}
 
-    /**
-     * Changes client password
-     * 
-  	 * @param	int		session id
-  	 * @param	int		client	id
-  	 * @param	string	new password
-  	 * @return	bool	true if success 
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-     * 
-     */
-    public function client_change_password($session_id, $client_id, $new_password) {
-        global $app;
-
-        if(!$this->checkPerm($session_id, 'client_change_password')) {
+	/**
+	 * Changes client password
+	 *
+	 * @param int  session id
+	 * @param int  client id
+	 * @param string new password
+	 * @return bool true if success
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 *
+	 */
+	public function client_change_password($session_id, $client_id, $new_password) {
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'client_change_password')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }
-        $client_id = $app->functions->intval($client_id);
-        $client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id);
-        if($client['client_id'] > 0) {
-            $new_password = $app->db->quote($new_password);
-            $sql = "UPDATE client SET password = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
-            $app->db->query($sql);            
-            $sql = "UPDATE sys_user SET passwort = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
-            $app->db->query($sql);            
-            return true;
-        } else {
+			return false;
+		}
+		$client_id = $app->functions->intval($client_id);
+		$client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id);
+		if($client['client_id'] > 0) {
+			$new_password = $app->db->quote($new_password);
+			$sql = "UPDATE client SET password = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
+			$app->db->query($sql);
+			$sql = "UPDATE sys_user SET passwort = md5('".($new_password)."') 	WHERE client_id = ".$client_id;
+			$app->db->query($sql);
+			return true;
+		} else {
 			throw new SoapFault('no_client_found', 'There is no user account for this client_id');
 			return false;
-        }
-    }
+		}
+	}
 
 	/**
-	 * 	Get all client templates
-	 *	@param 	int		session id
-	 *	@author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 *  Get all client templates
+	 * @param  int  session id
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
 	public function client_templates_get_all($session_id) {
 		global $app;
 		if(!$this->checkPerm($session_id, 'client_templates_get_all')) {
-			 throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $sql    = "SELECT * FROM client_template";
+		$sql    = "SELECT * FROM client_template";
 		$result = $app->db->queryAllRecords($sql);
-        return $result;
-   }
+		return $result;
+	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/dns.inc.php b/interface/lib/classes/remote.d/dns.inc.php
index 9e64ab8cbed541887a89e51555757cca6961f964..1e9526a12faf52db8bb00192e9655794021a886e 100644
--- a/interface/lib/classes/remote.d/dns.inc.php
+++ b/interface/lib/classes/remote.d/dns.inc.php
@@ -40,41 +40,41 @@ by Marius Cramer <m.cramer@pixcept.de>
 
 class remoting_dns extends remoting {
 	// DNS Function --------------------------------------------------------------------------------------------------
-	
+
 	//* Create Zone with Template
 	public function dns_templatezone_add($session_id, $client_id, $template_id, $domain, $ip, $ns1, $ns2, $email)
-    {
-        global $app, $conf;
+	{
+		global $app, $conf;
 		if(!$this->checkPerm($session_id, 'dns_templatezone_add')) {
-        	throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
 
 		$client = $app->db->queryOneRecord("SELECT default_dnsserver FROM client WHERE client_id = ".$app->functions->intval($client_id));
 		$server_id = $client["default_dnsserver"];
 		$template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'");
-		$fields = explode(',',$template_record['fields']);
+		$fields = explode(',', $template_record['fields']);
 		$tform_def_file = "../../web/dns/form/dns_soa.tform.php";
 		$app->uses('tform');
 		$app->tform->loadFormDef($tform_def_file);
 		$app->uses('tpl,validate_dns');
-		
+
 		//* replace template placeholders
 		$tpl_content = $template_record['template'];
-		if($domain != '') $tpl_content = str_replace('{DOMAIN}',$domain,$tpl_content);
-		if($ip != '') $tpl_content = str_replace('{IP}',$ip,$tpl_content);
-		if($ns1 != '') $tpl_content = str_replace('{NS1}',$ns1,$tpl_content);
-		if($ns2 != '') $tpl_content = str_replace('{NS2}',$ns2,$tpl_content);
-		if($email != '') $tpl_content = str_replace('{EMAIL}',$email,$tpl_content);
-		
+		if($domain != '') $tpl_content = str_replace('{DOMAIN}', $domain, $tpl_content);
+		if($ip != '') $tpl_content = str_replace('{IP}', $ip, $tpl_content);
+		if($ns1 != '') $tpl_content = str_replace('{NS1}', $ns1, $tpl_content);
+		if($ns2 != '') $tpl_content = str_replace('{NS2}', $ns2, $tpl_content);
+		if($email != '') $tpl_content = str_replace('{EMAIL}', $email, $tpl_content);
+
 		//* Parse the template
-		$tpl_rows = explode("\n",$tpl_content);
+		$tpl_rows = explode("\n", $tpl_content);
 		$section = '';
 		$vars = array();
 		$dns_rr = array();
 		foreach($tpl_rows as $row) {
 			$row = trim($row);
-			if(substr($row,0,1) == '[') {
+			if(substr($row, 0, 1) == '[') {
 				if($row == '[ZONE]') {
 					$section = 'zone';
 				} elseif($row == '[DNS_RECORDS]') {
@@ -86,14 +86,14 @@ class remoting_dns extends remoting {
 				if($row != '') {
 					//* Handle zone section
 					if($section == 'zone') {
-						$parts = explode('=',$row);
+						$parts = explode('=', $row);
 						$key = trim($parts[0]);
 						$val = trim($parts[1]);
 						if($key != '') $vars[$key] = $val;
 					}
 					//* Handle DNS Record rows
 					if($section == 'dns_records') {
-						$parts = explode('|',$row);
+						$parts = explode('|', $row);
 						$dns_rr[] = array(
 							'name' => $app->db->quote($parts[1]),
 							'type' => $app->db->quote($parts[0]),
@@ -103,9 +103,9 @@ class remoting_dns extends remoting {
 						);
 					}
 				}
-			}		
+			}
 		} // end foreach
-		
+
 		if($vars['origin'] == '') $error .= $app->lng('error_origin_empty').'<br />';
 		if($vars['ns'] == '') $error .= $app->lng('error_ns_empty').'<br />';
 		if($vars['mbox'] == '') $error .= $app->lng('error_mbox_empty').'<br />';
@@ -113,8 +113,8 @@ class remoting_dns extends remoting {
 		if($vars['retry'] == '') $error .= $app->lng('error_retry_empty').'<br />';
 		if($vars['expire'] == '') $error .= $app->lng('error_expire_empty').'<br />';
 		if($vars['minimum'] == '') $error .= $app->lng('error_minimum_empty').'<br />';
-		if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';	
-		
+		if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';
+
 		if($error == '') {
 			// Insert the soa record
 			$tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ".$app->functions->intval($client_id));
@@ -123,7 +123,7 @@ class remoting_dns extends remoting {
 			unset($tmp);
 			$origin = $app->db->quote($vars['origin']);
 			$ns = $app->db->quote($vars['ns']);
-			$mbox = $app->db->quote(str_replace('@','.',$vars['mbox']));
+			$mbox = $app->db->quote(str_replace('@', '.', $vars['mbox']));
 			$refresh = $app->db->quote($vars['refresh']);
 			$retry = $app->db->quote($vars['retry']);
 			$expire = $app->db->quote($vars['expire']);
@@ -132,14 +132,14 @@ class remoting_dns extends remoting {
 			$xfer = $app->db->quote($vars['xfer']);
 			$also_notify = $app->db->quote($vars['also_notify']);
 			$update_acl = $app->db->quote($vars['update_acl']);
-			$serial = $app->validate_dns->increase_serial(0);		
-			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES 
+			$serial = $app->validate_dns->increase_serial(0);
+			$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES
 			('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer', '$also_notify', '$update_acl')";
-			$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');	
+			$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
 			// Insert the dns_rr records
 			if(is_array($dns_rr) && $dns_soa_id > 0) {
 				foreach($dns_rr as $rr) {
-					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 					('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$rr[name]', '$rr[type]', '$rr[data]', '$rr[aux]', '$rr[ttl]', 'Y')";
 					$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 				}
@@ -149,13 +149,13 @@ class remoting_dns extends remoting {
 			throw new SoapFault('permission_denied', $error);
 		}
 	}
-	
-	
+
+
 	//* Get record details
 	public function dns_zone_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_zone_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -164,70 +164,70 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-    
-    //* Get record id by origin
-    public function dns_zone_get_id($session_id, $origin)
-    {
-        global $app;
-        
-        if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
-            throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }
-        
-        if(!preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)){
-            throw new SoapFault('no_domain_found', 'Invalid domain name.');
-            return false;
-        }
-
-        $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin."%'");
-        if(isset($rec['id'])) {
-            return $app->functions->intval($rec['id']);
-        } else {
-            throw new SoapFault('no_domain_found', 'There is no domain ID with informed domain name.');
-            return false;
-        }
-    }
-	
+
+	//* Get record id by origin
+	public function dns_zone_get_id($session_id, $origin)
+	{
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+
+		if(!preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)){
+			throw new SoapFault('no_domain_found', 'Invalid domain name.');
+			return false;
+		}
+
+		$rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin."%'");
+		if(isset($rec['id'])) {
+			return $app->functions->intval($rec['id']);
+		} else {
+			throw new SoapFault('no_domain_found', 'There is no domain ID with informed domain name.');
+			return false;
+		}
+	}
+
 	//* Add a record
 	public function dns_zone_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_zone_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_soa.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_soa.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_zone_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_zone_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_soa.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_zone_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_zone_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_soa.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_aaaa_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_aaaa_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -236,46 +236,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_aaaa.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_aaaa_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_aaaa_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_aaaa.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_aaaa.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_aaaa_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_aaaa_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_aaaa.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_aaaa_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_aaaa_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_aaaa.tform.php', $primary_id);
 		return $affected_rows;
 	}
 
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_a_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_a_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -284,46 +284,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_a.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_a_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_a_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_a.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_a.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_a_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_a_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_a.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_a_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_a_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_a.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_alias_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_alias_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -332,46 +332,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_alias.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_alias_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_alias_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_alias.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_alias.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_alias_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_alias_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_alias.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_alias_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_alias_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_alias.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_cname_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_cname_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -380,46 +380,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_cname.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_cname_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_cname_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_cname.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_cname.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_cname_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_cname_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_cname.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_cname_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_cname_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_cname.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_hinfo_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_hinfo_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -428,46 +428,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_hinfo.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_hinfo_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_hinfo_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_hinfo.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_hinfo.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_hinfo_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_hinfo_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_hinfo.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_hinfo_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_hinfo_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_hinfo.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_mx_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_mx_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -476,46 +476,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_mx.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_mx_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_mx_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_mx.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_mx.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_mx_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_mx_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_mx.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_mx_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_mx_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_mx.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_ns_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_ns_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -524,46 +524,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_ns.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_ns_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ns_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_ns.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_ns.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_ns_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ns_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_ns.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_ns_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ns_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_ns.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_ptr_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_ptr_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -572,46 +572,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_ptr.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_ptr_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ptr_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_ptr.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_ptr.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_ptr_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ptr_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_ptr.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_ptr_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_ptr_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_ptr.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_rp_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_rp_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -620,46 +620,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_rp.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_rp_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_rp_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_rp.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_rp.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_rp_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_rp_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_rp.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_rp_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_rp_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_rp.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_srv_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_srv_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -668,46 +668,46 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_srv.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_srv_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_srv_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_srv.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_srv.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_srv_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_srv_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_srv.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_srv_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_srv_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_srv.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function dns_txt_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'dns_txt_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -716,105 +716,109 @@ class remoting_dns extends remoting {
 		$app->remoting_lib->loadFormDef('../dns/form/dns_txt.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function dns_txt_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_txt_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../dns/form/dns_txt.tform.php',$client_id,$params);
+		return $this->insertQuery('../dns/form/dns_txt.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function dns_txt_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_txt_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../dns/form/dns_txt.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function dns_txt_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'dns_txt_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../dns/form/dns_txt.tform.php', $primary_id);
 		return $affected_rows;
 	}
 
 	/**
-	 * Get all DNS zone by user 
-	 *@author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-	 */	 
-    public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'dns_zone_get')) {
-			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }        
-        if (!empty($client_id) && !empty($server_id)) {
-        	$server_id      = $app->functions->intval($server_id);
-        	$client_id      = $app->functions->intval($client_id);
-    	    $sql            = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
-        	$result         = $app->db->queryAllRecords($sql);
-        	return          $result;
-        }
-        return false;
-    }
-    
+	 * Get all DNS zone by user
+	 *@author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+
+
+	public function dns_zone_get_by_user($session_id, $client_id, $server_id) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'dns_zone_get')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if (!empty($client_id) && !empty($server_id)) {
+			$server_id      = $app->functions->intval($server_id);
+			$client_id      = $app->functions->intval($client_id);
+			$sql            = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id";
+			$result         = $app->db->queryAllRecords($sql);
+			return          $result;
+		}
+		return false;
+	}
+
+
+
 	/**
-	 * 	Get all dns records for a zone
-	 *	@param 	int		session id
-	 *	@param 	int		dns zone id
-	 *	@author	Sebastian Mogilowski <sebastian@mogilowski.net> 2011
+	 *  Get all dns records for a zone
+	 * @param  int  session id
+	 * @param  int  dns zone id
+	 * @author Sebastian Mogilowski <sebastian@mogilowski.net> 2011
 	 */
 	public function dns_rr_get_all_by_zone($session_id, $zone_id) {
 		global $app;
 		if(!$this->checkPerm($session_id, 'dns_zone_get')) {
-			 throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $sql    = "SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($zone_id);;
+		$sql    = "SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($zone_id);;
 		$result = $app->db->queryAllRecords($sql);
-        return $result;
-   }
+		return $result;
+	}
 
 	/**
-	 * Changes DNS zone status 
-	 *	@param 	int		session id
-	 *	@param	int		dns soa id
-	 *	@param	string	status active or inactive string
-	 *	@author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * Changes DNS zone status
+	 * @param  int  session id
+	 * @param int  dns soa id
+	 * @param string status active or inactive string
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
-	 
-    public function dns_zone_set_status($session_id, $primary_id, $status) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'dns_zone_set_status')) {
-              throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-               return false;
-        }        
-        if(in_array($status, array('active', 'inactive'))) {	    	        	
-	    	if ($status == 'active') {
-	    		$status = 'Y';
-	    	} else {
-	    		$status = 'N';
-	    	}
-	        $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".$app->functions->intval($primary_id);
-	        $app->db->query($sql);
-	        $result = $app->db->affectedRows();
-	        return $result;
-        } else {
+	public function dns_zone_set_status($session_id, $primary_id, $status) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'dns_zone_set_status')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(in_array($status, array('active', 'inactive'))) {
+			if ($status == 'active') {
+				$status = 'Y';
+			} else {
+				$status = 'N';
+			}
+			$sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".$app->functions->intval($primary_id);
+			$app->db->query($sql);
+			$result = $app->db->affectedRows();
+			return $result;
+		} else {
 			throw new SoapFault('status_undefined', 'The status is not available');
 			return false;
-        }  
-    }
+		}
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/domains.inc.php b/interface/lib/classes/remote.d/domains.inc.php
index 2afe8153dcbfbbfe0c1a7d3c66a2f41342acc35c..9bba710023f6d311b7a18673ba731e072d957c11 100644
--- a/interface/lib/classes/remote.d/domains.inc.php
+++ b/interface/lib/classes/remote.d/domains.inc.php
@@ -40,12 +40,12 @@ by Marius Cramer <m.cramer@pixcept.de>
 
 class remoting_domains extends remoting {
 	// -----------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function domains_domain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'domains_domain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -57,40 +57,40 @@ class remoting_domains extends remoting {
 
 	//* Add a record
 	public function domains_domain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'domains_domain_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../client/form/domain.tform.php',$client_id,$params);
+		return $this->insertQuery('../client/form/domain.tform.php', $client_id, $params);
 	}
 
 	//* Delete a record
 	public function domains_domain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'domains_domain_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../client/form/domain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../client/form/domain.tform.php', $primary_id);
 		return $affected_rows;
 	}
 
-// -----------------------------------------------------------------------------------------------
+	// -----------------------------------------------------------------------------------------------
 
 	public function domains_get_all_by_user($session_id, $group_id)
-    {
-        global $app;
+	{
+		global $app;
 		if(!$this->checkPerm($session_id, 'domains_get_all_by_user')) {
-        	throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $group_id = $app->functions->intval($group_id);
-        $sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid  = $group_id ";
-        $all = $app->db->queryAllRecords($sql);
-        return $all;
+		$group_id = $app->functions->intval($group_id);
+		$sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid  = $group_id ";
+		$all = $app->db->queryAllRecords($sql);
+		return $all;
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php
index 5370c04a419b7ea25b8beae9e6be65c7f4c383ec..7adaf1fa743c5e70ecaa03f6796d698bae3eb587 100644
--- a/interface/lib/classes/remote.d/mail.inc.php
+++ b/interface/lib/classes/remote.d/mail.inc.php
@@ -41,9 +41,9 @@ by Marius Cramer <m.cramer@pixcept.de>
 class remoting_mail extends remoting {
 	//* Get mail domain details
 	public function mail_domain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_domain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -52,21 +52,21 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_domain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a mail domain
 	public function mail_domain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_domain_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php',$client_id,$params);
+		$primary_id = $this->insertQuery('../mail/form/mail_domain.tform.php', $client_id, $params);
 		return $primary_id;
 	}
-	
+
 	//* Update a mail domain
 	public function mail_domain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_domain_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -74,10 +74,10 @@ class remoting_mail extends remoting {
 		$affected_rows = $this->updateQuery('../mail/form/mail_domain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a mail domain
 	public function mail_domain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_domain_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -85,12 +85,12 @@ class remoting_mail extends remoting {
 		$affected_rows = $this->deleteQuery('../mail/form/mail_domain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get alias details
 	public function mail_aliasdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_aliasdomain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -99,13 +99,13 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_aliasdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* aliasy email
 	public function mail_aliasdomain_add($session_id, $client_id, $params)
 	{
 		if (!$this->checkPerm($session_id, 'mail_aliasdomain_add'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$affected_rows = $this->insertQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $params);
@@ -115,31 +115,31 @@ class remoting_mail extends remoting {
 
 	public function mail_aliasdomain_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_aliasdomain_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_aliasdomain_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_aliasdomain.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 	public function mail_aliasdomain_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_aliasdomain_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_aliasdomain.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_aliasdomain_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_aliasdomain.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get mail mailinglist details
 	public function mail_mailinglist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -148,21 +148,21 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_mailinglist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a mail mailinglist
 	public function mail_mailinglist_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php',$client_id,$params);
+		$primary_id = $this->insertQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $params);
 		return $primary_id;
 	}
-	
+
 	//* Update a mail mailinglist
 	public function mail_mailinglist_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -170,10 +170,10 @@ class remoting_mail extends remoting {
 		$affected_rows = $this->updateQuery('../mail/form/mail_mailinglist.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a mail mailinglist
 	public function mail_mailinglist_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'mail_mailinglist_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -181,12 +181,12 @@ class remoting_mail extends remoting {
 		$affected_rows = $this->deleteQuery('../mail/form/mail_mailinglist.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get mail user details
 	public function mail_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_user_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -195,70 +195,70 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
-	
+
+
 	//* Add mail domain
 	public function mail_user_add($session_id, $client_id, $params){
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_user_add')){
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check if mail domain exists
-		$email_parts = explode('@',$params['email']);
+		$email_parts = explode('@', $params['email']);
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'");
 		if($tmp['domain'] != $email_parts[1]) {
-			throw new SoapFault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.');
+			throw new SoapFault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
 			return false;
 		}
-		
+
 		$affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params);
 		return $affected_rows;
 	}
 
-	//* Update mail user	
+	//* Update mail user
 	public function mail_user_update($session_id, $client_id, $primary_id, $params)
 	{
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_user_update'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check if mail domain exists
-		$email_parts = explode('@',$params['email']);
+		$email_parts = explode('@', $params['email']);
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'");
 		if($tmp['domain'] != $email_parts[1]) {
-			throw new SoapFault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.');
+			throw new SoapFault('mail_domain_does_not_exist', 'Mail domain - '.$email_parts[1].' - does not exist.');
 			return false;
 		}
-		
+
 		$affected_rows = $this->updateQuery('../mail/form/mail_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
 
-	
+
 	//* Delete mail user
 	public function mail_user_delete($session_id, $primary_id)
 	{
 		if (!$this->checkPerm($session_id, 'mail_user_delete'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$affected_rows = $this->deleteQuery('../mail/form/mail_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get mail user filter details
 	public function mail_user_filter_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_user_filter_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -267,15 +267,15 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_user_filter.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	public function mail_user_filter_add($session_id, $client_id, $params)
 	{
 		global $app;
 		if (!$this->checkPerm($session_id, 'mail_user_filter_add')){
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params,'mail:mail_user_filter:on_after_insert');
+		$affected_rows = $this->insertQuery('../mail/form/mail_user_filter.tform.php', $client_id, $params, 'mail:mail_user_filter:on_after_insert');
 		// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_insert',$this);
 		return $affected_rows;
 	}
@@ -285,10 +285,10 @@ class remoting_mail extends remoting {
 		global $app;
 		if (!$this->checkPerm($session_id, 'mail_user_filter_update'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params,'mail:mail_user_filter:on_after_update');
+		$affected_rows = $this->updateQuery('../mail/form/mail_user_filter.tform.php', $client_id, $primary_id, $params, 'mail:mail_user_filter:on_after_update');
 		// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_update',$this);
 		return $affected_rows;
 	}
@@ -298,19 +298,19 @@ class remoting_mail extends remoting {
 		global $app;
 		if (!$this->checkPerm($session_id, 'mail_user_filter_delete'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id,'mail:mail_user_filter:on_after_delete');
+		$affected_rows = $this->deleteQuery('../mail/form/mail_user_filter.tform.php', $primary_id, 'mail:mail_user_filter:on_after_delete');
 		// $app->plugin->raiseEvent('mail:mail_user_filter:on_after_delete',$this);
 		return $affected_rows;
 	}
 
 	//* Get alias details
 	public function mail_alias_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_alias_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -319,25 +319,25 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_alias.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* aliasy email
 	public function mail_alias_add($session_id, $client_id, $params)
 	{
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_alias_add'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
 		if($tmp['number'] > 0) {
-			throw new SoapFault('duplicate','There is already a mailbox with this email address.');
+			throw new SoapFault('duplicate', 'There is already a mailbox with this email address.');
 		}
 		unset($tmp);
-		
+
 		$affected_rows = $this->insertQuery('../mail/form/mail_alias.tform.php', $client_id, $params);
 		return $affected_rows;
 	}
@@ -346,40 +346,40 @@ class remoting_mail extends remoting {
 	public function mail_alias_update($session_id, $client_id, $primary_id, $params)
 	{
 		global $app;
-		
+
 		if (!$this->checkPerm($session_id, 'mail_alias_update'))
 		{
-			throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-			
-			//* Check if there is no active mailbox with this address
+
+		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($params["source"])."'");
 		if($tmp['number'] > 0) {
-			throw new SoapFault('duplicate','There is already a mailbox with this email address.');
+			throw new SoapFault('duplicate', 'There is already a mailbox with this email address.');
 		}
 		unset($tmp);
-			
+
 		$affected_rows = $this->updateQuery('../mail/form/mail_alias.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
 
 	public function mail_alias_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_alias_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_alias_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_alias.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get mail forwarding details
 	public function mail_forward_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_forward_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -388,48 +388,48 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_forward.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
- 	//* przekierowania email
+
+	//* przekierowania email
 	public function mail_forward_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_forward_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_forward_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_forward.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_forward_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_forward_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_forward_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_forward.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_forward_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_forward_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_forward_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_forward.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get catchall details
 	public function mail_catchall_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_catchall_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -440,44 +440,44 @@ class remoting_mail extends remoting {
 	}
 
 	//* catchall e-mail
- 	public function mail_catchall_add($session_id, $client_id, $params)
+	public function mail_catchall_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_catchall_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_catchall_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 	public function mail_catchall_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_catchall_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_catchall_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_domain_catchall.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 	public function mail_catchall_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_catchall_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_catchall_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_domain_catchall.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get transport details
 	public function mail_transport_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_transport_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -486,48 +486,48 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_transport.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* przeniesienia e-mail
 	public function mail_transport_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_transport_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_transport_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_transport.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_transport_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_transport_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_transport_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_transport.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_transport_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_transport_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_transport_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_transport.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get spamfilter whitelist details
 	public function mail_spamfilter_whitelist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -537,47 +537,47 @@ class remoting_mail extends remoting {
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
 
- 	//* biała lista e-mail
+	//* biała lista e-mail
 	public function mail_spamfilter_whitelist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_whitelist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_whitelist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_whitelist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_whitelist_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_whitelist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get spamfilter blacklist details
 	public function mail_spamfilter_blacklist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -586,48 +586,48 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/spamfilter_blacklist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
- 	//* czarna lista e-mail
+
+	//* czarna lista e-mail
 	public function mail_spamfilter_blacklist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_blacklist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_blacklist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_blacklist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_blacklist_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_blacklist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get spamfilter user details
 	public function mail_spamfilter_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_spamfilter_user_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -640,44 +640,44 @@ class remoting_mail extends remoting {
 	//* filtr spamu użytkowników e-mail
 	public function mail_spamfilter_user_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_user_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_users.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_user_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_user_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_users.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_spamfilter_user_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_spamfilter_user_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_users.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get policy details
 	public function mail_policy_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_policy_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -686,48 +686,48 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/spamfilter_policy.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
- 	//* polityki filtrów spamu e-mail
+
+	//* polityki filtrów spamu e-mail
 	public function mail_policy_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_policy_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_policy_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_policy_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_policy_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_policy_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/spamfilter_policy.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_policy_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_policy_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_policy_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/spamfilter_policy.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get fetchmail details
 	public function mail_fetchmail_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_fetchmail_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -737,47 +737,47 @@ class remoting_mail extends remoting {
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
 
-	 //* fetchmail
+	//* fetchmail
 	public function mail_fetchmail_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_fetchmail_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_fetchmail_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_get.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_fetchmail_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_fetchmail_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_fetchmail_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_get.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_fetchmail_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_fetchmail_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_fetchmail_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_get.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get whitelist details
 	public function mail_whitelist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_whitelist_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -786,48 +786,48 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_whitelist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* wpisy białej listy
 	public function mail_whitelist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_whitelist_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_whitelist_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_whitelist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_whitelist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_whitelist_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_whitelist_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_whitelist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_whitelist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_whitelist_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_whitelist_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_whitelist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get Blacklist details
 	public function mail_blacklist_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_blacklist_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -836,48 +836,48 @@ class remoting_mail extends remoting {
 		$app->remoting_lib->loadFormDef('../mail/form/mail_blacklist.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* wpisy białej listy
 	public function mail_blacklist_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_blacklist_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_blacklist_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_blacklist.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_blacklist_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_blacklist_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_blacklist_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_blacklist.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_blacklist_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_blacklist_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_blacklist_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_blacklist.tform.php', $primary_id);
+		return $affected_rows;
 	}
-	
+
 	//* Get filter details
 	public function mail_filter_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'mail_filter_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -890,84 +890,86 @@ class remoting_mail extends remoting {
 	//* wpisy filtrow e-mail
 	public function mail_filter_add($session_id, $client_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_filter_add'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_filter_add'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_filter_update($session_id, $client_id, $primary_id, $params)
 	{
-			if (!$this->checkPerm($session_id, 'mail_filter_update'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_filter_update'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params);
+		return $affected_rows;
 	}
 
 
 	public function mail_filter_delete($session_id, $primary_id)
 	{
-			if (!$this->checkPerm($session_id, 'mail_filter_delete'))
-			{
-					throw new SoapFault('permission_denied','You do not have the permissions to access this function.');
-					return false;
-			}
-			$affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id);
-			return $affected_rows;
+		if (!$this->checkPerm($session_id, 'mail_filter_delete'))
+		{
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id);
+		return $affected_rows;
 	}
 
-    /**
-    * Fetch the mail_domain record for the provided domain.
-    * @param int session_id
-    * @param string the fully qualified domain (or subdomain)
-    * @return array array of arrays corresponding to the mail_domain table's records
-    * @author till, benlake
-    */
+	/**
+	 * Fetch the mail_domain record for the provided domain.
+	 * @param int session_id
+	 * @param string the fully qualified domain (or subdomain)
+	 * @return array array of arrays corresponding to the mail_domain table's records
+	 * @author till, benlake
+	 */
+
+
 	public function mail_domain_get_by_domain($session_id, $domain) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
-			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }        
-        if (!empty($domain)) {
-        	$domain      	= $app->db->quote($domain);        	
-    	    $sql            = "SELECT * FROM mail_domain WHERE domain = '$domain'";
-        	$result         = $app->db->queryAllRecords($sql);
-        	return          $result;
-        }
-        return false;
-    }
-
-    public function mail_domain_set_status($session_id, $primary_id, $status) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
-              throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-               return false;
-        }        
-        if(in_array($status, array('active', 'inactive'))) {	    	        	
-	    	if ($status == 'active') {
-	    		$status = 'y';
-	    	} else {
-	    		$status = 'n';
-	    	}
-	        $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
-	        $app->db->query($sql);
-	        $result = $app->db->affectedRows();
-	        return $result;
-        } else {
+		global $app;
+		if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if (!empty($domain)) {
+			$domain       = $app->db->quote($domain);
+			$sql            = "SELECT * FROM mail_domain WHERE domain = '$domain'";
+			$result         = $app->db->queryAllRecords($sql);
+			return          $result;
+		}
+		return false;
+	}
+
+	public function mail_domain_set_status($session_id, $primary_id, $status) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(in_array($status, array('active', 'inactive'))) {
+			if ($status == 'active') {
+				$status = 'y';
+			} else {
+				$status = 'n';
+			}
+			$sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
+			$app->db->query($sql);
+			$result = $app->db->affectedRows();
+			return $result;
+		} else {
 			throw new SoapFault('status_undefined', 'The status is not available');
 			return false;
-        }  
-    }
-	
+		}
+	}
+
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/openvz.inc.php b/interface/lib/classes/remote.d/openvz.inc.php
index 1a18791831ae5ec61107c3f1ae01d6fa761a74fb..4a087ccbc7e2d2c3df231d943869211fccbee439 100644
--- a/interface/lib/classes/remote.d/openvz.inc.php
+++ b/interface/lib/classes/remote.d/openvz.inc.php
@@ -40,12 +40,12 @@ by Marius Cramer <m.cramer@pixcept.de>
 
 class remoting_openvz extends remoting {
 	//* Functions for virtual machine management
-	
+
 	//* Get OpenVZ OStemplate details
 	public function openvz_ostemplate_get($session_id, $ostemplate_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -54,44 +54,44 @@ class remoting_openvz extends remoting {
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_ostemplate.tform.php');
 		return $app->remoting_lib->getDataRecord($ostemplate_id);
 	}
-	
+
 	//* Add a openvz ostemplate record
 	public function openvz_ostemplate_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_ostemplate.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update openvz ostemplate record
 	public function openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_ostemplate.tform.php',$client_id,$ostemplate_id,$params);
+		$affected_rows = $this->updateQuery('../vm/form/openvz_ostemplate.tform.php', $client_id, $ostemplate_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz ostemplate record
 	public function openvz_ostemplate_delete($session_id, $ostemplate_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_ostemplate.tform.php',$ostemplate_id);
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_ostemplate.tform.php', $ostemplate_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get OpenVZ template details
 	public function openvz_template_get($session_id, $template_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -100,44 +100,44 @@ class remoting_openvz extends remoting {
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_template.tform.php');
 		return $app->remoting_lib->getDataRecord($template_id);
 	}
-	
+
 	//* Add a openvz template record
 	public function openvz_template_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_template.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_template.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update openvz template record
 	public function openvz_template_update($session_id, $client_id, $template_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_template.tform.php',$client_id,$template_id,$params);
+		$affected_rows = $this->updateQuery('../vm/form/openvz_template.tform.php', $client_id, $template_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz template record
 	public function openvz_template_delete($session_id, $template_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_template.tform.php',$template_id);
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_template.tform.php', $template_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get OpenVZ ip details
 	public function openvz_ip_get($session_id, $ip_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -146,68 +146,68 @@ class remoting_openvz extends remoting {
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_ip.tform.php');
 		return $app->remoting_lib->getDataRecord($ip_id);
 	}
-	
+
 	//* Get OpenVZ a free IP address
 	public function openvz_get_free_ip($session_id, $server_id = 0)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$server_id = $app->functions->intval($server_id);
-		
+
 		if($server_id > 0) {
 			$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = $server_id LIMIT 0,1");
 		} else {
 			$tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 LIMIT 0,1");
 		}
-		
+
 		if(count($tmp) > 0) {
 			return $tmp;
 		} else {
 			throw new SoapFault('no_free_ip', 'There is no free IP available.');
 		}
 	}
-	
+
 	//* Add a openvz ip record
 	public function openvz_ip_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_ip.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_ip.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update openvz ip record
 	public function openvz_ip_update($session_id, $client_id, $ip_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_ip.tform.php',$client_id,$ip_id,$params);
+		$affected_rows = $this->updateQuery('../vm/form/openvz_ip.tform.php', $client_id, $ip_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz ip record
 	public function openvz_ip_delete($session_id, $ip_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_ip.tform.php',$ip_id);
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_ip.tform.php', $ip_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get OpenVZ vm details
 	public function openvz_vm_get($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -216,51 +216,51 @@ class remoting_openvz extends remoting {
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		return $app->remoting_lib->getDataRecord($vm_id);
 	}
-	
+
 	//* Get OpenVZ list
 	public function openvz_vm_get_by_client($session_id, $client_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		if (!empty($client_id)) {
-        	$client_id      = $app->functions->intval($client_id);
-			$tmp 			= $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-    	    $sql            = "SELECT * FROM openvz_vm WHERE sys_groupid = ".$app->functions->intval($tmp['groupid']);
-        	$result         = $app->db->queryAllRecords($sql);
-        	return          $result;
-        }
-        return false;
+			$client_id      = $app->functions->intval($client_id);
+			$tmp    = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
+			$sql            = "SELECT * FROM openvz_vm WHERE sys_groupid = ".$app->functions->intval($tmp['groupid']);
+			$result         = $app->db->queryAllRecords($sql);
+			return          $result;
+		}
+		return false;
 	}
-	
+
 	//* Add a openvz vm record
 	public function openvz_vm_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../vm/form/openvz_vm.tform.php',$client_id,$params);
+		return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params);
 	}
-	
+
 	//* Add a openvz vm record from template
 	public function openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $override_params = array())
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
-		
+
+
 		$template_id = $app->functions->intval($template_id);
 		$ostemplate_id = $app->functions->intval($ostemplate_id);
-		
+
 		//* Verify parameters
 		if($template_id == 0) {
 			throw new SoapFault('template_id_error', 'Template ID must be > 0.');
@@ -270,7 +270,7 @@ class remoting_openvz extends remoting {
 			throw new SoapFault('ostemplate_id_error', 'OSTemplate ID must be > 0.');
 			return false;
 		}
-		
+
 		// Verify if template and ostemplate exist
 		$tmp = $app->db->queryOneRecord("SELECT template_id FROM openvz_template WHERE template_id = $template_id");
 		if(!is_array($tmp)) {
@@ -282,10 +282,10 @@ class remoting_openvz extends remoting {
 			throw new SoapFault('ostemplate_id_error', 'OSTemplate does not exist.');
 			return false;
 		}
-		
+
 		//* Get the template
 		$vtpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = $template_id");
-		
+
 		//* Get the IP address and server_id
 		if($override_params['server_id'] > 0) {
 			$vmip = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = ".$override_params['server_id']." LIMIT 0,1");
@@ -296,7 +296,7 @@ class remoting_openvz extends remoting {
 			throw new SoapFault('vm_ip_error', 'Unable to get a free VM IP.');
 			return false;
 		}
-		
+
 		//* Build the $params array
 		$params = array();
 		$params['server_id'] = $vmip['server_id'];
@@ -309,8 +309,8 @@ class remoting_openvz extends remoting {
 		$params['active'] = (isset($override_params['active']))?$override_params['active']:'y';
 		$params['active_until_date'] = (isset($override_params['active_until_date']))?$override_params['active_until_date']:'0000-00-00';
 		$params['description'] = (isset($override_params['description']))?$override_params['description']:'';
-		
-		//* The next params get filled with pseudo values, as the get replaced 
+
+		//* The next params get filled with pseudo values, as the get replaced
 		//* by the openvz event plugin anyway with values from the template
 		$params['veid'] = 1;
 		$params['diskspace'] = 1;
@@ -323,178 +323,179 @@ class remoting_openvz extends remoting {
 		$params['nameserver'] = '8.8.8.8 8.8.4.4';
 		$params['create_dns'] = 'n';
 		$params['capability'] = '';
-		
-		return $this->insertQuery('../vm/form/openvz_vm.tform.php',$client_id,$params,'vm:openvz_vm:on_after_insert');
+
+		return $this->insertQuery('../vm/form/openvz_vm.tform.php', $client_id, $params, 'vm:openvz_vm:on_after_insert');
 	}
-	
+
 	//* Update openvz vm record
 	public function openvz_vm_update($session_id, $client_id, $vm_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../vm/form/openvz_vm.tform.php',$client_id,$vm_id,$params,'vm:openvz_vm:on_after_update');
+		$affected_rows = $this->updateQuery('../vm/form/openvz_vm.tform.php', $client_id, $vm_id, $params, 'vm:openvz_vm:on_after_update');
 		return $affected_rows;
 	}
-	
+
 	//* Delete openvz vm record
 	public function openvz_vm_delete($session_id, $vm_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../vm/form/openvz_vm.tform.php',$vm_id,'vm:openvz_vm:on_after_delete');
+		$affected_rows = $this->deleteQuery('../vm/form/openvz_vm.tform.php', $vm_id, 'vm:openvz_vm:on_after_delete');
 		return $affected_rows;
 	}
-	
+
 	//* Start VM
 	public function openvz_vm_start($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		$vm = $app->remoting_lib->getDataRecord($vm_id);
-		
+
 		if(!is_array($vm)) {
 			throw new SoapFault('action_pending', 'No VM with this ID available.');
 			return false;
 		}
-		
+
 		if($vm['active'] == 'n') {
 			throw new SoapFault('action_pending', 'VM is not in active state.');
 			return false;
 		}
-		
+
 		$action = 'openvz_start_vm';
-		
-		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction 
-				WHERE server_id = '".$vm['server_id']."' 
+
+		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
+				WHERE server_id = '".$vm['server_id']."'
 				AND action_type = '$action'
 				AND action_param = '".$vm['veid']."'
 				AND action_state = 'pending'");
-		
+
 		if($tmp['actions'] > 0) {
 			throw new SoapFault('action_pending', 'There is already a action pending for this VM.');
 			return false;
 		} else {
 			$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-					"VALUES (".
-					(int)$vm['server_id'] . ", ".
-					time() . ", ".
-					"'".$action."', ".
-					$vm['veid'].", ".
-					"'pending', ".
-					"''".
-					")";
+				"VALUES (".
+				(int)$vm['server_id'] . ", ".
+				time() . ", ".
+				"'".$action."', ".
+				$vm['veid'].", ".
+				"'pending', ".
+				"''".
+				")";
 			$app->db->query($sql);
 		}
 	}
-	
+
 	//* Stop VM
 	public function openvz_vm_stop($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		$vm = $app->remoting_lib->getDataRecord($vm_id);
-		
+
 		if(!is_array($vm)) {
 			throw new SoapFault('action_pending', 'No VM with this ID available.');
 			return false;
 		}
-		
+
 		if($vm['active'] == 'n') {
 			throw new SoapFault('action_pending', 'VM is not in active state.');
 			return false;
 		}
-		
+
 		$action = 'openvz_stop_vm';
-		
-		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction 
-				WHERE server_id = '".$vm['server_id']."' 
+
+		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
+				WHERE server_id = '".$vm['server_id']."'
 				AND action_type = '$action'
 				AND action_param = '".$vm['veid']."'
 				AND action_state = 'pending'");
-		
+
 		if($tmp['actions'] > 0) {
 			throw new SoapFault('action_pending', 'There is already a action pending for this VM.');
 			return false;
 		} else {
 			$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-					"VALUES (".
-					(int)$vm['server_id'] . ", ".
-					time() . ", ".
-					"'".$action."', ".
-					$vm['veid'].", ".
-					"'pending', ".
-					"''".
-					")";
+				"VALUES (".
+				(int)$vm['server_id'] . ", ".
+				time() . ", ".
+				"'".$action."', ".
+				$vm['veid'].", ".
+				"'pending', ".
+				"''".
+				")";
 			$app->db->query($sql);
 		}
 	}
-	
+
 	//* Restart VM
 	public function openvz_vm_restart($session_id, $vm_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'vm_openvz')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../vm/form/openvz_vm.tform.php');
 		$vm = $app->remoting_lib->getDataRecord($vm_id);
-		
+
 		if(!is_array($vm)) {
 			throw new SoapFault('action_pending', 'No VM with this ID available.');
 			return false;
 		}
-		
+
 		if($vm['active'] == 'n') {
 			throw new SoapFault('action_pending', 'VM is not in active state.');
 			return false;
 		}
-		
+
 		$action = 'openvz_restart_vm';
-		
-		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction 
-				WHERE server_id = '".$vm['server_id']."' 
+
+		$tmp = $app->db->queryOneRecord("SELECT count(action_id) as actions FROM sys_remoteaction
+				WHERE server_id = '".$vm['server_id']."'
 				AND action_type = '$action'
 				AND action_param = '".$vm['veid']."'
 				AND action_state = 'pending'");
-		
+
 		if($tmp['actions'] > 0) {
 			throw new SoapFault('action_pending', 'There is already a action pending for this VM.');
 			return false;
 		} else {
 			$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-					"VALUES (".
-					(int)$vm['server_id'] . ", ".
-					time() . ", ".
-					"'".$action."', ".
-					$vm['veid'].", ".
-					"'pending', ".
-					"''".
-					")";
+				"VALUES (".
+				(int)$vm['server_id'] . ", ".
+				time() . ", ".
+				"'".$action."', ".
+				$vm['veid'].", ".
+				"'pending', ".
+				"''".
+				")";
 			$app->db->query($sql);
 		}
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/server.inc.php b/interface/lib/classes/remote.d/server.inc.php
index 023d1a935605334fb374c63898a4e827ee15c0c5..db21ac0f49598edf247e74fe6b82ea444792e105 100644
--- a/interface/lib/classes/remote.d/server.inc.php
+++ b/interface/lib/classes/remote.d/server.inc.php
@@ -39,57 +39,59 @@ by Marius Cramer <m.cramer@pixcept.de>
 */
 
 class remoting_server extends remoting {
-    /**
-	    Gets the server configuration
-	    @param int session id
-	    @param int server id
-	    @param string  section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
-	    @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
-    */
-	
+	/**
+	 Gets the server configuration
+	 @param int session id
+	 @param int server id
+	 @param string  section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
+	 @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+
+
 	public function server_get_serverid_by_ip($session_id, $ipaddress)
-    {
-        global $app;
+	{
+		global $app;
 		if(!$this->checkPerm($session_id, 'server_get_serverid_by_ip')) {
-        	throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $sql = "SELECT server_id FROM server_ip WHERE ip_address  = '$ipaddress' LIMIT 1 ";
-        $all = $app->db->queryAllRecords($sql);
-        return $all;
+		$sql = "SELECT server_id FROM server_ip WHERE ip_address  = '$ipaddress' LIMIT 1 ";
+		$all = $app->db->queryAllRecords($sql);
+		return $all;
 	}
-	
+
 	//* Add a IP address record
 	public function server_ip_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'server_ip_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../admin/form/server_ip.tform.php',$client_id,$params);
+		return $this->insertQuery('../admin/form/server_ip.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update IP address record
 	public function server_ip_update($session_id, $client_id, $ip_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'server_ip_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../admin/form/server_ip.tform.php',$client_id,$ip_id,$params);
+		$affected_rows = $this->updateQuery('../admin/form/server_ip.tform.php', $client_id, $ip_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete IP address record
 	public function server_ip_delete($session_id, $ip_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'server_ip_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php',$ip_id);
+		$affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php', $ip_id);
 		return $affected_rows;
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php
index 37a79ba302e55e4730057182d92876009a966dc5..a043ce118a53bd80920b1683eefabbfcbaa1c93c 100644
--- a/interface/lib/classes/remote.d/sites.inc.php
+++ b/interface/lib/classes/remote.d/sites.inc.php
@@ -40,12 +40,12 @@ by Marius Cramer <m.cramer@pixcept.de>
 
 class remoting_sites extends remoting {
 	// Website functions ---------------------------------------------------------------------------------------
-	
+
 	//* Get cron details
 	public function sites_cron_get($session_id, $cron_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_cron_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -54,46 +54,46 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/cron.tform.php');
 		return $app->remoting_lib->getDataRecord($cron_id);
 	}
-	
+
 	//* Add a cron record
 	public function sites_cron_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_cron_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/cron.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/cron.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update cron record
 	public function sites_cron_update($session_id, $client_id, $cron_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_cron_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/cron.tform.php',$client_id,$cron_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/cron.tform.php', $client_id, $cron_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete cron record
 	public function sites_cron_delete($session_id, $cron_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_cron_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/cron.tform.php',$cron_id);
+		$affected_rows = $this->deleteQuery('../sites/form/cron.tform.php', $cron_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_database_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_database_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -102,17 +102,17 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/database.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_database_add($session_id, $client_id, $params)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Check for duplicates
 		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$app->db->quote($params['database_name'])."' AND server_id = '".intval($params["server_id"])."'");
 		if($tmp['dbnum'] > 0) {
@@ -120,66 +120,66 @@ class remoting_sites extends remoting {
 			return false;
 		}
 
-        $sql = $this->insertQueryPrepare('../sites/form/database.tform.php', $client_id, $params);
-        if($sql !== false) {
-            $app->uses('sites_database_plugin');
-            
-            $this->id = 0;
-            $this->dataRecord = $params;
-            $app->sites_database_plugin->processDatabaseInsert($this);
+		$sql = $this->insertQueryPrepare('../sites/form/database.tform.php', $client_id, $params);
+		if($sql !== false) {
+			$app->uses('sites_database_plugin');
 
-            return $this->insertQueryExecute($sql, $params);
-        }
-        
-        return false;
+			$this->id = 0;
+			$this->dataRecord = $params;
+			$app->sites_database_plugin->processDatabaseInsert($this);
+
+			return $this->insertQueryExecute($sql, $params);
+		}
+
+		return false;
 	}
-	
+
 	//* Update a record
 	public function sites_database_update($session_id, $client_id, $primary_id, $params)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
+
 		$sql = $this->updateQueryPrepare('../sites/form/database.tform.php', $client_id, $primary_id, $params);
-        if($sql !== false) {
-            $app->uses('sites_database_plugin');
-            
-            $this->id = $primary_id;
-            $this->dataRecord = $params;
-            $app->sites_database_plugin->processDatabaseUpdate($this);
-            return $this->updateQueryExecute($sql, $primary_id, $params);
-        }
-        
-        return false;
-	}
-	
+		if($sql !== false) {
+			$app->uses('sites_database_plugin');
+
+			$this->id = $primary_id;
+			$this->dataRecord = $params;
+			$app->sites_database_plugin->processDatabaseUpdate($this);
+			return $this->updateQueryExecute($sql, $primary_id, $params);
+		}
+
+		return false;
+	}
+
 	//* Delete a record
 	public function sites_database_delete($session_id, $primary_id)
-    {
-        global $app;
+	{
+		global $app;
 		if(!$this->checkPerm($session_id, 'sites_database_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        $app->uses('sites_database_plugin');
-        $app->sites_database_plugin->processDatabaseDelete($primary_id);
-        
-		$affected_rows = $this->deleteQuery('../sites/form/database.tform.php',$primary_id);
+
+		$app->uses('sites_database_plugin');
+		$app->sites_database_plugin->processDatabaseDelete($primary_id);
+
+		$affected_rows = $this->deleteQuery('../sites/form/database.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_database_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_database_user_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -188,81 +188,81 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/database_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_database_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_database_user_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 
-        return $this->insertQuery('../sites/form/database_user.tform.php', $client_id, $params);
+		return $this->insertQuery('../sites/form/database_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_database_user_update($session_id, $client_id, $primary_id, $params)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_user_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
 		$app->uses('remoting_lib');
 		$app->remoting_lib->loadFormDef('../sites/form/database_user.tform.php');
-        $old_rec = $app->remoting_lib->getDataRecord($primary_id);
-        
+		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
+
 		$result = $this->updateQuery('../sites/form/database_user.tform.php', $client_id, $primary_id, $params);
-        
-        $new_rec = $app->remoting_lib->getDataRecord($primary_id);
-        
-        $records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
-        foreach($records as $rec) {
-            $tmp_rec = $new_rec;
-            $tmp_rec['server_id'] = $rec['server_id'];
-            $app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $tmp_rec);
-        }
-        unset($new_rec);
-        unset($old_rec);
-        unset($records);
-        
-        return $result;
- 	}
-	
+
+		$new_rec = $app->remoting_lib->getDataRecord($primary_id);
+
+		$records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
+		foreach($records as $rec) {
+			$tmp_rec = $new_rec;
+			$tmp_rec['server_id'] = $rec['server_id'];
+			$app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $tmp_rec);
+		}
+		unset($new_rec);
+		unset($old_rec);
+		unset($records);
+
+		return $result;
+	}
+
 	//* Delete a record
 	public function sites_database_user_delete($session_id, $primary_id)
-    {
-        global $app;
-        
+	{
+		global $app;
+
 		if(!$this->checkPerm($session_id, 'sites_database_user_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-        
-        $app->db->datalogDelete('web_database_user', 'database_user_id', $primary_id);
-		$affected_rows = $this->deleteQuery('../sites/form/database_user.tform.php',$primary_id);
-        
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_user_id=NULL','database_id', $rec['database_id']);
-            
-        }
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_ro_user_id=NULL','database_id', $rec['database_id']);
-        }
-        
+
+		$app->db->datalogDelete('web_database_user', 'database_user_id', $primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/database_user.tform.php', $primary_id);
+
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($primary_id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_user_id=NULL', 'database_id', $rec['database_id']);
+
+		}
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($primary_id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_ro_user_id=NULL', 'database_id', $rec['database_id']);
+		}
+
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_ftp_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -271,66 +271,66 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/ftp_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_ftp_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/ftp_user.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/ftp_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_ftp_user_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/ftp_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_ftp_user_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/ftp_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	//* Get server for an ftp user
 	public function sites_ftp_user_server_get($session_id, $ftp_user)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_ftp_user_server_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		$data = $app->db->queryOneRecord("SELECT server_id FROM ftp_user WHERE username = '".$app->db->quote($ftp_user)."'");
 		//file_put_contents('/tmp/test.txt', serialize($data));
-        if(!isset($data['server_id'])) return false;
-		
-        $server = $this->server_get($session_id, $data['server_id'], 'server');
-        //file_put_contents('/tmp/test2.txt', serialize($server));
-        
+		if(!isset($data['server_id'])) return false;
+
+		$server = $this->server_get($session_id, $data['server_id'], 'server');
+		//file_put_contents('/tmp/test2.txt', serialize($server));
+
 		return $server;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_shell_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_shell_user_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -339,46 +339,46 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/shell_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_shell_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_shell_user_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/shell_user.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/shell_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_shell_user_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_shell_user_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/shell_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_shell_user_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_shell_user_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/shell_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_domain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_domain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -387,7 +387,7 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/web_domain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_domain_add($session_id, $client_id, $params, $readonly = false)
 	{
@@ -396,65 +396,65 @@ class remoting_sites extends remoting {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		if(!isset($params['client_group_id']) or (isset($params['client_group_id']) && empty($params['client_group_id']))) {
 			$rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($client_id));
 			$params['client_group_id'] = $rec['groupid'];
 		}
-		
+
 		//* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
 		if($params['document_root'] == '') $params['document_root'] = '-';
 		if($params['system_user'] == '') $params['system_user'] = '-';
 		if($params['system_group'] == '') $params['system_group'] = '-';
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$domain_id = $this->insertQuery('../sites/form/web_domain.tform.php',$client_id,$params, 'sites:web_domain:on_after_insert');
+
+		$domain_id = $this->insertQuery('../sites/form/web_domain.tform.php', $client_id, $params, 'sites:web_domain:on_after_insert');
 		if ($readonly === true)
 			$app->db->query("UPDATE web_domain SET `sys_userid` = '1' WHERE domain_id = ".$domain_id);
-			return $domain_id;
-		}
-	
+		return $domain_id;
+	}
+
 	//* Update a record
 	public function sites_web_domain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_domain_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php',$client_id,$primary_id,$params);
+
+		$affected_rows = $this->updateQuery('../sites/form/web_domain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_domain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_domain_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_domain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_vhost_subdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -463,7 +463,7 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/web_vhost_subdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_vhost_subdomain_add($session_id, $client_id, $params)
 	{
@@ -472,58 +472,58 @@ class remoting_sites extends remoting {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Set a few params to "not empty" values which get overwritten by the sites_web_domain_plugin
 		if($params['document_root'] == '') $params['document_root'] = '-';
 		if($params['system_user'] == '') $params['system_user'] = '-';
 		if($params['system_group'] == '') $params['system_group'] = '-';
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$domain_id = $this->insertQuery('../sites/form/web_vhost_subdomain.tform.php',$client_id,$params, 'sites:web_vhost_subdomain:on_after_insert');
-        return $domain_id;
-    }
-	
+
+		$domain_id = $this->insertQuery('../sites/form/web_vhost_subdomain.tform.php', $client_id, $params, 'sites:web_vhost_subdomain:on_after_insert');
+		return $domain_id;
+	}
+
 	//* Update a record
 	public function sites_web_vhost_subdomain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
+
 		//* Set a few defaults for nginx servers
 		if($params['pm_max_children'] == '') $params['pm_max_children'] = 1;
 		if($params['pm_start_servers'] == '') $params['pm_start_servers'] = 1;
 		if($params['pm_min_spare_servers'] == '') $params['pm_min_spare_servers'] = 1;
 		if($params['pm_max_spare_servers'] == '') $params['pm_max_spare_servers'] = 1;
-		
-		$affected_rows = $this->updateQuery('../sites/form/web_vhost_subdomain.tform.php',$client_id,$primary_id,$params, 'sites:web_vhost_subdomain:on_after_insert');
+
+		$affected_rows = $this->updateQuery('../sites/form/web_vhost_subdomain.tform.php', $client_id, $primary_id, $params, 'sites:web_vhost_subdomain:on_after_insert');
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_vhost_subdomain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_vhost_subdomain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_vhost_subdomain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// -----------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_aliasdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -532,46 +532,46 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/web_aliasdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_aliasdomain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_aliasdomain.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_aliasdomain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_aliasdomain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_aliasdomain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_aliasdomain_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_aliasdomain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_subdomain_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -580,46 +580,46 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/web_subdomain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_subdomain_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_subdomain.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_subdomain.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_subdomain_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_subdomain.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_subdomain_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_subdomain_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_subdomain.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// ----------------------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_folder_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_folder_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -628,56 +628,56 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/web_folder.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_folder_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_folder.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_folder.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_folder_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_folder.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_folder.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_folder_delete($session_id, $primary_id)
-    {
+	{
 		global $app;
 		if(!$this->checkPerm($session_id, 'sites_web_folder_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		
-        // Delete all users that belong to this folder. - taken from web_folder_delete.php
+
+		// Delete all users that belong to this folder. - taken from web_folder_delete.php
 		$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($primary_id)."'");
 		foreach($records as $rec) {
-			$this->deleteQuery('../sites/form/web_folder_user.tform.php',$rec['web_folder_user_id']);
+			$this->deleteQuery('../sites/form/web_folder_user.tform.php', $rec['web_folder_user_id']);
 			//$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']);
 		}
 		unset($records);
-        
-		$affected_rows = $this->deleteQuery('../sites/form/web_folder.tform.php',$primary_id);
+
+		$affected_rows = $this->deleteQuery('../sites/form/web_folder.tform.php', $primary_id);
 		return $affected_rows;
 	}
-	
+
 	// -----------------------------------------------------------------------------------------------
-	
+
 	//* Get record details
 	public function sites_web_folder_user_get($session_id, $primary_id)
-    {
+	{
 		global $app;
-		
+
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_get')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
@@ -686,118 +686,121 @@ class remoting_sites extends remoting {
 		$app->remoting_lib->loadFormDef('../sites/form/web_folder_user.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
-	
+
 	//* Add a record
 	public function sites_web_folder_user_add($session_id, $client_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_add')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../sites/form/web_folder_user.tform.php',$client_id,$params);
+		return $this->insertQuery('../sites/form/web_folder_user.tform.php', $client_id, $params);
 	}
-	
+
 	//* Update a record
 	public function sites_web_folder_user_update($session_id, $client_id, $primary_id, $params)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_update')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->updateQuery('../sites/form/web_folder_user.tform.php',$client_id,$primary_id,$params);
+		$affected_rows = $this->updateQuery('../sites/form/web_folder_user.tform.php', $client_id, $primary_id, $params);
 		return $affected_rows;
 	}
-	
+
 	//* Delete a record
 	public function sites_web_folder_user_delete($session_id, $primary_id)
-    {
+	{
 		if(!$this->checkPerm($session_id, 'sites_web_folder_user_delete')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../sites/form/web_folder_user.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../sites/form/web_folder_user.tform.php', $primary_id);
 		return $affected_rows;
 	}
 
 	/**
 	 * Gets sites by $sys_userid & $sys_groupid
-	 * @param	int		session id
-	 * @param	int		user id
-	 * @param	array	list of groups
-	 * @return	mixed	array with sites by user
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 * @param int  session id
+	 * @param int  user id
+	 * @param array list of groups
+	 * @return mixed array with sites by user
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
+
+
 	public function client_get_sites_by_user($session_id, $sys_userid, $sys_groupid) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) {
-              throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-              return false;
-        }
-        $sys_userid  = $app->functions->intval($sys_userid);        
-        $sys_groupid = explode(',', $sys_groupid);
-        $new_group = array();
-        foreach($sys_groupid as $group_id) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'client_get_sites_by_user')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$sys_userid  = $app->functions->intval($sys_userid);
+		$sys_groupid = explode(',', $sys_groupid);
+		$new_group = array();
+		foreach($sys_groupid as $group_id) {
 			$new_group[] = $app->functions->intval( $group_id);
-        }
-        $group_list = implode(',', $new_group);
+		}
+		$group_list = implode(',', $new_group);
 		$sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid  AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR  sys_perm_other LIKE '%r%') AND type = 'vhost'";
-        $result = $app->db->queryAllRecords($sql);
-        if(isset($result)) {
+		$result = $app->db->queryAllRecords($sql);
+		if(isset($result)) {
 			return $result;
-        } else {
+		} else {
 			throw new SoapFault('no_client_found', 'There is no site for this user');
 			return false;
-        }
-    }
-    
-    /**
-     * Change domains status
-	 * @param	int		session id
-	 * @param	int		site id
-	 * @param	string	active or inactive string 
-	 * @return	mixed	false if error
-	 * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
+		}
+	}
+
+
+
+	/**
+	 * Change domains status
+	 * @param int  session id
+	 * @param int  site id
+	 * @param string active or inactive string
+	 * @return mixed false if error
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
 	 */
-	 
-    public function sites_web_domain_set_status($session_id, $primary_id, $status) {
-        global $app;
-        if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) {
-            throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }        
-        if(in_array($status, array('active', 'inactive'))) {        	    	
-        	if ($status == 'active') {
-        		$status = 'y';
-        	} else {
-        		$status = 'n';
-        	}
-	        $sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);	        
-	        $app->db->query($sql);
-	        $result = $app->db->affectedRows();	
-	         return $result;
-        } else {
+	public function sites_web_domain_set_status($session_id, $primary_id, $status) {
+		global $app;
+		if(!$this->checkPerm($session_id, 'sites_web_domain_set_status')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if(in_array($status, array('active', 'inactive'))) {
+			if ($status == 'active') {
+				$status = 'y';
+			} else {
+				$status = 'n';
+			}
+			$sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id);
+			$app->db->query($sql);
+			$result = $app->db->affectedRows();
+			return $result;
+		} else {
 			throw new SoapFault('status_undefined', 'The status is not available');
 			return false;
-        }      
+		}
 	}
 
-    /**
-     * Get all databases by user
-     * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-     */
+	/**
+	 * Get all databases by user
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
 	public function sites_database_get_all_by_user($session_id, $client_id)
-    {
-        global $app;
+	{
+		global $app;
 		if(!$this->checkPerm($session_id, 'sites_database_get')) {
-        	throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
 		}
-        $client_id = $app->functions->intval($client_id);
-        $sql = "SELECT d.database_id, d.database_name, d.database_user_id, d.database_ro_user_id, du.database_user, du.database_password FROM web_database d LEFT JOIN web_database_user du ON (du.database_user_id = d.database_user_id) INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id";
+		$client_id = $app->functions->intval($client_id);
+		$sql = "SELECT d.database_id, d.database_name, d.database_user_id, d.database_ro_user_id, du.database_user, du.database_password FROM web_database d LEFT JOIN web_database_user du ON (du.database_user_id = d.database_user_id) INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id";
 		$all = $app->db->queryAllRecords($sql);
-        return $all;
+		return $all;
 	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index a6a6ddcdd968d8f6b5b3d32ffebfcbccb122f324..2dd717986f7066fa3b8cca23fae4a04c063aa5df 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -35,42 +35,42 @@ Copyright (c) Tri-Plex technology
 */
 
 class remoting {
-	
+
 	//* remote session timeout in seconds
 	private $session_timeout = 600;
-	
+
 	public $oldDataRecord;
 	public $dataRecord;
 	public $id;
-	
-    private $_methods = array();
-    
+
+	private $_methods = array();
+
 	/*
-	These variables shall stay global. 
+	These variables shall stay global.
 	Please do not make them private variables.
-    
+
 	private $app;
     private $conf;
     */
 
-    public function __construct($methods = array())
-    {
-        global $app;
-        $app->uses('remoting_lib');
+	public function __construct($methods = array())
+	{
+		global $app;
+		$app->uses('remoting_lib');
+
+		$this->_methods = $methods;
 
-        $this->_methods = $methods;
-		
-        /*
+		/*
         $this->app = $app;
         $this->conf = $conf;
 		*/
-    }
-    
-    //* remote login function
+	}
+
+	//* remote login function
 	public function login($username, $password, $client_login = false)
-    {
+	{
 		global $app, $conf;
-		
+
 		// Maintenance mode
 		$app->uses('ini_parser,getconf');
 		$server_config_array = $app->getconf->get_global_config('misc');
@@ -78,439 +78,442 @@ class remoting {
 			throw new SoapFault('maintenance_mode', 'This ISPConfig installation is currently under maintenance. We should be back shortly. Thank you for your patience.');
 			return false;
 		}
-		
+
 		if(empty($username)) {
 			throw new SoapFault('login_username_empty', 'The login username is empty.');
 			return false;
 		}
-		
+
 		if(empty($password)) {
 			throw new SoapFault('login_password_empty', 'The login password is empty.');
 			return false;
 		}
-		
+
 		//* Delete old remoting sessions
 		$sql = "DELETE FROM remote_session WHERE tstamp < ".time();
 		$app->db->query($sql);
-		
+
 		$username = $app->db->quote($username);
 		$password = $app->db->quote($password);
-		
-        if($client_login == true) {
-            $sql = "SELECT * FROM sys_user WHERE USERNAME = '$username'";
-            $user = $app->db->queryOneRecord($sql);
-            if($user) {
-                $saved_password = stripslashes($user['passwort']);
-
-                if(substr($saved_password,0,3) == '$1$') {
-                    //* The password is crypt-md5 encrypted
-                    $salt = '$1$'.substr($saved_password,3,8).'$';
-
-                    if(crypt(stripslashes($password),$salt) != $saved_password) {
-                        throw new SoapFault('client_login_failed', 'The login failed. Username or password wrong.');
-                        return false;
-                    }
-                } else {
-                    //* The password is md5 encrypted
-                    if(md5($password) != $saved_password) {
-                        throw new SoapFault('client_login_failed', 'The login failed. Username or password wrong.');
-                        return false;
-                    }
-                }
-            } else {
-                throw new SoapFault('client_login_failed', 'The login failed. Username or password wrong.');
-                return false;
-            }
-            if($user['active'] != 1) {
-                throw new SoapFault('client_login_failed', 'The login failed. User is blocked.');
-                return false;
-            }
-            
-            // now we need the client data
-            $client = $app->db->queryOneRecord("SELECT client.can_use_api FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = " . $app->functions->intval($user['default_group']));
-            if(!$client || $client['can_use_api'] != 'y') {
-                throw new SoapFault('client_login_failed', 'The login failed. Client may not use api.');
-                return false;
-            }
-            
-            //* Create a remote user session
-            //srand ((double)microtime()*1000000);
-            $remote_session = md5(mt_rand().uniqid('ispco'));
-            $remote_userid = $user['userid'];
-            $remote_functions = '';
-            $tstamp = time() + $this->session_timeout;
-            $sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,client_login,tstamp'
-                   .') VALUES ('
-                   ." '$remote_session',$remote_userid,'$remote_functions',1,$tstamp)";
-            $app->db->query($sql);
-            return $remote_session;
+
+		if($client_login == true) {
+			$sql = "SELECT * FROM sys_user WHERE USERNAME = '$username'";
+			$user = $app->db->queryOneRecord($sql);
+			if($user) {
+				$saved_password = stripslashes($user['passwort']);
+
+				if(substr($saved_password, 0, 3) == '$1$') {
+					//* The password is crypt-md5 encrypted
+					$salt = '$1$'.substr($saved_password, 3, 8).'$';
+
+					if(crypt(stripslashes($password), $salt) != $saved_password) {
+						throw new SoapFault('client_login_failed', 'The login failed. Username or password wrong.');
+						return false;
+					}
+				} else {
+					//* The password is md5 encrypted
+					if(md5($password) != $saved_password) {
+						throw new SoapFault('client_login_failed', 'The login failed. Username or password wrong.');
+						return false;
+					}
+				}
+			} else {
+				throw new SoapFault('client_login_failed', 'The login failed. Username or password wrong.');
+				return false;
+			}
+			if($user['active'] != 1) {
+				throw new SoapFault('client_login_failed', 'The login failed. User is blocked.');
+				return false;
+			}
+
+			// now we need the client data
+			$client = $app->db->queryOneRecord("SELECT client.can_use_api FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = " . $app->functions->intval($user['default_group']));
+			if(!$client || $client['can_use_api'] != 'y') {
+				throw new SoapFault('client_login_failed', 'The login failed. Client may not use api.');
+				return false;
+			}
+
+			//* Create a remote user session
+			//srand ((double)microtime()*1000000);
+			$remote_session = md5(mt_rand().uniqid('ispco'));
+			$remote_userid = $user['userid'];
+			$remote_functions = '';
+			$tstamp = time() + $this->session_timeout;
+			$sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,client_login,tstamp'
+				.') VALUES ('
+				." '$remote_session',$remote_userid,'$remote_functions',1,$tstamp)";
+			$app->db->query($sql);
+			return $remote_session;
 		} else {
-            $sql = "SELECT * FROM remote_user WHERE remote_username = '$username' and remote_password = md5('$password')";
-            $remote_user = $app->db->queryOneRecord($sql);
-            if($remote_user['remote_userid'] > 0) {
-                //* Create a remote user session
-                //srand ((double)microtime()*1000000);
-                $remote_session = md5(mt_rand().uniqid('ispco'));
-                $remote_userid = $remote_user['remote_userid'];
-                $remote_functions = $remote_user['remote_functions'];
-                $tstamp = time() + $this->session_timeout;
-                $sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp'
-                       .') VALUES ('
-                       ." '$remote_session',$remote_userid,'$remote_functions',$tstamp)";
-                $app->db->query($sql);
-                return $remote_session;
-            } else {
-                throw new SoapFault('login_failed', 'The login failed. Username or password wrong.');
-                return false;
-            }
-        }
-		
+			$sql = "SELECT * FROM remote_user WHERE remote_username = '$username' and remote_password = md5('$password')";
+			$remote_user = $app->db->queryOneRecord($sql);
+			if($remote_user['remote_userid'] > 0) {
+				//* Create a remote user session
+				//srand ((double)microtime()*1000000);
+				$remote_session = md5(mt_rand().uniqid('ispco'));
+				$remote_userid = $remote_user['remote_userid'];
+				$remote_functions = $remote_user['remote_functions'];
+				$tstamp = time() + $this->session_timeout;
+				$sql = 'INSERT INTO remote_session (remote_session,remote_userid,remote_functions,tstamp'
+					.') VALUES ('
+					." '$remote_session',$remote_userid,'$remote_functions',$tstamp)";
+				$app->db->query($sql);
+				return $remote_session;
+			} else {
+				throw new SoapFault('login_failed', 'The login failed. Username or password wrong.');
+				return false;
+			}
+		}
+
 	}
-	
+
 	//* remote logout function
 	public function logout($session_id)
-    {		
+	{
 		global $app;
-		
+
 		if(empty($session_id)) {
 			throw new SoapFault('session_id_empty', 'The SessionID is empty.');
 			return false;
 		}
-		
+
 		$session_id = $app->db->quote($session_id);
-		
+
 		$sql = "DELETE FROM remote_session WHERE remote_session = '$session_id'";
 		$app->db->query($sql);
-        return ($app->db->affectedRows() == 1);
+		return $app->db->affectedRows() == 1;
 	}
-	
+
 
 	//** protected functions -----------------------------------------------------------------------------------
-	
+
 
 	protected function klientadd($formdef_file, $reseller_id, $params)
-    {
+	{
 		global $app;
-			
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($reseller_id);
-		
+
 		//* Get the SQL query
-		$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
-		
+		$sql = $app->remoting_lib->getSQL($params, 'INSERT', 0);
+
 		//* Check if no system user with that username exists
 		$username = $app->db->quote($params["username"]);
 		$tmp = $app->db->queryOneRecord("SELECT count(userid) as number FROM sys_user WHERE username = '$username'");
 		if($tmp['number'] > 0) $app->remoting_lib->errorMessage .= "Duplicate username<br />";
-		
+
 		//* Stop on error while preparing the sql query
 		if($app->remoting_lib->errorMessage != '') {
 			throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
+
 		//* Execute the SQL query
 		$app->db->query($sql);
 		$insert_id = $app->db->insertID();
-		
-		
+
+
 		//* Stop on error while executing the sql query
 		if($app->remoting_lib->errorMessage != '') {
 			throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
+
 		$this->id = $insert_id;
 		$this->dataRecord = $params;
-		
-		$app->plugin->raiseEvent('client:' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . ':on_after_insert',$this);
-		
+
+		$app->plugin->raiseEvent('client:' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . ':on_after_insert', $this);
+
 		/*
 		if($app->db->errorMessage != '') {
 			throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
 		*/
-		
-        /* copied from the client_edit php */
+
+		/* copied from the client_edit php */
 		exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
 		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
 		exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
-        
-        
-			
+
+
+
 		//$app->uses('tform');
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
 			$new_rec = $app->remoting_lib->getDataRecord($insert_id);
-			$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec);			
-			$app->remoting_lib->ispconfig_sysuser_add($params,$insert_id);
+			$app->remoting_lib->datalogSave('INSERT', $primary_id, array(), $new_rec);
+			$app->remoting_lib->ispconfig_sysuser_add($params, $insert_id);
 
-            if($reseller_id) {
-                $client_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = ".$insert_id);
-                $reseller_user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = ".$reseller_id);
-                $app->auth->add_group_to_user($reseller_user['userid'], $client_group['groupid']);
-                $app->db->query("UPDATE client SET parent_client_id = ".$reseller_id." WHERE client_id = ".$insert_id);
-            }   
+			if($reseller_id) {
+				$client_group = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = ".$insert_id);
+				$reseller_user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = ".$reseller_id);
+				$app->auth->add_group_to_user($reseller_user['userid'], $client_group['groupid']);
+				$app->db->query("UPDATE client SET parent_client_id = ".$reseller_id." WHERE client_id = ".$insert_id);
+			}
 
 		}
 		return $insert_id;
 	}
 
-    protected function insertQuery($formdef_file, $client_id, $params,$event_identifier = '')
-    {
-        $sql = $this->insertQueryPrepare($formdef_file, $client_id, $params);
-        if($sql !== false) return $this->insertQueryExecute($sql, $params,$event_identifier);
-        else return false;
-    }
+	protected function insertQuery($formdef_file, $client_id, $params, $event_identifier = '')
+	{
+		$sql = $this->insertQueryPrepare($formdef_file, $client_id, $params);
+		if($sql !== false) return $this->insertQueryExecute($sql, $params, $event_identifier);
+		else return false;
+	}
 
 	protected function insertQueryPrepare($formdef_file, $client_id, $params)
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($client_id);
-		
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		//* Get the SQL query
-		$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
+		$sql = $app->remoting_lib->getSQL($params, 'INSERT', 0);
 		if($app->remoting_lib->errorMessage != '') {
 			throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
 		$app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG);
-        return $sql;
+		return $sql;
 	}
-	
-	protected function insertQueryExecute($sql, $params,$event_identifier = '')
-    {
+
+	protected function insertQueryExecute($sql, $params, $event_identifier = '')
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-        
+
 		$app->db->query($sql);
-		
+
 		if($app->db->errorMessage != '') {
 			throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
-		
+
 		$insert_id = $app->db->insertID();
-		
+
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->id = $insert_id;
 		$this->dataRecord = $params;
 		$app->log('Executed insertQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
-		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
-	
+		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier, $this);
+
 		//$app->uses('tform');
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
 			$new_rec = $app->remoting_lib->getDataRecord($insert_id);
-			$app->remoting_lib->datalogSave('INSERT',$primary_id,array(),$new_rec);			
-		}		
+			$app->remoting_lib->datalogSave('INSERT', $primary_id, array(), $new_rec);
+		}
 		return $insert_id;
 	}
-    
+
 	protected function updateQuery($formdef_file, $client_id, $primary_id, $params, $event_identifier = '')
-    {
+	{
 		global $app;
-		
+
 		$sql = $this->updateQueryPrepare($formdef_file, $client_id, $primary_id, $params);
-        if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params,$event_identifier);
-        else return false;
+		if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params, $event_identifier);
+		else return false;
 	}
-	
+
 	protected function updateQueryPrepare($formdef_file, $client_id, $primary_id, $params)
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($client_id);
-		
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		//* Get the SQL query
-		$sql = $app->remoting_lib->getSQL($params,'UPDATE',$primary_id);
+		$sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id);
 		// throw new SoapFault('debug', $sql);
 		if($app->remoting_lib->errorMessage != '') {
 			throw new SoapFault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
-        return $sql;
+
+		return $sql;
 	}
 
 	protected function updateQueryExecute($sql, $primary_id, $params, $event_identifier = '')
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
-		
+
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->oldDataRecord = $old_rec;
 		$this->id = $primary_id;
 		$this->dataRecord = $params;
-		
+
 		$app->db->query($sql);
-		
+
 		if($app->db->errorMessage != '') {
 			throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
-		
+
 		$affected_rows = $app->db->affectedRows();
 		$app->log('Executed updateQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
-		
-		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
-		
+
+		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier, $this);
+
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
 			$new_rec = $app->remoting_lib->getDataRecord($primary_id);
-			$app->remoting_lib->datalogSave('UPDATE',$primary_id,$old_rec,$new_rec);
+			$app->remoting_lib->datalogSave('UPDATE', $primary_id, $old_rec, $new_rec);
 		}
-		
+
 		return $affected_rows;
 	}
 
 	protected function deleteQuery($formdef_file, $primary_id, $event_identifier = '')
-    {
+	{
 		global $app;
-		
+
 		$app->uses('remoting_lib');
-		
+
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile(0);
-		
+
 		//* Load the form definition
 		$app->remoting_lib->loadFormDef($formdef_file);
-		
+
 		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
-		
+
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->oldDataRecord = $old_rec;
 		$this->id = $primary_id;
 		$this->dataRecord = $old_rec;
 		$app->log('Executed deleteQuery, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
 		//$this->dataRecord = $params;
-		
+
 		//* Get the SQL query
 		$sql = $app->remoting_lib->getDeleteSQL($primary_id);
 		$app->db->errorMessage = '';
 		$app->db->query($sql);
 		$affected_rows = $app->db->affectedRows();
-		
+
 		if($app->db->errorMessage != '') {
 			throw new SoapFault('database_error', $app->db->errorMessage . ' '.$sql);
 			return false;
 		}
-		
+
 		if($event_identifier != '') {
-			$app->plugin->raiseEvent($event_identifier,$this);
+			$app->plugin->raiseEvent($event_identifier, $this);
 		}
-		
+
 		//* Save changes to Datalog
 		if($app->remoting_lib->formDef["db_history"] == 'yes') {
-			$app->remoting_lib->datalogSave('DELETE',$primary_id,$old_rec,array());
+			$app->remoting_lib->datalogSave('DELETE', $primary_id, $old_rec, array());
 		}
-		
-		
+
+
 		return $affected_rows;
 	}
-	
-	
+
+
 	protected function checkPerm($session_id, $function_name)
-    {
-        global $app;
-	$dobre=array();
-	$session = $this->getSession($session_id);
-        if(!$session){
-            return false;
-        }
-		
-        $_SESSION['client_login'] = $session['client_login'];
-        if($session['client_login'] == 1) {
-            // permissions are checked at an other place
-            $_SESSION['client_sys_userid'] = $session['remote_userid'];
-            $app->remoting_lib->loadUserProfile(); // load the profile - we ALWAYS need this on client logins!
-            return true;
-        } else {
-            $_SESSION['client_sys_userid'] = 0;
-        }
-        
-		$dobre= str_replace(';',',',$session['remote_functions']);
+	{
+		global $app;
+		$dobre=array();
+		$session = $this->getSession($session_id);
+		if(!$session){
+			return false;
+		}
+
+		$_SESSION['client_login'] = $session['client_login'];
+		if($session['client_login'] == 1) {
+			// permissions are checked at an other place
+			$_SESSION['client_sys_userid'] = $session['remote_userid'];
+			$app->remoting_lib->loadUserProfile(); // load the profile - we ALWAYS need this on client logins!
+			return true;
+		} else {
+			$_SESSION['client_sys_userid'] = 0;
+		}
+
+		$dobre= str_replace(';', ',', $session['remote_functions']);
 		$check = in_array($function_name, explode(',', $dobre) );
 		if(!$check) {
-		  $app->log("REMOTE-LIB DENY: ".$session_id ." /". $function_name, LOGLEVEL_WARN);
+			$app->log("REMOTE-LIB DENY: ".$session_id ." /". $function_name, LOGLEVEL_WARN);
 		}
 		return $check;
 	}
-	
-	
+
+
 	protected function getSession($session_id)
-    {	
+	{
 		global $app;
-		
+
 		if(empty($session_id)) {
-			throw new SoapFault('session_id_empty','The SessionID is empty.');
+			throw new SoapFault('session_id_empty', 'The SessionID is empty.');
 			return false;
 		}
-		
+
 		$session_id = $app->db->quote($session_id);
-		
+
 		$now = time();
 		$sql = "SELECT * FROM remote_session WHERE remote_session = '$session_id' AND tstamp >= $now";
 		$session = $app->db->queryOneRecord($sql);
 		if($session['remote_userid'] > 0) {
 			return $session;
 		} else {
-			throw new SoapFault('session_does_not_exist','The Session is expired or does not exist.');
+			throw new SoapFault('session_does_not_exist', 'The Session is expired or does not exist.');
 			return false;
 		}
 	}
-	
-    // needed from inside the remoting plugins
-    public function server_get($session_id, $server_id, $section ='') {
-        global $app;        
-        if(!$this->checkPerm($session_id, 'server_get')) {
-            throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
-            return false;
-        }
-        if (!empty($session_id) && !empty($server_id)) {    
-            $app->uses('remoting_lib , getconf');        
-            $section_config =  $app->getconf->get_server_config($server_id,$section);        
-            return $section_config;
-        } else {
-            return false;
-        }
-    }
-	
+
+	// needed from inside the remoting plugins
+	public function server_get($session_id, $server_id, $section ='') {
+		global $app;
+		if(!$this->checkPerm($session_id, 'server_get')) {
+			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		if (!empty($session_id) && !empty($server_id)) {
+			$app->uses('remoting_lib , getconf');
+			$section_config =  $app->getconf->get_server_config($server_id, $section);
+			return $section_config;
+		} else {
+			return false;
+		}
+	}
+
 	/**
-   	* Get a list of functions
-   	* @param 	int		session id
-   	* @return	mixed	array of the available functions
-    * @author	Julio Montoya <gugli100@gmail.com> BeezNest 2010
-    */
-    public function get_function_list($session_id) 
-    {
-        if(!$this->checkPerm($session_id, 'get_function_list')) {
+	 * Get a list of functions
+	 * @param  int  session id
+	 * @return mixed array of the available functions
+	 * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
+	 */
+
+
+	public function get_function_list($session_id)
+	{
+		if(!$this->checkPerm($session_id, 'get_function_list')) {
 			throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
-        }
-        return $this->_methods;
-    }
-    
+		}
+		return $this->_methods;
+	}
+
 }
+
 ?>
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index f163a870b1bae35153b89384750a6efdd748f5bf..5d1b23d240624a1490e8474c964c19f2b734d39e 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -35,285 +35,289 @@ Copyright (c) Tri-Plex technology
 */
 
 /**
-* Formularbehandlung
-*
-* Functions to validate, display and save form values
-*
-*        Database table field definitions
-*
-*        Datatypes:
-*        - INTEGER (Converts data to int automatically)
-*        - DOUBLE
-*        - CURRENCY (Formats digits in currency notation)
-*        - VARCHAR (No format check)
-*        - DATE (Date format, converts from and to UNIX timestamps automatically)
-*
-*        Formtype:
-*        - TEXT (Normal text field)
-*        - PASSWORD (password field, the content will not be displayed again to the user)
-*        - SELECT (Option fiield)
-*        - MULTIPLE (Allows selection of multiple values)
-*
-*        VALUE:
-*        - Value or array
-*
-*        SEPARATOR
-*        - separator char used for fileds with multiple values
-*
-*        Hint: The auto increment (ID) filed of the table has not be be definied separately.
-*
-*/
+ * Formularbehandlung
+ *
+ * Functions to validate, display and save form values
+ *
+ *        Database table field definitions
+ *
+ *        Datatypes:
+ *        - INTEGER (Converts data to int automatically)
+ *        - DOUBLE
+ *        - CURRENCY (Formats digits in currency notation)
+ *        - VARCHAR (No format check)
+ *        - DATE (Date format, converts from and to UNIX timestamps automatically)
+ *
+ *        Formtype:
+ *        - TEXT (Normal text field)
+ *        - PASSWORD (password field, the content will not be displayed again to the user)
+ *        - SELECT (Option fiield)
+ *        - MULTIPLE (Allows selection of multiple values)
+ *
+ *        VALUE:
+ *        - Value or array
+ *
+ *        SEPARATOR
+ *        - separator char used for fileds with multiple values
+ *
+ *        Hint: The auto increment (ID) filed of the table has not be be definied separately.
+ *
+ */
+
+
 global $app;
 $app->load('tform_base');
 class remoting_lib extends tform_base {
-	
-        
-		// additional class variables
-		var $sys_username;
-		var $sys_userid;
-		var $sys_default_group;
-		var $sys_groups;
-		var $client_id;
-		var $dataRecord;
-
-		
-		//* Load the form definition from file. - special version for remoting
-        // module parameter is only for compatibility with base class
-    	function loadFormDef($file, $module = '') {
-			global $app,$conf;
-            
-			include($file);
-				
-			$this->formDef = $form;
-			unset($this->formDef['tabs']);
-                
-			//* Copy all fields from all tabs into one form definition
-			foreach($form['tabs'] as $tab) {
-				foreach($tab['fields'] as $key => $value) {
-					$this->formDef['fields'][$key] = $value;
-				}
+
+
+	// additional class variables
+	var $sys_username;
+	var $sys_userid;
+	var $sys_default_group;
+	var $sys_groups;
+	var $client_id;
+	var $dataRecord;
+
+
+	//* Load the form definition from file. - special version for remoting
+	// module parameter is only for compatibility with base class
+	function loadFormDef($file, $module = '') {
+		global $app, $conf;
+
+		include $file;
+
+		$this->formDef = $form;
+		unset($this->formDef['tabs']);
+
+		//* Copy all fields from all tabs into one form definition
+		foreach($form['tabs'] as $tab) {
+			foreach($tab['fields'] as $key => $value) {
+				$this->formDef['fields'][$key] = $value;
 			}
-			unset($form);
-			
-			$this->dateformat = $app->lng('conf_format_dateshort');
-				
-            return true;
-        }
-		
-		//* Load the user profile
-		function loadUserProfile($client_id_param = 0) {
-			global $app,$conf;
-            
-            $client_login = false;
-            if(isset($_SESSION['client_login']) && isset($_SESSION['client_sys_userid']) && $_SESSION['client_login'] == 1) {
-                $client_sys_userid = $app->functions->intval($_SESSION['client_sys_userid']);
-                
-                $client = $app->db->queryOneRecord("SELECT client.client_id FROM sys_user, client WHERE sys_user.client_id = client.client_id and sys_user.userid = " . $client_sys_userid);
-                
-                $this->client_id = $client['client_id'];
-                $client_login = true;
-            } else {
-                $this->client_id = $app->functions->intval($client_id_param);
-            }
-            
-			if($this->client_id == 0) {
-				$this->sys_username         = 'admin';
-				$this->sys_userid            = 1;
-				$this->sys_default_group     = 1;
-				$this->sys_groups            = 1;
-				$_SESSION["s"]["user"]["typ"] = 'admin';
-			} else {
-				//* load system user - try with sysuser and before with userid (workarrond)
-				/*
+		}
+		unset($form);
+
+		$this->dateformat = $app->lng('conf_format_dateshort');
+
+		return true;
+	}
+
+	//* Load the user profile
+	function loadUserProfile($client_id_param = 0) {
+		global $app, $conf;
+
+		$client_login = false;
+		if(isset($_SESSION['client_login']) && isset($_SESSION['client_sys_userid']) && $_SESSION['client_login'] == 1) {
+			$client_sys_userid = $app->functions->intval($_SESSION['client_sys_userid']);
+
+			$client = $app->db->queryOneRecord("SELECT client.client_id FROM sys_user, client WHERE sys_user.client_id = client.client_id and sys_user.userid = " . $client_sys_userid);
+
+			$this->client_id = $client['client_id'];
+			$client_login = true;
+		} else {
+			$this->client_id = $app->functions->intval($client_id_param);
+		}
+
+		if($this->client_id == 0) {
+			$this->sys_username         = 'admin';
+			$this->sys_userid            = 1;
+			$this->sys_default_group     = 1;
+			$this->sys_groups            = 1;
+			$_SESSION["s"]["user"]["typ"] = 'admin';
+		} else {
+			//* load system user - try with sysuser and before with userid (workarrond)
+			/*
 				$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE sysuser_id = $client_id");
 				if(empty($user["userid"])) {
-						$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $client_id");		
+						$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $client_id");
 						if(empty($user["userid"])) {
 								$this->errorMessage .= "No sysuser with the ID $client_id found.";
 								return false;
 						}
 				}*/
-				
-				$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = $this->client_id");
-				$this->sys_username         = $user['username'];
-				$this->sys_userid            = $user['userid'];
-				$this->sys_default_group     = $user['default_group'];
-				$this->sys_groups             = $user['groups'];
-				// $_SESSION["s"]["user"]["typ"] = $user['typ'];
-				// we have to force admin priveliges for the remoting API as some function calls might fail otherwise.
-				if($client_login == false) $_SESSION["s"]["user"]["typ"] = 'admin';
-			}
-			
-			$_SESSION["s"]["user"]["username"] = $this->sys_username;
-			$_SESSION["s"]["user"]["userid"] = $this->sys_userid;
-			$_SESSION["s"]["user"]["default_group"] = $this->sys_default_group;
-			$_SESSION["s"]["user"]["groups"] = $this->sys_groups;
-			$_SESSION["s"]["user"]["client_id"] = $this->client_id;
 
-		return true;
-	    }  
-
-
-        /**
-        * Converts the data in the array to human readable format
-        * Datatype conversion e.g. to show the data in lists
-        * tab parameter is only there for compatibility with params of base class
-        *
-        * @param record
-        * @return record
-        */
-        function decode($record, $tab = '') {
-			    return $this->_decode($record, '', true);
-        }
-
-        /**
-        * Get the key => value array of a form filled from a datasource definitiom
-        * dummy parameter is only there for compatibility with params of base class
-        * 
-        * @param field = array with field definition
-        * @param record = Dataset as array
-        * @return key => value array for the value field of a form
-        */
-
-        function getDatasourceData($field, $record, $dummy = '') {
-			return $this->_getDatasourceData($field, $record, true);
-        }
-
-        /**
-        /**
-        * Rewrite the record data to be stored in the database
-        * and check values with regular expressions.
-        * dummy parameter is only there for compatibility with params of base class
-        * 
-        * @param record = Datensatz als Array
-        * @return record
-        */
-        function encode($record,$dbencode = true, $dummy = '') {
-			$new_record = $this->_encode($record, '', $dbencode, true);
-			if(isset($record['_ispconfig_pw_crypted'])) $new_record['_ispconfig_pw_crypted'] = $record['_ispconfig_pw_crypted']; // this one is not in form definitions!
-			
-			return $new_record;
-        }
-
-        /**
-        * Create SQL statement
-        * dummy parameter is only there for compatibility with params of base class
-        * 
-        * @param record = Datensatz als Array
-        * @param action = INSERT oder UPDATE
-        * @param primary_id
-        * @return record
-        */
-        function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '', $dummy = '') {
-
-                global $app;
-
-                if(!is_array($this->formDef)) $app->error("Form definition not found.");
-				$this->dataRecord = $record;
-				
-				return $this->_getSQL($record, '', $action, $primary_id, $sql_ext_where, true);
-		}
-		
-		function getDeleteSQL($primary_id) {
-			
-			if(stristr($this->formDef['db_table'],'.')) {
-				$escape = '';
-			} else {
-				$escape = '`';
-			}
-			
-			$sql = "DELETE FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id. " AND " . $this->getAuthSQL('d', $this->formDef['db_table']);
-			return $sql;
+			$user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE client_id = $this->client_id");
+			$this->sys_username         = $user['username'];
+			$this->sys_userid            = $user['userid'];
+			$this->sys_default_group     = $user['default_group'];
+			$this->sys_groups             = $user['groups'];
+			// $_SESSION["s"]["user"]["typ"] = $user['typ'];
+			// we have to force admin priveliges for the remoting API as some function calls might fail otherwise.
+			if($client_login == false) $_SESSION["s"]["user"]["typ"] = 'admin';
 		}
 
-		function getDataRecord($primary_id) {
-			global $app;
+		$_SESSION["s"]["user"]["username"] = $this->sys_username;
+		$_SESSION["s"]["user"]["userid"] = $this->sys_userid;
+		$_SESSION["s"]["user"]["default_group"] = $this->sys_default_group;
+		$_SESSION["s"]["user"]["groups"] = $this->sys_groups;
+		$_SESSION["s"]["user"]["client_id"] = $this->client_id;
+
+		return true;
+	}
+
+
+	/**
+	 * Converts the data in the array to human readable format
+	 * Datatype conversion e.g. to show the data in lists
+	 * tab parameter is only there for compatibility with params of base class
+	 *
+	 * @param record
+	 * @return record
+	 */
+	function decode($record, $tab = '') {
+		return $this->_decode($record, '', true);
+	}
+
+
+	/**
+	 * Get the key => value array of a form filled from a datasource definitiom
+	 * dummy parameter is only there for compatibility with params of base class
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
+	function getDatasourceData($field, $record, $dummy = '') {
+		return $this->_getDatasourceData($field, $record, true);
+	}
+
+
+	/**
+	 /**
+	 * Rewrite the record data to be stored in the database
+	 * and check values with regular expressions.
+	 * dummy parameter is only there for compatibility with params of base class
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
+	function encode($record, $dbencode = true, $dummy = '') {
+		$new_record = $this->_encode($record, '', $dbencode, true);
+		if(isset($record['_ispconfig_pw_crypted'])) $new_record['_ispconfig_pw_crypted'] = $record['_ispconfig_pw_crypted']; // this one is not in form definitions!
+
+		return $new_record;
+	}
+
+
+	/**
+	 * Create SQL statement
+	 * dummy parameter is only there for compatibility with params of base class
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
+	function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '', $dummy = '') {
+
+		global $app;
+
+		if(!is_array($this->formDef)) $app->error("Form definition not found.");
+		$this->dataRecord = $record;
+
+		return $this->_getSQL($record, '', $action, $primary_id, $sql_ext_where, true);
+	}
+
+	function getDeleteSQL($primary_id) {
+
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
 			$escape = '`';
-			if(@is_numeric($primary_id)) {
-				return parent::getDataRecord($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 = '';
-				foreach($primary_id as $key => $val) {
-					$key = $app->db->quote($key);
-					$val = $app->db->quote($val);
-                    if($key == '#OFFSET#') $sql_offset = $app->functions->intval($val);
-                    elseif($key == '#LIMIT#') $sql_limit = $app->functions->intval($val);
-					elseif(stristr($val,'%')) {
-						$sql_where .= "$key like '$val' AND ";
-					} else {
-						$sql_where .= "$key = '$val' AND ";
-					}
-				}
-				$sql_where = substr($sql_where,0,-5);
-                if($sql_where == '') $sql_where = '1';
-				$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where. " AND " . $this->getAuthSQL('r', $this->formDef['db_table']);
-                if($sql_offset >= 0 && $sql_limit > 0) $sql .= ' LIMIT ' . $sql_offset . ',' . $sql_limit;
-                return $app->db->queryAllRecords($sql);
-			} else {
-				$this->errorMessage = 'The ID must be either an integer or an array.';
-				return array();
-			}
 		}
 
-		function ispconfig_sysuser_add($params,$insert_id){
-			global $conf,$app,$sql1;
-			$username = $app->db->quote($params["username"]);
-			$password = $app->db->quote($params["password"]);
-			if(!isset($params['modules'])) {
-				$modules = $conf['interface_modules_enabled'];
-			} else {
-				$modules = $app->db->quote($params['modules']);
-			}
-			if(isset($params['limit_client']) && $params['limit_client'] > 0) {
-				$modules .= ',client';
-			}
-			
-			if(!isset($params['startmodule'])) {			
-				$startmodule = 'dashboard';
-			} else {						
-				$startmodule = $app->db->quote($params["startmodule"]);
-				if(!preg_match('/'.$startmodule.'/',$modules)) {
-					$_modules = explode(',',$modules);
-					$startmodule=$_modules[0];
+		$sql = "DELETE FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id. " AND " . $this->getAuthSQL('d', $this->formDef['db_table']);
+		return $sql;
+	}
+
+	function getDataRecord($primary_id) {
+		global $app;
+		$escape = '`';
+		if(@is_numeric($primary_id)) {
+			return parent::getDataRecord($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 = '';
+			foreach($primary_id as $key => $val) {
+				$key = $app->db->quote($key);
+				$val = $app->db->quote($val);
+				if($key == '#OFFSET#') $sql_offset = $app->functions->intval($val);
+				elseif($key == '#LIMIT#') $sql_limit = $app->functions->intval($val);
+				elseif(stristr($val, '%')) {
+					$sql_where .= "$key like '$val' AND ";
+				} else {
+					$sql_where .= "$key = '$val' AND ";
 				}
 			}
-			$usertheme = $app->db->quote($params["usertheme"]);
-			$type = 'user';
-			$active = 1;
-			$insert_id = $app->functions->intval($insert_id);
-			$language = $app->db->quote($params["language"]);
-			$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
-			$groups = $groupid;
-			if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($password));
-			$sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
-			VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
-			$app->db->query($sql1);
+			$sql_where = substr($sql_where, 0, -5);
+			if($sql_where == '') $sql_where = '1';
+			$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$sql_where. " AND " . $this->getAuthSQL('r', $this->formDef['db_table']);
+			if($sql_offset >= 0 && $sql_limit > 0) $sql .= ' LIMIT ' . $sql_offset . ',' . $sql_limit;
+			return $app->db->queryAllRecords($sql);
+		} else {
+			$this->errorMessage = 'The ID must be either an integer or an array.';
+			return array();
 		}
-		
-		function ispconfig_sysuser_update($params,$client_id){
-			global $app;
-			$username = $app->db->quote($params["username"]);
-			$clear_password = $app->db->quote($params["password"]);
-			$client_id = $app->functions->intval($client_id);
-			if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($clear_password));
-            else $password = $clear_password;
-			if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ;
-			$sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id";
-			$app->db->query($sql);
+	}
+
+	function ispconfig_sysuser_add($params, $insert_id){
+		global $conf, $app, $sql1;
+		$username = $app->db->quote($params["username"]);
+		$password = $app->db->quote($params["password"]);
+		if(!isset($params['modules'])) {
+			$modules = $conf['interface_modules_enabled'];
+		} else {
+			$modules = $app->db->quote($params['modules']);
 		}
-		
-		function ispconfig_sysuser_delete($client_id){
-			global $app;
-			$client_id = $app->functions->intval($client_id);
-			$sql = "DELETE FROM sys_user WHERE client_id = $client_id";
-			$app->db->query($sql);
-			$sql = "DELETE FROM sys_group WHERE client_id = $client_id";
-			$app->db->query($sql);
+		if(isset($params['limit_client']) && $params['limit_client'] > 0) {
+			$modules .= ',client';
 		}
 
+		if(!isset($params['startmodule'])) {
+			$startmodule = 'dashboard';
+		} else {
+			$startmodule = $app->db->quote($params["startmodule"]);
+			if(!preg_match('/'.$startmodule.'/', $modules)) {
+				$_modules = explode(',', $modules);
+				$startmodule=$_modules[0];
+			}
+		}
+		$usertheme = $app->db->quote($params["usertheme"]);
+		$type = 'user';
+		$active = 1;
+		$insert_id = $app->functions->intval($insert_id);
+		$language = $app->db->quote($params["language"]);
+		$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid');
+		$groups = $groupid;
+		if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($password));
+		$sql1 = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
+			VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,$insert_id)";
+		$app->db->query($sql1);
+	}
+
+	function ispconfig_sysuser_update($params, $client_id){
+		global $app;
+		$username = $app->db->quote($params["username"]);
+		$clear_password = $app->db->quote($params["password"]);
+		$client_id = $app->functions->intval($client_id);
+		if(!isset($params['_ispconfig_pw_crypted']) || $params['_ispconfig_pw_crypted'] != 1) $password = $app->auth->crypt_password(stripslashes($clear_password));
+		else $password = $clear_password;
+		if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ;
+		$sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id";
+		$app->db->query($sql);
+	}
+
+	function ispconfig_sysuser_delete($client_id){
+		global $app;
+		$client_id = $app->functions->intval($client_id);
+		$sql = "DELETE FROM sys_user WHERE client_id = $client_id";
+		$app->db->query($sql);
+		$sql = "DELETE FROM sys_group WHERE client_id = $client_id";
+		$app->db->query($sql);
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/searchform.inc.php b/interface/lib/classes/searchform.inc.php
index e87547a9d97ed19ebd2db2e868fcfb644056bea8..cfa8f283601324f93861de938454d8b5cc635279 100644
--- a/interface/lib/classes/searchform.inc.php
+++ b/interface/lib/classes/searchform.inc.php
@@ -30,224 +30,225 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class searchform {
 
-    public $debug = 0;
-    public $errorMessage;
-    public $listDef;
-    public $searchValues;
-    public $pagingHTML;
-    public $pagingValues;
-    public $searchChanged = 0;
-    public $module;
-
-    public function loadListDef($file, $module = '')
-    {
-        global $app, $conf;
-        if(!is_file($file)){
-            die("List-Definition: $file not found.");
-        }
-        include_once($file);
-        $this->listDef = $liste;
-        $this->module = $module;
-		
+	public $debug = 0;
+	public $errorMessage;
+	public $listDef;
+	public $searchValues;
+	public $pagingHTML;
+	public $pagingValues;
+	public $searchChanged = 0;
+	public $module;
+
+	public function loadListDef($file, $module = '')
+	{
+		global $app, $conf;
+		if(!is_file($file)){
+			die("List-Definition: $file not found.");
+		}
+		include_once $file;
+		$this->listDef = $liste;
+		$this->module = $module;
+
 		//* Fill datasources
 		foreach($this->listDef['item'] as $key => $field) {
 			if(is_array($field['datasource'])) {
-                $this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
-            }
-		}	
-        return true;
-    }
-		
+				$this->listDef['item'][$key]['value'] = $this->getDatasourceData($field);
+			}
+		}
+		return true;
+	}
+
 	/**
-    * Get the key => value array of a form filed from a datasource definitiom
-    *
-    * @param field = array with field definition
-    * @param record = Dataset as array
-    * @return key => value array for the value field of a form
-    */
-
-    public function getDatasourceData($field)
-    {
-        global $app;
-        $values = array();
-
-        if($field['datasource']['type'] == 'SQL') {
-            //* Preparing SQL string. We will replace some common placeholders
-            $querystring = $field['datasource']['querystring'];
-            $querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
-            $querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
-            $querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
-            $table_idx = $this->formDef['db_table_idx'];
-            //$querystring = str_replace('{RECORDID}',$record[$table_idx],$querystring);
-            $app->uses('tform');
-            $querystring = str_replace('{AUTHSQL}', $app->tform->getAuthSQL('r'), $querystring);
-
-            //* Getting the records
-            $tmp_records = $app->db->queryAllRecords($querystring);
-            if($app->db->errorMessage != ''){
-                die($app->db->errorMessage);
-            }
-            if(is_array($tmp_records)) {
-                $key_field = $field['datasource']['keyfield'];
-                $value_field = $field['datasource']['valuefield'];
-                foreach($tmp_records as $tmp_rec) {
-                    $values[$tmp_rec[$key_field]] = $tmp_rec[$value_field];
-                }
-            }
-        }
-        if($field['datasource']['type'] == 'CUSTOM') {
-            //* Calls a custom class to validate this record
-            if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
-                $datasource_class = $field['datasource']['class'];
-                $datasource_function = $field['datasource']['function'];
-                $app->uses($datasource_class);
-                $record = array();
-                $values = $app->$datasource_class->$datasource_function($field, $record);
-            }else{
-                $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
-            }
-        }
-        return $values;
-    }
-
-    public function getSearchSQL($sql_where = '')
-    {
-        global $db;
-
-        //* Config vars
-        $list_name = $this->listDef['name'];
-        $search_prefix = $this->listDef['search_prefix'];
-
-        //* store retrieval query
-        foreach($this->listDef['item'] as $i) {
-            $field = $i['field'];
-
-            //* TODO ?  hat sich die suche ge�ndert - has itself search  ?
-            $ki = $search_prefix.$field;
-            if(isset($_REQUEST) and $_REQUEST[$ki] != $_SESSION['search'][$list_name][$ki]){
-                $this->searchChanged = 1;
-            }
-
-            //* suchfield in session store.
-            if(isset($_REQUEST[$ki])){
-                $_SESSION['search'][$list_name][$ki] = $_REQUEST[$ki];
-            }
-
-            if($i['formtype'] == 'SELECT'){
-                if(is_array($i['value'])) {
-                    $out = '<option value=""></option>';
-                    foreach($i['value'] as $k => $v) {
-                        $selected = ($k == $_SESSION['search'][$list_name][$ki] && $_SESSION['search'][$list_name][$ki] != '') ? ' SELECTED' : '';
-                        $out .= "<option value='$k'$selected>$v</option>\r\n";
-                    }
-                }
-                $this->searchValues[$ki] = $out;
-            }else{
-                $this->searchValues[$ki] = $_SESSION['search'][$list_name][$ki];
-            }
-        }
-
-        //* store variables in object. $this->searchValues = $_SESSION["search"][$list_name];
-        foreach($this->listDef['item'] as $i) {
-            $field = $i['field'];
-            //if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
+	 * Get the key => value array of a form filed from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
+
+
+	public function getDatasourceData($field)
+	{
+		global $app;
+		$values = array();
+
+		if($field['datasource']['type'] == 'SQL') {
+			//* Preparing SQL string. We will replace some common placeholders
+			$querystring = $field['datasource']['querystring'];
+			$querystring = str_replace('{USERID}', $_SESSION['s']['user']['userid'], $querystring);
+			$querystring = str_replace('{GROUPID}', $_SESSION['s']['user']['default_group'], $querystring);
+			$querystring = str_replace('{GROUPS}', $_SESSION['s']['user']['groups'], $querystring);
+			$table_idx = $this->formDef['db_table_idx'];
+			//$querystring = str_replace('{RECORDID}',$record[$table_idx],$querystring);
+			$app->uses('tform');
+			$querystring = str_replace('{AUTHSQL}', $app->tform->getAuthSQL('r'), $querystring);
+
+			//* Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != ''){
+				die($app->db->errorMessage);
+			}
+			if(is_array($tmp_records)) {
+				$key_field = $field['datasource']['keyfield'];
+				$value_field = $field['datasource']['valuefield'];
+				foreach($tmp_records as $tmp_rec) {
+					$values[$tmp_rec[$key_field]] = $tmp_rec[$value_field];
+				}
+			}
+		}
+		if($field['datasource']['type'] == 'CUSTOM') {
+			//* Calls a custom class to validate this record
+			if($field['datasource']['class'] != '' and $field['datasource']['function'] != '') {
+				$datasource_class = $field['datasource']['class'];
+				$datasource_function = $field['datasource']['function'];
+				$app->uses($datasource_class);
+				$record = array();
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			}else{
+				$this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
+			}
+		}
+		return $values;
+	}
+
+	public function getSearchSQL($sql_where = '')
+	{
+		global $db;
+
+		//* Config vars
+		$list_name = $this->listDef['name'];
+		$search_prefix = $this->listDef['search_prefix'];
+
+		//* store retrieval query
+		foreach($this->listDef['item'] as $i) {
+			$field = $i['field'];
+
+			//* TODO ?  hat sich die suche ge�ndert - has itself search  ?
+			$ki = $search_prefix.$field;
+			if(isset($_REQUEST) and $_REQUEST[$ki] != $_SESSION['search'][$list_name][$ki]){
+				$this->searchChanged = 1;
+			}
+
+			//* suchfield in session store.
+			if(isset($_REQUEST[$ki])){
+				$_SESSION['search'][$list_name][$ki] = $_REQUEST[$ki];
+			}
+
+			if($i['formtype'] == 'SELECT'){
+				if(is_array($i['value'])) {
+					$out = '<option value=""></option>';
+					foreach($i['value'] as $k => $v) {
+						$selected = ($k == $_SESSION['search'][$list_name][$ki] && $_SESSION['search'][$list_name][$ki] != '') ? ' SELECTED' : '';
+						$out .= "<option value='$k'$selected>$v</option>\r\n";
+					}
+				}
+				$this->searchValues[$ki] = $out;
+			}else{
+				$this->searchValues[$ki] = $_SESSION['search'][$list_name][$ki];
+			}
+		}
+
+		//* store variables in object. $this->searchValues = $_SESSION["search"][$list_name];
+		foreach($this->listDef['item'] as $i) {
+			$field = $i['field'];
+			//if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
 			if($_SESSION['search'][$list_name][$ki] != ''){
-                $sql_where .= " $field ".$i['op']." '".$i['prefix'].$_SESSION['search'][$list_name][$ki].$i['suffix']."' and";
-            }
-        }
-        return ($sql_where != '') ? substr($sql_where, 0, -3) : '1';
-    }
-
-    public function getPagingSQL($sql_where = '1') {
-        global $app, $conf;
-
-        $list_name          = $this->listDef['name'];
-        $search_prefix      = $this->listDef['search_prefix'];
-        $records_per_page   = $this->listDef['records_per_page'];
-        $table              = $this->listDef['table'];
-
-        //* set page to seror id session not set
-        if($_SESSION['search'][$list_name]['page'] == '')   $_SESSION['search'][$list_name]['page'] = 0;
-
-        //* Set page size to request if set
-        if(isset($_REQUEST['page']))    $_SESSION['search'][$list_name]['page'] = $_REQUEST['page']; 
-
-        //* TODO PAGE to 0 set, if look for themselves ge?ndert. =  page auf 0 setzen, wenn suche sich ge�ndert hat.
-        if($this->searchChanged == 1)   $_SESSION['search'][$list_name]['page'] = 0;
-
-        $sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page;
-        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
-        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
-
-        $vars['list_file']      = $this->listDef['file'];
-        $vars['page']           = $_SESSION['search'][$list_name]['page'];
-        $vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
-        $vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
-        $vars['pages']          = $pages;
-        $vars['max_pages']      = $pages + 1;
-        $vars['records_gesamt'] = $record_count['anzahl'];
-        $vars['page_params']    = $this->listDef['page_params'];
-
-        if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
-        if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
-
-        $this->pagingValues = $vars;
-        $this->pagingHTML = $this->getPagingHTML($vars);
-
-        return "LIMIT $sql_von, $records_per_page";
-    }
-
-    public function getPagingHTML($vars) {
-        global $app;
-        $page_params = $vars['page_params'];
-        $list_file = $vars['list_file'];
-        $content = '<a href="'.$list_file.'?page=0'.$page_params.'"><img src="../themes/iprg/images/btn_left.png" border="0"></a> &nbsp; ';
-        if($vars['show_page_back'] == 1){
-            $content .= '<a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'"><img src="../themes/iprg/images/btn_back.png" border="0"></a> ';
-        }
-        $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
-        if($vars['show_page_next'] == 1){
-            $content .= '<a href="'.$list_file.'?page='.$vars['next_page'].$page_params.'"><img src="../themes/iprg/images/btn_next.png" border="0"></a> &nbsp; ';
-        } else{
-            $content .= '&nbsp;';
-        }
-        $content .= '<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> <img src="../themes/iprg/images/btn_right.png" border="0"></a>';
-        return $content;
-    }
-		
-    public function getPagingHTMLasTXT($vars)
-    {
-        global $app;
-        $page_params = $vars['page_params'];
-        $list_file = $vars['list_file'];
-        $content = '[<a href="'.$list_file.'?page=0'.$page_params.'">|&lt;&lt; </a>]';
-        if($vars['show_page_back'] == 1){
-            $content .= '[<< <a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'">'.$app->lng('Back').'</a>] ';
-        }
-        $content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
-        if($vars['show_page_next'] == 1){
-            $content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$page_params.'">'.$app->lng('Next').' >></a>] ';
-        }
-        $content .= '[<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> &gt;&gt;|</a>]';
-        return $content;
-    }
-
-    public function getSortSQL()
-    {
-        $sort_field = $this->listDef['sort_field'];
-        $sort_direction = $this->listDef['sort_direction'];
-        return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
-    }
-		
+				$sql_where .= " $field ".$i['op']." '".$i['prefix'].$_SESSION['search'][$list_name][$ki].$i['suffix']."' and";
+			}
+		}
+		return ($sql_where != '') ? substr($sql_where, 0, -3) : '1';
+	}
+
+	public function getPagingSQL($sql_where = '1') {
+		global $app, $conf;
+
+		$list_name          = $this->listDef['name'];
+		$search_prefix      = $this->listDef['search_prefix'];
+		$records_per_page   = $this->listDef['records_per_page'];
+		$table              = $this->listDef['table'];
+
+		//* set page to seror id session not set
+		if($_SESSION['search'][$list_name]['page'] == '')   $_SESSION['search'][$list_name]['page'] = 0;
+
+		//* Set page size to request if set
+		if(isset($_REQUEST['page']))    $_SESSION['search'][$list_name]['page'] = $_REQUEST['page'];
+
+		//* TODO PAGE to 0 set, if look for themselves ge?ndert. =  page auf 0 setzen, wenn suche sich ge�ndert hat.
+		if($this->searchChanged == 1)   $_SESSION['search'][$list_name]['page'] = 0;
+
+		$sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page;
+		$record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
+		$pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);
+
+		$vars['list_file']      = $this->listDef['file'];
+		$vars['page']           = $_SESSION['search'][$list_name]['page'];
+		$vars['last_page']      = $_SESSION['search'][$list_name]['page'] - 1;
+		$vars['next_page']      = $_SESSION['search'][$list_name]['page'] + 1;
+		$vars['pages']          = $pages;
+		$vars['max_pages']      = $pages + 1;
+		$vars['records_gesamt'] = $record_count['anzahl'];
+		$vars['page_params']    = $this->listDef['page_params'];
+
+		if($_SESSION['search'][$list_name]['page'] > 0) $vars['show_page_back'] = 1;
+		if($_SESSION['search'][$list_name]['page'] <= $vars['pages'] - 1) $vars['show_page_next'] = 1;
+
+		$this->pagingValues = $vars;
+		$this->pagingHTML = $this->getPagingHTML($vars);
+
+		return "LIMIT $sql_von, $records_per_page";
+	}
+
+	public function getPagingHTML($vars) {
+		global $app;
+		$page_params = $vars['page_params'];
+		$list_file = $vars['list_file'];
+		$content = '<a href="'.$list_file.'?page=0'.$page_params.'"><img src="../themes/iprg/images/btn_left.png" border="0"></a> &nbsp; ';
+		if($vars['show_page_back'] == 1){
+			$content .= '<a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'"><img src="../themes/iprg/images/btn_back.png" border="0"></a> ';
+		}
+		$content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
+		if($vars['show_page_next'] == 1){
+			$content .= '<a href="'.$list_file.'?page='.$vars['next_page'].$page_params.'"><img src="../themes/iprg/images/btn_next.png" border="0"></a> &nbsp; ';
+		} else{
+			$content .= '&nbsp;';
+		}
+		$content .= '<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> <img src="../themes/iprg/images/btn_right.png" border="0"></a>';
+		return $content;
+	}
+
+	public function getPagingHTMLasTXT($vars)
+	{
+		global $app;
+		$page_params = $vars['page_params'];
+		$list_file = $vars['list_file'];
+		$content = '[<a href="'.$list_file.'?page=0'.$page_params.'">|&lt;&lt; </a>]';
+		if($vars['show_page_back'] == 1){
+			$content .= '[<< <a href="'.$list_file.'?page='.$vars['last_page'].$page_params.'">'.$app->lng('Back').'</a>] ';
+		}
+		$content .= ' '.$app->lng('Page').' '.$vars['next_page'].' '.$app->lng('of').' '.$vars['max_pages'].' ';
+		if($vars['show_page_next'] == 1){
+			$content .= '[<a href="'.$vars['list_file'].'?page='.$vars['next_page'].$page_params.'">'.$app->lng('Next').' >></a>] ';
+		}
+		$content .= '[<a href="'.$list_file.'?page='.$vars['pages'].$page_params.'"> &gt;&gt;|</a>]';
+		return $content;
+	}
+
+	public function getSortSQL()
+	{
+		$sort_field = $this->listDef['sort_field'];
+		$sort_direction = $this->listDef['sort_direction'];
+		return ($sort_field != '' && $sort_direction != '') ? "ORDER BY $sort_field $sort_direction" : '';
+	}
+
 	public function saveSearchSettings($searchresult_name)
-    {
+	{
 		global $app, $conf;
-		
+
 		$list_name = $this->listDef['name'];
 		$settings = $_SESSION['search'][$list_name];
 		unset($settings['page']);
 		$data = $app->db->quote(serialize($settings));
-		
+
 		$userid = $_SESSION['s']['user']['userid'];
 		$groupid = $_SESSION['s']['user']['default_group'];
 		$sys_perm_user = 'riud';
@@ -256,92 +257,93 @@ class searchform {
 		$module = $_SESSION['s']['module']['name'];
 		$searchform = $this->listDef['name'];
 		$title = $searchresult_name;
-		
+
 		$sql = 'INSERT INTO `searchform` ( '
-               .'`sys_userid` , `sys_groupid` , `sys_perm_user` , `sys_perm_group` , `sys_perm_other` , `module` , `searchform` , `title` , `data` '
-               .')VALUES ('
-               ."'$userid', '$groupid', '$sys_perm_user', '$sys_perm_group', '$sys_perm_other', '$module', '$searchform', '$title', '$data')";
+			.'`sys_userid` , `sys_groupid` , `sys_perm_user` , `sys_perm_group` , `sys_perm_other` , `module` , `searchform` , `title` , `data` '
+			.')VALUES ('
+			."'$userid', '$groupid', '$sys_perm_user', '$sys_perm_group', '$sys_perm_other', '$module', '$searchform', '$title', '$data')";
 		$app->db->query($sql);
 	}
 
-    public function decode($record)
-    {
-        global $app;
-        if(is_array($record)) {
-            foreach($this->listDef['item'] as $field) {
-                $key = $field['field'];
-                switch ($field['datatype'])
-                {
-                    case 'DATE':
-                        if($val > 0) {
-                            $record[$key] = date($this->dateformat, $record[$key]);
-                        }
-                        break;
-    
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
-    
-                    case 'DOUBLE':
-                        $record[$key] = $record[$key];
-                        break;
-    
-                    case 'CURRENCY':
-                        $record[$key] = number_format($record[$key], 2, ',', '');
-                        break;
-    
-                    
-                    case 'VARCHAR':
-                    case 'TEXT':
-                    default:
-                        $record[$key] = stripslashes($record[$key]);
-                        break;
-                    }
-            }
-        }
-        return $record;
-    }
-
-    public function encode($record)
-    {
-	global $app;
-        if(is_array($record)) {
-            foreach($this->listDef['item'] as $field) {
-                $key = $field['field'];
-                switch ($field['datatype'])
-                {
-                    case 'VARCHAR':
-                    case 'TEXT':
-                        if(!is_array($record[$key])) {
-                            $record[$key] = $app->db->quote($record[$key]);
-                        } else {
-                            $record[$key] = implode($this->tableDef[$key]['separator'],$record[$key]);
-                        }
-                        break;
-
-                    case 'DATE':
-                        if($record[$key] > 0) {
-                            list($tag, $monat, $jahr) = explode('.', $record[$key]);
-                            $record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
-                        }
-                        break;
-
-                    case 'INTEGER':
-                        $record[$key] = $app->functions->intval($record[$key]);
-                        break;
-
-                    case 'DOUBLE':
-                        $record[$key] = $app->db->quote($record[$key]);
-                        break;
-
-                    case 'CURRENCY':
-                        $record[$key] = str_replace(',', '.', $record[$key]);
-                        break;
-                }
-            }
-        }
-        return $record;
-    }
+	public function decode($record)
+	{
+		global $app;
+		if(is_array($record)) {
+			foreach($this->listDef['item'] as $field) {
+				$key = $field['field'];
+				switch ($field['datatype'])
+				{
+				case 'DATE':
+					if($val > 0) {
+						$record[$key] = date($this->dateformat, $record[$key]);
+					}
+					break;
+
+				case 'INTEGER':
+					$record[$key] = $app->functions->intval($record[$key]);
+					break;
+
+				case 'DOUBLE':
+					$record[$key] = $record[$key];
+					break;
+
+				case 'CURRENCY':
+					$record[$key] = number_format($record[$key], 2, ',', '');
+					break;
+
+
+				case 'VARCHAR':
+				case 'TEXT':
+				default:
+					$record[$key] = stripslashes($record[$key]);
+					break;
+				}
+			}
+		}
+		return $record;
+	}
+
+	public function encode($record)
+	{
+		global $app;
+		if(is_array($record)) {
+			foreach($this->listDef['item'] as $field) {
+				$key = $field['field'];
+				switch ($field['datatype'])
+				{
+				case 'VARCHAR':
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$record[$key] = $app->db->quote($record[$key]);
+					} else {
+						$record[$key] = implode($this->tableDef[$key]['separator'], $record[$key]);
+					}
+					break;
+
+				case 'DATE':
+					if($record[$key] > 0) {
+						list($tag, $monat, $jahr) = explode('.', $record[$key]);
+						$record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
+					}
+					break;
+
+				case 'INTEGER':
+					$record[$key] = $app->functions->intval($record[$key]);
+					break;
+
+				case 'DOUBLE':
+					$record[$key] = $app->db->quote($record[$key]);
+					break;
+
+				case 'CURRENCY':
+					$record[$key] = str_replace(',', '.', $record[$key]);
+					break;
+				}
+			}
+		}
+		return $record;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/searchform_actions.inc.php b/interface/lib/classes/searchform_actions.inc.php
index a451f4a85a6009a38f949047c49ff55250ccd728..e48eb8544de5bfbfe2c5efd2fd419ba1eb184e08 100644
--- a/interface/lib/classes/searchform_actions.inc.php
+++ b/interface/lib/classes/searchform_actions.inc.php
@@ -29,44 +29,44 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class searchform_actions {
-	
+
 	var $id;
 	var $idx_key;
 	var $DataRowColor;
 	var $SQLExtWhere = '';
 	var $SQLOrderBy = '';
-	
+
 	function onLoad() {
 		global $app, $conf, $list_def_file;
-		
+
 		if(!is_object($app->tpl)) $app->uses('tpl');
 		if(!is_object($app->searchform)) $app->uses('searchform');
 		if(!is_object($app->tform)) $app->uses('tform');
-		
+
 		// Load list definition
 		$app->searchform->loadListDef($list_def_file);
-		
+
 		// Delete the search form contents, if requested
 		if($_REQUEST["empty_searchfields"] == 'yes') {
 			$list_name = $app->searchform->listDef["name"];
 			unset($_SESSION["search"][$list_name]);
 		}
-		
+
 		// Save the search for later usage
 		if($_REQUEST["btn_submit_search_save"] && $_REQUEST["search_save_as"] != '') {
 			$app->searchform->saveSearchSettings($_REQUEST["search_save_as"]);
 		}
-		
+
 		// Set th returnto value for forms
 		$_SESSION["s"]["form"]["return_to_url"] = $app->searchform->listDef["file"];
-		
+
 		if(!is_file('templates/'.$app->searchform->listDef["name"].'_search.htm')) {
 			$app->uses('searchform_tpl_generator');
 			$app->searchform_tpl_generator->buildHTML($app->searchform->listDef);
 		}
-		
+
 		$app->tpl->newTemplate("searchpage.tpl.htm");
-		$app->tpl->setInclude('content_tpl','templates/'.$app->searchform->listDef["name"].'_search.htm');
+		$app->tpl->setInclude('content_tpl', 'templates/'.$app->searchform->listDef["name"].'_search.htm');
 
 		// Getting Datasets from DB
 		$records = $app->db->queryAllRecords($this->getQueryString());
@@ -74,30 +74,30 @@ class searchform_actions {
 
 		$this->DataRowColor = "#FFFFFF";
 		if(is_array($records)) {
-			$this->idx_key = $app->searchform->listDef["table_idx"]; 
+			$this->idx_key = $app->searchform->listDef["table_idx"];
 			foreach($records as $rec) {
 				$records_new[] = $this->prepareDataRow($rec);
 			}
 		}
 
-		$app->tpl->setLoop('records',$records_new);
-		
+		$app->tpl->setLoop('records', $records_new);
+
 		//print_r($records_new);
 
 		$this->onShow();
-		
-		
+
+
 	}
-	
+
 	function prepareDataRow($rec) {
 		global $app;
-		
+
 		$rec = $app->searchform->decode($rec);
 
 		// Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
 		$rec["bgcolor"] = $this->DataRowColor;
-		
+
 		// substitute value for select fields
 		foreach($app->searchform->listDef["item"] as $field) {
 			$key = $field["field"];
@@ -110,16 +110,16 @@ class searchform_actions {
 				$rec[$key] = $field['value'][$rec[$key]];
 			}
 		}
-		
+
 		// The variable "id" contains always the index variable
 		$rec["id"] = $rec[$this->idx_key];
-		
+
 		return $rec;
 	}
-	
+
 	function getQueryString() {
 		global $app;
-		
+
 		// Generate the search sql
 		if($app->searchform->listDef["auth"] != 'no') {
 			if($_SESSION["s"]["user"]["typ"] == "admin") {
@@ -128,74 +128,75 @@ class searchform_actions {
 				$sql_where = $app->tform->getAuthSQL('r')." and";
 			}
 		}
-		
+
 		if($this->SQLExtWhere != '') {
 			$sql_where .= " ".$this->SQLExtWhere." and";
 		}
 
 		$sql_where = $app->searchform->getSearchSQL($sql_where);
 		$app->tpl->setVar($app->searchform->searchValues);
-		
+
 		$order_by_sql = $this->SQLOrderBy;
 
 		// Generate SQL for paging
 		$limit_sql = $app->searchform->getPagingSQL($sql_where);
-		$app->tpl->setVar("paging",$app->searchform->pagingHTML);
+		$app->tpl->setVar("paging", $app->searchform->pagingHTML);
 
 		return "SELECT * FROM ".$app->searchform->listDef["table"]." WHERE $sql_where $order_by_sql $limit_sql";
-		
+
 	}
-	
-	
+
+
 	function onShow() {
 		global $app;
-		
+
 		// Language File setzen
 		$lng_file = ISPC_WEB_PATH.'/lang/lib/lang/'.$_SESSION['s']['language'].'_list.lng';
 		if(!file_exists($lng_file)) $lng_file = ISPC_WEB_PATH.'/lang/lib/lang/en_'.'_list.lng';
-		include($lng_file);
+		include $lng_file;
 		$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->searchform->listDef['name']."_search.lng";
 		if(!file_exists($lng_file)) $lng_file = 'lib/lang/en_'.$app->searchform->listDef['name']."_search.lng";
-		include($lng_file);
+		include $lng_file;
 		$app->tpl->setVar($wb);
-		$app->tpl->setVar("form_action",$app->searchform->listDef["file"]);
-		
+		$app->tpl->setVar("form_action", $app->searchform->listDef["file"]);
+
 		// Parse the templates and send output to the browser
 		$this->onShowEnd();
 	}
-	
+
 	function onShowEnd() {
 		global $app;
 
 		if(count($_REQUEST) > 0) {
-			$app->tpl->setVar('searchresult_visible',1);
-			if($_REQUEST['searchresult_visible'] == 'no') $app->tpl->setVar('searchresult_visible',0);
-			
+			$app->tpl->setVar('searchresult_visible', 1);
+			if($_REQUEST['searchresult_visible'] == 'no') $app->tpl->setVar('searchresult_visible', 0);
+
 			if($_REQUEST['searchform_visible'] == 'yes') {
-				$app->tpl->setVar('searchform_visible',1);
+				$app->tpl->setVar('searchform_visible', 1);
 			} else {
-				$app->tpl->setVar('searchform_visible',0);
+				$app->tpl->setVar('searchform_visible', 0);
 			}
 		} else {
-			$app->tpl->setVar('searchform_visible',1);
-			if($_REQUEST['searchform_visible'] == 'no') $app->tpl->setVar('searchform_visible',0);
-			
+			$app->tpl->setVar('searchform_visible', 1);
+			if($_REQUEST['searchform_visible'] == 'no') $app->tpl->setVar('searchform_visible', 0);
+
 			if($_REQUEST['searchresult_visible'] == 'yes') {
-				$app->tpl->setVar('searchresult_visible',1);
+				$app->tpl->setVar('searchresult_visible', 1);
 			} else {
-				$app->tpl->setVar('searchresult_visible',0);
+				$app->tpl->setVar('searchresult_visible', 0);
 			}
 		}
-		
+
 		// make columns visible
-		$visible_columns = explode(",",$app->searchform->listDef['default_columns']);
+		$visible_columns = explode(",", $app->searchform->listDef['default_columns']);
 		foreach($visible_columns as $col) {
-			$app->tpl->setVar($col.'_visible',1);
+			$app->tpl->setVar($col.'_visible', 1);
 		}
-		
+
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/searchform_tpl_generator.inc.php b/interface/lib/classes/searchform_tpl_generator.inc.php
index 4232e3b9d71524a79d25f860fafe75f9b3379d10..81e2f4ef1a6ee42c0b948c64742b958faf1a4007 100644
--- a/interface/lib/classes/searchform_tpl_generator.inc.php
+++ b/interface/lib/classes/searchform_tpl_generator.inc.php
@@ -29,11 +29,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class searchform_tpl_generator {
-	
-	function buildHTML($listDef,$module = '') {
-		
+
+	function buildHTML($listDef, $module = '') {
+
 		global $app;
-		
+
 		$lang = array();
 		$html = '<form name="myform" action="'.$listDef["file"].'" method="POST">
 <div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br />
@@ -43,23 +43,23 @@ class searchform_tpl_generator {
 		$lang["list_head_txt"] = $listDef["name"];
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
-			
+
 			if($field["formtype"] == 'SELECT') {
 				$html .= "
   <tr>
     <td class=\"frmText11\"><tmpl_var name=\"".$key."_txt\">:</td>
 	<td><select name=\"".$listDef["search_prefix"].$key."\">{tmpl_var name='".$listDef["search_prefix"].$key."'}</select></td>
   </tr>";
-  			} else {
+			} else {
 				$html .= "
   <tr>
     <td class=\"frmText11\"><tmpl_var name=\"".$key."_txt\">:</td>
 	<td><input type=\"text\" name=\"".$listDef["search_prefix"].$key."\" value=\"{tmpl_var name='".$listDef["search_prefix"].$key."'}\" class=\"text\" /></td>
   </tr>";
-  			}
+			}
 		}
 
-$html .= '
+		$html .= '
   <tr>
     <td colspan="2" align="center"><input name="Filter" type="image" id="Filter" src="../themes/iprg/images/btn_filter.png"></td>
   </tr>
@@ -67,14 +67,14 @@ $html .= '
 </tmpl_if>
 <tmpl_if name="searchresult_visible">
 <p>
-[<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=yes">Neue Suche</a>] 
+[<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=yes">Neue Suche</a>]
 [<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=no">Suchkriterien ändern</a>]
-Suche speichern unter: <input type="text" name="search_save_as" /> <input type="submit" name="btn_submit_search_save" value="Speichern" /> 
+Suche speichern unter: <input type="text" name="search_save_as" /> <input type="submit" name="btn_submit_search_save" value="Speichern" />
 </p>
 <table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
 ';
-		
+
 		$lang["list_head_txt"] = $listDef["name"];
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
@@ -83,25 +83,25 @@ Suche speichern unter: <input type="text" name="search_save_as" /> <input type="
 			$html .= "</tmpl_if>";
 			$lang[$key."_txt"] = $key;
 		}
-		
+
 		$html .= '    <td class="tblHead">&nbsp;</td>
   </tr>
   <tmpl_loop name="records">
   <tr bgcolor="{tmpl_var name="bgcolor"}">
 ';
-		
+
 		foreach($listDef["item"] as $field) {
 			$key = $field["field"];
 			$html .= "<tmpl_if name='".$key."_visible'>";
 			$html .= "    <td class=\"frmText11\"><a href=\"".$listDef["edit_file"]."?id={tmpl_var name='id'}\" class=\"frmText11\">{tmpl_var name=\"".$key."\"}</a></td>\r\n";
 			$html .= "</tmpl_if>";
 		}
-		
+
 		$html .= "    <td class=\"frmText11\" align=\"right\">[<a href=\"javascript: del_record('".$listDef["delete_file"]."?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');\" class=\"frmText11\">{tmpl_var name='delete_txt'}</a>]</td>
   </tr>
   </tmpl_loop>
 ";
-  $html .= '
+		$html .= '
 </table><table width="100%" border="0" cellspacing="0" cellpadding="4">
   <tr>
   	<td height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td>
@@ -109,28 +109,28 @@ Suche speichern unter: <input type="text" name="search_save_as" /> <input type="
 </table>
 </tmpl_if>
 </form>';
-		
+
 		if($module == '') {
 			$filename = 'templates/'.$listDef["name"].'_search.htm';
 		} else {
 			$filename = '../'.$module.'/templates/'.$listDef["name"].'_search.htm';
 		}
-		
-		
+
+
 		// speichere Template
-		if (!$handle = fopen($filename, 'w')) { 
-        	print "Cannot open file ($filename)"; 
-        	exit; 
-   		} 
- 
-   		if (!fwrite($handle, $html)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $html)) {
+			print "Cannot write to file ($filename)";
+			exit;
 		}
 		fclose($handle);
-		
-    }
-	
+
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/session.inc.php b/interface/lib/classes/session.inc.php
index dc12800696620503ea95bb339f9a20aedd5af524..be0ca84ab0c8dde9657e3396aa813f7a777fd607 100644
--- a/interface/lib/classes/session.inc.php
+++ b/interface/lib/classes/session.inc.php
@@ -29,101 +29,101 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class session {
-	
+
 	private $session_array = array();
 	private $db;
-	
+
 	function __construct() {
 		$this->db = new db;
 	}
-	
+
 	function open ($save_path, $session_name) {
 		return true;
 	}
-	
+
 	function close () {
 
 		if (!empty($this->session_array)) {
-            $result = $this->gc(ini_get('session.gc_maxlifetime'));
-            return $result;
-        }
-        return false;
-    }
-	
+			$result = $this->gc(ini_get('session.gc_maxlifetime'));
+			return $result;
+		}
+		return false;
+	}
+
 	function read ($session_id) {
-		
+
 		$rec = $this->db->queryOneRecord("SELECT * FROM sys_session WHERE session_id = '".$this->db->quote($session_id)."'");
 
-        if (is_array($rec)) {
+		if (is_array($rec)) {
 			$this->session_array = $rec;
 			return $this->session_array['session_data'];
 		} else {
 			return '';
 		}
 	}
-	
+
 	function write ($session_id, $session_data) {
-		
+
 		if (!empty($this->session_array) && $this->session_array['session_id'] != $session_id) {
-            $this->session_array = array();
-        }
-		
+			$this->session_array = array();
+		}
+
 		// Dont write session_data to DB if session data has not been changed after reading it.
 		if(isset($this->session_array['session_data']) && $this->session_array['session_data'] != '' && $this->session_array['session_data'] == $session_data) {
 			$session_id   = $this->db->quote($session_id);
 			$last_updated = date('Y-m-d H:i:s');
-            $this->db->query("UPDATE sys_session SET last_updated = '$last_updated' WHERE session_id = '$session_id'");
+			$this->db->query("UPDATE sys_session SET last_updated = '$last_updated' WHERE session_id = '$session_id'");
 			return true;
 		}
-		
 
-        if (@$this->session_array['session_id'] == '') {
+
+		if (@$this->session_array['session_id'] == '') {
 			$session_id   = $this->db->quote($session_id);
-            $date_created = date('Y-m-d H:i:s');
-            $last_updated = date('Y-m-d H:i:s');
-            $session_data = $this->db->quote($session_data);
+			$date_created = date('Y-m-d H:i:s');
+			$last_updated = date('Y-m-d H:i:s');
+			$session_data = $this->db->quote($session_data);
 			$sql = "INSERT INTO sys_session (session_id,date_created,last_updated,session_data) VALUES ('$session_id','$date_created','$last_updated','$session_data')";
 			$this->db->query($sql);
 
-        } else {
-            $session_id   = $this->db->quote($session_id);
+		} else {
+			$session_id   = $this->db->quote($session_id);
 			$last_updated = date('Y-m-d H:i:s');
-            $session_data = $this->db->quote($session_data);
-            $sql = "UPDATE sys_session SET last_updated = '$last_updated', session_data = '$session_data' WHERE session_id = '$session_id'";
+			$session_data = $this->db->quote($session_data);
+			$sql = "UPDATE sys_session SET last_updated = '$last_updated', session_data = '$session_data' WHERE session_id = '$session_id'";
 			$this->db->query($sql);
 
-        }
-		
-        return true;
-    }
-	
+		}
+
+		return true;
+	}
+
 	function destroy ($session_id) {
 
 		$session_id   = $this->db->quote($session_id);
 		$sql = "DELETE FROM sys_session WHERE session_id = '$session_id'";
 		$this->db->query($sql);
-        
-        return true;
-    }
-	
+
+		return true;
+	}
+
 	function gc ($max_lifetime) {
 
 		$real_now = date('Y-m-d H:i:s');
-        $dt1 = strtotime("$real_now -$max_lifetime seconds");
-        $dt2 = date('Y-m-d H:i:s', $dt1);
-		
+		$dt1 = strtotime("$real_now -$max_lifetime seconds");
+		$dt2 = date('Y-m-d H:i:s', $dt1);
+
 		$sql = "DELETE FROM sys_session WHERE last_updated < '$dt2'";
 		$this->db->query($sql);
-        
-        return true;
-        
-    }
+
+		return true;
+
+	}
 
 	function __destruct () {
-        @session_write_close();
+		@session_write_close();
 
-    }
+	}
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/simplepie.inc.php b/interface/lib/classes/simplepie.inc.php
index 4fcb2c3a7ba92d869d32e940e79408f57c878f20..5d36c09d34b62c7bf2fb1b235099b5344ac6de99 100644
--- a/interface/lib/classes/simplepie.inc.php
+++ b/interface/lib/classes/simplepie.inc.php
@@ -11,16 +11,16 @@
  * 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 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.
+ *  * 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 the SimplePie Team nor the names of its contributors may be used
- * 	  to endorse or promote products derived from this software without specific prior
- * 	  written permission.
+ *  * Neither the name of the SimplePie Team 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
@@ -43,6 +43,7 @@
  * @todo phpDoc comments
  */
 
+
 /**
  * SimplePie Name
  */
@@ -395,6 +396,7 @@ define('SIMPLEPIE_FILE_SOURCE_FILE_GET_CONTENTS', 16);
  */
 class simplepie
 {
+
 	/**
 	 * @var array Raw data
 	 * @access private
@@ -711,6 +713,7 @@ class simplepie
 	 */
 	var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style');
 
+
 	/**
 	 * The SimplePie class contains feed level data and options
 	 *
@@ -756,6 +759,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Used for converting object to a string
 	 */
@@ -764,6 +768,7 @@ class simplepie
 		return md5(serialize($this->data));
 	}
 
+
 	/**
 	 * Remove items that link back to this before destroying this object
 	 */
@@ -790,6 +795,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Force the given data/URL to be treated as a feed no matter what it
 	 * appears like
@@ -803,6 +809,7 @@ class simplepie
 		$this->force_feed = (bool) $enable;
 	}
 
+
 	/**
 	 * This is the URL of the feed you want to parse.
 	 *
@@ -835,6 +842,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Provides an instance of SimplePie_File to use as a feed
 	 *
@@ -853,6 +861,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to use a string of RSS/Atom data instead of a remote feed.
 	 *
@@ -870,6 +879,7 @@ class simplepie
 		$this->raw_data = $data;
 	}
 
+
 	/**
 	 * Allows you to override the default timeout for fetching remote feeds.
 	 *
@@ -885,6 +895,7 @@ class simplepie
 		$this->timeout = (int) $timeout;
 	}
 
+
 	/**
 	 * Forces SimplePie to use fsockopen() instead of the preferred cURL
 	 * functions.
@@ -898,6 +909,7 @@ class simplepie
 		$this->force_fsockopen = (bool) $enable;
 	}
 
+
 	/**
 	 * Outputs the raw XML content of the feed, after it has gone through
 	 * SimplePie's filters.
@@ -918,6 +930,7 @@ class simplepie
 		$this->xml_dump = (bool) $enable;
 	}
 
+
 	/**
 	 * Enables/disables caching in SimplePie.
 	 *
@@ -933,6 +946,7 @@ class simplepie
 		$this->cache = (bool) $enable;
 	}
 
+
 	/**
 	 * Set the length of time (in seconds) that the contents of a feed
 	 * will be cached.
@@ -945,6 +959,7 @@ class simplepie
 		$this->cache_duration = (int) $seconds;
 	}
 
+
 	/**
 	 * Set the length of time (in seconds) that the autodiscovered feed
 	 * URL will be cached.
@@ -957,6 +972,7 @@ class simplepie
 		$this->autodiscovery_cache_duration = (int) $seconds;
 	}
 
+
 	/**
 	 * Set the file system location where the cached files should be stored.
 	 *
@@ -968,6 +984,7 @@ class simplepie
 		$this->cache_location = (string) $location;
 	}
 
+
 	/**
 	 * Determines whether feed items should be sorted into reverse chronological order.
 	 *
@@ -979,6 +996,7 @@ class simplepie
 		$this->order_by_date = (bool) $enable;
 	}
 
+
 	/**
 	 * Allows you to override the character encoding reported by the feed.
 	 *
@@ -997,6 +1015,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Set how much feed autodiscovery to do
 	 *
@@ -1016,6 +1035,7 @@ class simplepie
 		$this->autodiscovery = (int) $level;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for caching.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1035,6 +1055,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for auto-discovery.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1054,6 +1075,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for XML parsing.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1073,6 +1095,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for remote file fetching.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1092,6 +1115,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for data sanitization.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1111,6 +1135,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for handling feed items.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1130,6 +1155,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for handling author data.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1149,6 +1175,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for handling category data.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1168,6 +1195,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for feed enclosures.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1187,6 +1215,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:text> captions
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1206,6 +1235,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:copyright>
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1225,6 +1255,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:credit>
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1244,6 +1275,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:rating>
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1263,6 +1295,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for <media:restriction>
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1282,6 +1315,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses for content-type sniffing.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1301,6 +1335,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to change which class SimplePie uses item sources.
 	 * Useful when you are overloading or extending SimplePie's default classes.
@@ -1320,6 +1355,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * Allows you to override the default user agent string.
 	 *
@@ -1331,6 +1367,7 @@ class simplepie
 		$this->useragent = (string) $ua;
 	}
 
+
 	/**
 	 * Set callback function to create cache filename with
 	 *
@@ -1345,6 +1382,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Set javascript query string parameter
 	 *
@@ -1363,6 +1401,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Set options to make SP as fast as possible.  Forgoes a
 	 * substantial amount of data sanitization in favor of speed.
@@ -1383,6 +1422,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Set maximum number of feeds to check with autodiscovery
 	 *
@@ -1436,6 +1476,7 @@ class simplepie
 		$this->sanitize->strip_comments($strip);
 	}
 
+
 	/**
 	 * Set element/attribute key/value pairs of HTML attributes
 	 * containing URLs that need to be resolved relative to the feed
@@ -1449,6 +1490,7 @@ class simplepie
 		$this->sanitize->set_url_replacements($element_attribute);
 	}
 
+
 	/**
 	 * Set the handler to enable the display of cached favicons.
 	 *
@@ -1468,6 +1510,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Set the handler to enable the display of cached images.
 	 *
@@ -1487,6 +1530,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Set the limit for items returned per-feed with multifeeds.
 	 *
@@ -1830,6 +1874,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Return the error message for the occured error
 	 *
@@ -1879,16 +1924,16 @@ class simplepie
 			elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
 			{
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
 				{
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
 				}
 				if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
-				|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
+					|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
 				{
 					$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
 				}
@@ -1900,38 +1945,38 @@ class simplepie
 				{
 					switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
 					{
-						case '0.91':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
-							if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
+					case '0.91':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
+						if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
+						{
+							switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
 							{
-								switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
-								{
-									case '0':
-										$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
-										break;
+							case '0':
+								$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
+								break;
 
-									case '24':
-										$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
-										break;
-								}
+							case '24':
+								$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
+								break;
 							}
-							break;
+						}
+						break;
 
-						case '0.92':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
-							break;
+					case '0.92':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
+						break;
 
-						case '0.93':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
-							break;
+					case '0.93':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
+						break;
 
-						case '0.94':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
-							break;
+					case '0.94':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
+						break;
 
-						case '2.0':
-							$this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
-							break;
+					case '2.0':
+						$this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
+						break;
 					}
 				}
 			}
@@ -1943,6 +1988,7 @@ class simplepie
 		return $this->data['type'];
 	}
 
+
 	/**
 	 * Returns the URL for the favicon of the feed's website.
 	 *
@@ -2004,6 +2050,7 @@ class simplepie
 		return false;
 	}
 
+
 	/**
 	 * @todo If we have a perm redirect we should return the new URL
 	 * @todo When we make the above change, let's support <itunes:new-feed-url> as well
@@ -2069,6 +2116,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Creates the subscribe_* methods' return data
 	 *
@@ -2577,6 +2625,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * Added for parity between the parent-level and the item/entry-level.
 	 */
@@ -2774,7 +2823,7 @@ class simplepie
 
 	function get_latitude()
 	{
-		
+
 		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
 		{
 			return (float) $return[0]['data'];
@@ -3048,6 +3097,7 @@ class simplepie
 		}
 	}
 
+
 	/**
 	 * @static
 	 */
@@ -3056,6 +3106,7 @@ class simplepie
 		return $a->get_date('U') <= $b->get_date('U');
 	}
 
+
 	/**
 	 * @static
 	 */
@@ -3106,6 +3157,7 @@ class simplepie
 			return array();
 		}
 	}
+
 }
 
 class SimplePie_Item
@@ -3124,6 +3176,7 @@ class SimplePie_Item
 		return md5(serialize($this->data));
 	}
 
+
 	/**
 	 * Remove items that link back to this before destroying this object
 	 */
@@ -3621,14 +3674,14 @@ class SimplePie_Item
 			$date_format = (string) $date_format;
 			switch ($date_format)
 			{
-				case '':
-					return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
+			case '':
+				return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
 
-				case 'U':
-					return $this->data['date']['parsed'];
+			case 'U':
+				return $this->data['date']['parsed'];
 
-				default:
-					return date($date_format, $this->data['date']['parsed']);
+			default:
+				return date($date_format, $this->data['date']['parsed']);
 			}
 		}
 		else
@@ -3758,6 +3811,7 @@ class SimplePie_Item
 		}
 	}
 
+
 	/**
 	 * @todo Add ability to prefer one type of content over another (in a media group).
 	 */
@@ -3774,6 +3828,7 @@ class SimplePie_Item
 		}
 	}
 
+
 	/**
 	 * Grabs all available enclosures (podcasts, etc.)
 	 *
@@ -5626,6 +5681,7 @@ class SimplePie_Item
 		}
 	}
 
+
 	/**
 	 * Creates the add_to_* methods' return data
 	 *
@@ -5725,6 +5781,7 @@ class SimplePie_Item
 	{
 		return $this->add_to_service('http://www.technorati.com/search/');
 	}
+
 }
 
 class SimplePie_Source
@@ -6043,6 +6100,7 @@ class SimplePie_Source
 		}
 	}
 
+
 	/**
 	 * Added for parity between the parent-level and the item/entry-level.
 	 */
@@ -6276,6 +6334,7 @@ class SimplePie_Source
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Author
@@ -6333,6 +6392,7 @@ class SimplePie_Author
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Category
@@ -6390,6 +6450,7 @@ class SimplePie_Category
 			return $this->get_term();
 		}
 	}
+
 }
 
 class SimplePie_Enclosure
@@ -6914,6 +6975,7 @@ class SimplePie_Enclosure
 		return $this->embed($options, true);
 	}
 
+
 	/**
 	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
 	 */
@@ -6950,45 +7012,45 @@ class SimplePie_Enclosure
 					$opt[1] = trim($opt[1]);
 					switch ($opt[0])
 					{
-						case 'audio':
-							$audio = $opt[1];
-							break;
+					case 'audio':
+						$audio = $opt[1];
+						break;
 
-						case 'video':
-							$video = $opt[1];
-							break;
+					case 'video':
+						$video = $opt[1];
+						break;
 
-						case 'alt':
-							$alt = $opt[1];
-							break;
+					case 'alt':
+						$alt = $opt[1];
+						break;
 
-						case 'altclass':
-							$altclass = $opt[1];
-							break;
+					case 'altclass':
+						$altclass = $opt[1];
+						break;
 
-						case 'loop':
-							$loop = $opt[1];
-							break;
+					case 'loop':
+						$loop = $opt[1];
+						break;
 
-						case 'width':
-							$width = $opt[1];
-							break;
+					case 'width':
+						$width = $opt[1];
+						break;
 
-						case 'height':
-							$height = $opt[1];
-							break;
+					case 'height':
+						$height = $opt[1];
+						break;
 
-						case 'bgcolor':
-							$bgcolor = $opt[1];
-							break;
+					case 'bgcolor':
+						$bgcolor = $opt[1];
+						break;
 
-						case 'mediaplayer':
-							$mediaplayer = $opt[1];
-							break;
+					case 'mediaplayer':
+						$mediaplayer = $opt[1];
+						break;
 
-						case 'widescreen':
-							$widescreen = $opt[1];
-							break;
+					case 'widescreen':
+						$widescreen = $opt[1];
+						break;
 					}
 				}
 			}
@@ -7175,7 +7237,7 @@ class SimplePie_Enclosure
 
 		// Mime-types by handler.
 		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
-		$types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
+		$types_fmedia = array('video/flv', 'video/x-flv', 'flv-application/octet-stream'); // Flash Media Player
 		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
 		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
 		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
@@ -7195,121 +7257,121 @@ class SimplePie_Enclosure
 			switch (strtolower($this->get_extension()))
 			{
 				// Audio mime-types
-				case 'aac':
-				case 'adts':
-					$type = 'audio/acc';
-					break;
+			case 'aac':
+			case 'adts':
+				$type = 'audio/acc';
+				break;
 
-				case 'aif':
-				case 'aifc':
-				case 'aiff':
-				case 'cdda':
-					$type = 'audio/aiff';
-					break;
+			case 'aif':
+			case 'aifc':
+			case 'aiff':
+			case 'cdda':
+				$type = 'audio/aiff';
+				break;
 
-				case 'bwf':
-					$type = 'audio/wav';
-					break;
+			case 'bwf':
+				$type = 'audio/wav';
+				break;
 
-				case 'kar':
-				case 'mid':
-				case 'midi':
-				case 'smf':
-					$type = 'audio/midi';
-					break;
+			case 'kar':
+			case 'mid':
+			case 'midi':
+			case 'smf':
+				$type = 'audio/midi';
+				break;
 
-				case 'm4a':
-					$type = 'audio/x-m4a';
-					break;
+			case 'm4a':
+				$type = 'audio/x-m4a';
+				break;
 
-				case 'mp3':
-				case 'swa':
-					$type = 'audio/mp3';
-					break;
+			case 'mp3':
+			case 'swa':
+				$type = 'audio/mp3';
+				break;
 
-				case 'wav':
-					$type = 'audio/wav';
-					break;
+			case 'wav':
+				$type = 'audio/wav';
+				break;
 
-				case 'wax':
-					$type = 'audio/x-ms-wax';
-					break;
+			case 'wax':
+				$type = 'audio/x-ms-wax';
+				break;
 
-				case 'wma':
-					$type = 'audio/x-ms-wma';
-					break;
+			case 'wma':
+				$type = 'audio/x-ms-wma';
+				break;
 
 				// Video mime-types
-				case '3gp':
-				case '3gpp':
-					$type = 'video/3gpp';
-					break;
+			case '3gp':
+			case '3gpp':
+				$type = 'video/3gpp';
+				break;
 
-				case '3g2':
-				case '3gp2':
-					$type = 'video/3gpp2';
-					break;
+			case '3g2':
+			case '3gp2':
+				$type = 'video/3gpp2';
+				break;
 
-				case 'asf':
-					$type = 'video/x-ms-asf';
-					break;
+			case 'asf':
+				$type = 'video/x-ms-asf';
+				break;
 
-				case 'flv':
-					$type = 'video/x-flv';
-					break;
+			case 'flv':
+				$type = 'video/x-flv';
+				break;
 
-				case 'm1a':
-				case 'm1s':
-				case 'm1v':
-				case 'm15':
-				case 'm75':
-				case 'mp2':
-				case 'mpa':
-				case 'mpeg':
-				case 'mpg':
-				case 'mpm':
-				case 'mpv':
-					$type = 'video/mpeg';
-					break;
+			case 'm1a':
+			case 'm1s':
+			case 'm1v':
+			case 'm15':
+			case 'm75':
+			case 'mp2':
+			case 'mpa':
+			case 'mpeg':
+			case 'mpg':
+			case 'mpm':
+			case 'mpv':
+				$type = 'video/mpeg';
+				break;
 
-				case 'm4v':
-					$type = 'video/x-m4v';
-					break;
+			case 'm4v':
+				$type = 'video/x-m4v';
+				break;
 
-				case 'mov':
-				case 'qt':
-					$type = 'video/quicktime';
-					break;
+			case 'mov':
+			case 'qt':
+				$type = 'video/quicktime';
+				break;
 
-				case 'mp4':
-				case 'mpg4':
-					$type = 'video/mp4';
-					break;
+			case 'mp4':
+			case 'mpg4':
+				$type = 'video/mp4';
+				break;
 
-				case 'sdv':
-					$type = 'video/sd-video';
-					break;
+			case 'sdv':
+				$type = 'video/sd-video';
+				break;
 
-				case 'wm':
-					$type = 'video/x-ms-wm';
-					break;
+			case 'wm':
+				$type = 'video/x-ms-wm';
+				break;
 
-				case 'wmv':
-					$type = 'video/x-ms-wmv';
-					break;
+			case 'wmv':
+				$type = 'video/x-ms-wmv';
+				break;
 
-				case 'wvx':
-					$type = 'video/x-ms-wvx';
-					break;
+			case 'wvx':
+				$type = 'video/x-ms-wvx';
+				break;
 
 				// Flash mime-types
-				case 'spl':
-					$type = 'application/futuresplash';
-					break;
+			case 'spl':
+				$type = 'application/futuresplash';
+				break;
 
-				case 'swf':
-					$type = 'application/x-shockwave-flash';
-					break;
+			case 'swf':
+				$type = 'application/x-shockwave-flash';
+				break;
 			}
 		}
 
@@ -7345,6 +7407,7 @@ class SimplePie_Enclosure
 			return $type;
 		}
 	}
+
 }
 
 class SimplePie_Caption
@@ -7430,6 +7493,7 @@ class SimplePie_Caption
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Credit
@@ -7487,6 +7551,7 @@ class SimplePie_Credit
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Copyright
@@ -7530,6 +7595,7 @@ class SimplePie_Copyright
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Rating
@@ -7573,6 +7639,7 @@ class SimplePie_Rating
 			return null;
 		}
 	}
+
 }
 
 class SimplePie_Restriction
@@ -7630,6 +7697,7 @@ class SimplePie_Restriction
 			return null;
 		}
 	}
+
 }
 
 /**
@@ -7810,35 +7878,35 @@ class SimplePie_File
 								// Hey, we act dumb elsewhere, so let's do that here too
 								switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20")))
 								{
-									case 'gzip':
-									case 'x-gzip':
-										$decoder = new SimplePie_gzdecode($this->body);
-										if (!$decoder->parse())
-										{
-											$this->error = 'Unable to decode HTTP "gzip" stream';
-											$this->success = false;
-										}
-										else
-										{
-											$this->body = $decoder->data;
-										}
-										break;
+								case 'gzip':
+								case 'x-gzip':
+									$decoder = new SimplePie_gzdecode($this->body);
+									if (!$decoder->parse())
+									{
+										$this->error = 'Unable to decode HTTP "gzip" stream';
+										$this->success = false;
+									}
+									else
+									{
+										$this->body = $decoder->data;
+									}
+									break;
 
-									case 'deflate':
-										if (($body = gzuncompress($this->body)) === false)
+								case 'deflate':
+									if (($body = gzuncompress($this->body)) === false)
+									{
+										if (($body = gzinflate($this->body)) === false)
 										{
-											if (($body = gzinflate($this->body)) === false)
-											{
-												$this->error = 'Unable to decode HTTP "deflate" stream';
-												$this->success = false;
-											}
+											$this->error = 'Unable to decode HTTP "deflate" stream';
+											$this->success = false;
 										}
-										$this->body = $body;
-										break;
+									}
+									$this->body = $body;
+									break;
 
-									default:
-										$this->error = 'Unknown content coding';
-										$this->success = false;
+								default:
+									$this->error = 'Unknown content coding';
+									$this->success = false;
 								}
 							}
 						}
@@ -7862,6 +7930,7 @@ class SimplePie_File
 			}
 		}
 	}
+
 }
 
 /**
@@ -7871,6 +7940,7 @@ class SimplePie_File
  */
 class SimplePie_HTTP_Parser
 {
+
 	/**
 	 * HTTP Version
 	 *
@@ -7959,6 +8029,7 @@ class SimplePie_HTTP_Parser
 	 */
 	var $value = '';
 
+
 	/**
 	 * Create an instance of the class with the input data
 	 *
@@ -7971,6 +8042,7 @@ class SimplePie_HTTP_Parser
 		$this->data_length = strlen($this->data);
 	}
 
+
 	/**
 	 * Parse the input data
 	 *
@@ -8000,6 +8072,7 @@ class SimplePie_HTTP_Parser
 		}
 	}
 
+
 	/**
 	 * Check whether there is data beyond the pointer
 	 *
@@ -8011,6 +8084,7 @@ class SimplePie_HTTP_Parser
 		return (bool) ($this->position < $this->data_length);
 	}
 
+
 	/**
 	 * See if the next character is LWS
 	 *
@@ -8026,6 +8100,7 @@ class SimplePie_HTTP_Parser
 				&& ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
 	}
 
+
 	/**
 	 * Parse the HTTP version
 	 *
@@ -8055,6 +8130,7 @@ class SimplePie_HTTP_Parser
 		}
 	}
 
+
 	/**
 	 * Parse the status code
 	 *
@@ -8074,6 +8150,7 @@ class SimplePie_HTTP_Parser
 		}
 	}
 
+
 	/**
 	 * Parse the reason phrase
 	 *
@@ -8087,6 +8164,7 @@ class SimplePie_HTTP_Parser
 		$this->state = 'new_line';
 	}
 
+
 	/**
 	 * Deal with a new line, shifting data around as needed
 	 *
@@ -8125,6 +8203,7 @@ class SimplePie_HTTP_Parser
 		}
 	}
 
+
 	/**
 	 * Parse a header name
 	 *
@@ -8153,6 +8232,7 @@ class SimplePie_HTTP_Parser
 		}
 	}
 
+
 	/**
 	 * Parse LWS, replacing consecutive LWS characters with a single space
 	 *
@@ -8175,6 +8255,7 @@ class SimplePie_HTTP_Parser
 		$this->value .= "\x20";
 	}
 
+
 	/**
 	 * See what state to move to while within non-quoted header values
 	 *
@@ -8190,23 +8271,24 @@ class SimplePie_HTTP_Parser
 		{
 			switch ($this->data[$this->position])
 			{
-				case '"':
-					$this->position++;
-					$this->state = 'quote';
-					break;
+			case '"':
+				$this->position++;
+				$this->state = 'quote';
+				break;
 
-				case "\x0A":
-					$this->position++;
-					$this->state = 'new_line';
-					break;
+			case "\x0A":
+				$this->position++;
+				$this->state = 'new_line';
+				break;
 
-				default:
-					$this->state = 'value_char';
-					break;
+			default:
+				$this->state = 'value_char';
+				break;
 			}
 		}
 	}
 
+
 	/**
 	 * Parse a header value while outside quotes
 	 *
@@ -8220,6 +8302,7 @@ class SimplePie_HTTP_Parser
 		$this->state = 'value';
 	}
 
+
 	/**
 	 * See what state to move to while within quoted header values
 	 *
@@ -8235,28 +8318,29 @@ class SimplePie_HTTP_Parser
 		{
 			switch ($this->data[$this->position])
 			{
-				case '"':
-					$this->position++;
-					$this->state = 'value';
-					break;
+			case '"':
+				$this->position++;
+				$this->state = 'value';
+				break;
 
-				case "\x0A":
-					$this->position++;
-					$this->state = 'new_line';
-					break;
+			case "\x0A":
+				$this->position++;
+				$this->state = 'new_line';
+				break;
 
-				case '\\':
-					$this->position++;
-					$this->state = 'quote_escaped';
-					break;
+			case '\\':
+				$this->position++;
+				$this->state = 'quote_escaped';
+				break;
 
-				default:
-					$this->state = 'quote_char';
-					break;
+			default:
+				$this->state = 'quote_char';
+				break;
 			}
 		}
 	}
 
+
 	/**
 	 * Parse a header value while within quotes
 	 *
@@ -8270,6 +8354,7 @@ class SimplePie_HTTP_Parser
 		$this->state = 'value';
 	}
 
+
 	/**
 	 * Parse an escaped character within quotes
 	 *
@@ -8282,6 +8367,7 @@ class SimplePie_HTTP_Parser
 		$this->state = 'quote';
 	}
 
+
 	/**
 	 * Parse the body
 	 *
@@ -8292,6 +8378,7 @@ class SimplePie_HTTP_Parser
 		$this->body = substr($this->data, $this->position);
 		$this->state = 'emit';
 	}
+
 }
 
 /**
@@ -8301,6 +8388,7 @@ class SimplePie_HTTP_Parser
  */
 class SimplePie_gzdecode
 {
+
 	/**
 	 * Compressed data
 	 *
@@ -8407,6 +8495,7 @@ class SimplePie_gzdecode
 	 */
 	var $comment;
 
+
 	/**
 	 * Don't allow anything to be set
 	 *
@@ -8417,6 +8506,7 @@ class SimplePie_gzdecode
 		trigger_error("Cannot write property $name", E_USER_ERROR);
 	}
 
+
 	/**
 	 * Set the compressed string and related properties
 	 *
@@ -8428,6 +8518,7 @@ class SimplePie_gzdecode
 		$this->compressed_size = strlen($data);
 	}
 
+
 	/**
 	 * Decode the GZIP stream
 	 *
@@ -8602,10 +8693,13 @@ class SimplePie_gzdecode
 			return false;
 		}
 	}
+
 }
 
 class SimplePie_Cache
 {
+
+
 	/**
 	 * Don't call the constructor. Please.
 	 *
@@ -8616,6 +8710,7 @@ class SimplePie_Cache
 		trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
 	}
 
+
 	/**
 	 * Create a new SimplePie_Cache object
 	 *
@@ -8627,17 +8722,18 @@ class SimplePie_Cache
 		$location_iri = new SimplePie_IRI($location);
 		switch ($location_iri->get_scheme())
 		{
-			case 'mysql':
-				if (extension_loaded('mysql'))
-				{
-					return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
-				}
-				break;
+		case 'mysql':
+			if (extension_loaded('mysql'))
+			{
+				return new SimplePie_Cache_MySQL($location_iri, $filename, $extension);
+			}
+			break;
 
-			default:
-				return new SimplePie_Cache_File($location, $filename, $extension);
+		default:
+			return new SimplePie_Cache_File($location, $filename, $extension);
 		}
 	}
+
 }
 
 class SimplePie_Cache_File
@@ -8719,6 +8815,7 @@ class SimplePie_Cache_File
 		}
 		return false;
 	}
+
 }
 
 class SimplePie_Cache_DB
@@ -8799,6 +8896,7 @@ class SimplePie_Cache_DB
 		}
 		return array(serialize($data->data), $items_by_id);
 	}
+
 }
 
 class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
@@ -9071,6 +9169,7 @@ class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
 			return false;
 		}
 	}
+
 }
 
 class SimplePie_Misc
@@ -9225,18 +9324,18 @@ class SimplePie_Misc
 		{
 			switch ($level)
 			{
-				case E_USER_ERROR:
-					$note = 'PHP Error';
-					break;
-				case E_USER_WARNING:
-					$note = 'PHP Warning';
-					break;
-				case E_USER_NOTICE:
-					$note = 'PHP Notice';
-					break;
-				default:
-					$note = 'Unknown Error';
-					break;
+			case E_USER_ERROR:
+				$note = 'PHP Error';
+				break;
+			case E_USER_WARNING:
+				$note = 'PHP Warning';
+				break;
+			case E_USER_NOTICE:
+				$note = 'PHP Notice';
+				break;
+			default:
+				$note = 'Unknown Error';
+				break;
 			}
 
 			$log_error = true;
@@ -9260,6 +9359,7 @@ class SimplePie_Misc
 		return $message;
 	}
 
+
 	/**
 	 * If a file has been cached, retrieve and display it.
 	 *
@@ -9378,6 +9478,7 @@ class SimplePie_Misc
 		}
 	}
 
+
 	/**
 	 * Remove bad UTF-8 bytes
 	 *
@@ -9413,6 +9514,7 @@ class SimplePie_Misc
 		}
 	}
 
+
 	/**
 	 * Converts a Windows-1252 encoded string to a UTF-8 encoded string
 	 *
@@ -9474,1314 +9576,1314 @@ class SimplePie_Misc
 		// Normalization from UTS #22
 		switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
 		{
-			case 'adobestandardencoding':
-			case 'csadobestandardencoding':
-				return 'Adobe-Standard-Encoding';
-
-			case 'adobesymbolencoding':
-			case 'cshppsmath':
-				return 'Adobe-Symbol-Encoding';
-
-			case 'ami1251':
-			case 'amiga1251':
-				return 'Amiga-1251';
-
-			case 'ansix31101983':
-			case 'csat5001983':
-			case 'csiso99naplps':
-			case 'isoir99':
-			case 'naplps':
-				return 'ANSI_X3.110-1983';
-
-			case 'arabic7':
-			case 'asmo449':
-			case 'csiso89asmo449':
-			case 'iso9036':
-			case 'isoir89':
-				return 'ASMO_449';
-
-			case 'big5':
-			case 'csbig5':
-			case 'xxbig5':
-				return 'Big5';
-
-			case 'big5hkscs':
-				return 'Big5-HKSCS';
-
-			case 'bocu1':
-			case 'csbocu1':
-				return 'BOCU-1';
-
-			case 'brf':
-			case 'csbrf':
-				return 'BRF';
-
-			case 'bs4730':
-			case 'csiso4unitedkingdom':
-			case 'gb':
-			case 'iso646gb':
-			case 'isoir4':
-			case 'uk':
-				return 'BS_4730';
-
-			case 'bsviewdata':
-			case 'csiso47bsviewdata':
-			case 'isoir47':
-				return 'BS_viewdata';
-
-			case 'cesu8':
-			case 'cscesu8':
-				return 'CESU-8';
-
-			case 'ca':
-			case 'csa71':
-			case 'csaz243419851':
-			case 'csiso121canadian1':
-			case 'iso646ca':
-			case 'isoir121':
-				return 'CSA_Z243.4-1985-1';
-
-			case 'csa72':
-			case 'csaz243419852':
-			case 'csiso122canadian2':
-			case 'iso646ca2':
-			case 'isoir122':
-				return 'CSA_Z243.4-1985-2';
-
-			case 'csaz24341985gr':
-			case 'csiso123csaz24341985gr':
-			case 'isoir123':
-				return 'CSA_Z243.4-1985-gr';
-
-			case 'csiso139csn369103':
-			case 'csn369103':
-			case 'isoir139':
-				return 'CSN_369103';
-
-			case 'csdecmcs':
-			case 'dec':
-			case 'decmcs':
-				return 'DEC-MCS';
-
-			case 'csiso21german':
-			case 'de':
-			case 'din66003':
-			case 'iso646de':
-			case 'isoir21':
-				return 'DIN_66003';
-
-			case 'csdkus':
-			case 'dkus':
-				return 'dk-us';
-
-			case 'csiso646danish':
-			case 'dk':
-			case 'ds2089':
-			case 'iso646dk':
-				return 'DS_2089';
-
-			case 'csibmebcdicatde':
-			case 'ebcdicatde':
-				return 'EBCDIC-AT-DE';
-
-			case 'csebcdicatdea':
-			case 'ebcdicatdea':
-				return 'EBCDIC-AT-DE-A';
-
-			case 'csebcdiccafr':
-			case 'ebcdiccafr':
-				return 'EBCDIC-CA-FR';
-
-			case 'csebcdicdkno':
-			case 'ebcdicdkno':
-				return 'EBCDIC-DK-NO';
-
-			case 'csebcdicdknoa':
-			case 'ebcdicdknoa':
-				return 'EBCDIC-DK-NO-A';
-
-			case 'csebcdices':
-			case 'ebcdices':
-				return 'EBCDIC-ES';
-
-			case 'csebcdicesa':
-			case 'ebcdicesa':
-				return 'EBCDIC-ES-A';
-
-			case 'csebcdicess':
-			case 'ebcdicess':
-				return 'EBCDIC-ES-S';
-
-			case 'csebcdicfise':
-			case 'ebcdicfise':
-				return 'EBCDIC-FI-SE';
-
-			case 'csebcdicfisea':
-			case 'ebcdicfisea':
-				return 'EBCDIC-FI-SE-A';
-
-			case 'csebcdicfr':
-			case 'ebcdicfr':
-				return 'EBCDIC-FR';
-
-			case 'csebcdicit':
-			case 'ebcdicit':
-				return 'EBCDIC-IT';
-
-			case 'csebcdicpt':
-			case 'ebcdicpt':
-				return 'EBCDIC-PT';
-
-			case 'csebcdicuk':
-			case 'ebcdicuk':
-				return 'EBCDIC-UK';
-
-			case 'csebcdicus':
-			case 'ebcdicus':
-				return 'EBCDIC-US';
-
-			case 'csiso111ecmacyrillic':
-			case 'ecmacyrillic':
-			case 'isoir111':
-			case 'koi8e':
-				return 'ECMA-cyrillic';
-
-			case 'csiso17spanish':
-			case 'es':
-			case 'iso646es':
-			case 'isoir17':
-				return 'ES';
-
-			case 'csiso85spanish2':
-			case 'es2':
-			case 'iso646es2':
-			case 'isoir85':
-				return 'ES2';
-
-			case 'cseucfixwidjapanese':
-			case 'extendedunixcodefixedwidthforjapanese':
-				return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
-
-			case 'cseucpkdfmtjapanese':
-			case 'eucjp':
-			case 'extendedunixcodepackedformatforjapanese':
-				return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
-
-			case 'gb18030':
-				return 'GB18030';
-
-			case 'chinese':
-			case 'cp936':
-			case 'csgb2312':
-			case 'csiso58gb231280':
-			case 'gb2312':
-			case 'gb231280':
-			case 'gbk':
-			case 'isoir58':
-			case 'ms936':
-			case 'windows936':
-				return 'GBK';
-
-			case 'cn':
-			case 'csiso57gb1988':
-			case 'gb198880':
-			case 'iso646cn':
-			case 'isoir57':
-				return 'GB_1988-80';
-
-			case 'csiso153gost1976874':
-			case 'gost1976874':
-			case 'isoir153':
-			case 'stsev35888':
-				return 'GOST_19768-74';
-
-			case 'csiso150':
-			case 'csiso150greekccitt':
-			case 'greekccitt':
-			case 'isoir150':
-				return 'greek-ccitt';
-
-			case 'csiso88greek7':
-			case 'greek7':
-			case 'isoir88':
-				return 'greek7';
-
-			case 'csiso18greek7old':
-			case 'greek7old':
-			case 'isoir18':
-				return 'greek7-old';
-
-			case 'cshpdesktop':
-			case 'hpdesktop':
-				return 'HP-DeskTop';
-
-			case 'cshplegal':
-			case 'hplegal':
-				return 'HP-Legal';
-
-			case 'cshpmath8':
-			case 'hpmath8':
-				return 'HP-Math8';
-
-			case 'cshppifont':
-			case 'hppifont':
-				return 'HP-Pi-font';
-
-			case 'cshproman8':
-			case 'hproman8':
-			case 'r8':
-			case 'roman8':
-				return 'hp-roman8';
-
-			case 'hzgb2312':
-				return 'HZ-GB-2312';
-
-			case 'csibmsymbols':
-			case 'ibmsymbols':
-				return 'IBM-Symbols';
-
-			case 'csibmthai':
-			case 'ibmthai':
-				return 'IBM-Thai';
-
-			case 'ccsid858':
-			case 'cp858':
-			case 'ibm858':
-			case 'pcmultilingual850euro':
-				return 'IBM00858';
-
-			case 'ccsid924':
-			case 'cp924':
-			case 'ebcdiclatin9euro':
-			case 'ibm924':
-				return 'IBM00924';
-
-			case 'ccsid1140':
-			case 'cp1140':
-			case 'ebcdicus37euro':
-			case 'ibm1140':
-				return 'IBM01140';
-
-			case 'ccsid1141':
-			case 'cp1141':
-			case 'ebcdicde273euro':
-			case 'ibm1141':
-				return 'IBM01141';
-
-			case 'ccsid1142':
-			case 'cp1142':
-			case 'ebcdicdk277euro':
-			case 'ebcdicno277euro':
-			case 'ibm1142':
-				return 'IBM01142';
-
-			case 'ccsid1143':
-			case 'cp1143':
-			case 'ebcdicfi278euro':
-			case 'ebcdicse278euro':
-			case 'ibm1143':
-				return 'IBM01143';
-
-			case 'ccsid1144':
-			case 'cp1144':
-			case 'ebcdicit280euro':
-			case 'ibm1144':
-				return 'IBM01144';
-
-			case 'ccsid1145':
-			case 'cp1145':
-			case 'ebcdices284euro':
-			case 'ibm1145':
-				return 'IBM01145';
-
-			case 'ccsid1146':
-			case 'cp1146':
-			case 'ebcdicgb285euro':
-			case 'ibm1146':
-				return 'IBM01146';
-
-			case 'ccsid1147':
-			case 'cp1147':
-			case 'ebcdicfr297euro':
-			case 'ibm1147':
-				return 'IBM01147';
-
-			case 'ccsid1148':
-			case 'cp1148':
-			case 'ebcdicinternational500euro':
-			case 'ibm1148':
-				return 'IBM01148';
-
-			case 'ccsid1149':
-			case 'cp1149':
-			case 'ebcdicis871euro':
-			case 'ibm1149':
-				return 'IBM01149';
-
-			case 'cp37':
-			case 'csibm37':
-			case 'ebcdiccpca':
-			case 'ebcdiccpnl':
-			case 'ebcdiccpus':
-			case 'ebcdiccpwt':
-			case 'ibm37':
-				return 'IBM037';
-
-			case 'cp38':
-			case 'csibm38':
-			case 'ebcdicint':
-			case 'ibm38':
-				return 'IBM038';
-
-			case 'cp273':
-			case 'csibm273':
-			case 'ibm273':
-				return 'IBM273';
-
-			case 'cp274':
-			case 'csibm274':
-			case 'ebcdicbe':
-			case 'ibm274':
-				return 'IBM274';
-
-			case 'cp275':
-			case 'csibm275':
-			case 'ebcdicbr':
-			case 'ibm275':
-				return 'IBM275';
-
-			case 'csibm277':
-			case 'ebcdiccpdk':
-			case 'ebcdiccpno':
-			case 'ibm277':
-				return 'IBM277';
-
-			case 'cp278':
-			case 'csibm278':
-			case 'ebcdiccpfi':
-			case 'ebcdiccpse':
-			case 'ibm278':
-				return 'IBM278';
-
-			case 'cp280':
-			case 'csibm280':
-			case 'ebcdiccpit':
-			case 'ibm280':
-				return 'IBM280';
-
-			case 'cp281':
-			case 'csibm281':
-			case 'ebcdicjpe':
-			case 'ibm281':
-				return 'IBM281';
-
-			case 'cp284':
-			case 'csibm284':
-			case 'ebcdiccpes':
-			case 'ibm284':
-				return 'IBM284';
-
-			case 'cp285':
-			case 'csibm285':
-			case 'ebcdiccpgb':
-			case 'ibm285':
-				return 'IBM285';
-
-			case 'cp290':
-			case 'csibm290':
-			case 'ebcdicjpkana':
-			case 'ibm290':
-				return 'IBM290';
-
-			case 'cp297':
-			case 'csibm297':
-			case 'ebcdiccpfr':
-			case 'ibm297':
-				return 'IBM297';
-
-			case 'cp420':
-			case 'csibm420':
-			case 'ebcdiccpar1':
-			case 'ibm420':
-				return 'IBM420';
-
-			case 'cp423':
-			case 'csibm423':
-			case 'ebcdiccpgr':
-			case 'ibm423':
-				return 'IBM423';
-
-			case 'cp424':
-			case 'csibm424':
-			case 'ebcdiccphe':
-			case 'ibm424':
-				return 'IBM424';
-
-			case '437':
-			case 'cp437':
-			case 'cspc8codepage437':
-			case 'ibm437':
-				return 'IBM437';
-
-			case 'cp500':
-			case 'csibm500':
-			case 'ebcdiccpbe':
-			case 'ebcdiccpch':
-			case 'ibm500':
-				return 'IBM500';
-
-			case 'cp775':
-			case 'cspc775baltic':
-			case 'ibm775':
-				return 'IBM775';
-
-			case '850':
-			case 'cp850':
-			case 'cspc850multilingual':
-			case 'ibm850':
-				return 'IBM850';
-
-			case '851':
-			case 'cp851':
-			case 'csibm851':
-			case 'ibm851':
-				return 'IBM851';
-
-			case '852':
-			case 'cp852':
-			case 'cspcp852':
-			case 'ibm852':
-				return 'IBM852';
-
-			case '855':
-			case 'cp855':
-			case 'csibm855':
-			case 'ibm855':
-				return 'IBM855';
-
-			case '857':
-			case 'cp857':
-			case 'csibm857':
-			case 'ibm857':
-				return 'IBM857';
-
-			case '860':
-			case 'cp860':
-			case 'csibm860':
-			case 'ibm860':
-				return 'IBM860';
-
-			case '861':
-			case 'cp861':
-			case 'cpis':
-			case 'csibm861':
-			case 'ibm861':
-				return 'IBM861';
-
-			case '862':
-			case 'cp862':
-			case 'cspc862latinhebrew':
-			case 'ibm862':
-				return 'IBM862';
-
-			case '863':
-			case 'cp863':
-			case 'csibm863':
-			case 'ibm863':
-				return 'IBM863';
-
-			case 'cp864':
-			case 'csibm864':
-			case 'ibm864':
-				return 'IBM864';
-
-			case '865':
-			case 'cp865':
-			case 'csibm865':
-			case 'ibm865':
-				return 'IBM865';
-
-			case '866':
-			case 'cp866':
-			case 'csibm866':
-			case 'ibm866':
-				return 'IBM866';
-
-			case 'cp868':
-			case 'cpar':
-			case 'csibm868':
-			case 'ibm868':
-				return 'IBM868';
-
-			case '869':
-			case 'cp869':
-			case 'cpgr':
-			case 'csibm869':
-			case 'ibm869':
-				return 'IBM869';
-
-			case 'cp870':
-			case 'csibm870':
-			case 'ebcdiccproece':
-			case 'ebcdiccpyu':
-			case 'ibm870':
-				return 'IBM870';
-
-			case 'cp871':
-			case 'csibm871':
-			case 'ebcdiccpis':
-			case 'ibm871':
-				return 'IBM871';
-
-			case 'cp880':
-			case 'csibm880':
-			case 'ebcdiccyrillic':
-			case 'ibm880':
-				return 'IBM880';
-
-			case 'cp891':
-			case 'csibm891':
-			case 'ibm891':
-				return 'IBM891';
-
-			case 'cp903':
-			case 'csibm903':
-			case 'ibm903':
-				return 'IBM903';
-
-			case '904':
-			case 'cp904':
-			case 'csibbm904':
-			case 'ibm904':
-				return 'IBM904';
-
-			case 'cp905':
-			case 'csibm905':
-			case 'ebcdiccptr':
-			case 'ibm905':
-				return 'IBM905';
-
-			case 'cp918':
-			case 'csibm918':
-			case 'ebcdiccpar2':
-			case 'ibm918':
-				return 'IBM918';
-
-			case 'cp1026':
-			case 'csibm1026':
-			case 'ibm1026':
-				return 'IBM1026';
-
-			case 'ibm1047':
-				return 'IBM1047';
-
-			case 'csiso143iecp271':
-			case 'iecp271':
-			case 'isoir143':
-				return 'IEC_P27-1';
-
-			case 'csiso49inis':
-			case 'inis':
-			case 'isoir49':
-				return 'INIS';
-
-			case 'csiso50inis8':
-			case 'inis8':
-			case 'isoir50':
-				return 'INIS-8';
-
-			case 'csiso51iniscyrillic':
-			case 'iniscyrillic':
-			case 'isoir51':
-				return 'INIS-cyrillic';
-
-			case 'csinvariant':
-			case 'invariant':
-				return 'INVARIANT';
-
-			case 'iso2022cn':
-				return 'ISO-2022-CN';
-
-			case 'iso2022cnext':
-				return 'ISO-2022-CN-EXT';
-
-			case 'csiso2022jp':
-			case 'iso2022jp':
-				return 'ISO-2022-JP';
-
-			case 'csiso2022jp2':
-			case 'iso2022jp2':
-				return 'ISO-2022-JP-2';
-
-			case 'csiso2022kr':
-			case 'iso2022kr':
-				return 'ISO-2022-KR';
-
-			case 'cswindows30latin1':
-			case 'iso88591windows30latin1':
-				return 'ISO-8859-1-Windows-3.0-Latin-1';
-
-			case 'cswindows31latin1':
-			case 'iso88591windows31latin1':
-				return 'ISO-8859-1-Windows-3.1-Latin-1';
-
-			case 'csisolatin2':
-			case 'iso88592':
-			case 'iso885921987':
-			case 'isoir101':
-			case 'l2':
-			case 'latin2':
-				return 'ISO-8859-2';
-
-			case 'cswindows31latin2':
-			case 'iso88592windowslatin2':
-				return 'ISO-8859-2-Windows-Latin-2';
-
-			case 'csisolatin3':
-			case 'iso88593':
-			case 'iso885931988':
-			case 'isoir109':
-			case 'l3':
-			case 'latin3':
-				return 'ISO-8859-3';
-
-			case 'csisolatin4':
-			case 'iso88594':
-			case 'iso885941988':
-			case 'isoir110':
-			case 'l4':
-			case 'latin4':
-				return 'ISO-8859-4';
-
-			case 'csisolatincyrillic':
-			case 'cyrillic':
-			case 'iso88595':
-			case 'iso885951988':
-			case 'isoir144':
-				return 'ISO-8859-5';
-
-			case 'arabic':
-			case 'asmo708':
-			case 'csisolatinarabic':
-			case 'ecma114':
-			case 'iso88596':
-			case 'iso885961987':
-			case 'isoir127':
-				return 'ISO-8859-6';
-
-			case 'csiso88596e':
-			case 'iso88596e':
-				return 'ISO-8859-6-E';
-
-			case 'csiso88596i':
-			case 'iso88596i':
-				return 'ISO-8859-6-I';
-
-			case 'csisolatingreek':
-			case 'ecma118':
-			case 'elot928':
-			case 'greek':
-			case 'greek8':
-			case 'iso88597':
-			case 'iso885971987':
-			case 'isoir126':
-				return 'ISO-8859-7';
-
-			case 'csisolatinhebrew':
-			case 'hebrew':
-			case 'iso88598':
-			case 'iso885981988':
-			case 'isoir138':
-				return 'ISO-8859-8';
-
-			case 'csiso88598e':
-			case 'iso88598e':
-				return 'ISO-8859-8-E';
-
-			case 'csiso88598i':
-			case 'iso88598i':
-				return 'ISO-8859-8-I';
-
-			case 'cswindows31latin5':
-			case 'iso88599windowslatin5':
-				return 'ISO-8859-9-Windows-Latin-5';
-
-			case 'csisolatin6':
-			case 'iso885910':
-			case 'iso8859101992':
-			case 'isoir157':
-			case 'l6':
-			case 'latin6':
-				return 'ISO-8859-10';
-
-			case 'iso885913':
-				return 'ISO-8859-13';
-
-			case 'iso885914':
-			case 'iso8859141998':
-			case 'isoceltic':
-			case 'isoir199':
-			case 'l8':
-			case 'latin8':
-				return 'ISO-8859-14';
-
-			case 'iso885915':
-			case 'latin9':
-				return 'ISO-8859-15';
-
-			case 'iso885916':
-			case 'iso8859162001':
-			case 'isoir226':
-			case 'l10':
-			case 'latin10':
-				return 'ISO-8859-16';
-
-			case 'iso10646j1':
-				return 'ISO-10646-J-1';
-
-			case 'csunicode':
-			case 'iso10646ucs2':
-				return 'ISO-10646-UCS-2';
-
-			case 'csucs4':
-			case 'iso10646ucs4':
-				return 'ISO-10646-UCS-4';
-
-			case 'csunicodeascii':
-			case 'iso10646ucsbasic':
-				return 'ISO-10646-UCS-Basic';
-
-			case 'csunicodelatin1':
-			case 'iso10646':
-			case 'iso10646unicodelatin1':
-				return 'ISO-10646-Unicode-Latin1';
-
-			case 'csiso10646utf1':
-			case 'iso10646utf1':
-				return 'ISO-10646-UTF-1';
-
-			case 'csiso115481':
-			case 'iso115481':
-			case 'isotr115481':
-				return 'ISO-11548-1';
-
-			case 'csiso90':
-			case 'isoir90':
-				return 'iso-ir-90';
-
-			case 'csunicodeibm1261':
-			case 'isounicodeibm1261':
-				return 'ISO-Unicode-IBM-1261';
-
-			case 'csunicodeibm1264':
-			case 'isounicodeibm1264':
-				return 'ISO-Unicode-IBM-1264';
-
-			case 'csunicodeibm1265':
-			case 'isounicodeibm1265':
-				return 'ISO-Unicode-IBM-1265';
-
-			case 'csunicodeibm1268':
-			case 'isounicodeibm1268':
-				return 'ISO-Unicode-IBM-1268';
-
-			case 'csunicodeibm1276':
-			case 'isounicodeibm1276':
-				return 'ISO-Unicode-IBM-1276';
-
-			case 'csiso646basic1983':
-			case 'iso646basic1983':
-			case 'ref':
-				return 'ISO_646.basic:1983';
-
-			case 'csiso2intlrefversion':
-			case 'irv':
-			case 'iso646irv1983':
-			case 'isoir2':
-				return 'ISO_646.irv:1983';
-
-			case 'csiso2033':
-			case 'e13b':
-			case 'iso20331983':
-			case 'isoir98':
-				return 'ISO_2033-1983';
-
-			case 'csiso5427cyrillic':
-			case 'iso5427':
-			case 'isoir37':
-				return 'ISO_5427';
-
-			case 'iso5427cyrillic1981':
-			case 'iso54271981':
-			case 'isoir54':
-				return 'ISO_5427:1981';
-
-			case 'csiso5428greek':
-			case 'iso54281980':
-			case 'isoir55':
-				return 'ISO_5428:1980';
-
-			case 'csiso6937add':
-			case 'iso6937225':
-			case 'isoir152':
-				return 'ISO_6937-2-25';
-
-			case 'csisotextcomm':
-			case 'iso69372add':
-			case 'isoir142':
-				return 'ISO_6937-2-add';
-
-			case 'csiso8859supp':
-			case 'iso8859supp':
-			case 'isoir154':
-			case 'latin125':
-				return 'ISO_8859-supp';
-
-			case 'csiso10367box':
-			case 'iso10367box':
-			case 'isoir155':
-				return 'ISO_10367-box';
-
-			case 'csiso15italian':
-			case 'iso646it':
-			case 'isoir15':
-			case 'it':
-				return 'IT';
-
-			case 'csiso13jisc6220jp':
-			case 'isoir13':
-			case 'jisc62201969':
-			case 'jisc62201969jp':
-			case 'katakana':
-			case 'x2017':
-				return 'JIS_C6220-1969-jp';
-
-			case 'csiso14jisc6220ro':
-			case 'iso646jp':
-			case 'isoir14':
-			case 'jisc62201969ro':
-			case 'jp':
-				return 'JIS_C6220-1969-ro';
-
-			case 'csiso42jisc62261978':
-			case 'isoir42':
-			case 'jisc62261978':
-				return 'JIS_C6226-1978';
-
-			case 'csiso87jisx208':
-			case 'isoir87':
-			case 'jisc62261983':
-			case 'jisx2081983':
-			case 'x208':
-				return 'JIS_C6226-1983';
-
-			case 'csiso91jisc62291984a':
-			case 'isoir91':
-			case 'jisc62291984a':
-			case 'jpocra':
-				return 'JIS_C6229-1984-a';
-
-			case 'csiso92jisc62991984b':
-			case 'iso646jpocrb':
-			case 'isoir92':
-			case 'jisc62291984b':
-			case 'jpocrb':
-				return 'JIS_C6229-1984-b';
-
-			case 'csiso93jis62291984badd':
-			case 'isoir93':
-			case 'jisc62291984badd':
-			case 'jpocrbadd':
-				return 'JIS_C6229-1984-b-add';
-
-			case 'csiso94jis62291984hand':
-			case 'isoir94':
-			case 'jisc62291984hand':
-			case 'jpocrhand':
-				return 'JIS_C6229-1984-hand';
-
-			case 'csiso95jis62291984handadd':
-			case 'isoir95':
-			case 'jisc62291984handadd':
-			case 'jpocrhandadd':
-				return 'JIS_C6229-1984-hand-add';
-
-			case 'csiso96jisc62291984kana':
-			case 'isoir96':
-			case 'jisc62291984kana':
-				return 'JIS_C6229-1984-kana';
-
-			case 'csjisencoding':
-			case 'jisencoding':
-				return 'JIS_Encoding';
-
-			case 'cshalfwidthkatakana':
-			case 'jisx201':
-			case 'x201':
-				return 'JIS_X0201';
-
-			case 'csiso159jisx2121990':
-			case 'isoir159':
-			case 'jisx2121990':
-			case 'x212':
-				return 'JIS_X0212-1990';
-
-			case 'csiso141jusib1002':
-			case 'iso646yu':
-			case 'isoir141':
-			case 'js':
-			case 'jusib1002':
-			case 'yu':
-				return 'JUS_I.B1.002';
-
-			case 'csiso147macedonian':
-			case 'isoir147':
-			case 'jusib1003mac':
-			case 'macedonian':
-				return 'JUS_I.B1.003-mac';
-
-			case 'csiso146serbian':
-			case 'isoir146':
-			case 'jusib1003serb':
-			case 'serbian':
-				return 'JUS_I.B1.003-serb';
-
-			case 'koi7switched':
-				return 'KOI7-switched';
-
-			case 'cskoi8r':
-			case 'koi8r':
-				return 'KOI8-R';
-
-			case 'koi8u':
-				return 'KOI8-U';
-
-			case 'csksc5636':
-			case 'iso646kr':
-			case 'ksc5636':
-				return 'KSC5636';
-
-			case 'cskz1048':
-			case 'kz1048':
-			case 'rk1048':
-			case 'strk10482002':
-				return 'KZ-1048';
-
-			case 'csiso19latingreek':
-			case 'isoir19':
-			case 'latingreek':
-				return 'latin-greek';
-
-			case 'csiso27latingreek1':
-			case 'isoir27':
-			case 'latingreek1':
-				return 'Latin-greek-1';
-
-			case 'csiso158lap':
-			case 'isoir158':
-			case 'lap':
-			case 'latinlap':
-				return 'latin-lap';
-
-			case 'csmacintosh':
-			case 'mac':
-			case 'macintosh':
-				return 'macintosh';
-
-			case 'csmicrosoftpublishing':
-			case 'microsoftpublishing':
-				return 'Microsoft-Publishing';
-
-			case 'csmnem':
-			case 'mnem':
-				return 'MNEM';
-
-			case 'csmnemonic':
-			case 'mnemonic':
-				return 'MNEMONIC';
-
-			case 'csiso86hungarian':
-			case 'hu':
-			case 'iso646hu':
-			case 'isoir86':
-			case 'msz77953':
-				return 'MSZ_7795.3';
-
-			case 'csnatsdano':
-			case 'isoir91':
-			case 'natsdano':
-				return 'NATS-DANO';
-
-			case 'csnatsdanoadd':
-			case 'isoir92':
-			case 'natsdanoadd':
-				return 'NATS-DANO-ADD';
-
-			case 'csnatssefi':
-			case 'isoir81':
-			case 'natssefi':
-				return 'NATS-SEFI';
-
-			case 'csnatssefiadd':
-			case 'isoir82':
-			case 'natssefiadd':
-				return 'NATS-SEFI-ADD';
-
-			case 'csiso151cuba':
-			case 'cuba':
-			case 'iso646cu':
-			case 'isoir151':
-			case 'ncnc1081':
-				return 'NC_NC00-10:81';
-
-			case 'csiso69french':
-			case 'fr':
-			case 'iso646fr':
-			case 'isoir69':
-			case 'nfz62010':
-				return 'NF_Z_62-010';
-
-			case 'csiso25french':
-			case 'iso646fr1':
-			case 'isoir25':
-			case 'nfz620101973':
-				return 'NF_Z_62-010_(1973)';
-
-			case 'csiso60danishnorwegian':
-			case 'csiso60norwegian1':
-			case 'iso646no':
-			case 'isoir60':
-			case 'no':
-			case 'ns45511':
-				return 'NS_4551-1';
-
-			case 'csiso61norwegian2':
-			case 'iso646no2':
-			case 'isoir61':
-			case 'no2':
-			case 'ns45512':
-				return 'NS_4551-2';
-
-			case 'osdebcdicdf3irv':
-				return 'OSD_EBCDIC_DF03_IRV';
-
-			case 'osdebcdicdf41':
-				return 'OSD_EBCDIC_DF04_1';
-
-			case 'osdebcdicdf415':
-				return 'OSD_EBCDIC_DF04_15';
-
-			case 'cspc8danishnorwegian':
-			case 'pc8danishnorwegian':
-				return 'PC8-Danish-Norwegian';
-
-			case 'cspc8turkish':
-			case 'pc8turkish':
-				return 'PC8-Turkish';
-
-			case 'csiso16portuguese':
-			case 'iso646pt':
-			case 'isoir16':
-			case 'pt':
-				return 'PT';
-
-			case 'csiso84portuguese2':
-			case 'iso646pt2':
-			case 'isoir84':
-			case 'pt2':
-				return 'PT2';
-
-			case 'cp154':
-			case 'csptcp154':
-			case 'cyrillicasian':
-			case 'pt154':
-			case 'ptcp154':
-				return 'PTCP154';
-
-			case 'scsu':
-				return 'SCSU';
-
-			case 'csiso10swedish':
-			case 'fi':
-			case 'iso646fi':
-			case 'iso646se':
-			case 'isoir10':
-			case 'se':
-			case 'sen850200b':
-				return 'SEN_850200_B';
-
-			case 'csiso11swedishfornames':
-			case 'iso646se2':
-			case 'isoir11':
-			case 'se2':
-			case 'sen850200c':
-				return 'SEN_850200_C';
-
-			case 'csshiftjis':
-			case 'mskanji':
-			case 'shiftjis':
-				return 'Shift_JIS';
-
-			case 'csiso102t617bit':
-			case 'isoir102':
-			case 't617bit':
-				return 'T.61-7bit';
-
-			case 'csiso103t618bit':
-			case 'isoir103':
-			case 't61':
-			case 't618bit':
-				return 'T.61-8bit';
-
-			case 'csiso128t101g2':
-			case 'isoir128':
-			case 't101g2':
-				return 'T.101-G2';
-
-			case 'cstscii':
-			case 'tscii':
-				return 'TSCII';
-
-			case 'csunicode11':
-			case 'unicode11':
-				return 'UNICODE-1-1';
-
-			case 'csunicode11utf7':
-			case 'unicode11utf7':
-				return 'UNICODE-1-1-UTF-7';
-
-			case 'csunknown8bit':
-			case 'unknown8bit':
-				return 'UNKNOWN-8BIT';
-
-			case 'ansix341968':
-			case 'ansix341986':
-			case 'ascii':
-			case 'cp367':
-			case 'csascii':
-			case 'ibm367':
-			case 'iso646irv1991':
-			case 'iso646us':
-			case 'isoir6':
-			case 'us':
-			case 'usascii':
-				return 'US-ASCII';
-
-			case 'csusdk':
-			case 'usdk':
-				return 'us-dk';
-
-			case 'utf7':
-				return 'UTF-7';
-
-			case 'utf8':
-				return 'UTF-8';
-
-			case 'utf16':
-				return 'UTF-16';
-
-			case 'utf16be':
-				return 'UTF-16BE';
-
-			case 'utf16le':
-				return 'UTF-16LE';
-
-			case 'utf32':
-				return 'UTF-32';
-
-			case 'utf32be':
-				return 'UTF-32BE';
-
-			case 'utf32le':
-				return 'UTF-32LE';
-
-			case 'csventurainternational':
-			case 'venturainternational':
-				return 'Ventura-International';
-
-			case 'csventuramath':
-			case 'venturamath':
-				return 'Ventura-Math';
-
-			case 'csventuraus':
-			case 'venturaus':
-				return 'Ventura-US';
-
-			case 'csiso70videotexsupp1':
-			case 'isoir70':
-			case 'videotexsuppl':
-				return 'videotex-suppl';
-
-			case 'csviqr':
-			case 'viqr':
-				return 'VIQR';
-
-			case 'csviscii':
-			case 'viscii':
-				return 'VISCII';
-
-			case 'cswindows31j':
-			case 'windows31j':
-				return 'Windows-31J';
-
-			case 'iso885911':
-			case 'tis620':
-				return 'windows-874';
-
-			case 'cseuckr':
-			case 'csksc56011987':
-			case 'euckr':
-			case 'isoir149':
-			case 'korean':
-			case 'ksc5601':
-			case 'ksc56011987':
-			case 'ksc56011989':
-			case 'windows949':
-				return 'windows-949';
-
-			case 'windows1250':
-				return 'windows-1250';
-
-			case 'windows1251':
-				return 'windows-1251';
-
-			case 'cp819':
-			case 'csisolatin1':
-			case 'ibm819':
-			case 'iso88591':
-			case 'iso885911987':
-			case 'isoir100':
-			case 'l1':
-			case 'latin1':
-			case 'windows1252':
-				return 'windows-1252';
-
-			case 'windows1253':
-				return 'windows-1253';
-
-			case 'csisolatin5':
-			case 'iso88599':
-			case 'iso885991989':
-			case 'isoir148':
-			case 'l5':
-			case 'latin5':
-			case 'windows1254':
-				return 'windows-1254';
-
-			case 'windows1255':
-				return 'windows-1255';
+		case 'adobestandardencoding':
+		case 'csadobestandardencoding':
+			return 'Adobe-Standard-Encoding';
+
+		case 'adobesymbolencoding':
+		case 'cshppsmath':
+			return 'Adobe-Symbol-Encoding';
+
+		case 'ami1251':
+		case 'amiga1251':
+			return 'Amiga-1251';
+
+		case 'ansix31101983':
+		case 'csat5001983':
+		case 'csiso99naplps':
+		case 'isoir99':
+		case 'naplps':
+			return 'ANSI_X3.110-1983';
+
+		case 'arabic7':
+		case 'asmo449':
+		case 'csiso89asmo449':
+		case 'iso9036':
+		case 'isoir89':
+			return 'ASMO_449';
+
+		case 'big5':
+		case 'csbig5':
+		case 'xxbig5':
+			return 'Big5';
+
+		case 'big5hkscs':
+			return 'Big5-HKSCS';
+
+		case 'bocu1':
+		case 'csbocu1':
+			return 'BOCU-1';
+
+		case 'brf':
+		case 'csbrf':
+			return 'BRF';
+
+		case 'bs4730':
+		case 'csiso4unitedkingdom':
+		case 'gb':
+		case 'iso646gb':
+		case 'isoir4':
+		case 'uk':
+			return 'BS_4730';
+
+		case 'bsviewdata':
+		case 'csiso47bsviewdata':
+		case 'isoir47':
+			return 'BS_viewdata';
+
+		case 'cesu8':
+		case 'cscesu8':
+			return 'CESU-8';
+
+		case 'ca':
+		case 'csa71':
+		case 'csaz243419851':
+		case 'csiso121canadian1':
+		case 'iso646ca':
+		case 'isoir121':
+			return 'CSA_Z243.4-1985-1';
+
+		case 'csa72':
+		case 'csaz243419852':
+		case 'csiso122canadian2':
+		case 'iso646ca2':
+		case 'isoir122':
+			return 'CSA_Z243.4-1985-2';
+
+		case 'csaz24341985gr':
+		case 'csiso123csaz24341985gr':
+		case 'isoir123':
+			return 'CSA_Z243.4-1985-gr';
+
+		case 'csiso139csn369103':
+		case 'csn369103':
+		case 'isoir139':
+			return 'CSN_369103';
+
+		case 'csdecmcs':
+		case 'dec':
+		case 'decmcs':
+			return 'DEC-MCS';
+
+		case 'csiso21german':
+		case 'de':
+		case 'din66003':
+		case 'iso646de':
+		case 'isoir21':
+			return 'DIN_66003';
+
+		case 'csdkus':
+		case 'dkus':
+			return 'dk-us';
+
+		case 'csiso646danish':
+		case 'dk':
+		case 'ds2089':
+		case 'iso646dk':
+			return 'DS_2089';
+
+		case 'csibmebcdicatde':
+		case 'ebcdicatde':
+			return 'EBCDIC-AT-DE';
+
+		case 'csebcdicatdea':
+		case 'ebcdicatdea':
+			return 'EBCDIC-AT-DE-A';
+
+		case 'csebcdiccafr':
+		case 'ebcdiccafr':
+			return 'EBCDIC-CA-FR';
+
+		case 'csebcdicdkno':
+		case 'ebcdicdkno':
+			return 'EBCDIC-DK-NO';
+
+		case 'csebcdicdknoa':
+		case 'ebcdicdknoa':
+			return 'EBCDIC-DK-NO-A';
+
+		case 'csebcdices':
+		case 'ebcdices':
+			return 'EBCDIC-ES';
+
+		case 'csebcdicesa':
+		case 'ebcdicesa':
+			return 'EBCDIC-ES-A';
+
+		case 'csebcdicess':
+		case 'ebcdicess':
+			return 'EBCDIC-ES-S';
+
+		case 'csebcdicfise':
+		case 'ebcdicfise':
+			return 'EBCDIC-FI-SE';
+
+		case 'csebcdicfisea':
+		case 'ebcdicfisea':
+			return 'EBCDIC-FI-SE-A';
+
+		case 'csebcdicfr':
+		case 'ebcdicfr':
+			return 'EBCDIC-FR';
+
+		case 'csebcdicit':
+		case 'ebcdicit':
+			return 'EBCDIC-IT';
+
+		case 'csebcdicpt':
+		case 'ebcdicpt':
+			return 'EBCDIC-PT';
+
+		case 'csebcdicuk':
+		case 'ebcdicuk':
+			return 'EBCDIC-UK';
+
+		case 'csebcdicus':
+		case 'ebcdicus':
+			return 'EBCDIC-US';
+
+		case 'csiso111ecmacyrillic':
+		case 'ecmacyrillic':
+		case 'isoir111':
+		case 'koi8e':
+			return 'ECMA-cyrillic';
+
+		case 'csiso17spanish':
+		case 'es':
+		case 'iso646es':
+		case 'isoir17':
+			return 'ES';
+
+		case 'csiso85spanish2':
+		case 'es2':
+		case 'iso646es2':
+		case 'isoir85':
+			return 'ES2';
+
+		case 'cseucfixwidjapanese':
+		case 'extendedunixcodefixedwidthforjapanese':
+			return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
+
+		case 'cseucpkdfmtjapanese':
+		case 'eucjp':
+		case 'extendedunixcodepackedformatforjapanese':
+			return 'Extended_UNIX_Code_Packed_Format_for_Japanese';
+
+		case 'gb18030':
+			return 'GB18030';
+
+		case 'chinese':
+		case 'cp936':
+		case 'csgb2312':
+		case 'csiso58gb231280':
+		case 'gb2312':
+		case 'gb231280':
+		case 'gbk':
+		case 'isoir58':
+		case 'ms936':
+		case 'windows936':
+			return 'GBK';
+
+		case 'cn':
+		case 'csiso57gb1988':
+		case 'gb198880':
+		case 'iso646cn':
+		case 'isoir57':
+			return 'GB_1988-80';
+
+		case 'csiso153gost1976874':
+		case 'gost1976874':
+		case 'isoir153':
+		case 'stsev35888':
+			return 'GOST_19768-74';
+
+		case 'csiso150':
+		case 'csiso150greekccitt':
+		case 'greekccitt':
+		case 'isoir150':
+			return 'greek-ccitt';
+
+		case 'csiso88greek7':
+		case 'greek7':
+		case 'isoir88':
+			return 'greek7';
+
+		case 'csiso18greek7old':
+		case 'greek7old':
+		case 'isoir18':
+			return 'greek7-old';
+
+		case 'cshpdesktop':
+		case 'hpdesktop':
+			return 'HP-DeskTop';
+
+		case 'cshplegal':
+		case 'hplegal':
+			return 'HP-Legal';
+
+		case 'cshpmath8':
+		case 'hpmath8':
+			return 'HP-Math8';
+
+		case 'cshppifont':
+		case 'hppifont':
+			return 'HP-Pi-font';
+
+		case 'cshproman8':
+		case 'hproman8':
+		case 'r8':
+		case 'roman8':
+			return 'hp-roman8';
+
+		case 'hzgb2312':
+			return 'HZ-GB-2312';
+
+		case 'csibmsymbols':
+		case 'ibmsymbols':
+			return 'IBM-Symbols';
+
+		case 'csibmthai':
+		case 'ibmthai':
+			return 'IBM-Thai';
+
+		case 'ccsid858':
+		case 'cp858':
+		case 'ibm858':
+		case 'pcmultilingual850euro':
+			return 'IBM00858';
+
+		case 'ccsid924':
+		case 'cp924':
+		case 'ebcdiclatin9euro':
+		case 'ibm924':
+			return 'IBM00924';
+
+		case 'ccsid1140':
+		case 'cp1140':
+		case 'ebcdicus37euro':
+		case 'ibm1140':
+			return 'IBM01140';
+
+		case 'ccsid1141':
+		case 'cp1141':
+		case 'ebcdicde273euro':
+		case 'ibm1141':
+			return 'IBM01141';
+
+		case 'ccsid1142':
+		case 'cp1142':
+		case 'ebcdicdk277euro':
+		case 'ebcdicno277euro':
+		case 'ibm1142':
+			return 'IBM01142';
+
+		case 'ccsid1143':
+		case 'cp1143':
+		case 'ebcdicfi278euro':
+		case 'ebcdicse278euro':
+		case 'ibm1143':
+			return 'IBM01143';
+
+		case 'ccsid1144':
+		case 'cp1144':
+		case 'ebcdicit280euro':
+		case 'ibm1144':
+			return 'IBM01144';
+
+		case 'ccsid1145':
+		case 'cp1145':
+		case 'ebcdices284euro':
+		case 'ibm1145':
+			return 'IBM01145';
+
+		case 'ccsid1146':
+		case 'cp1146':
+		case 'ebcdicgb285euro':
+		case 'ibm1146':
+			return 'IBM01146';
+
+		case 'ccsid1147':
+		case 'cp1147':
+		case 'ebcdicfr297euro':
+		case 'ibm1147':
+			return 'IBM01147';
+
+		case 'ccsid1148':
+		case 'cp1148':
+		case 'ebcdicinternational500euro':
+		case 'ibm1148':
+			return 'IBM01148';
+
+		case 'ccsid1149':
+		case 'cp1149':
+		case 'ebcdicis871euro':
+		case 'ibm1149':
+			return 'IBM01149';
+
+		case 'cp37':
+		case 'csibm37':
+		case 'ebcdiccpca':
+		case 'ebcdiccpnl':
+		case 'ebcdiccpus':
+		case 'ebcdiccpwt':
+		case 'ibm37':
+			return 'IBM037';
+
+		case 'cp38':
+		case 'csibm38':
+		case 'ebcdicint':
+		case 'ibm38':
+			return 'IBM038';
+
+		case 'cp273':
+		case 'csibm273':
+		case 'ibm273':
+			return 'IBM273';
+
+		case 'cp274':
+		case 'csibm274':
+		case 'ebcdicbe':
+		case 'ibm274':
+			return 'IBM274';
+
+		case 'cp275':
+		case 'csibm275':
+		case 'ebcdicbr':
+		case 'ibm275':
+			return 'IBM275';
+
+		case 'csibm277':
+		case 'ebcdiccpdk':
+		case 'ebcdiccpno':
+		case 'ibm277':
+			return 'IBM277';
+
+		case 'cp278':
+		case 'csibm278':
+		case 'ebcdiccpfi':
+		case 'ebcdiccpse':
+		case 'ibm278':
+			return 'IBM278';
+
+		case 'cp280':
+		case 'csibm280':
+		case 'ebcdiccpit':
+		case 'ibm280':
+			return 'IBM280';
+
+		case 'cp281':
+		case 'csibm281':
+		case 'ebcdicjpe':
+		case 'ibm281':
+			return 'IBM281';
+
+		case 'cp284':
+		case 'csibm284':
+		case 'ebcdiccpes':
+		case 'ibm284':
+			return 'IBM284';
+
+		case 'cp285':
+		case 'csibm285':
+		case 'ebcdiccpgb':
+		case 'ibm285':
+			return 'IBM285';
+
+		case 'cp290':
+		case 'csibm290':
+		case 'ebcdicjpkana':
+		case 'ibm290':
+			return 'IBM290';
+
+		case 'cp297':
+		case 'csibm297':
+		case 'ebcdiccpfr':
+		case 'ibm297':
+			return 'IBM297';
+
+		case 'cp420':
+		case 'csibm420':
+		case 'ebcdiccpar1':
+		case 'ibm420':
+			return 'IBM420';
+
+		case 'cp423':
+		case 'csibm423':
+		case 'ebcdiccpgr':
+		case 'ibm423':
+			return 'IBM423';
+
+		case 'cp424':
+		case 'csibm424':
+		case 'ebcdiccphe':
+		case 'ibm424':
+			return 'IBM424';
+
+		case '437':
+		case 'cp437':
+		case 'cspc8codepage437':
+		case 'ibm437':
+			return 'IBM437';
+
+		case 'cp500':
+		case 'csibm500':
+		case 'ebcdiccpbe':
+		case 'ebcdiccpch':
+		case 'ibm500':
+			return 'IBM500';
+
+		case 'cp775':
+		case 'cspc775baltic':
+		case 'ibm775':
+			return 'IBM775';
+
+		case '850':
+		case 'cp850':
+		case 'cspc850multilingual':
+		case 'ibm850':
+			return 'IBM850';
+
+		case '851':
+		case 'cp851':
+		case 'csibm851':
+		case 'ibm851':
+			return 'IBM851';
+
+		case '852':
+		case 'cp852':
+		case 'cspcp852':
+		case 'ibm852':
+			return 'IBM852';
+
+		case '855':
+		case 'cp855':
+		case 'csibm855':
+		case 'ibm855':
+			return 'IBM855';
+
+		case '857':
+		case 'cp857':
+		case 'csibm857':
+		case 'ibm857':
+			return 'IBM857';
+
+		case '860':
+		case 'cp860':
+		case 'csibm860':
+		case 'ibm860':
+			return 'IBM860';
+
+		case '861':
+		case 'cp861':
+		case 'cpis':
+		case 'csibm861':
+		case 'ibm861':
+			return 'IBM861';
+
+		case '862':
+		case 'cp862':
+		case 'cspc862latinhebrew':
+		case 'ibm862':
+			return 'IBM862';
+
+		case '863':
+		case 'cp863':
+		case 'csibm863':
+		case 'ibm863':
+			return 'IBM863';
+
+		case 'cp864':
+		case 'csibm864':
+		case 'ibm864':
+			return 'IBM864';
+
+		case '865':
+		case 'cp865':
+		case 'csibm865':
+		case 'ibm865':
+			return 'IBM865';
+
+		case '866':
+		case 'cp866':
+		case 'csibm866':
+		case 'ibm866':
+			return 'IBM866';
+
+		case 'cp868':
+		case 'cpar':
+		case 'csibm868':
+		case 'ibm868':
+			return 'IBM868';
+
+		case '869':
+		case 'cp869':
+		case 'cpgr':
+		case 'csibm869':
+		case 'ibm869':
+			return 'IBM869';
+
+		case 'cp870':
+		case 'csibm870':
+		case 'ebcdiccproece':
+		case 'ebcdiccpyu':
+		case 'ibm870':
+			return 'IBM870';
+
+		case 'cp871':
+		case 'csibm871':
+		case 'ebcdiccpis':
+		case 'ibm871':
+			return 'IBM871';
+
+		case 'cp880':
+		case 'csibm880':
+		case 'ebcdiccyrillic':
+		case 'ibm880':
+			return 'IBM880';
+
+		case 'cp891':
+		case 'csibm891':
+		case 'ibm891':
+			return 'IBM891';
+
+		case 'cp903':
+		case 'csibm903':
+		case 'ibm903':
+			return 'IBM903';
+
+		case '904':
+		case 'cp904':
+		case 'csibbm904':
+		case 'ibm904':
+			return 'IBM904';
+
+		case 'cp905':
+		case 'csibm905':
+		case 'ebcdiccptr':
+		case 'ibm905':
+			return 'IBM905';
+
+		case 'cp918':
+		case 'csibm918':
+		case 'ebcdiccpar2':
+		case 'ibm918':
+			return 'IBM918';
+
+		case 'cp1026':
+		case 'csibm1026':
+		case 'ibm1026':
+			return 'IBM1026';
+
+		case 'ibm1047':
+			return 'IBM1047';
+
+		case 'csiso143iecp271':
+		case 'iecp271':
+		case 'isoir143':
+			return 'IEC_P27-1';
+
+		case 'csiso49inis':
+		case 'inis':
+		case 'isoir49':
+			return 'INIS';
+
+		case 'csiso50inis8':
+		case 'inis8':
+		case 'isoir50':
+			return 'INIS-8';
+
+		case 'csiso51iniscyrillic':
+		case 'iniscyrillic':
+		case 'isoir51':
+			return 'INIS-cyrillic';
+
+		case 'csinvariant':
+		case 'invariant':
+			return 'INVARIANT';
+
+		case 'iso2022cn':
+			return 'ISO-2022-CN';
+
+		case 'iso2022cnext':
+			return 'ISO-2022-CN-EXT';
+
+		case 'csiso2022jp':
+		case 'iso2022jp':
+			return 'ISO-2022-JP';
+
+		case 'csiso2022jp2':
+		case 'iso2022jp2':
+			return 'ISO-2022-JP-2';
+
+		case 'csiso2022kr':
+		case 'iso2022kr':
+			return 'ISO-2022-KR';
+
+		case 'cswindows30latin1':
+		case 'iso88591windows30latin1':
+			return 'ISO-8859-1-Windows-3.0-Latin-1';
+
+		case 'cswindows31latin1':
+		case 'iso88591windows31latin1':
+			return 'ISO-8859-1-Windows-3.1-Latin-1';
+
+		case 'csisolatin2':
+		case 'iso88592':
+		case 'iso885921987':
+		case 'isoir101':
+		case 'l2':
+		case 'latin2':
+			return 'ISO-8859-2';
+
+		case 'cswindows31latin2':
+		case 'iso88592windowslatin2':
+			return 'ISO-8859-2-Windows-Latin-2';
+
+		case 'csisolatin3':
+		case 'iso88593':
+		case 'iso885931988':
+		case 'isoir109':
+		case 'l3':
+		case 'latin3':
+			return 'ISO-8859-3';
+
+		case 'csisolatin4':
+		case 'iso88594':
+		case 'iso885941988':
+		case 'isoir110':
+		case 'l4':
+		case 'latin4':
+			return 'ISO-8859-4';
+
+		case 'csisolatincyrillic':
+		case 'cyrillic':
+		case 'iso88595':
+		case 'iso885951988':
+		case 'isoir144':
+			return 'ISO-8859-5';
+
+		case 'arabic':
+		case 'asmo708':
+		case 'csisolatinarabic':
+		case 'ecma114':
+		case 'iso88596':
+		case 'iso885961987':
+		case 'isoir127':
+			return 'ISO-8859-6';
+
+		case 'csiso88596e':
+		case 'iso88596e':
+			return 'ISO-8859-6-E';
+
+		case 'csiso88596i':
+		case 'iso88596i':
+			return 'ISO-8859-6-I';
+
+		case 'csisolatingreek':
+		case 'ecma118':
+		case 'elot928':
+		case 'greek':
+		case 'greek8':
+		case 'iso88597':
+		case 'iso885971987':
+		case 'isoir126':
+			return 'ISO-8859-7';
+
+		case 'csisolatinhebrew':
+		case 'hebrew':
+		case 'iso88598':
+		case 'iso885981988':
+		case 'isoir138':
+			return 'ISO-8859-8';
+
+		case 'csiso88598e':
+		case 'iso88598e':
+			return 'ISO-8859-8-E';
+
+		case 'csiso88598i':
+		case 'iso88598i':
+			return 'ISO-8859-8-I';
+
+		case 'cswindows31latin5':
+		case 'iso88599windowslatin5':
+			return 'ISO-8859-9-Windows-Latin-5';
+
+		case 'csisolatin6':
+		case 'iso885910':
+		case 'iso8859101992':
+		case 'isoir157':
+		case 'l6':
+		case 'latin6':
+			return 'ISO-8859-10';
+
+		case 'iso885913':
+			return 'ISO-8859-13';
+
+		case 'iso885914':
+		case 'iso8859141998':
+		case 'isoceltic':
+		case 'isoir199':
+		case 'l8':
+		case 'latin8':
+			return 'ISO-8859-14';
+
+		case 'iso885915':
+		case 'latin9':
+			return 'ISO-8859-15';
+
+		case 'iso885916':
+		case 'iso8859162001':
+		case 'isoir226':
+		case 'l10':
+		case 'latin10':
+			return 'ISO-8859-16';
+
+		case 'iso10646j1':
+			return 'ISO-10646-J-1';
+
+		case 'csunicode':
+		case 'iso10646ucs2':
+			return 'ISO-10646-UCS-2';
+
+		case 'csucs4':
+		case 'iso10646ucs4':
+			return 'ISO-10646-UCS-4';
+
+		case 'csunicodeascii':
+		case 'iso10646ucsbasic':
+			return 'ISO-10646-UCS-Basic';
+
+		case 'csunicodelatin1':
+		case 'iso10646':
+		case 'iso10646unicodelatin1':
+			return 'ISO-10646-Unicode-Latin1';
+
+		case 'csiso10646utf1':
+		case 'iso10646utf1':
+			return 'ISO-10646-UTF-1';
+
+		case 'csiso115481':
+		case 'iso115481':
+		case 'isotr115481':
+			return 'ISO-11548-1';
+
+		case 'csiso90':
+		case 'isoir90':
+			return 'iso-ir-90';
+
+		case 'csunicodeibm1261':
+		case 'isounicodeibm1261':
+			return 'ISO-Unicode-IBM-1261';
+
+		case 'csunicodeibm1264':
+		case 'isounicodeibm1264':
+			return 'ISO-Unicode-IBM-1264';
+
+		case 'csunicodeibm1265':
+		case 'isounicodeibm1265':
+			return 'ISO-Unicode-IBM-1265';
+
+		case 'csunicodeibm1268':
+		case 'isounicodeibm1268':
+			return 'ISO-Unicode-IBM-1268';
+
+		case 'csunicodeibm1276':
+		case 'isounicodeibm1276':
+			return 'ISO-Unicode-IBM-1276';
+
+		case 'csiso646basic1983':
+		case 'iso646basic1983':
+		case 'ref':
+			return 'ISO_646.basic:1983';
+
+		case 'csiso2intlrefversion':
+		case 'irv':
+		case 'iso646irv1983':
+		case 'isoir2':
+			return 'ISO_646.irv:1983';
+
+		case 'csiso2033':
+		case 'e13b':
+		case 'iso20331983':
+		case 'isoir98':
+			return 'ISO_2033-1983';
+
+		case 'csiso5427cyrillic':
+		case 'iso5427':
+		case 'isoir37':
+			return 'ISO_5427';
+
+		case 'iso5427cyrillic1981':
+		case 'iso54271981':
+		case 'isoir54':
+			return 'ISO_5427:1981';
+
+		case 'csiso5428greek':
+		case 'iso54281980':
+		case 'isoir55':
+			return 'ISO_5428:1980';
+
+		case 'csiso6937add':
+		case 'iso6937225':
+		case 'isoir152':
+			return 'ISO_6937-2-25';
+
+		case 'csisotextcomm':
+		case 'iso69372add':
+		case 'isoir142':
+			return 'ISO_6937-2-add';
+
+		case 'csiso8859supp':
+		case 'iso8859supp':
+		case 'isoir154':
+		case 'latin125':
+			return 'ISO_8859-supp';
+
+		case 'csiso10367box':
+		case 'iso10367box':
+		case 'isoir155':
+			return 'ISO_10367-box';
+
+		case 'csiso15italian':
+		case 'iso646it':
+		case 'isoir15':
+		case 'it':
+			return 'IT';
+
+		case 'csiso13jisc6220jp':
+		case 'isoir13':
+		case 'jisc62201969':
+		case 'jisc62201969jp':
+		case 'katakana':
+		case 'x2017':
+			return 'JIS_C6220-1969-jp';
+
+		case 'csiso14jisc6220ro':
+		case 'iso646jp':
+		case 'isoir14':
+		case 'jisc62201969ro':
+		case 'jp':
+			return 'JIS_C6220-1969-ro';
+
+		case 'csiso42jisc62261978':
+		case 'isoir42':
+		case 'jisc62261978':
+			return 'JIS_C6226-1978';
+
+		case 'csiso87jisx208':
+		case 'isoir87':
+		case 'jisc62261983':
+		case 'jisx2081983':
+		case 'x208':
+			return 'JIS_C6226-1983';
+
+		case 'csiso91jisc62291984a':
+		case 'isoir91':
+		case 'jisc62291984a':
+		case 'jpocra':
+			return 'JIS_C6229-1984-a';
+
+		case 'csiso92jisc62991984b':
+		case 'iso646jpocrb':
+		case 'isoir92':
+		case 'jisc62291984b':
+		case 'jpocrb':
+			return 'JIS_C6229-1984-b';
+
+		case 'csiso93jis62291984badd':
+		case 'isoir93':
+		case 'jisc62291984badd':
+		case 'jpocrbadd':
+			return 'JIS_C6229-1984-b-add';
+
+		case 'csiso94jis62291984hand':
+		case 'isoir94':
+		case 'jisc62291984hand':
+		case 'jpocrhand':
+			return 'JIS_C6229-1984-hand';
+
+		case 'csiso95jis62291984handadd':
+		case 'isoir95':
+		case 'jisc62291984handadd':
+		case 'jpocrhandadd':
+			return 'JIS_C6229-1984-hand-add';
+
+		case 'csiso96jisc62291984kana':
+		case 'isoir96':
+		case 'jisc62291984kana':
+			return 'JIS_C6229-1984-kana';
+
+		case 'csjisencoding':
+		case 'jisencoding':
+			return 'JIS_Encoding';
+
+		case 'cshalfwidthkatakana':
+		case 'jisx201':
+		case 'x201':
+			return 'JIS_X0201';
+
+		case 'csiso159jisx2121990':
+		case 'isoir159':
+		case 'jisx2121990':
+		case 'x212':
+			return 'JIS_X0212-1990';
+
+		case 'csiso141jusib1002':
+		case 'iso646yu':
+		case 'isoir141':
+		case 'js':
+		case 'jusib1002':
+		case 'yu':
+			return 'JUS_I.B1.002';
+
+		case 'csiso147macedonian':
+		case 'isoir147':
+		case 'jusib1003mac':
+		case 'macedonian':
+			return 'JUS_I.B1.003-mac';
+
+		case 'csiso146serbian':
+		case 'isoir146':
+		case 'jusib1003serb':
+		case 'serbian':
+			return 'JUS_I.B1.003-serb';
+
+		case 'koi7switched':
+			return 'KOI7-switched';
+
+		case 'cskoi8r':
+		case 'koi8r':
+			return 'KOI8-R';
+
+		case 'koi8u':
+			return 'KOI8-U';
+
+		case 'csksc5636':
+		case 'iso646kr':
+		case 'ksc5636':
+			return 'KSC5636';
+
+		case 'cskz1048':
+		case 'kz1048':
+		case 'rk1048':
+		case 'strk10482002':
+			return 'KZ-1048';
+
+		case 'csiso19latingreek':
+		case 'isoir19':
+		case 'latingreek':
+			return 'latin-greek';
+
+		case 'csiso27latingreek1':
+		case 'isoir27':
+		case 'latingreek1':
+			return 'Latin-greek-1';
+
+		case 'csiso158lap':
+		case 'isoir158':
+		case 'lap':
+		case 'latinlap':
+			return 'latin-lap';
+
+		case 'csmacintosh':
+		case 'mac':
+		case 'macintosh':
+			return 'macintosh';
+
+		case 'csmicrosoftpublishing':
+		case 'microsoftpublishing':
+			return 'Microsoft-Publishing';
+
+		case 'csmnem':
+		case 'mnem':
+			return 'MNEM';
+
+		case 'csmnemonic':
+		case 'mnemonic':
+			return 'MNEMONIC';
+
+		case 'csiso86hungarian':
+		case 'hu':
+		case 'iso646hu':
+		case 'isoir86':
+		case 'msz77953':
+			return 'MSZ_7795.3';
+
+		case 'csnatsdano':
+		case 'isoir91':
+		case 'natsdano':
+			return 'NATS-DANO';
+
+		case 'csnatsdanoadd':
+		case 'isoir92':
+		case 'natsdanoadd':
+			return 'NATS-DANO-ADD';
+
+		case 'csnatssefi':
+		case 'isoir81':
+		case 'natssefi':
+			return 'NATS-SEFI';
+
+		case 'csnatssefiadd':
+		case 'isoir82':
+		case 'natssefiadd':
+			return 'NATS-SEFI-ADD';
+
+		case 'csiso151cuba':
+		case 'cuba':
+		case 'iso646cu':
+		case 'isoir151':
+		case 'ncnc1081':
+			return 'NC_NC00-10:81';
+
+		case 'csiso69french':
+		case 'fr':
+		case 'iso646fr':
+		case 'isoir69':
+		case 'nfz62010':
+			return 'NF_Z_62-010';
+
+		case 'csiso25french':
+		case 'iso646fr1':
+		case 'isoir25':
+		case 'nfz620101973':
+			return 'NF_Z_62-010_(1973)';
+
+		case 'csiso60danishnorwegian':
+		case 'csiso60norwegian1':
+		case 'iso646no':
+		case 'isoir60':
+		case 'no':
+		case 'ns45511':
+			return 'NS_4551-1';
+
+		case 'csiso61norwegian2':
+		case 'iso646no2':
+		case 'isoir61':
+		case 'no2':
+		case 'ns45512':
+			return 'NS_4551-2';
+
+		case 'osdebcdicdf3irv':
+			return 'OSD_EBCDIC_DF03_IRV';
+
+		case 'osdebcdicdf41':
+			return 'OSD_EBCDIC_DF04_1';
+
+		case 'osdebcdicdf415':
+			return 'OSD_EBCDIC_DF04_15';
+
+		case 'cspc8danishnorwegian':
+		case 'pc8danishnorwegian':
+			return 'PC8-Danish-Norwegian';
+
+		case 'cspc8turkish':
+		case 'pc8turkish':
+			return 'PC8-Turkish';
+
+		case 'csiso16portuguese':
+		case 'iso646pt':
+		case 'isoir16':
+		case 'pt':
+			return 'PT';
+
+		case 'csiso84portuguese2':
+		case 'iso646pt2':
+		case 'isoir84':
+		case 'pt2':
+			return 'PT2';
+
+		case 'cp154':
+		case 'csptcp154':
+		case 'cyrillicasian':
+		case 'pt154':
+		case 'ptcp154':
+			return 'PTCP154';
+
+		case 'scsu':
+			return 'SCSU';
+
+		case 'csiso10swedish':
+		case 'fi':
+		case 'iso646fi':
+		case 'iso646se':
+		case 'isoir10':
+		case 'se':
+		case 'sen850200b':
+			return 'SEN_850200_B';
+
+		case 'csiso11swedishfornames':
+		case 'iso646se2':
+		case 'isoir11':
+		case 'se2':
+		case 'sen850200c':
+			return 'SEN_850200_C';
+
+		case 'csshiftjis':
+		case 'mskanji':
+		case 'shiftjis':
+			return 'Shift_JIS';
+
+		case 'csiso102t617bit':
+		case 'isoir102':
+		case 't617bit':
+			return 'T.61-7bit';
+
+		case 'csiso103t618bit':
+		case 'isoir103':
+		case 't61':
+		case 't618bit':
+			return 'T.61-8bit';
+
+		case 'csiso128t101g2':
+		case 'isoir128':
+		case 't101g2':
+			return 'T.101-G2';
+
+		case 'cstscii':
+		case 'tscii':
+			return 'TSCII';
+
+		case 'csunicode11':
+		case 'unicode11':
+			return 'UNICODE-1-1';
+
+		case 'csunicode11utf7':
+		case 'unicode11utf7':
+			return 'UNICODE-1-1-UTF-7';
+
+		case 'csunknown8bit':
+		case 'unknown8bit':
+			return 'UNKNOWN-8BIT';
+
+		case 'ansix341968':
+		case 'ansix341986':
+		case 'ascii':
+		case 'cp367':
+		case 'csascii':
+		case 'ibm367':
+		case 'iso646irv1991':
+		case 'iso646us':
+		case 'isoir6':
+		case 'us':
+		case 'usascii':
+			return 'US-ASCII';
+
+		case 'csusdk':
+		case 'usdk':
+			return 'us-dk';
+
+		case 'utf7':
+			return 'UTF-7';
+
+		case 'utf8':
+			return 'UTF-8';
+
+		case 'utf16':
+			return 'UTF-16';
+
+		case 'utf16be':
+			return 'UTF-16BE';
+
+		case 'utf16le':
+			return 'UTF-16LE';
+
+		case 'utf32':
+			return 'UTF-32';
+
+		case 'utf32be':
+			return 'UTF-32BE';
+
+		case 'utf32le':
+			return 'UTF-32LE';
+
+		case 'csventurainternational':
+		case 'venturainternational':
+			return 'Ventura-International';
+
+		case 'csventuramath':
+		case 'venturamath':
+			return 'Ventura-Math';
+
+		case 'csventuraus':
+		case 'venturaus':
+			return 'Ventura-US';
+
+		case 'csiso70videotexsupp1':
+		case 'isoir70':
+		case 'videotexsuppl':
+			return 'videotex-suppl';
+
+		case 'csviqr':
+		case 'viqr':
+			return 'VIQR';
+
+		case 'csviscii':
+		case 'viscii':
+			return 'VISCII';
+
+		case 'cswindows31j':
+		case 'windows31j':
+			return 'Windows-31J';
+
+		case 'iso885911':
+		case 'tis620':
+			return 'windows-874';
+
+		case 'cseuckr':
+		case 'csksc56011987':
+		case 'euckr':
+		case 'isoir149':
+		case 'korean':
+		case 'ksc5601':
+		case 'ksc56011987':
+		case 'ksc56011989':
+		case 'windows949':
+			return 'windows-949';
+
+		case 'windows1250':
+			return 'windows-1250';
+
+		case 'windows1251':
+			return 'windows-1251';
+
+		case 'cp819':
+		case 'csisolatin1':
+		case 'ibm819':
+		case 'iso88591':
+		case 'iso885911987':
+		case 'isoir100':
+		case 'l1':
+		case 'latin1':
+		case 'windows1252':
+			return 'windows-1252';
+
+		case 'windows1253':
+			return 'windows-1253';
 
-			case 'windows1256':
-				return 'windows-1256';
+		case 'csisolatin5':
+		case 'iso88599':
+		case 'iso885991989':
+		case 'isoir148':
+		case 'l5':
+		case 'latin5':
+		case 'windows1254':
+			return 'windows-1254';
 
-			case 'windows1257':
-				return 'windows-1257';
-
-			case 'windows1258':
-				return 'windows-1258';
+		case 'windows1255':
+			return 'windows-1255';
 
-			default:
-				return $charset;
+		case 'windows1256':
+			return 'windows-1256';
+
+		case 'windows1257':
+			return 'windows-1257';
+
+		case 'windows1258':
+			return 'windows-1258';
+
+		default:
+			return $charset;
 		}
 	}
 
@@ -10840,6 +10942,7 @@ class SimplePie_Misc
 		return false;
 	}
 
+
 	/**
 	 * Strip HTML comments
 	 *
@@ -10885,6 +10988,7 @@ class SimplePie_Misc
 		return $decoder->parse();
 	}
 
+
 	/**
 	 * Remove RFC822 comments
 	 *
@@ -10920,13 +11024,13 @@ class SimplePie_Misc
 					{
 						switch ($string[$position])
 						{
-							case '(':
-								$depth++;
-								break;
+						case '(':
+							$depth++;
+							break;
 
-							case ')':
-								$depth--;
-								break;
+						case ')':
+							$depth--;
+							break;
 						}
 						$position++;
 					}
@@ -10984,20 +11088,20 @@ class SimplePie_Misc
 		{
 			switch (strtolower(trim($attribs['']['type'])))
 			{
-				case 'text':
-				case 'text/plain':
-					return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
+			case 'text':
+			case 'text/plain':
+				return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
 
-				case 'html':
-				case 'text/html':
-					return SIMPLEPIE_CONSTRUCT_HTML | $mode;
+			case 'html':
+			case 'text/html':
+				return SIMPLEPIE_CONSTRUCT_HTML | $mode;
 
-				case 'xhtml':
-				case 'application/xhtml+xml':
-					return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
+			case 'xhtml':
+			case 'application/xhtml+xml':
+				return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE | $mode;
+			default:
+				return SIMPLEPIE_CONSTRUCT_NONE | $mode;
 			}
 		}
 		else
@@ -11012,17 +11116,17 @@ class SimplePie_Misc
 		{
 			switch (strtolower(trim($attribs['']['type'])))
 			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+			case 'text':
+				return SIMPLEPIE_CONSTRUCT_TEXT;
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+			case 'html':
+				return SIMPLEPIE_CONSTRUCT_HTML;
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+			case 'xhtml':
+				return SIMPLEPIE_CONSTRUCT_XHTML;
 
-				default:
-					return SIMPLEPIE_CONSTRUCT_NONE;
+			default:
+				return SIMPLEPIE_CONSTRUCT_NONE;
 			}
 		}
 		return SIMPLEPIE_CONSTRUCT_TEXT;
@@ -11035,14 +11139,14 @@ class SimplePie_Misc
 			$type = strtolower(trim($attribs['']['type']));
 			switch ($type)
 			{
-				case 'text':
-					return SIMPLEPIE_CONSTRUCT_TEXT;
+			case 'text':
+				return SIMPLEPIE_CONSTRUCT_TEXT;
 
-				case 'html':
-					return SIMPLEPIE_CONSTRUCT_HTML;
+			case 'html':
+				return SIMPLEPIE_CONSTRUCT_HTML;
 
-				case 'xhtml':
-					return SIMPLEPIE_CONSTRUCT_XHTML;
+			case 'xhtml':
+				return SIMPLEPIE_CONSTRUCT_XHTML;
 			}
 			if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
 			{
@@ -11125,6 +11229,7 @@ class SimplePie_Misc
 		}
 	}
 
+
 	/**
 	 * Converts a unicode codepoint to a UTF-8 character
 	 *
@@ -11141,21 +11246,21 @@ class SimplePie_Misc
 			return false;
 		}
 		else if ($codepoint <= 0x7f)
-		{
-			return chr($codepoint);
-		}
+			{
+				return chr($codepoint);
+			}
 		else if ($codepoint <= 0x7ff)
-		{
-			return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
-		}
+			{
+				return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+			}
 		else if ($codepoint <= 0xffff)
-		{
-			return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
-		}
+			{
+				return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			}
 		else if ($codepoint <= 0x10ffff)
-		{
-			return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
-		}
+			{
+				return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+			}
 		else
 		{
 			// U+FFFD REPLACEMENT CHARACTER
@@ -11163,6 +11268,7 @@ class SimplePie_Misc
 		}
 	}
 
+
 	/**
 	 * Re-implementation of PHP 5's stripos()
 	 *
@@ -11206,6 +11312,7 @@ class SimplePie_Misc
 		}
 	}
 
+
 	/**
 	 * Similar to parse_str()
 	 *
@@ -11354,7 +11461,7 @@ class SimplePie_Misc
 		header('Content-type: text/javascript; charset: UTF-8');
 		header('Cache-Control: must-revalidate');
 		header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days
-		?>
+?>
 function embed_odeo(link) {
 	document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');
 }
@@ -11381,6 +11488,7 @@ function embed_wmedia(width, height, link) {
 }
 		<?php
 	}
+
 }
 
 /**
@@ -11392,6 +11500,7 @@ function embed_wmedia(width, height, link) {
  */
 class SimplePie_Decode_HTML_Entities
 {
+
 	/**
 	 * Data to be parsed
 	 *
@@ -11416,6 +11525,7 @@ class SimplePie_Decode_HTML_Entities
 	 */
 	var $position = 0;
 
+
 	/**
 	 * Create an instance of the class with the input data
 	 *
@@ -11427,6 +11537,7 @@ class SimplePie_Decode_HTML_Entities
 		$this->data = $data;
 	}
 
+
 	/**
 	 * Parse the input data
 	 *
@@ -11444,6 +11555,7 @@ class SimplePie_Decode_HTML_Entities
 		return $this->data;
 	}
 
+
 	/**
 	 * Consume the next byte
 	 *
@@ -11463,6 +11575,7 @@ class SimplePie_Decode_HTML_Entities
 		}
 	}
 
+
 	/**
 	 * Consume a range of characters
 	 *
@@ -11485,6 +11598,7 @@ class SimplePie_Decode_HTML_Entities
 		}
 	}
 
+
 	/**
 	 * Unconsume one byte
 	 *
@@ -11496,6 +11610,7 @@ class SimplePie_Decode_HTML_Entities
 		$this->position--;
 	}
 
+
 	/**
 	 * Decode an entity
 	 *
@@ -11505,86 +11620,87 @@ class SimplePie_Decode_HTML_Entities
 	{
 		switch ($this->consume())
 		{
-			case "\x09":
-			case "\x0A":
-			case "\x0B":
-			case "\x0B":
-			case "\x0C":
-			case "\x20":
-			case "\x3C":
-			case "\x26":
-			case false:
+		case "\x09":
+		case "\x0A":
+		case "\x0B":
+		case "\x0B":
+		case "\x0C":
+		case "\x20":
+		case "\x3C":
+		case "\x26":
+		case false:
+			break;
+
+		case "\x23":
+			switch ($this->consume())
+			{
+			case "\x78":
+			case "\x58":
+				$range = '0123456789ABCDEFabcdef';
+				$hex = true;
 				break;
 
-			case "\x23":
-				switch ($this->consume())
-				{
-					case "\x78":
-					case "\x58":
-						$range = '0123456789ABCDEFabcdef';
-						$hex = true;
-						break;
+			default:
+				$range = '0123456789';
+				$hex = false;
+				$this->unconsume();
+				break;
+			}
 
-					default:
-						$range = '0123456789';
-						$hex = false;
-						$this->unconsume();
-						break;
-				}
+			if ($codepoint = $this->consume_range($range))
+			{
+				static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
 
-				if ($codepoint = $this->consume_range($range))
+				if ($hex)
 				{
-					static $windows_1252_specials = array(0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8");
-
-					if ($hex)
-					{
-						$codepoint = hexdec($codepoint);
-					}
-					else
-					{
-						$codepoint = intval($codepoint);
-					}
-
-					if (isset($windows_1252_specials[$codepoint]))
-					{
-						$replacement = $windows_1252_specials[$codepoint];
-					}
-					else
-					{
-						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
-					}
-
-					if (!in_array($this->consume(), array(';', false), true))
-					{
-						$this->unconsume();
-					}
-
-					$consumed_length = strlen($this->consumed);
-					$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
-					$this->position += strlen($replacement) - $consumed_length;
+					$codepoint = hexdec($codepoint);
+				}
+				else
+				{
+					$codepoint = intval($codepoint);
 				}
-				break;
 
-			default:
-				static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
+				if (isset($windows_1252_specials[$codepoint]))
+				{
+					$replacement = $windows_1252_specials[$codepoint];
+				}
+				else
+				{
+					$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
+				}
 
-				for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
+				if (!in_array($this->consume(), array(';', false), true))
 				{
-					$consumed = substr($this->consumed, 1);
-					if (isset($entities[$consumed]))
-					{
-						$match = $consumed;
-					}
+					$this->unconsume();
 				}
 
-				if ($match !== null)
+				$consumed_length = strlen($this->consumed);
+				$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
+				$this->position += strlen($replacement) - $consumed_length;
+			}
+			break;
+
+		default:
+			static $entities = array('Aacute' => "\xC3\x81", 'aacute' => "\xC3\xA1", 'Aacute;' => "\xC3\x81", 'aacute;' => "\xC3\xA1", 'Acirc' => "\xC3\x82", 'acirc' => "\xC3\xA2", 'Acirc;' => "\xC3\x82", 'acirc;' => "\xC3\xA2", 'acute' => "\xC2\xB4", 'acute;' => "\xC2\xB4", 'AElig' => "\xC3\x86", 'aelig' => "\xC3\xA6", 'AElig;' => "\xC3\x86", 'aelig;' => "\xC3\xA6", 'Agrave' => "\xC3\x80", 'agrave' => "\xC3\xA0", 'Agrave;' => "\xC3\x80", 'agrave;' => "\xC3\xA0", 'alefsym;' => "\xE2\x84\xB5", 'Alpha;' => "\xCE\x91", 'alpha;' => "\xCE\xB1", 'AMP' => "\x26", 'amp' => "\x26", 'AMP;' => "\x26", 'amp;' => "\x26", 'and;' => "\xE2\x88\xA7", 'ang;' => "\xE2\x88\xA0", 'apos;' => "\x27", 'Aring' => "\xC3\x85", 'aring' => "\xC3\xA5", 'Aring;' => "\xC3\x85", 'aring;' => "\xC3\xA5", 'asymp;' => "\xE2\x89\x88", 'Atilde' => "\xC3\x83", 'atilde' => "\xC3\xA3", 'Atilde;' => "\xC3\x83", 'atilde;' => "\xC3\xA3", 'Auml' => "\xC3\x84", 'auml' => "\xC3\xA4", 'Auml;' => "\xC3\x84", 'auml;' => "\xC3\xA4", 'bdquo;' => "\xE2\x80\x9E", 'Beta;' => "\xCE\x92", 'beta;' => "\xCE\xB2", 'brvbar' => "\xC2\xA6", 'brvbar;' => "\xC2\xA6", 'bull;' => "\xE2\x80\xA2", 'cap;' => "\xE2\x88\xA9", 'Ccedil' => "\xC3\x87", 'ccedil' => "\xC3\xA7", 'Ccedil;' => "\xC3\x87", 'ccedil;' => "\xC3\xA7", 'cedil' => "\xC2\xB8", 'cedil;' => "\xC2\xB8", 'cent' => "\xC2\xA2", 'cent;' => "\xC2\xA2", 'Chi;' => "\xCE\xA7", 'chi;' => "\xCF\x87", 'circ;' => "\xCB\x86", 'clubs;' => "\xE2\x99\xA3", 'cong;' => "\xE2\x89\x85", 'COPY' => "\xC2\xA9", 'copy' => "\xC2\xA9", 'COPY;' => "\xC2\xA9", 'copy;' => "\xC2\xA9", 'crarr;' => "\xE2\x86\xB5", 'cup;' => "\xE2\x88\xAA", 'curren' => "\xC2\xA4", 'curren;' => "\xC2\xA4", 'Dagger;' => "\xE2\x80\xA1", 'dagger;' => "\xE2\x80\xA0", 'dArr;' => "\xE2\x87\x93", 'darr;' => "\xE2\x86\x93", 'deg' => "\xC2\xB0", 'deg;' => "\xC2\xB0", 'Delta;' => "\xCE\x94", 'delta;' => "\xCE\xB4", 'diams;' => "\xE2\x99\xA6", 'divide' => "\xC3\xB7", 'divide;' => "\xC3\xB7", 'Eacute' => "\xC3\x89", 'eacute' => "\xC3\xA9", 'Eacute;' => "\xC3\x89", 'eacute;' => "\xC3\xA9", 'Ecirc' => "\xC3\x8A", 'ecirc' => "\xC3\xAA", 'Ecirc;' => "\xC3\x8A", 'ecirc;' => "\xC3\xAA", 'Egrave' => "\xC3\x88", 'egrave' => "\xC3\xA8", 'Egrave;' => "\xC3\x88", 'egrave;' => "\xC3\xA8", 'empty;' => "\xE2\x88\x85", 'emsp;' => "\xE2\x80\x83", 'ensp;' => "\xE2\x80\x82", 'Epsilon;' => "\xCE\x95", 'epsilon;' => "\xCE\xB5", 'equiv;' => "\xE2\x89\xA1", 'Eta;' => "\xCE\x97", 'eta;' => "\xCE\xB7", 'ETH' => "\xC3\x90", 'eth' => "\xC3\xB0", 'ETH;' => "\xC3\x90", 'eth;' => "\xC3\xB0", 'Euml' => "\xC3\x8B", 'euml' => "\xC3\xAB", 'Euml;' => "\xC3\x8B", 'euml;' => "\xC3\xAB", 'euro;' => "\xE2\x82\xAC", 'exist;' => "\xE2\x88\x83", 'fnof;' => "\xC6\x92", 'forall;' => "\xE2\x88\x80", 'frac12' => "\xC2\xBD", 'frac12;' => "\xC2\xBD", 'frac14' => "\xC2\xBC", 'frac14;' => "\xC2\xBC", 'frac34' => "\xC2\xBE", 'frac34;' => "\xC2\xBE", 'frasl;' => "\xE2\x81\x84", 'Gamma;' => "\xCE\x93", 'gamma;' => "\xCE\xB3", 'ge;' => "\xE2\x89\xA5", 'GT' => "\x3E", 'gt' => "\x3E", 'GT;' => "\x3E", 'gt;' => "\x3E", 'hArr;' => "\xE2\x87\x94", 'harr;' => "\xE2\x86\x94", 'hearts;' => "\xE2\x99\xA5", 'hellip;' => "\xE2\x80\xA6", 'Iacute' => "\xC3\x8D", 'iacute' => "\xC3\xAD", 'Iacute;' => "\xC3\x8D", 'iacute;' => "\xC3\xAD", 'Icirc' => "\xC3\x8E", 'icirc' => "\xC3\xAE", 'Icirc;' => "\xC3\x8E", 'icirc;' => "\xC3\xAE", 'iexcl' => "\xC2\xA1", 'iexcl;' => "\xC2\xA1", 'Igrave' => "\xC3\x8C", 'igrave' => "\xC3\xAC", 'Igrave;' => "\xC3\x8C", 'igrave;' => "\xC3\xAC", 'image;' => "\xE2\x84\x91", 'infin;' => "\xE2\x88\x9E", 'int;' => "\xE2\x88\xAB", 'Iota;' => "\xCE\x99", 'iota;' => "\xCE\xB9", 'iquest' => "\xC2\xBF", 'iquest;' => "\xC2\xBF", 'isin;' => "\xE2\x88\x88", 'Iuml' => "\xC3\x8F", 'iuml' => "\xC3\xAF", 'Iuml;' => "\xC3\x8F", 'iuml;' => "\xC3\xAF", 'Kappa;' => "\xCE\x9A", 'kappa;' => "\xCE\xBA", 'Lambda;' => "\xCE\x9B", 'lambda;' => "\xCE\xBB", 'lang;' => "\xE3\x80\x88", 'laquo' => "\xC2\xAB", 'laquo;' => "\xC2\xAB", 'lArr;' => "\xE2\x87\x90", 'larr;' => "\xE2\x86\x90", 'lceil;' => "\xE2\x8C\x88", 'ldquo;' => "\xE2\x80\x9C", 'le;' => "\xE2\x89\xA4", 'lfloor;' => "\xE2\x8C\x8A", 'lowast;' => "\xE2\x88\x97", 'loz;' => "\xE2\x97\x8A", 'lrm;' => "\xE2\x80\x8E", 'lsaquo;' => "\xE2\x80\xB9", 'lsquo;' => "\xE2\x80\x98", 'LT' => "\x3C", 'lt' => "\x3C", 'LT;' => "\x3C", 'lt;' => "\x3C", 'macr' => "\xC2\xAF", 'macr;' => "\xC2\xAF", 'mdash;' => "\xE2\x80\x94", 'micro' => "\xC2\xB5", 'micro;' => "\xC2\xB5", 'middot' => "\xC2\xB7", 'middot;' => "\xC2\xB7", 'minus;' => "\xE2\x88\x92", 'Mu;' => "\xCE\x9C", 'mu;' => "\xCE\xBC", 'nabla;' => "\xE2\x88\x87", 'nbsp' => "\xC2\xA0", 'nbsp;' => "\xC2\xA0", 'ndash;' => "\xE2\x80\x93", 'ne;' => "\xE2\x89\xA0", 'ni;' => "\xE2\x88\x8B", 'not' => "\xC2\xAC", 'not;' => "\xC2\xAC", 'notin;' => "\xE2\x88\x89", 'nsub;' => "\xE2\x8A\x84", 'Ntilde' => "\xC3\x91", 'ntilde' => "\xC3\xB1", 'Ntilde;' => "\xC3\x91", 'ntilde;' => "\xC3\xB1", 'Nu;' => "\xCE\x9D", 'nu;' => "\xCE\xBD", 'Oacute' => "\xC3\x93", 'oacute' => "\xC3\xB3", 'Oacute;' => "\xC3\x93", 'oacute;' => "\xC3\xB3", 'Ocirc' => "\xC3\x94", 'ocirc' => "\xC3\xB4", 'Ocirc;' => "\xC3\x94", 'ocirc;' => "\xC3\xB4", 'OElig;' => "\xC5\x92", 'oelig;' => "\xC5\x93", 'Ograve' => "\xC3\x92", 'ograve' => "\xC3\xB2", 'Ograve;' => "\xC3\x92", 'ograve;' => "\xC3\xB2", 'oline;' => "\xE2\x80\xBE", 'Omega;' => "\xCE\xA9", 'omega;' => "\xCF\x89", 'Omicron;' => "\xCE\x9F", 'omicron;' => "\xCE\xBF", 'oplus;' => "\xE2\x8A\x95", 'or;' => "\xE2\x88\xA8", 'ordf' => "\xC2\xAA", 'ordf;' => "\xC2\xAA", 'ordm' => "\xC2\xBA", 'ordm;' => "\xC2\xBA", 'Oslash' => "\xC3\x98", 'oslash' => "\xC3\xB8", 'Oslash;' => "\xC3\x98", 'oslash;' => "\xC3\xB8", 'Otilde' => "\xC3\x95", 'otilde' => "\xC3\xB5", 'Otilde;' => "\xC3\x95", 'otilde;' => "\xC3\xB5", 'otimes;' => "\xE2\x8A\x97", 'Ouml' => "\xC3\x96", 'ouml' => "\xC3\xB6", 'Ouml;' => "\xC3\x96", 'ouml;' => "\xC3\xB6", 'para' => "\xC2\xB6", 'para;' => "\xC2\xB6", 'part;' => "\xE2\x88\x82", 'permil;' => "\xE2\x80\xB0", 'perp;' => "\xE2\x8A\xA5", 'Phi;' => "\xCE\xA6", 'phi;' => "\xCF\x86", 'Pi;' => "\xCE\xA0", 'pi;' => "\xCF\x80", 'piv;' => "\xCF\x96", 'plusmn' => "\xC2\xB1", 'plusmn;' => "\xC2\xB1", 'pound' => "\xC2\xA3", 'pound;' => "\xC2\xA3", 'Prime;' => "\xE2\x80\xB3", 'prime;' => "\xE2\x80\xB2", 'prod;' => "\xE2\x88\x8F", 'prop;' => "\xE2\x88\x9D", 'Psi;' => "\xCE\xA8", 'psi;' => "\xCF\x88", 'QUOT' => "\x22", 'quot' => "\x22", 'QUOT;' => "\x22", 'quot;' => "\x22", 'radic;' => "\xE2\x88\x9A", 'rang;' => "\xE3\x80\x89", 'raquo' => "\xC2\xBB", 'raquo;' => "\xC2\xBB", 'rArr;' => "\xE2\x87\x92", 'rarr;' => "\xE2\x86\x92", 'rceil;' => "\xE2\x8C\x89", 'rdquo;' => "\xE2\x80\x9D", 'real;' => "\xE2\x84\x9C", 'REG' => "\xC2\xAE", 'reg' => "\xC2\xAE", 'REG;' => "\xC2\xAE", 'reg;' => "\xC2\xAE", 'rfloor;' => "\xE2\x8C\x8B", 'Rho;' => "\xCE\xA1", 'rho;' => "\xCF\x81", 'rlm;' => "\xE2\x80\x8F", 'rsaquo;' => "\xE2\x80\xBA", 'rsquo;' => "\xE2\x80\x99", 'sbquo;' => "\xE2\x80\x9A", 'Scaron;' => "\xC5\xA0", 'scaron;' => "\xC5\xA1", 'sdot;' => "\xE2\x8B\x85", 'sect' => "\xC2\xA7", 'sect;' => "\xC2\xA7", 'shy' => "\xC2\xAD", 'shy;' => "\xC2\xAD", 'Sigma;' => "\xCE\xA3", 'sigma;' => "\xCF\x83", 'sigmaf;' => "\xCF\x82", 'sim;' => "\xE2\x88\xBC", 'spades;' => "\xE2\x99\xA0", 'sub;' => "\xE2\x8A\x82", 'sube;' => "\xE2\x8A\x86", 'sum;' => "\xE2\x88\x91", 'sup;' => "\xE2\x8A\x83", 'sup1' => "\xC2\xB9", 'sup1;' => "\xC2\xB9", 'sup2' => "\xC2\xB2", 'sup2;' => "\xC2\xB2", 'sup3' => "\xC2\xB3", 'sup3;' => "\xC2\xB3", 'supe;' => "\xE2\x8A\x87", 'szlig' => "\xC3\x9F", 'szlig;' => "\xC3\x9F", 'Tau;' => "\xCE\xA4", 'tau;' => "\xCF\x84", 'there4;' => "\xE2\x88\xB4", 'Theta;' => "\xCE\x98", 'theta;' => "\xCE\xB8", 'thetasym;' => "\xCF\x91", 'thinsp;' => "\xE2\x80\x89", 'THORN' => "\xC3\x9E", 'thorn' => "\xC3\xBE", 'THORN;' => "\xC3\x9E", 'thorn;' => "\xC3\xBE", 'tilde;' => "\xCB\x9C", 'times' => "\xC3\x97", 'times;' => "\xC3\x97", 'TRADE;' => "\xE2\x84\xA2", 'trade;' => "\xE2\x84\xA2", 'Uacute' => "\xC3\x9A", 'uacute' => "\xC3\xBA", 'Uacute;' => "\xC3\x9A", 'uacute;' => "\xC3\xBA", 'uArr;' => "\xE2\x87\x91", 'uarr;' => "\xE2\x86\x91", 'Ucirc' => "\xC3\x9B", 'ucirc' => "\xC3\xBB", 'Ucirc;' => "\xC3\x9B", 'ucirc;' => "\xC3\xBB", 'Ugrave' => "\xC3\x99", 'ugrave' => "\xC3\xB9", 'Ugrave;' => "\xC3\x99", 'ugrave;' => "\xC3\xB9", 'uml' => "\xC2\xA8", 'uml;' => "\xC2\xA8", 'upsih;' => "\xCF\x92", 'Upsilon;' => "\xCE\xA5", 'upsilon;' => "\xCF\x85", 'Uuml' => "\xC3\x9C", 'uuml' => "\xC3\xBC", 'Uuml;' => "\xC3\x9C", 'uuml;' => "\xC3\xBC", 'weierp;' => "\xE2\x84\x98", 'Xi;' => "\xCE\x9E", 'xi;' => "\xCE\xBE", 'Yacute' => "\xC3\x9D", 'yacute' => "\xC3\xBD", 'Yacute;' => "\xC3\x9D", 'yacute;' => "\xC3\xBD", 'yen' => "\xC2\xA5", 'yen;' => "\xC2\xA5", 'yuml' => "\xC3\xBF", 'Yuml;' => "\xC5\xB8", 'yuml;' => "\xC3\xBF", 'Zeta;' => "\xCE\x96", 'zeta;' => "\xCE\xB6", 'zwj;' => "\xE2\x80\x8D", 'zwnj;' => "\xE2\x80\x8C");
+
+			for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++)
+			{
+				$consumed = substr($this->consumed, 1);
+				if (isset($entities[$consumed]))
 				{
- 					$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
-					$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
+					$match = $consumed;
 				}
-				break;
+			}
+
+			if ($match !== null)
+			{
+				$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
+				$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
+			}
+			break;
 		}
 	}
+
 }
 
 /**
@@ -11594,6 +11710,7 @@ class SimplePie_Decode_HTML_Entities
  */
 class SimplePie_IRI
 {
+
 	/**
 	 * Scheme
 	 *
@@ -11658,6 +11775,7 @@ class SimplePie_IRI
 	 */
 	var $valid = array();
 
+
 	/**
 	 * Return the entire IRI when you try and read the object as a string
 	 *
@@ -11669,6 +11787,7 @@ class SimplePie_IRI
 		return $this->get_iri();
 	}
 
+
 	/**
 	 * Create a new IRI object, from a specified string
 	 *
@@ -11771,6 +11890,7 @@ class SimplePie_IRI
 		return $target;
 	}
 
+
 	/**
 	 * Parse an IRI into scheme/authority/path/query/fragment segments
 	 *
@@ -11788,6 +11908,7 @@ class SimplePie_IRI
 		return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
 	}
 
+
 	/**
 	 * Remove dot segments from a path
 	 *
@@ -11849,6 +11970,7 @@ class SimplePie_IRI
 		return $output . $input;
 	}
 
+
 	/**
 	 * Replace invalid character with percent encoding
 	 *
@@ -11928,6 +12050,7 @@ class SimplePie_IRI
 		return $string;
 	}
 
+
 	/**
 	 * Check if the object represents a valid IRI
 	 *
@@ -11939,6 +12062,7 @@ class SimplePie_IRI
 		return array_sum($this->valid) === count($this->valid);
 	}
 
+
 	/**
 	 * Set the scheme. Returns true on success, false on failure (if there are
 	 * any invalid characters).
@@ -11958,21 +12082,21 @@ class SimplePie_IRI
 			$len = strlen($scheme);
 			switch (true)
 			{
-				case $len > 1:
-					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
-					{
-						$this->scheme = null;
-						$this->valid[__FUNCTION__] = false;
-						return false;
-					}
+			case $len > 1:
+				if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-.', 1))
+				{
+					$this->scheme = null;
+					$this->valid[__FUNCTION__] = false;
+					return false;
+				}
 
-				case $len > 0:
-					if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
-					{
-						$this->scheme = null;
-						$this->valid[__FUNCTION__] = false;
-						return false;
-					}
+			case $len > 0:
+				if (!strspn($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 0, 1))
+				{
+					$this->scheme = null;
+					$this->valid[__FUNCTION__] = false;
+					return false;
+				}
 			}
 			$this->scheme = strtolower($scheme);
 		}
@@ -11980,6 +12104,7 @@ class SimplePie_IRI
 		return true;
 	}
 
+
 	/**
 	 * Set the authority. Returns true on success, false on failure (if there are
 	 * any invalid characters).
@@ -12013,6 +12138,7 @@ class SimplePie_IRI
 		return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
 	}
 
+
 	/**
 	 * Set the userinfo.
 	 *
@@ -12034,6 +12160,7 @@ class SimplePie_IRI
 		return true;
 	}
 
+
 	/**
 	 * Set the host. Returns true on success, false on failure (if there are
 	 * any invalid characters).
@@ -12073,6 +12200,7 @@ class SimplePie_IRI
 		}
 	}
 
+
 	/**
 	 * Set the port. Returns true on success, false on failure (if there are
 	 * any invalid characters).
@@ -12103,6 +12231,7 @@ class SimplePie_IRI
 		}
 	}
 
+
 	/**
 	 * Set the path.
 	 *
@@ -12136,6 +12265,7 @@ class SimplePie_IRI
 		}
 	}
 
+
 	/**
 	 * Set the query.
 	 *
@@ -12157,6 +12287,7 @@ class SimplePie_IRI
 		return true;
 	}
 
+
 	/**
 	 * Set the fragment.
 	 *
@@ -12178,6 +12309,7 @@ class SimplePie_IRI
 		return true;
 	}
 
+
 	/**
 	 * Get the complete IRI
 	 *
@@ -12218,6 +12350,7 @@ class SimplePie_IRI
 		}
 	}
 
+
 	/**
 	 * Get the scheme
 	 *
@@ -12229,6 +12362,7 @@ class SimplePie_IRI
 		return $this->scheme;
 	}
 
+
 	/**
 	 * Get the complete authority
 	 *
@@ -12261,6 +12395,7 @@ class SimplePie_IRI
 		}
 	}
 
+
 	/**
 	 * Get the user information
 	 *
@@ -12272,6 +12407,7 @@ class SimplePie_IRI
 		return $this->userinfo;
 	}
 
+
 	/**
 	 * Get the host
 	 *
@@ -12283,6 +12419,7 @@ class SimplePie_IRI
 		return $this->host;
 	}
 
+
 	/**
 	 * Get the port
 	 *
@@ -12294,6 +12431,7 @@ class SimplePie_IRI
 		return $this->port;
 	}
 
+
 	/**
 	 * Get the path
 	 *
@@ -12305,6 +12443,7 @@ class SimplePie_IRI
 		return $this->path;
 	}
 
+
 	/**
 	 * Get the query
 	 *
@@ -12316,6 +12455,7 @@ class SimplePie_IRI
 		return $this->query;
 	}
 
+
 	/**
 	 * Get the fragment
 	 *
@@ -12326,6 +12466,7 @@ class SimplePie_IRI
 	{
 		return $this->fragment;
 	}
+
 }
 
 /**
@@ -12342,6 +12483,8 @@ class SimplePie_IRI
  */
 class SimplePie_Net_IPv6
 {
+
+
 	/**
 	 * Removes a possible existing netmask specification of an IP address.
 	 *
@@ -12364,6 +12507,7 @@ class SimplePie_Net_IPv6
 		return $addr;
 	}
 
+
 	/**
 	 * Uncompresses an IPv6 address
 	 *
@@ -12371,8 +12515,8 @@ class SimplePie_Net_IPv6
 	 * function expects an valid IPv6 address and expands the '::' to
 	 * the required zeros.
 	 *
-	 * Example:	 FF01::101	->	FF01:0:0:0:0:0:0:101
-	 *			 ::1		->	0:0:0:0:0:0:0:1
+	 * Example:  FF01::101 -> FF01:0:0:0:0:0:0:101
+	 *    ::1  -> 0:0:0:0:0:0:0:1
 	 *
 	 * @access public
 	 * @static
@@ -12430,35 +12574,36 @@ class SimplePie_Net_IPv6
 			}
 			// ::xxx
 			else if ($c1 === -1)
-			{
-				$fill = str_repeat('0:', 7 - $c2);
-				$uip =	str_replace('::', $fill, $uip);
-			}
+				{
+					$fill = str_repeat('0:', 7 - $c2);
+					$uip = str_replace('::', $fill, $uip);
+				}
 			// xxx::
 			else if ($c2 === -1)
-			{
-				$fill = str_repeat(':0', 7 - $c1);
-				$uip =	str_replace('::', $fill, $uip);
-			}
+				{
+					$fill = str_repeat(':0', 7 - $c1);
+					$uip = str_replace('::', $fill, $uip);
+				}
 			// xxx::xxx
 			else
 			{
 				$fill = str_repeat(':0:', 6 - $c2 - $c1);
-				$uip =	str_replace('::', $fill, $uip);
-				$uip =	str_replace('::', ':', $uip);
+				$uip = str_replace('::', $fill, $uip);
+				$uip = str_replace('::', ':', $uip);
 			}
 		}
 		return $uip;
 	}
 
+
 	/**
 	 * Splits an IPv6 address into the IPv6 and a possible IPv4 part
 	 *
 	 * RFC 2373 allows you to note the last two parts of an IPv6 address as
 	 * an IPv4 compatible address
 	 *
-	 * Example:	 0:0:0:0:0:0:13.1.68.3
-	 *			 0:0:0:0:0:FFFF:129.144.52.38
+	 * Example:  0:0:0:0:0:0:13.1.68.3
+	 *    0:0:0:0:0:FFFF:129.144.52.38
 	 *
 	 * @access public
 	 * @static
@@ -12481,6 +12626,7 @@ class SimplePie_Net_IPv6
 		}
 	}
 
+
 	/**
 	 * Checks an IPv6 address
 	 *
@@ -12538,6 +12684,7 @@ class SimplePie_Net_IPv6
 			return false;
 		}
 	}
+
 }
 
 /**
@@ -12547,6 +12694,7 @@ class SimplePie_Net_IPv6
  */
 class SimplePie_Parse_Date
 {
+
 	/**
 	 * Input data
 	 *
@@ -13029,6 +13177,7 @@ class SimplePie_Parse_Date
 	 */
 	var $user = array();
 
+
 	/**
 	 * Create new SimplePie_Parse_Date object, and set self::day_pcre,
 	 * self::month_pcre, and self::built_in
@@ -13075,6 +13224,7 @@ class SimplePie_Parse_Date
 		return $object;
 	}
 
+
 	/**
 	 * Parse a date
 	 *
@@ -13104,6 +13254,7 @@ class SimplePie_Parse_Date
 		return false;
 	}
 
+
 	/**
 	 * Add a callback method to parse a date
 	 *
@@ -13123,6 +13274,7 @@ class SimplePie_Parse_Date
 		}
 	}
 
+
 	/**
 	 * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
 	 * well as allowing any of upper or lower case "T", horizontal tabs, or
@@ -13196,6 +13348,7 @@ class SimplePie_Parse_Date
 		}
 	}
 
+
 	/**
 	 * Remove RFC822 comments
 	 *
@@ -13231,13 +13384,13 @@ class SimplePie_Parse_Date
 					{
 						switch ($string[$position])
 						{
-							case '(':
-								$depth++;
-								break;
+						case '(':
+							$depth++;
+							break;
 
-							case ')':
-								$depth--;
-								break;
+						case ')':
+							$depth--;
+							break;
 						}
 						$position++;
 					}
@@ -13257,6 +13410,7 @@ class SimplePie_Parse_Date
 		return $output;
 	}
 
+
 	/**
 	 * Parse RFC2822's date format
 	 *
@@ -13350,6 +13504,7 @@ class SimplePie_Parse_Date
 		}
 	}
 
+
 	/**
 	 * Parse RFC850's date format
 	 *
@@ -13415,6 +13570,7 @@ class SimplePie_Parse_Date
 		}
 	}
 
+
 	/**
 	 * Parse C99's asctime()'s date format
 	 *
@@ -13457,6 +13613,7 @@ class SimplePie_Parse_Date
 		}
 	}
 
+
 	/**
 	 * Parse dates using strtotime()
 	 *
@@ -13475,6 +13632,7 @@ class SimplePie_Parse_Date
 			return $strtotime;
 		}
 	}
+
 }
 
 /**
@@ -13484,6 +13642,7 @@ class SimplePie_Parse_Date
  */
 class SimplePie_Content_Type_Sniffer
 {
+
 	/**
 	 * File object
 	 *
@@ -13492,6 +13651,7 @@ class SimplePie_Content_Type_Sniffer
 	 */
 	var $file;
 
+
 	/**
 	 * Create an instance of the class with the input file
 	 *
@@ -13503,6 +13663,7 @@ class SimplePie_Content_Type_Sniffer
 		$this->file = $file;
 	}
 
+
 	/**
 	 * Get the Content-Type of the specified file
 	 *
@@ -13568,6 +13729,7 @@ class SimplePie_Content_Type_Sniffer
 		}
 	}
 
+
 	/**
 	 * Sniff text or binary
 	 *
@@ -13593,6 +13755,7 @@ class SimplePie_Content_Type_Sniffer
 		}
 	}
 
+
 	/**
 	 * Sniff unknown
 	 *
@@ -13639,6 +13802,7 @@ class SimplePie_Content_Type_Sniffer
 		}
 	}
 
+
 	/**
 	 * Sniff images
 	 *
@@ -13670,6 +13834,7 @@ class SimplePie_Content_Type_Sniffer
 		}
 	}
 
+
 	/**
 	 * Sniff HTML
 	 *
@@ -13685,19 +13850,19 @@ class SimplePie_Content_Type_Sniffer
 		{
 			switch ($this->file->body[$pos])
 			{
-				case "\x09":
-				case "\x0A":
-				case "\x0D":
-				case "\x20":
-					$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
-					continue 2;
+			case "\x09":
+			case "\x0A":
+			case "\x0D":
+			case "\x20":
+				$pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos);
+				continue 2;
 
-				case '<':
-					$pos++;
-					break;
+			case '<':
+				$pos++;
+				break;
 
-				default:
-					return 'text/html';
+			default:
+				return 'text/html';
 			}
 
 			if (substr($this->file->body, $pos, 3) === '!--')
@@ -13751,6 +13916,7 @@ class SimplePie_Content_Type_Sniffer
 
 		return 'text/html';
 	}
+
 }
 
 /**
@@ -13760,6 +13926,7 @@ class SimplePie_Content_Type_Sniffer
  */
 class SimplePie_XML_Declaration_Parser
 {
+
 	/**
 	 * XML Version
 	 *
@@ -13816,6 +13983,7 @@ class SimplePie_XML_Declaration_Parser
 	 */
 	var $position = 0;
 
+
 	/**
 	 * Create an instance of the class with the input data
 	 *
@@ -13828,6 +13996,7 @@ class SimplePie_XML_Declaration_Parser
 		$this->data_length = strlen($this->data);
 	}
 
+
 	/**
 	 * Parse the input data
 	 *
@@ -13855,6 +14024,7 @@ class SimplePie_XML_Declaration_Parser
 		}
 	}
 
+
 	/**
 	 * Check whether there is data beyond the pointer
 	 *
@@ -13866,6 +14036,7 @@ class SimplePie_XML_Declaration_Parser
 		return (bool) ($this->position < $this->data_length);
 	}
 
+
 	/**
 	 * Advance past any whitespace
 	 *
@@ -13878,6 +14049,7 @@ class SimplePie_XML_Declaration_Parser
 		return $whitespace;
 	}
 
+
 	/**
 	 * Read value
 	 */
@@ -14040,17 +14212,17 @@ class SimplePie_XML_Declaration_Parser
 		{
 			switch ($standalone)
 			{
-				case 'yes':
-					$this->standalone = true;
-					break;
+			case 'yes':
+				$this->standalone = true;
+				break;
 
-				case 'no':
-					$this->standalone = false;
-					break;
+			case 'no':
+				$this->standalone = false;
+				break;
 
-				default:
-					$this->state = false;
-					return;
+			default:
+				$this->state = false;
+				return;
 			}
 
 			$this->skip_whitespace();
@@ -14068,6 +14240,7 @@ class SimplePie_XML_Declaration_Parser
 			$this->state = false;
 		}
 	}
+
 }
 
 class SimplePie_Locator
@@ -14325,6 +14498,7 @@ class SimplePie_Locator
 		}
 		return null;
 	}
+
 }
 
 class SimplePie_Parser
@@ -14443,51 +14617,51 @@ class SimplePie_Parser
 				switch ($xml->nodeType)
 				{
 
-					case constant('XMLReader::END_ELEMENT'):
+				case constant('XMLReader::END_ELEMENT'):
+					if ($xml->namespaceURI !== '')
+					{
+						$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+					}
+					else
+					{
+						$tagName = $xml->localName;
+					}
+					$this->tag_close(null, $tagName);
+					break;
+				case constant('XMLReader::ELEMENT'):
+					$empty = $xml->isEmptyElement;
+					if ($xml->namespaceURI !== '')
+					{
+						$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+					}
+					else
+					{
+						$tagName = $xml->localName;
+					}
+					$attributes = array();
+					while ($xml->moveToNextAttribute())
+					{
 						if ($xml->namespaceURI !== '')
 						{
-							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
+							$attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
 						}
 						else
 						{
-							$tagName = $xml->localName;
+							$attrName = $xml->localName;
 						}
+						$attributes[$attrName] = $xml->value;
+					}
+					$this->tag_open(null, $tagName, $attributes);
+					if ($empty)
+					{
 						$this->tag_close(null, $tagName);
-						break;
-					case constant('XMLReader::ELEMENT'):
-						$empty = $xml->isEmptyElement;
-						if ($xml->namespaceURI !== '')
-						{
-							$tagName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
-						}
-						else
-						{
-							$tagName = $xml->localName;
-						}
-						$attributes = array();
-						while ($xml->moveToNextAttribute())
-						{
-							if ($xml->namespaceURI !== '')
-							{
-								$attrName = "{$xml->namespaceURI}{$this->separator}{$xml->localName}";
-							}
-							else
-							{
-								$attrName = $xml->localName;
-							}
-							$attributes[$attrName] = $xml->value;
-						}
-						$this->tag_open(null, $tagName, $attributes);
-						if ($empty)
-						{
-							$this->tag_close(null, $tagName);
-						}
-						break;
-					case constant('XMLReader::TEXT'):
+					}
+					break;
+				case constant('XMLReader::TEXT'):
 
-					case constant('XMLReader::CDATA'):
-						$this->cdata(null, $xml->value);
-						break;
+				case constant('XMLReader::CDATA'):
+					$this->cdata(null, $xml->value);
+					break;
 				}
 			}
 			if ($error = libxml_get_last_error())
@@ -14588,7 +14762,7 @@ class SimplePie_Parser
 			$this->data =& $this->data['child'][end($this->namespace)][end($this->element)][];
 			$this->data = array('data' => '', 'attribs' => $attribs, 'xml_base' => end($this->xml_base), 'xml_base_explicit' => end($this->xml_base_explicit), 'xml_lang' => end($this->xml_lang));
 			if ((end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_03 && in_array(end($this->element), array('title', 'tagline', 'copyright', 'info', 'summary', 'content')) && isset($attribs['']['mode']) && $attribs['']['mode'] === 'xml')
-			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
+				|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_ATOM_10 && in_array(end($this->element), array('rights', 'subtitle', 'summary', 'info', 'title', 'content')) && isset($attribs['']['type']) && $attribs['']['type'] === 'xhtml'))
 			{
 				$this->current_xhtml_construct = 0;
 			}
@@ -14663,6 +14837,7 @@ class SimplePie_Parser
 		}
 		return $cache[$string];
 	}
+
 }
 
 /**
@@ -14818,6 +14993,7 @@ class SimplePie_Sanitize
 		$this->output_encoding = (string) $encoding;
 	}
 
+
 	/**
 	 * Set element/attribute key/value pairs of HTML attributes
 	 * containing URLs that need to be resolved relative to the feed
@@ -15018,6 +15194,7 @@ class SimplePie_Sanitize
 			return '';
 		}
 	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/sites_database_plugin.inc.php b/interface/lib/classes/sites_database_plugin.inc.php
index 37cc546b137923186107af27d602b00679eea2dd..d255fdca85169d641e473b038f71c6db16738b38 100644
--- a/interface/lib/classes/sites_database_plugin.inc.php
+++ b/interface/lib/classes/sites_database_plugin.inc.php
@@ -31,22 +31,22 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 class sites_database_plugin {
 
 	public function processDatabaseInsert($form_page) {
-        global $app;
-        
+		global $app;
+
 		/*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
 			$sys_groupid = $web['sys_groupid'];
         } else {
             $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']) . "')");
-            
+
             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']) . "'");
@@ -60,7 +60,7 @@ class sites_database_plugin {
         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']) . "')");
-            
+
             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']) . "'");
@@ -70,22 +70,22 @@ class sites_database_plugin {
                 }
             }
         }*/
-    }
-    
-    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));
-        
+	}
+
+	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));
+
         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
             $sys_groupid = $web['sys_groupid'];
         } else {
             $sys_groupid = $form_page->dataRecord['sys_groupid'];
         }
-        
+
         // 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
@@ -112,11 +112,11 @@ class sites_database_plugin {
                 }
             }
         }*/
-        
-        /*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']) . "')");
-            
+
             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']) . "'");
@@ -130,7 +130,7 @@ class sites_database_plugin {
         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']) . "')");
-            
+
             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']) . "'");
@@ -140,13 +140,13 @@ class sites_database_plugin {
                 }
             }
         }*/
-        
-    }
-    
-    public function processDatabaseDelete($primary_id) {
-        global $app;
-        
-        /*$old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($primary_id));
+
+	}
+
+	public function processDatabaseDelete($primary_id) {
+		global $app;
+
+		/*$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 `database_id` != '" . $app->functions->intval($primary_id) . "'");
@@ -171,8 +171,9 @@ class sites_database_plugin {
                 }
             }
         }*/
-        
-    }
+
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/soap_handler.inc.php b/interface/lib/classes/soap_handler.inc.php
index e998d21fe9f624a311e7831517b438d4d2e72498..c2bf643767cee8ee0c799581cd79dc3fc9ae964c 100644
--- a/interface/lib/classes/soap_handler.inc.php
+++ b/interface/lib/classes/soap_handler.inc.php
@@ -31,64 +31,65 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 class ISPConfigSoapHandler {
-    private $methods = array();
-    private $classes = array();
-
-    public function __construct() {
-        global $app;
-        
-        // load main remoting file
-        $app->load('remoting');
-        
-        // load all remote classes and get their methods
-        $dir = dirname(realpath(__FILE__)) . '/remote.d';
-        $d = opendir($dir);
-        while($f = readdir($d)) {
-            if($f == '.' || $f == '..') continue;
-            if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
-            
-            $name = substr($f, 0, strpos($f, '.'));
-            
-            include($dir . '/' . $f);
-            $class_name = 'remoting_' . $name;
-            if(class_exists($class_name, false)) {
-                $this->classes[$class_name] = new $class_name();
-                foreach(get_class_methods($this->classes[$class_name]) as $method) {
-                    $this->methods[$method] = $class_name;
-                }
-            }
-        }
-        closedir($d);
-        
-        // add main methods
-        $this->methods['login'] = 'remoting';
-        $this->methods['logout'] = 'remoting';
-        $this->methods['get_function_list'] = 'remoting';
-        
-        // create main class
-        $this->classes['remoting'] = new remoting(array_keys($this->methods));
-    }
-
-    public function __call($method, $params) {
-        if(array_key_exists($method, $this->methods) == false) {
-            throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist');
-        }
-        
-        $class_name = $this->methods[$method];
-        if(array_key_exists($class_name, $this->classes) == false) {
-            throw new SoapFault('invalid_class', 'Class ' . $class_name . ' does not exist');
-        }
-        
-        if(method_exists($this->classes[$class_name], $method) == false) {
-            throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')');
-        }
-        
-        try {
-            return call_user_func_array(array($this->classes[$class_name], $method), $params);
-        } catch(SoapFault $e) {
-            throw $e;
-        }
-    }
+	private $methods = array();
+	private $classes = array();
+
+	public function __construct() {
+		global $app;
+
+		// load main remoting file
+		$app->load('remoting');
+
+		// load all remote classes and get their methods
+		$dir = dirname(realpath(__FILE__)) . '/remote.d';
+		$d = opendir($dir);
+		while($f = readdir($d)) {
+			if($f == '.' || $f == '..') continue;
+			if(!is_file($dir . '/' . $f) || substr($f, strrpos($f, '.')) != '.php') continue;
+
+			$name = substr($f, 0, strpos($f, '.'));
+
+			include $dir . '/' . $f;
+			$class_name = 'remoting_' . $name;
+			if(class_exists($class_name, false)) {
+				$this->classes[$class_name] = new $class_name();
+				foreach(get_class_methods($this->classes[$class_name]) as $method) {
+					$this->methods[$method] = $class_name;
+				}
+			}
+		}
+		closedir($d);
+
+		// add main methods
+		$this->methods['login'] = 'remoting';
+		$this->methods['logout'] = 'remoting';
+		$this->methods['get_function_list'] = 'remoting';
+
+		// create main class
+		$this->classes['remoting'] = new remoting(array_keys($this->methods));
+	}
+
+	public function __call($method, $params) {
+		if(array_key_exists($method, $this->methods) == false) {
+			throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist');
+		}
+
+		$class_name = $this->methods[$method];
+		if(array_key_exists($class_name, $this->classes) == false) {
+			throw new SoapFault('invalid_class', 'Class ' . $class_name . ' does not exist');
+		}
+
+		if(method_exists($this->classes[$class_name], $method) == false) {
+			throw new SoapFault('invalid_method', 'Method ' . $method . ' does not exist in the class it was expected (' . $class_name . ')');
+		}
+
+		try {
+			return call_user_func_array(array($this->classes[$class_name], $method), $params);
+		} catch(SoapFault $e) {
+			throw $e;
+		}
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 806d6b247b9157695fd3cdb467958b0eb4b989f3..f334508816600f2b3b236c53bdefbb32864f6700 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -29,313 +29,317 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 /**
-* Formularbehandlung
-*
-* Functions to validate, display and save form values
-*
-*        Database table field definitions
-*
-*        Datatypes:
-*        - INTEGER (Converts data to int automatically)
-*        - DOUBLE
-*        - CURRENCY (Formats digits in currency notation)
-*        - VARCHAR (No format check)
-*        - DATE (Date format, converts from and to UNIX timestamps automatically)
-*
-*        Formtype:
-*        - TEXT (Normal text field)
-*        - PASSWORD (password field, the content will not be displayed again to the user)
-*        - SELECT (Option fiield)
-*        - MULTIPLE (Allows selection of multiple values)
-*
-*        VALUE:
-*        - Value or array
-*
-*        SEPARATOR
-*        - separator char used for fileds with multiple values
-*
-*        Hint: The auto increment (ID) filed of the table has not be be definied separately.
-*
-*/
+ * Formularbehandlung
+ *
+ * Functions to validate, display and save form values
+ *
+ *        Database table field definitions
+ *
+ *        Datatypes:
+ *        - INTEGER (Converts data to int automatically)
+ *        - DOUBLE
+ *        - CURRENCY (Formats digits in currency notation)
+ *        - VARCHAR (No format check)
+ *        - DATE (Date format, converts from and to UNIX timestamps automatically)
+ *
+ *        Formtype:
+ *        - TEXT (Normal text field)
+ *        - PASSWORD (password field, the content will not be displayed again to the user)
+ *        - SELECT (Option fiield)
+ *        - MULTIPLE (Allows selection of multiple values)
+ *
+ *        VALUE:
+ *        - Value or array
+ *
+ *        SEPARATOR
+ *        - separator char used for fileds with multiple values
+ *
+ *        Hint: The auto increment (ID) filed of the table has not be be definied separately.
+ *
+ */
+
+
 global $app;
 $app->load('tform_base');
 class tform extends tform_base {
-		/*
+	/*
 		This function checks if a user has the parmissions $perm for the data record with the ID $record_id
 		If record_id = 0, the the permissions are tested against the defaults of the form file.
 		*/
-		function checkPerm($record_id,$perm) {
-				global $app;
-
-				if($record_id > 0) {
-						// Add backticks for incomplete table names.
-						if(stristr($this->formDef['db_table'],'.')) {
-								$escape = '';
-						} else {
-								$escape = '`';
-						}
-
-						$sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
-						if($record = $app->db->queryOneRecord($sql)) {
-								return true;
-						} else {
-								return false;
-						}
-				} else {
-						$result = false;
-						if(@$this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
-						if(@$this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
-						if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
+	function checkPerm($record_id, $perm) {
+		global $app;
 
-						// if preset == 0, everyone can insert a record of this type
-						if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
+		if($record_id > 0) {
+			// Add backticks for incomplete table names.
+			if(stristr($this->formDef['db_table'], '.')) {
+				$escape = '';
+			} else {
+				$escape = '`';
+			}
 
-						return $result;
+			$sql = "SELECT ".$this->formDef['db_table_idx']." FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$record_id." AND ".$this->getAuthSQL($perm);
+			if($record = $app->db->queryOneRecord($sql)) {
+				return true;
+			} else {
+				return false;
+			}
+		} else {
+			$result = false;
+			if(@$this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm, $this->formDef["auth_preset"]["perm_user"])) $result = true;
+			if(@$this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm, $this->formDef["auth_preset"]["perm_group"])) $result = true;
+			if(@stristr($this->formDef["auth_preset"]["perm_other"], $perm)) $result = true;
 
-				}
+			// if preset == 0, everyone can insert a record of this type
+			if($this->formDef["auth_preset"]["userid"] == 0 and $this->formDef["auth_preset"]["groupid"] == 0 and (@stristr($this->formDef["auth_preset"]["perm_user"], $perm) or @stristr($this->formDef["auth_preset"]["perm_group"], $perm))) $result = true;
+
+			return $result;
 
 		}
 
-		function getNextTab() {
-				// Which tab is shown
-				if($this->errorMessage == '') {
-					// If there is no error
-					if(isset($_REQUEST["next_tab"]) && $_REQUEST["next_tab"] != '') {
-								// If the next tab is known
-								$active_tab = $_REQUEST["next_tab"];
-					} else {
-						// else use the default tab
-						$active_tab = $this->formDef['tab_default'];
-					}
-				} else {
-					// Show the same tab again in case of an error
-					$active_tab = $_SESSION["s"]["form"]["tab"];
-				}
+	}
 
-				return $active_tab;
+	function getNextTab() {
+		// Which tab is shown
+		if($this->errorMessage == '') {
+			// If there is no error
+			if(isset($_REQUEST["next_tab"]) && $_REQUEST["next_tab"] != '') {
+				// If the next tab is known
+				$active_tab = $_REQUEST["next_tab"];
+			} else {
+				// else use the default tab
+				$active_tab = $this->formDef['tab_default'];
+			}
+		} else {
+			// Show the same tab again in case of an error
+			$active_tab = $_SESSION["s"]["form"]["tab"];
 		}
 
-		function getCurrentTab() {
-				return $_SESSION["s"]["form"]["tab"];
+		return $active_tab;
+	}
+
+	function getCurrentTab() {
+		return $_SESSION["s"]["form"]["tab"];
+	}
+
+	function isReadonlyTab($tab, $primary_id) {
+		global $app, $conf;
+
+		// Add backticks for incomplete table names.
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
 		}
 
-		function isReadonlyTab($tab, $primary_id) {
-			global $app, $conf;
+		$sql = "SELECT sys_userid FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+		$record = $app->db->queryOneRecord($sql);
 
-			// Add backticks for incomplete table names.
-			if(stristr($this->formDef['db_table'],'.')) {
-				$escape = '';
-			} else {
-				$escape = '`';
-			}
+		// return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record.
+		if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
+			return true;
+		} else {
+			return false;
+		}
+	}
 
-			$sql = "SELECT sys_userid FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-			$record = $app->db->queryOneRecord($sql);
 
-			// return true if the readonly flag of the form is set and the current loggedin user is not the owner of the record.
-			if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true && $record['sys_userid'] != $_SESSION["s"]["user"]["userid"]) {
-				return true;
-			} else {
-				return false;
-			}
+	// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
+	function lng($msg) {
+		global $app, $conf;
+
+		if(isset($this->wordbook[$msg])) {
+			return $this->wordbook[$msg];
+		} else {
+			return $app->lng($msg);
 		}
 
+	}
 
-		// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
-		function lng($msg) {
-			global $app,$conf;
+	function checkClientLimit($limit_name, $sql_where = '') {
+		global $app;
 
-			if(isset($this->wordbook[$msg])) {
-				return $this->wordbook[$msg];
-			} else {
-				return $app->lng($msg);
-			}
+		$check_passed = true;
+		$limit_name = $app->db->quote($limit_name);
+		if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+
+		// Get the limits of the client that is currently logged in
+		$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		$client = $app->db->queryOneRecord("SELECT $limit_name as number, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
+		// Check if the user may add another item
+		if($client["number"] >= 0) {
+			$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE ".$this->getAuthSQL('u');
+			if($sql_where != '') $sql .= ' and '.$sql_where;
+			$tmp = $app->db->queryOneRecord($sql);
+			if($tmp["number"] >= $client["number"]) $check_passed = false;
 		}
 
-		function checkClientLimit($limit_name,$sql_where = '') {
-			global $app;
+		return $check_passed;
+	}
 
-			$check_passed = true;
-			$limit_name = $app->db->quote($limit_name);
-			if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+	function checkResellerLimit($limit_name, $sql_where = '') {
+		global $app;
 
-			// Get the limits of the client that is currently logged in
+		$check_passed = true;
+		$limit_name = $app->db->quote($limit_name);
+		if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+
+		// Get the limits of the client that is currently logged in
+		$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+		//* If the client belongs to a reseller, we will check against the reseller Limit too
+		if($client['parent_client_id'] != 0) {
+
+			//* first we need to know the groups of this reseller
+			$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
+			$reseller_groups = $tmp["groups"];
+			$reseller_userid = $tmp["userid"];
+
+			// Get the limits of the reseller of the logged in client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT $limit_name as number, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$reseller = $app->db->queryOneRecord("SELECT $limit_name as number FROM client WHERE client_id = ".$client['parent_client_id']);
 
 			// Check if the user may add another item
-			if($client["number"] >= 0) {
-				$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE ".$this->getAuthSQL('u');
+			if($reseller["number"] >= 0) {
+				$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE (sys_groupid IN (".$reseller_groups.") or sys_userid = ".$reseller_userid.")";
 				if($sql_where != '') $sql .= ' and '.$sql_where;
 				$tmp = $app->db->queryOneRecord($sql);
-				if($tmp["number"] >= $client["number"]) $check_passed = false;
+				if($tmp["number"] >= $reseller["number"]) $check_passed = false;
 			}
-
-			return $check_passed;
 		}
 
-		function checkResellerLimit($limit_name,$sql_where = '') {
-			global $app;
+		return $check_passed;
+	}
 
-			$check_passed = true;
-			$limit_name = $app->db->quote($limit_name);
-			if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
+	//* get the difference record of two arrays
+	function getDiffRecord($record_old, $record_new) {
 
-			// Get the limits of the client that is currently logged in
-			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-
-			//* If the client belongs to a reseller, we will check against the reseller Limit too
-			if($client['parent_client_id'] != 0) {
-
-				//* first we need to know the groups of this reseller
-				$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
-				$reseller_groups = $tmp["groups"];
-				$reseller_userid = $tmp["userid"];
-
-				// Get the limits of the reseller of the logged in client
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-				$reseller = $app->db->queryOneRecord("SELECT $limit_name as number FROM client WHERE client_id = ".$client['parent_client_id']);
-
-				// Check if the user may add another item
-				if($reseller["number"] >= 0) {
-					$sql = "SELECT count(".$this->formDef['db_table_idx'].") as number FROM ".$this->formDef['db_table']." WHERE (sys_groupid IN (".$reseller_groups.") or sys_userid = ".$reseller_userid.")";
-					if($sql_where != '') $sql .= ' and '.$sql_where;
-					$tmp = $app->db->queryOneRecord($sql);
-					if($tmp["number"] >= $reseller["number"]) $check_passed = false;
-				}
-			}
-
-			return $check_passed;
-		}
-
-		//* get the difference record of two arrays
-		function getDiffRecord($record_old,$record_new) {
-
-			if(is_array($record_new) && count($record_new) > 0) {
+		if(is_array($record_new) && count($record_new) > 0) {
 			foreach($record_new as $key => $val) {
 				if(@$record_old[$key] != $val) {
 					// Record has changed
-					$diffrec[$key] = array(	'old' => @$record_old[$key],
-											'new' => $val);
-					}
+					$diffrec[$key] = array( 'old' => @$record_old[$key],
+						'new' => $val);
 				}
-			} elseif(is_array($record_old)) {
-				foreach($record_old as $key => $val) {
-					if($record_new[$key] != $val) {
-						// Record has changed
-						$diffrec[$key] = array(	'new' => $record_new[$key],
-												'old' => $val);
-						}
-					}
+			}
+		} elseif(is_array($record_old)) {
+			foreach($record_old as $key => $val) {
+				if($record_new[$key] != $val) {
+					// Record has changed
+					$diffrec[$key] = array( 'new' => $record_new[$key],
+						'old' => $val);
 				}
-			return $diffrec;
-
+			}
+		}
+		return $diffrec;
+
+	}
+
+
+	/**
+	 * Generate HTML for DATETIME fields.
+	 *
+	 * @access private
+	 * @param string $form_element Name of the form element.
+	 * @param string $default_value Selected value for fields.
+	 * @param bool $display_secons Include seconds selection.
+	 * @return string HTML
+	 */
+	function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
+	{
+		$_datetime = strtotime($default_value);
+		$_showdate = ($_datetime === false) ? false : true;
+
+		$dselect = array('day', 'month', 'year', 'hour', 'minute');
+		if ($display_seconds === true) {
+			$dselect[] = 'second';
 		}
 
-		/**
-		 * Generate HTML for DATETIME fields.
-		 *
-		 * @access private
-		 * @param string $form_element Name of the form element.
-		 * @param string $default_value Selected value for fields.
-		 * @param bool $display_secons Include seconds selection.
-		 * @return string HTML
-		 */
-		function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
-		{
-			$_datetime = strtotime($default_value);
-			$_showdate = ($_datetime === false) ? false : true;
+		$out = '';
 
-			$dselect = array('day','month','year','hour','minute');
-			if ($display_seconds === true) {
-			 	$dselect[] = 'second';
-			}
+		foreach ($dselect as $dt_element)
+		{
+			$dt_options = array();
+			$dt_space = 1;
+
+			switch ($dt_element) {
+			case 'day':
+				for ($i = 1; $i <= 31; $i++) {
+					$dt_options[] = array('name' =>  sprintf('%02d', $i),
+						'value' => sprintf('%d', $i));
+				}
+				$selected_value = date('d', $_datetime);
+				break;
 
-			$out = '';
-
-			foreach ($dselect as $dt_element)
-			{
-			 	$dt_options = array();
-			 	$dt_space = 1;
-
-			 	switch ($dt_element) {
-			 		case 'day':
-					 	for ($i = 1; $i <= 31; $i++) {
-							$dt_options[] = array('name' =>  sprintf('%02d', $i),
-												  'value' => sprintf('%d', $i));
-						}
-						$selected_value = date('d', $_datetime);
-			 			break;
-
-			 		case 'month':
-				 		for ($i = 1; $i <= 12; $i++) {
-							$dt_options[] = array('name' => strftime('%b', mktime(0, 0, 0, $i, 1, 2000)),
-												  'value' => strftime('%m', mktime(0, 0, 0, $i, 1, 2000)));
-						}
-						$selected_value = date('n', $_datetime);
-			 			break;
-
-			 		case 'year':
-					 	$start_year = strftime("%Y");
-						$years = range((int)$start_year, (int)($start_year+3));
-
-						foreach ($years as $year) {
-							$dt_options[] = array('name' => $year,
-												 'value' => $year);
-						}
-						$selected_value = date('Y', $_datetime);
-						$dt_space = 2;
-			 			break;
-
-			 		case 'hour':
-			 			foreach(range(0, 23) as $hour) {
-			 				$dt_options[] = array('name' =>  sprintf('%02d', $hour),
-												  'value' => sprintf('%d', $hour));
-			 			}
-			 			$selected_value = date('G', $_datetime);
-			 			break;
-
-			 		case 'minute':
-			 			foreach(range(0, 59) as $minute) {
-			 				if (($minute % 5) == 0) {
-			 					$dt_options[] = array('name' =>  sprintf('%02d', $minute),
-													  'value' => sprintf('%d', $minute));
-			 				}
-			 			}
-			 			$selected_value = (int)floor(date('i', $_datetime));
-			 			break;
-
-			 		case 'second':
-			 			foreach(range(0, 59) as $second) {
-			 				$dt_options[] = array('name' =>  sprintf('%02d', $second),
-								  				  'value' => sprintf('%d', $second));
-			 			}
-			 			$selected_value = (int)floor(date('s', $_datetime));
-			 			break;
-			 	}
-
-				$out .= "<select name=\"".$form_element."[$dt_element]\" id=\"".$form_element."_$dt_element\" class=\"selectInput\" style=\"width: auto; float: none;\">";
-				if (!$_showdate) {
-					$out .= "<option value=\"-\" selected=\"selected\">--</option>" . PHP_EOL;
-				} else {
-					$out .= "<option value=\"-\">--</option>" . PHP_EOL;
+			case 'month':
+				for ($i = 1; $i <= 12; $i++) {
+					$dt_options[] = array('name' => strftime('%b', mktime(0, 0, 0, $i, 1, 2000)),
+						'value' => strftime('%m', mktime(0, 0, 0, $i, 1, 2000)));
 				}
+				$selected_value = date('n', $_datetime);
+				break;
 
-				foreach ($dt_options as $dt_opt) {
-					if ( $_showdate && ($selected_value == $dt_opt['value']) ) {
-						$out .= "<option value=\"{$dt_opt['value']}\" selected=\"selected\">{$dt_opt['name']}</option>" . PHP_EOL;
-					} else {
-						$out .= "<option value=\"{$dt_opt['value']}\">{$dt_opt['name']}</option>" . PHP_EOL;
+			case 'year':
+				$start_year = strftime("%Y");
+				$years = range((int)$start_year, (int)($start_year+3));
+
+				foreach ($years as $year) {
+					$dt_options[] = array('name' => $year,
+						'value' => $year);
+				}
+				$selected_value = date('Y', $_datetime);
+				$dt_space = 2;
+				break;
+
+			case 'hour':
+				foreach(range(0, 23) as $hour) {
+					$dt_options[] = array('name' =>  sprintf('%02d', $hour),
+						'value' => sprintf('%d', $hour));
+				}
+				$selected_value = date('G', $_datetime);
+				break;
+
+			case 'minute':
+				foreach(range(0, 59) as $minute) {
+					if (($minute % 5) == 0) {
+						$dt_options[] = array('name' =>  sprintf('%02d', $minute),
+							'value' => sprintf('%d', $minute));
 					}
 				}
+				$selected_value = (int)floor(date('i', $_datetime));
+				break;
+
+			case 'second':
+				foreach(range(0, 59) as $second) {
+					$dt_options[] = array('name' =>  sprintf('%02d', $second),
+						'value' => sprintf('%d', $second));
+				}
+				$selected_value = (int)floor(date('s', $_datetime));
+				break;
+			}
 
-				$out .= '</select>' . str_repeat('&nbsp;', $dt_space);
+			$out .= "<select name=\"".$form_element."[$dt_element]\" id=\"".$form_element."_$dt_element\" class=\"selectInput\" style=\"width: auto; float: none;\">";
+			if (!$_showdate) {
+				$out .= "<option value=\"-\" selected=\"selected\">--</option>" . PHP_EOL;
+			} else {
+				$out .= "<option value=\"-\">--</option>" . PHP_EOL;
 			}
 
-			return $out;
+			foreach ($dt_options as $dt_opt) {
+				if ( $_showdate && ($selected_value == $dt_opt['value']) ) {
+					$out .= "<option value=\"{$dt_opt['value']}\" selected=\"selected\">{$dt_opt['name']}</option>" . PHP_EOL;
+				} else {
+					$out .= "<option value=\"{$dt_opt['value']}\">{$dt_opt['name']}</option>" . PHP_EOL;
+				}
+			}
+
+			$out .= '</select>' . str_repeat('&nbsp;', $dt_space);
 		}
+
+		return $out;
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index 4db3157e53da50e9bca54f0ab97fd76fac6254e3..336d2fb5d08ac8db4240d54e4beb291da773742b 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -30,570 +30,578 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class tform_actions {
 
-        public $id;
-        public $activeTab;
-        public $dataRecord;
-        public $plugins = array();
-		public $oldDataRecord; // This array is only filled during updates and when db_history is enabled.
-
-        function onLoad() {
-                global $app, $conf, $tform_def_file;
-
-                // Loading template classes and initialize template
-                if(!is_object($app->tpl)) $app->uses('tpl');
-                if(!is_object($app->tform)) $app->uses('tform');
-
-                $app->tpl->newTemplate("tabbed_form.tpl.htm");
-
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-				
-				// Importing ID
-                $this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
-				
-				// show print version of the form
-				if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) {
-					die('Function disabled.');
-					$this->onPrintForm();
-				}
-				
-				// send this form by email
-				if(isset($_GET["send_form_by_mail"]) && $_GET["send_form_by_mail"] == 1) {
-					die('Function disabled.');
-					$this->onMailSendForm();
-				}
+	public $id;
+	public $activeTab;
+	public $dataRecord;
+	public $plugins = array();
+	public $oldDataRecord; // This array is only filled during updates and when db_history is enabled.
+
+	function onLoad() {
+		global $app, $conf, $tform_def_file;
+
+		// Loading template classes and initialize template
+		if(!is_object($app->tpl)) $app->uses('tpl');
+		if(!is_object($app->tform)) $app->uses('tform');
+
+		$app->tpl->newTemplate("tabbed_form.tpl.htm");
+
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
+
+		// Importing ID
+		$this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
+
+		// show print version of the form
+		if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) {
+			die('Function disabled.');
+			$this->onPrintForm();
+		}
+
+		// send this form by email
+		if(isset($_GET["send_form_by_mail"]) && $_GET["send_form_by_mail"] == 1) {
+			die('Function disabled.');
+			$this->onMailSendForm();
+		}
+
+		if(count($_POST) > 1) {
+			$this->dataRecord = $_POST;
+			$this->onSubmit();
+		} else {
+			$this->onShow();
+		}
+	}
+
+	/**
+	 * Function called on page submit
+	 */
+
+
+	function onSubmit() {
+		global $app, $conf;
+
+		// check if the client is locked - he may not change anything, then.
+		if(!$app->auth->is_admin()) {
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT client.locked FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($client_group_id));
+			if(is_array($client) && $client['locked'] == 'y') {
+				$app->tform->errorMessage .= $app->lng("client_you_are_locked")."<br />";
+			}
+		}
+
+		// Calling the action functions
+		if($this->id > 0) {
+			$app->tform->action == 'EDIT';
+			$this->onUpdate();
+		} else {
+			$app->tform->action == 'NEW';
+			$this->onInsert();
+		}
+	}
+
 
-                if(count($_POST) > 1) {
-                        $this->dataRecord = $_POST;
-                        $this->onSubmit();
-                } else {
-                        $this->onShow();
-                }
-        }
-
-        /**
-        * Function called on page submit
-        */
-
-        function onSubmit() {
-                global $app, $conf;
-                
-                // check if the client is locked - he may not change anything, then.
-				if(!$app->auth->is_admin()) {
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-					$client = $app->db->queryOneRecord("SELECT client.locked FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($client_group_id));
-					if(is_array($client) && $client['locked'] == 'y') {
-						$app->tform->errorMessage .= $app->lng("client_you_are_locked")."<br />";
-					}
+	/**
+	 * Function called on data update
+	 */
+	function onUpdate() {
+		global $app, $conf;
+
+		$this->onBeforeUpdate();
+
+		$ext_where = '';
+		$sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'UPDATE', $this->id, $ext_where);
+		if($app->tform->errorMessage == '') {
+
+			if($app->tform->formDef['db_history'] == 'yes') {
+				$this->oldDataRecord = $app->tform->getDataRecord($this->id);
+			}
+
+			// Save record in database
+			$this->onUpdateSave($sql);
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_update_save', array('page_form'=>$this, 'sql'=>$sql));
+
+			// loading plugins
+			$next_tab = $app->tform->getCurrentTab();
+			$this->loadPlugins($next_tab);
+
+			// Call plugin
+			foreach($this->plugins as $plugin) {
+				$plugin->onUpdate();
+			}
+
+			$this->onAfterUpdate();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_update', $this);
+
+			// Write data history (sys_datalog)
+			if($app->tform->formDef['db_history'] == 'yes') {
+				$new_data_record = $app->tform->getDataRecord($this->id);
+				$app->tform->datalogSave('UPDATE', $this->id, $this->oldDataRecord, $new_data_record);
+				unset($new_data_record);
+				unset($old_data_record);
+			}
+
+			if($_REQUEST["next_tab"] == '') {
+				$list_name = $_SESSION["s"]["form"]["return_to"];
+				// When a list is embedded inside of a form
+
+				//if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+				if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+					$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+					$_SESSION["s"]["form"]["return_to"] = '';
+					session_write_close();
+					header($redirect);
+					// When a returnto variable is set
+				} elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
+					$redirect = $_SESSION["s"]["form"]["return_to_url"];
+					$_SESSION["s"]["form"]["return_to_url"] = '';
+					session_write_close();
+					header("Location: ".$redirect);
+					exit;
+					// Use the default list of the form
+				} else {
+					header("Location: ".$app->tform->formDef['list_default']);
 				}
-                
-                // Calling the action functions
-                if($this->id > 0) {
-					$app->tform->action == 'EDIT';
-					$this->onUpdate();
-                } else {
-					$app->tform->action == 'NEW';
-					$this->onInsert();
-                }
-        }
-
-        /**
-        * Function called on data update
-        */
-
-        function onUpdate() {
-                global $app, $conf;
-				
-				$this->onBeforeUpdate();
-				
-                $ext_where = '';
-                $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
-                if($app->tform->errorMessage == '') {
-						
-						if($app->tform->formDef['db_history'] == 'yes') {
-							$this->oldDataRecord = $app->tform->getDataRecord($this->id);
-						}
-						
-						// Save record in database
-						$this->onUpdateSave($sql);
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_update_save',array('page_form'=>$this, 'sql'=>$sql));
-                        
-						// loading plugins
-						$next_tab = $app->tform->getCurrentTab();
-                		$this->loadPlugins($next_tab);
-
-                        // Call plugin
-                        foreach($this->plugins as $plugin) {
-                                $plugin->onUpdate();
-                        }
-						
-						$this->onAfterUpdate();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_update',$this);
-						
-						// Write data history (sys_datalog)
-						if($app->tform->formDef['db_history'] == 'yes') {
-							$new_data_record = $app->tform->getDataRecord($this->id);
-							$app->tform->datalogSave('UPDATE',$this->id,$this->oldDataRecord,$new_data_record);
-							unset($new_data_record);
-							unset($old_data_record);
-						}
-
-                        if($_REQUEST["next_tab"] == '') {
-                           $list_name = $_SESSION["s"]["form"]["return_to"];
-						   // When a list is embedded inside of a form
-						   
-                           //if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-						   if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                                $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-                                $_SESSION["s"]["form"]["return_to"] = '';
-                                session_write_close();
-                                header($redirect);
-							// When a returnto variable is set
-							} elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
-								$redirect = $_SESSION["s"]["form"]["return_to_url"];
-								$_SESSION["s"]["form"]["return_to_url"] = '';
-								session_write_close();
-								header("Location: ".$redirect);
-								exit;
-								// Use the default list of the form
-                        	} else {
-                            	header("Location: ".$app->tform->formDef['list_default']);
-                        	}
-                        	exit;
-                    	} else {
-                                $this->onShow();
-                        }
-                } else {
-                        $this->onError();
-                }
-        }
-		
-		/*
+				exit;
+			} else {
+				$this->onShow();
+			}
+		} else {
+			$this->onError();
+		}
+	}
+
+	/*
 		 Save record in database
 		*/
-		
-		function onUpdateSave($sql) {
-			global $app;
-			if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(),$this->id)) {
-				$app->db->query($sql);
-				if($app->db->errorMessage != '') die($app->db->errorMessage);
+
+	function onUpdateSave($sql) {
+		global $app;
+		if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(), $this->id)) {
+			$app->db->query($sql);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+		}
+	}
+
+
+
+
+
+	/**
+	 * Function called on data insert
+	 */
+	function onInsert() {
+		global $app, $conf;
+
+		$this->onBeforeInsert();
+
+		$ext_where = '';
+		$sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'INSERT', $this->id, $ext_where);
+		if($app->tform->errorMessage == '') {
+
+			$this->id = $this->onInsertSave($sql);
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_insert_save', array('page_form'=>$this, 'sql'=>$sql));
+
+			// loading plugins
+			$next_tab = $app->tform->getCurrentTab();
+			$this->loadPlugins($next_tab);
+
+			// Call plugin
+			foreach($this->plugins as $plugin) {
+				$plugin->onInsert();
 			}
+
+			$this->onAfterInsert();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_insert', $this);
+
+			// Write data history (sys_datalog)
+			if($app->tform->formDef['db_history'] == 'yes') {
+				$new_data_record = $app->tform->getDataRecord($this->id);
+				$app->tform->datalogSave('INSERT', $this->id, array(), $new_data_record);
+				unset($new_data_record);
+			}
+
+
+			if($_REQUEST["next_tab"] == '') {
+				$list_name = $_SESSION["s"]["form"]["return_to"];
+				// if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+				if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+					$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+					$_SESSION["s"]["form"]["return_to"] = '';
+					session_write_close();
+					header($redirect);
+					exit;
+				} elseif ($_SESSION["s"]["form"]["return_to_url"] != '') {
+					$redirect = $_SESSION["s"]["form"]["return_to_url"];
+					$_SESSION["s"]["form"]["return_to_url"] = '';
+					session_write_close();
+					header("Location: ".$redirect);
+					exit;
+				} else {
+					header("Location: ".$app->tform->formDef['list_default']);
+				}
+				exit;
+			} else {
+				$this->onShow();
+			}
+		} else {
+			$this->onError();
 		}
-		
-
-        /**
-        * Function called on data insert
-        */
-
-        function onInsert() {
-                global $app, $conf;
-				
-				$this->onBeforeInsert();
-
-                $ext_where = '';
-                $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'INSERT',$this->id,$ext_where);
-                if($app->tform->errorMessage == '') {
-						
-						$this->id = $this->onInsertSave($sql);
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_insert_save',array('page_form'=>$this, 'sql'=>$sql));
-                        
-						// loading plugins
-						$next_tab = $app->tform->getCurrentTab();
-                		$this->loadPlugins($next_tab);
-						
-                        // Call plugin
-                        foreach($this->plugins as $plugin) {
-                                $plugin->onInsert();
-                        }
-
-                        $this->onAfterInsert();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_insert',$this);
-
-						// Write data history (sys_datalog)
-						if($app->tform->formDef['db_history'] == 'yes') {
-							$new_data_record = $app->tform->getDataRecord($this->id);
-							$app->tform->datalogSave('INSERT',$this->id,array(),$new_data_record);
-							unset($new_data_record);
-						}
-						
-
-                     if($_REQUEST["next_tab"] == '') {
-                         $list_name = $_SESSION["s"]["form"]["return_to"];
-                         // if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-						 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                            $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-                            $_SESSION["s"]["form"]["return_to"] = '';
-                            session_write_close();
-                            header($redirect);
-							exit;
-                        } elseif ($_SESSION["s"]["form"]["return_to_url"] != '') {
-							$redirect = $_SESSION["s"]["form"]["return_to_url"];
-							$_SESSION["s"]["form"]["return_to_url"] = '';
-							session_write_close();
-							header("Location: ".$redirect);
-							exit;
-						} else {
-                                header("Location: ".$app->tform->formDef['list_default']);
-                        }
-                        exit;
-                    } else {
-                            $this->onShow();
-                        }
-                } else {
-                        $this->onError();
-                }
-        }
-		
-		/*
+	}
+
+	/*
 		 Save record in database
 		*/
-		
-		function onInsertSave($sql) {
-			global $app, $conf;
-			$app->db->query($sql);
-            if($app->db->errorMessage != '') die($app->db->errorMessage);
-            return $app->db->insertID();
+
+	function onInsertSave($sql) {
+		global $app, $conf;
+		$app->db->query($sql);
+		if($app->db->errorMessage != '') die($app->db->errorMessage);
+		return $app->db->insertID();
+	}
+
+	function onBeforeUpdate() {
+		global $app, $conf;
+	}
+
+	function onBeforeInsert() {
+		global $app, $conf;
+	}
+
+	function onAfterUpdate() {
+		global $app, $conf;
+	}
+
+	function onAfterInsert() {
+		global $app, $conf;
+	}
+
+
+	/**
+	 * Function called on data insert or update error
+	 */
+	function onError() {
+		global $app, $conf;
+
+		$app->tpl->setVar("error", "<li>".$app->tform->errorMessage."</li>");
+		$app->tpl->setVar($this->dataRecord);
+		$this->onShow();
+	}
+
+
+	/**
+	 * Function called on data delete
+	 */
+	function onDelete() {
+		global $app, $conf, $list_def_file, $tform_def_file;
+
+		include_once $list_def_file;
+
+		// Loading tform framework
+		if(!is_object($app->tform)) $app->uses('tform');
+
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
+
+		// importing ID
+		$this->id = $app->functions->intval($_REQUEST["id"]);
+
+		if($this->id > 0) {
+
+			// checking permissions
+			if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
+				if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+			}
+
+			//$this->dataRecord = $app->db->queryOneRecord("SELECT * FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
+			$this->dataRecord = $app->tform->getDataRecord($this->id);
+
+			$this->onBeforeDelete();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_delete', $this);
+
+			// Saving record to datalog when db_history enabled
+			if($app->tform->formDef["db_history"] == 'yes') {
+				//$old_data_record = $app->tform->getDataRecord($this->id);
+				$app->tform->datalogSave('DELETE', $this->id, $this->dataRecord, array());
+			}
+
+			$app->db->query("DELETE FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." LIMIT 1");
+
+
+			// loading plugins
+			$next_tab = $app->tform->getCurrentTab();
+			$this->loadPlugins($next_tab);
+
+
+			// Call plugin
+			foreach($this->plugins as $plugin) {
+				$plugin->onDelete();
+			}
+
+			$this->onAfterDelete();
+			$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_delete', $this);
 		}
 
-        function onBeforeUpdate() {
-            global $app, $conf;
-        }
-
-        function onBeforeInsert() {
-            global $app, $conf;
-        }
-		
-		function onAfterUpdate() {
-            global $app, $conf;
-        }
-
-        function onAfterInsert() {
-            global $app, $conf;
-        }
-
-
-        /**
-        * Function called on data insert or update error
-        */
-
-        function onError() {
-                global $app, $conf;
-
-                $app->tpl->setVar("error","<li>".$app->tform->errorMessage."</li>");
-                $app->tpl->setVar($this->dataRecord);
-                $this->onShow();
-        }
-
-        /**
-        * Function called on data delete
-        */
-
-        function onDelete() {
-                global $app, $conf,$list_def_file,$tform_def_file;
-
-                include_once($list_def_file);
-
-                // Loading tform framework
-                if(!is_object($app->tform)) $app->uses('tform');
-
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-
-                // importing ID
-                $this->id = $app->functions->intval($_REQUEST["id"]);
-
-                if($this->id > 0) {
-
-                        // checking permissions
-                        if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
-                                if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-                        }
-
-                        //$this->dataRecord = $app->db->queryOneRecord("SELECT * FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
-						$this->dataRecord = $app->tform->getDataRecord($this->id);
-						
-						$this->onBeforeDelete();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_delete',$this);
-						
-                        // Saving record to datalog when db_history enabled
-                        if($app->tform->formDef["db_history"] == 'yes') {
-							//$old_data_record = $app->tform->getDataRecord($this->id);
-							$app->tform->datalogSave('DELETE',$this->id,$this->dataRecord,array());
-                        }
-
-                        $app->db->query("DELETE FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." LIMIT 1");
-						
-						
-						// loading plugins
-						$next_tab = $app->tform->getCurrentTab();
-                		$this->loadPlugins($next_tab);
-						
-                	
-                        // Call plugin
-                        foreach($this->plugins as $plugin) {
-                                $plugin->onDelete();
-                        }
-						
-						$this->onAfterDelete();
-						$app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_delete',$this);
-                }
-
-                		//header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
-                 $list_name = $_SESSION["s"]["form"]["return_to"];
-                 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                        $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-                        $_SESSION["s"]["form"]["return_to"] = '';
-                        session_write_close();
-                        header($redirect);
-                } else {
-                    header("Location: ".$liste["file"]);
-                }
-                exit;
-
-        }
-		
-		function onBeforeDelete() {
-            global $app, $conf;
-        }
-		
-		function onAfterDelete() {
-            global $app, $conf;
-        }
-		
-		/**
-        * Function to print the form content
-        */
-		
-		function onPrintForm() {
-			global $app, $conf;
-			
-			if($app->tform->formDef['template_print'] == '') die('No print template available.');
-			
-			$app->tpl->newTemplate("print.tpl.htm");
-			$app->tpl->setInclude("content_tpl",$app->tform->formDef['template_print']);
+		//header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
+		$list_name = $_SESSION["s"]["form"]["return_to"];
+		if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
+			$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
+			$_SESSION["s"]["form"]["return_to"] = '';
+			session_write_close();
+			header($redirect);
+		} else {
+			header("Location: ".$liste["file"]);
+		}
+		exit;
 
-			if($app->tform->formDef['auth'] == 'no') {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-            } else {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-            }
-            if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-			
-			$record["datum"] = date("d.m.Y");
-			
-			$app->tpl->setVar($app->tform->wordbook);
+	}
 
-			$app->tpl->setVar($record);
+	function onBeforeDelete() {
+		global $app, $conf;
+	}
+
+	function onAfterDelete() {
+		global $app, $conf;
+	}
+
+
+
+
+
+	/**
+	 * Function to print the form content
+	 */
+	function onPrintForm() {
+		global $app, $conf;
+
+		if($app->tform->formDef['template_print'] == '') die('No print template available.');
+
+		$app->tpl->newTemplate("print.tpl.htm");
+		$app->tpl->setInclude("content_tpl", $app->tform->formDef['template_print']);
+
+		if($app->tform->formDef['auth'] == 'no') {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+		} else {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
+		}
+		if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+
+		$record["datum"] = date("d.m.Y");
+
+		$app->tpl->setVar($app->tform->wordbook);
+
+		$app->tpl->setVar($record);
+		$app->tpl_defaults();
+		$app->tpl->pparse();
+		exit;
+
+	}
+
+
+
+
+
+	/**
+	 * Function to print the form content
+	 */
+	function onMailSendForm() {
+		global $app, $conf;
+
+		if($app->tform->formDef['template_mailsend'] == '') die('No print template available.');
+
+		if($_POST["email"] == '' && $_POST["sender"] == '') {
+			// Zeige Formular zum versenden an.
+			$app->tpl->newTemplate("form.tpl.htm");
+			$app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
+			$app->tpl->setVar('show_form', 1);
+			$app->tpl->setVar("form_action", $app->tform->formDef['action'].'?send_form_by_mail=1');
+			$app->tpl->setVar("id", $this->id);
 			$app->tpl_defaults();
 			$app->tpl->pparse();
 			exit;
-			
-		}
-		
-		/**
-        * Function to print the form content
-        */
-		
-		function onMailSendForm() {
-			global $app, $conf;
-			
-			if($app->tform->formDef['template_mailsend'] == '') die('No print template available.');
-			
-			if($_POST["email"] == '' && $_POST["sender"] == '') {
-				// Zeige Formular zum versenden an.
-				$app->tpl->newTemplate("form.tpl.htm");
-				$app->tpl->setInclude("content_tpl",$app->tform->formDef['template_mailsend']);
-				$app->tpl->setVar('show_form',1);
-				$app->tpl->setVar("form_action",$app->tform->formDef['action'].'?send_form_by_mail=1');
-				$app->tpl->setVar("id",$this->id);
-				$app->tpl_defaults();
-				$app->tpl->pparse();
-				exit;
+		} else {
+			$app->tpl->newTemplate("mail.tpl.htm");
+			$app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
+			$app->tpl->setVar('show_mail', 1);
+			if($app->tform->formDef['auth'] == 'no') {
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
 			} else {
-				$app->tpl->newTemplate("mail.tpl.htm");
-				$app->tpl->setInclude("content_tpl",$app->tform->formDef['template_mailsend']);
-				$app->tpl->setVar('show_mail',1);
-				if($app->tform->formDef['auth'] == 'no') {
-            		$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-            	} else {
-            		$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-            	}
-            	if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-			
-				$record["datum"] = date("d.m.Y");
-				$record["mailmessage"] = $_POST["message"];
-			
-				$app->tpl->setVar($app->tform->wordbook);
-
-				$app->tpl->setVar($record);
-				$app->tpl_defaults();
-				
-				$email_message = $app->tpl->grab();
-				$email = $_POST["email"];
-				$sender = $_POST["sender"];
-				
-				$headers  = "MIME-Version: 1.0\n";
-				$headers .= "Content-type: text/html; charset=iso-8859-1\n";
-				$headers .= "From: $sender\n";
-				
-				if (!preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $sender)) {
-    				$sender = 'noreply@iprguard.de';
-  				}
-				
-				if (preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $email)) {
-    				mail($email, 'Domainrecherche Statement '.$record["domain"], $email_message, $headers);
-  				}
-				echo "<p>&nbsp;</p><p>Email wurde versand.</p>";
-				exit;
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
 			}
-			
-			
+			if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
 
-			if($app->tform->formDef['auth'] == 'no') {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-            } else {
-            	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-            }
-            if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-			
 			$record["datum"] = date("d.m.Y");
-			
+			$record["mailmessage"] = $_POST["message"];
+
 			$app->tpl->setVar($app->tform->wordbook);
 
 			$app->tpl->setVar($record);
 			$app->tpl_defaults();
-			$app->tpl->pparse();
+
+			$email_message = $app->tpl->grab();
+			$email = $_POST["email"];
+			$sender = $_POST["sender"];
+
+			$headers  = "MIME-Version: 1.0\n";
+			$headers .= "Content-type: text/html; charset=iso-8859-1\n";
+			$headers .= "From: $sender\n";
+
+			if (!preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $sender)) {
+				$sender = 'noreply@iprguard.de';
+			}
+
+			if (preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $email)) {
+				mail($email, 'Domainrecherche Statement '.$record["domain"], $email_message, $headers);
+			}
+			echo "<p>&nbsp;</p><p>Email wurde versand.</p>";
 			exit;
-			
 		}
 
-        /**
-        * Function called on page show
-        */
-
-        function onShow() {
-                global $app, $conf;
-
-                // Which tab do we render
-                $this->active_tab = $app->tform->getNextTab();
-
-                if($this->id > 0) {
-                        $this->onShowEdit();
-                } else {
-                        $this->onShowNew();
-                }
-
-                // make Form and Tabs
-                $app->tform->showForm();
-
-                // Setting default values
-                $app->tpl_defaults();
-				
-				// Show the navigation bar of the form
-				if(isset($app->tform->formDef['navibar']) && $app->tform->formDef['navibar'] == 'yes') {
-					$navibar = '';
-					if($app->tform->formDef['template_print'] != '') {
-						$navibar .= '<a href="'.$app->tform->formDef['action'].'?id='.$this->id.'&print_form=1" target="_blank"><img src="../themes/iprg/icons/printer.png" border="0" alt="Drucken" /></a> &nbsp;';
-					}
-					if($app->tform->formDef['template_mailsend'] != '') {
-						$navibar .= "<a href=\"#\" onclick=\"window.open('".$app->tform->formDef['action'].'?id='.$this->id."&send_form_by_mail=1','send','width=370,height=240')\"><img src=\"../themes/iprg/icons/mail.png\" border=\"0\" alt=\"Als E-Mail versenden\" /></a>";
-					}
-					$app->tpl->setVar('form_navibar',$navibar);
-				}
-				
-                if(isset($_SESSION['show_info_msg'])) {
-                    $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-                    unset($_SESSION['show_info_msg']);
-                }
-                if(isset($_SESSION['show_error_msg'])) {
-                    $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-                    unset($_SESSION['show_error_msg']);
-                }
-				
-				// loading plugins
-                $this->loadPlugins($this->active_tab);
-
-                // Calling the Plugin onShow Events and set the data in the
-                // plugins placeholder in the template
-                foreach($this->plugins as $plugin_name => $plugin) {
-                        $app->tpl->setVar($plugin_name,$plugin->onShow());
-                }
-
-                // Parse the templates and send output to the browser
-                $this->onShowEnd();
-
-        }
-
-        /**
-        * Function called on new record
-        */
-
-        function onShowNew() {
-                global $app, $conf;
-
-                if($app->tform->errorMessage == '') {
-                        $record = array();
-                        $record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'],'NEW');
-                } else {
-                        $record = $app->tform->getHTML($app->tform->encode($_POST,$this->active_tab),$this->active_tab,'EDIT');
-                }
-
-                $app->tpl->setVar($record);
-        }
-
-        /**
-        * Function called on edit record
-        */
-
-        function onShowEdit() {
-                global $app, $conf;
-
-                // bestehenden Datensatz anzeigen
-                if($app->tform->errorMessage == '') {
-                        if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
-                        	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
-                        } else {
-                        	$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
-                        }
-                        if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
-                } else {
-                        // $record = $app->tform->encode($_POST,$this->active_tab);
-						$record = $app->tform->encode($this->dataRecord,$this->active_tab,false);
-                }
-
-                $this->dataRecord = $record;
-
-            	// Userdaten umwandeln
-                $record = $app->tform->getHTML($record, $this->active_tab,'EDIT');
-                $record['id'] = $this->id;
-
-                $app->tpl->setVar($record);
-        }
-
-        function onShowEnd() {
-                global $app, $conf;
-
-                // Template parsen
-                $app->tpl->pparse();
-        }
-		
-		function loadPlugins($next_tab) {
-			global $app;
-			if(@is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
-                 $app->load('plugin_base');
-                 foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
-                      $plugin_class = $plugin_settings["class"];
-                      $app->load($plugin_class);
-                      $this->plugins[$plugin_name] = new $plugin_class;
-                      $this->plugins[$plugin_name]->setOptions($plugin_name,$plugin_settings['options']);
-					  // Make the data of the form easily accessible for the plugib
-					  $this->plugins[$plugin_name]->form = $this;
-                      $this->plugins[$plugin_name]->onLoad();
-                  }
-             }
+
+
+		if($app->tform->formDef['auth'] == 'no') {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+		} else {
+			$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
+		}
+		if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+
+		$record["datum"] = date("d.m.Y");
+
+		$app->tpl->setVar($app->tform->wordbook);
+
+		$app->tpl->setVar($record);
+		$app->tpl_defaults();
+		$app->tpl->pparse();
+		exit;
+
+	}
+
+
+	/**
+	 * Function called on page show
+	 */
+	function onShow() {
+		global $app, $conf;
+
+		// Which tab do we render
+		$this->active_tab = $app->tform->getNextTab();
+
+		if($this->id > 0) {
+			$this->onShowEdit();
+		} else {
+			$this->onShowNew();
+		}
+
+		// make Form and Tabs
+		$app->tform->showForm();
+
+		// Setting default values
+		$app->tpl_defaults();
+
+		// Show the navigation bar of the form
+		if(isset($app->tform->formDef['navibar']) && $app->tform->formDef['navibar'] == 'yes') {
+			$navibar = '';
+			if($app->tform->formDef['template_print'] != '') {
+				$navibar .= '<a href="'.$app->tform->formDef['action'].'?id='.$this->id.'&print_form=1" target="_blank"><img src="../themes/iprg/icons/printer.png" border="0" alt="Drucken" /></a> &nbsp;';
+			}
+			if($app->tform->formDef['template_mailsend'] != '') {
+				$navibar .= "<a href=\"#\" onclick=\"window.open('".$app->tform->formDef['action'].'?id='.$this->id."&send_form_by_mail=1','send','width=370,height=240')\"><img src=\"../themes/iprg/icons/mail.png\" border=\"0\" alt=\"Als E-Mail versenden\" /></a>";
+			}
+			$app->tpl->setVar('form_navibar', $navibar);
+		}
+
+		if(isset($_SESSION['show_info_msg'])) {
+			$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+			unset($_SESSION['show_info_msg']);
+		}
+		if(isset($_SESSION['show_error_msg'])) {
+			$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+			unset($_SESSION['show_error_msg']);
+		}
+
+		// loading plugins
+		$this->loadPlugins($this->active_tab);
+
+		// Calling the Plugin onShow Events and set the data in the
+		// plugins placeholder in the template
+		foreach($this->plugins as $plugin_name => $plugin) {
+			$app->tpl->setVar($plugin_name, $plugin->onShow());
+		}
+
+		// Parse the templates and send output to the browser
+		$this->onShowEnd();
+
+	}
+
+
+	/**
+	 * Function called on new record
+	 */
+	function onShowNew() {
+		global $app, $conf;
+
+		if($app->tform->errorMessage == '') {
+			$record = array();
+			$record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'], 'NEW');
+		} else {
+			$record = $app->tform->getHTML($app->tform->encode($_POST, $this->active_tab), $this->active_tab, 'EDIT');
+		}
+
+		$app->tpl->setVar($record);
+	}
+
+
+	/**
+	 * Function called on edit record
+	 */
+	function onShowEdit() {
+		global $app, $conf;
+
+		// bestehenden Datensatz anzeigen
+		if($app->tform->errorMessage == '') {
+			if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
+			} else {
+				$sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
+			}
+			if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
+		} else {
+			// $record = $app->tform->encode($_POST,$this->active_tab);
+			$record = $app->tform->encode($this->dataRecord, $this->active_tab, false);
+		}
+
+		$this->dataRecord = $record;
+
+		// Userdaten umwandeln
+		$record = $app->tform->getHTML($record, $this->active_tab, 'EDIT');
+		$record['id'] = $this->id;
+
+		$app->tpl->setVar($record);
+	}
+
+	function onShowEnd() {
+		global $app, $conf;
+
+		// Template parsen
+		$app->tpl->pparse();
+	}
+
+	function loadPlugins($next_tab) {
+		global $app;
+		if(@is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
+			$app->load('plugin_base');
+			foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
+				$plugin_class = $plugin_settings["class"];
+				$app->load($plugin_class);
+				$this->plugins[$plugin_name] = new $plugin_class;
+				$this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']);
+				// Make the data of the form easily accessible for the plugib
+				$this->plugins[$plugin_name]->form = $this;
+				$this->plugins[$plugin_name]->onLoad();
+			}
 		}
+	}
 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php
index b80aa72f51622ced7b9d568be0200b866df9ec72..856cdc49887b4bb5454d172becd296a04c397d9b 100644
--- a/interface/lib/classes/tform_base.inc.php
+++ b/interface/lib/classes/tform_base.inc.php
@@ -29,87 +29,88 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 /**
-* Formularbehandlung
-*
-* Functions to validate, display and save form values
-*
-*        Database table field definitions
-*
-*        Datatypes:
-*        - INTEGER (Converts data to int automatically)
-*        - DOUBLE
-*        - CURRENCY (Formats digits in currency notation)
-*        - VARCHAR (No format check)
-*        - DATE (Date format, converts from and to UNIX timestamps automatically)
-*
-*        Formtype:
-*        - TEXT (Normal text field)
-*        - PASSWORD (password field, the content will not be displayed again to the user)
-*        - SELECT (Option fiield)
-*        - MULTIPLE (Allows selection of multiple values)
-*
-*        VALUE:
-*        - Value or array
-*
-*        SEPARATOR
-*        - separator char used for fileds with multiple values
-*
-*        Hint: The auto increment (ID) filed of the table has not be be definied separately.
-*
-*/
-
-class tform_base {
+ * Formularbehandlung
+ *
+ * Functions to validate, display and save form values
+ *
+ *        Database table field definitions
+ *
+ *        Datatypes:
+ *        - INTEGER (Converts data to int automatically)
+ *        - DOUBLE
+ *        - CURRENCY (Formats digits in currency notation)
+ *        - VARCHAR (No format check)
+ *        - DATE (Date format, converts from and to UNIX timestamps automatically)
+ *
+ *        Formtype:
+ *        - TEXT (Normal text field)
+ *        - PASSWORD (password field, the content will not be displayed again to the user)
+ *        - SELECT (Option fiield)
+ *        - MULTIPLE (Allows selection of multiple values)
+ *
+ *        VALUE:
+ *        - Value or array
+ *
+ *        SEPARATOR
+ *        - separator char used for fileds with multiple values
+ *
+ *        Hint: The auto increment (ID) filed of the table has not be be definied separately.
+ *
+ */
 
-		/**
-		* Definition of the database table (array)
-		* @var tableDef
-		*/
-		var $tableDef;
-
-		/**
-		* Private
-		* @var action
-		*/
-		var $action;
 
-		/**
-		* Table name (String)
-		* @var table_name
-		*/
-		var $table_name;
-
-		/**
-		* Debug Variable
-		* @var debug
-		*/
-		var $debug = 0;
-
-		/**
-		* name of the primary field of the database table (string)
-		* @var table_index
-		*/
-		var $table_index;
-
-		/**
-		* contains the error messages
-		* @var errorMessage
-		*/
-		var $errorMessage = '';
-
-		var $dateformat = "d.m.Y";
-		var $formDef = array();
-		var $wordbook;
-		var $module;
-		var $primary_id;
-		var $diffrec = array();
+class tform_base {
 
-		/**
-		* Loading of the table definition
-		*
-		* @param file: path to the form definition file
-		* @return true
-		*/
-		/*
+	/**
+	 * Definition of the database table (array)
+	 * @var tableDef
+	 */
+	var $tableDef;
+
+	/**
+	 * Private
+	 * @var action
+	 */
+	var $action;
+
+	/**
+	 * Table name (String)
+	 * @var table_name
+	 */
+	var $table_name;
+
+	/**
+	 * Debug Variable
+	 * @var debug
+	 */
+	var $debug = 0;
+
+	/**
+	 * name of the primary field of the database table (string)
+	 * @var table_index
+	 */
+	var $table_index;
+
+	/**
+	 * contains the error messages
+	 * @var errorMessage
+	 */
+	var $errorMessage = '';
+
+	var $dateformat = "d.m.Y";
+	var $formDef = array();
+	var $wordbook;
+	var $module;
+	var $primary_id;
+	var $diffrec = array();
+
+	/**
+	 * Loading of the table definition
+	 *
+	 * @param file: path to the form definition file
+	 * @return true
+	 */
+	/*
 		function loadTableDef($file) {
 				global $app,$conf;
 
@@ -121,42 +122,42 @@ class tform_base {
 		}
 		*/
 
-	function loadFormDef($file,$module = '') {
-				global $app,$conf;
+	function loadFormDef($file, $module = '') {
+		global $app, $conf;
 
-				include($file);
-				$this->formDef = $form;
+		include $file;
+		$this->formDef = $form;
 
-				$this->module = $module;
-				$wb = array();
+		$this->module = $module;
+		$wb = array();
 
-				include_once(ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng');
+		include_once ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng';
 
-				if(is_array($wb)) $wb_global = $wb;
+		if(is_array($wb)) $wb_global = $wb;
 
-				if($module == '') {
-					$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
-					if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng";
-					include($lng_file);
-				} else {
-					$lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
-					if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng";
-					include($lng_file);
-				}
+		if($module == '') {
+			$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
+			if(!file_exists($lng_file)) $lng_file = "lib/lang/en_".$this->formDef["name"].".lng";
+			include $lng_file;
+		} else {
+			$lng_file = "../$module/lib/lang/".$_SESSION["s"]["language"]."_".$this->formDef["name"].".lng";
+			if(!file_exists($lng_file)) $lng_file = "../$module/lib/lang/en_".$this->formDef["name"].".lng";
+			include $lng_file;
+		}
 
-				if(is_array($wb_global)) {
-					$wb = $app->functions->array_merge($wb_global,$wb);
-				}
-				if(isset($wb_global)) unset($wb_global);
+		if(is_array($wb_global)) {
+			$wb = $app->functions->array_merge($wb_global, $wb);
+		}
+		if(isset($wb_global)) unset($wb_global);
 
-				$this->wordbook = $wb;
+		$this->wordbook = $wb;
 
-				$this->dateformat = $app->lng('conf_format_dateshort');
+		$this->dateformat = $app->lng('conf_format_dateshort');
 
-				return true;
-		}
+		return true;
+	}
 
-		/*
+	/*
 		* Converts the data in the array to human readable format
 		* Datatype conversion e.g. to show the data in lists
 		*
@@ -165,1108 +166,1111 @@ class tform_base {
 		* @param apply_filters
 		* @return record
 		*/
-		protected function _decode($record, $tab = '', $api = false) {
-            global $app;
-				$new_record = '';
-				if($api == false) {
-					$table_idx = $this->formDef['db_table_idx'];
-					if(isset($record[$table_idx])) $new_record[$table_idx] = $app->functions->intval($record[$table_idx ]);
-					$fields = &$this->formDef['tabs'][$tab]['fields'];
-				} else {
-					$fields = &$this->formDef['fields'];
+	protected function _decode($record, $tab = '', $api = false) {
+		global $app;
+		$new_record = '';
+		if($api == false) {
+			$table_idx = $this->formDef['db_table_idx'];
+			if(isset($record[$table_idx])) $new_record[$table_idx] = $app->functions->intval($record[$table_idx ]);
+			$fields = &$this->formDef['tabs'][$tab]['fields'];
+		} else {
+			$fields = &$this->formDef['fields'];
+		}
+
+		if(is_array($record)) {
+			foreach($fields as $key => $field) {
+
+				//* Apply filter to record value.
+				if($api == false && isset($field['filters']) && is_array($field['filters'])) {
+					$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
 				}
 
-				if(is_array($record)) {
-						foreach($fields as $key => $field) {
+				switch ($field['datatype']) {
+				case 'VARCHAR':
+					$new_record[$key] = ($api == true ? stripslashes($record[$key]) : $record[$key]);
+					break;
 
-								//* Apply filter to record value.
-								if($api == false && isset($field['filters']) && is_array($field['filters'])) {
-									$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SHOW');
-								}
+				case 'TEXT':
+					$new_record[$key] = ($api == true ? stripslashes($record[$key]) : $record[$key]);
+					break;
 
-								switch ($field['datatype']) {
-								case 'VARCHAR':
-										$new_record[$key] = ($api == true ? stripslashes($record[$key]) : $record[$key]);
-								break;
-
-								case 'TEXT':
-										$new_record[$key] = ($api == true ? stripslashes($record[$key]) : $record[$key]);
-								break;
-
-								case 'DATETSTAMP':
-										if($record[$key] > 0) {
-												$new_record[$key] = date($this->dateformat,$record[$key]);
-										}
-								break;
-
-								case 'DATE':
-										if($record[$key] != '' && $record[$key] != '0000-00-00') {
-												$tmp = explode('-',$record[$key]);
-												$new_record[$key] = date($this->dateformat,mktime(0, 0, 0, $tmp[1]  , $tmp[2], $tmp[0]));
-										}
-								break;
-
-								case 'INTEGER':
-										$new_record[$key] = $app->functions->intval($record[$key]);
-								break;
-
-								case 'DOUBLE':
-										$new_record[$key] = $record[$key];
-								break;
-
-								case 'CURRENCY':
-										$new_record[$key] = $app->functions->currency_format($record[$key]);
-								break;
-
-								default:
-										$new_record[$key] = ($api == true ? stripslashes($record[$key]) : $record[$key]);
-								}
-						}
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						$new_record[$key] = date($this->dateformat, $record[$key]);
+					}
+					break;
+
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						$tmp = explode('-', $record[$key]);
+						$new_record[$key] = date($this->dateformat, mktime(0, 0, 0, $tmp[1]  , $tmp[2], $tmp[0]));
+					}
+					break;
+
+				case 'INTEGER':
+					$new_record[$key] = $app->functions->intval($record[$key]);
+					break;
 
+				case 'DOUBLE':
+					$new_record[$key] = $record[$key];
+					break;
+
+				case 'CURRENCY':
+					$new_record[$key] = $app->functions->currency_format($record[$key]);
+					break;
+
+				default:
+					$new_record[$key] = ($api == true ? stripslashes($record[$key]) : $record[$key]);
 				}
+			}
+
+		}
 
 		return $new_record;
+	}
+
+
+	/**
+	 * Converts the data in the array to human readable format
+	 * Datatype conversion e.g. to show the data in lists
+	 *
+	 * @param record
+	 * @return record
+	 */
+	function decode($record, $tab) {
+		global $conf, $app;
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab).");
+		return $this->_decode($record, $tab, false);
+	}
+
+	/**
+	 * Get the key => value array of a form filled from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
+	protected function _getDatasourceData($field, $record, $api = false) {
+		global $app;
+
+		$values = array();
+
+		if($field["datasource"]["type"] == 'SQL') {
+
+			// Preparing SQL string. We will replace some
+			// common placeholders
+			$querystring = $field["datasource"]["querystring"];
+			$querystring = str_replace("{USERID}", $_SESSION["s"]["user"]["userid"], $querystring);
+			$querystring = str_replace("{GROUPID}", $_SESSION["s"]["user"]["default_group"], $querystring);
+			$querystring = str_replace("{GROUPS}", $_SESSION["s"]["user"]["groups"], $querystring);
+			$table_idx = $this->formDef['db_table_idx'];
+
+			$tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
+			$querystring = str_replace("{RECORDID}", $tmp_recordid, $querystring);
+			unset($tmp_recordid);
+
+			$querystring = str_replace("{AUTHSQL}", $this->getAuthSQL('r'), $querystring);
+
+			// Getting the records
+			$tmp_records = $app->db->queryAllRecords($querystring);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+			if(is_array($tmp_records)) {
+				$key_field = $field["datasource"]["keyfield"];
+				$value_field = $field["datasource"]["valuefield"];
+				foreach($tmp_records as $tmp_rec) {
+					$tmp_id = $tmp_rec[$key_field];
+					$values[$tmp_id] = $tmp_rec[$value_field];
+				}
+			}
 		}
 
-		/**
-		* Converts the data in the array to human readable format
-		* Datatype conversion e.g. to show the data in lists
-		*
-		* @param record
-		* @return record
-		*/
-		function decode($record,$tab) {
-				global $conf, $app;
-				if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab).");
-				return $this->_decode($record, $tab, false);
+		if($field["datasource"]["type"] == 'CUSTOM') {
+			// Calls a custom class to validate this record
+			if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
+				$datasource_class = $field["datasource"]['class'];
+				$datasource_function = $field["datasource"]['function'];
+				$app->uses($datasource_class);
+				$values = $app->$datasource_class->$datasource_function($field, $record);
+			} else {
+				$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
+			}
 		}
 
-		/**
-		* Get the key => value array of a form filled from a datasource definitiom
-		*
-		* @param field = array with field definition
-		* @param record = Dataset as array
-		* @return key => value array for the value field of a form
-		*/
+		if($api == false && isset($field['filters']) && is_array($field['filters'])) {
+			$new_values = array();
+			foreach($values as $index => $value) {
+				$new_index = $this->filterField($index, $index, $field['filters'], 'SHOW');
+				$new_values[$new_index] = $this->filterField($index, (isset($values[$index]))?$values[$index]:'', $field['filters'], 'SHOW');
+			}
+			$values = $new_values;
+			unset($new_values);
+			unset($new_index);
+		}
 
-		protected function _getDatasourceData($field, $record, $api = false) {
-				global $app;
+		return $values;
 
-				$values = array();
+	}
 
-				if($field["datasource"]["type"] == 'SQL') {
 
-						// Preparing SQL string. We will replace some
-						// common placeholders
-						$querystring = $field["datasource"]["querystring"];
-						$querystring = str_replace("{USERID}",$_SESSION["s"]["user"]["userid"],$querystring);
-						$querystring = str_replace("{GROUPID}",$_SESSION["s"]["user"]["default_group"],$querystring);
-						$querystring = str_replace("{GROUPS}",$_SESSION["s"]["user"]["groups"],$querystring);
-						$table_idx = $this->formDef['db_table_idx'];
+	/**
+	 * Get the key => value array of a form filled from a datasource definitiom
+	 *
+	 * @param field = array with field definition
+	 * @param record = Dataset as array
+	 * @return key => value array for the value field of a form
+	 */
+	function getDatasourceData($field, $record) {
+		return $this->_getDatasourceData($field, $record, false);
+	}
 
-						$tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0;
-						$querystring = str_replace("{RECORDID}",$tmp_recordid,$querystring);
-						unset($tmp_recordid);
+	//* If the parameter 'valuelimit' is set
+	function applyValueLimit($limit, $values) {
 
-						$querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring);
+		global $app;
 
-						// Getting the records
-						$tmp_records = $app->db->queryAllRecords($querystring);
-						if($app->db->errorMessage != '') die($app->db->errorMessage);
-						if(is_array($tmp_records)) {
-								$key_field = $field["datasource"]["keyfield"];
-								$value_field = $field["datasource"]["valuefield"];
-								foreach($tmp_records as $tmp_rec) {
-										$tmp_id = $tmp_rec[$key_field];
-										$values[$tmp_id] = $tmp_rec[$value_field];
-								}
-						}
-				}
+		$limit_parts = explode(':', $limit);
 
-				if($field["datasource"]["type"] == 'CUSTOM') {
-						// Calls a custom class to validate this record
-						if($field["datasource"]['class'] != '' and $field["datasource"]['function'] != '') {
-								$datasource_class = $field["datasource"]['class'];
-								$datasource_function = $field["datasource"]['function'];
-								$app->uses($datasource_class);
-								$values = $app->$datasource_class->$datasource_function($field, $record);
-						} else {
-								$this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
-						}
-				}
+		//* values are limited to a comma separated list
+		if($limit_parts[0] == 'list') {
+			$allowed = explode(',', $limit_parts[1]);
+		}
 
-				if($api == false && isset($field['filters']) && is_array($field['filters'])) {
-					$new_values = array();
-					foreach($values as $index => $value) {
-						$new_index = $this->filterField($index, $index, $field['filters'], 'SHOW');
-						$new_values[$new_index] = $this->filterField($index, (isset($values[$index]))?$values[$index]:'', $field['filters'], 'SHOW');
-					}
-					$values = $new_values;
-					unset($new_values);
-					unset($new_index);
-				}
+		//* values are limited to a field in the client settings
+		if($limit_parts[0] == 'client') {
+			if($_SESSION["s"]["user"]["typ"] == 'admin') {
+				return $values;
+			} else {
+				$client_group_id = $_SESSION["s"]["user"]["default_group"];
+				$client = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+				$allowed = explode(',', $client['lm']);
+			}
+		}
 
+		//* values are limited to a field in the reseller settings
+		if($limit_parts[0] == 'reseller') {
+			if($_SESSION["s"]["user"]["typ"] == 'admin') {
 				return $values;
+			} else {
+				//* Get the limits of the client that is currently logged in
+				$client_group_id = $_SESSION["s"]["user"]["default_group"];
+				$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+				//echo "SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
+				//* If the client belongs to a reseller, we will check against the reseller Limit too
+				if($client['parent_client_id'] != 0) {
+
+					//* first we need to know the groups of this reseller
+					$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
+					$reseller_groups = $tmp["groups"];
+					$reseller_userid = $tmp["userid"];
+
+					// Get the limits of the reseller of the logged in client
+					$client_group_id = $_SESSION["s"]["user"]["default_group"];
+					$reseller = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM client WHERE client_id = ".$client['parent_client_id']);
+					$allowed = explode(',', $reseller['lm']);
+				} else {
+					return $values;
+				}
+			} // end if admin
+		} // end if reseller
+
+		//* values are limited to a field in the system settings
+		if($limit_parts[0] == 'system') {
+			$app->uses('getconf');
+			$tmp_conf = $app->getconf->get_global_config($limit_parts[1]);
+			$tmp_key = $limit_parts[2];
+			$allowed = $tmp_conf[$tmp_key];
+		}
 
+		$values_new = array();
+		foreach($values as $key => $val) {
+			if(in_array($key, $allowed)) $values_new[$key] = $val;
 		}
 
-		/**
-        * Get the key => value array of a form filled from a datasource definitiom
-        *
-        * @param field = array with field definition
-        * @param record = Dataset as array
-        * @return key => value array for the value field of a form
-        */
+		return $values_new;
+	}
 
-        function getDatasourceData($field, $record) {
-			return $this->_getDatasourceData($field, $record, false);
-        }
 
-		//* If the parameter 'valuelimit' is set
-		function applyValueLimit($limit,$values) {
+	/**
+	 * Prepare the data record to show the data in a form.
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = NEW oder EDIT
+	 * @return record
+	 */
+	function getHTML($record, $tab, $action = 'NEW') {
 
-			global $app;
+		global $app;
 
-			$limit_parts = explode(':',$limit);
+		$this->action = $action;
 
-			//* values are limited to a comma separated list
-			if($limit_parts[0] == 'list') {
-				$allowed = explode(',',$limit_parts[1]);
-			}
+		if(!is_array($this->formDef)) $app->error("No form definition found.");
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
 
-			//* values are limited to a field in the client settings
-			if($limit_parts[0] == 'client') {
-				if($_SESSION["s"]["user"]["typ"] == 'admin') {
-					return $values;
-				} else {
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-					$client = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-					$allowed = explode(',',$client['lm']);
-				}
-			}
+		$new_record = array();
+		if($action == 'EDIT') {
+			$record = $this->decode($record, $tab);
+			if(is_array($record)) {
+				foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
 
-			//* values are limited to a field in the reseller settings
-			if($limit_parts[0] == 'reseller') {
-				if($_SESSION["s"]["user"]["typ"] == 'admin') {
-					return $values;
-				} else {
-					//* Get the limits of the client that is currently logged in
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-					$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-					//echo "SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
-					//* If the client belongs to a reseller, we will check against the reseller Limit too
-					if($client['parent_client_id'] != 0) {
-
-						//* first we need to know the groups of this reseller
-						$tmp = $app->db->queryOneRecord("SELECT userid, groups FROM sys_user WHERE client_id = ".$client['parent_client_id']);
-						$reseller_groups = $tmp["groups"];
-						$reseller_userid = $tmp["userid"];
-
-						// Get the limits of the reseller of the logged in client
-						$client_group_id = $_SESSION["s"]["user"]["default_group"];
-						$reseller = $app->db->queryOneRecord("SELECT ".$limit_parts[1]." as lm FROM client WHERE client_id = ".$client['parent_client_id']);
-						$allowed = explode(',',$reseller['lm']);
+					if(isset($record[$key])) {
+						$val = $record[$key];
 					} else {
-						return $values;
+						$val = '';
 					}
-				} // end if admin
-			} // end if reseller
-
-			//* values are limited to a field in the system settings
-			if($limit_parts[0] == 'system') {
-				$app->uses('getconf');
-				$tmp_conf = $app->getconf->get_global_config($limit_parts[1]);
-				$tmp_key = $limit_parts[2];
-				$allowed = $tmp_conf[$tmp_key];
-			}
 
-			$values_new = array();
-			foreach($values as $key => $val) {
-				if(in_array($key,$allowed)) $values_new[$key] = $val;
-			}
-
-			return $values_new;
-		}
+					// If Datasource is set, get the data from there
+					if(isset($field['datasource']) && is_array($field['datasource'])) {
+						if(is_array($field["value"])) {
+							//$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
+							$field["value"] = $app->functions->array_merge($field["value"], $this->getDatasourceData($field, $record));
+						} else {
+							$field["value"] = $this->getDatasourceData($field, $record);
+						}
+					}
 
+					// If a limitation for the values is set
+					if(isset($field['valuelimit']) && is_array($field["value"])) {
+						$field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"]);
+					}
 
-		/**
-		* Prepare the data record to show the data in a form.
-		*
-		* @param record = Datensatz als Array
-		* @param action = NEW oder EDIT
-		* @return record
-		*/
-		function getHTML($record, $tab, $action = 'NEW') {
-
-				global $app;
-
-				$this->action = $action;
-
-				if(!is_array($this->formDef)) $app->error("No form definition found.");
-				if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
-
-				$new_record = array();
-				if($action == 'EDIT') {
-						$record = $this->decode($record,$tab);
-						if(is_array($record)) {
-								foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-
-										if(isset($record[$key])) {
-											$val = $record[$key];
-										} else {
-											$val = '';
-										}
-
-										// If Datasource is set, get the data from there
-										if(isset($field['datasource']) && is_array($field['datasource'])) {
-												if(is_array($field["value"])) {
-													//$field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
-													$field["value"] = $app->functions->array_merge($field["value"],$this->getDatasourceData($field, $record));
-												} else {
-													$field["value"] = $this->getDatasourceData($field, $record);
-												}
-										}
-
-										// If a limitation for the values is set
-										if(isset($field['valuelimit']) && is_array($field["value"])) {
-											$field["value"] = $this->applyValueLimit($field['valuelimit'],$field["value"]);
-										}
-
-										switch ($field['formtype']) {
-										case 'SELECT':
-												$out = '';
-												if(is_array($field['value'])) {
-														foreach($field['value'] as $k => $v) {
-																$selected = ($k == $val)?' SELECTED':'';
-																if(!empty($this->wordbook[$v]))
-																	$v = $this->wordbook[$v];
-																$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
-														}
-												}
-												$new_record[$key] = $out;
-										break;
-										case 'MULTIPLE':
-												if(is_array($field['value'])) {
-
-														// Split
-														$vals = explode($field['separator'],$val);
-
-														// write HTML
-														$out = '';
-														foreach($field['value'] as $k => $v) {
-
-																$selected = '';
-																foreach($vals as $tvl) {
-																		if(trim($tvl) == trim($k)) $selected = ' SELECTED';
-																}
-
-																$out .= "<option value='$k'$selected>$v</option>\r\n";
-														}
-												}
-												$new_record[$key] = $out;
-										break;
-
-										case 'PASSWORD':
-												$new_record[$key] = '';
-										break;
-
-										case 'CHECKBOX':
-												$checked = ($val == $field['value'][1])?' CHECKED':'';
-												$new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
-										break;
-
-										case 'CHECKBOXARRAY':
-												if(is_array($field['value'])) {
-
-														// aufsplitten ergebnisse
-														$vals = explode($field['separator'],$val);
-
-														// HTML schreiben
-														$out = '';
-														$elementNo = 0;
-														foreach($field['value'] as $k => $v) {
-
-																$checked = '';
-																foreach($vals as $tvl) {
-																		if(trim($tvl) == trim($k)) $checked = ' CHECKED';
-																}
-																// $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
-																$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label><br/>\r\n";
-																$elementNo++;
-														}
-												}
-												$new_record[$key] = $out;
-										break;
-
-										case 'RADIO':
-												if(is_array($field['value'])) {
-
-														// HTML schreiben
-														$out = '';
-														$elementNo = 0;
-														foreach($field['value'] as $k => $v) {
-																$checked = ($k == $val)?' CHECKED':'';
-																//$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
-																$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v </label>\r\n";
-																$elementNo++;
-														}
-												}
-												$new_record[$key] = $out;
-										break;
-
-										case 'DATETIME':
-												if (strtotime($val) !== false) {
-													$dt_value = $val;
-												} elseif ( isset($field['default']) && (strtotime($field['default']) !== false) ) {
-													$dt_value = $field['default'];
-												} else {
-													$dt_value = 0;
-												}
-
-												$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
-
-												$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
-										break;
-
-										default:
-											if(isset($record[$key])) {
-												$new_record[$key] = htmlspecialchars($record[$key]);
-											} else {
-												$new_record[$key] = '';
-											}
-										}
-								}
+					switch ($field['formtype']) {
+					case 'SELECT':
+						$out = '';
+						if(is_array($field['value'])) {
+							foreach($field['value'] as $k => $v) {
+								$selected = ($k == $val)?' SELECTED':'';
+								if(!empty($this->wordbook[$v]))
+									$v = $this->wordbook[$v];
+								$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
+							}
 						}
-				} else {
-						// Action: NEW
-						foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
-
-								// If Datasource is set, get the data from there
-								if(@is_array($field['datasource'])) {
-									if(is_array($field["value"])) {
-										$field["value"] = $app->functions->array_merge($field["value"],$this->getDatasourceData($field, $record));
-									} else {
-										$field["value"] = $this->getDatasourceData($field, $record);
-									}
-								}
+						$new_record[$key] = $out;
+						break;
+					case 'MULTIPLE':
+						if(is_array($field['value'])) {
 
-								// If a limitation for the values is set
-								if(isset($field['valuelimit']) && is_array($field["value"])) {
-									$field["value"] = $this->applyValueLimit($field['valuelimit'],$field["value"]);
-								}
+							// Split
+							$vals = explode($field['separator'], $val);
 
-								switch ($field['formtype']) {
-								case 'SELECT':
-										if(is_array($field['value'])) {
-												$out = '';
-												foreach($field['value'] as $k => $v) {
-													$selected = ($k == $field["default"])?' SELECTED':'';
-													$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
-												}
-										}
-										if(isset($out)) $new_record[$key] = $out;
-								break;
-								case 'MULTIPLE':
-												if(is_array($field['value'])) {
-
-														// aufsplitten ergebnisse
-														$vals = explode($field['separator'],$val);
-
-														// HTML schreiben
-														$out = '';
-														foreach($field['value'] as $k => $v) {
-
-																$out .= "<option value='$k'>$v</option>\r\n";
-														}
-												}
-												$new_record[$key] = $out;
-										break;
-
-                                case 'PASSWORD':
-                                        //$new_record[$key] = '';
-										$new_record[$key] = htmlspecialchars($field['default']);
-                                break;
-
-								case 'CHECKBOX':
-										// $checked = (empty($field["default"]))?'':' CHECKED';
-															$checked = ($field["default"] == $field['value'][1])?' CHECKED':'';
-										$new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
-								break;
-
-								case 'CHECKBOXARRAY':
-										if(is_array($field['value'])) {
-
-												// aufsplitten ergebnisse
-												$vals = explode($field['separator'],$field["default"]);
-
-												// HTML schreiben
-												$out = '';
-												$elementNo = 0;
-												foreach($field['value'] as $k => $v) {
-
-														$checked = '';
-														foreach($vals as $tvl) {
-																if(trim($tvl) == trim($k)) $checked = ' CHECKED';
-														}
-														// $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
-														$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label> &nbsp;\r\n";
-														$elementNo++;
-												}
-										}
-										$new_record[$key] = $out;
-								break;
-
-								case 'RADIO':
-										if(is_array($field['value'])) {
-
-												// HTML schreiben
-												$out = '';
-												$elementNo = 0;
-												foreach($field['value'] as $k => $v) {
-														$checked = ($k == $field["default"])?' CHECKED':'';
-														//$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
-														$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
-														$elementNo++;
-												}
-										}
-										$new_record[$key] = $out;
-								break;
-
-								case 'DATETIME':
-										$dt_value = (isset($field['default'])) ? $field['default'] : 0;
-										$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
-
-										$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
-								break;
-
-								default:
-										$new_record[$key] = htmlspecialchars($field['default']);
+							// write HTML
+							$out = '';
+							foreach($field['value'] as $k => $v) {
+
+								$selected = '';
+								foreach($vals as $tvl) {
+									if(trim($tvl) == trim($k)) $selected = ' SELECTED';
 								}
+
+								$out .= "<option value='$k'$selected>$v</option>\r\n";
+							}
 						}
+						$new_record[$key] = $out;
+						break;
 
-				}
+					case 'PASSWORD':
+						$new_record[$key] = '';
+						break;
 
-				if($this->debug == 1) $this->dbg($new_record);
+					case 'CHECKBOX':
+						$checked = ($val == $field['value'][1])?' CHECKED':'';
+						$new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
+						break;
 
-				return $new_record;
-		}
+					case 'CHECKBOXARRAY':
+						if(is_array($field['value'])) {
 
-		/**
-		* Rewrite the record data to be stored in the database
-		* and check values with regular expressions.
-		*
-		* @param record = Datensatz als Array
-		* @return record
-		*/
-		protected function _encode($record,$tab,$dbencode = true,$api = false) {
-			global $app;
-			if($api == true) $fields = &$this->formDef['fields'];
-			else $fields = &$this->formDef['tabs'][$tab]['fields'];
-				if(is_array($record)) {
-						foreach($fields as $key => $field) {
-
-								//* Apply filter to record value
-								if(isset($field['filters']) && is_array($field['filters'])) {
-									$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
-								}
-								//* Validate record value
-								if(isset($field['validators']) && is_array($field['validators'])) {
-									$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
-								}
+							// aufsplitten ergebnisse
+							$vals = explode($field['separator'], $val);
 
-								switch ($field['datatype']) {
-								case 'VARCHAR':
-										if(!@is_array($record[$key])) {
-												$new_record[$key] = (isset($record[$key]))?$record[$key]:'';
-										} else {
-												$new_record[$key] = implode($field['separator'],$record[$key]);
-										}
-								break;
-								case 'TEXT':
-										if(!is_array($record[$key])) {
-												$new_record[$key] = $record[$key];
-										} else {
-												$new_record[$key] = implode($field['separator'],$record[$key]);
-										}
-								break;
-								case 'DATETSTAMP':
-										if($record[$key] > 0) {
-												list($tag,$monat,$jahr) = explode('.',$record[$key]);
-												$new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
-										} else {
-											$new_record[$key] = 0;
-										}
-								break;
-								case 'DATE':
-										if($record[$key] != '' && $record[$key] != '0000-00-00') {
-												if(function_exists('date_parse_from_format')) {
-													$date_parts = date_parse_from_format($this->dateformat,$record[$key]);
-													//list($tag,$monat,$jahr) = explode('.',$record[$key]);
-													$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
-													//$tmp = strptime($record[$key],$this->dateformat);
-													//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
-												} else {
-													//$tmp = strptime($record[$key],$this->dateformat);
-													//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
-													$tmp = strtotime($record[$key]);
-													$new_record[$key] = date('Y-m-d',$tmp);
-												}
-										} else {
-											$new_record[$key] = '0000-00-00';
-										}
-								break;
-								case 'INTEGER':
-										$new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
-										//if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
-										//if($key == 'refresh') die($record[$key]);
-								break;
-								case 'DOUBLE':
-										$new_record[$key] = $record[$key];
-								break;
-								case 'CURRENCY':
-										$new_record[$key] = str_replace(",",".",$record[$key]);
-								break;
-
-								case 'DATETIME':
-										if (is_array($record[$key]))
-										{
-											$filtered_values = array_map(create_function('$item','return (int)$item;'), $record[$key]);
-											extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
-
-											if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
-												$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
-											}
-										}
-								break;
-								}
+							// HTML schreiben
+							$out = '';
+							$elementNo = 0;
+							foreach($field['value'] as $k => $v) {
 
-								// The use of the field value is deprecated, use validators instead
-								if(isset($field['regex']) && $field['regex'] != '') {
-										// Enable that "." matches also newlines
-										$field['regex'] .= 's';
-										if(!preg_match($field['regex'], $record[$key])) {
-												$errmsg = $field['errmsg'];
-												$this->errorMessage .= ($api == true ? $errmsg : $this->wordbook[$errmsg]."<br />") . "\r\n";
-										}
+								$checked = '';
+								foreach($vals as $tvl) {
+									if(trim($tvl) == trim($k)) $checked = ' CHECKED';
 								}
+								// $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
+								$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label><br/>\r\n";
+								$elementNo++;
+							}
+						}
+						$new_record[$key] = $out;
+						break;
 
-								//* Add slashes to all records, when we encode data which shall be inserted into mysql.
-								if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
+					case 'RADIO':
+						if(is_array($field['value'])) {
+
+							// HTML schreiben
+							$out = '';
+							$elementNo = 0;
+							foreach($field['value'] as $k => $v) {
+								$checked = ($k == $val)?' CHECKED':'';
+								//$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
+								$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v </label>\r\n";
+								$elementNo++;
+							}
 						}
-				}
-				return $new_record;
-		}
+						$new_record[$key] = $out;
+						break;
 
-		/**
-		* Rewrite the record data to be stored in the database
-		* and check values with regular expressions.
-		*
-		* @param record = Datensatz als Array
-		* @return record
-		*/
-		function encode($record,$tab,$dbencode = true) {
-			global $app;
+					case 'DATETIME':
+						if (strtotime($val) !== false) {
+							$dt_value = $val;
+						} elseif ( isset($field['default']) && (strtotime($field['default']) !== false) ) {
+							$dt_value = $field['default'];
+						} else {
+							$dt_value = 0;
+						}
 
-			if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab is empty or does not exist (TAB: $tab).");
-			return $this->_encode($record, $tab, $dbencode, false);
-		}
+						$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
 
-		/**
-		* process the filters for a given field.
-		*
-		* @param field_name = Name of the field
-		* @param field_value = value of the field
-		* @param filters = Array of filters
-		* @param filter_event = 'SAVE'or 'SHOW'
-		* @return record
-		*/
+						$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
+						break;
 
-		function filterField($field_name, $field_value, $filters, $filter_event) {
+					default:
+						if(isset($record[$key])) {
+							$new_record[$key] = htmlspecialchars($record[$key]);
+						} else {
+							$new_record[$key] = '';
+						}
+					}
+				}
+			}
+		} else {
+			// Action: NEW
+			foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) {
+
+				// If Datasource is set, get the data from there
+				if(@is_array($field['datasource'])) {
+					if(is_array($field["value"])) {
+						$field["value"] = $app->functions->array_merge($field["value"], $this->getDatasourceData($field, $record));
+					} else {
+						$field["value"] = $this->getDatasourceData($field, $record);
+					}
+				}
 
-			global $app;
-			$returnval = $field_value;
+				// If a limitation for the values is set
+				if(isset($field['valuelimit']) && is_array($field["value"])) {
+					$field["value"] = $this->applyValueLimit($field['valuelimit'], $field["value"]);
+				}
 
-			//* Loop trough all filters
-			foreach($filters as $filter) {
-				if($filter['event'] == $filter_event) {
-					switch ($filter['type']) {
-						case 'TOLOWER':
-							$returnval = strtolower($returnval);
-						break;
-						case 'TOUPPER':
-							$returnval = strtoupper($returnval);
-						break;
-						case 'IDNTOASCII':
-							$returnval = $app->functions->idn_encode($returnval);
-						break;
-						case 'IDNTOUTF8':
-							$returnval = $app->functions->idn_decode($returnval);
-						break;
-						default:
-							$this->errorMessage .= "Unknown Filter: ".$filter['type'];
-						break;
+				switch ($field['formtype']) {
+				case 'SELECT':
+					if(is_array($field['value'])) {
+						$out = '';
+						foreach($field['value'] as $k => $v) {
+							$selected = ($k == $field["default"])?' SELECTED':'';
+							$out .= "<option value='$k'$selected>".$this->lng($v)."</option>\r\n";
+						}
+					}
+					if(isset($out)) $new_record[$key] = $out;
+					break;
+				case 'MULTIPLE':
+					if(is_array($field['value'])) {
+
+						// aufsplitten ergebnisse
+						$vals = explode($field['separator'], $val);
+
+						// HTML schreiben
+						$out = '';
+						foreach($field['value'] as $k => $v) {
+
+							$out .= "<option value='$k'>$v</option>\r\n";
+						}
+					}
+					$new_record[$key] = $out;
+					break;
+
+				case 'PASSWORD':
+					//$new_record[$key] = '';
+					$new_record[$key] = htmlspecialchars($field['default']);
+					break;
+
+				case 'CHECKBOX':
+					// $checked = (empty($field["default"]))?'':' CHECKED';
+					$checked = ($field["default"] == $field['value'][1])?' CHECKED':'';
+					$new_record[$key] = "<input name=\"".$key."\" id=\"".$key."\" value=\"".$field['value'][1]."\" type=\"checkbox\" $checked />\r\n";
+					break;
+
+				case 'CHECKBOXARRAY':
+					if(is_array($field['value'])) {
+
+						// aufsplitten ergebnisse
+						$vals = explode($field['separator'], $field["default"]);
+
+						// HTML schreiben
+						$out = '';
+						$elementNo = 0;
+						foreach($field['value'] as $k => $v) {
+
+							$checked = '';
+							foreach($vals as $tvl) {
+								if(trim($tvl) == trim($k)) $checked = ' CHECKED';
+							}
+							// $out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"checkbox\" $checked /> $v</label>\r\n";
+							$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"checkbox\" $checked /> $v</label> &nbsp;\r\n";
+							$elementNo++;
+						}
+					}
+					$new_record[$key] = $out;
+					break;
+
+				case 'RADIO':
+					if(is_array($field['value'])) {
+
+						// HTML schreiben
+						$out = '';
+						$elementNo = 0;
+						foreach($field['value'] as $k => $v) {
+							$checked = ($k == $field["default"])?' CHECKED':'';
+							//$out .= "<label for=\"".$key."[]\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key."[]\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
+							$out .= "<label for=\"".$key.$elementNo."\" class=\"inlineLabel\"><input name=\"".$key."[]\" id=\"".$key.$elementNo."\" value=\"$k\" type=\"radio\" $checked/> $v</label>\r\n";
+							$elementNo++;
+						}
 					}
+					$new_record[$key] = $out;
+					break;
+
+				case 'DATETIME':
+					$dt_value = (isset($field['default'])) ? $field['default'] : 0;
+					$display_seconds = (isset($field['display_seconds']) && $field['display_seconds'] == true) ? true : false;
+
+					$new_record[$key] = $this->_getDateTimeHTML($key, $dt_value, $display_seconds);
+					break;
+
+				default:
+					$new_record[$key] = htmlspecialchars($field['default']);
 				}
 			}
-			return $returnval;
+
 		}
 
-		/**
-		* process the validators for a given field.
-		*
-		* @param field_name = Name of the field
-		* @param field_value = value of the field
-		* @param validatoors = Array of validators
-		* @return record
-		*/
+		if($this->debug == 1) $this->dbg($new_record);
 
-		function validateField($field_name, $field_value, $validators) {
-
-				global $app;
-
-				$escape = '`';
-
-				// loop trough the validators
-				foreach($validators as $validator) {
-
-						switch ($validator['type']) {
-								case 'REGEX':
-										$validator['regex'] .= 's';
-										if(!preg_match($validator['regex'], $field_value)) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-										}
-								break;
-								case 'UNIQUE':
-										if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
-										if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
-											if($this->action == 'NEW') {
-												$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
-												if($num_rec["number"] > 0) {
-														$errmsg = $validator['errmsg'];
-														if(isset($this->wordbook[$errmsg])) {
-															$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br />\r\n";
-														}
-												}
-											} else {
-												$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
-												if($num_rec["number"] > 0) {
-														$errmsg = $validator['errmsg'];
-														if(isset($this->wordbook[$errmsg])) {
-															$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-														} else {
-															$this->errorMessage .= $errmsg."<br />\r\n";
-														}
-												}
-											}
-										}
-								break;
-								case 'NOTEMPTY':
-										if(empty($field_value)) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-										}
-								break;
-								case 'ISEMAIL':
-									if(function_exists('filter_var')) {
-										if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-												$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-										}
-									} else {
-										if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-										}
-									}
-								break;
-								case 'ISINT':
-									if(function_exists('filter_var') && $field_value < 2147483647) {
-										if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-												$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-										}
-									} else {
-										$tmpval = $app->functions->intval($field_value);
-										if($tmpval === 0 and !empty($field_value)) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-										}
-									}
-								break;
-								case 'ISPOSITIVE':
-										if(!is_numeric($field_value) || $field_value <= 0){
-										  $errmsg = $validator['errmsg'];
-										  if(isset($this->wordbook[$errmsg])) {
-											 $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br />\r\n";
-										  }
-										}
-								break;
-				case 'ISV6PREFIX':
-					$v6_prefix_ok = 0;
-					$explode_field_value = explode(':',$field_value);
-					if ($explode_field_value[count($explode_field_value)-1]=='' && $explode_field_value[count($explode_field_value)-2]=='' ){
-							if ( count($explode_field_value) <= 9 ) {
-									if(filter_var(substr($field_value,0,strlen($field_value)-2),FILTER_VALIDATE_IP,FILTER_FLAG_IPV6) or filter_var(substr($field_value,0,strlen($field_value)-2).'::0',FILTER_VALIDATE_IP,FILTER_FLAG_IPV6) or filter_var(substr($field_value,0,strlen($field_value)-2).':0',FILTER_VALIDATE_IP,FILTER_FLAG_IPV6) ) {
-											$v6_prefix_ok = 1;
-									}
+		return $new_record;
+	}
+
+	/**
+	 * Rewrite the record data to be stored in the database
+	 * and check values with regular expressions.
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
+	protected function _encode($record, $tab, $dbencode = true, $api = false) {
+		global $app;
+		if($api == true) $fields = &$this->formDef['fields'];
+		else $fields = &$this->formDef['tabs'][$tab]['fields'];
+		if(is_array($record)) {
+			foreach($fields as $key => $field) {
+
+				//* Apply filter to record value
+				if(isset($field['filters']) && is_array($field['filters'])) {
+					$record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE');
+				}
+				//* Validate record value
+				if(isset($field['validators']) && is_array($field['validators'])) {
+					$this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']);
+				}
+
+				switch ($field['datatype']) {
+				case 'VARCHAR':
+					if(!@is_array($record[$key])) {
+						$new_record[$key] = (isset($record[$key]))?$record[$key]:'';
+					} else {
+						$new_record[$key] = implode($field['separator'], $record[$key]);
+					}
+					break;
+				case 'TEXT':
+					if(!is_array($record[$key])) {
+						$new_record[$key] = $record[$key];
+					} else {
+						$new_record[$key] = implode($field['separator'], $record[$key]);
+					}
+					break;
+				case 'DATETSTAMP':
+					if($record[$key] > 0) {
+						list($tag, $monat, $jahr) = explode('.', $record[$key]);
+						$new_record[$key] = mktime(0, 0, 0, $monat, $tag, $jahr);
+					} else {
+						$new_record[$key] = 0;
+					}
+					break;
+				case 'DATE':
+					if($record[$key] != '' && $record[$key] != '0000-00-00') {
+						if(function_exists('date_parse_from_format')) {
+							$date_parts = date_parse_from_format($this->dateformat, $record[$key]);
+							//list($tag,$monat,$jahr) = explode('.',$record[$key]);
+							$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
+							//$tmp = strptime($record[$key],$this->dateformat);
+							//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
+						} else {
+							//$tmp = strptime($record[$key],$this->dateformat);
+							//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
+							$tmp = strtotime($record[$key]);
+							$new_record[$key] = date('Y-m-d', $tmp);
+						}
+					} else {
+						$new_record[$key] = '0000-00-00';
+					}
+					break;
+				case 'INTEGER':
+					$new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0;
+					//if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default'];
+					//if($key == 'refresh') die($record[$key]);
+					break;
+				case 'DOUBLE':
+					$new_record[$key] = $record[$key];
+					break;
+				case 'CURRENCY':
+					$new_record[$key] = str_replace(",", ".", $record[$key]);
+					break;
+
+				case 'DATETIME':
+					if (is_array($record[$key]))
+					{
+						$filtered_values = array_map(create_function('$item', 'return (int)$item;'), $record[$key]);
+						extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
+
+						if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
+							$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
+						}
+					}
+					break;
+				}
+
+				// The use of the field value is deprecated, use validators instead
+				if(isset($field['regex']) && $field['regex'] != '') {
+					// Enable that "." matches also newlines
+					$field['regex'] .= 's';
+					if(!preg_match($field['regex'], $record[$key])) {
+						$errmsg = $field['errmsg'];
+						$this->errorMessage .= ($api == true ? $errmsg : $this->wordbook[$errmsg]."<br />") . "\r\n";
+					}
+				}
+
+				//* Add slashes to all records, when we encode data which shall be inserted into mysql.
+				if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]);
+			}
+		}
+		return $new_record;
+	}
+
+
+	/**
+	 * Rewrite the record data to be stored in the database
+	 * and check values with regular expressions.
+	 *
+	 * @param record = Datensatz als Array
+	 * @return record
+	 */
+	function encode($record, $tab, $dbencode = true) {
+		global $app;
+
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab is empty or does not exist (TAB: $tab).");
+		return $this->_encode($record, $tab, $dbencode, false);
+	}
+
+
+	/**
+	 * process the filters for a given field.
+	 *
+	 * @param field_name = Name of the field
+	 * @param field_value = value of the field
+	 * @param filters = Array of filters
+	 * @param filter_event = 'SAVE'or 'SHOW'
+	 * @return record
+	 */
+	function filterField($field_name, $field_value, $filters, $filter_event) {
+
+		global $app;
+		$returnval = $field_value;
+
+		//* Loop trough all filters
+		foreach($filters as $filter) {
+			if($filter['event'] == $filter_event) {
+				switch ($filter['type']) {
+				case 'TOLOWER':
+					$returnval = strtolower($returnval);
+					break;
+				case 'TOUPPER':
+					$returnval = strtoupper($returnval);
+					break;
+				case 'IDNTOASCII':
+					$returnval = $app->functions->idn_encode($returnval);
+					break;
+				case 'IDNTOUTF8':
+					$returnval = $app->functions->idn_decode($returnval);
+					break;
+				default:
+					$this->errorMessage .= "Unknown Filter: ".$filter['type'];
+					break;
+				}
+			}
+		}
+		return $returnval;
+	}
+
+
+	/**
+	 * process the validators for a given field.
+	 *
+	 * @param field_name = Name of the field
+	 * @param field_value = value of the field
+	 * @param validatoors = Array of validators
+	 * @return record
+	 */
+	function validateField($field_name, $field_value, $validators) {
+
+		global $app;
+
+		$escape = '`';
+
+		// loop trough the validators
+		foreach($validators as $validator) {
+
+			switch ($validator['type']) {
+			case 'REGEX':
+				$validator['regex'] .= 's';
+				if(!preg_match($validator['regex'], $field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'UNIQUE':
+				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
+				if($validator['allowempty'] == 'n' || ($validator['allowempty'] == 'y' && $field_value != '')){
+					if($this->action == 'NEW') {
+						$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."'");
+						if($num_rec["number"] > 0) {
+							$errmsg = $validator['errmsg'];
+							if(isset($this->wordbook[$errmsg])) {
+								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+							} else {
+								$this->errorMessage .= $errmsg."<br />\r\n";
 							}
+						}
 					} else {
-						$v6_prefix_ok = 2;
+						$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM ".$escape.$this->formDef['db_table'].$escape. " WHERE $field_name = '".$app->db->quote($field_value)."' AND ".$this->formDef['db_table_idx']." != ".$this->primary_id);
+						if($num_rec["number"] > 0) {
+							$errmsg = $validator['errmsg'];
+							if(isset($this->wordbook[$errmsg])) {
+								$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+							} else {
+								$this->errorMessage .= $errmsg."<br />\r\n";
+							}
+						}
 					}
-					// check subnet against defined server-ipv6
-					$sql_v6 = $app->db->queryOneRecord("SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' LIMIT 0,1");
-					$sql_v6_explode=explode(':',$sql_v6['ip_address']);
-					if ( count($sql_v6_explode) < count($explode_field_value) && isset($sql_v6['ip_address']) )  {
-						$v6_prefix_ok = 3;
+				}
+				break;
+			case 'NOTEMPTY':
+				if(empty($field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
 					}
-					if($v6_prefix_ok == 0) {
+				}
+				break;
+			case 'ISEMAIL':
+				if(function_exists('filter_var')) {
+					if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
 						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
 					}
-					if($v6_prefix_ok == 2) {
-						$errmsg = 'IPv6 Prefix must end with ::';
+				} else {
+					if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
 					}
-					if($v6_prefix_ok == 3) {
-						$errmsg = 'IPv6 Prefix too long (according to Server IP Addresses)';
+				}
+				break;
+			case 'ISINT':
+				if(function_exists('filter_var') && $field_value < 2147483647) {
+					if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
 					}
-					if($v6_prefix_ok <> 1){
+				} else {
+					$tmpval = $app->functions->intval($field_value);
+					if($tmpval === 0 and !empty($field_value)) {
+						$errmsg = $validator['errmsg'];
+						if(isset($this->wordbook[$errmsg])) {
+							$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+						} else {
+							$this->errorMessage .= $errmsg."<br />\r\n";
+						}
+					}
+				}
+				break;
+			case 'ISPOSITIVE':
+				if(!is_numeric($field_value) || $field_value <= 0){
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
 						$this->errorMessage .= $errmsg."<br />\r\n";
 					}
+				}
 				break;
-								case 'ISIPV4':
-								$vip=1;
-								if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
-								$groups=explode(".",$field_value);
-								foreach($groups as $group){
-									if($group<0 OR $group>255)
-									$vip=0;
-								}
-								}else{$vip=0;}
-										if($vip==0) {
-										$errmsg = $validator['errmsg'];
-										  if(isset($this->wordbook[$errmsg])) {
-											 $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-										  } else {
-											 $this->errorMessage .= $errmsg."<br />\r\n";
-										  }
-										}
-								break;
-								case 'ISIP':
-								if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
-								if($validator['allowempty'] == 'y' && $field_value == '') {
-									//* Do nothing
-								} else {
-								//* Check if its a IPv4 or IPv6 address
-									if(isset($validator['separator']) && $validator['separator'] != '') {
-										//* When the field may contain several IP addresses, split them by the char defined as separator
-										$field_value_array = explode($validator['separator'],$field_value);
-									} else {
-										$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'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-											}
-										} else {
-											//* Check content with regex, if we use php < 5.2
-											$ip_ok = 0;
-											if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){
-												$ip_ok = 1;
-											}
-											if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
-												$ip_ok = 1;
-											}
-											if($ip_ok == 0) {
-												$errmsg = $validator['errmsg'];
-												if(isset($this->wordbook[$errmsg])) {
-													$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-												} else {
-													$this->errorMessage .= $errmsg."<br />\r\n";
-												}
-											}
-										}
-									}
-								}
-								break;
-								case 'RANGE':
-										//* Checks if the value is within the given range or above / below a value
-										//* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
-										$range_parts = explode(':',trim($validator['range']));
-										$ok = true;
-										if($range_parts[0] != '' && $field_value < $range_parts[0]) {
-											$ok = false;
-										}
-										if($range_parts[1] != '' && $field_value > $range_parts[1]) {
-											$ok = false;
-										}
-										if($ok != true) {
-											$errmsg = $validator['errmsg'];
-											if(isset($this->wordbook[$errmsg])) {
-												$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
-											} else {
-												$this->errorMessage .= $errmsg."<br />\r\n";
-											}
-										}
-										unset($range_parts);
-								break;
-								case 'CUSTOM':
-										// Calls a custom class to validate this record
-										if($validator['class'] != '' and $validator['function'] != '') {
-												$validator_class = $validator['class'];
-												$validator_function = $validator['function'];
-												$app->uses($validator_class);
-												$this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
-										} else {
-												$this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
-										}
-								break;
-								default:
-									$this->errorMessage .= "Unknown Validator: ".$validator['type'];
-								break;
+			case 'ISV6PREFIX':
+				$v6_prefix_ok = 0;
+				$explode_field_value = explode(':', $field_value);
+				if ($explode_field_value[count($explode_field_value)-1]=='' && $explode_field_value[count($explode_field_value)-2]=='' ){
+					if ( count($explode_field_value) <= 9 ) {
+						if(filter_var(substr($field_value, 0, strlen($field_value)-2), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) or filter_var(substr($field_value, 0, strlen($field_value)-2).'::0', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) or filter_var(substr($field_value, 0, strlen($field_value)-2).':0', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ) {
+							$v6_prefix_ok = 1;
 						}
-
-
+					}
+				} else {
+					$v6_prefix_ok = 2;
 				}
-
-				return true;
-		}
-
-		/**
-		* Create SQL statement
-		*
-		* @param record = Datensatz als Array
-		* @param action = INSERT oder UPDATE
-		* @param primary_id
-		* @return record
-		*/
-		protected function _getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '', $api = false) {
-
-				global $app;
-
-				$this->action = $action;
-				$this->primary_id = $primary_id;
-
-
-				$record = $this->encode($record,$tab,true);
-				$sql_insert_key = '';
-				$sql_insert_val = '';
-				$sql_update = '';
-				
-				if($api == true) $fields = &$this->formDef['fields'];
-				else $fields = &$this->formDef['tabs'][$tab]['fields'];
-				
-				// go trough all fields of the tab
-				if(is_array($record)) {
-				foreach($fields as $key => $field) {
-								// Wenn es kein leeres Passwortfeld ist
-								if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
-										// Erzeuge Insert oder Update Quelltext
-										if($action == "INSERT") {
-												if($field['formtype'] == 'PASSWORD') {
-														$sql_insert_key .= "`$key`, ";
-														if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        } elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
-																$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-														} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
-																$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
-																$record[$key] = $tmp['crypted'];
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        } else {
-                                                                $record[$key] = md5(stripslashes($record[$key]));
-																$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
-                                                        }
-												} elseif ($field['formtype'] == 'CHECKBOX') {
-														$sql_insert_key .= "`$key`, ";
-														if($record[$key] == '') {
-															// if a checkbox is not set, we set it to the unchecked value
-															$sql_insert_val .= "'".$field['value'][0]."', ";
-															$record[$key] = $field['value'][0];
-														} else {
-															$sql_insert_val .= "'".$record[$key]."', ";
-														}
-												} else {
-														$sql_insert_key .= "`$key`, ";
-														$sql_insert_val .= "'".$record[$key]."', ";
-												}
-										} else {
-												if($field['formtype'] == 'PASSWORD') {
-														if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-                                                        } elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
-                                                                $record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-														} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
-																$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
-																$record[$key] = $tmp['crypted'];
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-														} else {
-                                                                $record[$key] = md5(stripslashes($record[$key]));
-																$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
-                                                        }
-
-												} elseif ($field['formtype'] == 'CHECKBOX') {
-														if($record[$key] == '') {
-															// if a checkbox is not set, we set it to the unchecked value
-															$sql_update .= "`$key` = '".$field['value'][0]."', ";
-															$record[$key] = $field['value'][0];
-														} else {
-															$sql_update .= "`$key` = '".$record[$key]."', ";
-														}
-												} else {
-														$sql_update .= "`$key` = '".$record[$key]."', ";
-												}
-										}
+				// check subnet against defined server-ipv6
+				$sql_v6 = $app->db->queryOneRecord("SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND virtualhost = 'y' LIMIT 0,1");
+				$sql_v6_explode=explode(':', $sql_v6['ip_address']);
+				if ( count($sql_v6_explode) < count($explode_field_value) && isset($sql_v6['ip_address']) )  {
+					$v6_prefix_ok = 3;
+				}
+				if($v6_prefix_ok == 0) {
+					$errmsg = $validator['errmsg'];
+				}
+				if($v6_prefix_ok == 2) {
+					$errmsg = 'IPv6 Prefix must end with ::';
+				}
+				if($v6_prefix_ok == 3) {
+					$errmsg = 'IPv6 Prefix too long (according to Server IP Addresses)';
+				}
+				if($v6_prefix_ok <> 1){
+					$this->errorMessage .= $errmsg."<br />\r\n";
+				}
+				break;
+			case 'ISIPV4':
+				$vip=1;
+				if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
+					$groups=explode(".", $field_value);
+					foreach($groups as $group){
+						if($group<0 or $group>255)
+							$vip=0;
+					}
+				}else{$vip=0;}
+				if($vip==0) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				break;
+			case 'ISIP':
+				if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
+				if($validator['allowempty'] == 'y' && $field_value == '') {
+					//* Do nothing
+				} else {
+					//* Check if its a IPv4 or IPv6 address
+					if(isset($validator['separator']) && $validator['separator'] != '') {
+						//* When the field may contain several IP addresses, split them by the char defined as separator
+						$field_value_array = explode($validator['separator'], $field_value);
+					} else {
+						$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'];
+								if(isset($this->wordbook[$errmsg])) {
+									$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
 								} else {
-									// we unset the password filed, if empty to tell the datalog function
-									// that the password has not been changed
-									unset($record[$key]);
+									$this->errorMessage .= $errmsg."<br />\r\n";
 								}
+							}
+						} else {
+							//* Check content with regex, if we use php < 5.2
+							$ip_ok = 0;
+							if(preg_match("/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i", $field_value)){
+								$ip_ok = 1;
+							}
+							if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $field_value)){
+								$ip_ok = 1;
+							}
+							if($ip_ok == 0) {
+								$errmsg = $validator['errmsg'];
+								if(isset($this->wordbook[$errmsg])) {
+									$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+								} else {
+									$this->errorMessage .= $errmsg."<br />\r\n";
+								}
+							}
 						}
-		}
-
-
-				// Add backticks for incomplete table names
-				if(stristr($this->formDef['db_table'],'.')) {
-						$escape = '';
+					}
+				}
+				break;
+			case 'RANGE':
+				//* Checks if the value is within the given range or above / below a value
+				//* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
+				$range_parts = explode(':', trim($validator['range']));
+				$ok = true;
+				if($range_parts[0] != '' && $field_value < $range_parts[0]) {
+					$ok = false;
+				}
+				if($range_parts[1] != '' && $field_value > $range_parts[1]) {
+					$ok = false;
+				}
+				if($ok != true) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
+				unset($range_parts);
+				break;
+			case 'CUSTOM':
+				// Calls a custom class to validate this record
+				if($validator['class'] != '' and $validator['function'] != '') {
+					$validator_class = $validator['class'];
+					$validator_function = $validator['function'];
+					$app->uses($validator_class);
+					$this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
 				} else {
-						$escape = '`';
+					$this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
 				}
+				break;
+			default:
+				$this->errorMessage .= "Unknown Validator: ".$validator['type'];
+				break;
+			}
 
 
-				if($action == "INSERT") {
-						if($this->formDef['auth'] == 'yes') {
-								// Set user and group
-								$sql_insert_key .= "`sys_userid`, ";
-								$sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
-								$sql_insert_key .= "`sys_groupid`, ";
-								$sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
-								$sql_insert_key .= "`sys_perm_user`, ";
-								$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
-								$sql_insert_key .= "`sys_perm_group`, ";
-								$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
-								$sql_insert_key .= "`sys_perm_other`, ";
-								$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
-						}
-						$sql_insert_key = substr($sql_insert_key,0,-2);
-						$sql_insert_val = substr($sql_insert_val,0,-2);
-						$sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
-				} else {
-					if($this->formDef['auth'] == 'yes') {
-						if($primary_id != 0) {
-								if($api == true && $_SESSION["s"]["user"]["client_id"] > 0 && $_SESSION["s"]["user"]["iserid"] > 0 && $_SESSION["s"]["user"]["default_group"] > 0) {
-									$sql_update .= '`sys_userid` = '.$this->sys_userid.', ';
-									$sql_update .= '`sys_groupid` = '.$this->sys_default_group.', ';
-								}
-								
-								$sql_update = substr($sql_update,0,-2);
-								$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
-								if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Create SQL statement
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
+	protected function _getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '', $api = false) {
+
+		global $app;
+
+		$this->action = $action;
+		$this->primary_id = $primary_id;
+
+
+		$record = $this->encode($record, $tab, true);
+		$sql_insert_key = '';
+		$sql_insert_val = '';
+		$sql_update = '';
+
+		if($api == true) $fields = &$this->formDef['fields'];
+		else $fields = &$this->formDef['tabs'][$tab]['fields'];
+
+		// go trough all fields of the tab
+		if(is_array($record)) {
+			foreach($fields as $key => $field) {
+				// Wenn es kein leeres Passwortfeld ist
+				if (!($field['formtype'] == 'PASSWORD' and $record[$key] == '')) {
+					// Erzeuge Insert oder Update Quelltext
+					if($action == "INSERT") {
+						if($field['formtype'] == 'PASSWORD') {
+							$sql_insert_key .= "`$key`, ";
+							if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
+								$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
+								$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
+								$record[$key] = $tmp['crypted'];
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							} else {
+								$record[$key] = md5(stripslashes($record[$key]));
+								$sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+							}
+						} elseif ($field['formtype'] == 'CHECKBOX') {
+							$sql_insert_key .= "`$key`, ";
+							if($record[$key] == '') {
+								// if a checkbox is not set, we set it to the unchecked value
+								$sql_insert_val .= "'".$field['value'][0]."', ";
+								$record[$key] = $field['value'][0];
+							} else {
+								$sql_insert_val .= "'".$record[$key]."', ";
+							}
 						} else {
-								$app->error("Primary ID fehlt!");
+							$sql_insert_key .= "`$key`, ";
+							$sql_insert_val .= "'".$record[$key]."', ";
 						}
 					} else {
-						if($primary_id != 0) {
-								$sql_update = substr($sql_update,0,-2);
-								$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
-								if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+						if($field['formtype'] == 'PASSWORD') {
+							if ((isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') || (isset($record['_ispconfig_pw_crypted']) && $record['_ispconfig_pw_crypted'] == 1)) {
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} elseif(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
+								$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
+								$tmp = $app->db->queryOneRecord("SELECT PASSWORD('".$app->db->quote(stripslashes($record[$key]))."') as `crypted`");
+								$record[$key] = $tmp['crypted'];
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							} else {
+								$record[$key] = md5(stripslashes($record[$key]));
+								$sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+							}
+
+						} elseif ($field['formtype'] == 'CHECKBOX') {
+							if($record[$key] == '') {
+								// if a checkbox is not set, we set it to the unchecked value
+								$sql_update .= "`$key` = '".$field['value'][0]."', ";
+								$record[$key] = $field['value'][0];
+							} else {
+								$sql_update .= "`$key` = '".$record[$key]."', ";
+							}
 						} else {
-								$app->error("Primary ID fehlt!");
+							$sql_update .= "`$key` = '".$record[$key]."', ";
 						}
 					}
-					//* return a empty string if there is nothing to update
-					if(trim($sql_update) == '') $sql = '';
+				} else {
+					// we unset the password filed, if empty to tell the datalog function
+					// that the password has not been changed
+					unset($record[$key]);
 				}
-
-				return $sql;
+			}
 		}
 
-		/**
-		* Create SQL statement
-		*
-		* @param record = Datensatz als Array
-		* @param action = INSERT oder UPDATE
-		* @param primary_id
-		* @return record
-		*/
-		function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
 
-				global $app;
+		// Add backticks for incomplete table names
+		if(stristr($this->formDef['db_table'], '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
 
-				// If there are no data records on the tab, return empty sql string
-				if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
 
-				// checking permissions
-				if($this->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
-						if($action == "INSERT") {
-								if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied.<br />\r\n";
-						} else {
-								if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Update denied.<br />\r\n";
-						}
-				}
-				
-				if(!is_array($this->formDef)) $app->error("Form definition not found.");
-				if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
+		if($action == "INSERT") {
+			if($this->formDef['auth'] == 'yes') {
+				// Set user and group
+				$sql_insert_key .= "`sys_userid`, ";
+				$sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$_SESSION["s"]["user"]["userid"]."', ";
+				$sql_insert_key .= "`sys_groupid`, ";
+				$sql_insert_val .= ($this->formDef["auth_preset"]["groupid"] > 0)?"'".$this->formDef["auth_preset"]["groupid"]."', ":"'".$_SESSION["s"]["user"]["default_group"]."', ";
+				$sql_insert_key .= "`sys_perm_user`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_user"]."', ";
+				$sql_insert_key .= "`sys_perm_group`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_group"]."', ";
+				$sql_insert_key .= "`sys_perm_other`, ";
+				$sql_insert_val .= "'".$this->formDef["auth_preset"]["perm_other"]."', ";
+			}
+			$sql_insert_key = substr($sql_insert_key, 0, -2);
+			$sql_insert_val = substr($sql_insert_val, 0, -2);
+			$sql = "INSERT INTO ".$escape.$this->formDef['db_table'].$escape." ($sql_insert_key) VALUES ($sql_insert_val)";
+		} else {
+			if($this->formDef['auth'] == 'yes') {
+				if($primary_id != 0) {
+					if($api == true && $_SESSION["s"]["user"]["client_id"] > 0 && $_SESSION["s"]["user"]["iserid"] > 0 && $_SESSION["s"]["user"]["default_group"] > 0) {
+						$sql_update .= '`sys_userid` = '.$this->sys_userid.', ';
+						$sql_update .= '`sys_groupid` = '.$this->sys_default_group.', ';
+					}
 
-				return $this->_getSQL($record, $tab, $action, $primary_id, $sql_ext_where, false);
+					$sql_update = substr($sql_update, 0, -2);
+					$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->getAuthSQL('u')." AND ".$this->formDef['db_table_idx']." = ".$primary_id;
+					if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+				} else {
+					$app->error("Primary ID fehlt!");
+				}
+			} else {
+				if($primary_id != 0) {
+					$sql_update = substr($sql_update, 0, -2);
+					$sql = "UPDATE ".$escape.$this->formDef['db_table'].$escape." SET ".$sql_update." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id;
+					if($sql_ext_where != '') $sql .= " and ".$sql_ext_where;
+				} else {
+					$app->error("Primary ID fehlt!");
+				}
+			}
+			//* return a empty string if there is nothing to update
+			if(trim($sql_update) == '') $sql = '';
 		}
 
-		/**
-		* Debugging arrays.
-		*
-		* @param array_data
-		*/
-		function dbg($array_data) {
+		return $sql;
+	}
+
 
-				echo "<pre>";
-				print_r($array_data);
-				echo "</pre>";
+	/**
+	 * Create SQL statement
+	 *
+	 * @param record = Datensatz als Array
+	 * @param action = INSERT oder UPDATE
+	 * @param primary_id
+	 * @return record
+	 */
+	function getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '') {
 
+		global $app;
+
+		// If there are no data records on the tab, return empty sql string
+		if(count($this->formDef['tabs'][$tab]['fields']) == 0) return '';
+
+		// checking permissions
+		if($this->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
+			if($action == "INSERT") {
+				if(!$this->checkPerm($primary_id, 'i')) $this->errorMessage .= "Insert denied.<br />\r\n";
+			} else {
+				if(!$this->checkPerm($primary_id, 'u')) $this->errorMessage .= "Update denied.<br />\r\n";
+			}
 		}
 
+		if(!is_array($this->formDef)) $app->error("Form definition not found.");
+		if(!is_array($this->formDef['tabs'][$tab])) $app->error("The tab is empty or does not exist (TAB: $tab).");
+
+		return $this->_getSQL($record, $tab, $action, $primary_id, $sql_ext_where, false);
+	}
+
+
+	/**
+	 * Debugging arrays.
+	 *
+	 * @param array_data
+	 */
+	function dbg($array_data) {
+
+		echo "<pre>";
+		print_r($array_data);
+		echo "</pre>";
+
+	}
+
 
 	function showForm() {
-			global $app,$conf;
+		global $app, $conf;
 
 		if(!is_array($this->formDef)) die("Form Definition wurde nicht geladen.");
 
-				$active_tab = $this->getNextTab();
+		$active_tab = $this->getNextTab();
 
 		// go trough the tabs
 		foreach( $this->formDef["tabs"] as $key => $tab) {
@@ -1285,20 +1289,20 @@ class tform_base {
 
 
 				if(!is_file($tab["template"])) {
-					 $app->uses('tform_tpl_generator');
-					 $app->tform_tpl_generator->buildHTML($this->formDef,$tab['name']);
+					$app->uses('tform_tpl_generator');
+					$app->tform_tpl_generator->buildHTML($this->formDef, $tab['name']);
 				}
 				$app->tpl->setVar('readonly_tab', (isset($tab['readonly']) && $tab['readonly'] == true));
-				$app->tpl->setInclude('content_tpl',$tab["template"]);
+				$app->tpl->setInclude('content_tpl', $tab["template"]);
 				$tab["active"] = 1;
 				$_SESSION["s"]["form"]["tab"] = $tab['name'];
 			} else {
-					$tab["active"] = 0;
+				$tab["active"] = 0;
 			}
 
-						// Unset unused variables.
-						unset($tab["fields"]);
-						unset($tab["plugins"]);
+			// Unset unused variables.
+			unset($tab["fields"]);
+			unset($tab["plugins"]);
 
 			$frmTab[] = $tab;
 		}
@@ -1306,52 +1310,53 @@ class tform_base {
 		// setting form tabs
 		$app->tpl->setLoop("formTab", $frmTab);
 
-				// Set form action
-				$app->tpl->setVar('form_action',$this->formDef["action"]);
-				$app->tpl->setVar('form_active_tab',$active_tab);
+		// Set form action
+		$app->tpl->setVar('form_action', $this->formDef["action"]);
+		$app->tpl->setVar('form_active_tab', $active_tab);
 
-				// Set form title
-				$form_hint = $this->lng($this->formDef["title"]);
-				if($this->formDef["description"] != '') $form_hint .= '<div class="pageForm_description">'.$this->lng($this->formDef["description"]).'</div>';
-				$app->tpl->setVar('form_hint',$form_hint);
+		// Set form title
+		$form_hint = $this->lng($this->formDef["title"]);
+		if($this->formDef["description"] != '') $form_hint .= '<div class="pageForm_description">'.$this->lng($this->formDef["description"]).'</div>';
+		$app->tpl->setVar('form_hint', $form_hint);
 
-				// Set Wordbook for this form
+		// Set Wordbook for this form
 
-				$app->tpl->setVar($this->wordbook);
-		}
+		$app->tpl->setVar($this->wordbook);
+	}
 
-		function getDataRecord($primary_id) {
-			global $app;
-			$escape = '`';
-			$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id." AND ".$this->getAuthSQL('r',$this->formDef['db_table']);
-			return $app->db->queryOneRecord($sql);
-		}
+	function getDataRecord($primary_id) {
+		global $app;
+		$escape = '`';
+		$sql = "SELECT * FROM ".$escape.$this->formDef['db_table'].$escape." WHERE ".$this->formDef['db_table_idx']." = ".$primary_id." AND ".$this->getAuthSQL('r', $this->formDef['db_table']);
+		return $app->db->queryOneRecord($sql);
+	}
 
 
-		function datalogSave($action,$primary_id, $record_old, $record_new) {
-				global $app,$conf;
+	function datalogSave($action, $primary_id, $record_old, $record_new) {
+		global $app, $conf;
 
-				$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
-				return true;
-        }
+		$app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new);
+		return true;
+	}
 
-		function getAuthSQL($perm, $table = '') {
-				if($_SESSION["s"]["user"]["typ"] == 'admin') {
-					return '1';
-				} else {
-					if ($table != ''){
-						$table = ' ' . $table . '.';
-					}
-					$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
-					$sql = '(';
-					$sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR  ";
-					$sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR ";
-					$sql .= $table . "sys_perm_other like '%$perm%'";
-					$sql .= ')';
-
-					return $sql;
-				}
+	function getAuthSQL($perm, $table = '') {
+		if($_SESSION["s"]["user"]["typ"] == 'admin') {
+			return '1';
+		} else {
+			if ($table != ''){
+				$table = ' ' . $table . '.';
+			}
+			$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
+			$sql = '(';
+			$sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR  ";
+			$sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR ";
+			$sql .= $table . "sys_perm_other like '%$perm%'";
+			$sql .= ')';
+
+			return $sql;
 		}
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/tform_tpl_generator.inc.php b/interface/lib/classes/tform_tpl_generator.inc.php
index bfc932f84d63b4643691fcec511116671f353988..635aa0467b6c1408b404fd7ceae6fc5697cf4e24 100644
--- a/interface/lib/classes/tform_tpl_generator.inc.php
+++ b/interface/lib/classes/tform_tpl_generator.inc.php
@@ -29,13 +29,13 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class tform_tpl_generator {
-	
-	function buildHTML($formDef,$tab) {
-		
+
+	function buildHTML($formDef, $tab) {
+
 		global $app;
-		
+
 		$module = $_SESSION["s"]["module"]["name"];
-		
+
 		$html = '<h2><tmpl_var name="list_head_txt"></h2>
 <p><tmpl_var name="list_desc_txt"></p>
 
@@ -51,22 +51,22 @@ class tform_tpl_generator {
 			if ($field['required'] == true ) { $html_reqcode = $html_reqestedelement; } else { $html_reqcode = ''; }
 
 			switch ($field['formtype']) {
-				case 'TEXT':
-					$html .= "
+			case 'TEXT':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <input name=\"".$key."\" id=\"".$key."\" value=\"{tmpl_var name='".$key."'}\" size=\"".$field['width']."\" maxlength=\"".$field['maxlength']."\" type=\"text\" class=\"textInput\" />
 			</div>";
 				break;
-				case 'TEXTAREA':
-					$html .= "
+			case 'TEXTAREA':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <textarea name=\"".$key."\" id=\"".$key."\" rows='".$field['rows']."' cols='".$field['cols']."'>{tmpl_var name='".$key."'}</textarea>
       </div>";
 				break;
-				case 'SELECT':
-					$html .= "
+			case 'SELECT':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <select name=\"".$key."\" id=\"".$key."\" class=\"selectInput\">
@@ -74,8 +74,8 @@ class tform_tpl_generator {
 				</select>
       </div>";
 				break;
-				case 'MULTIPLE':
-					$html .= "
+			case 'MULTIPLE':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <select multiple name=\"".$key."\" id=\"".$key."\" class=\"selectInput\">
@@ -83,15 +83,15 @@ class tform_tpl_generator {
 				</select>
       </div>";
 				break;
-				case 'PASSWORD':
-					$html .= "
+			case 'PASSWORD':
+				$html .= "
       <div class=\"ctrlHolder\">
       	<label for=\"".$key."\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</label>
         <input name=\"".$key."\" id=\"".$key."\" value=\"{tmpl_var name='".$key."'}\" size=\"".$field['width']."\" maxlength=\"".$field['maxlength']."\" type=\"password\" class=\"textInput\" />
 			</div>";
 				break;
-				case 'CHECKBOX':
-					$html .= "
+			case 'CHECKBOX':
+				$html .= "
       <div class=\"ctrlHolder\">
 				<p class=\"label\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</p>
 					<div class=\"multiField\">
@@ -99,8 +99,8 @@ class tform_tpl_generator {
 					</div>
 			</div>";
 				break;
-				case 'CHECKBOXARRAY':
-					$html .= "
+			case 'CHECKBOXARRAY':
+				$html .= "
       <div class=\"ctrlHolder\">
 				<p class=\"label\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</p>
 					<div class=\"multiField\">
@@ -108,8 +108,8 @@ class tform_tpl_generator {
 					</div>
 			</div>";
 				break;
-				case 'RADIO':
-					$html .= "
+			case 'RADIO':
+				$html .= "
       <div class=\"ctrlHolder\">
 				<p class=\"label\">".$html_reqcode."{tmpl_var name='".$key."_txt'}</p>
 					<div class=\"multiField\">
@@ -118,18 +118,18 @@ class tform_tpl_generator {
 			</div>";
 				break;
 			}
-			
+
 			// Language File Eintrag für "Feld-Titel" anlegen
 			$lang[$key."_txt"] = $key;
-			
+
 			// language File Eintrag, für error-Text anlegen
 			if(isset($field["errmsg"]) && $field["errmsg"] != '') {
 				$errmsg = $field["errmsg"];
 				$lang[$errmsg] = $errmsg;
 			}
-			
+
 		}
-		
+
 		$html .= "
     </fieldset>
 
@@ -140,94 +140,94 @@ class tform_tpl_generator {
       <button class=\"negative iconstxt icoNegative\" type=\"button\" value=\"{tmpl_var name='btn_cancel_txt'}\" onclick=\"loadContent('".$module."/".$formDef["list_default"]."');\"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
     </div>
   </div>
-  
+
 </div>
 ";
 
-				
+
 		// speichere Template
-		if (!$handle = fopen($formDef['tabs'][$tab]['template'], 'w')) { 
-        	print "Cannot open file (".$formDef['tabs'][$tab]['template'].")"; 
-        	exit; 
-   		} 
- 
-   		if (!fwrite($handle, $html)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
+		if (!$handle = fopen($formDef['tabs'][$tab]['template'], 'w')) {
+			print "Cannot open file (".$formDef['tabs'][$tab]['template'].")";
+			exit;
+		}
+
+		if (!fwrite($handle, $html)) {
+			print "Cannot write to file ($filename)";
+			exit;
 		}
 		fclose($handle);
-		
-		$this->lng_add($lang,$formDef);
-		
+
+		$this->lng_add($lang, $formDef);
+
 		// überprüfe, ob es die Tabelle schon gibt,
 		// ansonsten wird sie angelegt
 		$tables = $app->db->getTables();
-		
-		if(!@in_array($formDef['db_table'],$tables)) {
+
+		if(!@in_array($formDef['db_table'], $tables)) {
 			// Datenbank noch nicht vorhanden
-			
+
 			$columns = array();
-			
+
 			// füge ID Feld hinzu
-			$col = array(	'action' 		=> 'add',
-							'name'			=> $formDef["db_table_idx"],
-							'type'			=> 'int64',
-							'typeValue'		=> '',
-							'defaultValue'	=> false,
-							'notNull'		=> true,
-							'autoInc'		=> true,
-							'option'		=> 'primary'
-						);
-					
+			$col = array( 'action'   => 'add',
+				'name'   => $formDef["db_table_idx"],
+				'type'   => 'int64',
+				'typeValue'  => '',
+				'defaultValue' => false,
+				'notNull'  => true,
+				'autoInc'  => true,
+				'option'  => 'primary'
+			);
+
 			$columns[] = $col;
 			$app->db->show_error_messages = true;
-			
+
 			if($formDef["auth"] == 'yes') {
-				
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_userid',
-								'type'			=> 'int32',
-								'typeValue'		=> '',
-								'defaultValue'	=> '0',
-								'notNull'		=> true
-							);
+
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_userid',
+					'type'   => 'int32',
+					'typeValue'  => '',
+					'defaultValue' => '0',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_groupid',
-								'type'			=> 'int32',
-								'typeValue'		=> '',
-								'defaultValue'	=> '0',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_groupid',
+					'type'   => 'int32',
+					'typeValue'  => '',
+					'defaultValue' => '0',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_perm_user',
-								'type'			=> 'varchar',
-								'typeValue'		=> '5',
-								'defaultValue'	=> 'NULL',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_perm_user',
+					'type'   => 'varchar',
+					'typeValue'  => '5',
+					'defaultValue' => 'NULL',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_perm_group',
-								'type'			=> 'varchar',
-								'typeValue'		=> '5',
-								'defaultValue'	=> 'NULL',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_perm_group',
+					'type'   => 'varchar',
+					'typeValue'  => '5',
+					'defaultValue' => 'NULL',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-				$col = array(	'action' 		=> 'add',
-								'name'			=> 'sys_perm_other',
-								'type'			=> 'varchar',
-								'typeValue'		=> '5',
-								'defaultValue'	=> 'NULL',
-								'notNull'		=> true
-							);
+				$col = array( 'action'   => 'add',
+					'name'   => 'sys_perm_other',
+					'type'   => 'varchar',
+					'typeValue'  => '5',
+					'defaultValue' => 'NULL',
+					'notNull'  => true
+				);
 				$columns[] = $col;
-			
+
 			}
-			
-			
+
+
 			foreach($formDef['tabs'] as $tab) {
 				foreach($tab["fields"] as $name => $field) {
 					/*
@@ -240,85 +240,86 @@ class tform_tpl_generator {
 				                        notNull =>   true | false
 				                        autoInc =>   true | false
 				                        option =>   unique | primary | index)
-				       
-				       
+
+
 					*/
 					switch ($field["datatype"]) {
-						case 'INTEGER':
-							$type = 'int32';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'INTEGER':
+						$type = 'int32';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
-						case 'DOUBLE':
-							$type = 'double';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'DOUBLE':
+						$type = 'double';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
-						case 'CURRENCY':
-							$type = 'double';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'CURRENCY':
+						$type = 'double';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
-						case 'VARCHAR':
-							$type = 'varchar';
-							$typeValue = ($field["maxlength"] > 0 and $field["maxlength"] <= 256)?$field["maxlength"]:255;
-							// $defaultValue	= ($field["default"] != '')?$field["default"]:'NOT NULL';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'NULL';
+					case 'VARCHAR':
+						$type = 'varchar';
+						$typeValue = ($field["maxlength"] > 0 and $field["maxlength"] <= 256)?$field["maxlength"]:255;
+						// $defaultValue = ($field["default"] != '')?$field["default"]:'NOT NULL';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'NULL';
 						break;
-						case 'TEXT':
-							$type = 'text';
-							$typevalue = '';
-							$defaultValue = 'NULL';
+					case 'TEXT':
+						$type = 'text';
+						$typevalue = '';
+						$defaultValue = 'NULL';
 						break;
-						case 'DATE':
-							$type = 'int64';
-							$typevalue = '';
-							$defaultValue	= ($field["default"] != '')?$field["default"]:'0';
+					case 'DATE':
+						$type = 'int64';
+						$typevalue = '';
+						$defaultValue = ($field["default"] != '')?$field["default"]:'0';
 						break;
 					}
-					
-					
-					$col = array(	'action' 		=> 'add',
-									'name'			=> $name,
-									'type'			=> $type,
-									'typeValue'		=> $typeValue,
-									'defaultValue'	=> $defaultValue,
-									'notNull'		=> true
-									);
-					
+
+
+					$col = array( 'action'   => 'add',
+						'name'   => $name,
+						'type'   => $type,
+						'typeValue'  => $typeValue,
+						'defaultValue' => $defaultValue,
+						'notNull'  => true
+					);
+
 					$columns[] = $col;
 				}
 			}
-		
-		$app->db->createTable($formDef["db_table"],$columns);
-		
+
+			$app->db->createTable($formDef["db_table"], $columns);
+
 		}
 	}
-	
-	function lng_add($lang,$formDef) {
-		global $go_api, $go_info,$conf;
-		
+
+	function lng_add($lang, $formDef) {
+		global $go_api, $go_info, $conf;
+
 		$lng_file = "lib/lang/".$conf["language"]."_".$formDef['name'].".lng";
 		if(is_file($lng_file)) {
-			include($lng_file);
+			include $lng_file;
 		} else {
 			$wb = array();
 		}
-		
-		$wb_out = array_merge($lang,$wb);
-		
+
+		$wb_out = array_merge($lang, $wb);
+
 		if(is_array($wb_out)) {
-			$fp = fopen ($lng_file, "w");
-			fwrite($fp,"<?php\n");
+			$fp = fopen($lng_file, "w");
+			fwrite($fp, "<?php\n");
 			foreach($wb_out as $key => $val) {
 				$new_line = '$wb["'.$key.'"] = '."'$val';\n";
-				fwrite($fp,$new_line);
-				
+				fwrite($fp, $new_line);
+
 			}
-			fwrite($fp,"?>");
+			fwrite($fp, "?>");
 			fclose($fp);
 		}
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tools_monitor.inc.php b/interface/lib/classes/tools_monitor.inc.php
index cb389c8d445fa0cc00b3219893392b8fb56beb12..19f2ccd5a9969951bf0405f23e86e67bc64bd084 100644
--- a/interface/lib/classes/tools_monitor.inc.php
+++ b/interface/lib/classes/tools_monitor.inc.php
@@ -29,21 +29,21 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class tools_monitor {
 
-    function showServerLoad() {
-        global $app;
+	function showServerLoad() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'server_load' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes'];
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			if (strlen($data['up_minutes']) == "1") $data['up_minutes'] = "0".$data['up_minutes'];
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>
                 <tr>
@@ -54,7 +54,7 @@ class tools_monitor {
                 <td>' . $app->lng("Users online").':</td>
                 <td>' . $data['user_online'] . '</td>
                 </tr>' .
-                    '<tr>
+				'<tr>
                 <td>' . $app->lng("System load 1 minute") . ':</td>
                 <td>' . $data['load_1'] . '</td>
                 </tr>
@@ -69,27 +69,27 @@ class tools_monitor {
                 </table>
                 </div>
                 </div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
-        }
+		} else {
+			$html = '<p>'.$app->lng("no_data_serverload_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showDiskUsage () {
-        global $app;
+	function showDiskUsage () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'disk_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>
                 <tr>
@@ -101,34 +101,34 @@ class tools_monitor {
                 <td>'.$app->lng("monitor_diskusage_usage_txt").'</td>
                 <td>'.$app->lng("monitor_diskusage_mounted_txt").'</td>
                 </tr>';
-            foreach($data as $line) {
-                $html .= '<tr>';
-                foreach ($line as $item) {
-                    $html .= '<td>' . $item . '</td>';
-                }
-                $html .= '</tr>';
-            }
-            $html .= '</table>';
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
-        }
-
-
-        return $html;
-    }
-
-    function showDatabaseSize () {
-	global $app;
-	/* fetch the Data from the DB */
-	$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'database_size' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-	if(isset($record['data'])) {
-		$data = unserialize($record['data']);
-		/*
+			foreach($data as $line) {
+				$html .= '<tr>';
+				foreach ($line as $item) {
+					$html .= '<td>' . $item . '</td>';
+				}
+				$html .= '</tr>';
+			}
+			$html .= '</table>';
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_diskusage_txt").'</p>';
+		}
+
+
+		return $html;
+	}
+
+	function showDatabaseSize () {
+		global $app;
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'database_size' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
+			/*
             	Format the data
             	*/
-            	$html =
-        	       '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
 	                <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 	<table>
 	                <thead>
@@ -137,448 +137,450 @@ class tools_monitor {
 	                <td>'.$app->lng("monitor_database_size_txt").'</td>
         	        <td>'.$app->lng("monitor_database_client_txt").'</td>
                 	</tr>';
-            	foreach($data as $line) {
-                	$html .= '<tr>';
-	                if ($line['size'] > 0) $line['size'] = $app->functions->formatBytes($line['size']);
-        	        $t=$app->db->queryOneRecord("SELECT username FROM client WHERE sys_groupid = ".$line['client_id']);
-	                $line['client_id']=$t['username'];
-        	        unset($t);
-                	foreach ($line as $item) {
-				$html .= '<td>' . $item . '</td>';
-	                }
-        	        $html .= '</tr></tmpl loop>';
-            	}
-            	$html .= '</tbody></table>';
-            	$html .= '</div></div>';
-        } else {
-            	$html = '<p>'.$app->lng("no_data_database_size_txt").'</p>';
-        }
-        return $html;
-    }
-
-    function showMemUsage () {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
-
-            /*
+			foreach($data as $line) {
+				$html .= '<tr>';
+				if ($line['size'] > 0) $line['size'] = $app->functions->formatBytes($line['size']);
+				$t=$app->db->queryOneRecord("SELECT username FROM client WHERE sys_groupid = ".$line['client_id']);
+				$line['client_id']=$t['username'];
+				unset($t);
+				foreach ($line as $item) {
+					$html .= '<td>' . $item . '</td>';
+				}
+				$html .= '</tr></tmpl loop>';
+			}
+			$html .= '</tbody></table>';
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_database_size_txt").'</p>';
+		}
+		return $html;
+	}
+
+	function showMemUsage () {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mem_usage' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
+
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>';
 
-            foreach($data as $key => $value) {
-                if ($key != '') {
-                    $html .= '<tr>
+			foreach($data as $key => $value) {
+				if ($key != '') {
+					$html .= '<tr>
                         <td>' . $key . ':</td>
                         <td>' . $value . '</td>
                         </tr>';
-                }
-            }
-            $html .= '</table>';
-            $html .= '</div></div>';
+				}
+			}
+			$html .= '</table>';
+			$html .= '</div></div>';
 
-        } else {
-            $html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
-        }
+		} else {
+			$html = '<p>'.$app->lng("no_data_memusage_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showCpuInfo () {
-        global $app;
+	function showCpuInfo () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'cpu_info' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>';
-            foreach($data as $key => $value) {
-                if ($key != '') {
-                    $html .= '<tr>
+			foreach($data as $key => $value) {
+				if ($key != '') {
+					$html .= '<tr>
                         <td>' . $key . ':</td>
                         <td>' . $value . '</td>
                         </tr>';
-                }
-            }
-            $html .= '</table>';
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
-        }
+				}
+			}
+			$html .= '</table>';
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_cpuinfo_txt").'</p>';
+		}
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showServices () {
-        global $app;
+	function showServices () {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'services' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
 
-            /*
+			/*
             Format the data
             */
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">
                 <table>';
 
-            if($data['webserver'] != -1) {
-                if($data['webserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['webserver'] != -1) {
+				if($data['webserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_web_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
 
-            if($data['ftpserver'] != -1) {
-                if($data['ftpserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			if($data['ftpserver'] != -1) {
+				if($data['ftpserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_ftp_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
-
-            if($data['smtpserver'] != -1) {
-                if($data['smtpserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			}
+
+			if($data['smtpserver'] != -1) {
+				if($data['smtpserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_smtp_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
-
-            if($data['pop3server'] != -1) {
-                if($data['pop3server'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			}
+
+			if($data['pop3server'] != -1) {
+				if($data['pop3server'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_pop_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
-
-            if($data['imapserver'] != -1) {
-                if($data['imapserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			}
+
+			if($data['imapserver'] != -1) {
+				if($data['imapserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_imap_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
-
-            if($data['bindserver'] != -1) {
-                if($data['bindserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			}
+
+			if($data['bindserver'] != -1) {
+				if($data['bindserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_mydns_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
-
-            if($data['mysqlserver'] != -1) {
-                if($data['mysqlserver'] == 1) {
-                    $status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
-                } else {
-                    $status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
-                }
-                $html .= '<tr>
+			}
+
+			if($data['mysqlserver'] != -1) {
+				if($data['mysqlserver'] == 1) {
+					$status = '<span class="online">'.$app->lng("monitor_services_online_txt").'</span>';
+				} else {
+					$status = '<span class="offline">'.$app->lng("monitor_services_offline_txt").'</span>';
+				}
+				$html .= '<tr>
                 <td>'.$app->lng("monitor_services_mysql_txt").'</td>
                 <td>'.$status.'</td>
                 </tr>';
-            }
+			}
 
 
-            $html .= '</table></div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_services_txt").'</p>';
-        }
+			$html .= '</table></div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_services_txt").'</p>';
+		}
 
 
-        return $html;
-    }
+		return $html;
+	}
 
-    function showSystemUpdate() {
-        global $app;
+	function showSystemUpdate() {
+		global $app;
 
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'system_update' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
 
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because the destribution is not supported) show this.
             */
-            if ($record['state'] == 'no_state') {
-                $html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>';
-            }
-            else {
-                $data = unserialize($record['data']);
-                $html .= nl2br(html_entity_decode($data['output']));
-            }
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
-        }
-
-        return $html;
-    }
-
-
-    function showOpenVzBeancounter() {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'openvz_beancounter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			if ($record['state'] == 'no_state') {
+				$html .= '<p>'.$app->lng("monitor_updates_nosupport_txt").'</p>';
+			}
+			else {
+				$data = unserialize($record['data']);
+				$html .= nl2br(html_entity_decode($data['output']));
+			}
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
+		}
+
+		return $html;
+	}
+
+
+	function showOpenVzBeancounter() {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'openvz_beancounter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because the server is not a VE) show this.
             */
-            $data = unserialize($record['data']);
-            if ((!isset($data)) || ($data == '')) {
-                $html .= '<p>'.$app->lng("monitor_beancounter_nosupport_txt").'</p>';
-            }
-            else {
-                $html .= '<pre>' . nl2br($data) . '</pre>';
-            }
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
-        }
-
-        return $html;
-    }
-
-    function showRaidState() {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$data = unserialize($record['data']);
+			if ((!isset($data)) || ($data == '')) {
+				$html .= '<p>'.$app->lng("monitor_beancounter_nosupport_txt").'</p>';
+			}
+			else {
+				$html .= '<pre>' . nl2br($data) . '</pre>';
+			}
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>'.$app->lng("no_data_updates_txt").'</p>';
+		}
+
+		return $html;
+	}
+
+	function showRaidState() {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'raid_state' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because the RAID-Controler is not supported yet) show this.
             */
-            if ($record['state'] == 'no_state') {
-                $html .= '<p>'.$app->lng("monitor_nosupportedraid1_txt").'</p>';
-            }
-            else {
-                $data = unserialize($record['data']);
-                $html .= nl2br($data['output']);
-            }
-            $html .= '</div></div>';
-
-        } else {
-            $html = '<p>'.$app->lng("no_data_raid_txt").'</p>';
-        }
-
-        return $html;
-    }
-
-    function showRKHunter() {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			if ($record['state'] == 'no_state') {
+				$html .= '<p>'.$app->lng("monitor_nosupportedraid1_txt").'</p>';
+			}
+			else {
+				$data = unserialize($record['data']);
+				$html .= nl2br($data['output']);
+			}
+			$html .= '</div></div>';
+
+		} else {
+			$html = '<p>'.$app->lng("no_data_raid_txt").'</p>';
+		}
+
+		return $html;
+	}
+
+	function showRKHunter() {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'rkhunter' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because rkhunter is not installed) show this.
             */
-            $data = unserialize($record['data']);
-            if ($data['output'] == '') {
-                $html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>';
-            }
-            else {
-                $html .= nl2br($data['output']);
-            }
-            $html .= '</div></div>';
-
-        } else {
-            $html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>';
-        }
-
-        return $html;
-    }
-
-    function showFail2ban() {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$data = unserialize($record['data']);
+			if ($data['output'] == '') {
+				$html .= '<p>'.$app->lng("monitor_norkhunter_txt").'</p>';
+			}
+			else {
+				$html .= nl2br($data['output']);
+			}
+			$html .= '</div></div>';
+
+		} else {
+			$html = '<p>'.$app->lng("no_data_rkhunter_txt").'</p>';
+		}
+
+		return $html;
+	}
+
+	function showFail2ban() {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_fail2ban' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because fail2ban is not installed) show this.
             */
-            $data = unserialize($record['data']);
-            if ($data == '') {
-                $html .= '<p>'.
-                        'fail2ban is not installed at this server.<br />' .
-                        'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
-                        '</p>';
-            }
-            else {
-                $html .= nl2br($data);
-            }
-            $html .= '</div></div>';
-
-        } else {
-            $html = '<p>There is no data available at the moment.</p>';
-        }
-
-        return $html;
-    }
-
-    function showMongoDB() {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_mongodb' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$data = unserialize($record['data']);
+			if ($data == '') {
+				$html .= '<p>'.
+					'fail2ban is not installed at this server.<br />' .
+					'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
+					'</p>';
+			}
+			else {
+				$html .= nl2br($data);
+			}
+			$html .= '</div></div>';
+
+		} else {
+			$html = '<p>There is no data available at the moment.</p>';
+		}
+
+		return $html;
+	}
+
+	function showMongoDB() {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'log_mongodb' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
 
-            /*
+			/*
              * First, we have to detect, if there is any monitoring-data.
              * If not (because mongodb is not installed) show this.
             */
-            $data = unserialize($record['data']);
-            if ($data == '') {
-                $html .= '<p>'.
-                        'MongoDB is not installed at this server.<br />' .
-                        'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
-                        '</p>';
-            }
-            else {
-                $html .= nl2br($data);
-            }
-            $html .= '</div></div>';
-
-        } else {
-            $html = '<p>There is no data available at the moment.</p>';
-        }
-
-        return $html;
-    }
-
-    function showIPTables() {
-        global $app;
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-        if(isset($record['data'])) {
-            $html =
-                    '<div class="systemmonitor-state state-'.$record['state'].'">
+			$data = unserialize($record['data']);
+			if ($data == '') {
+				$html .= '<p>'.
+					'MongoDB is not installed at this server.<br />' .
+					'See more (for debian) <a href="http://www.howtoforge.com/fail2ban_debian_etch" target="htf">here...</a>'.
+					'</p>';
+			}
+			else {
+				$html .= nl2br($data);
+			}
+			$html .= '</div></div>';
+
+		} else {
+			$html = '<p>There is no data available at the moment.</p>';
+		}
+
+		return $html;
+	}
+
+	function showIPTables() {
+		global $app;
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'iptables_rules' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+		if(isset($record['data'])) {
+			$html =
+				'<div class="systemmonitor-state state-'.$record['state'].'">
                 <div class="systemmonitor-content icons32 ico-'.$record['state'].'">';
-            $data = unserialize($record['data']);
-            if ($data == '') {
-                $html .= '<p>Problem, there are no rules listed for the server</p>';
-            }
-            else {
-                $html .= nl2br($data['output']);
-            }
-            $html .= '</div></div>';
-        } else {
-            $html = '<p>There is no data available at the moment.</p>';
-        }
-        return $html;
-    }
-
-
-    function showMailq() {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        if(isset($record['data'])) {
-            $data = unserialize($record['data']);
-            $html = nl2br($data['output']);
-        } else {
-            $html = '<p>'.$app->lng("no_data_mailq_txt").'</p>';
-        }
-
-        return $html;
-    }
-
-    function getDataTime($type) {
-        global $app;
-
-        /* fetch the Data from the DB */
-        $record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
-
-        /* TODO: datetimeformat should be set somewhat other way */
-        $dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt");
-
-        if(isset($record['created'])) {
-    //        $res = date('Y-m-d H:i', $record['created']);
-            $res = date($dateTimeFormat, $record['created']);
-        } else {
-            $res = '????-??-?? ??:??';
-        }
-        return $res;
-    }
+			$data = unserialize($record['data']);
+			if ($data == '') {
+				$html .= '<p>Problem, there are no rules listed for the server</p>';
+			}
+			else {
+				$html .= nl2br($data['output']);
+			}
+			$html .= '</div></div>';
+		} else {
+			$html = '<p>There is no data available at the moment.</p>';
+		}
+		return $html;
+	}
+
+
+	function showMailq() {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE type = 'mailq' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		if(isset($record['data'])) {
+			$data = unserialize($record['data']);
+			$html = nl2br($data['output']);
+		} else {
+			$html = '<p>'.$app->lng("no_data_mailq_txt").'</p>';
+		}
+
+		return $html;
+	}
+
+	function getDataTime($type) {
+		global $app;
+
+		/* fetch the Data from the DB */
+		$record = $app->db->queryOneRecord("SELECT created FROM monitor_data WHERE type = '" . $type . "' and server_id = " . $_SESSION['monitor']['server_id'] . " order by created desc");
+
+		/* TODO: datetimeformat should be set somewhat other way */
+		$dateTimeFormat = $app->lng("monitor_settings_datetimeformat_txt");
+
+		if(isset($record['created'])) {
+			//        $res = date('Y-m-d H:i', $record['created']);
+			$res = date($dateTimeFormat, $record['created']);
+		} else {
+			$res = '????-??-?? ??:??';
+		}
+		return $res;
+	}
+
 }
+
 ?>
diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php
index deb57f5e33e52143e47206d27f730ab071c6ded8..c636bbc610994b05846428a99cb62f12cb518d70 100644
--- a/interface/lib/classes/tools_sites.inc.php
+++ b/interface/lib/classes/tools_sites.inc.php
@@ -29,147 +29,148 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class tools_sites {
 
-    function replacePrefix($name, $dataRecord) {
-        // No input -> no possible output -> go out!
-        if ($name=="") return "";
-
-        // Array containing keys to search
-        $keywordlist=array('CLIENTNAME','CLIENTID','DOMAINID');
-
-        // Try to match the key within the string
-        foreach ($keywordlist as $keyword) {
-            if (substr_count($name, '['.$keyword.']') > 0) {
-                switch ($keyword) {
-                    case 'CLIENTNAME':
-                        $name=str_replace('['.$keyword.']', $this->getClientName($dataRecord),$name);
-                    break;
-                    case 'CLIENTID':
-                        $name=str_replace('['.$keyword.']', $this->getClientID($dataRecord),$name);
-                    break;
-                    case 'DOMAINID':
-                        $name=str_replace('['.$keyword.']', $dataRecord['parent_domain_id'],$name);
-                    break;
-                }
-            }
-        }
-        return $name;
-    }
-    
-    function removePrefix($name, $currentPrefix, $globalPrefix) {
-        if($name == "") return "";
-        
-        if($currentPrefix === '') return $name; // empty prefix, do not change name
-        if($currentPrefix === '#') $currentPrefix = $globalPrefix; // entry has no prefix set, maybe it was created before this function was introduced
-        
-        if($currentPrefix === '') return $name; // no current prefix and global prefix is empty -> nothing to remove here.
-        
-        return preg_replace('/^' . preg_quote($currentPrefix, '/') . '/', '', $name); // return name without prefix
-    }
-    
-    function getPrefix($currentPrefix, $userPrefix, $adminPrefix = false) {
-        global $app;
-        
-        if($currentPrefix !== '#') return $currentPrefix; // return the currently set prefix for this entry (# = no prefix set yet)
-        
-        if($adminPrefix === false) $adminPrefix = $userPrefix;
-        
-        if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) return $adminPrefix;
-        else return $userPrefix;
-    }
-    
-    function getClientName($dataRecord) {
-        global $app, $conf;
-        if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-            // Get the group-id of the user if the logged in user is neither admin nor reseller
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-        } else {
-            // Get the group-id from the data itself
-            if(isset($dataRecord['client_group_id'])) {
-                $client_group_id = $dataRecord['client_group_id'];
-            } elseif (isset($dataRecord['parent_domain_id'])) {
-                $tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
-                $client_group_id = $tmp['sys_groupid'];
-            } elseif(isset($dataRecord['sys_groupid'])) {
-                $client_group_id = $dataRecord['sys_groupid'];
-            } else {
-                $client_group_id = 0;
-            }
-        }
-        
-        $tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
-        $clientName = $tmp['name'];
-        if ($clientName == "") $clientName = 'default';
-        $clientName = $this->convertClientName($clientName);
-        return $clientName;
-    }
-
-    function getClientID($dataRecord) {
-        global $app, $conf;
-
-        if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-            // Get the group-id of the user
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-        } else {
-            // Get the group-id from the data itself
-            if(isset($dataRecord['client_group_id'])) {
-                $client_group_id = $dataRecord['client_group_id'];
-            } elseif (isset($dataRecord['parent_domain_id']) && $dataRecord['parent_domain_id'] != 0) {
-                $tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
-                $client_group_id = $tmp['sys_groupid'];
-            } elseif(isset($dataRecord['sys_groupid'])) {
-                $client_group_id = $dataRecord['sys_groupid'];
-            } else {
-                $client_group_id = 0;
-            }
-        }
-        $tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
-        $clientID = $tmp['client_id'];
-        if ($clientID == '') $clientID = '0';
-        return $clientID;
-    }
-    
-    function convertClientName($name){
-        $allowed = 'abcdefghijklmnopqrstuvwxyz0123456789_';
-        $res = '';
-        $name = strtolower(trim($name));
-        for ($i=0; $i < strlen($name); $i++){
-            if ($name[$i] == ' ') continue;
-            if (strpos($allowed, $name[$i]) !== false){
-                $res .= $name[$i];
-            }
-            else {
-                $res .= '_';
-            }
-        }
-        return $res;
-    }
-    
-    function getDomainModuleDomains() {
-        global $app;
-        
-        $sql = "SELECT domain_id, domain FROM domain WHERE";
-        if ($_SESSION["s"]["user"]["typ"] == 'admin') {
-            $sql .= " 1";
-        } else {
-            $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
-            $sql .= " sys_groupid IN (".$groups.")";
-        }
-        $sql .= " ORDER BY domain";
-        return $app->db->queryAllRecords($sql);
-    }
-    
-    function checkDomainModuleDomain($domain_id) {
-        global $app;
-        
-        $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($domain_id);
-        if ($_SESSION["s"]["user"]["typ"] != 'admin') {
-            $groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
-            $sql .= " AND sys_groupid IN (".$groups.")";
-        }
-        $domain = $app->db->queryOneRecord($sql);
-        if(!$domain || !$domain['domain_id']) return false;
-        return $domain['domain'];
-    }
+	function replacePrefix($name, $dataRecord) {
+		// No input -> no possible output -> go out!
+		if ($name=="") return "";
+
+		// Array containing keys to search
+		$keywordlist=array('CLIENTNAME', 'CLIENTID', 'DOMAINID');
+
+		// Try to match the key within the string
+		foreach ($keywordlist as $keyword) {
+			if (substr_count($name, '['.$keyword.']') > 0) {
+				switch ($keyword) {
+				case 'CLIENTNAME':
+					$name=str_replace('['.$keyword.']', $this->getClientName($dataRecord), $name);
+					break;
+				case 'CLIENTID':
+					$name=str_replace('['.$keyword.']', $this->getClientID($dataRecord), $name);
+					break;
+				case 'DOMAINID':
+					$name=str_replace('['.$keyword.']', $dataRecord['parent_domain_id'], $name);
+					break;
+				}
+			}
+		}
+		return $name;
+	}
+
+	function removePrefix($name, $currentPrefix, $globalPrefix) {
+		if($name == "") return "";
+
+		if($currentPrefix === '') return $name; // empty prefix, do not change name
+		if($currentPrefix === '#') $currentPrefix = $globalPrefix; // entry has no prefix set, maybe it was created before this function was introduced
+
+		if($currentPrefix === '') return $name; // no current prefix and global prefix is empty -> nothing to remove here.
+
+		return preg_replace('/^' . preg_quote($currentPrefix, '/') . '/', '', $name); // return name without prefix
+	}
+
+	function getPrefix($currentPrefix, $userPrefix, $adminPrefix = false) {
+		global $app;
+
+		if($currentPrefix !== '#') return $currentPrefix; // return the currently set prefix for this entry (# = no prefix set yet)
+
+		if($adminPrefix === false) $adminPrefix = $userPrefix;
+
+		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) return $adminPrefix;
+		else return $userPrefix;
+	}
+
+	function getClientName($dataRecord) {
+		global $app, $conf;
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			// Get the group-id of the user if the logged in user is neither admin nor reseller
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			if(isset($dataRecord['client_group_id'])) {
+				$client_group_id = $dataRecord['client_group_id'];
+			} elseif (isset($dataRecord['parent_domain_id'])) {
+				$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
+				$client_group_id = $tmp['sys_groupid'];
+			} elseif(isset($dataRecord['sys_groupid'])) {
+				$client_group_id = $dataRecord['sys_groupid'];
+			} else {
+				$client_group_id = 0;
+			}
+		}
+
+		$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
+		$clientName = $tmp['name'];
+		if ($clientName == "") $clientName = 'default';
+		$clientName = $this->convertClientName($clientName);
+		return $clientName;
+	}
+
+	function getClientID($dataRecord) {
+		global $app, $conf;
+
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			// Get the group-id of the user
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			if(isset($dataRecord['client_group_id'])) {
+				$client_group_id = $dataRecord['client_group_id'];
+			} elseif (isset($dataRecord['parent_domain_id']) && $dataRecord['parent_domain_id'] != 0) {
+				$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = " . $dataRecord['parent_domain_id']);
+				$client_group_id = $tmp['sys_groupid'];
+			} elseif(isset($dataRecord['sys_groupid'])) {
+				$client_group_id = $dataRecord['sys_groupid'];
+			} else {
+				$client_group_id = 0;
+			}
+		}
+		$tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id));
+		$clientID = $tmp['client_id'];
+		if ($clientID == '') $clientID = '0';
+		return $clientID;
+	}
+
+	function convertClientName($name){
+		$allowed = 'abcdefghijklmnopqrstuvwxyz0123456789_';
+		$res = '';
+		$name = strtolower(trim($name));
+		for ($i=0; $i < strlen($name); $i++){
+			if ($name[$i] == ' ') continue;
+			if (strpos($allowed, $name[$i]) !== false){
+				$res .= $name[$i];
+			}
+			else {
+				$res .= '_';
+			}
+		}
+		return $res;
+	}
+
+	function getDomainModuleDomains() {
+		global $app;
+
+		$sql = "SELECT domain_id, domain FROM domain WHERE";
+		if ($_SESSION["s"]["user"]["typ"] == 'admin') {
+			$sql .= " 1";
+		} else {
+			$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
+			$sql .= " sys_groupid IN (".$groups.")";
+		}
+		$sql .= " ORDER BY domain";
+		return $app->db->queryAllRecords($sql);
+	}
+
+	function checkDomainModuleDomain($domain_id) {
+		global $app;
+
+		$sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($domain_id);
+		if ($_SESSION["s"]["user"]["typ"] != 'admin') {
+			$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
+			$sql .= " AND sys_groupid IN (".$groups.")";
+		}
+		$domain = $app->db->queryOneRecord($sql);
+		if(!$domain || !$domain['domain_id']) return false;
+		return $domain['domain'];
+	}
+
 }
 
 ?>
diff --git a/interface/lib/classes/tpl.inc.php b/interface/lib/classes/tpl.inc.php
index 070e34919b1e2115096a64cb0e04f65df885d10b..4b411e2c3caaed3975bef8a94a3daf0de565c50a 100644
--- a/interface/lib/classes/tpl.inc.php
+++ b/interface/lib/classes/tpl.inc.php
@@ -1,15 +1,16 @@
 <?php
 /**
-* vlibTemplate is a class used to seperate PHP and HTML.
-* For instructions on how to use vlibTemplate, see the
-* vlibTemplate.html file, located in the 'docs' directory.
-*
-* @since 07/03/2002
-* @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-* @package vLIB
-* @access public
-* @see vlibTemplate.html
-*/
+ * vlibTemplate is a class used to seperate PHP and HTML.
+ * For instructions on how to use vlibTemplate, see the
+ * vlibTemplate.html file, located in the 'docs' directory.
+ *
+ * @since 07/03/2002
+ * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+ * @package vLIB
+ * @access public
+ * @see vlibTemplate.html
+ */
+
 
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 // +----------------------------------------------------------------------+
@@ -25,200 +26,243 @@
 //** check and avoid multiple loading of class
 if (!defined('vlibTemplateClassLoaded')) {
 
-    define('vlibTemplateClassLoaded', 1);
-   	include_once (ISPC_CLASS_PATH.'/tpl_error.inc.php');
-   	include_once (ISPC_CLASS_PATH.'/tpl_ini.inc.php');
+	define('vlibTemplateClassLoaded', 1);
+	include_once ISPC_CLASS_PATH.'/tpl_error.inc.php';
+	include_once ISPC_CLASS_PATH.'/tpl_ini.inc.php';
+
+	class tpl{
 
-    class tpl{
-    
-        /*-----------------------------------------------------------------------------\
+		/*-----------------------------------------------------------------------------\
         |                                 ATTENTION                                    |
         |  Do not touch the following variables. vlibTemplate will not work otherwise. |
         \-----------------------------------------------------------------------------*/
-        private $OPTIONS = array(
-                'MAX_INCLUDES'          =>   10,
-                'TEMPLATE_DIR'          => null,
-                'GLOBAL_VARS'           => null,
-                'GLOBAL_CONTEXT_VARS'   => null,
-                'LOOP_CONTEXT_VARS'     => null,
-                'SET_LOOP_VAR'          => null,
-                'DEFAULT_ESCAPE'        => null,
-                'STRICT'                => null,
-                'CASELESS'              => null,
-                'UNKNOWNS'              => null,
-                'TIME_PARSE'            => null,
-                'ENABLE_PHPINCLUDE'     => null,
-                'INCLUDE_PATHS'         => array(),
-                'CACHE_DIRECTORY'       => null,
-                'CACHE_LIFETIME'        => null,
-                'CACHE_EXTENSION'       => null
-                );
-
-        /** open and close tags used for escaping */
-        private $ESCAPE_TAGS = array(
-                'html'      => array('open' => 'htmlspecialchars('    ,'close'=> ', ENT_QUOTES)'),
-                'url'       => array('open' => 'urlencode('           ,'close'=> ')'),
-                'rawurl'    => array('open' => 'rawurlencode('        ,'close'=> ')'),
-                'sq'        => array('open' => 'addcslashes('         ,'close'=> ", \"'\")"),
-                'dq'        => array('open' => 'addcslashes('         ,'close'=> ", '\"')"),
-                '1'         => array('open' => 'htmlspecialchars('    ,'close'=> ', ENT_QUOTES)'),
-                '0'         => array('open' => ''                     ,'close'=> ''),
-                'none'      => array('open' => ''                     ,'close'=> ''),
-                'hex'       => array('open' => '$this->_escape_hex('  ,'close'=> ', false)'),
-                'hexentity' => array('open' => '$this->_escape_hex('  ,'close'=> ', true)')
-                );
-    
-        /** open and close tags used for formatting */
-        private $FORMAT_TAGS = array(
-                'strtoupper' => array('open' => 'strtoupper(',          'close'=> ')'),
-                'uc'         => array('open' => 'strtoupper(',          'close'=> ')'),
-                'strtolower' => array('open' => 'strtolower(',          'close'=> ')'),
-                'lc'         => array('open' => 'strtolower(',          'close'=> ')'),
-                'ucfirst'    => array('open' => 'ucfirst(',             'close'=> ')'),
-                'lcucfirst'  => array('open' => 'ucfirst(strtolower(',  'close'=> '))'),
-                'ucwords'    => array('open' => 'ucwords(',             'close'=> ')'),
-                'lcucwords'  => array('open' => 'ucwords(strtolower(',  'close'=> '))')
-                );
-
-        /** operators allowed when using extended TMPL_IF syntax */
-        private $allowed_if_ops = array('==','!=','<>','<','>','<=','>=');
-    
-        /** dbs allowed by vlibTemplate::setDbLoop(). */
-        private $allowed_loop_dbs = array('MYSQL','POSTGRESQL','INFORMIX','INTERBASE','INGRES',
-                                        'MSSQL','MSQL','OCI8','ORACLE','OVRIMOS','SYBASE');
-    
-        /** root directory of vlibTemplate automagically filled in */
-        private $VLIBTEMPLATE_ROOT = null;
-    
-        /** contains current directory used when doing recursive include */
-        private $_currentincludedir = array();
-    
-        /** current depth of includes */
-        private $_includedepth = 0;
-    
-        /** full path to tmpl file */
-        private $_tmplfilename = null;
-    
-        /** file data before it's parsed */
-        private $_tmplfile = null;
-    
-        /** parsed version of file, ready for eval()ing */
-        private $_tmplfilep = null;
-    
-        /** eval()ed version ready for printing or whatever */
-        private $_tmploutput = null;
-    
-        /** array for variables to be kept */
-        private $_vars = array();
-    
-        /** array where loop variables are kept */
-        private $_arrvars = array();
-
-        /** array which holds the current namespace during parse */
-        private $_namespace = array();
-    
-        /** variable is set to true once the template is parsed, to save re-parsing everything */
-        private $_parsed = false;
-    
-        /** array holds all unknowns vars */
-        private $_unknowns = array();
-    
-        /** microtime when template parsing began */
-        private $_firstparsetime = null;
-    
-        /** total time taken to parse template */
-        private $_totalparsetime = null;
-    
-        /** name of current loop being passed in */
-        private $_currloopname = null;
-    
-        /** rows with the above loop */
-        private $_currloop = array();
-    
-        /** define vars to avoid warnings */
-        private $_debug = null;
-        private $_cache = null;
-        
-        /** array which holds the dynamic Includes */
-        private $_dyninclude = array();
-
-        /*-----------------------------------------------------------------------------\
+		private $OPTIONS = array(
+			'MAX_INCLUDES'          =>   10,
+			'TEMPLATE_DIR'          => null,
+			'GLOBAL_VARS'           => null,
+			'GLOBAL_CONTEXT_VARS'   => null,
+			'LOOP_CONTEXT_VARS'     => null,
+			'SET_LOOP_VAR'          => null,
+			'DEFAULT_ESCAPE'        => null,
+			'STRICT'                => null,
+			'CASELESS'              => null,
+			'UNKNOWNS'              => null,
+			'TIME_PARSE'            => null,
+			'ENABLE_PHPINCLUDE'     => null,
+			'INCLUDE_PATHS'         => array(),
+			'CACHE_DIRECTORY'       => null,
+			'CACHE_LIFETIME'        => null,
+			'CACHE_EXTENSION'       => null
+		);
+
+		/** open and close tags used for escaping */
+		private $ESCAPE_TAGS = array(
+			'html'      => array('open' => 'htmlspecialchars('    , 'close'=> ', ENT_QUOTES)'),
+			'url'       => array('open' => 'urlencode('           , 'close'=> ')'),
+			'rawurl'    => array('open' => 'rawurlencode('        , 'close'=> ')'),
+			'sq'        => array('open' => 'addcslashes('         , 'close'=> ", \"'\")"),
+			'dq'        => array('open' => 'addcslashes('         , 'close'=> ", '\"')"),
+			'1'         => array('open' => 'htmlspecialchars('    , 'close'=> ', ENT_QUOTES)'),
+			'0'         => array('open' => ''                     , 'close'=> ''),
+			'none'      => array('open' => ''                     , 'close'=> ''),
+			'hex'       => array('open' => '$this->_escape_hex('  , 'close'=> ', false)'),
+			'hexentity' => array('open' => '$this->_escape_hex('  , 'close'=> ', true)')
+		);
+
+
+
+		/** open and close tags used for formatting */
+		private $FORMAT_TAGS = array(
+			'strtoupper' => array('open' => 'strtoupper(',          'close'=> ')'),
+			'uc'         => array('open' => 'strtoupper(',          'close'=> ')'),
+			'strtolower' => array('open' => 'strtolower(',          'close'=> ')'),
+			'lc'         => array('open' => 'strtolower(',          'close'=> ')'),
+			'ucfirst'    => array('open' => 'ucfirst(',             'close'=> ')'),
+			'lcucfirst'  => array('open' => 'ucfirst(strtolower(',  'close'=> '))'),
+			'ucwords'    => array('open' => 'ucwords(',             'close'=> ')'),
+			'lcucwords'  => array('open' => 'ucwords(strtolower(',  'close'=> '))')
+		);
+
+		/** operators allowed when using extended TMPL_IF syntax */
+		private $allowed_if_ops = array('==', '!=', '<>', '<', '>', '<=', '>=');
+
+
+
+		/** dbs allowed by vlibTemplate::setDbLoop(). */
+		private $allowed_loop_dbs = array('MYSQL', 'POSTGRESQL', 'INFORMIX', 'INTERBASE', 'INGRES',
+			'MSSQL', 'MSQL', 'OCI8', 'ORACLE', 'OVRIMOS', 'SYBASE');
+
+
+
+		/** root directory of vlibTemplate automagically filled in */
+		private $VLIBTEMPLATE_ROOT = null;
+
+
+
+		/** contains current directory used when doing recursive include */
+		private $_currentincludedir = array();
+
+
+
+		/** current depth of includes */
+		private $_includedepth = 0;
+
+
+
+		/** full path to tmpl file */
+		private $_tmplfilename = null;
+
+
+
+		/** file data before it's parsed */
+		private $_tmplfile = null;
+
+
+
+		/** parsed version of file, ready for eval()ing */
+		private $_tmplfilep = null;
+
+
+
+		/** eval()ed version ready for printing or whatever */
+		private $_tmploutput = null;
+
+
+
+		/** array for variables to be kept */
+		private $_vars = array();
+
+
+
+		/** array where loop variables are kept */
+		private $_arrvars = array();
+
+		/** array which holds the current namespace during parse */
+		private $_namespace = array();
+
+
+
+		/** variable is set to true once the template is parsed, to save re-parsing everything */
+		private $_parsed = false;
+
+
+
+		/** array holds all unknowns vars */
+		private $_unknowns = array();
+
+
+
+		/** microtime when template parsing began */
+		private $_firstparsetime = null;
+
+
+
+		/** total time taken to parse template */
+		private $_totalparsetime = null;
+
+
+
+		/** name of current loop being passed in */
+		private $_currloopname = null;
+
+
+
+		/** rows with the above loop */
+		private $_currloop = array();
+
+
+
+		/** define vars to avoid warnings */
+		private $_debug = null;
+		private $_cache = null;
+
+
+
+		/** array which holds the dynamic Includes */
+		private $_dyninclude = array();
+
+		/*-----------------------------------------------------------------------------\
         |                           public functions                                   |
         \-----------------------------------------------------------------------------*/
-		    
-		
-        /**
-         * Usually called by the class constructor.
-         * Stores the filename in $this->_tmplfilename.
-         * Raises an error if the template file is not found.
-         * @param string $tmplfile full path to template file
-         * @return boolean true
-         * @access public
-         */
-        public function newTemplate($tmplfile)
-        {
-            if (!$tfile = $this->_fileSearch($tmplfile)){
-                vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
-            }
 
-            //* make sure that any parsing vars are cleared for the new template
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
-
-            //* reset debug module
-            if ($this->_debug){
-                $this->_debugReset();
-            }
-            $this->_tmplfilename = $tfile;
-            return true;
-        }
-
-        /**
-         * Sets variables to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        public function setVar($k, $v = null)
-        {
-            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 ) {
-                        $this->_vars[$key] = $value;
-                    }
-                }
-            } else {
-                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 {
-                    return false;
-                }
-            }
-            return true;
-        }
-        
-        /**
-         * Sets dynamic includes to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        public function setInclude($k, $v = null) 
-        {
-        	if(is_array($k)) {
+
+
+
+
+		/**
+		 * Usually called by the class constructor.
+		 * Stores the filename in $this->_tmplfilename.
+		 * Raises an error if the template file is not found.
+		 * @param string $tmplfile full path to template file
+		 * @return boolean true
+		 * @access public
+		 */
+		public function newTemplate($tmplfile)
+		{
+			if (!$tfile = $this->_fileSearch($tmplfile)){
+				vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
+			}
+
+			//* make sure that any parsing vars are cleared for the new template
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+
+			//* reset debug module
+			if ($this->_debug){
+				$this->_debugReset();
+			}
+			$this->_tmplfilename = $tfile;
+			return true;
+		}
+
+		/**
+		 * Sets variables to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setVar($k, $v = null)
+		{
+			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 ) {
+						$this->_vars[$key] = $value;
+					}
+				}
+			} else {
+				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 {
+					return false;
+				}
+			}
+			return true;
+		}
+
+
+
+		/**
+		 * Sets dynamic includes to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setInclude($k, $v = null)
+		{
+			if(is_array($k)) {
 				foreach($k as $key => $val) {
 					$this->_dyninclude[$key] = $val;
 				}
@@ -228,103 +272,103 @@ if (!defined('vlibTemplateClassLoaded')) {
 			return true;
 		}
 
-        /**
-         * Unsets a variable which has already been set
-         * Parse in all vars wanted for deletion in seperate parametres
-         * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        public function unsetVar()
-        {
-            $num_args = func_num_args();
-            if ($num_args < 1)  return false;
-
-            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;
-                unset($this->_vars[$var]);
-            }
-            return true;
-        }
-
-        /**
-         * Gets all vars currently set in global namespace.
-         * @return array
-         * @access public
-         */
-        public function getVars()
-        {
-            return empty($this->_vars) ? false : $this->_vars;
-        }
-
-        /**
-         * Gets a single var from the global namespace
-         * @return var
-         * @access public
-         */
-        public function getVar($var)
-        {
-            if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-            return (empty($var) || !isset($this->_vars[$var])) ? false : $this->_vars[$var];
-        }
-
-        /**
-         * sets the GLOBAL_CONTEXT_VARS
-         * @return true
-         * @access public
-         */
-        public function setContextVars()
-        {
-            $_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
-            $_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
-            $_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
-            $_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
-
-            //* the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
-            $_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
-            $_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
-
-            $this->setvar('__SELF__', $_self);
-            $this->setvar('__REQUEST_URI__', $_uri);
-            return true;
-        }
-
-        /**
-         * Builds the loop construct for use with <TMPL_LOOP>.
-         * @param string $k string to define loop name
-         * @param array $v array to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        public function setLoop($k, $v)
-        {
-            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;
-        }
-
-        /**
-         * [** EXPERIMENTAL **]
-         * Function to create a loop from a Db result resource link.
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @param string $result link to a Db result resource
-         * @param string $db_type, type of db that the result resource belongs to.
-         * @return boolean true/false
-         * @access public
-         */
-        public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
-        {
-            /*
+		/**
+		 * Unsets a variable which has already been set
+		 * Parse in all vars wanted for deletion in seperate parametres
+		 * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		public function unsetVar()
+		{
+			$num_args = func_num_args();
+			if ($num_args < 1)  return false;
+
+			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;
+				unset($this->_vars[$var]);
+			}
+			return true;
+		}
+
+		/**
+		 * Gets all vars currently set in global namespace.
+		 * @return array
+		 * @access public
+		 */
+		public function getVars()
+		{
+			return empty($this->_vars) ? false : $this->_vars;
+		}
+
+		/**
+		 * Gets a single var from the global namespace
+		 * @return var
+		 * @access public
+		 */
+		public function getVar($var)
+		{
+			if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+			return (empty($var) || !isset($this->_vars[$var])) ? false : $this->_vars[$var];
+		}
+
+		/**
+		 * sets the GLOBAL_CONTEXT_VARS
+		 * @return true
+		 * @access public
+		 */
+		public function setContextVars()
+		{
+			$_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
+			$_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
+			$_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
+			$_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+
+			//* the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
+			$_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
+			$_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
+
+			$this->setvar('__SELF__', $_self);
+			$this->setvar('__REQUEST_URI__', $_uri);
+			return true;
+		}
+
+		/**
+		 * Builds the loop construct for use with <TMPL_LOOP>.
+		 * @param string $k string to define loop name
+		 * @param array $v array to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setLoop($k, $v)
+		{
+			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;
+		}
+
+		/**
+		 * [** EXPERIMENTAL **]
+		 * Function to create a loop from a Db result resource link.
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @param string $result link to a Db result resource
+		 * @param string $db_type, type of db that the result resource belongs to.
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function setDbLoop($loopname, $result, $db_type = 'MYSQL')
+		{
+			/*
 			$db_type = strtoupper($db_type);
             if (!in_array($db_type, $this->allowed_loop_dbs)) {
                 vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB', WARNING, $db_type);
@@ -452,932 +496,936 @@ if (!defined('vlibTemplateClassLoaded')) {
             $this->setLoop($loopname, $loop_arr);
             return true;
 			*/
-        }
-
-        /**
-         * Sets the name for the curent loop in the 3 step loop process.
-         * @param string $name string to define loop name
-         * @return boolean true/false
-         * @access public
-         */
-        public function newLoop($loopname)
-        {
-            if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
-                $this->_currloopname[$loopname] = $loopname;
-                $this->_currloop[$loopname] = array();
-                return true;
-            } else {
-                return false;
-            }
-        }
-
-        /**
-         * Adds a row to the current loop in the 3 step loop process.
-         * @param array $row loop row to add to current loop
-         * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
-         * @return boolean true/false
-         * @access public
-         */
-        public function addRow($row, $loopname = null)
-        {
-            if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
-
-            if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
-                vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
-                return false;
-            }
-            if (is_array($row)) {
-                $this->_currloop[$loopname][] = $row;
-                return true;
-            } else {
-                return false;
-            }
-        }
-
-        /**
-         * Completes the 3 step loop process. This assigns the rows and resets
-         * the variables used.
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @return boolean true/false
-         * @access public
-         */
-        public function addLoop($loopname = null)
-        {
-            if ($loopname == null) { // add last loop used
-                if (!empty($this->_currloop)) {
-                    foreach ($this->_currloop as $k => $v) {
-                        $this->setLoop($k, $v);
-                        unset($this->_currloop[$k]);
-                    }
-                    $this->_currloopname = array();
-                    return true;
-                } else {
-                    return false;
-                }
-            } elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
-                    vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
-                    return false;
-            } else { // add a specific loop
-                $this->setLoop($loopname, $this->_currloop[$loopname]);
-                unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
-            }
-            return true;
-        }
-
-        /**
-         * Unsets a loop which has already been set.
-         * Can only unset top level loops.
-         * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        public function unsetLoop()
-        {
-            $num_args = func_num_args();
-            if ($num_args < 1) return false;
-
-            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;
-                unset($this->_arrvars[$var]);
-            }
-            return true;
-        }
-
-        /**
-         * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
-         * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
-         * @return boolean true
-         * @access public
-         */
-        public function reset()
-        {
-            $this->clearVars();
-            $this->clearLoops();
-            $this->_tmplfilename = null;
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
-
-        /**
-         * Unsets all variables in the template
-         * @return boolean true
-         * @access public
-         */
-        public function clearVars()
-        {
-            $this->_vars = array();
-            return true;
-        }
-
-        /**
-         * Unsets all loops in the template
-         * @return boolean true
-         * @access public
-         */
-        public function clearLoops()
-        {
-            $this->_arrvars = array();
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
-
-        /**
-         * Unsets all variables and loops set using setVar/Loop()
-         * @return boolean true
-         * @access public
-         */
-        public function clearAll()
-        {
-            $this->clearVars();
-            $this->clearLoops();
-            return true;
-        }
-
-        /**
-         * Returns true if unknowns were found after parsing.
-         * Function MUST be called AFTER one of the parsing functions to have any relevance.
-         * @return boolean true/false
-         * @access public
-         */
-        public function unknownsExist()
-        {
-            return (!empty($this->_unknowns));
-        }
-
-        /**
-         * Alias for unknownsExist.
-         * @access public
-         */
-        public function unknowns()
-        {
-            return $this->unknownsExist();
-        }
-
-        /**
-         * Returns an array of all unknown vars found when parsing.
-         * This function is only relevant after parsing a document.
-         * @return array
-         * @access public
-         */
-        public function getUnknowns()
-        {
-            return $this->_unknowns;
-        }
-
-        /**
-          * Sets how you want to handle variables that were found in the
-         * template but not set in vlibTemplate using vlibTemplate::setVar().
-         * @param  string $arg ignore, remove, print, leave or comment
-         * @return boolean
-         * @access public
-         */
-        public function setUnknowns($arg)
-        {
-            $arg = strtolower(trim($arg));
-            if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
-                $this->OPTIONS['UNKNOWNS'] = $arg;
-                return true;
-            }
-            return false;
-        }
-
-        /**
-         * function sets the paths to use when including files.
-         * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
-         * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
-         * with as many paths as you like.
-         * if this function is called without any arguments, it will just delete any previously set paths.
-         *
-         * @param string path (mulitple)
-         * @return bool success
-         * @access public
-         */
-        public function setPath()
-        {
-            $num_args = func_num_args();
-            if ($num_args < 1) {
-                $this->OPTIONS['INCLUDE_PATHS'] = array();
-                return true;
-            }
-            for ($i = 0; $i < $num_args; $i++) {
-                $thispath = func_get_arg($i);
-                array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
-            }
-            return true;
-        }
-
-        /**
-         * After using one of the parse functions, this will allow you
-         * access the time taken to parse the template.
-         * see OPTION 'TIME_PARSE'.
-         *
-         * @return float time taken to parse template
-         * @access public
-         */
-        public function getParseTime()
-        {
-            if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
-                return $this->_totalparsetime;
-            }
-            return false;
-        }
-
-
-        /**
-         * Identical to pparse() except that it uses output buffering w/ gz compression thus
-         * printing the output directly and compressed if poss.
-         * Will possibly if parsing a huge template.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        public function fastPrint()
-        {
-            $ret = $this->_parse('ob_gzhandler');
-            print($this->_tmploutput);
-            return $ret;
-        }
-
-
-        /**
-         * Calls parse, and then prints out $this->_tmploutput
-         * @access public
-         * @return boolean true/false
-         */
-        public function pparse()
-        {
-            if (!$this->_parsed) $this->_parse();
-            print($this->_tmploutput);
-            return true;
-        }
-
-        /**
-         * Alias for pparse()
-         * @access public
-         */
-        public function pprint()
-        {
-            return $this->pparse();
-        }
-
-
-        /**
-         * Returns the parsed output, ready for printing, passing to mail() ...etc.
-         * Invokes $this->_parse() if template has not yet been parsed.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        public function grab()
-        {
-            if (!$this->_parsed) $this->_parse();
-            return $this->_tmploutput;
-        }
-
-        /*-----------------------------------------------------------------------------\
+		}
+
+		/**
+		 * Sets the name for the curent loop in the 3 step loop process.
+		 * @param string $name string to define loop name
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function newLoop($loopname)
+		{
+			if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
+				$this->_currloopname[$loopname] = $loopname;
+				$this->_currloop[$loopname] = array();
+				return true;
+			} else {
+				return false;
+			}
+		}
+
+		/**
+		 * Adds a row to the current loop in the 3 step loop process.
+		 * @param array $row loop row to add to current loop
+		 * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function addRow($row, $loopname = null)
+		{
+			if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
+
+			if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			}
+			if (is_array($row)) {
+				$this->_currloop[$loopname][] = $row;
+				return true;
+			} else {
+				return false;
+			}
+		}
+
+		/**
+		 * Completes the 3 step loop process. This assigns the rows and resets
+		 * the variables used.
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function addLoop($loopname = null)
+		{
+			if ($loopname == null) { // add last loop used
+				if (!empty($this->_currloop)) {
+					foreach ($this->_currloop as $k => $v) {
+						$this->setLoop($k, $v);
+						unset($this->_currloop[$k]);
+					}
+					$this->_currloopname = array();
+					return true;
+				} else {
+					return false;
+				}
+			} elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			} else { // add a specific loop
+				$this->setLoop($loopname, $this->_currloop[$loopname]);
+				unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
+			}
+			return true;
+		}
+
+		/**
+		 * Unsets a loop which has already been set.
+		 * Can only unset top level loops.
+		 * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		public function unsetLoop()
+		{
+			$num_args = func_num_args();
+			if ($num_args < 1) return false;
+
+			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;
+				unset($this->_arrvars[$var]);
+			}
+			return true;
+		}
+
+		/**
+		 * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
+		 * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
+		 * @return boolean true
+		 * @access public
+		 */
+		public function reset()
+		{
+			$this->clearVars();
+			$this->clearLoops();
+			$this->_tmplfilename = null;
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
+
+		/**
+		 * Unsets all variables in the template
+		 * @return boolean true
+		 * @access public
+		 */
+		public function clearVars()
+		{
+			$this->_vars = array();
+			return true;
+		}
+
+		/**
+		 * Unsets all loops in the template
+		 * @return boolean true
+		 * @access public
+		 */
+		public function clearLoops()
+		{
+			$this->_arrvars = array();
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
+
+		/**
+		 * Unsets all variables and loops set using setVar/Loop()
+		 * @return boolean true
+		 * @access public
+		 */
+		public function clearAll()
+		{
+			$this->clearVars();
+			$this->clearLoops();
+			return true;
+		}
+
+		/**
+		 * Returns true if unknowns were found after parsing.
+		 * Function MUST be called AFTER one of the parsing functions to have any relevance.
+		 * @return boolean true/false
+		 * @access public
+		 */
+		public function unknownsExist()
+		{
+			return !empty($this->_unknowns);
+		}
+
+		/**
+		 * Alias for unknownsExist.
+		 * @access public
+		 */
+		public function unknowns()
+		{
+			return $this->unknownsExist();
+		}
+
+		/**
+		 * Returns an array of all unknown vars found when parsing.
+		 * This function is only relevant after parsing a document.
+		 * @return array
+		 * @access public
+		 */
+		public function getUnknowns()
+		{
+			return $this->_unknowns;
+		}
+
+		/**
+		 * Sets how you want to handle variables that were found in the
+		 * template but not set in vlibTemplate using vlibTemplate::setVar().
+		 * @param  string $arg ignore, remove, print, leave or comment
+		 * @return boolean
+		 * @access public
+		 */
+		public function setUnknowns($arg)
+		{
+			$arg = strtolower(trim($arg));
+			if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
+				$this->OPTIONS['UNKNOWNS'] = $arg;
+				return true;
+			}
+			return false;
+		}
+
+		/**
+		 * function sets the paths to use when including files.
+		 * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
+		 * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
+		 * with as many paths as you like.
+		 * if this function is called without any arguments, it will just delete any previously set paths.
+		 *
+		 * @param string path (mulitple)
+		 * @return bool success
+		 * @access public
+		 */
+		public function setPath()
+		{
+			$num_args = func_num_args();
+			if ($num_args < 1) {
+				$this->OPTIONS['INCLUDE_PATHS'] = array();
+				return true;
+			}
+			for ($i = 0; $i < $num_args; $i++) {
+				$thispath = func_get_arg($i);
+				array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
+			}
+			return true;
+		}
+
+		/**
+		 * After using one of the parse functions, this will allow you
+		 * access the time taken to parse the template.
+		 * see OPTION 'TIME_PARSE'.
+		 *
+		 * @return float time taken to parse template
+		 * @access public
+		 */
+		public function getParseTime()
+		{
+			if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
+				return $this->_totalparsetime;
+			}
+			return false;
+		}
+
+
+		/**
+		 * Identical to pparse() except that it uses output buffering w/ gz compression thus
+		 * printing the output directly and compressed if poss.
+		 * Will possibly if parsing a huge template.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		public function fastPrint()
+		{
+			$ret = $this->_parse('ob_gzhandler');
+			print($this->_tmploutput);
+			return $ret;
+		}
+
+
+		/**
+		 * Calls parse, and then prints out $this->_tmploutput
+		 * @access public
+		 * @return boolean true/false
+		 */
+		public function pparse()
+		{
+			if (!$this->_parsed) $this->_parse();
+			print($this->_tmploutput);
+			return true;
+		}
+
+		/**
+		 * Alias for pparse()
+		 * @access public
+		 */
+		public function pprint()
+		{
+			return $this->pparse();
+		}
+
+
+		/**
+		 * Returns the parsed output, ready for printing, passing to mail() ...etc.
+		 * Invokes $this->_parse() if template has not yet been parsed.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		public function grab()
+		{
+			if (!$this->_parsed) $this->_parse();
+			return $this->_tmploutput;
+		}
+
+		/*-----------------------------------------------------------------------------\
         |                           private functions                                  |
         \-----------------------------------------------------------------------------*/
 
-        /**
-         * vlibTemplate constructor.
-         * if $tmplfile has been passed to it, it will send to $this->newTemplate()
-         * @param string $tmplfile full path to template file
-         * @param array $options see above
-         * @return boolean true/false
-         * @access private
-         */
-        public function __construct($tmplfile = null, $options = null)
-        {
-            if (is_array($tmplfile) && $options == null) {
-                $options = $tmplfile;
-                unset($tmplfile);
-            }
+		/**
+		 * vlibTemplate constructor.
+		 * if $tmplfile has been passed to it, it will send to $this->newTemplate()
+		 * @param string $tmplfile full path to template file
+		 * @param array $options see above
+		 * @return boolean true/false
+		 * @access private
+		 */
+		public function __construct($tmplfile = null, $options = null)
+		{
+			if (is_array($tmplfile) && $options == null) {
+				$options = $tmplfile;
+				unset($tmplfile);
+			}
 
-            $this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
+			$this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
 
-            if (is_array(vlibIni::vlibTemplate())) {
-                foreach (vlibIni::vlibTemplate() as $name => $val) {
-                    $this->OPTIONS[$name] = $val;
-                }
-            }
+			if (is_array(vlibIni::vlibTemplate())) {
+				foreach (vlibIni::vlibTemplate() as $name => $val) {
+					$this->OPTIONS[$name] = $val;
+				}
+			}
 
-            if (is_array($options)) {
-                foreach($options as $key => $val) {
-                    $key = strtoupper($key);
-                    if ($key == 'PATH') {
-                        $this->setPath($val);
-                    } else {
-                        $this->_setOption($key, strtolower($val));
-                    }
-                }
-            }
-            if($tmplfile) $this->newTemplate($tmplfile);
-            if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
-            return true;
-        }
-
-        /**
-         * function returns the text from the file, or if we're using cache, the text
-         * from the cache file. MUST RETURN DATA.
-         * @param string tmplfile contains path to template file
-         * @param do_eval used for included files. If set then this function must do the eval()'ing.
-         * @access private
-         * @return mixed data/string or boolean
-         */
-        private function _getData ($tmplfile, $do_eval=false)
-        {
-            //* check the current file depth
-            if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
-                return;
-            } else {
-                if ($this->_debug){
-                    array_push ($this->_debugIncludedfiles, $tmplfile);
-                }
-                if ($do_eval) {
-                    array_push($this->_currentincludedir, dirname($tmplfile));
-                    $this->_includedepth++;
-                }
-            }
+			if (is_array($options)) {
+				foreach($options as $key => $val) {
+					$key = strtoupper($key);
+					if ($key == 'PATH') {
+						$this->setPath($val);
+					} else {
+						$this->_setOption($key, strtolower($val));
+					}
+				}
+			}
+			if($tmplfile) $this->newTemplate($tmplfile);
+			if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
+			return true;
+		}
 
+		/**
+		 * function returns the text from the file, or if we're using cache, the text
+		 * from the cache file. MUST RETURN DATA.
+		 * @param string tmplfile contains path to template file
+		 * @param do_eval used for included files. If set then this function must do the eval()'ing.
+		 * @access private
+		 * @return mixed data/string or boolean
+		 */
+		private function _getData ($tmplfile, $do_eval=false)
+		{
+			//* check the current file depth
+			if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
+				return;
+			} else {
+				if ($this->_debug){
+					array_push($this->_debugIncludedfiles, $tmplfile);
+				}
+				if ($do_eval) {
+					array_push($this->_currentincludedir, dirname($tmplfile));
+					$this->_includedepth++;
+				}
+			}
 
-            if($this->_cache && $this->_checkCache($tmplfile)) { //* cache exists so lets use it
-                $data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
-                fclose($fp);
-            } else { //* no cache lets parse the file
-                $data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
-                fclose($fp);
-
-                $regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
-                $regex.= 'tmpl_([\w]+)\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value|file)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')?';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:>|\/>|}|-->){1}';
-                $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);
-                }
-            }
 
-            //* now we must parse the $data and check for any <tmpl_include>'s
-            if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
+			if($this->_cache && $this->_checkCache($tmplfile)) { //* cache exists so lets use it
+				$data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
+				fclose($fp);
+			} else { //* no cache lets parse the file
+				$data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
+				fclose($fp);
+
+				$regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
+				$regex.= 'tmpl_([\w]+)\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value|file)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')?';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:>|\/>|}|-->){1}';
+				$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);
+				}
+			}
+
+			//* now we must parse the $data and check for any <tmpl_include>'s
+			if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
+
+			if ($do_eval) {
+				$success = @eval('?>'.$data.'<?php return 1;');
+				$this->_includedepth--;
+				array_pop($this->_currentincludedir);
+				return $success;
+			} else {
+				return $data;
+			}
+		}
+
+		/**
+		 * Searches for all possible instances of file { $file }
+		 * @param string $file path of file we're looking for
+		 * @access private
+		 * @return mixed fullpath to file or boolean false
+		 */
+		private function _fileSearch($file)
+		{
 
-            if ($do_eval) {
-                $success = @eval('?>'.$data.'<?php return 1;');
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
-                return $success;
-            } else {
-                return $data;
-            }
-        }
-
-        /**
-         * Searches for all possible instances of file { $file }
-         * @param string $file path of file we're looking for
-         * @access private
-         * @return mixed fullpath to file or boolean false
-         */
-        private function _fileSearch($file) 
-        {
-			
 			$filename = basename($file);
-            $filepath = dirname($file);
-			
+			$filepath = dirname($file);
+
 			if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['theme'])) {
 				if(is_file(ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename)) {
 					return ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename;
 				}
 			}
 
-            //* check fullpath first..
-            $fullpath = $filepath.'/'.$filename;
-            if (is_file($fullpath)) return $fullpath;
-
-            //* ..then check for relative path for current directory..
-            if (!empty($this->_currentincludedir)) {
-                $currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
-                $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                if (is_file($relativepath)) {
-                    array_push ($this->_currentincludedir, dirname($relativepath));
-                    return $relativepath;
-                }
-            }
+			//* check fullpath first..
+			$fullpath = $filepath.'/'.$filename;
+			if (is_file($fullpath)) return $fullpath;
+
+			//* ..then check for relative path for current directory..
+			if (!empty($this->_currentincludedir)) {
+				$currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
+				$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+				if (is_file($relativepath)) {
+					array_push($this->_currentincludedir, dirname($relativepath));
+					return $relativepath;
+				}
+			}
 
-            //* ..then check for relative path for all additional given paths..
-            if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
-                foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
-                    $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                    if (is_file($relativepath)) {
-                        return $relativepath;
-                    }
-                }
-            }
+			//* ..then check for relative path for all additional given paths..
+			if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
+				foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
+					$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+					if (is_file($relativepath)) {
+						return $relativepath;
+					}
+				}
+			}
 
-            //* ..then check path from TEMPLATE_DIR..
-            if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
-                $fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) return $fullpath;
-            }
+			//* ..then check path from TEMPLATE_DIR..
+			if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
+				$fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) return $fullpath;
+			}
 
-            //* ..then check relative path from executing php script..
-            $fullpath = realpath($filepath.'/'.$filename);
-            if (is_file($fullpath)) return $fullpath;
+			//* ..then check relative path from executing php script..
+			$fullpath = realpath($filepath.'/'.$filename);
+			if (is_file($fullpath)) return $fullpath;
 
-            //* ..then check path from template file.
-            if (!empty($this->VLIBTEMPLATE_ROOT)) {
-                $fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) return $fullpath;
-            }
+			//* ..then check path from template file.
+			if (!empty($this->VLIBTEMPLATE_ROOT)) {
+				$fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) return $fullpath;
+			}
 
-            return false; // uh oh, file not found
-        }
-
-        /**
-         * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
-         * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
-         * Used by $this->setloop().
-         * @param array $arr
-         * @return array new look array
-         * @access private
-         */
-        private function _arrayBuild($arr)
-        {
-            if (is_array($arr) && !empty($arr)) {
-                $arr = array_values($arr); // to prevent problems w/ non sequential arrays
-                for ($i = 0; $i < count($arr); $i++) {
-                    if(!is_array($arr[$i]))  return false;
-                    foreach ($arr[$i] as $k => $v) {
-                        unset($arr[$i][$k]);
-                        if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
-                        if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
-
-                        if (is_array($v)) {
-                            if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
-                        } else { // reinsert the var
-                            $arr[$i][$k] = $v;
-                        }
-                    }
-                    if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
-                        if ($i == 0) $arr[$i]['__FIRST__'] = true;
-                        if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
-                        if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
-                        if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
-                        if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
-                        $arr[$i]['__ROWNUM__'] = ($i + 1);
-                    }
-                }
-                return $arr;
-            } elseif (empty($arr)) {
-                return true;
-            }
-        }
-
-        /**
-         * returns a string used for parsing in tmpl_if statements.
-         * @param string $varname
-         * @param string $value
-         * @param string $op
-         * @param string $namespace current namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        private function _parseIf($varname, $value = null, $op = null, $namespace = null)
-        {
-            if (isset($namespace)) $namespace = substr($namespace, 0, -1);
-            $comp_str = ''; // used for extended if statements
-
-            // work out what to put on the end id value="whatever" is used
-            if (isset($value)) {
-
-                // add the correct operator depending on whether it's been specified or not
-                if (!empty($op)) {
-                    if (in_array($op, $this->allowed_if_ops)) {
-                        $comp_str .= $op;
-                    } else {
-                        vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
-                    }
-                } else {
-                    $comp_str .= '==';
-                }
-
-                // now we add the value, if it's numeric, then we leave the quotes off
-                if (is_numeric($value)) {
-                    $comp_str .= $value;
-                } else {
-                    $comp_str .= '\''.$value.'\'';
-                }
-            }
+			return false; // uh oh, file not found
+		}
 
-            if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
-            $retstr = '$this->_arrvars';
-            $numnamespaces = count($this->_namespace);
-            for ($i=0; $i < $numnamespaces; $i++) {
-                if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                    $retstr .= "['".$namespace."'][\$_".$i."]";
-                    break 1;
-                } else {
-                    $retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                }
-            }
-            if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
-            } else {
-                return $retstr."['".$varname."']".$comp_str;
-            }
-        }
-
-
-        /**
-         * returns a string used for parsing in tmpl_loop statements.
-         * @param string $varname
-         * @access private
-         * @return string used for eval'ing
-         */
-        private function _parseLoop ($varname)
-        {
-            array_push($this->_namespace, $varname);
-            $tempvar = count($this->_namespace) - 1;
-            $retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
-            for ($i=0; $i < count($this->_namespace); $i++) {
-                $retstr .= "['".$this->_namespace[$i]."']";
-                if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
-            }
-            return $retstr."); \$_".$tempvar."++) {";
-        }
-
-        /**
-         * returns a string used for parsing in tmpl_var statements.
-         * @param string $wholetag
-         * @param string $tag
-         * @param string $varname
-         * @param string $escape
-         * @param string $format
-         * @param string $namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        private function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace)
-        {
-            if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
-            $wholetag = stripslashes($wholetag);
-
-            if (count($this->_namespace) == 0 || $namespace == 'global') {
-                $var1 = '$this->_vars[\''.$varname.'\']';
-            } else {
-                $var1build = "\$this->_arrvars";
-                $numnamespaces = count($this->_namespace);
-                for ($i=0; $i < $numnamespaces; $i++) {
-                    if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                        $var1build .= "['".$namespace."'][\$_".$i."]";
-                        break 1;
-                    } else {
-                        $var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                    }
-                }
-                $var1 = $var1build . "['$varname']";
-                if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                    $var2 = '$this->_vars[\''.$varname.'\']';
-                }
-            }
+		/**
+		 * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
+		 * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
+		 * Used by $this->setloop().
+		 * @param array $arr
+		 * @return array new look array
+		 * @access private
+		 */
+		private function _arrayBuild($arr)
+		{
+			if (is_array($arr) && !empty($arr)) {
+				$arr = array_values($arr); // to prevent problems w/ non sequential arrays
+				for ($i = 0; $i < count($arr); $i++) {
+					if(!is_array($arr[$i]))  return false;
+					foreach ($arr[$i] as $k => $v) {
+						unset($arr[$i][$k]);
+						if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
+						if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
+
+						if (is_array($v)) {
+							if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
+						} else { // reinsert the var
+							$arr[$i][$k] = $v;
+						}
+					}
+					if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
+						if ($i == 0) $arr[$i]['__FIRST__'] = true;
+						if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
+						if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
+						if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
+						if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
+						$arr[$i]['__ROWNUM__'] = ($i + 1);
+					}
+				}
+				return $arr;
+			} elseif (empty($arr)) {
+				return true;
+			}
+		}
 
-            $beforevar = '';
-            $aftervar  = '';
-            if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
-                $beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
-                $aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
-            }
+		/**
+		 * returns a string used for parsing in tmpl_if statements.
+		 * @param string $varname
+		 * @param string $value
+		 * @param string $op
+		 * @param string $namespace current namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		private function _parseIf($varname, $value = null, $op = null, $namespace = null)
+		{
+			if (isset($namespace)) $namespace = substr($namespace, 0, -1);
+			$comp_str = ''; // used for extended if statements
+
+			// work out what to put on the end id value="whatever" is used
+			if (isset($value)) {
+
+				// add the correct operator depending on whether it's been specified or not
+				if (!empty($op)) {
+					if (in_array($op, $this->allowed_if_ops)) {
+						$comp_str .= $op;
+					} else {
+						vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
+					}
+				} else {
+					$comp_str .= '==';
+				}
 
-            if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
-                $beforevar .= $this->FORMAT_TAGS[$format]['open'];
-                $aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
-            }
+				// now we add the value, if it's numeric, then we leave the quotes off
+				if (is_numeric($value)) {
+					$comp_str .= $value;
+				} else {
+					$comp_str .= '\''.$value.'\'';
+				}
+			}
 
-            //* build return values
-            $retstr  = 'if ('.$var1.' !== null) { ';
-            $retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
-            $retstr .= '}';
+			if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
+			$retstr = '$this->_arrvars';
+			$numnamespaces = count($this->_namespace);
+			for ($i=0; $i < $numnamespaces; $i++) {
+				if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+					$retstr .= "['".$namespace."'][\$_".$i."]";
+					break 1;
+				} else {
+					$retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+				}
+			}
+			if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+				return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
+			} else {
+				return $retstr."['".$varname."']".$comp_str;
+			}
+		}
 
-            if (@$var2) {
-                $retstr .= ' elseif ('.$var2.' !== null) { ';
-                $retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
-                $retstr .= '}';
-            }
 
-            switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
-                case 'comment':
-                    $comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
-                    $retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+		/**
+		 * returns a string used for parsing in tmpl_loop statements.
+		 * @param string $varname
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		private function _parseLoop ($varname)
+		{
+			array_push($this->_namespace, $varname);
+			$tempvar = count($this->_namespace) - 1;
+			$retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
+			for ($i=0; $i < count($this->_namespace); $i++) {
+				$retstr .= "['".$this->_namespace[$i]."']";
+				if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
+			}
+			return $retstr."); \$_".$tempvar."++) {";
+		}
 
-                case 'leave':
-                    $retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+		/**
+		 * returns a string used for parsing in tmpl_var statements.
+		 * @param string $wholetag
+		 * @param string $tag
+		 * @param string $varname
+		 * @param string $escape
+		 * @param string $format
+		 * @param string $namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		private function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace)
+		{
+			if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
+			$wholetag = stripslashes($wholetag);
+
+			if (count($this->_namespace) == 0 || $namespace == 'global') {
+				$var1 = '$this->_vars[\''.$varname.'\']';
+			} else {
+				$var1build = "\$this->_arrvars";
+				$numnamespaces = count($this->_namespace);
+				for ($i=0; $i < $numnamespaces; $i++) {
+					if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+						$var1build .= "['".$namespace."'][\$_".$i."]";
+						break 1;
+					} else {
+						$var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+					}
+				}
+				$var1 = $var1build . "['$varname']";
+				if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+					$var2 = '$this->_vars[\''.$varname.'\']';
+				}
+			}
 
-                case 'print':
-                    $retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+			$beforevar = '';
+			$aftervar  = '';
+			if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
+				$beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
+				$aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
+			}
 
-                case 'ignore':
-                    return $retstr;
+			if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
+				$beforevar .= $this->FORMAT_TAGS[$format]['open'];
+				$aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
+			}
 
-                case 'remove':
-                default:
-                    $retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
+			//* build return values
+			$retstr  = 'if ('.$var1.' !== null) { ';
+			$retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
+			$retstr .= '}';
 
-            }
-        }
-
-        /**
-         * takes values from preg_replace in $this->_intparse() and determines
-         * the replace string.
-         *
-         * @param array $args array of all matches found by preg_replace
-         * @access private
-         * @return string replace values
-         */
-        private function _parseTag ($args)
-        {
-            $wholetag = $args[0];
-            $openclose = $args[1];
-            $tag = strtolower($args[2]);
-            $newline = $args[9];
-
-            if ($tag == 'else') return '<?php } else { ?>'.$newline;
-            if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
-
-            if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
-                if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
-                if ($tag == 'comment' || $tag == 'endcomment') {
-                    return '<?php */ ?>'.$newline;
-                } else {
-                    return '<?php } ?>'.$newline;
-                }
-            }
+			if (@$var2) {
+				$retstr .= ' elseif ('.$var2.' !== null) { ';
+				$retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
+				$retstr .= '}';
+			}
 
-            //* arrange attributes
-            for ($i=3; $i < 8; $i=($i+2)) {
-                if (empty($args[$i]) && empty($args[($i+1)])) break;
-                $key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
-                if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
-                $$key = $args[($i+1)];
-            }
+			switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
+			case 'comment':
+				$comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
+				$retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-            $var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
+			case 'leave':
+				$retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-            if ($this->_debug && !empty($var)) {
-                if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
-                if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
-                if (!isset($var2)) $var2 = $var;
-                if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
-            }
+			case 'print':
+				$retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-            if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
-                $var = $matches[3];
-                $namespace = $matches[1];
-            }
+			case 'ignore':
+				return $retstr;
 
+			case 'remove':
+			default:
+				$retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
 
-            //* return correct string (tag dependent)
-            switch ($tag) {
-                case 'var':
-                    if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
-                        $escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
-                    }
-                    return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace)." ?>$newline";
+			}
+		}
+
+		/**
+		 * takes values from preg_replace in $this->_intparse() and determines
+		 * the replace string.
+		 *
+		 * @param array $args array of all matches found by preg_replace
+		 * @access private
+		 * @return string replace values
+		 */
+		private function _parseTag ($args)
+		{
+			$wholetag = $args[0];
+			$openclose = $args[1];
+			$tag = strtolower($args[2]);
+			$newline = $args[9];
+
+			if ($tag == 'else') return '<?php } else { ?>'.$newline;
+			if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
+
+			if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
+				if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
+				if ($tag == 'comment' || $tag == 'endcomment') {
+					return '<?php */ ?>'.$newline;
+				} else {
+					return '<?php } ?>'.$newline;
+				}
+			}
 
-                case 'if':
-                    return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+			//* arrange attributes
+			for ($i=3; $i < 8; $i=($i+2)) {
+				if (empty($args[$i]) && empty($args[($i+1)])) break;
+				$key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
+				if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
+				$$key = $args[($i+1)];
+			}
 
-                case 'unless':
-                      return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+			$var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
 
-                case 'elseif':
-                      return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+			if ($this->_debug && !empty($var)) {
+				if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
+				if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
+				if (!isset($var2)) $var2 = $var;
+				if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
+			}
 
-                case 'loop':
-                      return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
+			if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
+				$var = $matches[3];
+				$namespace = $matches[1];
+			}
 
-                case 'comment':
-                    if (empty($var)) { // full open/close style comment
-                        return '<?php /* ?>'.$newline;
-                    } else { // just ignore tag if it was a one line comment
-                        return;
-                    }
 
-                case 'phpinclude':
-                	if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
-                    	return '<?php include(\''.$file.'\'); ?>'.$newline;
-                    }
+			//* return correct string (tag dependent)
+			switch ($tag) {
+			case 'var':
+				if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
+					$escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
+				}
+				return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace)." ?>$newline";
 
-                case 'include':
-                    return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
-                
-                case 'dyninclude':
-                    return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
+			case 'if':
+				return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
 
-                default:
-                    if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
-                break;
-            }
+			case 'unless':
+				return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+
+			case 'elseif':
+				return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+
+			case 'loop':
+				return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
+
+			case 'comment':
+				if (empty($var)) { // full open/close style comment
+					return '<?php /* ?>'.$newline;
+				} else { // just ignore tag if it was a one line comment
+					return;
+				}
+
+			case 'phpinclude':
+				if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
+					return '<?php include(\''.$file.'\'); ?>'.$newline;
+				}
+
+			case 'include':
+				return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
+
+			case 'dyninclude':
+				return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
+
+			default:
+				if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
+				break;
+			}
+
+		}
+
+		/**
+		 * Parses $this->_tmplfile into correct format for eval() to work
+		 * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
+		 * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
+		 * Sets final parsed file to $this->_tmplfilep.
+		 *
+		 * @access private
+		 * @return boolean true/false
+		 */
+		private function _intParse ()
+		{
+			//$mqrt = get_magic_quotes_runtime();
+			//set_magic_quotes_runtime(0);
+			$this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
+			//set_magic_quotes_runtime($mqrt);
+			return true;
+		}
+
+		/**
+		 * Calls _intParse, and eval()s $this->tmplfilep
+		 * and outputs the results to $this->tmploutput
+		 *
+		 * @param bool compress whether to compress contents
+		 * @access private
+		 * @return boolean true/false
+		 */
+		private function _parse ($compress = '')
+		{
+			if (!$this->_parsed) {
+				if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
+
+				$this->_intParse();
+				$this->_parsed = true;
+
+				if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
+				if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
+			}
 
-        }
-
-        /**
-         * Parses $this->_tmplfile into correct format for eval() to work
-         * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
-         * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
-         * Sets final parsed file to $this->_tmplfilep.
-         *
-         * @access private
-         * @return boolean true/false
-         */
-        private function _intParse ()
-        {
-            //$mqrt = get_magic_quotes_runtime();
-            //set_magic_quotes_runtime(0);
-            $this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
-            //set_magic_quotes_runtime($mqrt);
-            return true;
-        }
-
-        /**
-         * Calls _intParse, and eval()s $this->tmplfilep
-         * and outputs the results to $this->tmploutput
-         *
-         * @param bool compress whether to compress contents
-         * @access private
-         * @return boolean true/false
-         */
-        private function _parse ($compress = '')
-        {
-            if (!$this->_parsed) {
-                if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
-
-                $this->_intParse();
-                $this->_parsed = true;
-
-                if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
-                if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
-            }
-			
 			// ob_start($compress);
-            ob_start();
-
-                array_push($this->_currentincludedir, dirname($this->_tmplfilename));
-                $this->_includedepth++;
-                $success = @eval($this->_tmplfilep);
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
-
-                if ($this->_debug) $this->doDebug();
-                if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
-                $this->_tmploutput .= ob_get_contents();
-            ob_end_clean();
-            return true;
-        }
-
-        /**
-         * Sets one or more of the boolean options 1/0, that control certain actions in the template.
-         * Use of this function:
-         * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
-         * or      vlibTemplate::_setOptions(array);
-         *          with an associative array where the key is the option_name
-         *          and the value is the option_value.
-         *
-         * @param mixed (mulitple)
-         * @return bool true/false
-         * @access private
-         */
-        private function _setOption() 
-        {
-            $numargs = func_num_args();
-            if ($numargs < 1) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
+			ob_start();
+
+			array_push($this->_currentincludedir, dirname($this->_tmplfilename));
+			$this->_includedepth++;
+			$success = @eval($this->_tmplfilep);
+			$this->_includedepth--;
+			array_pop($this->_currentincludedir);
+
+			if ($this->_debug) $this->doDebug();
+			if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
+			$this->_tmploutput .= ob_get_contents();
+			ob_end_clean();
+			return true;
+		}
 
-            if ($numargs == 1) {
-                $options = func_get_arg(1);
-                if (is_array($options)) {
-                    foreach ($options as $k => $v) {
-                        if ($v != null) {
-                            if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                        } else {
-                            continue;
-                        }
-                    }
-                } else {
-                    vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                    return false;
-                }
-            }elseif (is_int($numargs / 2)) {
-                for ($i = 0; $i < $numargs; $i=($i+2)) {
-                    $k  = func_get_arg($i);
-                    $v = func_get_arg(($i+1));
-                    if ($v != null) {
-                        if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                    }
-                }
-            } else {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
-            return true;
-        }
-
-        /**
-         * Used during parsing, this function sets an unknown var checking to see if it
-         * has been previously set.
-         * @param string var
-         * @access private
-         */
-        private function _setUnknown($var) 
-        {
-            if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
-        }
-
-        /**
-         * Returns microtime as a float number
-         * @return float microtime
-         * @access private
-         */
-        private function _getMicrotime() 
-        {
-            list($msec, $sec) = explode(' ',microtime());
-            return ((float)$msec + (float)$sec);
-        }
-
-        /**
-         * Returns str encoded to hex code.
-         * @param string str to be encoded
-         * @param bool true/false specify whether to use hex_entity
-         * @return string encoded in hex
-         * @access private
-         */
-        private  function _escape_hex($str = '', $entity = false) {
-            $prestr = $entity ? '&#x' : '%';
-            $poststr= $entity ? ';' : '';
-            for ($i=0; $i < strlen($str); $i++) {
-                $return .= $prestr.bin2hex($str[$i]).$poststr;
-            }
-            return $return;
-        }
+		/**
+		 * Sets one or more of the boolean options 1/0, that control certain actions in the template.
+		 * Use of this function:
+		 * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
+		 * or      vlibTemplate::_setOptions(array);
+		 *          with an associative array where the key is the option_name
+		 *          and the value is the option_value.
+		 *
+		 * @param mixed (mulitple)
+		 * @return bool true/false
+		 * @access private
+		 */
+		private function _setOption()
+		{
+			$numargs = func_num_args();
+			if ($numargs < 1) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
+
+			if ($numargs == 1) {
+				$options = func_get_arg(1);
+				if (is_array($options)) {
+					foreach ($options as $k => $v) {
+						if ($v != null) {
+							if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+						} else {
+							continue;
+						}
+					}
+				} else {
+					vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+					return false;
+				}
+			}elseif (is_int($numargs / 2)) {
+				for ($i = 0; $i < $numargs; $i=($i+2)) {
+					$k  = func_get_arg($i);
+					$v = func_get_arg(($i+1));
+					if ($v != null) {
+						if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+					}
+				}
+			} else {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
+			return true;
+		}
+
+		/**
+		 * Used during parsing, this function sets an unknown var checking to see if it
+		 * has been previously set.
+		 * @param string var
+		 * @access private
+		 */
+		private function _setUnknown($var)
+		{
+			if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
+		}
+
+		/**
+		 * Returns microtime as a float number
+		 * @return float microtime
+		 * @access private
+		 */
+		private function _getMicrotime()
+		{
+			list($msec, $sec) = explode(' ', microtime());
+			return (float)$msec + (float)$sec;
+		}
+
+		/**
+		 * Returns str encoded to hex code.
+		 * @param string str to be encoded
+		 * @param bool true/false specify whether to use hex_entity
+		 * @return string encoded in hex
+		 * @access private
+		 */
+		private  function _escape_hex($str = '', $entity = false) {
+			$prestr = $entity ? '&#x' : '%';
+			$poststr= $entity ? ';' : '';
+			for ($i=0; $i < strlen($str); $i++) {
+				$return .= $prestr.bin2hex($str[$i]).$poststr;
+			}
+			return $return;
+		}
 
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+		/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     The following functions have no use and are included just so that if the user
     is making use of vlibTemplateCache functions, this doesn't crash when changed to
     vlibTemplate if the user is quickly bypassing the vlibTemplateCache class.
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-        function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
-        function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
-        function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
-        function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
-    } // << end class Def
+		function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
+
+		function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
+
+		function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
+
+		function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
+
+	} // << end class Def
 
-    //include_once (ISPC_CLASS_PATH.'/vlibTemplate/debug.php');
-    include_once (ISPC_CLASS_PATH.'/tpl_cache.inc.php');
+	//include_once (ISPC_CLASS_PATH.'/vlibTemplate/debug.php');
+	include_once ISPC_CLASS_PATH.'/tpl_cache.inc.php';
 
 } // << end if(!defined())..
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tpl_cache.inc.php b/interface/lib/classes/tpl_cache.inc.php
index a3999466a703e1fec5f27930debeb0b3a6a386a2..4bf75faa8c8cda9ccb92a3b8749cf0926fce8f47 100644
--- a/interface/lib/classes/tpl_cache.inc.php
+++ b/interface/lib/classes/tpl_cache.inc.php
@@ -20,167 +20,174 @@
  * @access public
  */
 
+
 class tplc extends tpl {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS, IT MAY NOT WORK OTHERWISE           |
 \-----------------------------------------------------------------------------*/
 
-    var $_cache = 1;     // tells vlibTemplate that we're caching
-    var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
-    var $_cacheexists;   // has this file been cached before
-    var $_cachefilelocked; // is this file currently locked whilst writing
-    var $_cachefiledir;  // dir of current cache file
-    var $_clearcache = 0;
-
-
-    /**
-     * FUNCTION: clearCache
-     * will unset a file, and set $this->_cacheexists to 0.
-     *
-     * @access public
-     * @return boolean
-     */
-    function clearCache() {
-        $this->_clearcache = 1;
-        return true;
-    }
-
-    /**
-     * FUNCTION: recache
-     * alias for clearCache().
-     *
-     * @access public
-     * @return boolean
-     */
-    function recache() {
-        return $this->clearCache();
-    }
-
-    /**
-     * FUNCTION: setCacheLifeTime
-     * sets the lifetime of the cached file
-     *
-     * @param int $int number of seconds to set lifetime to
-     * @access public
-     * @return boolean
-     */
-    function setCacheLifeTime($int = null) {
-        if ($int == null || !is_int($int)) return false;
-        if ($int == 0) $int = 60;
-        if ($int == -1) $int = 157680000; // set to 5 yrs time
-        $this->OPTIONS['CACHE_LIFETIME'] = $int;
-        return true;
-    }
-
-    /**
-     * FUNCTION: setCacheExtension
-     * sets the extention of the cache file
-     *
-     * @param str $str name of new cache extention
-     * @access public
-     * @return boolean
-     */
-    function setCacheExtension($str = null) {
-        if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
-        $this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
-        return true;
-    }
-
-
-/*----------------------------------------\
+	var $_cache = 1;     // tells vlibTemplate that we're caching
+	var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
+	var $_cacheexists;   // has this file been cached before
+	var $_cachefilelocked; // is this file currently locked whilst writing
+	var $_cachefiledir;  // dir of current cache file
+	var $_clearcache = 0;
+
+
+	/**
+	 * FUNCTION: clearCache
+	 * will unset a file, and set $this->_cacheexists to 0.
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function clearCache() {
+		$this->_clearcache = 1;
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: recache
+	 * alias for clearCache().
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function recache() {
+		return $this->clearCache();
+	}
+
+
+	/**
+	 * FUNCTION: setCacheLifeTime
+	 * sets the lifetime of the cached file
+	 *
+	 * @param int $int number of seconds to set lifetime to
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheLifeTime($int = null) {
+		if ($int == null || !is_int($int)) return false;
+		if ($int == 0) $int = 60;
+		if ($int == -1) $int = 157680000; // set to 5 yrs time
+		$this->OPTIONS['CACHE_LIFETIME'] = $int;
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: setCacheExtension
+	 * sets the extention of the cache file
+	 *
+	 * @param str $str name of new cache extention
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheExtension($str = null) {
+		if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
+		$this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
+		return true;
+	}
+
+
+	/*----------------------------------------\
           Private Functions
 -----------------------------------------*/
 
-    /**
-     * FUNCTION: _checkCache
-     * checks if there's a cache, if there is then it will read the cache file as the template.
-     */
-    function _checkCache ($tmplfile) {
-        $this->_cachefile = $this->_getFilename($tmplfile);
-        if ($this->_clearcache) {
-            if (file_exists($this->_cachefile)) unlink($this->_cachefile);
-            return false;
-        }
-
-        if (file_exists($this->_cachefile)) {
-            $this->_cacheexists = 1;
-
-            // if it's expired
-            if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date ('U')
-                  || filectime($this->_cachefile) < filemtime($tmplfile)) {
-                $this->_cacheexists = 0;
-                return false; // so that we know to recache
-            }
-            else {
-                return true;
-            }
-
-        } else {
-            $this->_cacheexists = 0;
-            return false;
-        }
-    }
-
-
-    /**
-     * FUNCTION: _getFilename
-     * gets the full pathname for the cached file
-     *
-     */
-    function _getFilename($tmplfile) {
-        return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
-    }
-
-    /**
-     * FUNCTION: _createCache
-     * creates the cached file
-     *
-     */
-    function _createCache($data) {
-        $cache_file = $this->_cachefile;
-        if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
-
-        $f = fopen ($cache_file, "w");
-        flock($f, 2); // set an EXclusive lock
-        if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE',KILL,$cache_file);
-        fputs ($f, $data); // write the parsed string from vlibTemplate
-        flock($f, 3); // UNlock file
-        fclose ($f);
-        touch ($cache_file);
-        return true;
-    }
-
-    /**
-     * FUNCTION: _prepareDirs
-     * prepares the directory structure
-     *
-     */
-    function _prepareDirs($file) {
-        if (empty($file)) die('no filename'); //do error in future
-        $filepath = dirname($file);
-        if (is_dir($filepath)) return true;
-
-        $dirs = preg_split('/[\\/]/', $filepath);
-        $currpath;
-        foreach ($dirs as $dir) {
-            $currpath .= $dir .'/';
-            $type = @filetype($currpath);
-
-            ($type=='link') and $type = 'dir';
-            if ($type != 'dir' && $type != false && !empty($type)) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE',KILL,'directory: '.$currpath.', type: '.$type);
-            }
-            if ($type == 'dir') {
-                continue;
-            }
-            else {
-                $s = @mkdir($currpath, 0775);
-                if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE',KILL,'directory: '.$currpath);
-            }
-        }
-        return true;
-    }
+
+	/**
+	 * FUNCTION: _checkCache
+	 * checks if there's a cache, if there is then it will read the cache file as the template.
+	 */
+	function _checkCache ($tmplfile) {
+		$this->_cachefile = $this->_getFilename($tmplfile);
+		if ($this->_clearcache) {
+			if (file_exists($this->_cachefile)) unlink($this->_cachefile);
+			return false;
+		}
+
+		if (file_exists($this->_cachefile)) {
+			$this->_cacheexists = 1;
+
+			// if it's expired
+			if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date('U')
+				|| filectime($this->_cachefile) < filemtime($tmplfile)) {
+				$this->_cacheexists = 0;
+				return false; // so that we know to recache
+			}
+			else {
+				return true;
+			}
+
+		} else {
+			$this->_cacheexists = 0;
+			return false;
+		}
+	}
+
+
+	/**
+	 * FUNCTION: _getFilename
+	 * gets the full pathname for the cached file
+	 *
+	 */
+	function _getFilename($tmplfile) {
+		return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
+	}
+
+
+	/**
+	 * FUNCTION: _createCache
+	 * creates the cached file
+	 *
+	 */
+	function _createCache($data) {
+		$cache_file = $this->_cachefile;
+		if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
+
+		$f = fopen($cache_file, "w");
+		flock($f, 2); // set an EXclusive lock
+		if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE', KILL, $cache_file);
+		fputs($f, $data); // write the parsed string from vlibTemplate
+		flock($f, 3); // UNlock file
+		fclose($f);
+		touch($cache_file);
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: _prepareDirs
+	 * prepares the directory structure
+	 *
+	 */
+	function _prepareDirs($file) {
+		if (empty($file)) die('no filename'); //do error in future
+		$filepath = dirname($file);
+		if (is_dir($filepath)) return true;
+
+		$dirs = preg_split('/[\\/]/', $filepath);
+		$currpath;
+		foreach ($dirs as $dir) {
+			$currpath .= $dir .'/';
+			$type = @filetype($currpath);
+
+			($type=='link') and $type = 'dir';
+			if ($type != 'dir' && $type != false && !empty($type)) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE', KILL, 'directory: '.$currpath.', type: '.$type);
+			}
+			if ($type == 'dir') {
+				continue;
+			}
+			else {
+				$s = @mkdir($currpath, 0775);
+				if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE', KILL, 'directory: '.$currpath);
+			}
+		}
+		return true;
+	}
 
 } // -- end vlibTemplateCache class
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tpl_error.inc.php b/interface/lib/classes/tpl_error.inc.php
index a4095d8188fb038fbbba17b17cff40982ead8eac..b4433cdf435540eea5349b206480d71f357d9e88 100644
--- a/interface/lib/classes/tpl_error.inc.php
+++ b/interface/lib/classes/tpl_error.inc.php
@@ -25,68 +25,71 @@ define('KILL',    -1); // used for killing inside parsing.
  * @access private
  */
 
+
 class vlibTemplateError {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS IT MAY NOT WORK OTHERWISE            |
 \-----------------------------------------------------------------------------*/
 
-    public static function raiseError ($code, $level = null, $extra=null) {
-        if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
+	public static function raiseError ($code, $level = null, $extra=null) {
+		if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
+
+		$error_codes = array(
+			'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
+			'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br />To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
+			'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
+			'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
+			'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
+			'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
+			'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
+			'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
+			'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
+			'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
+			'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
+			'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
+			'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
+			'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
+			'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
+			'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
+		);
 
-        $error_codes = array(
-                        'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
-                        'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br />To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
-                        'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
-                        'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
-                        'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
-                        'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
-                        'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
-                        'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
-                        'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
-                        'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
-                        'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
-                        'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
-                        'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
-                        'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
-                        'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
-                            );
+		$error_levels = array(
+			'VT_ERROR_NOFILE'               => FATAL,
+			'VT_ERROR_PARSE'                => FATAL,
+			'VT_NOTICE_INVALID_TAG'         => NOTICE,
+			'VT_ERROR_INVALID_TAG'          => FATAL,
+			'VT_NOTICE_INVALID_ATT'         => NOTICE,
+			'VT_WARNING_INVALID_ARR'        => WARNING,
+			'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
+			'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
+			'VT_ERROR_UNKNOWN_VAR'          => WARNING,
+			'VT_ERROR_NO_CACHE_WRITE'       => KILL,
+			'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
+			'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
+			'VT_WARNING_LOOP_NOT_SET'       => WARNING,
+			'VT_WARNING_INVALID_RESOURCE'   => WARNING,
+			'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
+			'VT_WARNING_INVALID_IF_OP'      => WARNING
+		);
 
-        $error_levels = array(
-                        'VT_ERROR_NOFILE'               => FATAL,
-                        'VT_ERROR_PARSE'                => FATAL,
-                        'VT_NOTICE_INVALID_TAG'         => NOTICE,
-                        'VT_ERROR_INVALID_TAG'          => FATAL,
-                        'VT_NOTICE_INVALID_ATT'         => NOTICE,
-                        'VT_WARNING_INVALID_ARR'        => WARNING,
-                        'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
-                        'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
-                        'VT_ERROR_UNKNOWN_VAR'          => WARNING,
-                        'VT_ERROR_NO_CACHE_WRITE'       => KILL,
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
-                        'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
-                        'VT_WARNING_LOOP_NOT_SET'       => WARNING,
-                        'VT_WARNING_INVALID_RESOURCE'   => WARNING,
-                        'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
-                        'VT_WARNING_INVALID_IF_OP'      => WARNING
-                            );
+		($level === null) and $level = $error_levels[$code];
+		if ($level == KILL) {
+			die ($error_codes[$code]);
+		}
 
-        ($level === null) and $level = $error_levels[$code];
-        if ($level == KILL) {
-            die ($error_codes[$code]);
-        }
+		if ($msg = $error_codes[$code]) {
+			trigger_error($msg, $level);
+		} else {
+			$level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
+			$msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
+			trigger_error($msg, $level);
+		}
+		return;
+	}
 
-        if ($msg = $error_codes[$code]) {
-            trigger_error($msg, $level);
-        } else {
-            $level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
-            $msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
-            trigger_error($msg, $level);
-        }
-        return;
-    }
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/interface/lib/classes/tpl_ini.inc.php b/interface/lib/classes/tpl_ini.inc.php
index 838814821ce283573de9187b98456ba328428124..e7452540066247ceadf5e5f17057663a0eb60d1c 100644
--- a/interface/lib/classes/tpl_ini.inc.php
+++ b/interface/lib/classes/tpl_ini.inc.php
@@ -1,14 +1,15 @@
 <?php
-    /**
-     * vlibIni is a class used to store configuration parameters
-     * for the vLIB library.
-     *
-     * @since 21/07/2002
-     * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-     * @copyright 2002 Active Fish Group 
-     * @package vLIB
-     * @access private
-     */
+/**
+ * vlibIni is a class used to store configuration parameters
+ * for the vLIB library.
+ *
+ * @since 21/07/2002
+ * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+ * @copyright 2002 Active Fish Group
+ * @package vLIB
+ * @access private
+ */
+
 
 /* vim: set expandtab tabstop=4 shiftwidth=4: */
 // +----------------------------------------------------------------------+
@@ -39,80 +40,80 @@
 */
 
 if (!defined('vlibIniClassLoaded')) {
-    define('vlibIniClassLoaded', 1);
+	define('vlibIniClassLoaded', 1);
 
 
 
-    class vlibIni{
+	class vlibIni{
 
-        /** Returns $array of config vars for vlibTemplate */
-        public static function vlibTemplate()
-        {
+		/** Returns $array of config vars for vlibTemplate */
+		public static function vlibTemplate()
+		{
 
 			$tpl_dir = ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates';
 			$def_tpl_dir = ISPC_THEMES_PATH.'/default/templates';
-            return array(
+			return array(
 
-                        'INCLUDE_PATHS' => array($tpl_dir),   // The path, searched BEVORE the template_dir is searched for the template-file
+				'INCLUDE_PATHS' => array($tpl_dir),   // The path, searched BEVORE the template_dir is searched for the template-file
 
-                        'TEMPLATE_DIR' => $def_tpl_dir,			   // Default directory for your template files (full path)
-                                                                   // leave the '/' or '\' off the end of the directory.
+				'TEMPLATE_DIR' => $def_tpl_dir,      // Default directory for your template files (full path)
+				// leave the '/' or '\' off the end of the directory.
 
-                        'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
+				'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
 
-                        'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
-                                                                   // loop will search for a global var as well
+				'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
+				// loop will search for a global var as well
 
-                        'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
-                                                                   // reflecting the environment.
+				'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
+				// reflecting the environment.
 
-                        'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
-                                                                   // on each row of the loop.
+				'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
+				// on each row of the loop.
 
-                        'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
+				'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
 
-                        'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
+				'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
 
-                        'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
-                                                                   // style tags i.e. tmpl_vae
+				'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
+				// style tags i.e. tmpl_vae
 
-                        'CASELESS' => 0,                           // Removes case sensitivity on all variables
+				'CASELESS' => 0,                           // Removes case sensitivity on all variables
 
-                        'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
-                                                                   // 1 of the following: ignore, remove, leave,print, comment
-                                                                   // 1 of the following: ignore, remove, leave, print, comment
+				'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
+				// 1 of the following: ignore, remove, leave,print, comment
+				// 1 of the following: ignore, remove, leave, print, comment
 
-                        'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
-                                                                   // your template. You then use the function: getParseTime().
+				'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
+				// your template. You then use the function: getParseTime().
 
-                        'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
+				'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
 
 
-                        /* the following are only used by the vlibTemplateCache class. */
-                        // pedro notes:: triggers a notice as its not set - was $conf['template']['cache_dir'],
-                        'CACHE_DIRECTORY' => ISPC_CACHE_PATH,
-                                                                   // Directory where the cached filesystem
-                                                                   // will be set up (full path, and must be writable)
-                                                                   // '/' or '\' off the end of the directory.
+				/* the following are only used by the vlibTemplateCache class. */
+				// pedro notes:: triggers a notice as its not set - was $conf['template']['cache_dir'],
+				'CACHE_DIRECTORY' => ISPC_CACHE_PATH,
+				// Directory where the cached filesystem
+				// will be set up (full path, and must be writable)
+				// '/' or '\' off the end of the directory.
 
-                        'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
+				'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
 
-                        'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
-                                                                   // index.vtc (vlibTemplate Compiled)
-                    );
+				'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
+				// index.vtc (vlibTemplate Compiled)
+			);
 
-        } // << end function vlibTemplate
+		} // << end function vlibTemplate
 
 
 
-        /** Returns $array of config vars for vlibDate */
-        public function vlibDate()
-        {
-            return array( 'DEFAULT_LANG' => 'de' ); //* default language for the date displays
-        }
+		/** Returns $array of config vars for vlibDate */
+		public function vlibDate()
+		{
+			return array( 'DEFAULT_LANG' => 'de' ); //* default language for the date displays
+		}
 
 
-    }// << end class vlibIni
+	}// << end class vlibIni
 
 } // << if Defined
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/tree.inc.php b/interface/lib/classes/tree.inc.php
index dcc2d61fd2a9f303540ddde67f4edcdeab594023..8d29a671104ac92cf4f06416f50bcfaccf0d3ad1 100644
--- a/interface/lib/classes/tree.inc.php
+++ b/interface/lib/classes/tree.inc.php
@@ -38,218 +38,218 @@ class node {
 class tree
 {
 
-    var $obj;
-    var $events;
-    
-    // Feld Definitionen
-	var $data_field		= 'name';
-	var $primary_field	= 'media_cat_id';
-	var $parent_field 	= 'parent';
-	var $root_id 		= '0';
-	var $opt_spacer 	= '&nbsp;';
-	
+	var $obj;
+	var $events;
+
+	// Feld Definitionen
+	var $data_field  = 'name';
+	var $primary_field = 'media_cat_id';
+	var $parent_field  = 'parent';
+	var $root_id   = '0';
+	var $opt_spacer  = '&nbsp;';
+
 	// interne Vars
 	var $_last_id;
-	
+
 	/*
 		Funktion zum laden des Baumes aus Array
 	*/
-    
-    function loadFromArray ($nodes) {
-    	
-    	$this->obj[$this->root_id] = new node();
+
+	function loadFromArray ($nodes) {
+
+		$this->obj[$this->root_id] = new node();
 		if(is_array($nodes)) {
-        	foreach($nodes as $row) {
-
-            	$id = $row[$this->primary_field];
-            	$data = $row[$this->data_field];
-            	$ordner = $row[$this->parent_field];
-            
-            	//$this->raw_data[$id] = $row;
-            
-            	if($id > $this->_last_id) $this->_last_id = $id;
-            
-            	if(!is_object($this->obj[$id])) $this->obj[$id] = new node();
-            
-            	$this->obj[$id]->data = $data;
-            	$this->obj[$id]->id = $row[$this->primary_field];
-            	$this->obj[$id]->parent = $row[$this->parent_field];
-
-            	if(is_object($this->obj[$ordner])) {
-                 	$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
-           		} else {
-                	$this->obj[$ordner] = new node();
-                	$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
-            	}
-        	}
+			foreach($nodes as $row) {
+
+				$id = $row[$this->primary_field];
+				$data = $row[$this->data_field];
+				$ordner = $row[$this->parent_field];
+
+				//$this->raw_data[$id] = $row;
+
+				if($id > $this->_last_id) $this->_last_id = $id;
+
+				if(!is_object($this->obj[$id])) $this->obj[$id] = new node();
+
+				$this->obj[$id]->data = $data;
+				$this->obj[$id]->id = $row[$this->primary_field];
+				$this->obj[$id]->parent = $row[$this->parent_field];
+
+				if(is_object($this->obj[$ordner])) {
+					$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
+				} else {
+					$this->obj[$ordner] = new node();
+					$this->obj[$ordner]->childs[$id] = &$this->obj[$id];
+				}
+			}
 		}
-    }
-    
-    function optionlist($nroot = '')
-    {
-        
-        if($nroot == '') $nroot = $this->obj[$this->root_id];
+	}
+
+	function optionlist($nroot = '')
+	{
+
+		if($nroot == '') $nroot = $this->obj[$this->root_id];
 		$opt_spacer = $this->opt_spacer;
-		
-        $this->ptree($nroot,'',$optionlist, $opt_spacer); 
-        
-        if(is_array($optionlist)){
+
+		$this->ptree($nroot, '', $optionlist, $opt_spacer);
+
+		if(is_array($optionlist)){
 			return $optionlist;
 		} else {
 			return false;
 		}
-    }
-	
+	}
+
 	function ptree($myobj, $ebene, &$optionlist, $opt_spacer){
-			$ebene .= $opt_spacer;
-
-            if(is_array($myobj->childs)) {
-                foreach($myobj->childs as $val) {
-                	$id = $val->id;
-                    if(!empty($id)) $optionlist[$id] = array( 	data => $ebene . $val->data,
-                                   								id => $id);
-                    $this->ptree($val,$ebene, $optionlist, $opt_spacer);
-                }
-            }
+		$ebene .= $opt_spacer;
+
+		if(is_array($myobj->childs)) {
+			foreach($myobj->childs as $val) {
+				$id = $val->id;
+				if(!empty($id)) $optionlist[$id] = array(  data => $ebene . $val->data,
+						id => $id);
+				$this->ptree($val, $ebene, $optionlist, $opt_spacer);
+			}
 		}
-    
-    function add($parent,$data) {
-    	
-    	$id = $this->_last_id + 1;
-    	$this->obj[$id] = new node;
-    	$this->obj[$id]->data = $data;
-    	$this->obj[$id]->id = $id;
-    	$this->obj[$id]->parent = $parent;
-    	$this->obj[$parent]->childs[$id] = &$this->obj[$id];
-    	
-    	// Event Aufrufen
-    	$this->_callEvent('insert',$this->obj[$id]);
-    	
-    }
-    
-    /*
+	}
+
+	function add($parent, $data) {
+
+		$id = $this->_last_id + 1;
+		$this->obj[$id] = new node;
+		$this->obj[$id]->data = $data;
+		$this->obj[$id]->id = $id;
+		$this->obj[$id]->parent = $parent;
+		$this->obj[$parent]->childs[$id] = &$this->obj[$id];
+
+		// Event Aufrufen
+		$this->_callEvent('insert', $this->obj[$id]);
+
+	}
+
+	/*
     	Löschen von Einträgen ohne Child's
     */
-    
-    function del($id) {
-    	if(count($this->obj[$id]->childs) == 0) {
-    		$this->obj[$id] = NULL;
-    		unset($this->obj[$id]);
-    		return true;
-    	} else {
-    		return false;
-    	}
-    }
-    
-    /*
+
+	function del($id) {
+		if(count($this->obj[$id]->childs) == 0) {
+			$this->obj[$id] = NULL;
+			unset($this->obj[$id]);
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	/*
     	Rekursives löschen von Einträgen
     */
-    
-    function deltree($tree_id) {
-    	// lösche Einträge recursiv
-    	$this->_deltree_recurse($this->obj[$this->root_id],$tree_id, 0);
-    }
-    
-    /*
+
+	function deltree($tree_id) {
+		// lösche Einträge recursiv
+		$this->_deltree_recurse($this->obj[$this->root_id], $tree_id, 0);
+	}
+
+	/*
     	Hilfsfunktion für deltree
     */
-    
-    function _deltree_recurse(&$myobj,$tree_id,$delete) {
+
+	function _deltree_recurse(&$myobj, $tree_id, $delete) {
 		if(is_array($myobj->childs)) {
-            foreach($myobj->childs as $val) {
-            	
-            	// Setze Delete Flag
-            	if($val->id == $tree_id) {
-                	$delete = 1;
-                }
-                
-                // recurse durch Objekte
-            	$this->_deltree_recurse($val,$tree_id,$delete);
-                
-                // lösche Eintrag
-                if($delete == 1) {
-                	$tmp_id = $val->id;
-                	$this->obj[$tmp_id] = NULL;
-    				unset($this->obj[$tmp_id]);
-    				$this->_callEvent('delete',$val);
-    				//echo "Deleting ID: $tmp_id \r\n";
-                }
-                
-                // entferne Delete Flag
-                if($val->id == $tree_id) {
-                	$delete = 0;
-                }
-            }
-        }
-    }
-    
-    
-    /*
+			foreach($myobj->childs as $val) {
+
+				// Setze Delete Flag
+				if($val->id == $tree_id) {
+					$delete = 1;
+				}
+
+				// recurse durch Objekte
+				$this->_deltree_recurse($val, $tree_id, $delete);
+
+				// lösche Eintrag
+				if($delete == 1) {
+					$tmp_id = $val->id;
+					$this->obj[$tmp_id] = NULL;
+					unset($this->obj[$tmp_id]);
+					$this->_callEvent('delete', $val);
+					//echo "Deleting ID: $tmp_id \r\n";
+				}
+
+				// entferne Delete Flag
+				if($val->id == $tree_id) {
+					$delete = 0;
+				}
+			}
+		}
+	}
+
+
+	/*
     	private Funktion zum aufrufen der eventHandler
     */
-    
-    function _callEvent($event, $myobj, $myobj_old = '') {
-    	global $app;
+
+	function _callEvent($event, $myobj, $myobj_old = '') {
+		global $app;
 		if(is_array($this->events)) {
-    		foreach($this->events as $val) {
-    			if($val["event"] == $event) {
-    				$class_name = $val["class_name"];
-    				$function_name = $val["function_name"];
-    				if($val["class_name"] != '') {
-    					$app->uses($class_name);
-    					$app->$class_name->$function_name($myobj,$myobj_old);
-    				} else {
-    					call_user_func ($function_name, $myobj, $myobj_old);
-    				}
-    			}
+			foreach($this->events as $val) {
+				if($val["event"] == $event) {
+					$class_name = $val["class_name"];
+					$function_name = $val["function_name"];
+					if($val["class_name"] != '') {
+						$app->uses($class_name);
+						$app->$class_name->$function_name($myobj, $myobj_old);
+					} else {
+						call_user_func($function_name, $myobj, $myobj_old);
+					}
+				}
 			}
-    	}
-    }
-    
-    /*
+		}
+	}
+
+	/*
     	Funktion zum Verschieben von Einträgen
     */
-    
-    function move($id, $new_parent) {
-    	
-    	$obj_old = $this->obj[$id];
-    	$parent = $this->obj[$id]->parent;
-    	$this->obj[$new_parent]->childs[$id] = &$this->obj[$id];
-    	$this->obj[$id]->parent = $new_parent;
-    	unset($this->obj[$parent]->childs[$id]);
-    	
-    	// event aufrufen
-    	$this->_callEvent('update',$this->obj[$id],$obj_old);
-    	
-    }
-    
-    /*
+
+	function move($id, $new_parent) {
+
+		$obj_old = $this->obj[$id];
+		$parent = $this->obj[$id]->parent;
+		$this->obj[$new_parent]->childs[$id] = &$this->obj[$id];
+		$this->obj[$id]->parent = $new_parent;
+		unset($this->obj[$parent]->childs[$id]);
+
+		// event aufrufen
+		$this->_callEvent('update', $this->obj[$id], $obj_old);
+
+	}
+
+	/*
     	Funktion zum updaten der Daten eines Nodes
     */
-    
-    function update($id,$data) {
-    	
-    	$obj_old = $this->obj[$id];
-    	$this->obj[$id]->data = $data;
-    	$this->_callEvent('update',$this->obj[$id],$obj_old);
-    	
-    }
-    
-    /*
+
+	function update($id, $data) {
+
+		$obj_old = $this->obj[$id];
+		$this->obj[$id]->data = $data;
+		$this->_callEvent('update', $this->obj[$id], $obj_old);
+
+	}
+
+	/*
     	Funktion zum registrieren von Events
     	mögliche events: insert, update, delete
-    	
+
     */
-    
-    function regEvent($event,$class_name,$function_name) {
-    	
-    	$this->events[] = array( 	event 			=> $event,
-    								class_name 		=> $class_name,
-    								function_name 	=> $function_name);
-    	
-    }
+
+	function regEvent($event, $class_name, $function_name) {
+
+		$this->events[] = array(  event    => $event,
+			class_name   => $class_name,
+			function_name  => $function_name);
+
+	}
 
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/lib/classes/validate_autoresponder.inc.php b/interface/lib/classes/validate_autoresponder.inc.php
index c5e989e84135896a0c511c57d3307756594496bb..fa29b7ee708710a2a18b86aa40181335ff50e15d 100755
--- a/interface/lib/classes/validate_autoresponder.inc.php
+++ b/interface/lib/classes/validate_autoresponder.inc.php
@@ -27,41 +27,42 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-include_once('validate_datetime.inc.php');
+include_once 'validate_datetime.inc.php';
 
-class validate_autoresponder extends validate_datetime 
+class validate_autoresponder extends validate_datetime
 {
 	function start_date($field_name, $field_value, $validator)
 	{
-		# save field value for later use in end_date()
+		// save field value for later use in end_date()
 		$this->start_date = $field_value;
-		
+
 		if ($this->_datetime_selected($field_value)) {
-			# We just require a start date be set
+			// We just require a start date be set
 			return;
 		}
 		if($_POST['autoresponder'] == 'y') {
 			return "No start date selected";
 		}
 	}
-	
+
 	function end_date($field_name, $field_value, $validator)
 	{
 		global $app;
-		
+
 		$start_date = $this->start_date;
 		//$start_date = $app->tform_actions->dataRecord['autoresponder_start_date'];
-		
+
 		$_msg = $this->not_empty('autoresponder_start_date', $start_date, $validator);
-		if (!$_msg) // Start date set 
-		{
-			if ( !($_msg = $this->not_empty($field_name, $field_value, $validator)) ) // End date set
+		if (!$_msg) // Start date set
 			{
+			if ( !($_msg = $this->not_empty($field_name, $field_value, $validator)) ) // End date set
+				{
 				$validator['compare'] = $this->_get_timestamp_value($start_date);
 				$_msg = $this->is_greater($field_name, $field_value, $validator);
 			}
-			
+
 			return $_msg;
 		}
 	}
-}
\ No newline at end of file
+
+}
diff --git a/interface/lib/classes/validate_client.inc.php b/interface/lib/classes/validate_client.inc.php
index 36370abaebc39ff739f14d10ff833b271fe7eef4..6bd001530d99b7d785f9a3dca8c9594deaaa147b 100644
--- a/interface/lib/classes/validate_client.inc.php
+++ b/interface/lib/classes/validate_client.inc.php
@@ -29,60 +29,60 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class validate_client {
-	
+
 	/*
 		Validator function to check if a username is unique.
 	*/
 	function username_unique($field_name, $field_value, $validator) {
 		global $app;
-		
+
 		if(isset($app->remoting_lib->primary_id)) {
 			$client_id = $app->remoting_lib->primary_id;
 		} else {
 			$client_id = $app->tform->primary_id;
 		}
-		
+
 		if($client_id == 0) {
-        	$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."'");
-            	if($num_rec["number"] > 0) {
-                	$errmsg = $validator['errmsg'];
-					if(isset($app->tform->wordbook[$errmsg])) {
-                    	return $app->tform->wordbook[$errmsg]."<br>\r\n";
-					} else {
-						return $errmsg."<br>\r\n";
-					}
-                }
-        } else {
-        	$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$client_id);
+			$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."'");
 			if($num_rec["number"] > 0) {
-            	$errmsg = $validator['errmsg'];
-                if(isset($app->tform->wordbook[$errmsg])) {
-                	return $app->tform->wordbook[$errmsg]."<br>\r\n";
+				$errmsg = $validator['errmsg'];
+				if(isset($app->tform->wordbook[$errmsg])) {
+					return $app->tform->wordbook[$errmsg]."<br>\r\n";
+				} else {
+					return $errmsg."<br>\r\n";
+				}
+			}
+		} else {
+			$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM sys_user WHERE username = '".$app->db->quote($field_value)."' AND client_id != ".$client_id);
+			if($num_rec["number"] > 0) {
+				$errmsg = $validator['errmsg'];
+				if(isset($app->tform->wordbook[$errmsg])) {
+					return $app->tform->wordbook[$errmsg]."<br>\r\n";
 				} else {
 					return $errmsg."<br>\r\n";
 				}
 			}
 		}
 	}
-	
+
 	function username_collision($field_name, $field_value, $validator) {
 		global $app;
-		
+
 		if(isset($app->remoting_lib->primary_id)) {
 			$client_id = $app->remoting_lib->primary_id;
 		} else {
 			$client_id = $app->tform->primary_id;
 		}
-		
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('sites');
-		
-		if((trim($field_value) == 'web' || preg_match('/^web[0-9]/',$field_value)) && 
-		  ($global_config['ftpuser_prefix'] == '[CLIENTNAME]' || 
-		   $global_config['ftpuser_prefix'] == '' ||
-		   $global_config['shelluser_prefix'] == '[CLIENTNAME]' ||
-		   $global_config['shelluser_prefix'] == '' ) &&
-		   $global_config['client_username_web_check_disabled'] == 'n') {
+
+		if((trim($field_value) == 'web' || preg_match('/^web[0-9]/', $field_value)) &&
+			($global_config['ftpuser_prefix'] == '[CLIENTNAME]' ||
+				$global_config['ftpuser_prefix'] == '' ||
+				$global_config['shelluser_prefix'] == '[CLIENTNAME]' ||
+				$global_config['shelluser_prefix'] == '' ) &&
+			$global_config['client_username_web_check_disabled'] == 'n') {
 			$errmsg = $validator['errmsg'];
 			if(isset($app->tform->wordbook[$errmsg])) {
 				return $app->tform->wordbook[$errmsg]."<br>\r\n";
@@ -90,13 +90,13 @@ class validate_client {
 				return $errmsg."<br>\r\n";
 			}
 		}
-		
-		
-		
-		
+
+
+
+
 	}
-	
-	
-	
-	
-}
\ No newline at end of file
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_cron.inc.php b/interface/lib/classes/validate_cron.inc.php
index e551af32b88c42e33fbb1372b3ec3da47601afba..7e95e18182a9d36ada114cf745a9c66562bb031c 100644
--- a/interface/lib/classes/validate_cron.inc.php
+++ b/interface/lib/classes/validate_cron.inc.php
@@ -30,32 +30,32 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class validate_cron {
-	
-    function get_error($errmsg) {
-        global $app;
-        
-        if(isset($app->tform->wordbook[$errmsg])) {
-            return $app->tform->wordbook[$errmsg]."<br>\r\n";
-        } else {
-            return $errmsg."<br>\r\n";
-        }
-    }
-    
-    /*
+
+	function get_error($errmsg) {
+		global $app;
+
+		if(isset($app->tform->wordbook[$errmsg])) {
+			return $app->tform->wordbook[$errmsg]."<br>\r\n";
+		} else {
+			return $errmsg."<br>\r\n";
+		}
+	}
+
+	/*
         Validator function to check if a given cron command is in correct form (url only).
     */
-    function command_format($field_name, $field_value, $validator) {
-        if(preg_match("'^(\w+):\/\/'", $field_value, $matches)) {
-            
-            $parsed = parse_url($field_value);
-            if($parsed === false) return $this->get_error($validator['errmsg']);
-            
-            if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']);
-            
-            if(preg_match("'^([a-z0-9][a-z0-9-]{0,62}\.)+([a-z]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
-        }
-    }
-	
+	function command_format($field_name, $field_value, $validator) {
+		if(preg_match("'^(\w+):\/\/'", $field_value, $matches)) {
+
+			$parsed = parse_url($field_value);
+			if($parsed === false) return $this->get_error($validator['errmsg']);
+
+			if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']);
+
+			if(preg_match("'^([a-z0-9][a-z0-9-]{0,62}\.)+([a-z]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
+		}
+	}
+
 	function run_month_format($field_name, $field_value, $validator) {
 		global $app;
 		//* allow value @reboot in month field
@@ -63,137 +63,137 @@ class validate_cron {
 			return $this->run_time_format($field_name, $field_value, $validator);
 		}
 	}
-    
+
 	/*
 		Validator function to check if a given cron time is in correct form.
 	*/
 	function run_time_format($field_name, $field_value, $validator) {
 		global $app;
-		
-        //* check general form
-        $is_ok = true;
-        $field_value = str_replace(" ", "", $field_value); // spaces are not needed
-        $used_times = array();
-        
-        if(preg_match("'^[0-9\-\,\/\*]+$'", $field_value) == false) return $this->get_error($validator['errmsg']); // allowed characters are 0-9, comma, *, -, /
-        elseif(preg_match("'[\-\,\/][\-\,\/]'", $field_value) == true) return $this->get_error($validator['errmsg']); // comma, - and / never stand together
-        //* now split list and check each entry. store used values in array for later limit-check
-        $time_list = explode(",", $field_value);
-        if(count($time_list) < 1) return $this->get_error($validator['errmsg']);
-        
-        $max_entry = 0;
-        $min_entry = 0;
-        $in_minutes = 1;
-        //* get maximum value of entry for each field type (name)
-        switch($field_name) {
-            case "run_min":
-                $max_entry = 59;
-                break;
-            case "run_hour":
-                $max_entry = 23;
-                $in_minutes = 60;
-                break;
-            case "run_mday":
-                $max_entry = 31;
-                $min_entry = 1;
-                $in_minutes = 1440;
-                break;
-            case "run_month":
-                $max_entry = 12;
-                $min_entry = 1;
-                $in_minutes = 1440 * 28; // not exactly but enough
-                break;
-            case "run_wday":
-                $max_entry = 7;
-                $in_minutes = 1440;
-                break;
-        }
-        
-        if($max_entry == 0) return $this->get_error('unknown_fieldtype_error');
-        
-        foreach($time_list as $entry) {
-            //* possible value combinations:
-            //* x               =>      ^(\d+)$
-            //* x-y             =>      ^(\d+)\-(\d+)$
-            //* x/y             =>      ^(\d+)\/([1-9]\d*)$
-            //* x-y/z           =>      ^(\d+)\-(\d+)\/([1-9]\d*)$
-            //* */x             =>      ^\*\/([1-9]\d*)$
-            //* combined regex  =>      ^(\d+|\*)(\-(\d+))?(\/([1-9]\d*))?$
-            
-            if(preg_match("'^(((\d+)(\-(\d+))?)|\*)(\/([1-9]\d*))?$'", $entry, $matches) == false) {
-                return $this->get_error($validator['errmsg']);
-            }
-            
-            //* matches contains:
-            //* 1       =>      * or value or x-y range
-            //* 2       =>      unused
-            //* 3       =>      value if [1] != *
-            //* 4       =>      empty if no range was used
-            //* 5       =>      2nd value of range if [1] != * and range was used
-            //* 6       =>      empty if step was not used
-            //* 7       =>      step
-            
-            $loop_step = 1;
-            $loop_from = $min_entry;
-            $loop_to = $max_entry;
-            
-            //* calculate used values
-            if($matches[1] == "*") {
-                //* not to check
-            } else {
-                if($matches[3] < $min_entry || $matches[3] > $max_entry) {
-                    //* check if value is in allowed range
-                    return $this->get_error($validator['errmsg']);
-                } elseif($matches[4] && ($matches[5] < $min_entry || $matches[5] > $max_entry || $matches[5] <= $matches[3])) {
-                    //* check if value is in allowed range and not less or equal to first value
-                    return $this->get_error($validator['errmsg']);
-                }
-                
-                $loop_from = $matches[3];
-                $loop_to = $matches[3];
-                if($matches[4]) $loop_to = $matches[5];
-            }
-            if($matches[6] && ($matches[7] < 2 || $matches[7] > $max_entry - 1)) {
-                //* check if step value is valid
-                return $this->get_error($validator['errmsg']);
-            }
-            if($matches[7]) $loop_step = $matches[7];
-            
-            //* loop through values to set used times
-            for($t = $loop_from; $t <= $loop_to; $t = $t + $loop_step) {
-                $used_times[] = $t;
-            }
-        } //* end foreach entry loop
-        
-        //* sort used times and erase doubles
-        sort($used_times);
-        $used_times = array_unique($used_times);
-        
-        //* get minimum frequency and store it in $app->tform->cron_min_freq for usage in onUpdateSave and onInsertSave!
-        $min_freq = -1;
-        $prev_time = -1;
-        foreach($used_times as $curtime) {
-            if($prev_time != -1) {
-                $freq = $curtime - $prev_time;
-                if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
-            }
-            $prev_time = $curtime;
-        }
-        
-        //* check last against first (needed because e.g. wday 1,4,7 has diff 1 not 3
-        $prev_time = $used_times[0];
-        $freq = ($prev_time - $min_entry) + ($max_entry - $curtime) + 1;
-        if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
-        
-        if($min_freq > 0 && $min_freq <= $max_entry) { //* only store if > 1 && < $max_entry!
-            $min_freq = $min_freq * $in_minutes; // we have to overwrite $app->tform->cron_min_freq if this is higher value
-            if(!$app->tform->cron_min_freq || $app->tform->cron_min_freq > $min_freq) $app->tform->cron_min_freq = $min_freq;
-        }
-        
-        //return "DEBUG: " . $app->tform->cron_min_freq . " ($min_freq) --- " . var_export($used_times, true) . "<br />";
+
+		//* check general form
+		$is_ok = true;
+		$field_value = str_replace(" ", "", $field_value); // spaces are not needed
+		$used_times = array();
+
+		if(preg_match("'^[0-9\-\,\/\*]+$'", $field_value) == false) return $this->get_error($validator['errmsg']); // allowed characters are 0-9, comma, *, -, /
+		elseif(preg_match("'[\-\,\/][\-\,\/]'", $field_value) == true) return $this->get_error($validator['errmsg']); // comma, - and / never stand together
+		//* now split list and check each entry. store used values in array for later limit-check
+		$time_list = explode(",", $field_value);
+		if(count($time_list) < 1) return $this->get_error($validator['errmsg']);
+
+		$max_entry = 0;
+		$min_entry = 0;
+		$in_minutes = 1;
+		//* get maximum value of entry for each field type (name)
+		switch($field_name) {
+		case "run_min":
+			$max_entry = 59;
+			break;
+		case "run_hour":
+			$max_entry = 23;
+			$in_minutes = 60;
+			break;
+		case "run_mday":
+			$max_entry = 31;
+			$min_entry = 1;
+			$in_minutes = 1440;
+			break;
+		case "run_month":
+			$max_entry = 12;
+			$min_entry = 1;
+			$in_minutes = 1440 * 28; // not exactly but enough
+			break;
+		case "run_wday":
+			$max_entry = 7;
+			$in_minutes = 1440;
+			break;
+		}
+
+		if($max_entry == 0) return $this->get_error('unknown_fieldtype_error');
+
+		foreach($time_list as $entry) {
+			//* possible value combinations:
+			//* x               =>      ^(\d+)$
+			//* x-y             =>      ^(\d+)\-(\d+)$
+			//* x/y             =>      ^(\d+)\/([1-9]\d*)$
+			//* x-y/z           =>      ^(\d+)\-(\d+)\/([1-9]\d*)$
+			//* */x             =>      ^\*\/([1-9]\d*)$
+			//* combined regex  =>      ^(\d+|\*)(\-(\d+))?(\/([1-9]\d*))?$
+
+			if(preg_match("'^(((\d+)(\-(\d+))?)|\*)(\/([1-9]\d*))?$'", $entry, $matches) == false) {
+				return $this->get_error($validator['errmsg']);
+			}
+
+			//* matches contains:
+			//* 1       =>      * or value or x-y range
+			//* 2       =>      unused
+			//* 3       =>      value if [1] != *
+			//* 4       =>      empty if no range was used
+			//* 5       =>      2nd value of range if [1] != * and range was used
+			//* 6       =>      empty if step was not used
+			//* 7       =>      step
+
+			$loop_step = 1;
+			$loop_from = $min_entry;
+			$loop_to = $max_entry;
+
+			//* calculate used values
+			if($matches[1] == "*") {
+				//* not to check
+			} else {
+				if($matches[3] < $min_entry || $matches[3] > $max_entry) {
+					//* check if value is in allowed range
+					return $this->get_error($validator['errmsg']);
+				} elseif($matches[4] && ($matches[5] < $min_entry || $matches[5] > $max_entry || $matches[5] <= $matches[3])) {
+					//* check if value is in allowed range and not less or equal to first value
+					return $this->get_error($validator['errmsg']);
+				}
+
+				$loop_from = $matches[3];
+				$loop_to = $matches[3];
+				if($matches[4]) $loop_to = $matches[5];
+			}
+			if($matches[6] && ($matches[7] < 2 || $matches[7] > $max_entry - 1)) {
+				//* check if step value is valid
+				return $this->get_error($validator['errmsg']);
+			}
+			if($matches[7]) $loop_step = $matches[7];
+
+			//* loop through values to set used times
+			for($t = $loop_from; $t <= $loop_to; $t = $t + $loop_step) {
+				$used_times[] = $t;
+			}
+		} //* end foreach entry loop
+
+		//* sort used times and erase doubles
+		sort($used_times);
+		$used_times = array_unique($used_times);
+
+		//* get minimum frequency and store it in $app->tform->cron_min_freq for usage in onUpdateSave and onInsertSave!
+		$min_freq = -1;
+		$prev_time = -1;
+		foreach($used_times as $curtime) {
+			if($prev_time != -1) {
+				$freq = $curtime - $prev_time;
+				if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
+			}
+			$prev_time = $curtime;
+		}
+
+		//* check last against first (needed because e.g. wday 1,4,7 has diff 1 not 3
+		$prev_time = $used_times[0];
+		$freq = ($prev_time - $min_entry) + ($max_entry - $curtime) + 1;
+		if($min_freq == -1 || $freq < $min_freq) $min_freq = $freq;
+
+		if($min_freq > 0 && $min_freq <= $max_entry) { //* only store if > 1 && < $max_entry!
+			$min_freq = $min_freq * $in_minutes; // we have to overwrite $app->tform->cron_min_freq if this is higher value
+			if(!$app->tform->cron_min_freq || $app->tform->cron_min_freq > $min_freq) $app->tform->cron_min_freq = $min_freq;
+		}
+
+		//return "DEBUG: " . $app->tform->cron_min_freq . " ($min_freq) --- " . var_export($used_times, true) . "<br />";
 	}
-	
-	
-	
-	
-}
\ No newline at end of file
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_database.inc.php b/interface/lib/classes/validate_database.inc.php
index db419e48baea3ec5a4fedbc752fe601d70fa0826..0e6ffef5d504926389a4098163e3fe1875e9954b 100644
--- a/interface/lib/classes/validate_database.inc.php
+++ b/interface/lib/classes/validate_database.inc.php
@@ -29,44 +29,44 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class validate_database {
-	
+
 	/*
 		Validator function to check if a given list of ips is ok.
 	*/
 	function valid_ip_list($field_name, $field_value, $validator) {
 		global $app;
-		
-    if($_POST["remote_access"] == "y") {
-        if(trim($field_value) == "") return;
-        
-        $values = explode(",", $field_value);
-        foreach($values as $cur_value) {
-            $cur_value = trim($cur_value);
-            
-            $valid = true;
-            if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) {
-                $groups = explode(".", $cur_value);
-                foreach($groups as $group){
-                  if($group<0 OR $group>255)
-                  $valid=false;
-                }
-            } else {
-                $valid = false;
-            }
-            
-            if($valid == false) {
-                $errmsg = $validator['errmsg'];
-                if(isset($app->tform->wordbook[$errmsg])) {
-                    return $app->tform->wordbook[$errmsg]."<br>\r\n";
-                } else {
-                    return $errmsg."<br>\r\n";
-                }
-            }
-        }
-    }
-  }
-	
-	
-	
-	
-}
\ No newline at end of file
+
+		if($_POST["remote_access"] == "y") {
+			if(trim($field_value) == "") return;
+
+			$values = explode(",", $field_value);
+			foreach($values as $cur_value) {
+				$cur_value = trim($cur_value);
+
+				$valid = true;
+				if(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $cur_value)) {
+					$groups = explode(".", $cur_value);
+					foreach($groups as $group){
+						if($group<0 or $group>255)
+							$valid=false;
+					}
+				} else {
+					$valid = false;
+				}
+
+				if($valid == false) {
+					$errmsg = $validator['errmsg'];
+					if(isset($app->tform->wordbook[$errmsg])) {
+						return $app->tform->wordbook[$errmsg]."<br>\r\n";
+					} else {
+						return $errmsg."<br>\r\n";
+					}
+				}
+			}
+		}
+	}
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_datetime.inc.php b/interface/lib/classes/validate_datetime.inc.php
index 42afeaf5a298f6080aba3c5452d0bee8a2b03cb2..2cb35f44e99385d5ecdf0ca0cebd1a94d0fff1b7 100755
--- a/interface/lib/classes/validate_datetime.inc.php
+++ b/interface/lib/classes/validate_datetime.inc.php
@@ -27,66 +27,80 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-class validate_datetime 
+class validate_datetime
 {
 	/**
 	 * Check if the parsed datetime selectors are not set
 	 * to it's default value (zero).
-	 * 
+	 *
 	 * @param array $field_value
 	 * @return bool
 	 */
+
+
 	function _datetime_selected($field_value)
 	{
-		if (is_array($field_value) && count($field_value) >= 5) 
+		if (is_array($field_value) && count($field_value) >= 5)
 		{
 			$result = array_filter($field_value, create_function('$dt_unit', 'return ($dt_unit > 0);'));
-			return (count($result) !== 0);
+			return count($result) !== 0;
 		}
-		
+
 		return false;
 	}
-	
+
+
+
+
+
 	/**
 	 * Check wordbook for the existence of an
 	 * error message. If not found will return
 	 * the parsed error message with line break.
-	 * 
+	 *
 	 * @param $errmsg
 	 * @return string
 	 */
 	function _get_error($errmsg)
 	{
 		global $app;
-		
+
 		$errmsg = (isset($app->tform->wordbook[$errmsg])) ? $app->tform->wordbook[$errmsg] : $errmsg;
 		$errmsg .= '<br />' . PHP_EOL;
-		
+
 		return $errmsg;
 	}
-	
+
+
+
+
+
 	/**
-	 * Helper function - filter the contents of the 
+	 * Helper function - filter the contents of the
 	 * selectors and return the resulting unix timestamp.
-	 * 
+	 *
 	 * @param $field_value
 	 * @return int Unix timestamp
 	 */
 	function _get_timestamp_value($field_value)
 	{
 		if(!is_array($field_value)) return 0;
-        $second = 0;
-		$filtered_values = array_map(create_function('$item','return (int)$item;'), $field_value);
+		$second = 0;
+		$filtered_values = array_map(create_function('$item', 'return (int)$item;'), $field_value);
 		extract($filtered_values, EXTR_OVERWRITE);
-		
+
 		return mktime($hour, $minute, $second, $month, $day, $year);
 	}
-	
+
+
+
+
+
 	/**
 	 * The minimum requirement to submit a datetime field
 	 * is to set the day, month and year values. Check that
 	 * these values are not zero (default).
-	 * 
+	 *
 	 * @param string $field_name
 	 * @param array $field_value
 	 * @param array $validator
@@ -94,31 +108,39 @@ class validate_datetime
 	 */
 	function not_empty($field_name, $field_value, $validator)
 	{
-        if(!is_array($field_value)) return $this->_get_error($validator['errmsg']);
+		if(!is_array($field_value)) return $this->_get_error($validator['errmsg']);
 		extract($field_value);
 		if ( !($day > 0 && $month > 0 && $year > 0) ) {
 			return $this->_get_error($validator['errmsg']);
 		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Check that the selected datetime is in the future.
-	 * 
+	 *
 	 * @param string $field_name
 	 * @param array $field_value
 	 * @param array $validator
 	 * @return string|void Error message if found
 	 */
-	function is_future($field_name, $field_value, $validator) 
+	function is_future($field_name, $field_value, $validator)
 	{
-		$validator['compare'] = mktime(date('H'), (date('i')-30), 0, date('m'), date('d'), date('Y')); // Turn back the clock 30 minutes for slow posters.	
+		$validator['compare'] = mktime(date('H'), (date('i')-30), 0, date('m'), date('d'), date('Y')); // Turn back the clock 30 minutes for slow posters.
 		return $this->is_greater($field_name, $field_value, $validator);
 	}
-	
+
+
+
+
+
 	/**
 	 * Compare the selected datetime to a timestamp
 	 * parsed via the validator array (key: compare).
-	 * 
+	 *
 	 * @param string $field_name
 	 * @param array $field_value
 	 * @param array $validator
@@ -129,12 +151,12 @@ class validate_datetime
 		if ( !isset($validator['compare']) || !is_numeric($validator['compare']) || (date('d/m/Y', $validator['compare']) == '01/01/1970') ) {
 			return $this->_get_error('Could not find a unix timestamp to compare datetime with.');
 		}
-		
+
 		$dt_stamp = $this->_get_timestamp_value($field_value);
 		if ($dt_stamp < $validator['compare']) {
 			return $this->_get_error($validator['errmsg']);
 		}
 	}
-	
-	
-}
\ No newline at end of file
+
+
+}
diff --git a/interface/lib/classes/validate_dkim.inc.php b/interface/lib/classes/validate_dkim.inc.php
index e633430cf34489d186b7b06730e2be4341e804fe..523c7c7aec9155983372458f6c3de0eb2244cbdd 100644
--- a/interface/lib/classes/validate_dkim.inc.php
+++ b/interface/lib/classes/validate_dkim.inc.php
@@ -1,93 +1,98 @@
 <?php
 
 /**
-Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
-Copyright (c) 2013, Florian Schaal, info@schaal-24.de
-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.
-
-@author Florian Schaal, info@schaal-24.de
-@copyrighth Florian Schaal, info@schaal-24.de
-*/
+ Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
+ Copyright (c) 2013, Florian Schaal, info@schaal-24.de
+ 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.
+
+ @author Florian Schaal, info@schaal-24.de
+ @copyrighth Florian Schaal, info@schaal-24.de
+ */
+
 
 class validate_dkim {
-	
+
 	function get_error($errmsg) {
 		global $app;
-        	if(isset($app->tform->wordbook[$errmsg])) {
+		if(isset($app->tform->wordbook[$errmsg])) {
 			return $app->tform->wordbook[$errmsg]."<br>\r\n";
 		} else {
 			return $errmsg."<br>\r\n";
 		}
-    	}
+	}
+
 
 	/**
-	* Validator function for private DKIM-Key 
-	*/
-    	function check_private_key($field_name, $field_value, $validator) {
+	 * Validator function for private DKIM-Key
+	 */
+	function check_private_key($field_name, $field_value, $validator) {
 		$dkim_enabled=$_POST['dkim'];
 		if ($dkim_enabled == 'y') {
 			if (empty($field_value)) return $this->get_error($validator['errmsg']);
-			exec('echo '.escapeshellarg($field_value).'|openssl rsa -check',$output,$result);
+			exec('echo '.escapeshellarg($field_value).'|openssl rsa -check', $output, $result);
 			if($result != 0) return $this->get_error($validator['errmsg']);
 		}
 	}
 
+
 	/**
-	* Validator function for DKIM Path 
-	* @return boolean - true when the dkim-path exists and is writeable
-	*/
+	 * Validator function for DKIM Path
+	 * @return boolean - true when the dkim-path exists and is writeable
+	 */
 	function check_dkim_path($field_name, $field_value, $validator) {
 		if(empty($field_value)) return $this->get_error($validator['errmsg']);
-		if (substr(sprintf('%o', fileperms($field_value)),-3) <= 600)
+		if (substr(sprintf('%o', fileperms($field_value)), -3) <= 600)
 			return $this->get_error($validator['errmsg']);
 	}
 
-	/** 
-	* Check function for DNS-Template 
-	*/
+
+	/**
+	 * Check function for DNS-Template
+	 */
 	function check_template($field_name, $field_value, $validator) {
 		$dkim=false;
 		foreach($field_value as $field ) { if($field == 'DKIM') $dkim=true; }
 		if ($dkim && $field_value[0]!='DOMAIN') return $this->get_error($validator['errmsg']);
 	}
 
+
 	/**
-	* Validator function for $_POST 
-	*
-	* @return boolean - true if $POST contains a real key-file
-	*/
-	function validate_post($key,$value) {
+	 * Validator function for $_POST
+	 *
+	 * @return boolean - true if $POST contains a real key-file
+	 */
+	function validate_post($key, $value) {
 		switch ($key) {
-			case 'public':	
-				if (preg_match("/(^-----BEGIN PUBLIC KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,221}(-----END PUBLIC KEY-----(\n|\r)$)/",$value) === 1) { return true; } else { return false; }
+		case 'public':
+			if (preg_match("/(^-----BEGIN PUBLIC KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,221}(-----END PUBLIC KEY-----(\n|\r)$)/", $value) === 1) { return true; } else { return false; }
 			break;
-			case 'private':
-				if (preg_match("/(^-----BEGIN RSA PRIVATE KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,850}(-----END RSA PRIVATE KEY-----(\n|\r)$)/",$value) === 1) { return true; } else { return false; }
+		case 'private':
+			if (preg_match("/(^-----BEGIN RSA PRIVATE KEY-----)[a-zA-Z0-9\r\n\/\+=]{1,850}(-----END RSA PRIVATE KEY-----(\n|\r)$)/", $value) === 1) { return true; } else { return false; }
 			break;
 		}
-	}	
-}
+	}
 
+}
diff --git a/interface/lib/classes/validate_dns.inc.php b/interface/lib/classes/validate_dns.inc.php
index 2e5643d074386857c44264c25e990a9f2e8db3d7..99ff6c5b4503c0312b352534fe67e9988d3218c4 100644
--- a/interface/lib/classes/validate_dns.inc.php
+++ b/interface/lib/classes/validate_dns.inc.php
@@ -34,254 +34,254 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class validate_dns {
 
-function validate_field($field, $area, $zoneid, $wildcard_allowed = 1){
-  //$desc: Name, Data, RP mbox, RP txtref, SRV target, Zone origin, Name server, Admin email
-  global $app, $conf;
-
-  switch ($area) {
-  case "Name":
-    $desc = $app->tform->wordbook['name_txt'];
-    break;
-  case "Data":
-    $desc = $app->tform->wordbook['data_txt'];
-    break;
-  case "RP mbox":
-    $desc = $app->tform->wordbook['rp_mbox_txt'];
-    break;
-  case "RP txtref":
-    $desc = $app->tform->wordbook['rp_txtref_txt'];
-    break;
-  case "SRV target":
-    $desc = $app->tform->wordbook['srv_target_txt'];
-    break;
-  case "Zone origin":
-    $desc = $app->tform->wordbook['zone_origin_txt'];
-    break;
-  case "Name server":
-    $desc = $app->tform->wordbook['ns_txt'];
-    break;
-  case "Admin email":
-    $desc = $app->tform->wordbook['mbox_txt'];
-    break;
-  }
-
-  $error = '';
-
-  $valid_characters = "*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_";
-
-  if(strlen($field) > 255) $error .= $desc." ".$app->tform->wordbook['error_255_characters']."<br>\r\n";
-
-  $parts = explode(".", $field);
-  $i = 0;
-  $empty = 0;
-  foreach ($parts as $part){
-    $i++;
-
-    if(trim($part) == '') $empty += 1;
-
-    if(strlen($part) > 63) $error .= $desc." ".$app->tform->wordbook['error_63_characters']."<br>\r\n";
-
-    if(strspn($part, $valid_characters) != strlen($part)) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
-
-    if(substr($part, 0, 1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_begin']."<br>\r\n";
-    if(substr($part, -1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_end']."<br>\r\n";
-
-    if(strstr($part, "*")){
-      if($wildcard_allowed){
-        if($i != 1) $error .= $desc." ".$app->tform->wordbook['error_wildcard_non_initial_part']."<br>\r\n";
-
-        if($part != "*") $error .= $desc." ".$app->tform->wordbook['error_wildcard_mix']."<br>\r\n";
-      } else {
-        $error .= $desc." ".$app->tform->wordbook['error_no_wildcard_allowed']."<br>\r\n";
-      }
-    }
-  }
-
-  if(substr($field, -1) == '.'){
-    if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
-  } else {
-    if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
-  }
-
-  if(substr($field, -1) == '.' && $area == 'Name'){
-    $soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$zoneid);
-    if(substr($field, (strlen($field) - strlen($soa['origin']))) != $soa['origin']) $error .= $desc." ".$app->tform->wordbook['error_out_of_zone']."<br>\r\n";
-  }
-
-  return $error;
-}
-
-function validate_rp_data(&$data, $zoneid){
-  global $app, $conf;
-  $error = '';
-  $fields = explode(" ", trim($data));
-  if(count($fields) != 2) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_rp']."<br>\r\n";
-  $mbox = $fields[0];
-  $txtref = $fields[1];
-
-  $error .= $this->validate_field($mbox, 'RP mbox', $zoneid, 0);
-  $error .= $this->validate_field($txtref, 'RP txtref', $zoneid, 0);
-
-  $data = $mbox." ".$txtref;
-  return $error;
-}
-
-function validate_srv_data(&$data, $zoneid){
-  global $app, $conf;
-  $error = '';
-
-  $fields = explode(" ", trim($data));
-  if(count($fields) != 3) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_srv']."<br>\r\n";
-
-  $weight = $fields[0];
-  $port = $fields[1];
-  $target = $fields[2];
-  if($weight < 0 || $weight > 65535) $error .= $app->tform->wordbook['weight_txt']." (\"<i>" . htmlentities($weight,ENT_QUOTES,$conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
-  if($port < 0 || $port > 65535) $error .= $app->tform->wordbook['port_txt']." (\"<i>".htmlentities($port,ENT_QUOTES,$conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
-
-  $error .= $this->validate_field($target, "SRV target", $zoneid, 0);
-
-  $data = (int)$weight." ".(int)$port." ".$target;
-  return $error;
-}
-
-function is_integer($value, $fieldname, $zero_allowed = 0){
-  global $app, $conf;
-
-  $error = '';
-
-  if($app->functions->intval($value, true) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."<br>\r\n";
-  if($value > 2147483647) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_greater_than_2147483647']."<br>\r\n";
-  if(!$zero_allowed){
-    if($value <= 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_positive']."<br>\r\n";
-  } else {
-    if($value < 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_negative']."<br>\r\n";
-  }
-
-  return $error;
-}
+	function validate_field($field, $area, $zoneid, $wildcard_allowed = 1){
+		//$desc: Name, Data, RP mbox, RP txtref, SRV target, Zone origin, Name server, Admin email
+		global $app, $conf;
+
+		switch ($area) {
+		case "Name":
+			$desc = $app->tform->wordbook['name_txt'];
+			break;
+		case "Data":
+			$desc = $app->tform->wordbook['data_txt'];
+			break;
+		case "RP mbox":
+			$desc = $app->tform->wordbook['rp_mbox_txt'];
+			break;
+		case "RP txtref":
+			$desc = $app->tform->wordbook['rp_txtref_txt'];
+			break;
+		case "SRV target":
+			$desc = $app->tform->wordbook['srv_target_txt'];
+			break;
+		case "Zone origin":
+			$desc = $app->tform->wordbook['zone_origin_txt'];
+			break;
+		case "Name server":
+			$desc = $app->tform->wordbook['ns_txt'];
+			break;
+		case "Admin email":
+			$desc = $app->tform->wordbook['mbox_txt'];
+			break;
+		}
+
+		$error = '';
+
+		$valid_characters = "*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_";
+
+		if(strlen($field) > 255) $error .= $desc." ".$app->tform->wordbook['error_255_characters']."<br>\r\n";
+
+		$parts = explode(".", $field);
+		$i = 0;
+		$empty = 0;
+		foreach ($parts as $part){
+			$i++;
+
+			if(trim($part) == '') $empty += 1;
+
+			if(strlen($part) > 63) $error .= $desc." ".$app->tform->wordbook['error_63_characters']."<br>\r\n";
+
+			if(strspn($part, $valid_characters) != strlen($part)) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+
+			if(substr($part, 0, 1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_begin']."<br>\r\n";
+			if(substr($part, -1) == '-') $error .= $desc." ".$app->tform->wordbook['error_hyphen_end']."<br>\r\n";
+
+			if(strstr($part, "*")){
+				if($wildcard_allowed){
+					if($i != 1) $error .= $desc." ".$app->tform->wordbook['error_wildcard_non_initial_part']."<br>\r\n";
+
+					if($part != "*") $error .= $desc." ".$app->tform->wordbook['error_wildcard_mix']."<br>\r\n";
+				} else {
+					$error .= $desc." ".$app->tform->wordbook['error_no_wildcard_allowed']."<br>\r\n";
+				}
+			}
+		}
+
+		if(substr($field, -1) == '.'){
+			if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+		} else {
+			if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+		}
+
+		if(substr($field, -1) == '.' && $area == 'Name'){
+			$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$zoneid);
+			if(substr($field, (strlen($field) - strlen($soa['origin']))) != $soa['origin']) $error .= $desc." ".$app->tform->wordbook['error_out_of_zone']."<br>\r\n";
+		}
+
+		return $error;
+	}
+
+	function validate_rp_data(&$data, $zoneid){
+		global $app, $conf;
+		$error = '';
+		$fields = explode(" ", trim($data));
+		if(count($fields) != 2) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_rp']."<br>\r\n";
+		$mbox = $fields[0];
+		$txtref = $fields[1];
+
+		$error .= $this->validate_field($mbox, 'RP mbox', $zoneid, 0);
+		$error .= $this->validate_field($txtref, 'RP txtref', $zoneid, 0);
+
+		$data = $mbox." ".$txtref;
+		return $error;
+	}
+
+	function validate_srv_data(&$data, $zoneid){
+		global $app, $conf;
+		$error = '';
+
+		$fields = explode(" ", trim($data));
+		if(count($fields) != 3) return $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_invalid_srv']."<br>\r\n";
+
+		$weight = $fields[0];
+		$port = $fields[1];
+		$target = $fields[2];
+		if($weight < 0 || $weight > 65535) $error .= $app->tform->wordbook['weight_txt']." (\"<i>" . htmlentities($weight, ENT_QUOTES, $conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
+		if($port < 0 || $port > 65535) $error .= $app->tform->wordbook['port_txt']." (\"<i>".htmlentities($port, ENT_QUOTES, $conf["html_content_encoding"])."</i>\") ".$app->tform->wordbook['error_srv_out_of_range']."<br>\r\n";
+
+		$error .= $this->validate_field($target, "SRV target", $zoneid, 0);
+
+		$data = (int)$weight." ".(int)$port." ".$target;
+		return $error;
+	}
+
+	function is_integer($value, $fieldname, $zero_allowed = 0){
+		global $app, $conf;
+
+		$error = '';
+
+		if($app->functions->intval($value, true) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."<br>\r\n";
+		if($value > 2147483647) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_greater_than_2147483647']."<br>\r\n";
+		if(!$zero_allowed){
+			if($value <= 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_positive']."<br>\r\n";
+		} else {
+			if($value < 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_negative']."<br>\r\n";
+		}
+
+		return $error;
+	}
+
+	function validate_rr(&$rr){
+		global $app, $conf;
+
+		$error = '';
+
+		$tmp_rr = $rr;
+		foreach($tmp_rr as $key => $val){
+			$rr[$key] = trim($val);
+		}
+		unset($tmp_rr);
+
+		$error .= $this->validate_field($rr['name'], 'Name', $rr['zone'], 1);
+
+		switch ($rr['type']) {
+		case "A":
+			$ip_parts = explode(".", $rr['data']);
+			if(count($ip_parts) != 4){
+				$error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
+			} else {
+				for($n = 0; $n < 4; $n++){
+					$q = $ip_parts[$n];
+					if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255 || trim($q) !== $q) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
+				}
+			}
+			$rr['data'] = (int)$ip_parts[0].".".(int)$ip_parts[1].".".(int)$ip_parts[2].".".(int)$ip_parts[3];
+			break;
+		case "AAAA":
+			$valid_chars = "ABCDEFabcdef1234567890:";
+
+			if(strspn($rr['data'], $valid_chars) != strlen($rr['data'])) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_aaaa']."<br>\r\n";
+			break;
+		case "ALIAS":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			break;
+		case "CNAME":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			break;
+		case "HINFO":
+			if(!strchr($rr['data'], ' ')) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_hinfo']."<br>\r\n";
+			break;
+		case "MX":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			$error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
+			break;
+		case "NS":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			break;
+		case "PTR":
+			$error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
+			if(substr($rr['data'], -1) != '.') $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_ptr']."<br>\r\n";
+			break;
+		case "RP":
+			$error .= $this->validate_rp_data($rr['data'], $rr['zone']);
+			break;
+		case "SRV":
+			$error .= $this->validate_srv_data($rr['data'], $rr['zone']);
+			$error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
+			break;
+		case "TXT":
+			break;
+		}
+
+		$error .= $this->is_integer($rr['ttl'], $app->tform->wordbook['ttl_txt']);
+
+
+		return $error;
+	}
+
+	function validate_soa(&$soa){
+		global $app, $conf;
+
+		$error = '';
+
+		$tmp_soa = $soa;
+		foreach($tmp_soa as $key => $val){
+			if($key != 'active') $soa[$key] = trim($val);
+		}
+		unset($tmp_soa);
+
+		if($soa['origin'] == '') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
+		if(substr($soa['origin'], -1) != '.') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_dot']."<br>\r\n";
+		$error .= $this->validate_field($soa['origin'], "Zone origin", $soa['id'], 0);
+
+		$error .= $this->is_integer($soa['ttl'], $app->tform->wordbook['ttl_txt']);
+
+		if($soa['ns'] == '') $error .= $app->tform->wordbook['ns_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
+		$error .= $this->validate_field($soa['ns'], "Name server", $soa['id'], 0);
+
+		if($soa['mbox'] == '') $error .= $app->tform->wordbook['mbox_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
+		$error .= $this->validate_field($soa['mbox'], "Admin email", $soa['id'], 0);
+
+		$error .= $this->is_integer($soa['refresh'], $app->tform->wordbook['refresh_txt']);
+
+		$error .= $this->is_integer($soa['retry'], $app->tform->wordbook['retry_txt']);
+
+		$error .= $this->is_integer($soa['expire'], $app->tform->wordbook['expire_txt']);
+
+		$error .= $this->is_integer($soa['minimum'], $app->tform->wordbook['minimum_txt']);
+
+		return $error;
+	}
+
+	function increase_serial($serial){
+		global $app, $conf;
+
+		// increase serial
+		$serial_date = substr($serial, 0, 8);
+		$count = $app->functions->intval(substr($serial, 8, 2));
+		$current_date = date("Ymd");
+		if($serial_date >= $current_date){
+			$count += 1;
+			if ($count > 99) {
+				$serial_date += 1;
+				$count = 0;
+			}
+			$count = str_pad($count, 2, "0", STR_PAD_LEFT);
+			$new_serial = $serial_date.$count;
+		} else {
+			$new_serial = $current_date.'01';
+		}
+		return $new_serial;
+	}
 
-function validate_rr(&$rr){
-  global $app, $conf;
-
-  $error = '';
-
-  $tmp_rr = $rr;
-  foreach($tmp_rr as $key => $val){
-    $rr[$key] = trim($val);
-  }
-  unset($tmp_rr);
-
-  $error .= $this->validate_field($rr['name'], 'Name', $rr['zone'], 1);
-
-  switch ($rr['type']) {
-  case "A":
-    $ip_parts = explode(".", $rr['data']);
-    if(count($ip_parts) != 4){
-      $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
-    } else {
-      for($n = 0; $n < 4; $n++){
-        $q = $ip_parts[$n];
-        if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255 || trim($q) !== $q) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
-      }
-    }
-    $rr['data'] = (int)$ip_parts[0].".".(int)$ip_parts[1].".".(int)$ip_parts[2].".".(int)$ip_parts[3];
-    break;
-  case "AAAA":
-    $valid_chars = "ABCDEFabcdef1234567890:";
-
-    if(strspn($rr['data'], $valid_chars) != strlen($rr['data'])) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_aaaa']."<br>\r\n";
-    break;
-  case "ALIAS":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    break;
-  case "CNAME":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    break;
-  case "HINFO":
-    if(!strchr($rr['data'], ' ')) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_hinfo']."<br>\r\n";
-    break;
-  case "MX":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
-    break;
-  case "NS":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    break;
-  case "PTR":
-    $error .= $this->validate_field($rr['data'], 'Data', $rr['zone'], 0);
-    if(substr($rr['data'], -1) != '.') $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_ptr']."<br>\r\n";
-    break;
-  case "RP":
-    $error .= $this->validate_rp_data($rr['data'], $rr['zone']);
-    break;
-  case "SRV":
-    $error .= $this->validate_srv_data($rr['data'], $rr['zone']);
-    $error .= $this->is_integer($rr['aux'], $app->tform->wordbook['aux_txt'], 1);
-    break;
-  case "TXT":
-    break;
-  }
-
-  $error .= $this->is_integer($rr['ttl'], $app->tform->wordbook['ttl_txt']);
-
-
-  return $error;
 }
-
-function validate_soa(&$soa){
-  global $app, $conf;
-
-  $error = '';
-
-  $tmp_soa = $soa;
-  foreach($tmp_soa as $key => $val){
-    if($key != 'active') $soa[$key] = trim($val);
-  }
-  unset($tmp_soa);
-
-  if($soa['origin'] == '') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
-  if(substr($soa['origin'], -1) != '.') $error .= $app->tform->wordbook['origin_txt']." ".$app->tform->wordbook['error_dot']."<br>\r\n";
-  $error .= $this->validate_field($soa['origin'], "Zone origin", $soa['id'], 0);
-
-  $error .= $this->is_integer($soa['ttl'], $app->tform->wordbook['ttl_txt']);
-
-  if($soa['ns'] == '') $error .= $app->tform->wordbook['ns_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
-  $error .= $this->validate_field($soa['ns'], "Name server", $soa['id'], 0);
-
-  if($soa['mbox'] == '') $error .= $app->tform->wordbook['mbox_txt']." ".$app->tform->wordbook['error_empty']."<br>\r\n";
-  $error .= $this->validate_field($soa['mbox'], "Admin email", $soa['id'], 0);
-
-  $error .= $this->is_integer($soa['refresh'], $app->tform->wordbook['refresh_txt']);
-
-  $error .= $this->is_integer($soa['retry'], $app->tform->wordbook['retry_txt']);
-
-  $error .= $this->is_integer($soa['expire'], $app->tform->wordbook['expire_txt']);
-
-  $error .= $this->is_integer($soa['minimum'], $app->tform->wordbook['minimum_txt']);
-
-  return $error;
-}
-
-function increase_serial($serial){
-  global $app, $conf;
-
-  // increase serial
-  $serial_date = substr($serial, 0, 8);
-  $count = $app->functions->intval(substr($serial, 8, 2));
-  $current_date = date("Ymd");
-  if($serial_date >= $current_date){
-    $count += 1;
-    if ($count > 99) {
-        $serial_date += 1;
-        $count = 0;
-    }
-    $count = str_pad($count, 2, "0", STR_PAD_LEFT);
-    $new_serial = $serial_date.$count;
-  } else {
-    $new_serial = $current_date.'01';
-  }
-  return $new_serial;
-}
-
-}
\ No newline at end of file
diff --git a/interface/lib/classes/validate_domain.inc.php b/interface/lib/classes/validate_domain.inc.php
index ca137f6c3cc3aff8d95fdf8b29c63dfbea6d1279..3135c7a9d6191b6e96f809b2ae84500b8deb1001 100644
--- a/interface/lib/classes/validate_domain.inc.php
+++ b/interface/lib/classes/validate_domain.inc.php
@@ -30,98 +30,98 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class validate_domain {
-	
-    function get_error($errmsg) {
-        global $app;
-        
-        if(isset($app->tform->wordbook[$errmsg])) {
-            return $app->tform->wordbook[$errmsg]."<br>\r\n";
-        } else {
-            return $errmsg."<br>\r\n";
-        }
-    }
-    
-    /* Validator function for domain (website) */
-    function web_domain($field_name, $field_value, $validator) {
-        if(empty($field_value)) return $this->get_error('domain_error_empty');
-        
-        // do not allow wildcards on website domains
-        $result = $this->_regex_validate($field_value);
-        if(!$result) return $this->get_error('domain_error_regex');
-        
-        $result = $this->_check_unique($field_value);
-        if(!$result) return $this->get_error('domain_error_unique');
-    }
-    
-    /* Validator function for sub domain */
-    function sub_domain($field_name, $field_value, $validator) {
-        if(empty($field_value)) return $this->get_error('domain_error_empty');
-        
-        $allow_wildcard = $this->_wildcard_limit();
-        if($allow_wildcard == false && substr($field_value, 0, 2) === '*.') return $this->get_error('domain_error_wildcard');
-        
-        $result = $this->_regex_validate($field_value, $allow_wildcard);
-        if(!$result) return $this->get_error('domain_error_regex');
-        
-        $result = $this->_check_unique($field_value);
-        if(!$result) return $this->get_error('domain_error_unique');
-    }
-    
-    /* Validator function for alias domain */
-    function alias_domain($field_name, $field_value, $validator) {
-        if(empty($field_value)) return $this->get_error('domain_error_empty');
-        
-        // do not allow wildcards on alias domains
-        $result = $this->_regex_validate($field_value);
-        if(!$result) return $this->get_error('domain_error_regex');
-        
-        $result = $this->_check_unique($field_value);
-        if(!$result) return $this->get_error('domain_error_unique');
-    }
-    
-    /* Validator function for checking the auto subdomain of a web/aliasdomain */
-    function web_domain_autosub($field_name, $field_value, $validator) {
-        global $app;
-        if(empty($field_value) || $field_name != 'subdomain') return; // none set
-        
-        $check_domain = $_POST['domain'];
-        $app->uses('ini_parser,getconf');
-        $settings = $app->getconf->get_global_config('domains');
-        if ($settings['use_domain_module'] == 'y') {
-            $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($check_domain);
-            $domain_check = $app->db->queryOneRecord($sql);
-            if(!$domain_check) return;
-            $check_domain = $domain_check['domain'];
-        }
-        
-        $result = $this->_check_unique($field_value . '.' . $check_domain, true);
-        if(!$result) return $this->get_error('domain_error_autosub');
-    }
-    
-    /* internal validator function to match regexp */
-    function _regex_validate($domain_name, $allow_wildcard = false) {
-        $pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/';
-        return preg_match($pattern, $domain_name);
-    }
-    
-    /* check if the domain hostname is unique (keep in mind the auto subdomains!) */
-    function _check_unique($domain_name, $only_domain = false) {
-        global $app, $page;
-        
-        if(isset($app->remoting_lib->primary_id)) {
-            $primary_id = $app->remoting_lib->primary_id;
+
+	function get_error($errmsg) {
+		global $app;
+
+		if(isset($app->tform->wordbook[$errmsg])) {
+			return $app->tform->wordbook[$errmsg]."<br>\r\n";
+		} else {
+			return $errmsg."<br>\r\n";
+		}
+	}
+
+	/* Validator function for domain (website) */
+	function web_domain($field_name, $field_value, $validator) {
+		if(empty($field_value)) return $this->get_error('domain_error_empty');
+
+		// do not allow wildcards on website domains
+		$result = $this->_regex_validate($field_value);
+		if(!$result) return $this->get_error('domain_error_regex');
+
+		$result = $this->_check_unique($field_value);
+		if(!$result) return $this->get_error('domain_error_unique');
+	}
+
+	/* Validator function for sub domain */
+	function sub_domain($field_name, $field_value, $validator) {
+		if(empty($field_value)) return $this->get_error('domain_error_empty');
+
+		$allow_wildcard = $this->_wildcard_limit();
+		if($allow_wildcard == false && substr($field_value, 0, 2) === '*.') return $this->get_error('domain_error_wildcard');
+
+		$result = $this->_regex_validate($field_value, $allow_wildcard);
+		if(!$result) return $this->get_error('domain_error_regex');
+
+		$result = $this->_check_unique($field_value);
+		if(!$result) return $this->get_error('domain_error_unique');
+	}
+
+	/* Validator function for alias domain */
+	function alias_domain($field_name, $field_value, $validator) {
+		if(empty($field_value)) return $this->get_error('domain_error_empty');
+
+		// do not allow wildcards on alias domains
+		$result = $this->_regex_validate($field_value);
+		if(!$result) return $this->get_error('domain_error_regex');
+
+		$result = $this->_check_unique($field_value);
+		if(!$result) return $this->get_error('domain_error_unique');
+	}
+
+	/* Validator function for checking the auto subdomain of a web/aliasdomain */
+	function web_domain_autosub($field_name, $field_value, $validator) {
+		global $app;
+		if(empty($field_value) || $field_name != 'subdomain') return; // none set
+
+		$check_domain = $_POST['domain'];
+		$app->uses('ini_parser,getconf');
+		$settings = $app->getconf->get_global_config('domains');
+		if ($settings['use_domain_module'] == 'y') {
+			$sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($check_domain);
+			$domain_check = $app->db->queryOneRecord($sql);
+			if(!$domain_check) return;
+			$check_domain = $domain_check['domain'];
+		}
+
+		$result = $this->_check_unique($field_value . '.' . $check_domain, true);
+		if(!$result) return $this->get_error('domain_error_autosub');
+	}
+
+	/* internal validator function to match regexp */
+	function _regex_validate($domain_name, $allow_wildcard = false) {
+		$pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/';
+		return preg_match($pattern, $domain_name);
+	}
+
+	/* check if the domain hostname is unique (keep in mind the auto subdomains!) */
+	function _check_unique($domain_name, $only_domain = false) {
+		global $app, $page;
+
+		if(isset($app->remoting_lib->primary_id)) {
+			$primary_id = $app->remoting_lib->primary_id;
 			$domain = $app->remoting_lib->dataRecord;
-        } else {
-            $primary_id = $app->tform->primary_id;
+		} else {
+			$primary_id = $app->tform->primary_id;
 			$domain = $page->dataRecord;
-        }
+		}
 
 		if($domain['ip_address'] == '' || $domain['ipv6_address'] == ''){
 			if($domain['parent_domain_id'] > 0){
 				$parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$domain['parent_domain_id']);
 			}
 		}
-		
+
 		// check if domain has alias/subdomains - if we move a web to another IP, make sure alias/subdomains are checked as well
 		$aliassubdomains = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE parent_domain_id = ".$app->functions->intval($primary_id)." AND (type = 'alias' OR type = 'subdomain')");
 		$additional_sql1 = '';
@@ -132,10 +132,10 @@ class validate_domain {
 				$additional_sql2 .= " OR CONCAT(`subdomain`, '.', `domain`) = '".$app->db->quote($aliassubdomain['domain'])."'";
 			}
 		}
-		
-        //$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `domain` = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
+
+		//$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `domain` = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
 		//if($check['cnt'] > 0) return false;
-		
+
 		// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
 		$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (`domain` = '" . $app->db->quote($domain_name) . "'".$additional_sql1.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql1 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
 
@@ -151,14 +151,14 @@ class validate_domain {
 						$check_parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ".$check['parent_domain_id']);
 					}
 				}
-					
+
 				if($domain['ip_address'] == '' && $check['ip_address'] != ''){
 					if(is_array($parent_domain) && !empty($parent_domain)){
 						if($parent_domain['ip_address'] == '*') return false;
 						if($parent_domain['ip_address'] != '' && $check['ip_address'] == $parent_domain['ip_address']) return false;
 					}
 				}
-				
+
 				if($domain['ip_address'] == '' && $check['ip_address'] == ''){
 					if($check['parent_domain_id'] > 0){
 						if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -170,7 +170,7 @@ class validate_domain {
 						if($parent_domain['ip_address'] != '' && $check_parent_domain['ip_address'] == $parent_domain['ip_address']) return false;
 					}
 				}
-				
+
 				if($check['ip_address'] == '' && $domain['ip_address'] != ''){
 					if($check['parent_domain_id'] > 0){
 						if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -179,19 +179,19 @@ class validate_domain {
 						}
 					}
 				}
-				
+
 				if($domain['ipv6_address'] == '' && $check['ipv6_address'] != ''){
 					if(is_array($parent_domain) && !empty($parent_domain)){
 						if($parent_domain['ipv6_address'] != '' && $check['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 					}
 				}
-				
+
 				if($domain['ipv6_address'] == '' && $check['ipv6_address'] == ''){
 					if(is_array($parent_domain) && !empty($parent_domain)){
 						if($parent_domain['ipv6_address'] != '' && $check_parent_domain['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 					}
 				}
-				
+
 				if($check['ipv6_address'] == '' && $domain['ipv6_address'] != ''){
 					if($check['parent_domain_id'] > 0){
 						if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -201,10 +201,10 @@ class validate_domain {
 				}
 			}
 		}
-        
-        
-        if($only_domain == false) {
-            //$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
+
+
+		if($only_domain == false) {
+			//$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id));
 			//if($check['cnt'] > 0) return false;
 			// we can have the same domain on different servers or different IPs, so we have to check for identical domains on the same IP (or wildcard IPs)
 			$checks = $app->db->queryAllRecords("SELECT * FROM `web_domain` WHERE (CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "'".$additional_sql2.") AND `server_id` = ".intval($domain['server_id'])." AND `domain_id` != " . $app->functions->intval($primary_id).($additional_sql2 != '' ? " AND `parent_domain_id` != ".$app->functions->intval($primary_id) : ""));
@@ -220,14 +220,14 @@ class validate_domain {
 							$check_parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = ".$check['parent_domain_id']);
 						}
 					}
-					
+
 					if($domain['ip_address'] == '' && $check['ip_address'] != ''){
 						if(is_array($parent_domain) && !empty($parent_domain)){
 							if($parent_domain['ip_address'] == '*') return false;
 							if($parent_domain['ip_address'] != '' && $check['ip_address'] == $parent_domain['ip_address']) return false;
 						}
 					}
-				
+
 					if($domain['ip_address'] == '' && $check['ip_address'] == ''){
 						if($check['parent_domain_id'] > 0){
 							if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -239,7 +239,7 @@ class validate_domain {
 							if($parent_domain['ip_address'] != '' && $check_parent_domain['ip_address'] == $parent_domain['ip_address']) return false;
 						}
 					}
-				
+
 					if($check['ip_address'] == '' && $domain['ip_address'] != ''){
 						if($check['parent_domain_id'] > 0){
 							if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -248,19 +248,19 @@ class validate_domain {
 							}
 						}
 					}
-				
+
 					if($domain['ipv6_address'] == '' && $check['ipv6_address'] != ''){
 						if(is_array($parent_domain) && !empty($parent_domain)){
 							if($parent_domain['ipv6_address'] != '' && $check['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 						}
 					}
-				
+
 					if($domain['ipv6_address'] == '' && $check['ipv6_address'] == ''){
 						if(is_array($parent_domain) && !empty($parent_domain)){
 							if($parent_domain['ipv6_address'] != '' && $check_parent_domain['ipv6_address'] == $parent_domain['ipv6_address']) return false;
 						}
 					}
-				
+
 					if($check['ipv6_address'] == '' && $domain['ipv6_address'] != ''){
 						if($check['parent_domain_id'] > 0){
 							if(is_array($check_parent_domain) && !empty($check_parent_domain)){
@@ -270,24 +270,25 @@ class validate_domain {
 					}
 				}
 			}
-            
-        }
-        
-        return true;
-    }
-    
-    /* check if the client may add wildcard domains */
-    function _wildcard_limit() {
-        global $app;
-        
-        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_wildcard FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-        
-            if($client["limit_wildcard"] == 'y') return true;
-            else return false;
-        }
-        return true; // admin may always add wildcard domain
-    }
-}
\ No newline at end of file
+
+		}
+
+		return true;
+	}
+
+	/* check if the client may add wildcard domains */
+	function _wildcard_limit() {
+		global $app;
+
+		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_wildcard FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+			if($client["limit_wildcard"] == 'y') return true;
+			else return false;
+		}
+		return true; // admin may always add wildcard domain
+	}
+
+}
diff --git a/interface/lib/classes/validate_ftpuser.inc.php b/interface/lib/classes/validate_ftpuser.inc.php
index 60768a33d8104e558c27eae89e3ff32df5f8738a..64ca12f2279e37d358772889a33bb9e54b09b02e 100644
--- a/interface/lib/classes/validate_ftpuser.inc.php
+++ b/interface/lib/classes/validate_ftpuser.inc.php
@@ -29,66 +29,66 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class validate_ftpuser {
-	
+
 	/*
 		Validator function to check if a given dir is ok.
 	*/
 	function ftp_dir($field_name, $field_value, $validator) {
 		global $app;
-		
-        if($app->tform->primary_id == 0) {
-            $errmsg = $validator['errmsg'];
-            if(isset($app->tform->wordbook[$errmsg])) {
-                return $app->tform->wordbook[$errmsg]."<br>\r\n";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
-        
-        
-        $ftp_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM ftp_user WHERE ftp_user_id = '".$app->db->quote($app->tform->primary_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";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
-        
-        $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(!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";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
-        
-        $doc_root = $domain_data["document_root"];
-        $is_ok = false;
-        if($doc_root == $field_value) $is_ok = true;
-        
-        $doc_root .= "/";
-        if(substr($field_value, 0, strlen($doc_root)) == $doc_root) $is_ok = true;
-		
-		if(stristr($field_value,'..') or stristr($field_value,'./') or stristr($field_value,'/.')) $is_ok = false;
-        
+
+		if($app->tform->primary_id == 0) {
+			$errmsg = $validator['errmsg'];
+			if(isset($app->tform->wordbook[$errmsg])) {
+				return $app->tform->wordbook[$errmsg]."<br>\r\n";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
+
+
+		$ftp_data = $app->db->queryOneRecord("SELECT parent_domain_id FROM ftp_user WHERE ftp_user_id = '".$app->db->quote($app->tform->primary_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";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
+
+		$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(!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";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
+
+		$doc_root = $domain_data["document_root"];
+		$is_ok = false;
+		if($doc_root == $field_value) $is_ok = true;
+
+		$doc_root .= "/";
+		if(substr($field_value, 0, strlen($doc_root)) == $doc_root) $is_ok = true;
+
+		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])) {
-                return $app->tform->wordbook[$errmsg]."<br>\r\n";
-            } else {
-                return $errmsg."<br>\r\n";
-            }
-        }
+
+		if($is_ok == false) {
+			$errmsg = $validator['errmsg'];
+			if(isset($app->tform->wordbook[$errmsg])) {
+				return $app->tform->wordbook[$errmsg]."<br>\r\n";
+			} else {
+				return $errmsg."<br>\r\n";
+			}
+		}
 	}
-	
-	
-	
-	
-}
\ No newline at end of file
+
+
+
+
+}
diff --git a/interface/lib/classes/validate_reseller.inc.php b/interface/lib/classes/validate_reseller.inc.php
index 54539050282bd5b5306ec65123d82f1fe6b2748b..c02c4fd8d2e82d4d0c11f179b46ad14eb584d7c8 100644
--- a/interface/lib/classes/validate_reseller.inc.php
+++ b/interface/lib/classes/validate_reseller.inc.php
@@ -29,19 +29,19 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class validate_reseller {
-    
-    /*
+
+	/*
         Validator function to check if a given cron command is in correct form (url only).
     */
-    function limit_client($field_name, $field_value, $validator) {
-        global $app;
-		
+	function limit_client($field_name, $field_value, $validator) {
+		global $app;
+
 		if($field_value <= 0) {
 			return $app->tform->lng('limit_client_error_positive');
 		} else {
 			return '';
 		}
-    }
+	}
+
 
-	
-}
\ No newline at end of file
+}
diff --git a/interface/lib/config.inc.php b/interface/lib/config.inc.php
index 3cd1723c2e8d91d736997badb569751fc008ff52..7de46b7be8fe0fed4eb32f723f23e3ca351365f4 100644
--- a/interface/lib/config.inc.php
+++ b/interface/lib/config.inc.php
@@ -31,16 +31,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //** Web-only
 if( !empty($_SERVER['DOCUMENT_ROOT']) ) {
 
-	Header("Pragma: no-cache");
-	Header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
-	Header("Content-Type: text/html; charset=utf-8");
+	header("Pragma: no-cache");
+	header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
+	header("Content-Type: text/html; charset=utf-8");
 
-	ini_set('register_globals',0);
+	ini_set('register_globals', 0);
 }
 
 //** SVN Revision
 $svn_revision = '$Revision: 1525 $';
-$revision = str_replace(array('Revision:','$',' '), '', $svn_revision);
+$revision = str_replace(array('Revision:', '$', ' '), '', $svn_revision);
 
 //** Application
 define('ISPC_APP_TITLE', 'ISPConfig');
@@ -58,21 +58,21 @@ $conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL:
 $conf['db_new_link'] = false;
 $conf['db_client_flags'] = 0;
 
-define('DB_TYPE',$conf['db_type']);
-define('DB_HOST',$conf['db_host']);
-define('DB_DATABASE',$conf['db_database']);
-define('DB_USER',$conf['db_user']);
-define('DB_PASSWORD',$conf['db_password']);
-define('DB_CHARSET',$conf['db_charset']);
+define('DB_TYPE', $conf['db_type']);
+define('DB_HOST', $conf['db_host']);
+define('DB_DATABASE', $conf['db_database']);
+define('DB_USER', $conf['db_user']);
+define('DB_PASSWORD', $conf['db_password']);
+define('DB_CHARSET', $conf['db_charset']);
 
 
 //** Database settings for the master DB. This setting is only used in multiserver setups
-$conf['dbmaster_type']			= 'mysql';
-$conf['dbmaster_host']			= '{mysql_master_server_host}';
-$conf['dbmaster_database']		= '{mysql_master_server_database}';
-$conf['dbmaster_user']			= '{mysql_master_server_ispconfig_user}';
-$conf['dbmaster_password']		= '{mysql_master_server_ispconfig_password}';
-$conf['dbmaster_new_link'] 		= false;
+$conf['dbmaster_type']   = 'mysql';
+$conf['dbmaster_host']   = '{mysql_master_server_host}';
+$conf['dbmaster_database']  = '{mysql_master_server_database}';
+$conf['dbmaster_user']   = '{mysql_master_server_ispconfig_user}';
+$conf['dbmaster_password']  = '{mysql_master_server_ispconfig_password}';
+$conf['dbmaster_new_link']   = false;
 $conf['dbmaster_client_flags']  = 0;
 
 
@@ -87,15 +87,15 @@ define('ISPC_WEB_TEMP_PATH', ISPC_WEB_PATH.'/temp'); // Path for downloads, acce
 define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
 
 //** Paths (Do not change!)
-$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
+$conf['rootpath'] = substr(dirname(__FILE__), 0, -4);
 $conf['fs_div'] = '/'; // File system separator (divider), "\\" on Windows and "/" on Linux and UNIX
 $conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
 $conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
 
-define('FS_DIV',$conf['fs_div']);
-define('SERVER_ROOT',$conf['rootpath']);
-define('INCLUDE_ROOT',SERVER_ROOT.FS_DIV.'lib');
-define('CLASSES_ROOT',INCLUDE_ROOT.FS_DIV.'classes');
+define('FS_DIV', $conf['fs_div']);
+define('SERVER_ROOT', $conf['rootpath']);
+define('INCLUDE_ROOT', SERVER_ROOT.FS_DIV.'lib');
+define('CLASSES_ROOT', INCLUDE_ROOT.FS_DIV.'classes');
 
 
 //** Server
@@ -110,8 +110,8 @@ $conf['server_id'] = '1';
 $conf['interface_modules_enabled'] = 'dashboard,mail,sites,dns,tools';
 
 //** Demo mode
-/* The demo mode is an option to restrict certain actions in the interface like 
-*  changing the password of users with sys_userid < 3 etc. to be 
+/* The demo mode is an option to restrict certain actions in the interface like
+*  changing the password of users with sys_userid < 3 etc. to be
 *  able to run the ISPConfig interface as online demo. It does not
 *  affect the server part. The demo mode should be always set to false
 *  on every normal installation
@@ -154,8 +154,8 @@ $conf['start_session'] = true;
 
 
 //** Constants
-define('LOGLEVEL_DEBUG',0);
-define('LOGLEVEL_WARN',1);
-define('LOGLEVEL_ERROR',2);
+define('LOGLEVEL_DEBUG', 0);
+define('LOGLEVEL_WARN', 1);
+define('LOGLEVEL_ERROR', 2);
 
 ?>
diff --git a/interface/lib/plugins/clients_template_plugin.inc.php b/interface/lib/plugins/clients_template_plugin.inc.php
index 4bf222ec12a5eff668dadb1935248d276505f97e..c4899bfa6a2437c1255c6c7d52185def3f046ac1 100644
--- a/interface/lib/plugins/clients_template_plugin.inc.php
+++ b/interface/lib/plugins/clients_template_plugin.inc.php
@@ -1,34 +1,36 @@
 <?php
 /**
  * clients_template_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG
  * @author (original tools.inc.php) Till Brehm, projektfarm Gmbh
  * @author (original tools.inc.php) Oliver Vogel www.muv.com
  */
- 
+
+
 class clients_template_plugin {
 
 	var $plugin_name        = 'clients_template_plugin';
 	var $class_name         = 'clients_template_plugin';
-	
 
-    /*
+
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('client:client:on_after_insert','clients_template_plugin','apply_client_templates');
-        $app->plugin->registerEvent('client:client:on_after_update','clients_template_plugin','apply_client_templates');
-        $app->plugin->registerEvent('client:reseller:on_after_insert','clients_template_plugin','apply_client_templates');
-        $app->plugin->registerEvent('client:reseller:on_after_update','clients_template_plugin','apply_client_templates');
-    }
-    
-    function apply_client_templates($event_name, $page_form) {
-        global $app;
-        
-        $app->uses('client_templates');
-        $app->client_templates->apply_client_templates($page_form->id);
-    }
-}
\ No newline at end of file
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('client:client:on_after_insert', 'clients_template_plugin', 'apply_client_templates');
+		$app->plugin->registerEvent('client:client:on_after_update', 'clients_template_plugin', 'apply_client_templates');
+		$app->plugin->registerEvent('client:reseller:on_after_insert', 'clients_template_plugin', 'apply_client_templates');
+		$app->plugin->registerEvent('client:reseller:on_after_update', 'clients_template_plugin', 'apply_client_templates');
+	}
+
+	function apply_client_templates($event_name, $page_form) {
+		global $app;
+
+		$app->uses('client_templates');
+		$app->client_templates->apply_client_templates($page_form->id);
+	}
+
+}
diff --git a/interface/lib/plugins/mail_user_filter_plugin.inc.php b/interface/lib/plugins/mail_user_filter_plugin.inc.php
index f376a777ac9a8e333bca73bc35bf16bd1c6e9fee..df939d376daf5e5deff7a96fff277842203a057f 100644
--- a/interface/lib/plugins/mail_user_filter_plugin.inc.php
+++ b/interface/lib/plugins/mail_user_filter_plugin.inc.php
@@ -29,44 +29,44 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class mail_user_filter_plugin {
-	
+
 	var $plugin_name = 'mail_user_filter_plugin';
 	var $class_name = 'mail_user_filter_plugin';
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugin->registerEvent('mail:mail_user_filter:on_after_insert','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mail:mail_user_filter:on_after_update','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mail:mail_user_filter:on_after_delete','mail_user_filter_plugin','mail_user_filter_del');
-		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_insert','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_update','mail_user_filter_plugin','mail_user_filter_edit');
-		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_delete','mail_user_filter_plugin','mail_user_filter_del');
-		
+
+		$app->plugin->registerEvent('mail:mail_user_filter:on_after_insert', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mail:mail_user_filter:on_after_update', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mail:mail_user_filter:on_after_delete', 'mail_user_filter_plugin', 'mail_user_filter_del');
+		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_insert', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_update', 'mail_user_filter_plugin', 'mail_user_filter_edit');
+		$app->plugin->registerEvent('mailuser:mail_user_filter:on_after_delete', 'mail_user_filter_plugin', 'mail_user_filter_del');
+
 	}
-	
-	
+
+
 	/*
-		function to create the mail filter rule and insert it into the custom rules 
+		function to create the mail filter rule and insert it into the custom rules
 		field when a new mail filter is added or modified.
 	*/
-	function mail_user_filter_edit($event_name,$page_form) {
+	function mail_user_filter_edit($event_name, $page_form) {
 		global $app, $conf;
-				
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$page_form->dataRecord["mailuser_id"]);
 		$skip = false;
-		$lines = explode("\n",$mailuser['custom_mailfilter']);
+		$lines = explode("\n", $mailuser['custom_mailfilter']);
 		$out = '';
 		$found = false;
-		
+
 		foreach($lines as $line) {
 			$line = rtrim($line);
 			if($line == '### BEGIN FILTER_ID:'.$page_form->id) {
@@ -79,27 +79,27 @@ class mail_user_filter_plugin {
 				$skip = false;
 			}
 		}
-		
+
 		// We did not found our rule, so we add it now as first rule.
 		if($found == false && $page_form->dataRecord["active"] == 'y') {
 			$new_rule = $this->mail_user_filter_get_rule($page_form);
 			$out = $new_rule . $out;
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $page_form->dataRecord["mailuser_id"]);
-		
-		
+
+
 	}
-	
-	function mail_user_filter_del($event_name,$page_form) {
+
+	function mail_user_filter_del($event_name, $page_form) {
 		global $app, $conf;
-		
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$page_form->dataRecord["mailuser_id"]);
 		$skip = false;
-		$lines = explode("\n",$mailuser['custom_mailfilter']);
+		$lines = explode("\n", $mailuser['custom_mailfilter']);
 		$out = '';
-		
+
 		foreach($lines as $line) {
 			$line = trim($line);
 			if($line == '### BEGIN FILTER_ID:'.$page_form->id) {
@@ -110,40 +110,40 @@ class mail_user_filter_plugin {
 				$skip = false;
 			}
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $page_form->dataRecord["mailuser_id"]);
 	}
-	
-	
+
+
 	/*
 		private function to create the mail filter rules in maildrop or sieve format.
 	*/
 	private function mail_user_filter_get_rule($page_form) {
-		
-		global $app,$conf;
-		
+
+		global $app, $conf;
+
 		$app->uses("getconf");
 		$mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".$app->functions->intval($page_form->dataRecord["mailuser_id"]));
-		$mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]),'mail');
-		
+		$mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]), 'mail');
+
 		if($mail_config['mail_filter_syntax'] == 'sieve') {
-			
+
 			// #######################################################
 			// Filter in Sieve Syntax
 			// #######################################################
-			
+
 			$content = '';
 			$content .= '### BEGIN FILTER_ID:'.$page_form->id."\n";
-			
+
 			//$content .= 'require ["fileinto", "regex", "vacation"];'."\n";
-			
+
 			$content .= 'if header :regex    ["'.strtolower($page_form->dataRecord["source"]).'"] ["';
-			
+
 			$searchterm = preg_quote($page_form->dataRecord["searchterm"]);
-			$searchterm = str_replace('\\[','\\\\[',$searchterm);
-			$searchterm = str_replace('\\]','\\\\]',$searchterm);
-			
+			$searchterm = str_replace('\\[', '\\\\[', $searchterm);
+			$searchterm = str_replace('\\]', '\\\\]', $searchterm);
+
 			if($page_form->dataRecord["op"] == 'contains') {
 				$content .= ".*".$searchterm;
 			} elseif ($page_form->dataRecord["op"] == 'is') {
@@ -153,21 +153,21 @@ class mail_user_filter_plugin {
 			} elseif ($page_form->dataRecord["op"] == 'ends') {
 				$content .= ".*".$searchterm."$";
 			}
-			
+
 			$content .= '"] {'."\n";
-			
+
 			if($page_form->dataRecord["action"] == 'move') {
 				$content .= '    fileinto "'.$page_form->dataRecord["target"].'";' . "\n";
 			} else {
 				$content .= "    discard;\n";
 			}
-			
+
 			$content .= "    stop;\n}\n";
-			
+
 			$content .= '### END FILTER_ID:'.$page_form->id."\n";
-		
+
 		} else {
-		
+
 			// #######################################################
 			// Filter in Maildrop Syntax
 			// #######################################################
@@ -187,7 +187,7 @@ class mail_user_filter_plugin {
 
 			if($page_form->dataRecord["action"] == 'move') {
 
-			$content .= "
+				$content .= "
 `test -e ".$TestChDirQuotes." && exit 1 || exit 0`
 if ( ".'$RETURNCODE'." != 1 )
 {
@@ -224,19 +224,19 @@ if ( ".'$RETURNCODE'." != 1 )
 
 			$content .= "}\n";
 			$content .= "}\n";
-		
+
 			//}
-		
+
 			$content .= '### END FILTER_ID:'.$page_form->id."\n";
-		
+
 		}
-		
+
 		return $content;
 	}
-	
+
 
 } // end class
 
 
 
-?>
\ No newline at end of file
+?>
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 791ee593b68a647887a6db7def278dc638a1f0ec..1a880a1b10a0cd4d67cdc9861dbf917839b01c96 100644
--- a/interface/lib/plugins/sites_web_database_user_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_database_user_plugin.inc.php
@@ -1,41 +1,43 @@
 <?php
 /**
  * sites_web_database_user_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012
  */
- 
+
+
 class sites_web_database_user_plugin {
 
 	var $plugin_name        = 'sites_web_database_user_plugin';
 	var $class_name         = 'sites_web_database_user_plugin';
-	
-    /*
+
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('sites:web_database_user:on_after_update','sites_web_database_user_plugin','sites_web_database_user_edit');
-        $app->plugin->registerEvent('sites:web_database_user:on_after_insert','sites_web_database_user_plugin','sites_web_database_user_edit');
-    }
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('sites:web_database_user:on_after_update', 'sites_web_database_user_plugin', 'sites_web_database_user_edit');
+		$app->plugin->registerEvent('sites:web_database_user:on_after_insert', 'sites_web_database_user_plugin', 'sites_web_database_user_edit');
+	}
 
-    /*
-		Function to create the sites_web_database_user rule and insert it into the custom rules           
+	/*
+		Function to create the sites_web_database_user rule and insert it into the custom rules
     */
-    function sites_web_database_user_edit($event_name, $page_form) {
-        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 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);
-        }
-        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && 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 = '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);
+	function sites_web_database_user_edit($event_name, $page_form) {
+		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 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);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && 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 = '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);
 	}
-}              	
\ No newline at end of file
+
+}
diff --git a/interface/lib/plugins/sites_web_domain_plugin.inc.php b/interface/lib/plugins/sites_web_domain_plugin.inc.php
index a21c56fa0444f0bc41794b098379ebe2571eed26..a84857aa8c023d0c40cc5992506fa73d5baeed34 100644
--- a/interface/lib/plugins/sites_web_domain_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_domain_plugin.inc.php
@@ -1,20 +1,21 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
  */
- 
+
+
 class sites_web_domain_plugin {
 
 	var $plugin_name        = 'sites_web_domain_plugin';
 	var $class_name         = 'sites_web_domain_plugin';
-	
+
 	// TODO: This function is a duplicate from the one in interface/web/sites/web_domain_edit.php
 	//       There should be a single "token replacement" function to be called from modules and
-	//	 from the main code.
+	//  from the main code.
 	// Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -26,67 +27,68 @@ class sites_web_domain_plugin {
 		return $hash;
 	}
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        $app->plugin->registerEvent('sites:web_domain:on_after_insert','sites_web_domain_plugin','sites_web_domain_edit');
-    }
+	function onLoad() {
+		global $app;
+		//Register for the events
+		$app->plugin->registerEvent('sites:web_domain:on_after_insert', 'sites_web_domain_plugin', 'sites_web_domain_edit');
+	}
 
-    /*
-		Function to create the sites_web_domain rule and insert it into the custom rules           
+	/*
+		Function to create the sites_web_domain rule and insert it into the custom rules
     */
-    function sites_web_domain_edit($event_name, $page_form) {
-        global $app, $conf;   
-        // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
-        // also make sure that the user can not delete domain created by a admin
-        if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id);
-        }
-        if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
-            $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
-            $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$page_form->id);
-        }
-        // Get configuration for the web system
-        $app->uses("getconf");        
-        $web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']),'web');            
-        $document_root = str_replace("[website_id]",$page_form->id,$web_config["website_path"]);
-		$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
-		
-        // get the ID of the client
-        if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {                    
-            $client_group_id = $_SESSION["s"]["user"]["default_group"];
-            $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
-            $client_id = $app->functions->intval($client["client_id"]);
-        } else {                
-            //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]);
-            $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($page_form->dataRecord["client_group_id"]));
-            $client_id = $app->functions->intval($client["client_id"]);
-        }
+	function sites_web_domain_edit($event_name, $page_form) {
+		global $app, $conf;
+		// make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it
+		// also make sure that the user can not delete domain created by a admin
+		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id);
+		}
+		if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) {
+			$client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]);
+			$app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$page_form->id);
+		}
+		// Get configuration for the web system
+		$app->uses("getconf");
+		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web');
+		$document_root = str_replace("[website_id]", $page_form->id, $web_config["website_path"]);
+		$document_root = str_replace("[website_idhash_1]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_2]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_3]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_4]", $this->id_hash($page_form->id, 1), $document_root);
+
+		// get the ID of the client
+		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id");
+			$client_id = $app->functions->intval($client["client_id"]);
+		} else {
+			//$client_id = $app->functions->intval($this->dataRecord["client_group_id"]);
+			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($page_form->dataRecord["client_group_id"]));
+			$client_id = $app->functions->intval($client["client_id"]);
+		}
+
+		// Set the values for document_root, system_user and system_group
+		$system_user     = $app->db->quote('web'.$page_form->id);
+		$system_group     = $app->db->quote('client'.$client_id);
+
+		$document_root     = str_replace("[client_id]", $client_id, $document_root);
+		$document_root    = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root);
+		$document_root    = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root);
+		$document_root    = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root);
+		$document_root    = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root);
+		$document_root     = $app->db->quote($document_root);
+
+		$php_open_basedir    = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
+		$php_open_basedir    = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir));
+
+		$htaccess_allow_override  = $app->db->quote($web_config["htaccess_allow_override"]);
 
-        // Set the values for document_root, system_user and system_group
-        $system_user 				= $app->db->quote('web'.$page_form->id);
-        $system_group 				= $app->db->quote('client'.$client_id);
-		
-		$document_root 				= str_replace("[client_id]",$client_id,$document_root);
-		$document_root				= str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
-		$document_root				= str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
-		$document_root				= str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
-		$document_root				= str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
-		$document_root 				= $app->db->quote($document_root);
-        
-		$php_open_basedir 			= str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
-        $php_open_basedir 			= $app->db->quote(str_replace("[website_domain]",$page_form->dataRecord['domain'],$php_open_basedir));
-		
-		$htaccess_allow_override 	= $app->db->quote($web_config["htaccess_allow_override"]);
-        
 		$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$page_form->id;
 		$app->db->query($sql);
 	}
-}              	
\ No newline at end of file
+
+}
diff --git a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
index e4de54a5e7668069936f0d9ece83c9febb78f428..e28c184eef9f42eb621dad9b127c200250c15bf1 100644
--- a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
+++ b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php
@@ -1,21 +1,22 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG 2012, copied and adapted from web_domain plugin by:
  * @author Julio Montoya <gugli100@gmail.com> BeezNest 2010
  */
- 
+
+
 class sites_web_vhost_subdomain_plugin {
 
 	var $plugin_name        = 'sites_web_vhost_subdomain_plugin';
 	var $class_name         = 'sites_web_vhost_subdomain_plugin';
-	
+
 	// TODO: This function is a duplicate from the one in interface/web/sites/web_vhost_subdomain_edit.php
 	//       There should be a single "token replacement" function to be called from modules and
-	//	 from the main code.
+	//  from the main code.
 	// Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -27,40 +28,41 @@ class sites_web_vhost_subdomain_plugin {
 		return $hash;
 	}
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        //Register for the events        
-        // both event call the same function as the things to do do not differ here
-        $app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_insert','sites_web_vhost_subdomain_plugin','sites_web_vhost_subdomain_edit');
-        $app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_update','sites_web_vhost_subdomain_plugin','sites_web_vhost_subdomain_edit');
-    }
+	function onLoad() {
+		global $app;
+		//Register for the events
+		// both event call the same function as the things to do do not differ here
+		$app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_insert', 'sites_web_vhost_subdomain_plugin', 'sites_web_vhost_subdomain_edit');
+		$app->plugin->registerEvent('sites:web_vhost_subdomain:on_after_update', 'sites_web_vhost_subdomain_plugin', 'sites_web_vhost_subdomain_edit');
+	}
 
-    /*
-		Function to create the sites_web_vhost_subdomain rule and insert it into the custom rules           
+	/*
+		Function to create the sites_web_vhost_subdomain rule and insert it into the custom rules
     */
-    function sites_web_vhost_subdomain_edit($event_name, $page_form) {
-        global $app, $conf;   
-        
+	function sites_web_vhost_subdomain_edit($event_name, $page_form) {
+		global $app, $conf;
+
 		// Get configuration for the web system
-        $app->uses("getconf");        
-		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']),'web');            
-        
-        $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
-        
+		$app->uses("getconf");
+		$web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']), 'web');
+
+		$parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($page_form->dataRecord['parent_domain_id']) . "'");
+
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote($parent_domain['system_user']);
 		$system_group = $app->db->quote($parent_domain['system_group']);
 		$document_root = $app->db->quote($parent_domain['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$page_form->dataRecord['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$page_form->dataRecord['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$page_form->dataRecord['web_folder'], $web_config["php_open_basedir"]);
+		$php_open_basedir = str_replace("[website_domain]/web", $page_form->dataRecord['domain'].'/'.$page_form->dataRecord['web_folder'], $php_open_basedir);
+		$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $page_form->dataRecord['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($parent_domain['allow_override']);
 
 		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$page_form->id;
 		$app->db->query($sql);
 	}
-}              	
\ No newline at end of file
+
+}
diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php
index 0e8696e162bbcd604455e6120c8ceaa89e55e731..98b0f9f422a86397abb01f72fdc21e55d5879e34 100644
--- a/interface/lib/plugins/vm_openvz_plugin.inc.php
+++ b/interface/lib/plugins/vm_openvz_plugin.inc.php
@@ -1,10 +1,11 @@
 <?php
 /**
  * sites_web_domain_plugin plugin
- * 
+ *
  * @author Till Brehm, projektfarm GmbH
  */
- 
+
+
 class vm_openvz_plugin {
 
 	var $plugin_name        = 'vm_openvz_plugin';
@@ -14,28 +15,28 @@ class vm_openvz_plugin {
 	var $oldDataRecord = array();
 
 
-    /*
+	/*
             This function is called when the plugin is loaded
     */
-    function onLoad() {
-        global $app;
-        
-		//* Register for events        
-        $app->plugin->registerEvent('vm:openvz_vm:on_after_insert','vm_openvz_plugin','openvz_vm_insert');
-		$app->plugin->registerEvent('vm:openvz_vm:on_after_update','vm_openvz_plugin','openvz_vm_update');
-		$app->plugin->registerEvent('vm:openvz_vm:on_after_delete','vm_openvz_plugin','openvz_vm_delete');
-    }
-
-    /*
-		Function that gets called after a new vm was inserted           
+	function onLoad() {
+		global $app;
+
+		//* Register for events
+		$app->plugin->registerEvent('vm:openvz_vm:on_after_insert', 'vm_openvz_plugin', 'openvz_vm_insert');
+		$app->plugin->registerEvent('vm:openvz_vm:on_after_update', 'vm_openvz_plugin', 'openvz_vm_update');
+		$app->plugin->registerEvent('vm:openvz_vm:on_after_delete', 'vm_openvz_plugin', 'openvz_vm_delete');
+	}
+
+	/*
+		Function that gets called after a new vm was inserted
     */
-    function openvz_vm_insert($event_name, $page_form) {
-        global $app, $conf;  
+	function openvz_vm_insert($event_name, $page_form) {
+		global $app, $conf;
 
 		$this->id = $page_form->id;
-		$this->dataRecord = $page_form->dataRecord;	
-		$this->oldDataRecord = $page_form->oldDataRecord;	
-        
+		$this->dataRecord = $page_form->dataRecord;
+		$this->oldDataRecord = $page_form->oldDataRecord;
+
 		// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
 		// also make sure that the user can not delete domain created by a admin
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -46,37 +47,37 @@ class vm_openvz_plugin {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
 		}
-		
+
 		// Set the VEID
 		$tmp = $app->db->queryOneRecord('SELECT MAX(veid) + 1 as newveid FROM openvz_vm');
 		$veid = ($tmp['newveid'] > 100)?$tmp['newveid']:101;
 		$app->db->query("UPDATE openvz_vm SET veid = ".$veid." WHERE vm_id = ".$this->id);
 		unset($tmp);
-		
+
 		// Apply template values to the advanced tab settings
 		$this->applyTemplate();
-		
+
 		// Set the IP address
 		$app->db->query("UPDATE openvz_ip SET vm_id = ".$this->id." WHERE ip_address = '".$this->dataRecord['ip_address']."'");
-		
+
 		// Create the OpenVZ config file and store it in config field
 		$this->makeOpenVZConfig();
-		
+
 		// Create the DNS record
 		$this->createDNS();
-		
+
 	}
-	
+
 	/*
-		Function that gets called after a vm was updated          
+		Function that gets called after a vm was updated
     */
-    function openvz_vm_update($event_name, $page_form) {
-        global $app, $conf;
-		
+	function openvz_vm_update($event_name, $page_form) {
+		global $app, $conf;
+
 		$this->id = $page_form->id;
 		$this->dataRecord = $page_form->dataRecord;
-		$this->oldDataRecord = $page_form->oldDataRecord;	
-		
+		$this->oldDataRecord = $page_form->oldDataRecord;
+
 		// make sure that the record belongs to the clinet group and not the admin group when a admin inserts it
 		// also make sure that the user can not delete domain created by a admin
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -87,40 +88,40 @@ class vm_openvz_plugin {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id);
 		}
-		
+
 		if(isset($this->dataRecord["ostemplate_id"]) && $this->oldDataRecord["ostemplate_id"] != $this->dataRecord["ostemplate_id"]) {
 			$this->applyTemplate();
 		}
-		
+
 		// Set the IP address
 		if(isset($this->dataRecord['ip_address'])) $app->db->query("UPDATE openvz_ip SET vm_id = ".$this->id." WHERE ip_address = '".$this->dataRecord['ip_address']."'");
-		
+
 		// Create the OpenVZ config file and store it in config field
 		$this->makeOpenVZConfig();
-		
+
 		// Create the DNS record
-		if((isset($this->dataRecord['hostname']) && $this->dataRecord['hostname'] != $this->oldDataRecord['hostname']) 
-		or (isset($this->dataRecord['create_dns']) && $this->dataRecord['create_dns'] != $this->oldDataRecord['create_dns'])) {
+		if((isset($this->dataRecord['hostname']) && $this->dataRecord['hostname'] != $this->oldDataRecord['hostname'])
+			or (isset($this->dataRecord['create_dns']) && $this->dataRecord['create_dns'] != $this->oldDataRecord['create_dns'])) {
 			$this->createDNS();
 		}
-        
+
 	}
-	
+
 	function openvz_vm_delete($event_name, $page_form) {
-        global $app, $conf;
-		
+		global $app, $conf;
+
 		//* Free the IP address
 		$tmp = $app->db->queryOneRecord("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ".$page_form->id);
 		$app->db->datalogUpdate('openvz_ip', 'vm_id = 0', 'ip_address_id', $tmp['ip_address_id']);
 		unset($tmp);
-		
+
 	}
-	
+
 	private function applyTemplate() {
 		global $app, $conf;
-		
+
 		$tpl = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$this->dataRecord["template_id"]);
-		
+
 		$sql = "UPDATE openvz_vm SET ";
 		$sql .= "diskspace = '".$tpl['diskspace']."', ";
 		$sql .= "ram = '".$tpl['ram']."', ";
@@ -134,113 +135,113 @@ class vm_openvz_plugin {
 		$sql .= "capability = '".$tpl['capability']."' ";
 		$sql .= "WHERE vm_id = ".$this->id;
 		$app->db->query($sql);
-		
+
 	}
-	
+
 	private function makeOpenVZConfig() {
 		global $app, $conf;
-		
+
 		$vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ".$this->id);
 		$vm_template = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$vm['template_id']);
 		$burst_ram = $vm['ram_burst']*256;
 		$guar_ram = $vm['ram']*256;
-		
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('../vm/templates/openvz.conf.tpl');
-		
+
 		$onboot = ($vm['start_boot'] == 'y')?'yes':'no';
-		$tpl->setVar('onboot',$onboot);
-		
-		$tpl->setVar('kmemsize',$vm_template['kmemsize']);
-		$tpl->setVar('lockedpages',$vm_template['lockedpages']);
-		$tpl->setVar('privvmpages',$burst_ram.':'.$burst_ram);
-		$tpl->setVar('shmpages',$guar_ram.':'.$guar_ram);
-		$tpl->setVar('numproc',$vm_template['numproc']);
-		$tpl->setVar('physpages',$vm_template['physpages']);
-		$tpl->setVar('vmguarpages',$guar_ram.':'.$guar_ram);
-		$tpl->setVar('oomguarpages',$guar_ram.':'.$guar_ram);
-		$tpl->setVar('numtcpsock',$vm_template['numtcpsock']);
-		$tpl->setVar('numflock',$vm_template['numflock']);
-		$tpl->setVar('numpty',$vm_template['numpty']);
-		$tpl->setVar('numsiginfo',$vm_template['numsiginfo']);
-		$tpl->setVar('tcpsndbuf',$vm_template['tcpsndbuf']);
-		$tpl->setVar('tcprcvbuf',$vm_template['tcprcvbuf']);
-		$tpl->setVar('othersockbuf',$vm_template['othersockbuf']);
-		$tpl->setVar('dgramrcvbuf',$vm_template['dgramrcvbuf']);
-		$tpl->setVar('numothersock',$vm_template['numothersock']);
-		$tpl->setVar('dcachesize',$vm_template['dcachesize']);
-		$tpl->setVar('numfile',$vm_template['numfile']);
-		$tpl->setVar('avnumproc',$vm_template['avnumproc']);
-		$tpl->setVar('numiptent',$vm_template['numiptent']);
-		$tpl->setVar('swappages',$vm_template['swappages']);
-		
+		$tpl->setVar('onboot', $onboot);
+
+		$tpl->setVar('kmemsize', $vm_template['kmemsize']);
+		$tpl->setVar('lockedpages', $vm_template['lockedpages']);
+		$tpl->setVar('privvmpages', $burst_ram.':'.$burst_ram);
+		$tpl->setVar('shmpages', $guar_ram.':'.$guar_ram);
+		$tpl->setVar('numproc', $vm_template['numproc']);
+		$tpl->setVar('physpages', $vm_template['physpages']);
+		$tpl->setVar('vmguarpages', $guar_ram.':'.$guar_ram);
+		$tpl->setVar('oomguarpages', $guar_ram.':'.$guar_ram);
+		$tpl->setVar('numtcpsock', $vm_template['numtcpsock']);
+		$tpl->setVar('numflock', $vm_template['numflock']);
+		$tpl->setVar('numpty', $vm_template['numpty']);
+		$tpl->setVar('numsiginfo', $vm_template['numsiginfo']);
+		$tpl->setVar('tcpsndbuf', $vm_template['tcpsndbuf']);
+		$tpl->setVar('tcprcvbuf', $vm_template['tcprcvbuf']);
+		$tpl->setVar('othersockbuf', $vm_template['othersockbuf']);
+		$tpl->setVar('dgramrcvbuf', $vm_template['dgramrcvbuf']);
+		$tpl->setVar('numothersock', $vm_template['numothersock']);
+		$tpl->setVar('dcachesize', $vm_template['dcachesize']);
+		$tpl->setVar('numfile', $vm_template['numfile']);
+		$tpl->setVar('avnumproc', $vm_template['avnumproc']);
+		$tpl->setVar('numiptent', $vm_template['numiptent']);
+		$tpl->setVar('swappages', $vm_template['swappages']);
+
 		$diskspace = $vm['diskspace']*1048576;
 		$diskinodes = $vm['diskspace']*524288;
-		
-		$tpl->setVar('diskspace',$diskspace.":".$diskspace);
-		$tpl->setVar('diskinodes',$diskinodes.":".$diskinodes);
-		$tpl->setVar('io_priority',$vm['io_priority']);
-		
-		$tpl->setVar('cpu_num',$vm['cpu_num']);
-		$tpl->setVar('cpu_units',$vm['cpu_units']);
-		$tpl->setVar('cpu_limit',$vm['cpu_limit']);
-		
-		$hostname = str_replace('{VEID}',$vm['veid'],$vm['hostname']);
-		
-		$tpl->setVar('hostname',$hostname);
-		$tpl->setVar('ip_address',$vm['ip_address']);
-		$tpl->setVar('nameserver',$vm['nameserver']);
-		$tpl->setVar('capability',$vm['capability']);
-		
+
+		$tpl->setVar('diskspace', $diskspace.":".$diskspace);
+		$tpl->setVar('diskinodes', $diskinodes.":".$diskinodes);
+		$tpl->setVar('io_priority', $vm['io_priority']);
+
+		$tpl->setVar('cpu_num', $vm['cpu_num']);
+		$tpl->setVar('cpu_units', $vm['cpu_units']);
+		$tpl->setVar('cpu_limit', $vm['cpu_limit']);
+
+		$hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']);
+
+		$tpl->setVar('hostname', $hostname);
+		$tpl->setVar('ip_address', $vm['ip_address']);
+		$tpl->setVar('nameserver', $vm['nameserver']);
+		$tpl->setVar('capability', $vm['capability']);
+
 		$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$vm['ostemplate_id']);
-		$tpl->setVar('ostemplate',$tmp['template_file']);
+		$tpl->setVar('ostemplate', $tmp['template_file']);
 		unset($tmp);
-		
+
 		$openvz_config = $app->db->quote($tpl->grab());
 		$app->db->query("UPDATE openvz_vm SET config = '".$openvz_config."' WHERE vm_id = ".$this->id);
-		
+
 		unset($tpl);
-		
+
 	}
-	
+
 	private function createDNS() {
 		global $app, $conf;
-		
+
 		$vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ".$this->id);
-		
+
 		if($vm['create_dns'] != 'y') return;
-		
-		$full_hostname = str_replace('{VEID}',$vm['veid'],$vm['hostname']);
-		$hostname_parts = explode('.',$full_hostname);
+
+		$full_hostname = str_replace('{VEID}', $vm['veid'], $vm['hostname']);
+		$hostname_parts = explode('.', $full_hostname);
 		$hostname = $hostname_parts[0];
 		unset($hostname_parts[0]);
-		$zone = implode('.',$hostname_parts);
+		$zone = implode('.', $hostname_parts);
 		unset($hostname_parts);
-		
+
 		// Find the dns zone
 		$zone_rec = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE origin = '$zone.'");
 		$rr_rec = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = '".$zone_rec['id']."' AND name = '$hostname'");
-		
+
 		if($zone_rec['id'] > 0) {
 			$ip_address = $vm['ip_address'];
 			$sys_userid = $zone_rec['sys_userid'];
 			$sys_groupid = $zone_rec['sys_groupid'];
 			$server_id = $zone_rec['server_id'];
 			$dns_soa_id = $zone_rec['id'];
-			
+
 			if($rr_rec['id'] > 0) {
 				$app->uses('validate_dns');
 				$app->db->datalogUpdate('dns_rr', "data = '$ip_address'", 'id', $rr_rec['id']);
 				$serial = $app->validate_dns->increase_serial($zone_rec['serial']);
 				$app->db->datalogUpdate('dns_soa', "serial = '$serial'", 'id', $zone_rec['id']);
 			} else {
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 				('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$hostname', 'A', '$ip_address', '0', '3600', 'Y')";
 				$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 			}
-			
+
 		}
 	}
 
-}              	
\ No newline at end of file
+}
diff --git a/interface/web/admin/directive_snippets_del.php b/interface/web/admin/directive_snippets_del.php
index ee1ab8b273cd67ed7b897514ea8f4ae2e6b532e8..551634f0a8664891eefe10e733e8acc350ca7d40 100644
--- a/interface/web/admin/directive_snippets_del.php
+++ b/interface/web/admin/directive_snippets_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/directive_snippets.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('admin');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/directive_snippets_edit.php b/interface/web/admin/directive_snippets_edit.php
index 317dc58bbcd0f37e38b80358dbe3d2de94f8aa99..06cea79fff9420dcd7b46ab9fd95746c111ecf35 100644
--- a/interface/web/admin/directive_snippets_edit.php
+++ b/interface/web/admin/directive_snippets_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/directive_snippets.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,4 +50,4 @@ $app->uses('tpl,tform,tform_actions');
 // let tform_actions handle the page
 $app->tform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/directive_snippets_list.php b/interface/web/admin/directive_snippets_list.php
index 4f411942cefad2f1c42ded4c68db8ca9f07813c5..5fb75c75937b64f3dfa797ed2a22d42747fea94f 100644
--- a/interface/web/admin/directive_snippets_list.php
+++ b/interface/web/admin/directive_snippets_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/firewall_del.php b/interface/web/admin/firewall_del.php
index 0df60d19f669a94b595731a0f97ea03ea50c3836..c4ea5605c7d968c44980c1dd34a047d65de6ef0c 100644
--- a/interface/web/admin/firewall_del.php
+++ b/interface/web/admin/firewall_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/firewall.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('admin');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/firewall_edit.php b/interface/web/admin/firewall_edit.php
index 03e0deff184f60b574fca654b15f6c01d42ee03f..d0c35db8e8e2a421ff7876e4c223712e26d2550d 100644
--- a/interface/web/admin/firewall_edit.php
+++ b/interface/web/admin/firewall_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/firewall.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -64,9 +64,10 @@ class page_action extends tform_actions {
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/firewall_list.php b/interface/web/admin/firewall_list.php
index d958f4503395adabb43b5e0c5b8acf33b2ec2c7f..3d390504e2e76f0f3c04becb67900f7c3e4263c8 100644
--- a/interface/web/admin/firewall_list.php
+++ b/interface/web/admin/firewall_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/dbsync.tform.php b/interface/web/admin/form/dbsync.tform.php
index 27ad1f665bab0803648bd420e72d07c021db6491..8a4181b88870045b8b839c686bb67913db67bd6f 100644
--- a/interface/web/admin/form/dbsync.tform.php
+++ b/interface/web/admin/form/dbsync.tform.php
@@ -62,14 +62,14 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 //* Load modules
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != "." && $file != "..") {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != "." && $file != "..") {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
 				$modules_list[$file] = $file;
 			}
-        }
+		}
 	}
 }
 closedir($handle);
@@ -77,10 +77,10 @@ closedir($handle);
 //* read data bases in with more activated db_history.
 $db_tables = array();
 foreach($modules_list as $md) {
-	$handle = @opendir(ISPC_WEB_PATH."/$md/form"); 
-	while ($file = @readdir ($handle)) { 
-    	if ($file != '.' && $file != '..' && substr($file, 0, 1) != '.') {
-        	include_once(ISPC_WEB_PATH."/$md/form/$file");
+	$handle = @opendir(ISPC_WEB_PATH."/$md/form");
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..' && substr($file, 0, 1) != '.') {
+			include_once ISPC_WEB_PATH."/$md/form/$file";
 			if(isset($form['db_history']) && $form['db_history'] == 'yes') {
 				$tmp_id = $form['db_table'];
 				$db_tables[$tmp_id] = $form['db_table'];
@@ -105,160 +105,160 @@ $form['auth']           = 'no';
 
 
 $form['tabs']['dbsync'] = array (
-    'title'     => 'DB sync',
-    'width'     => 80,
-    'template'  => 'templates/dbsync_edit.htm',
-    'fields'    => array (
-    ##################################
-    # Beginn Datenbankfelder
-    ##################################
-        'jobname' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '/^.{1,30}$/',
-            'errmsg'    => 'jobname_err',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '15',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'sync_interval_minutes' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '15',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => array('mysql' => 'mysql'),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_host' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_name' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_username' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_password' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'db_tables' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'CHECKBOXARRAY',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => 'admin,forms',
-            'value'     => $db_tables,
-            'separator' => ',',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'empty_datalog' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'CHECKBOX',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => array(0 => 0,1 => 1),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'sync_datalog_external' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'CHECKBOX',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '',
-            'value'     => array(0 => 0,1 => 1),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'active' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'CHECKBOX',
-            'regex'     => '',
-            'errmsg'    => '',
-            'default'   => '1',
-            'value'     => array(0 => 0,1 => 1),
-            'separator' => '',
-            'width'     => '30',
-            'maxlength' => '255',
-            'rows'      => '',
-            'cols'      => ''
-        )
-    ##################################
-    # ENDE Datenbankfelder
-    ##################################
-    )
+	'title'     => 'DB sync',
+	'width'     => 80,
+	'template'  => 'templates/dbsync_edit.htm',
+	'fields'    => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
+		'jobname' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '/^.{1,30}$/',
+			'errmsg'    => 'jobname_err',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '15',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'sync_interval_minutes' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '15',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => array('mysql' => 'mysql'),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_host' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_name' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_username' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_password' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'db_tables' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'CHECKBOXARRAY',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => 'admin,forms',
+			'value'     => $db_tables,
+			'separator' => ',',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'empty_datalog' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'CHECKBOX',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'sync_datalog_external' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'CHECKBOX',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '',
+			'value'     => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'active' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'CHECKBOX',
+			'regex'     => '',
+			'errmsg'    => '',
+			'default'   => '1',
+			'value'     => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'     => '30',
+			'maxlength' => '255',
+			'rows'      => '',
+			'cols'      => ''
+		)
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
+	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/directive_snippets.tform.php b/interface/web/admin/form/directive_snippets.tform.php
index b41e0e4d7860dbb7cbfae16c25ecc367c7e58937..2af05af6c3e2824a57d62dd116fd1a2e07dac890 100644
--- a/interface/web/admin/form/directive_snippets.tform.php
+++ b/interface/web/admin/form/directive_snippets.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Directive Snippets";
-$form["description"] 	= "";
-$form["name"] 			= "directive_snippets";
-$form["action"]			= "directive_snippets_edit.php";
-$form["db_table"]		= "directive_snippets";
-$form["db_table_idx"]	= "directive_snippets_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "directive_snippets";
-$form["list_default"]	= "directive_snippets_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Directive Snippets";
+$form["description"]  = "";
+$form["name"]    = "directive_snippets";
+$form["action"]   = "directive_snippets_edit.php";
+$form["db_table"]  = "directive_snippets";
+$form["db_table_idx"] = "directive_snippets_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "directive_snippets";
+$form["list_default"] = "directive_snippets_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,54 +56,54 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['directive_snippets'] = array (
-	'title' 	=> "Directive Snippets",
-	'width' 	=> 100,
-	'template' 	=> "templates/directive_snippets_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Directive Snippets",
+	'width'  => 100,
+	'template'  => "templates/directive_snippets_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 =>  array (    'type'	=> 'NOTEMPTY',
-                                                         'errmsg'=> 'directive_snippets_name_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'directive_snippets_name_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 =>  array (    'type' => 'NOTEMPTY',
+					'errmsg'=> 'directive_snippets_name_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'directive_snippets_name_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('apache' => 'Apache','nginx' => 'nginx','php' => 'PHP','proxy' => 'Proxy'),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP', 'proxy' => 'Proxy'),
 			'searchable' => 2
 		),
 		'snippet' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/filesync.tform.php b/interface/web/admin/form/filesync.tform.php
index 45d081a7d43415c4504513550256d7c983bb5e24..0dfa5b125a439b50a46c68e6e5620da04192497f 100644
--- a/interface/web/admin/form/filesync.tform.php
+++ b/interface/web/admin/form/filesync.tform.php
@@ -60,146 +60,146 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 			= "Datei Synchronisation";
-$form["description"] 	= "Formular zum Anlegen von Datei-Synchronisierungen.";
-$form["name"] 			= "filesync";
-$form["action"]			= "filesync_edit.php";
-$form["db_table"]		= "sys_filesync";
-$form["db_table_idx"]	= "id";
-$form["tab_default"]	= "filesync";
-$form["list_default"]	= "filesync_list.php";
-$form["auth"]			= 'no';
+$form["title"]    = "Datei Synchronisation";
+$form["description"]  = "Formular zum Anlegen von Datei-Synchronisierungen.";
+$form["name"]    = "filesync";
+$form["action"]   = "filesync_edit.php";
+$form["db_table"]  = "sys_filesync";
+$form["db_table_idx"] = "id";
+$form["tab_default"] = "filesync";
+$form["list_default"] = "filesync_list.php";
+$form["auth"]   = 'no';
 
 
 $form["tabs"]['filesync'] = array (
-	'title' 	=> "Datei sync",
-	'width' 	=> 80,
-	'template' 	=> "templates/filesync_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Datei sync",
+	'width'  => 80,
+	'template'  => "templates/filesync_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'jobname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '/^.{1,30}$/',
-			'errmsg'	=> 'jobname_err',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '/^.{1,30}$/',
+			'errmsg' => 'jobname_err',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'sync_interval_minutes' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_host' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ftp_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'local_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'wput_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '--timestamping --dont-continue',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '--timestamping --dont-continue',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '1',
-			'value'		=> array(0 => 0,1 => 1),
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '1',
+			'value'  => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/firewall.tform.php b/interface/web/admin/form/firewall.tform.php
index c5209fcb18b9c6d9fbe2617e30673f15c616f3ba..0bef6ebcc0b16066dff4ad061087e8972f62a21a 100644
--- a/interface/web/admin/form/firewall.tform.php
+++ b/interface/web/admin/form/firewall.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Firewall";
-$form["description"] 	= "";
-$form["name"] 			= "firewall";
-$form["action"]			= "firewall_edit.php";
-$form["db_table"]		= "firewall";
-$form["db_table_idx"]	= "firewall_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "firewall";
-$form["list_default"]	= "firewall_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Firewall";
+$form["description"]  = "";
+$form["name"]    = "firewall";
+$form["action"]   = "firewall_edit.php";
+$form["db_table"]  = "firewall";
+$form["db_table_idx"] = "firewall_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "firewall";
+$form["list_default"] = "firewall_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,62 +51,62 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['firewall'] = array (
-	'title' 	=> "Firewall",
-	'width' 	=> 100,
-	'template' 	=> "templates/firewall_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Firewall",
+	'width'  => 100,
+	'template'  => "templates/firewall_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'firewall_error_unique'),
-									),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'firewall_error_unique'),
+			),
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'tcp_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\s0-9\,\:]{0,255}$/',
-														'errmsg'=> 'tcp_ports_error_regex'),
-									),
-			'default'	=> '20,21,22,25,53,80,110,143,443,993,995,3306,8080,8081,10000',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\s0-9\,\:]{0,255}$/',
+					'errmsg'=> 'tcp_ports_error_regex'),
+			),
+			'default' => '20,21,22,25,53,80,110,143,443,993,995,3306,8080,8081,10000',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'udp_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\s0-9\,\:]{0,255}$/',
-														'errmsg'=> 'tcp_ports_error_regex'),
-									),
-			'default'	=> '53,3306',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\s0-9\,\:]{0,255}$/',
+					'errmsg'=> 'tcp_ports_error_regex'),
+			),
+			'default' => '53,3306',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/groups.tform.php b/interface/web/admin/form/groups.tform.php
index ce78a66354c0a12404743b5d4ab6a998327872ea..c7b3f74fdb37c793f321e809317b3a0ae9d7da65 100644
--- a/interface/web/admin/form/groups.tform.php
+++ b/interface/web/admin/form/groups.tform.php
@@ -59,54 +59,54 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 			= "Groups";
-$form["description"] 	= "groups_description";
-$form["name"] 			= "groups";
-$form["action"]			= "groups_edit.php";
-$form["db_table"]		= "sys_group";
-$form["db_table_idx"]	= "groupid";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "groups";
-$form["list_default"]	= "groups_list.php";
-$form["auth"]			= 'no';
+$form["title"]    = "Groups";
+$form["description"]  = "groups_description";
+$form["name"]    = "groups";
+$form["action"]   = "groups_edit.php";
+$form["db_table"]  = "sys_group";
+$form["db_table_idx"] = "groupid";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "groups";
+$form["list_default"] = "groups_list.php";
+$form["auth"]   = 'no';
 
 $form["tabs"]['groups'] = array (
-	'title' 	=> "Groups",
-	'width' 	=> 80,
-	'template' 	=> "templates/groups_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Groups",
+	'width'  => 80,
+	'template'  => "templates/groups_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'regex'		=> '/^.{1,30}$/',
-			'errmsg'	=> 'name_err',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'regex'  => '/^.{1,30}$/',
+			'errmsg' => 'name_err',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '5',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '5',
+			'cols'  => '30'
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/iptables.tform.php b/interface/web/admin/form/iptables.tform.php
index 87f7b7f83025d62dd052b6f48969ba713e4f5643..7d09ca3f5e1b3bd40875ad3a94754d3530e6ab1c 100644
--- a/interface/web/admin/form/iptables.tform.php
+++ b/interface/web/admin/form/iptables.tform.php
@@ -1,15 +1,15 @@
 <?php
 
-$form["title"] 			= "IPTables";
-$form["description"] 	= "IPTables based firewall";
-$form["name"] 			= "iptables";
-$form["action"]			= "iptables_edit.php";
-$form["db_table"]		= "iptables";
-$form["db_table_idx"]	= "iptables_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "iptables";
-$form["list_default"]	= "iptables_list.php";
-//$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "IPTables";
+$form["description"]  = "IPTables based firewall";
+$form["name"]    = "iptables";
+$form["action"]   = "iptables_edit.php";
+$form["db_table"]  = "iptables";
+$form["db_table_idx"] = "iptables_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "iptables";
+$form["list_default"] = "iptables_list.php";
+//$form["auth"]   = 'yes'; // yes / no
 
 //$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
@@ -18,92 +18,92 @@ $form["list_default"]	= "iptables_list.php";
 //$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['iptables'] = array (
-	'title' 	=> "Rules",
-	'width' 	=> "100",
-	'template' 	=> "templates/iptables_edit.htm",
-	'fields' 	=> array (
+	'title'  => "Rules",
+	'width'  => "100",
+	'template'  => "templates/iptables_edit.htm",
+	'fields'  => array (
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'),
+			'value'  => ''
 		),
 		'protocol' => array (
-						'datatype'	=> 'VARCHAR',
-						'formtype'	=> 'SELECT',
-						'default'	=> '',
-						'value'		=> array('none'=>'None','tcp'=>'TCP','udp'=>'UDP'),
-						'width'		=> '',
-						'maxlength'	=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('none'=>'None', 'tcp'=>'TCP', 'udp'=>'UDP'),
+			'width'  => '',
+			'maxlength' => ''
 		),
 		'table' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'SELECT',
-                        'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'table_error_empty')),
-                        'default'       => 'INPUT',
-                        'value'         => array('INPUT'=>'INPUT','OUTPUT'=>'OUTPUT','FORWARD'=>'FORWARD'),
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'SELECT',
+			'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'table_error_empty')),
+			'default'       => 'INPUT',
+			'value'         => array('INPUT'=>'INPUT', 'OUTPUT'=>'OUTPUT', 'FORWARD'=>'FORWARD'),
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'source_ip' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'destination_ip' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'singleport' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'multiport' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'state' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'target' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'SELECT',
-                        'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'target_error_empty')),
-                        'default'       => '',
-                        'value'         => array('ACCEPT'=>'ACCEPT','DROP'=>'DROP','REJECT'=>'REJECT'),
-                        'width'         => '',
-                        'maxlength'     => ''
-                ),
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'SELECT',
+			'validators'    => array (      0  => array ( 'type' => 'NOTEMPTY', 'errmsg' => 'target_error_empty')),
+			'default'       => '',
+			'value'         => array('ACCEPT'=>'ACCEPT', 'DROP'=>'DROP', 'REJECT'=>'REJECT'),
+			'width'         => '',
+			'maxlength'     => ''
+		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/remote_user.tform.php b/interface/web/admin/form/remote_user.tform.php
index 5fb252989396363fda8743ccf0bf1c823d6e6231..fd765ce9f632ad051b014cdeb556c923fc18d250 100644
--- a/interface/web/admin/form/remote_user.tform.php
+++ b/interface/web/admin/form/remote_user.tform.php
@@ -40,21 +40,21 @@ $modules = explode(',', $_SESSION['s']['user']['modules']);
 if(is_array($modules)) {
 	foreach($modules as $mt) {
 		if(is_file(ISPC_WEB_PATH.'/'.$mt.'/lib/remote.conf.php')) {
-			include(ISPC_WEB_PATH."/$mt/lib/remote.conf.php");
+			include ISPC_WEB_PATH."/$mt/lib/remote.conf.php";
 		}
 	}
 }
 
-$form["title"] 			= "Remote user";
-$form["description"] 	= "";
-$form["name"] 			= "remote_user";
-$form["action"]			= "remote_user_edit.php";
-$form["db_table"]		= "remote_user";
-$form["db_table_idx"]	= "remote_userid";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "remote_user";
-$form["list_default"]	= "remote_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Remote user";
+$form["description"]  = "";
+$form["name"]    = "remote_user";
+$form["action"]   = "remote_user_edit.php";
+$form["db_table"]  = "remote_user";
+$form["db_table_idx"] = "remote_userid";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "remote_user";
+$form["list_default"] = "remote_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -63,67 +63,67 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['remote_user'] = array (
-	'title' 	=> "Remote User",
-	'width' 	=> 100,
-	'template' 	=> "templates/remote_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Remote User",
+	'width'  => 100,
+	'template'  => "templates/remote_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'remote_userid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
-										'keyfield'=> 'remote_userid',
-										'valuefield'=> 'remote_username'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
+				'keyfield'=> 'remote_userid',
+				'valuefield'=> 'remote_username'
+			),
+			'value'  => ''
 		),
-		
+
 		'remote_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-2 => array (	'type' => 'NOTEMPTY',
-		'errmsg'=> 'username_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+				2 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'remote_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'MD5',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'remote_functions' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $function_list,
-			'separator'	=> ';',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '5',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'CHECKBOXARRAY',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $function_list,
+			'separator' => ';',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '5',
+			'cols'  => '30'
 		)
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/admin/form/server.tform.php b/interface/web/admin/form/server.tform.php
index 20947c8a061c8bdaeaa441f98293a05fb657b49f..a2eac6c3b758e5e6ffe1c993f167d3104fd2be05 100644
--- a/interface/web/admin/form/server.tform.php
+++ b/interface/web/admin/form/server.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Server";
-$form["description"] 	= "";
-$form["name"] 			= "server";
-$form["action"]			= "server_edit.php";
-$form["db_table"]		= "server";
-$form["db_table_idx"]	= "server_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "services";
-$form["list_default"]	= "server_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Server";
+$form["description"]  = "";
+$form["name"]    = "server";
+$form["action"]   = "server_edit.php";
+$form["db_table"]  = "server";
+$form["db_table_idx"] = "server_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "services";
+$form["list_default"] = "server_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"] = 1; // 0 = default groupid of the user, > 0 id must match with groupid of current user
@@ -51,62 +51,62 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['services'] = array (
-	'title' 	=> "Services",
-	'width' 	=> 100,
-	'template' 	=> "templates/server_edit_services.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Services",
+	'width'  => 100,
+	'template'  => "templates/server_edit_services.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'mail_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'web_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'dns_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'file_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'db_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'vserver_server' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '0',
-			'value'		=> array(0 => 0,1 => 1)
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '0',
+			'value'  => array(0 => 0, 1 => 1)
 		),
 		'mirror_server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		/*
 		'update' => array (
@@ -117,14 +117,14 @@ $form["tabs"]['services'] = array (
 		),
 		*/
 		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'value'		=> array(0 => 'No', 1 => 'Yes')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'value'  => array(0 => 'No', 1 => 'Yes')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -154,4 +154,4 @@ $form["tabs"]['config'] = array (
 );
 */
 
-?>
\ 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 2f4b9e2dc9e56fcdfd62dfbe6de98996fe9915ea..90c758984844e0f68fe0d59b1316cc46249c54ff 100644
--- a/interface/web/admin/form/server_config.tform.php
+++ b/interface/web/admin/form/server_config.tform.php
@@ -55,9 +55,9 @@ $form["tabs"]['server'] = array(
 	'width' => 70,
 	'template' => "templates/server_config_server_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'auto_network_configuration' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
@@ -89,10 +89,10 @@ $form["tabs"]['server'] = array(
 		'v6_prefix' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
-						'validators' => array(0 => array('type' => 'ISV6PREFIX',
-										'errmsg' => 'v6_prefix_wrong'),
-						),
-		'default' => ''
+			'validators' => array(0 => array('type' => 'ISV6PREFIX',
+					'errmsg' => 'v6_prefix_wrong'),
+			),
+			'default' => ''
 		),
 		'gateway' => array(
 			'datatype' => 'VARCHAR',
@@ -118,12 +118,12 @@ $form["tabs"]['server'] = array(
 			'formtype' => 'TEXT',
 			'default' => 'server1.domain.tld',
 			'filters'   => array( 0 => array( 'event' => 'SAVE',
-											  'type' => 'IDNTOASCII'),
-								  1 => array( 'event' => 'SHOW',
-											  'type' => 'IDNTOUTF8'),
-								  2 => array( 'event' => 'SAVE',
-											  'type' => 'TOLOWER')
-								),
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
 			'validators' => array(0 => array('type' => 'NOTEMPTY',
 					'errmsg' => 'hostname_error_empty'),
 			),
@@ -181,10 +181,10 @@ $form["tabs"]['server'] = array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-																'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-																'errmsg'=> 'monit_url_error_regex'),
-												),
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'monit_url_error_regex'),
+			),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
@@ -209,10 +209,10 @@ $form["tabs"]['server'] = array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-																'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-																'errmsg'=> 'munin_url_error_regex'),
-												),
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'munin_url_error_regex'),
+			),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
@@ -233,9 +233,9 @@ $form["tabs"]['server'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -244,9 +244,9 @@ $form["tabs"]['mail'] = array(
 	'width' => 60,
 	'template' => "templates/server_config_mail_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'module' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
@@ -275,19 +275,19 @@ $form["tabs"]['mail'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-				'dkim_path' => array(
-						'datatype' => 'VARCHAR',
-						'formtype' => 'TEXT',
-						'default' => '/var/lib/amavis/dkim',
-						'validators'    => array (  0 => array ('type'  => 'CUSTOM',
-							   	   'class' => 'validate_dkim',
-								   'function' => 'check_dkim_path',
-								   'errmsg'=> 'dkim_path_error'),
-								 ),
-						'value' => '',
-						'width' => '40',
-						'maxlength' => '255'
-				),
+		'dkim_path' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '/var/lib/amavis/dkim',
+			'validators'    => array (  0 => array ('type'  => 'CUSTOM',
+					'class' => 'validate_dkim',
+					'function' => 'check_dkim_path',
+					'errmsg'=> 'dkim_path_error'),
+			),
+			'value' => '',
+			'width' => '40',
+			'maxlength' => '255'
+		),
 		'pop3_imap_daemon' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
@@ -388,16 +388,16 @@ $form["tabs"]['mail'] = array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default' => 'y',
-			'value' => array(0 => 'n',1 => 'y')
+			'value' => array(0 => 'n', 1 => 'y')
 		),
 		'realtime_blackhole_list' => array(
 			'datatype' => 'VARCHAR',
 			'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]))*)?$/',
-														'errmsg'=> 'rbl_error_regex'),
-									),
+			'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]))*)?$/',
+					'errmsg'=> 'rbl_error_regex'),
+			),
 			'value' => '',
 			'width' => '40',
 			'maxlength' => '255'
@@ -428,9 +428,9 @@ $form["tabs"]['mail'] = array(
 			'default' => 'n',
 			'value' => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -439,9 +439,9 @@ $form["tabs"]['getmail'] = array(
 	'width' => 80,
 	'template' => "templates/server_config_getmail_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'getmail_config_dir' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -453,9 +453,9 @@ $form["tabs"]['getmail'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -464,9 +464,9 @@ $form["tabs"]['web'] = array(
 	'width' => 60,
 	'template' => "templates/server_config_web_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_type' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
@@ -510,7 +510,7 @@ $form["tabs"]['web'] = array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default' => 'n',
-			'value' => array(0 => 'n',1 => 'y')
+			'value' => array(0 => 'n', 1 => 'y')
 		),
 		'website_autoalias' => array(
 			'datatype' => 'VARCHAR',
@@ -520,7 +520,7 @@ $form["tabs"]['web'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-/*
+		/*
 'vhost_rewrite_v6' => array (
 'datatype' => 'VARCHAR',
 'formtype' => 'CHECKBOX',
@@ -912,9 +912,9 @@ $form["tabs"]['web'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -923,9 +923,9 @@ $form["tabs"]['dns'] = array(
 	'width' => 60,
 	'template' => "templates/server_config_dns_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'bind_user' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -981,9 +981,9 @@ $form["tabs"]['dns'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -992,9 +992,9 @@ $form["tabs"]['fastcgi'] = array(
 	'width' => 80,
 	'template' => "templates/server_config_fastcgi_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'fastcgi_starter_path' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1054,11 +1054,11 @@ $form["tabs"]['fastcgi'] = array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'default' => '',
-			'validators' => array(	0 => array(	'type' => 'ISINT',
-												'errmsg' => 'fastcgi_max_requests_error_empty'),
-									1 => array(	'type' => 'RANGE',
-												'range' => '0:',
-												'errmsg' => 'fastcgi_max_requests_error_empty'),
+			'validators' => array( 0 => array( 'type' => 'ISINT',
+					'errmsg' => 'fastcgi_max_requests_error_empty'),
+				1 => array( 'type' => 'RANGE',
+					'range' => '0:',
+					'errmsg' => 'fastcgi_max_requests_error_empty'),
 			),
 			'value' => '',
 			'width' => '40',
@@ -1083,9 +1083,9 @@ $form["tabs"]['fastcgi'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1095,9 +1095,9 @@ $form["tabs"]['jailkit'] = array(
 	'width' => 80,
 	'template' => "templates/server_config_jailkit_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'jailkit_chroot_home' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1142,9 +1142,9 @@ $form["tabs"]['jailkit'] = array(
 			'width' => '40',
 			'maxlength' => '1000'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1217,9 +1217,9 @@ $form["tabs"]['vlogger'] = array(
 	'width' => 80,
 	'template' => "templates/server_config_vlogger_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'config_dir' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1231,9 +1231,9 @@ $form["tabs"]['vlogger'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1244,9 +1244,9 @@ $form["tabs"]['cron'] = array(
 	'width' => 80,
 	'template' => "templates/server_config_cron_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'init_script' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -1280,9 +1280,9 @@ $form["tabs"]['cron'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -1291,9 +1291,9 @@ $form["tabs"]['rescue'] = array(
 	'width' => 80,
 	'template' => "templates/server_config_rescue_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'try_rescue' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
@@ -1324,9 +1324,9 @@ $form["tabs"]['rescue'] = array(
 			'default' => 'n',
 			'value' => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 ?>
diff --git a/interface/web/admin/form/server_ip.tform.php b/interface/web/admin/form/server_ip.tform.php
index e565e1eec0b914cecf7203eb57e0c9b18f6e8eee..c044f2d03f8002dd2f74c9425d650518ae4b99ba 100644
--- a/interface/web/admin/form/server_ip.tform.php
+++ b/interface/web/admin/form/server_ip.tform.php
@@ -55,7 +55,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 	Hinweis:
 	Das ID-Feld ist nicht bei den Table Values einzufügen.
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -64,16 +64,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 			= "IP Addresses";
-$form["description"] 	= "Form to edit system IP Addresses";
-$form["name"] 			= "server_ip";
-$form["action"]			= "server_ip_edit.php";
-$form["db_table"]		= "server_ip";
-$form["db_table_idx"]	= "server_ip_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "server_ip";
-$form["list_default"]	= "server_ip_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "IP Addresses";
+$form["description"]  = "Form to edit system IP Addresses";
+$form["name"]    = "server_ip";
+$form["action"]   = "server_ip_edit.php";
+$form["db_table"]  = "server_ip";
+$form["db_table_idx"] = "server_ip_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "server_ip";
+$form["list_default"] = "server_ip_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
@@ -82,83 +82,83 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['server_ip'] = array (
-	'title' 	=> "IP Address",
-	'width' 	=> 80,
-	'template' 	=> "templates/server_ip_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "IP Address",
+	'width'  => 80,
+	'template'  => "templates/server_ip_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'client_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'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'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'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'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'ip_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'),
 			'searchable' => 2
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIP',
-														'errmsg'=> 'ip_error_wrong'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'ip_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '15',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISIP',
+					'errmsg'=> 'ip_error_wrong'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'ip_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '15',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'virtualhost' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'virtualhost_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,5}\,{0,1}){1,}$/i',
-														'errmsg'=> 'error_port_syntax'),
-									),
-			'default'	=> '80,443',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '15',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^([0-9]{1,5}\,{0,1}){1,}$/i',
+					'errmsg'=> 'error_port_syntax'),
+			),
+			'default' => '80,443',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '15',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/server_php.tform.php b/interface/web/admin/form/server_php.tform.php
index 58c1d7fd40cd3859cb823a6a5cdcec729bb4236a..66bb504f0f39520547b1ac3cde7cc3946690ab82 100644
--- a/interface/web/admin/form/server_php.tform.php
+++ b/interface/web/admin/form/server_php.tform.php
@@ -59,16 +59,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 			= "Additional PHP Versions";
-$form["description"] 	= "Form to edit additional PHP versions";
-$form["name"] 			= "server_php";
-$form["action"]			= "server_php_edit.php";
-$form["db_table"]		= "server_php";
-$form["db_table_idx"]	= "server_php_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "php_name";
-$form["list_default"]	= "server_php_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Additional PHP Versions";
+$form["description"]  = "Form to edit additional PHP versions";
+$form["name"]    = "server_php";
+$form["action"]   = "server_php_edit.php";
+$form["db_table"]  = "server_php";
+$form["db_table_idx"] = "server_php_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "php_name";
+$form["list_default"] = "server_php_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
@@ -77,50 +77,50 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['php_name'] = array (
-	'title' 	=> "Name",
-	'width' 	=> 80,
-	'template' 	=> "templates/server_php_name_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Name",
+	'width'  => 80,
+	'template'  => "templates/server_php_name_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'client_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'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'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'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'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'validators' => array(0 => array('type' => 'NOTEMPTY',
-											 'errmsg' => 'server_php_name_error_empty'),
+					'errmsg' => 'server_php_name_error_empty'),
 			),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
@@ -129,9 +129,9 @@ $form["tabs"]['php_fastcgi'] = array(
 	'width' => 80,
 	'template' => "templates/server_php_fastcgi_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'php_fastcgi_binary' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -148,9 +148,9 @@ $form["tabs"]['php_fastcgi'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -159,9 +159,9 @@ $form["tabs"]['php_fpm'] = array(
 	'width' => 80,
 	'template' => "templates/server_php_fpm_edit.htm",
 	'fields' => array(
-		##################################
-		# Begin Datatable fields
-		##################################
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'php_fpm_init_script' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
@@ -186,9 +186,9 @@ $form["tabs"]['php_fpm'] = array(
 			'width' => '40',
 			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/software_package.tform.php b/interface/web/admin/form/software_package.tform.php
index 96ce5aadaf3e2742bff64715058626809c5fe119..1db7056acc1b0b779962fbcdc6820fca5257e34d 100644
--- a/interface/web/admin/form/software_package.tform.php
+++ b/interface/web/admin/form/software_package.tform.php
@@ -59,16 +59,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$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["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
@@ -77,40 +77,40 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $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
-	##################################
+	'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'		=> ''
+			'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'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// 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 0396e6f5dceb1db9ced206f30bac1b6bf98490c5..6d1c50f921ea643d7d3f68121c3b46c902acc365 100644
--- a/interface/web/admin/form/software_repo.tform.php
+++ b/interface/web/admin/form/software_repo.tform.php
@@ -59,16 +59,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 			= "Software Repository";
-$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";
-$form["db_table_idx"]	= "software_repo_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "software_repo";
-$form["list_default"]	= "software_repo_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Software Repository";
+$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";
+$form["db_table_idx"] = "software_repo_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "software_repo";
+$form["list_default"] = "software_repo_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
@@ -77,77 +77,77 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['software_repo'] = array (
-	'title' 	=> "Repository",
-	'width' 	=> 80,
-	'template' 	=> "templates/software_repo_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Repository",
+	'width'  => 80,
+	'template'  => "templates/software_repo_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'repo_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'repo_name_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'repo_name_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '40',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'repo_name_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'repo_name_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'repo_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'repo_name_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'repo_name_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '40',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'repo_name_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'repo_name_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '40',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'repo_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '30',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '30',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'repo_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CLEARTEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '30',
-			'rows'		=> '',
-			'cols'		=> ''
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '30',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/system_config.tform.php b/interface/web/admin/form/system_config.tform.php
index f09d4db2e1bf8f749c6972aacaae58416fa62c1b..155eeeb9dbdb84b924878d82719ee31049ed8d54 100644
--- a/interface/web/admin/form/system_config.tform.php
+++ b/interface/web/admin/form/system_config.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 		= "System Config";
-$form["description"] 	= "system_config_desc_txt";
-$form["name"] 		= "system_config";
-$form["action"]		= "system_config_edit.php";
-$form["db_table"]	= "sys_ini";
-$form["db_table_idx"]	= "sysini_id";
-$form["db_history"]	= "yes";
-$form["tab_default"]	= "sites";
-$form["list_default"]	= "server_list.php";
-$form["auth"]		= 'yes'; // yes / no
+$form["title"]   = "System Config";
+$form["description"]  = "system_config_desc_txt";
+$form["name"]   = "system_config";
+$form["action"]  = "system_config_edit.php";
+$form["db_table"] = "sys_ini";
+$form["db_table_idx"] = "sysini_id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "sites";
+$form["list_default"] = "server_list.php";
+$form["auth"]  = 'yes'; // yes / no
 
 $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
@@ -51,135 +51,135 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['sites'] = array (
-	'title' 	=> "Sites",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_sites_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Sites",
+	'width'  => 70,
+	'template'  => "templates/system_config_sites_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'dbname_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'dbname_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'dbname_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dbuser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'dbuser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'dbuser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ftpuser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'ftpuser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'ftpuser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'shelluser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'shelluser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'shelluser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'webdavuser_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
-                                                                'errmsg'=> 'webdavuser_prefix_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-0\-\_\[\]]{0,50}$/',
+					'errmsg'=> 'webdavuser_prefix_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dblist_phpmyadmin_link' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'phpmyadmin_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-                                                                'errmsg'=> 'phpmyadmin_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'phpmyadmin_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'webftp_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
-                                                                'errmsg'=> 'webftp_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
+					'errmsg'=> 'webftp_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'vhost_subdomains' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'client_username_web_check_disabled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'reseller_can_use_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['mail'] = array (
-	'title' 	=> "Mail",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_mail_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mail",
+	'width'  => 70,
+	'template'  => "templates/system_config_mail_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'enable_custom_login' => array(
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
@@ -190,160 +190,160 @@ $form["tabs"]['mail'] = array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default'  => 'y',
-			'value'    => array(0 => 'n',1 => 'y')
+			'value'    => array(0 => 'n', 1 => 'y')
 		),
 		'mailbox_show_mail_filter_tab' => array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default'  => 'y',
-			'value'    => array(0 => 'n',1 => 'y')
+			'value'    => array(0 => 'n', 1 => 'y')
 		),
 		'mailbox_show_custom_rules_tab' => array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
 			'default'  => 'y',
-			'value'    => array(0 => 'n',1 => 'y')
+			'value'    => array(0 => 'n', 1 => 'y')
 		),
 		'mailboxlist_webmail_link' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'webmail_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                /*'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}(\?.+)?$/',*/
-																'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
-                                                                'errmsg'=> 'webmail_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					/*'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}(\?.+)?$/',*/
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.\[\]]{0,255}$/',
+					'errmsg'=> 'webmail_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'mailmailinglist_link' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'mailmailinglist_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
-                                                                'errmsg'=> 'mailinglist_url_error_regex'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9a-zA-Z\:\/\-\.]{0,255}$/',
+					'errmsg'=> 'mailinglist_url_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'admin_mail' => array (
-			'datatype'	=> 'VARCHAR',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'admin_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_enabled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'smtp_host' => array (
-			'datatype'	=> 'VARCHAR',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_port' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '25',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '25',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_pass' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'smtp_crypt' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['domains'] = array (
-	'title' 	=> "Domains",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_domains_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domains",
+	'width'  => 70,
+	'template'  => "templates/system_config_domains_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'use_domain_module' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'new_domain_html' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -372,106 +372,106 @@ $form["tabs"]['domains'] = array (
 
  END: Branding */
 $form["tabs"]['misc'] = array (
-	'title' 	=> "Misc",
-	'width' 	=> 70,
-	'template' 	=> "templates/system_config_misc_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Misc",
+	'width'  => 70,
+	'template'  => "templates/system_config_misc_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'dashboard_atom_url_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://www.ispconfig.org/atom',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://www.ispconfig.org/atom',
+			'value'  => ''
 		),
 		'dashboard_atom_url_reseller' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://www.ispconfig.org/atom',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://www.ispconfig.org/atom',
+			'value'  => ''
 		),
 		'dashboard_atom_url_client' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://www.ispconfig.org/atom',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://www.ispconfig.org/atom',
+			'value'  => ''
 		),
 		'monitor_key' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'tab_change_discard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'tab_change_warning' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'use_loadindicator' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'use_combobox' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'maintenance_mode' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'admin_dashlets_left' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'admin_dashlets_right' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'reseller_dashlets_left' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'reseller_dashlets_right' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'client_dashlets_left' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
 		'client_dashlets_right' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => ''
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/admin/form/tpl_default.tform.php b/interface/web/admin/form/tpl_default.tform.php
index de63948b8fe84781718442ecf8264c4a37888fd7..df52bbec5f3633e64090e2c96557ca0ad2fc4417 100644
--- a/interface/web/admin/form/tpl_default.tform.php
+++ b/interface/web/admin/form/tpl_default.tform.php
@@ -59,16 +59,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 		= "tpl_default_head_txt";
-$form["description"] 	= "tpl_default_desc_txt";
-$form["name"] 		= "tpl_default";
-$form["action"]		= "tpl_default.php";
-$form["db_table"]	= "sys_theme";
-$form["db_table_idx"]	= "id";
-$form["db_history"]	= "yes";
-$form["tab_default"]	= "basic";
-$form["list_default"]	= "system_config_edit.php";
-$form["auth"]		= 'yes';
+$form["title"]   = "tpl_default_head_txt";
+$form["description"]  = "tpl_default_desc_txt";
+$form["name"]   = "tpl_default";
+$form["action"]  = "tpl_default.php";
+$form["db_table"] = "sys_theme";
+$form["db_table_idx"] = "id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "basic";
+$form["list_default"] = "system_config_edit.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
@@ -77,37 +77,37 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['basic'] = array (
-	'title' 	=> "Basic Settings",
-	'width' 	=> 80,
-	'template' 	=> "templates/tpl_default_basic.htm",
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => "Basic Settings",
+	'width'  => 80,
+	'template'  => "templates/tpl_default_basic.htm",
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'validators'    => '',
-			'default'	=> 'global',
-			'value'		=> 'global',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '64'
+			'default' => 'global',
+			'value'  => 'global',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '64'
 		),
 		'logo_url' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'validators'    => '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/form/users.tform.php b/interface/web/admin/form/users.tform.php
index b6ff5f3bdf04e426de264807d5062d160073ad78..06f07c07e977c6024e89786bd312513805c60b85 100644
--- a/interface/web/admin/form/users.tform.php
+++ b/interface/web/admin/form/users.tform.php
@@ -60,62 +60,62 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form['title'] 		= 'Users';
-$form['description'] 	= 'Form to edit systemusers.';
-$form['name'] 		= 'users';
-$form['action']		= 'users_edit.php';
-$form['db_table']	= 'sys_user';
-$form['db_table_idx']	= 'userid';
-$form["db_history"]	= "no";
-$form['tab_default']	= 'users';
-$form['list_default']	= 'users_list.php';
-$form['auth']		= 'yes';
+$form['title']   = 'Users';
+$form['description']  = 'Form to edit systemusers.';
+$form['name']   = 'users';
+$form['action']  = 'users_edit.php';
+$form['db_table'] = 'sys_user';
+$form['db_table_idx'] = 'userid';
+$form["db_history"] = "no";
+$form['tab_default'] = 'users';
+$form['list_default'] = 'users_list.php';
+$form['auth']  = 'yes';
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
 $form['auth_preset']['perm_group'] = 'riud';
-$form['auth_preset']['perm_other'] = ''; 
+$form['auth_preset']['perm_other'] = '';
 
 //* Pick out modules
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
 				$modules_list[$file] = $file;
 			}
-        }
+		}
 	}
 }
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
@@ -129,133 +129,133 @@ if(is_array($tmp_records)) {
 }
 
 $form['tabs']['users'] = array (
-	'title' 	=> 'Users',
-	'width' 	=> 80,
-	'template' 	=> 'templates/users_user_edit.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => 'Users',
+	'width'  => 80,
+	'template'  => 'templates/users_user_edit.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array (  0 => array (    'type'	=> 'NOTEMPTY',
-                                                                    'errmsg'=> 'username_empty'),
-                                                    1 => array (    'type'	=> 'UNIQUE',
-                                                                    'errmsg'=> 'username_unique'),
-                                                    2 => array (    'type'	=> 'REGEX',
-                                                                    'regex' => '/^[\w\.\-\_]{0,64}$/',
-                                                                    'errmsg'=> 'username_err'),
-													3 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_client',
-														'function' => 'username_collision',
-														'errmsg'=> 'username_error_collision'),
-                                                ),
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '30',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array (    'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_empty'),
+				1 => array (    'type' => 'UNIQUE',
+					'errmsg'=> 'username_unique'),
+				2 => array (    'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_]{0,64}$/',
+					'errmsg'=> 'username_err'),
+				3 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_collision',
+					'errmsg'=> 'username_error_collision'),
+			),
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '30',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'passwort' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'    => 'CRYPT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '100',
-			'rows'		=> '',
-			'cols'		=> ''
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '100',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'modules' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> 'admin,forms',
-			'value'		=> $modules_list,
-			'separator'	=> ',',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => 'admin,forms',
+			'value'  => $modules_list,
+			'separator' => ',',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'startmodule' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $modules_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $modules_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'app_theme' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'RADIO',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> 'default',
-			'value'		=> $themes_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'RADIO',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => 'default',
+			'value'  => $themes_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'typ' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'RADIO',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> 'user',
-			'value'		=> array ('user' => 'user', 'admin' => 'admin'),
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'RADIO',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => 'user',
+			'value'  => array ('user' => 'user', 'admin' => 'admin'),
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'active' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> array(0 => 0,1 => 1),
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => array(0 => 0, 1 => 1),
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '2',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '2',
+			'rows'  => '',
+			'cols'  => ''
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 /*
@@ -419,44 +419,44 @@ $form['tabs']['address'] = array (
 */
 
 $form['tabs']['groups'] = array (
-	'title' 	=> 'Groups',
-	'width' 	=> 80,
-	'template' 	=> 'templates/users_groups_edit.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => 'Groups',
+	'width'  => 80,
+	'template'  => 'templates/users_groups_edit.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'default_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $groups_list,
-			'separator'	=> ',',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $groups_list,
+			'separator' => ',',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'groups' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $groups_list,
-			'separator'	=> ',',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $groups_list,
+			'separator' => ',',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		)
 
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/groups_del.php b/interface/web/admin/groups_del.php
index 3303154f275c2f5914a92fbdddb4fe5a10165d68..57b47d9f488bdbafb39a40763599462832f2e1d9 100644
--- a/interface/web/admin/groups_del.php
+++ b/interface/web/admin/groups_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/groups.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('admin');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/groups_edit.php b/interface/web/admin/groups_edit.php
index d2acf2b8544d69f417edc5daa339fb1131c5327b..5ecf75fdf51d4e6e853e48219a293d88027622fb 100644
--- a/interface/web/admin/groups_edit.php
+++ b/interface/web/admin/groups_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/groups.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,4 +50,4 @@ $app->uses('tpl,tform,tform_actions');
 // let tform_actions handle the page
 $app->tform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/groups_list.php b/interface/web/admin/groups_list.php
index f75f5de698890d36d71bb7b95faa1436795d5352..aa2c37c664ecd97aa28cf8a8eccbc1cf069932e2 100644
--- a/interface/web/admin/groups_list.php
+++ b/interface/web/admin/groups_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/index.php b/interface/web/admin/index.php
index 3691df1d8e4b5b38ed5a1623d7fb268592b0e23a..7cbfddbe9d6b4e47fa067be774937c281460dcd0 100644
--- a/interface/web/admin/index.php
+++ b/interface/web/admin/index.php
@@ -34,14 +34,14 @@ class admin_index {
 	var $target = '';
 
 	function render() {
-		
+
 		global $app;
-		
+
 		$app->uses('tpl');
 		$app->tpl->newTemplate("form.tpl.htm");
 
-		$app->tpl->setVar('error',$error);
-		$app->tpl->setInclude('content_tpl','admin/templates/index.htm');
+		$app->tpl->setVar('error', $error);
+		$app->tpl->setInclude('content_tpl', 'admin/templates/index.htm');
 		return $app->tpl->grab();
 		/*
 		$filename = 'test.txt';
@@ -69,10 +69,11 @@ $somecontent = $app->tpl->grab();
 
 
 
-		
+
 		return 'dd';
 		*/
 	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/iptables_del.php b/interface/web/admin/iptables_del.php
index 2f1830fee77c126afcbc2ea31ac6bab5ee83e65f..2497768c19a91df3b89d075854aef2176b94f8a6 100644
--- a/interface/web/admin/iptables_del.php
+++ b/interface/web/admin/iptables_del.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/iptables.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -47,4 +47,4 @@ $app->auth->check_module_permissions('admin');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/iptables_edit.php b/interface/web/admin/iptables_edit.php
index cf9152b5744ce3db531ecd210d6ab61055cb7837..61d1ee3310a11edc0d5257fc04386fa1a0c92794 100644
--- a/interface/web/admin/iptables_edit.php
+++ b/interface/web/admin/iptables_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/iptables.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,10 +49,10 @@ $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/iptables_list.php b/interface/web/admin/iptables_list.php
index 71f888751044e8aae99f10a77856de7f8ff62006..8110460c1c725e7adf49ac7547ae2b211005bf5c 100644
--- a/interface/web/admin/iptables_list.php
+++ b/interface/web/admin/iptables_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_add.php b/interface/web/admin/language_add.php
index a2961715a821045e6b44df03e3fa8ff9b5e6e00a..3444179a2a73bd0ffd0217691191161df677ada0 100644
--- a/interface/web/admin/language_add.php
+++ b/interface/web/admin/language_add.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,13 +46,13 @@ $app->tpl->setInclude('content_tpl', 'templates/language_add.htm');
 $language_option = '';
 $error = '';
 $msg = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):'en';
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):'en';
 if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die('unallowed characters in selected language name.');
 
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
@@ -60,29 +60,29 @@ while ($file = readdir ($handle)) {
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('language_option', $language_option);
+$app->tpl->setVar('error', $error);
 
 if(isset($_POST['lng_new']) && strlen($_POST['lng_new']) == 2 && $error == '') {
 	$lng_new = $_POST['lng_new'];
 	if(!preg_match("/^[a-z]{2}$/i", $lng_new)) die('unallowed characters in language name.');
-	
+
 	//* Copy the main language file
-	copy(ISPC_LIB_PATH."/lang/$selected_language.lng",ISPC_LIB_PATH."/lang/$lng_new.lng");
-	
+	copy(ISPC_LIB_PATH."/lang/$selected_language.lng", ISPC_LIB_PATH."/lang/$lng_new.lng");
+
 	//* Make a copy of every language file
 	$bgcolor = '#FFFFFF';
 	$language_files_list = array();
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
-	   	if ($file != '.' && $file != '..') {
-	        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
-						$new_lang_file = $lng_new.substr($lang_file,2);
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
+						$new_lang_file = $lng_new.substr($lang_file, 2);
 						//echo ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file.' ## '.ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$new_lang_file;
-						copy(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file,ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$new_lang_file);
+						copy(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file, ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$new_lang_file);
 						$msg = 'Added new language '.$lng_new;
 					}
 				}
@@ -91,15 +91,15 @@ if(isset($_POST['lng_new']) && strlen($_POST['lng_new']) == 2 && $error == '') {
 	}
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_add.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_complete.php b/interface/web/admin/language_complete.php
index 75343bd82db785f7dea62ee8c19af71248e60d9d..67cfb86ed25c5962cd377da98b356ed34f59f784 100644
--- a/interface/web/admin/language_complete.php
+++ b/interface/web/admin/language_complete.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,13 +46,13 @@ $app->tpl->setInclude('content_tpl', 'templates/language_complete.htm');
 $language_option = '';
 $error = '';
 $msg = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):'en';
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):'en';
 if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die('unallowed characters in selected language name.');
 
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='' && $tmp_lng != 'en') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
@@ -60,65 +60,65 @@ while ($file = readdir ($handle)) {
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('language_option', $language_option);
+$app->tpl->setVar('error', $error);
 
 // Export the language file
 if(isset($_POST['lng_select']) && $error == '') {
-	
+
 	// complete the global langauge file
-	merge_langfile(ISPC_LIB_PATH."/lang/".$selected_language.".lng",ISPC_LIB_PATH."/lang/en.lng");
-	
+	merge_langfile(ISPC_LIB_PATH."/lang/".$selected_language.".lng", ISPC_LIB_PATH."/lang/en.lng");
+
 	// Go trough all language files
 	$bgcolor = '#FFFFFF';
 	$language_files_list = array();
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
-	   	if ($file != '.' && $file != '..') {
-	        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == 'en') {
-						$target_lang_file = $selected_language.substr($lang_file,2);
-						merge_langfile(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$target_lang_file,ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file);
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == 'en') {
+						$target_lang_file = $selected_language.substr($lang_file, 2);
+						merge_langfile(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$target_lang_file, ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file);
 					}
 				}
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
-						$master_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/en'.substr($lang_file,2);
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
+						$master_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/en'.substr($lang_file, 2);
 						$target_lang_file=ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file;
 						if(!file_exists($master_lang_file)){
-						unlink($target_lang_file);
-						$msg.="File $target_lang_file removed because does not exist in master language<br />";
+							unlink($target_lang_file);
+							$msg.="File $target_lang_file removed because does not exist in master language<br />";
 						}
 					}
 				}//Finish of remove the files how not exists in master language
 			}
 		}
 	}
-if($msg=='')
-$msg="No files created, removed or modified<br />";
+	if($msg=='')
+		$msg="No files created, removed or modified<br />";
 }
 
-function merge_langfile($langfile,$masterfile) {
+function merge_langfile($langfile, $masterfile) {
 	global $msg;
-	
+
 	if(is_file($langfile)) {
-	
+
 		// Load the english language file
-		include($masterfile);
+		include $masterfile;
 		if(isset($wb) && is_array($wb)) {
 			$wb_master = $wb;
 			unset($wb);
 		} else {
 			$wb_master = array();
 		}
-	
+
 		// Load the incomplete language file
 		$wb = array();
-		include($langfile);
-	
+		include $langfile;
+
 		$n = 0;
 		foreach($wb_master as $key => $val) {
 			if(!isset($wb[$key])) {
@@ -126,7 +126,7 @@ function merge_langfile($langfile,$masterfile) {
 				$n++;
 			}
 		}
-		
+
 		$r = 0;
 		foreach($wb as $key => $val) {
 			if(!isset($wb_master[$key])) {
@@ -134,35 +134,35 @@ function merge_langfile($langfile,$masterfile) {
 				$r++;
 			}
 		}
-	
+
 		$file_content = "<?php\n";
 		foreach($wb as $key => $val) {
-			$val = str_replace("'","\\'",$val);
-			$val = str_replace('"','\"',$val);
+			$val = str_replace("'", "\\'", $val);
+			$val = str_replace('"', '\"', $val);
 			$file_content .= '$wb['."'$key'".'] = '."'$val';\n";
 		}
 		$file_content .= "?>\n";
-		
+
 		if($n!=0)
-		$msg .= "Added $n lines to the file $langfile<br />";
+			$msg .= "Added $n lines to the file $langfile<br />";
 		if($r!=0)
-		$msg .= "Removed $r lines to the file $langfile<br />";
-		file_put_contents($langfile ,$file_content);
+			$msg .= "Removed $r lines to the file $langfile<br />";
+		file_put_contents($langfile , $file_content);
 	} else {
 		$msg .= "File does not exist yet. Copied file $masterfile to $langfile<br />";
-		copy($masterfile,$langfile);
+		copy($masterfile, $langfile);
 	}
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_complete.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_edit.php b/interface/web/admin/language_edit.php
index ffba65d61a894ef3ac30f1cfe120a28263f609fa..fda70a62a3a7ab8ca69f78d9d1e454a86650d648 100644
--- a/interface/web/admin/language_edit.php
+++ b/interface/web/admin/language_edit.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -57,27 +57,27 @@ if(isset($_POST['records']) && is_array($_POST['records'])) {
 	$file_content = "<?php\n";
 	foreach($_POST['records'] as $key => $val) {
 		$val = stripslashes($val);
-		$val = str_replace('"','\"',$val);
-		$val = str_replace('$','',$val);
+		$val = str_replace('"', '\"', $val);
+		$val = str_replace('$', '', $val);
 		$file_content .= '$wb['."'$key'".'] = "'.$val.'";'."\n";
 		$msg = 'File saved.';
 	}
 	$file_content .= "?>\n";
 	if($module == 'global') {
-		file_put_contents(ISPC_LIB_PATH."/lang/$lang_file" ,$file_content);
+		file_put_contents(ISPC_LIB_PATH."/lang/$lang_file" , $file_content);
 	} else {
-		file_put_contents(ISPC_WEB_PATH."/$module/lib/lang/$lang_file" ,$file_content);
+		file_put_contents(ISPC_WEB_PATH."/$module/lib/lang/$lang_file" , $file_content);
 	}
 }
 
 
-$app->tpl->setVar(array('module' => $module,'lang_file' => $lang_file, 'lang' => $lang, 'msg' => $msg));
+$app->tpl->setVar(array('module' => $module, 'lang_file' => $lang_file, 'lang' => $lang, 'msg' => $msg));
 
 if($module == 'global') {
-	include(ISPC_LIB_PATH."/lang/$lang_file");
+	include ISPC_LIB_PATH."/lang/$lang_file";
 	$file_path = ISPC_LIB_PATH."/lang/$lang_file";
 } else {
-	include(ISPC_WEB_PATH."/$module/lib/lang/$lang_file");
+	include ISPC_WEB_PATH."/$module/lib/lang/$lang_file";
 	$file_path = ISPC_WEB_PATH."/$module/lib/lang/$lang_file";
 }
 $app->tpl->setVar("file_path", $file_path);
@@ -85,7 +85,7 @@ $app->tpl->setVar("file_path", $file_path);
 $keyword_list = array();
 if(isset($wb) && is_array($wb)) {
 	foreach($wb as $key => $val) {
-		$keyword_list[] = array('key' => $key, 'val' => htmlentities($val,ENT_COMPAT | ENT_HTML401,'UTF-8'));
+		$keyword_list[] = array('key' => $key, 'val' => htmlentities($val, ENT_COMPAT | ENT_HTML401, 'UTF-8'));
 	}
 
 	$app->tpl->setLoop('records', $keyword_list);
@@ -93,9 +93,9 @@ if(isset($wb) && is_array($wb)) {
 }
 
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_edit.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
diff --git a/interface/web/admin/language_export.php b/interface/web/admin/language_export.php
index 5c192c3cf61bad84f1155d9012c226e6ee0540a1..a4c75f3df810b43a95c519e625153a6dad35237b 100644
--- a/interface/web/admin/language_export.php
+++ b/interface/web/admin/language_export.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,13 +46,13 @@ $app->tpl->setInclude('content_tpl', 'templates/language_export.htm');
 $language_option = '';
 $error = '';
 $msg = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):'en';
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):'en';
 if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die('unallowed characters in selected language name.');
 
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
@@ -60,34 +60,34 @@ while ($file = readdir ($handle)) {
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('language_option', $language_option);
+$app->tpl->setVar('error', $error);
 
 // Export the language file
 if(isset($_POST['lng_select']) && $error == '') {
 	//$lng_select = $_POST['lng_select'];
 	//if(!preg_match("/^[a-z]{2}$/i", $lng_select)) die('unallowed characters in language name.');
-	
+
 	// This variable contains the content of the language files
 	$content = '';
 	$content .= "---|ISPConfig Language File|".$conf["app_version"]."|".$selected_language."\n";
-	
+
 	//* get the global language file
 	$content .= "--|global|".$selected_language."|".$selected_language.".lng\n";
 	$content .= file_get_contents(ISPC_LIB_PATH."/lang/".$selected_language.".lng")."\n";
-	
+
 	//* Get the global file of the module
 	//$content .= "---|$module|$selected_language|\n";
 	//copy(ISPC_WEB_PATH."/$module/lib/lang/$selected_language.lng",ISPC_WEB_PATH."/$module/lib/lang/$lng_new.lng");
 	$bgcolor = '#FFFFFF';
 	$language_files_list = array();
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
-	   	if ($file != '.' && $file != '..') {
-	        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
+		if ($file != '.' && $file != '..') {
+			if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 				$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-				while ($lang_file = @readdir ($handle2)) {
-					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
+				while ($lang_file = @readdir($handle2)) {
+					if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
 						$content .= "--|".$file."|".$selected_language."|".$lang_file."\n";
 						$content .= file_get_contents(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file)."\n";
 						$msg .= 'Exported language file '.$lang_file.'<br />';
@@ -96,26 +96,26 @@ if(isset($_POST['lng_select']) && $error == '') {
 			}
 		}
 	}
-	
+
 	$content .= '---|EOF';
-	
+
 	// Write the language file
 	file_put_contents(ISPC_WEB_TEMP_PATH.'/'.$selected_language.'.lng', $content);
-	
+
 	$msg = "Exported language file to: <a href='temp/$selected_language.lng' target='_blank'>/temp/".$selected_language.'.lng</a>';
-	
+
 	//$msg = nl2br($content);
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_export.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_import.php b/interface/web/admin/language_import.php
index c25406ae7ff117857868e4639bf48935c5af913e..1dfaa18468495f726defaf7e685b59b44c59b4c4 100644
--- a/interface/web/admin/language_import.php
+++ b/interface/web/admin/language_import.php
@@ -27,87 +27,87 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 function normalize_string($string, $quote, $allow_special = false) {
-    $escaped = false;
-    $in_string = true;
-    $new_string = '';
-    
-    for($c = 0; $c < mb_strlen($string); $c++) {
-        $char = $string{$c};
-        
-        if($in_string === true && $escaped === false && $char === $quote) {
-            // this marks a string end (e.g. for concatenation)
-            $in_string = false;
-            continue;
-        } elseif($in_string === false) {
-            if($escaped === false && $char === $quote) {
-                $in_string = true;
-                continue;
-            } else {
-                continue; // we strip everything from outside the string!
-            }
-        }
-        
-        if($char === '"' && $escaped === true && $quote === '"') {
-            // unescape this
-            $new_string .= $char;
-            $escaped = false;
-            continue;
-        } elseif($char === "'" && $escaped === false && $quote === '"') {
-            // escape this
-            $new_string .= '\\' . $char;
-            continue;
-        }
-        
-        if($escaped === true) {
-            // the next character is the escaped one.
-            if($allow_special === true && ($char === 'n' || $char === 'r' || $char === 't')) {
-                $new_string .= '\' . "\\' . $char . '" . \'';
-            } else {
-                $new_string .= '\\' . $char;
-            }
-            $escaped = false;
-        } else {
-            if($char === '\\') {
-                $escaped = true;
-            } else {
-                $new_string .= $char;
-            }
-        }
-    }
-    return $new_string;
+	$escaped = false;
+	$in_string = true;
+	$new_string = '';
+
+	for($c = 0; $c < mb_strlen($string); $c++) {
+		$char = $string{$c};
+
+		if($in_string === true && $escaped === false && $char === $quote) {
+			// this marks a string end (e.g. for concatenation)
+			$in_string = false;
+			continue;
+		} elseif($in_string === false) {
+			if($escaped === false && $char === $quote) {
+				$in_string = true;
+				continue;
+			} else {
+				continue; // we strip everything from outside the string!
+			}
+		}
+
+		if($char === '"' && $escaped === true && $quote === '"') {
+			// unescape this
+			$new_string .= $char;
+			$escaped = false;
+			continue;
+		} elseif($char === "'" && $escaped === false && $quote === '"') {
+			// escape this
+			$new_string .= '\\' . $char;
+			continue;
+		}
+
+		if($escaped === true) {
+			// the next character is the escaped one.
+			if($allow_special === true && ($char === 'n' || $char === 'r' || $char === 't')) {
+				$new_string .= '\' . "\\' . $char . '" . \'';
+			} else {
+				$new_string .= '\\' . $char;
+			}
+			$escaped = false;
+		} else {
+			if($char === '\\') {
+				$escaped = true;
+			} else {
+				$new_string .= $char;
+			}
+		}
+	}
+	return $new_string;
 }
 
 function validate_line($line) {
-    $line = trim($line);
-    if($line === '' || $line === '<?php' || $line === '?>') return $line; // don't treat empty lines as malicious
-    
-    $ok = preg_match('/^\s*\$wb\[(["\'])(.*?)\\1\]\s*=\s*(["\'])(.*?)\\3\s*;\s*$/', $line, $matches);
-    if(!$ok) return false; // this line has invalid form and could lead to malfunction
-    
-    $keyquote = $matches[1]; // ' or "
-    $key = $matches[2];
-    if(strpos($key, '"') !== false || strpos($key, "'") !== false) return false;
-    
-    $textquote = $matches[3]; // ' or "
-    $text = $matches[4];
-
-    $new_line = '$wb[\'';
-    
-    // validate the language key
-    $key = normalize_string($key, $keyquote);
-    
-    $new_line .= $key . '\'] = \'';
-    
-    // validate this text to avoid code injection
-    $text = normalize_string($text, $textquote, true);
-    
-    $new_line .= $text . '\';';
-    
-    return $new_line;
+	$line = trim($line);
+	if($line === '' || $line === '<?php' || $line === '?>') return $line; // don't treat empty lines as malicious
+
+	$ok = preg_match('/^\s*\$wb\[(["\'])(.*?)\\1\]\s*=\s*(["\'])(.*?)\\3\s*;\s*$/', $line, $matches);
+	if(!$ok) return false; // this line has invalid form and could lead to malfunction
+
+	$keyquote = $matches[1]; // ' or "
+	$key = $matches[2];
+	if(strpos($key, '"') !== false || strpos($key, "'") !== false) return false;
+
+	$textquote = $matches[3]; // ' or "
+	$text = $matches[4];
+
+	$new_line = '$wb[\'';
+
+	// validate the language key
+	$key = normalize_string($key, $keyquote);
+
+	$new_line .= $key . '\'] = \'';
+
+	// validate this text to avoid code injection
+	$text = normalize_string($text, $textquote, true);
+
+	$new_line .= $text . '\';';
+
+	return $new_line;
 }
 
 //* Check permissions for module
@@ -130,20 +130,20 @@ $error = '';
 if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
 	$lines = file($_FILES['file']['tmp_name']);
 	// initial check
-	$parts = explode('|',$lines[0]);
+	$parts = explode('|', $lines[0]);
 	if($parts[0] == '---' && $parts[1] == 'ISPConfig Language File') {
 		if($_POST['ignore_version'] != 1 && $parts[2] != $conf["app_version"]) {
 			$error .= 'Application version does not match. Appversion: '.$conf["app_version"].' Lanfile version: '.$parts[2];
 		} else {
 			unset($lines[0]);
-			
+
 			$buffer = '';
 			$langfile_path = '';
 			// all other lines
-            $ln = 1;
+			$ln = 1;
 			foreach($lines as $line) {
-                $ln++;
-				$parts = explode('|',$line);
+				$ln++;
+				$parts = explode('|', $line);
 				if(is_array($parts) && count($parts) > 0 && $parts[0] == '--') {
 					// Write language file, if its not the first file
 					if($buffer != '' && $langfile_path != '') {
@@ -151,7 +151,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 							$error .= "File exists, not written: $langfile_path<br />";
 						} else {
 							$msg .= "File written: $langfile_path<br />";
-							file_put_contents($langfile_path,$buffer);
+							file_put_contents($langfile_path, $buffer);
 						}
 					}
 					// empty buffer and set variables
@@ -161,17 +161,17 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 					$file_name = trim($parts[3]);
 					if(!preg_match("/^[a-z]{2}$/i", $selected_language)) die("unallowed characters in selected language name: $selected_language");
 					if(!preg_match("/^[a-z_]+$/i", $module_name)) die('unallowed characters in module name.');
-					if(!preg_match("/^[a-z\._\-]+$/i", $file_name) || stristr($file_name,'..')) die("unallowed characters in language file name: '$file_name'");
+					if(!preg_match("/^[a-z\._\-]+$/i", $file_name) || stristr($file_name, '..')) die("unallowed characters in language file name: '$file_name'");
 					if($module_name == 'global') {
 						$langfile_path = trim(ISPC_LIB_PATH."/lang/".$selected_language.".lng");
 					} else {
 						$langfile_path = trim(ISPC_WEB_PATH.'/'.$module_name.'/lib/lang/'.$file_name);
 					}
 				} elseif(is_array($parts) && count($parts) > 1 && $parts[0] == '---' && $parts[1] == 'EOF') {
-                    // EOF line, ignore it.
-                } else {
-                    $line = validate_line($line);
-                    if($line === false) $error .= "Language file contains invalid language entry on line $ln.<br />";
+					// EOF line, ignore it.
+				} else {
+					$line = validate_line($line);
+					if($line === false) $error .= "Language file contains invalid language entry on line $ln.<br />";
 					else $buffer .= $line."\n";
 				}
 			}
@@ -179,16 +179,16 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 	}
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_import.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/language_list.php b/interface/web/admin/language_list.php
index 84b800713339e7f9444eec6c1b09e2ceb2743a83..2cb28dc187f1a7f2649715029ae4b584df690576 100644
--- a/interface/web/admin/language_list.php
+++ b/interface/web/admin/language_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -46,45 +46,45 @@ $bgcolor = '#FFFFFF';
 
 //* reading languages
 $language_option = '';
-$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'],0,2):$_SESSION['s']['language'];
-$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/'); 
-while ($file = readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-		$tmp_lng = substr($file,0,-4);
+$selected_language = (isset($_REQUEST['lng_select']))?substr($_REQUEST['lng_select'], 0, 2):$_SESSION['s']['language'];
+$handle = opendir(ISPC_ROOT_PATH.'/lib/lang/');
+while ($file = readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		$tmp_lng = substr($file, 0, -4);
 		if($tmp_lng !='') {
 			$selected = ($tmp_lng == $selected_language)?'SELECTED':'';
 			$language_option .= "<option value='$tmp_lng' $selected>$tmp_lng</option>";
-			
+
 			//$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 			if($file == $selected_language.'.lng') {
-			$language_files_list[] = array(	'module' => 'global',
-											'lang_file' => $file,
-											'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_ROOT_PATH.'/lib/lang/'.$file)),
-											'bgcolor'  => $bgcolor,
-											'lang' => $selected_language);
+				$language_files_list[] = array( 'module' => 'global',
+					'lang_file' => $file,
+					'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_ROOT_PATH.'/lib/lang/'.$file)),
+					'bgcolor'  => $bgcolor,
+					'lang' => $selected_language);
 			}
-			
-			
+
+
 		}
 	}
 }
-$app->tpl->setVar('language_option',$language_option);
+$app->tpl->setVar('language_option', $language_option);
 // $app->tpl->setLoop('records', $language_list);
 
 //* list all language files of the selected language
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH.'/'.$file.'/lib/lang')) {
 			$handle2 = opendir(ISPC_WEB_PATH.'/'.$file.'/lib/lang');
-			while ($lang_file = @readdir ($handle2)) {
-				if ($lang_file != '.' && $lang_file != '..' && substr($lang_file,0,2) == $selected_language) {
+			while ($lang_file = @readdir($handle2)) {
+				if ($lang_file != '.' && $lang_file != '..' && substr($lang_file, 0, 2) == $selected_language) {
 					$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
-					$language_files_list[] = array(	'module' => $file,
-													'lang_file' => $lang_file,
-													'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file)),
-													'bgcolor'  => $bgcolor,
-													'lang' => $selected_language);
+					$language_files_list[] = array( 'module' => $file,
+						'lang_file' => $lang_file,
+						'lang_file_date' => date("Y-m-d H:i:s", filectime(ISPC_WEB_PATH.'/'.$file.'/lib/lang/'.$lang_file)),
+						'bgcolor'  => $bgcolor,
+						'lang' => $selected_language);
 				}
 			}
 		}
@@ -96,9 +96,9 @@ $app->tpl->setLoop('records', $language_files_list);
 
 
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_language_list.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
diff --git a/interface/web/admin/lib/module.conf.php b/interface/web/admin/lib/module.conf.php
index 92e1979b16e23a5c990166d5e05a146d81177b82..7f4d19da1abd456a7027fdd6729994edc67b2a90 100644
--- a/interface/web/admin/lib/module.conf.php
+++ b/interface/web/admin/lib/module.conf.php
@@ -2,61 +2,61 @@
 
 global $conf;
 
-$module['name'] 	= 'admin';
-$module['title'] 	= 'top_menu_system';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'admin/server_list.php';
+$module['name']  = 'admin';
+$module['title']  = 'top_menu_system';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'admin/server_list.php';
 $module['tab_width']    = '60';
 
 
 $items[] = array(   'title'     => 'CP Users',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/users_list.php',
-                    'html_id'   => 'user_list');
+	'target'  => 'content',
+	'link' => 'admin/users_list.php',
+	'html_id'   => 'user_list');
 
-$items[] = array(   'title' 	=> 'Remote Users',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/remote_user_list.php',
-                    'html_id'   => 'remote_user_list');
+$items[] = array(   'title'  => 'Remote Users',
+	'target'  => 'content',
+	'link' => 'admin/remote_user_list.php',
+	'html_id'   => 'remote_user_list');
 
-$module['nav'][] = array(   'title'	=> 'User Management',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module['nav'][] = array(   'title' => 'User Management',
+	'open'  => 1,
+	'items' => $items);
 
 // cleanup
 unset($items);
 
-$items[] = array(   'title' 	=> 'Server Services',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_list.php',
-                    'html_id'   => 'server_list');
+$items[] = array(   'title'  => 'Server Services',
+	'target'  => 'content',
+	'link' => 'admin/server_list.php',
+	'html_id'   => 'server_list');
 
-$items[] = array(   'title' 	=> 'Server Config',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_config_list.php',
-                    'html_id'   => 'server_config_list');
+$items[] = array(   'title'  => 'Server Config',
+	'target'  => 'content',
+	'link' => 'admin/server_config_list.php',
+	'html_id'   => 'server_config_list');
 
-$items[] = array(   'title' 	=> 'Server IP addresses',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_ip_list.php',
-                    'html_id'   => 'server_ip_list');
+$items[] = array(   'title'  => 'Server IP addresses',
+	'target'  => 'content',
+	'link' => 'admin/server_ip_list.php',
+	'html_id'   => 'server_ip_list');
 
 
 
-$items[] = array(   'title' 	=> 'Additional PHP Versions',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/server_php_list.php',
-                    'html_id'   => 'server_php_list');
-					
-$items[] = array(   'title' 	=> 'Directive Snippets',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/directive_snippets_list.php',
-                    'html_id'   => 'directive_snippets_list');
+$items[] = array(   'title'  => 'Additional PHP Versions',
+	'target'  => 'content',
+	'link' => 'admin/server_php_list.php',
+	'html_id'   => 'server_php_list');
 
-$items[] = array(   'title' 	=> 'Firewall',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/firewall_list.php',
-                    'html_id'   => 'firewall_list');
+$items[] = array(   'title'  => 'Directive Snippets',
+	'target'  => 'content',
+	'link' => 'admin/directive_snippets_list.php',
+	'html_id'   => 'directive_snippets_list');
+
+$items[] = array(   'title'  => 'Firewall',
+	'target'  => 'content',
+	'link' => 'admin/firewall_list.php',
+	'html_id'   => 'firewall_list');
 
 /*
 $items[] = array( 'title' 	=> 'Firewall IPTables',
@@ -65,104 +65,104 @@ $items[] = array( 'title' 	=> 'Firewall IPTables',
 
 $items[] = array( 'title' 	=> 'Packet Filter',
 				  'target' 	=> 'content',
-				  'link'	=> 'admin/firewall_filter_list.php');				  
+				  'link'	=> 'admin/firewall_filter_list.php');
 
 $items[] = array( 'title' 	=> 'Port Forward',
 				  'target' 	=> 'content',
-				  'link'	=> 'admin/firewall_forward_list.php');				  
+				  'link'	=> 'admin/firewall_forward_list.php');
 */
 
 $module['nav'][] = array(   'title'     => 'System',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+	'open'  => 1,
+	'items' => $items);
 // cleanup
 unset($items);
 
-$items[] = array(   'title' 	=> 'Interface Config',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/system_config_edit.php?id=1',
-                    'html_id'   => 'interface_config');
+$items[] = array(   'title'  => 'Interface Config',
+	'target'  => 'content',
+	'link' => 'admin/system_config_edit.php?id=1',
+	'html_id'   => 'interface_config');
 
 $module['nav'][] = array(   'title'     => 'Interface',
-                            'open'      => "1",
-                            'items'     => $items);
+	'open'      => "1",
+	'items'     => $items);
 
 
 // cleanup
 unset($items);
 
 
-$items[] = array(   'title' 	=> 'Repositories',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/software_repo_list.php',
-                    'html_id'   => 'software_repo_list');
+$items[] = array(   'title'  => 'Repositories',
+	'target'  => 'content',
+	'link' => 'admin/software_repo_list.php',
+	'html_id'   => 'software_repo_list');
 
-$items[] = array(   'title' 	=> 'Packages',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/software_package_list.php',
-                    'html_id'   => 'software_package_list');
+$items[] = array(   'title'  => 'Packages',
+	'target'  => 'content',
+	'link' => 'admin/software_package_list.php',
+	'html_id'   => 'software_package_list');
 
-$items[] = array(   'title' 	=> 'Updates',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/software_update_list.php',
-                    'html_id'   => 'software_update_list');
+$items[] = array(   'title'  => 'Updates',
+	'target'  => 'content',
+	'link' => 'admin/software_update_list.php',
+	'html_id'   => 'software_update_list');
 
 $module['nav'][] = array(   'title'     => 'Software',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+	'open'  => 1,
+	'items' => $items);
 
 
 // cleanup
 unset($items);
 
-$items[] = array(   'title' 	=> 'Languages',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_list.php',
-                    'html_id'   => 'language_list');
+$items[] = array(   'title'  => 'Languages',
+	'target'  => 'content',
+	'link' => 'admin/language_list.php',
+	'html_id'   => 'language_list');
 
-$items[] = array(   'title' 	=> 'New Language',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_add.php',
-                    'html_id'   => 'language_add');
+$items[] = array(   'title'  => 'New Language',
+	'target'  => 'content',
+	'link' => 'admin/language_add.php',
+	'html_id'   => 'language_add');
 
-$items[] = array(   'title' 	=> 'Merge',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_complete.php',
-                    'html_id'   => 'language_complete');
+$items[] = array(   'title'  => 'Merge',
+	'target'  => 'content',
+	'link' => 'admin/language_complete.php',
+	'html_id'   => 'language_complete');
 
-$items[] = array(   'title' 	=> 'Export',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_export.php',
-                    'html_id'   => 'language_export');
+$items[] = array(   'title'  => 'Export',
+	'target'  => 'content',
+	'link' => 'admin/language_export.php',
+	'html_id'   => 'language_export');
 
-$items[] = array(   'title' 	=> 'Import',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/language_import.php',
-                    'html_id'   => 'language_import');
+$items[] = array(   'title'  => 'Import',
+	'target'  => 'content',
+	'link' => 'admin/language_import.php',
+	'html_id'   => 'language_import');
 
 $module['nav'][] = array(   'title'     => 'Language Editor',
-                            'open'      => 1,
-                            'items'     => $items);
+	'open'      => 1,
+	'items'     => $items);
 
 
 // cleanup
 unset($items);
 
 
-$items[] = array(   'title' 	=> 'Do OS-Update',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/remote_action_osupdate.php',
-                    'html_id'   => 'osupdate');
+$items[] = array(   'title'  => 'Do OS-Update',
+	'target'  => 'content',
+	'link' => 'admin/remote_action_osupdate.php',
+	'html_id'   => 'osupdate');
 
 // ISPConfig interface update has been removed. Please use ispconfig_update.sh on the shell instead.
-$items[] = array(   'title' 	=> 'Do ISPConfig-Update',
-                    'target' 	=> 'content',
-                    'link'	=> 'admin/remote_action_ispcupdate.php',
-                    'html_id'   => 'ispcupdate');
+$items[] = array(   'title'  => 'Do ISPConfig-Update',
+	'target'  => 'content',
+	'link' => 'admin/remote_action_ispcupdate.php',
+	'html_id'   => 'ispcupdate');
 
-$module['nav'][] = array(   'title'	=> 'Remote Actions',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module['nav'][] = array(   'title' => 'Remote Actions',
+	'open'  => 1,
+	'items' => $items);
 
 
 // Getting the admin options from other modules
@@ -171,7 +171,7 @@ if(is_array($modules)) {
 	foreach($modules as $mt) {
 		if(is_file($mt.'/lib/admin.conf.php')) {
 			$options = array();
-			include_once(ISPC_WEB_PATH."/$mt/lib/admin.conf.php");
+			include_once ISPC_WEB_PATH."/$mt/lib/admin.conf.php";
 			if(is_array($options)) {
 				foreach($options as $opt) {
 					$module['nav'][] = $opt;
@@ -181,4 +181,4 @@ if(is_array($modules)) {
 	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/lib/remote.conf.php b/interface/web/admin/lib/remote.conf.php
index 6a87e9579bd7b81279b3998f316ae4b622170c99..4268f47e120e0f706054d2e6b2885b2f024000fc 100644
--- a/interface/web/admin/lib/remote.conf.php
+++ b/interface/web/admin/lib/remote.conf.php
@@ -2,4 +2,4 @@
 
 $function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/directive_snippets.list.php b/interface/web/admin/list/directive_snippets.list.php
index 593ff80a2e3a38070671b34d243d18aa3d55eeaf..8522e076414ec05fbb33592aa9a951a816a2b92d 100644
--- a/interface/web/admin/list/directive_snippets.list.php
+++ b/interface/web/admin/list/directive_snippets.list.php
@@ -13,66 +13,66 @@
 
 
 // Name of the list
-$liste["name"] 				= "directive_snippets";
+$liste["name"]     = "directive_snippets";
 
 // Database table
-$liste["table"] 			= "directive_snippets";
+$liste["table"]    = "directive_snippets";
 
 // Index index field of the database table
-$liste["table_idx"]			= "directive_snippets_id";
+$liste["table_idx"]   = "directive_snippets_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "directive_snippets_list.php";
+$liste["file"]    = "directive_snippets_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "directive_snippets_edit.php";
+$liste["edit_file"]   = "directive_snippets_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "directive_snippets_del.php";
+$liste["delete_file"]  = "directive_snippets_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP', 'proxy' => 'Proxy'));
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('apache' => 'Apache', 'nginx' => 'nginx', 'php' => 'PHP', 'proxy' => 'Proxy'));
+
+?>
diff --git a/interface/web/admin/list/firewall.list.php b/interface/web/admin/list/firewall.list.php
index 97d2fe9a91b64b2554a7c8c733c74a3750b04010..058e86c804cfa730fdbed654b2a6ec18a76a8fff 100644
--- a/interface/web/admin/list/firewall.list.php
+++ b/interface/web/admin/list/firewall.list.php
@@ -13,81 +13,81 @@
 
 
 // Name of the list
-$liste["name"] 				= "firewall";
+$liste["name"]     = "firewall";
 
 // Database table
-$liste["table"] 			= "firewall";
+$liste["table"]    = "firewall";
 
 // Index index field of the database table
-$liste["table_idx"]			= "firewall_id";
+$liste["table_idx"]   = "firewall_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "firewall_list.php";
+$liste["file"]    = "firewall_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "firewall_edit.php";
+$liste["edit_file"]   = "firewall_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "firewall_del.php";
+$liste["delete_file"]  = "firewall_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "tcp_port",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "udp_port",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "tcp_port",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "udp_port",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/admin/list/groups.list.php b/interface/web/admin/list/groups.list.php
index ded13062421003c7bb858da093eda2dcd6fe313a..9d8d4c902a41b634c20b09b04e579385bca4e727 100644
--- a/interface/web/admin/list/groups.list.php
+++ b/interface/web/admin/list/groups.list.php
@@ -10,52 +10,52 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'groups';
+$liste['name']     = 'groups';
 
 //* Database table
-$liste['table'] 			= 'sys_group';
+$liste['table']    = 'sys_group';
 
 //* Primary index column
-$liste['table_idx']			= 'groupid';
+$liste['table_idx']   = 'groupid';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'groups_list.php';
+$liste['file']    = 'groups_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'groups_edit.php';
+$liste['edit_file']   = 'groups_edit.php';
 
 //* Script file for deleting
-$liste['delete_file']		= 'groups_del.php';
+$liste['delete_file']  = 'groups_del.php';
 
 //* Paging Template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'name',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'description',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '');  
-
-?>
\ No newline at end of file
+$liste['item'][] = array( 'field'  => 'name',
+	'datatype' => 'VARCHAR',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '');
+
+$liste['item'][] = array( 'field'  => 'description',
+	'datatype' => 'VARCHAR',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '');
+
+?>
diff --git a/interface/web/admin/list/iptables.list.php b/interface/web/admin/list/iptables.list.php
index 657f521330694bb1b9eb1a717bdb985b994cf463..ad487e5b6baf5a688561385956414907d32be758 100644
--- a/interface/web/admin/list/iptables.list.php
+++ b/interface/web/admin/list/iptables.list.php
@@ -1,107 +1,107 @@
 <?php
 
-$liste["name"] 				= "iptables";
-$liste["table"] 			= "iptables";
-$liste["table_idx"]			= "iptables_id";
-$liste["search_prefix"] 	= "search_";
-$liste["records_per_page"] 	= "15";
-$liste["file"]				= "iptables_list.php";
-$liste["edit_file"]			= "iptables_edit.php";
-$liste["delete_file"]		= "iptables_del.php";
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
-$liste["auth"]				= "yes";
+$liste["name"]     = "iptables";
+$liste["table"]    = "iptables";
+$liste["table_idx"]   = "iptables_id";
+$liste["search_prefix"]  = "search_";
+$liste["records_per_page"]  = "15";
+$liste["file"]    = "iptables_list.php";
+$liste["edit_file"]   = "iptables_edit.php";
+$liste["delete_file"]  = "iptables_del.php";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
+$liste["auth"]    = "yes";
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array("y" => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>","n" => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array("y" => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", "n" => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> "SQL",
-														'querystring' => "SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name",
-														'keyfield'=> "server_id",
-														'valuefield'=> "server_name"),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => "SQL",
+		'querystring' => "SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name",
+		'keyfield'=> "server_id",
+		'valuefield'=> "server_name"),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "singleport",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "singleport",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "multiport",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "multiport",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
 
 $liste["item"][] = array(   'field'     => "protocol",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => array('none'=>'None','tcp' => "TCP",'udp' => "UDP"));
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => array('none'=>'None', 'tcp' => "TCP", 'udp' => "UDP"));
 
 $liste["item"][] = array(   'field'     => "table",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => array('INPUT' => "INPUT",'OUTPUT' => "OUTPUT",'FORWARD' => "FORWARD"));
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => array('INPUT' => "INPUT", 'OUTPUT' => "OUTPUT", 'FORWARD' => "FORWARD"));
 
 $liste["item"][] = array(   'field'     => "source_ip",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "16",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "16",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "destination_ip",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "16",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "16",
+	'value'     => "");
 
-$liste["item"][] = array(	'field'		=> "target",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-                            'value'     => array('ACCEPT' => "ACCEPT",'DROP' => "DROP",'REJECT' => "REJECT",'LOG' => "LOG"));
+$liste["item"][] = array( 'field'  => "target",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'     => array('ACCEPT' => "ACCEPT", 'DROP' => "DROP", 'REJECT' => "REJECT", 'LOG' => "LOG"));
 
-$liste["item"][] = array(	'field'		=> "state",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "state",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+?>
diff --git a/interface/web/admin/list/remote_user.list.php b/interface/web/admin/list/remote_user.list.php
index 09f4e3d7ff0937bf6efbf85508cef4454394eb92..7dc0fbf430c078c06a13b40ec6fa725ad0cb33f3 100644
--- a/interface/web/admin/list/remote_user.list.php
+++ b/interface/web/admin/list/remote_user.list.php
@@ -34,32 +34,31 @@ $liste['auth'] = 'yes';
 //****** Search fields
 
 $liste['item'][] = array(
-            'field'      => 'remote_userid',
-            'datatype'   => 'VARCHAR',
-            'formtype'   => 'SELECT',
-            'op'         => '=',
-            'prefix'     => '',
-            'suffix'     => '',
-            'width'      => '',
-            'datasource' => array(
-                    'type' => 'SQL',
-                    'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
-                    'keyfield'    => 'remote_userid',
-                    'valuefield'  => 'remote_userid'
-                                  ),
-            'value'      => ''
-        );
+	'field'      => 'remote_userid',
+	'datatype'   => 'VARCHAR',
+	'formtype'   => 'SELECT',
+	'op'         => '=',
+	'prefix'     => '',
+	'suffix'     => '',
+	'width'      => '',
+	'datasource' => array(
+		'type' => 'SQL',
+		'querystring' => 'SELECT remote_userid,remote_username FROM remote_user WHERE {AUTHSQL} ORDER BY remote_username',
+		'keyfield'    => 'remote_userid',
+		'valuefield'  => 'remote_userid'
+	),
+	'value'      => ''
+);
 
 $liste['item'][] = array(
-            'field'      => 'remote_username',
-            'datatype'   => 'VARCHAR',
-            'formtype'   => 'TEXT',
-            'op'         => 'like',
-            'prefix'     => '%',
-            'suffix'     => '%',
-            'width'      => '',
-            'value'      => ''
-        );
+	'field'      => 'remote_username',
+	'datatype'   => 'VARCHAR',
+	'formtype'   => 'TEXT',
+	'op'         => 'like',
+	'prefix'     => '%',
+	'suffix'     => '%',
+	'width'      => '',
+	'value'      => ''
+);
 
 ?>
-
diff --git a/interface/web/admin/list/server.list.php b/interface/web/admin/list/server.list.php
index acca81a92f8c3cbf2b3117e170a3d26247b96332..85b6e656f2d6bcef99d3ffb4933a4fbb6d08817c 100644
--- a/interface/web/admin/list/server.list.php
+++ b/interface/web/admin/list/server.list.php
@@ -10,104 +10,104 @@
 */
 
 //* Name of the list
-$liste['name'] 				= 'server';
+$liste['name']     = 'server';
 
 //* Database table
-$liste['table'] 			= 'server';
+$liste['table']    = 'server';
 
 //* Index index field of the database table
-$liste['table_idx']			= 'server_id';
+$liste['table_idx']   = 'server_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script File of the list
-$liste['file']				= 'server_list.php';
+$liste['file']    = 'server_list.php';
 
 //* Script file of the edit form
-$liste['edit_file']			= 'server_edit.php';
+$liste['edit_file']   = 'server_edit.php';
 
 //* Script File of the delete script
-$liste['delete_file']		= 'server_del.php';
+$liste['delete_file']  = 'server_del.php';
 
 //* Paging Template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'yes';
+$liste['auth']    = 'yes';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'server_name',
-							'datatype'	=> 'VARCHAR',
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'mail_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste['item'][] = array(	'field'		=> 'web_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste['item'][] = array(	'field'		=> 'dns_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste['item'][] = array(	'field'		=> 'file_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste['item'][] = array(	'field'		=> 'db_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste['item'][] = array(	'field'		=> 'vserver_server',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-?>
\ No newline at end of file
+$liste['item'][] = array( 'field'  => 'server_name',
+	'datatype' => 'VARCHAR',
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'mail_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste['item'][] = array( 'field'  => 'web_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste['item'][] = array( 'field'  => 'dns_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste['item'][] = array( 'field'  => 'file_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste['item'][] = array( 'field'  => 'db_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste['item'][] = array( 'field'  => 'vserver_server',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+?>
diff --git a/interface/web/admin/list/server_config.list.php b/interface/web/admin/list/server_config.list.php
index f0540f4422d2ace205770faff63a7e752b860cb6..fb7ac32b6f2fd6501da695140e3ca7d7d0d24a54 100644
--- a/interface/web/admin/list/server_config.list.php
+++ b/interface/web/admin/list/server_config.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "server_config";
+$liste["name"]     = "server_config";
 
 // Database table
-$liste["table"] 			= "server";
+$liste["table"]    = "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "server_id";
+$liste["table_idx"]   = "server_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "server_config_list.php";
+$liste["file"]    = "server_config_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "server_config_edit.php";
+$liste["edit_file"]   = "server_config_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "server_config_del.php";
+$liste["delete_file"]  = "server_config_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "server_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/list/server_ip.list.php b/interface/web/admin/list/server_ip.list.php
index 10001fb11434eab03d2aafe430162768ad0a3835..dba0c68cb1129b58210479614da81a448b52797e 100644
--- a/interface/web/admin/list/server_ip.list.php
+++ b/interface/web/admin/list/server_ip.list.php
@@ -10,99 +10,99 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'server_ip';
+$liste['name']     = 'server_ip';
 
 //* Database table
-$liste['table'] 			= 'server_ip';
+$liste['table']    = 'server_ip';
 
 //* Primary index column
-$liste['table_idx']			= 'server_ip_id';
+$liste['table_idx']   = 'server_ip_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'server_ip_list.php';
+$liste['file']    = 'server_ip_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'server_ip_edit.php';
+$liste['edit_file']   = 'server_ip_edit.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'server_ip_del.php';
+$liste['delete_file']  = 'server_ip_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'client_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
-														'keyfield'=> 'client_id',
-														'valuefield'=> 'contact_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'ip_type',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '',
-							'value'		=> array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'));
-
-$liste['item'][] = array(	'field'		=> 'ip_address',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '');  
-
-$liste["item"][] = array(	'field'		=> "virtualhost",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste['item'][] = array(	'field'		=> 'virtualhost_port',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> ''); 
-
-?>
\ No newline at end of file
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'client_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
+		'keyfield'=> 'client_id',
+		'valuefield'=> 'contact_name'
+	),
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'ip_type',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '',
+	'value'  => array('IPv4' => 'IPv4', 'IPv6' => 'IPv6'));
+
+$liste['item'][] = array( 'field'  => 'ip_address',
+	'datatype' => 'VARCHAR',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '');
+
+$liste["item"][] = array( 'field'  => "virtualhost",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste['item'][] = array( 'field'  => 'virtualhost_port',
+	'datatype' => 'VARCHAR',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '');
+
+?>
diff --git a/interface/web/admin/list/server_php.list.php b/interface/web/admin/list/server_php.list.php
index 1464d161f5ad8c858b8d792eb1037f5f8a6351b1..ce8944d5a85e87ce3a4ae5e3874dd6162c53c85d 100644
--- a/interface/web/admin/list/server_php.list.php
+++ b/interface/web/admin/list/server_php.list.php
@@ -10,73 +10,73 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'server_php';
+$liste['name']     = 'server_php';
 
 //* Database table
-$liste['table'] 			= 'server_php';
+$liste['table']    = 'server_php';
 
 //* Primary index column
-$liste['table_idx']			= 'server_php_id';
+$liste['table_idx']   = 'server_php_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'server_php_list.php';
+$liste['file']    = 'server_php_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'server_php_edit.php';
+$liste['edit_file']   = 'server_php_edit.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'server_php_del.php';
+$liste['delete_file']  = 'server_php_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'client_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
-														'keyfield'=> 'client_id',
-														'valuefield'=> 'contact_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'name',
-							'datatype'	=> 'VARCHAR',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '');
-
-?>
\ No newline at end of file
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'client_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
+		'keyfield'=> 'client_id',
+		'valuefield'=> 'contact_name'
+	),
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'name',
+	'datatype' => 'VARCHAR',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '');
+
+?>
diff --git a/interface/web/admin/list/software_repo.list.php b/interface/web/admin/list/software_repo.list.php
index 7c11113ebff6c6a6b4217f6048296ca0889f15f3..2eb3dd520eeb4d74bd39184f39879b9f6e6c237f 100644
--- a/interface/web/admin/list/software_repo.list.php
+++ b/interface/web/admin/list/software_repo.list.php
@@ -13,66 +13,66 @@
 
 
 // Name of the list
-$liste["name"] 				= "software_repo";
+$liste["name"]     = "software_repo";
 
 // Database table
-$liste["table"] 			= "software_repo";
+$liste["table"]    = "software_repo";
 
 // Index index field of the database table
-$liste["table_idx"]			= "software_repo_id";
+$liste["table_idx"]   = "software_repo_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "software_repo_list.php";
+$liste["file"]    = "software_repo_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "software_repo_edit.php";
+$liste["edit_file"]   = "software_repo_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "software_repo_del.php";
+$liste["delete_file"]  = "software_repo_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "repo_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "repo_url",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "repo_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "repo_url",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/admin/list/users.list.php b/interface/web/admin/list/users.list.php
index 69cd880fa20680712e890db8b2c6f17ff92ff4eb..b260c2b3c652f01b5c61c277c58d4c3ae7688dbb 100644
--- a/interface/web/admin/list/users.list.php
+++ b/interface/web/admin/list/users.list.php
@@ -13,31 +13,31 @@
 $liste['name']                  = 'users';
 
 //* Database table
-$liste['table'] 		= 'sys_user';
+$liste['table']   = 'sys_user';
 
 //* Primary index column
-$liste['table_idx']		= 'userid';
+$liste['table_idx']  = 'userid';
 
 //* Search column prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for list
-$liste['file']			= 'users_list.php';
+$liste['file']   = 'users_list.php';
 
 //* Script file to edit
-$liste['edit_file']		= 'users_edit.php';
+$liste['edit_file']  = 'users_edit.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'users_del.php';
+$liste['delete_file']  = 'users_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']			= 'no';
+$liste['auth']   = 'no';
 
 
 /*****************************************************
@@ -45,35 +45,35 @@ $liste['auth']			= 'no';
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "client_id",
-                            'datatype'	=> "INTEGER",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> "");
-
-$liste["item"][] = array(   'field'	=> "active",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste['item'][] = array(   'field'	=> 'username',
-                            'datatype'	=> 'VARCHAR',
-                            'op'	=> 'like',
-                            'prefix'	=> '%',
-                            'suffix'	=> '%',
-                            'width'	=> '');
-
-$liste['item'][] = array(   'field'	=> 'groups',
-                            'datatype'	=> 'VARCHAR',
-                            'op'	=> 'like',
-                            'prefix'	=> '%',
-                            'suffix'	=> '%',
-                            'width'	=> '');
-
-?>
\ No newline at end of file
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => "");
+
+$liste["item"][] = array(   'field' => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste['item'][] = array(   'field' => 'username',
+	'datatype' => 'VARCHAR',
+	'op' => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width' => '');
+
+$liste['item'][] = array(   'field' => 'groups',
+	'datatype' => 'VARCHAR',
+	'op' => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width' => '');
+
+?>
diff --git a/interface/web/admin/login_as.php b/interface/web/admin/login_as.php
index f7103b7aad5d187c4a3b495fd2f08af9cdd7d8d3..a5a34f13f4326d8de18c626251eb5d7178c29b05 100644
--- a/interface/web/admin/login_as.php
+++ b/interface/web/admin/login_as.php
@@ -28,8 +28,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /* Check permissions for module */
 $app->auth->check_module_permissions('admin');
@@ -41,7 +41,7 @@ if ($_SESSION["s"]["user"]["typ"] != 'admin') {
 
 /* get the id of the user (must be int!) */
 if (!isset($_GET['id']) && !isset($_GET['cid'])){
-    die ("No user selected!");
+	die ("No user selected!");
 }
 
 if(isset($_GET['id'])) {
@@ -61,16 +61,16 @@ if(isset($_GET['id'])) {
  * Get the data to login as user x
  */
 $dbData = $app->db->queryOneRecord(
-    "SELECT username, passwort FROM sys_user WHERE userid = " . $userId);
+	"SELECT username, passwort FROM sys_user WHERE userid = " . $userId);
 
 /*
  * Now generate the login-Form
  * TODO: move the login_as form to a template file -> themeability
  */
- 
- $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_login_as.lng';
-include($lng_file);
- 
+
+$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_login_as.lng';
+include $lng_file;
+
 echo '
 	<br /> <br />	<br /> <br />
 	'.$wb['login_1_txt'].' ' .  $dbData['username'] . '?<br />
diff --git a/interface/web/admin/remote_action_ispcupdate.php b/interface/web/admin/remote_action_ispcupdate.php
index a72f9426ff79b2c9154539743734679eaf084a49..e8c8b24416749c6178f1aeadaab9416cbdf02e62 100644
--- a/interface/web/admin/remote_action_ispcupdate.php
+++ b/interface/web/admin/remote_action_ispcupdate.php
@@ -29,8 +29,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 //die('Function has been removed.');
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@ $app->tpl->setInclude('content_tpl', 'templates/remote_action_ispcupdate.htm');
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng';
-include($lng_file);
+include $lng_file;
 
 /*
  * We need a list of all Servers
@@ -80,20 +80,20 @@ if (1 == 0 && isset($_POST['server_select'])) {
 	}
 	foreach ($servers as $serverId) {
 		$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$serverId . ", " .
-				time() . ", " .
-				"'ispc_update', " .
-				"'', " .
-				"'pending', " .
-				"''" .
-				")";
+			"VALUES (".
+			(int)$serverId . ", " .
+			time() . ", " .
+			"'ispc_update', " .
+			"'', " .
+			"'pending', " .
+			"''" .
+			")";
 		$app->db->query($sql);
 	}
 	$msg = $wb['action_scheduled'];
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
 $app->tpl->setVar($wb);
 
@@ -101,4 +101,4 @@ $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/remote_action_osupdate.php b/interface/web/admin/remote_action_osupdate.php
index b0f287863a6933479dd0a466eb3fecd2ae8587e9..08925b0696fe17f41fef50882e42096c07462cd3 100644
--- a/interface/web/admin/remote_action_osupdate.php
+++ b/interface/web/admin/remote_action_osupdate.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -43,7 +43,7 @@ $app->tpl->setInclude('content_tpl', 'templates/remote_action_osupdate.htm');
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_remote_action.lng';
-include($lng_file);
+include $lng_file;
 
 /*
  * We need a list of all Servers
@@ -75,20 +75,20 @@ if (isset($_POST['server_select'])) {
 	}
 	foreach ($servers as $serverId) {
 		$sql = "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$serverId . ", " .
-				time() . ", " .
-				"'os_update', " .
-				"'', " .
-				"'pending', " .
-				"''" .
-				")";
+			"VALUES (".
+			(int)$serverId . ", " .
+			time() . ", " .
+			"'os_update', " .
+			"'', " .
+			"'pending', " .
+			"''" .
+			")";
 		$app->db->query($sql);
 	}
 	$msg = $wb['action_scheduled'];
 }
 
-$app->tpl->setVar('msg',$msg);
+$app->tpl->setVar('msg', $msg);
 
 $app->tpl->setVar($wb);
 
@@ -96,4 +96,4 @@ $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/remote_user_del.php b/interface/web/admin/remote_user_del.php
index 277910588dd220814b029b572296d480a72fcb95..e3a3832724d684910b52ba80882c45ce27ed1d38 100644
--- a/interface/web/admin/remote_user_del.php
+++ b/interface/web/admin/remote_user_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/remote_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,14 +48,15 @@ $app->auth->check_module_permissions('admin');
 $app->uses('tpl,tform');
 $app->load('tform_actions');
 
-// Create a class page_action that extends the tform_actions base class 
+// Create a class page_action that extends the tform_actions base class
 
-class page_action extends tform_actions { 
+class page_action extends tform_actions {
 
 
 	// Customisations for the page actions will be defined here
-   	
+
 }
+
 $page = new page_action;
 $page->onDelete();
 
diff --git a/interface/web/admin/remote_user_edit.php b/interface/web/admin/remote_user_edit.php
index a99e9837dc25cf14a3e2e29683009da84da43fbd..962aa575224beb2a253b78c2c1514d0aa64ebf33 100644
--- a/interface/web/admin/remote_user_edit.php
+++ b/interface/web/admin/remote_user_edit.php
@@ -4,13 +4,13 @@
 $tform_def_file = 'form/remote_user.tform.php';
 
 // include the core configuration and application classes
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check the  module permissions and redirect if not allowed.
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-    header('Location: ../index.php');
-    die;
+if(!stristr($_SESSION['s']['user']['modules'], 'admin')) {
+	header('Location: ../index.php');
+	die;
 }
 
 // Disable this function in demo mode
@@ -23,15 +23,15 @@ $app->load('tform_actions');
 // Create a class page_action that extends the tform_actions base class
 class page_action extends tform_actions {
 
-    //* Customisations for the page actions will be defined here
+	//* Customisations for the page actions will be defined here
 	function onShow() {
 		global $app;
-		
+
 		// Translate the items, very bad trick... :( because the language file is not loaded yet when the form file gets parsed
 		foreach($app->tform->formDef["tabs"]['remote_user']['fields']['remote_functions']['value'] as $key => $val) {
 			$app->tform->formDef["tabs"]['remote_user']['fields']['remote_functions']['value'][$key] = $app->tform->lng($val).'<br>';
 		}
-		
+
 		parent::onShow();
 	}
 
diff --git a/interface/web/admin/remote_user_list.php b/interface/web/admin/remote_user_list.php
index 90a92b517d57b4e46ae65054fa542b901c8ae3c1..1830ba562f37c6fc8e196ac99026799c6780938a 100644
--- a/interface/web/admin/remote_user_list.php
+++ b/interface/web/admin/remote_user_list.php
@@ -1,15 +1,15 @@
 <?php
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Path to the list definition file
 $list_def_file = 'list/remote_user.list.php';
 
 // Check the module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'admin')) {
-    header('Location: ../index.php');
-    die();
+if(!stristr($_SESSION['s']['user']['modules'], 'admin')) {
+	header('Location: ../index.php');
+	die();
 }
 
 // Loading the class
diff --git a/interface/web/admin/server_config_del.php b/interface/web/admin/server_config_del.php
index 7b30ea3e4d969e18fe964d1a9c9c7f34551c585f..c50ca140f3b70584b81758abeb0cc8f04bb22b2a 100644
--- a/interface/web/admin/server_config_del.php
+++ b/interface/web/admin/server_config_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/server_config.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@ if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mo
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_config_edit.php b/interface/web/admin/server_config_edit.php
index 2ebf0a177457d1d6c99d4c548f9fd4aff4094223..a47118114b4d70198e380edf8ad1a8cae576f8dd 100644
--- a/interface/web/admin/server_config_edit.php
+++ b/interface/web/admin/server_config_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/server_config.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,39 +49,39 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowEdit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
-		
+
 		if($app->tform->errorMessage == '') {
 			$app->uses('ini_parser,getconf');
-		
+
 			$section = $this->active_tab;
 			$server_id = $this->id;
-		
-			$this->dataRecord = $app->getconf->get_server_config($server_id,$section);
+
+			$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
 		}
-		
-		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
-		
+
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
+
 		$record['id'] = $this->id;
 		$app->tpl->setVar($record);
 	}
-	
+
 	function onUpdateSave($sql) {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
 		$app->uses('ini_parser,getconf');
-		
+
 		if($conf['demo_mode'] != true) {
 			$section = $app->tform->getCurrentTab();
 			$server_id = $this->id;
-		
+
 			$server_config_array = $app->getconf->get_server_config($server_id);
-			
+
 			foreach($app->tform->formDef['tabs'][$section]['fields'] as $key => $field) {
 				if ($field['formtype'] == 'CHECKBOX') {
 					if($this->dataRecord[$key] == '') {
@@ -90,18 +90,18 @@ class page_action extends tform_actions {
 					}
 				}
 			}
-		
-			$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
+
+			$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
 			$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
-		
+
 			$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
 		}
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_config_list.php b/interface/web/admin/server_config_list.php
index 5fc8ddb902007ff0d61e1ca8e86f75f011a18d21..5a1d61517b5b7040fe14e667eb0c072c9415d9af 100644
--- a/interface/web/admin/server_config_list.php
+++ b/interface/web/admin/server_config_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -50,4 +50,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_del.php b/interface/web/admin/server_del.php
index d5b3b9639f1a5b2ce9e192d1f2b9741734cb61d5..c39b73238f6abebdf0d4bdae8258587a55994b76 100644
--- a/interface/web/admin/server_del.php
+++ b/interface/web/admin/server_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/server.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@ if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mo
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_edit.php b/interface/web/admin/server_edit.php
index e718576870e282c26c2591bed13cebf5840b62a0..c81c6ee8bdb0edbadadec3ccfa18c8de89352ff6 100644
--- a/interface/web/admin/server_edit.php
+++ b/interface/web/admin/server_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/server.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -52,8 +52,8 @@ class page_action extends tform_actions {
 
 	function onShowEnd() {
 		global $app, $conf;
-		
-		// Getting Servers 
+
+		// Getting Servers
 		$sql = "SELECT server_id,server_name FROM server WHERE server_id != $this->id ORDER BY server_name";
 		$mirror_servers = $app->db->queryAllRecords($sql);
 		$mirror_server_select = '<option value="0">'.$app->tform->lng('- None -').'</option>';
@@ -63,19 +63,19 @@ class page_action extends tform_actions {
 				$mirror_server_select .= "<option value='$mirror_server[server_id]' $selected>$mirror_server[server_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("mirror_server_id",$mirror_server_select);
-		
+		$app->tpl->setVar("mirror_server_id", $mirror_server_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app;
-		
+
 		//* We do not want to mirror the the server itself
 		if($this->id == $this->dataRecord['mirror_server_id']) $this->dataRecord['mirror_server_id'] = 0;
-		
+
 		parent::onSubmit();
-		
+
 	}
 
 }
@@ -83,4 +83,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_ip_del.php b/interface/web/admin/server_ip_del.php
index 1229958e3916847dd824adaeb14d4225e9e42adb..e1df9348379850e088521152d6c96af696ef82e4 100644
--- a/interface/web/admin/server_ip_del.php
+++ b/interface/web/admin/server_ip_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/server_ip.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('admin');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_ip_edit.php b/interface/web/admin/server_ip_edit.php
index baffa1467d722aa9b576f8944ffd679c37ec371b..be48434cc17a8e4e58da4709a42157ac086c4fc8 100644
--- a/interface/web/admin/server_ip_edit.php
+++ b/interface/web/admin/server_ip_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/server_ip.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -65,9 +65,10 @@ class page_action extends tform_actions {
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_ip_list.php b/interface/web/admin/server_ip_list.php
index 939d41f34b269bfe3bf49cc457d6cd3f17dec2cc..29622428aa1208454dbaaf4c30f3fa54652801b7 100644
--- a/interface/web/admin/server_ip_list.php
+++ b/interface/web/admin/server_ip_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -51,4 +51,4 @@ $app->listform_actions->SQLOrderBy = "ORDER BY server_ip.server_id, server_ip.ip
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_list.php b/interface/web/admin/server_list.php
index 985dac6771e7d352d8ccce6889fb6b324a0bfbfc..30ba12373ab9bdf4a5c2c75ede9315e4b7571401 100644
--- a/interface/web/admin/server_list.php
+++ b/interface/web/admin/server_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_php_del.php b/interface/web/admin/server_php_del.php
index 9b6a6fed9bb2190be566460ccf2f5dae573596dd..d9c7baf2da916bbb521cb629e4c1bdd2a695342b 100644
--- a/interface/web/admin/server_php_del.php
+++ b/interface/web/admin/server_php_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/server_php.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('admin');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_php_edit.php b/interface/web/admin/server_php_edit.php
index aeac62113aebf094c9f856dd1250944fbee1c34c..e88575eb91926be8354686134104206ce058f1a1 100644
--- a/interface/web/admin/server_php_edit.php
+++ b/interface/web/admin/server_php_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/server_php.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -65,9 +65,10 @@ class page_action extends tform_actions {
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/server_php_list.php b/interface/web/admin/server_php_list.php
index bcd323bbecc746b8c10e5f858ef39e16dba8b36a..7d69ab7d25c19e803e46b61031007e0889e74a01 100644
--- a/interface/web/admin/server_php_list.php
+++ b/interface/web/admin/server_php_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -51,4 +51,4 @@ $app->listform_actions->SQLOrderBy = "ORDER BY server_php.server_id, server_php.
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_package_del.php b/interface/web/admin/software_package_del.php
index bd43b3409bcb031cf578d3ae0a219eaba66c4817..ff9ab6e5b7c84b790a49521a601db4f7d3a75981 100644
--- a/interface/web/admin/software_package_del.php
+++ b/interface/web/admin/software_package_del.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -37,7 +37,7 @@ if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mo
 
 $software_update_inst_id = $app->functions->intval($_GET['software_update_inst_id']);
 
-if($software_update_inst_id > 0) {	
+if($software_update_inst_id > 0) {
 	$app->db->datalogDelete('software_update_inst', 'software_update_inst_id', $software_update_inst_id);
 	//header('Location: admin/software_package_list.php');
 	die('HEADER_REDIRECT: admin/software_package_list.php');
@@ -50,4 +50,4 @@ if($software_update_inst_id > 0) {
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_package_edit.php b/interface/web/admin/software_package_edit.php
index 27a40f26d025d9700d850999a410e5f3c051c5f6..038f377e72cb2a0c7e06ec0851e4f8973251d982 100644
--- a/interface/web/admin/software_package_edit.php
+++ b/interface/web/admin/software_package_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/software_package.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,10 +50,10 @@ $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_install.php b/interface/web/admin/software_package_install.php
index f8381777f618a22d9cc073a378421ed7f16cae29..6150709fe67a501035682a22cd4f551ba76f551f 100644
--- a/interface/web/admin/software_package_install.php
+++ b/interface/web/admin/software_package_install.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,20 +49,20 @@ $message_ok = '';
 
 //* verify the key
 if($package['package_installable'] == 'key' && $install_key != '') {
-	
+
 	$repo = $app->db->queryOneRecord("SELECT * FROM software_repo WHERE software_repo_id = ".$package['software_repo_id']);
-	
+
 	$client = new SoapClient(null, array('location' => $repo['repo_url'],
-                                     	 'uri'      => $repo['repo_url']));
-		
+			'uri'      => $repo['repo_url']));
+
 	$install_key_verified = $client->check_installable($package_name, $install_key, $repo['repo_username'], $repo['repo_password']);
-	
+
 	if($install_key_verified == false) {
 		//$install_key = '';
 		$message_err = 'Verification of the key failed.';
 	} else {
 		// Store the verified key into the database
-		$app->db->datalogUpdate('software_package', "package_key = '$install_key'", 'package_id',$package['package_id']);
+		$app->db->datalogUpdate('software_package', "package_key = '$install_key'", 'package_id', $package['package_id']);
 	}
 } else {
 	$message_ok = 'Please enter the software key for the package.';
@@ -73,64 +73,64 @@ if($install_server_id > 0 && $package_name != '' && ($package['package_installab
 	$sql = "SELECT software_update_id, package_name, update_title FROM software_update WHERE type = 'full' AND package_name = '$package_name' ORDER BY v1 DESC, v2 DESC, v3 DESC, v4 DESC LIMIT 0,1";
 	$tmp = $app->db->queryOneRecord($sql);
 	$software_update_id = $tmp['software_update_id'];
-	
+
 	//* if package requires a DB and there is no data for a db in config, then we create this data now
 	if($package['package_requires_db'] == 'mysql') {
 		$app->uses('ini_parser,getconf');
-		
+
 		$package_config_array = array();
 		if(trim($package['package_config']) != '') {
 			$package_config_array = $app->ini_parser->parse_ini_string(stripslashes($package['package_config']));
 		}
-		
+
 		if(!isset($package_config_array['mysql'])) {
-			$package_config_array['mysql'] = array(	'database_name' => 'ispapp'.$package['package_id'],
-													'database_user' => 'ispapp'.$package['package_id'],
-													'database_password' => md5(mt_rand()),
-													'database_host' => 'localhost');
+			$package_config_array['mysql'] = array( 'database_name' => 'ispapp'.$package['package_id'],
+				'database_user' => 'ispapp'.$package['package_id'],
+				'database_password' => md5(mt_rand()),
+				'database_host' => 'localhost');
 			$package_config_str = $app->ini_parser->get_ini_string($package_config_array);
 			$package['package_config'] = $package_config_str;
-			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id',$package['package_id']);
+			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id', $package['package_id']);
 		}
 	}
-	
+
 	//* If the packages requires a remote user
 	if($package['package_remote_functions'] != '') {
-		
+
 		if(trim($package['package_config']) != '') {
 			$package_config_array = $app->ini_parser->parse_ini_string(stripslashes($package['package_config']));
 		}
-		
+
 		if(!isset($package_config_array['remote_api'])) {
 			$remote_user = 'ispapp'.$package['package_id'];
 			$remote_password = md5(mt_rand());
 			$remote_functions = $app->db->quote($package['package_remote_functions']);
-			
+
 			$package_config_array['remote_api'] = array(
-													'remote_hostname'	=> $_SERVER['HTTP_HOST'],
-													'remote_user' 		=> $remote_user,
-													'remote_password' 	=> $remote_password
-														);
+				'remote_hostname' => $_SERVER['HTTP_HOST'],
+				'remote_user'   => $remote_user,
+				'remote_password'  => $remote_password
+			);
 
 			$package_config_str = $app->ini_parser->get_ini_string($package_config_array);
 			$package['package_config'] = $package_config_str;
 			$remote_password_md5 = md5($remote_password);
-			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id',$package['package_id']);
-			
+			$app->db->datalogUpdate('software_package', "package_config = '".$app->db->quote($package_config_str)."'", 'package_id', $package['package_id']);
+
 			$sql = "INSERT INTO `remote_user` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `remote_username`, `remote_password`, `remote_functions`) VALUES
 					(1, 1, 'riud', 'riud', '', '$remote_user', '$remote_password_md5', '$remote_functions');";
-			
+
 			$app->db->query($sql);
-			
+
 		}
-	
+
 	}
-	
+
 	//* Add the record to start the install process
 	$insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$install_server_id', '$software_update_id','installing')";
 	$app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id');
 	$message_ok = 'Starting package installation '."<a href=\"#\" onclick=\"submitForm('pageForm','admin/software_package_list.php');\">".$app->lng('next')."</a>";
-	
+
 }
 
 if(count($_POST) > 2 && $install_key == '') {
@@ -147,17 +147,17 @@ if($package['package_installable'] == 'key' && !$install_key_verified) {
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/software_package_install.htm');
+$app->tpl->setInclude('content_tpl', 'templates/software_package_install.htm');
 
-$app->tpl->setVar('message_ok',$message_ok);
-$app->tpl->setVar('message_err',$message_err);
-$app->tpl->setVar('insert_key',$insert_key);
-$app->tpl->setVar('install_key',$install_key);
-$app->tpl->setVar('package_name',$package_name);
-$app->tpl->setVar('server_id',$install_server_id);
+$app->tpl->setVar('message_ok', $message_ok);
+$app->tpl->setVar('message_err', $message_err);
+$app->tpl->setVar('insert_key', $insert_key);
+$app->tpl->setVar('install_key', $install_key);
+$app->tpl->setVar('package_name', $package_name);
+$app->tpl->setVar('server_id', $install_server_id);
 
 
-include_once('lib/lang/en_software_package_install.lng');
+include_once 'lib/lang/en_software_package_install.lng';
 $app->tpl->setVar($wb);
 
 
diff --git a/interface/web/admin/software_package_list.php b/interface/web/admin/software_package_list.php
index af6887b666cf897abdc88029d00233f4ba2aa4bc..e05ccc9f8b7bc6060b438ac2724c95718eef4c29 100644
--- a/interface/web/admin/software_package_list.php
+++ b/interface/web/admin/software_package_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -43,14 +43,14 @@ $repos = $app->db->queryAllRecords("SELECT software_repo_id, repo_url, repo_user
 if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate' ) {
 	foreach($repos as $repo) {
 		$client = new SoapClient(null, array('location' => $repo['repo_url'],
-                                     		 'uri'      => $repo['repo_url']));
-		
+				'uri'      => $repo['repo_url']));
+
 		$packages = $client->get_packages($repo['repo_username'], $repo['repo_password']);
 		if(is_array($packages)) {
 			foreach($packages as $p) {
 				$package_name = $app->db->quote($p['name']);
 				$tmp = $app->db->queryOneRecord("SELECT package_id FROM software_package WHERE package_name = '$package_name'");
-				
+
 				$package_title = $app->db->quote($p['title']);
 				$package_description = $app->db->quote($p['description']);
 				$software_repo_id = $app->functions->intval($repo['software_repo_id']);
@@ -58,7 +58,7 @@ if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate'
 				$package_installable = $app->db->quote($p['installable']);
 				$package_requires_db = $app->db->quote($p['requires_db']);
 				$package_remote_functions = $app->db->quote($p['remote_functions']);
-				
+
 				if(empty($tmp['package_id'])) {
 					//$sql = "INSERT INTO software_package (software_repo_id, package_name, package_title, package_description,package_type,package_installable,package_requires_db) VALUES ($software_repo_id, '$package_name', '$package_title', '$package_description','$package_type','$package_installable','$package_requires_db')";
 					//$app->db->query($sql);
@@ -70,53 +70,53 @@ if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate'
 					//$app->db->query($sql);
 					$update_data = "software_repo_id = $software_repo_id, package_title = '$package_title', package_description = '$package_description', package_type = '$package_type', package_installable = '$package_installable', package_requires_db = '$package_requires_db', package_remote_functions = '$package_remote_functions'";
 					//echo $update_data;
-					$app->db->datalogUpdate('software_package', $update_data, 'package_id',$tmp['package_id']);
+					$app->db->datalogUpdate('software_package', $update_data, 'package_id', $tmp['package_id']);
 				}
 			}
 		}
-        
-        $packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC");
-        if(is_array($packages)) {
-            foreach($packages as $p) {
-            
-                $version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4'];
-                $updates = $client->get_updates($p['package_name'], $version,$repo['repo_username'], $repo['repo_password']);
-                
-                if(is_array($updates)) {
-                    foreach($updates as $u) {
-                        
-                        $version_array = explode('.',$u['version']);
-                        $v1 = $app->functions->intval($version_array[0]);
-                        $v2 = $app->functions->intval($version_array[1]);
-                        $v3 = $app->functions->intval($version_array[2]);
-                        $v4 = $app->functions->intval($version_array[3]);
-                        
-                        $package_name = $app->db->quote($u['package_name']);
-                        $software_repo_id = $app->functions->intval($repo['software_repo_id']);
-                        $update_url = $app->db->quote($u['url']);
-                        $update_md5 = $app->db->quote($u['md5']);
-                        $update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):'';
-                        $update_title = $app->db->quote($u['title']);
-                        $type = $app->db->quote($u['type']);
-                        
-                        // Check that we do not have this update in the database yet
-                        $sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'";
-                        $tmp = $app->db->queryOneRecord($sql);
-                        if(!isset($tmp['software_update_id'])) {
-                            // Insert the update in the datbase
-                            //$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) 
-                            //VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
-                            //die($sql);
-                            //$app->db->query($sql);
-							$insert_data = "(software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) 
+
+		$packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC");
+		if(is_array($packages)) {
+			foreach($packages as $p) {
+
+				$version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4'];
+				$updates = $client->get_updates($p['package_name'], $version, $repo['repo_username'], $repo['repo_password']);
+
+				if(is_array($updates)) {
+					foreach($updates as $u) {
+
+						$version_array = explode('.', $u['version']);
+						$v1 = $app->functions->intval($version_array[0]);
+						$v2 = $app->functions->intval($version_array[1]);
+						$v3 = $app->functions->intval($version_array[2]);
+						$v4 = $app->functions->intval($version_array[3]);
+
+						$package_name = $app->db->quote($u['package_name']);
+						$software_repo_id = $app->functions->intval($repo['software_repo_id']);
+						$update_url = $app->db->quote($u['url']);
+						$update_md5 = $app->db->quote($u['md5']);
+						$update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):'';
+						$update_title = $app->db->quote($u['title']);
+						$type = $app->db->quote($u['type']);
+
+						// Check that we do not have this update in the database yet
+						$sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'";
+						$tmp = $app->db->queryOneRecord($sql);
+						if(!isset($tmp['software_update_id'])) {
+							// Insert the update in the datbase
+							//$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type)
+							//VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
+							//die($sql);
+							//$app->db->query($sql);
+							$insert_data = "(software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type)
                             VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
 							$app->db->datalogInsert('software_update', $insert_data, 'software_update_id');
-                        }
-                        
-                    }
-                }
-            }
-        }
+						}
+
+					}
+				}
+			}
+		}
 	}
 }
 
@@ -128,7 +128,7 @@ if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] !=
 	$sql = "SELECT software_update_id, package_name, update_title FROM software_update WHERE type = 'full' AND package_name = '$package_name' ORDER BY v1 DESC, v2 DESC, v3 DESC, v4 DESC LIMIT 0,1";
 	$tmp = $app->db->queryOneRecord($sql);
 	$software_update_id = $tmp['software_update_id'];
-	
+
 	$insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')";
 	// $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installed')";
 	$app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id');
@@ -141,7 +141,7 @@ if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] !=
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/software_package_list.htm');
+$app->tpl->setInclude('content_tpl', 'templates/software_package_list.htm');
 
 
 $servers = $app->db->queryAllRecords('SELECT server_id, server_name FROM server ORDER BY server_name');
@@ -152,13 +152,13 @@ if(is_array($packages) && count($packages) > 0) {
 		foreach($servers as $s) {
 			$inst = $app->db->queryOneRecord("SELECT * FROM software_update, software_update_inst WHERE software_update_inst.software_update_id = software_update.software_update_id AND software_update_inst.package_name = '".addslashes($p["package_name"])."' AND server_id = '".$s["server_id"]."'");
 			$version = $inst['v1'].'.'.$inst['v2'].'.'.$inst['v3'].'.'.$inst['v4'];
-			
+
 			if($inst['status'] == 'installed') {
 				$installed_txt .= $s['server_name'].": ".$app->lng("Installed version $version")."<br />";
-            } elseif ($inst['status'] == 'installing') {
-                $installed_txt .= $s['server_name'].": ".$app->lng("Installation in progress")."<br />";
-            } elseif ($inst['status'] == 'failed') {
-                $installed_txt .= $s['server_name'].": ".$app->lng("Installation failed")."<br />";
+			} elseif ($inst['status'] == 'installing') {
+				$installed_txt .= $s['server_name'].": ".$app->lng("Installation in progress")."<br />";
+			} elseif ($inst['status'] == 'failed') {
+				$installed_txt .= $s['server_name'].": ".$app->lng("Installation failed")."<br />";
 			} elseif ($inst['status'] == 'deleting') {
 				$installed_txt .= $s['server_name'].": ".$app->lng("Deletion in progress")."<br />";
 			} else {
@@ -172,17 +172,17 @@ if(is_array($packages) && count($packages) > 0) {
 		$packages[$key]['software_update_inst_id'] = intval($inst['software_update_inst_id']);
 		$packages[$key]['installed'] = $installed_txt;
 	}
-	$app->tpl->setVar('has_packages',1);
+	$app->tpl->setVar('has_packages', 1);
 } else {
-	$app->tpl->setVar('has_packages',0);
+	$app->tpl->setVar('has_packages', 0);
 }
 
 
 
-$app->tpl->setLoop('records',$packages);
+$app->tpl->setLoop('records', $packages);
 
 $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
-include_once('lib/lang/'.$language.'_software_package_list.lng');
+include_once 'lib/lang/'.$language.'_software_package_list.lng';
 $app->tpl->setVar($wb);
 
 
@@ -190,4 +190,4 @@ $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_repo_del.php b/interface/web/admin/software_repo_del.php
index a6522fa5bdb081bdedf013bbf5e4bc51d25ba8fd..b8effc1d5716bf7bf4c8389f3885b7a3d6955289 100644
--- a/interface/web/admin/software_repo_del.php
+++ b/interface/web/admin/software_repo_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/software_repo.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@ if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mo
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_repo_edit.php b/interface/web/admin/software_repo_edit.php
index 17902f152eb4030c54e40a3c5c6d75ffbb1c9e48..2a6a4f42280d9e58c24d44189ccbbb3555cf7aa8 100644
--- a/interface/web/admin/software_repo_edit.php
+++ b/interface/web/admin/software_repo_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/software_repo.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,10 +50,10 @@ $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_repo_list.php b/interface/web/admin/software_repo_list.php
index 0c05490ba0dd985e0ea19935bfd172ba8f150166..b8afc8f9bc8f6bde874e87e75feb42e93587bd6f 100644
--- a/interface/web/admin/software_repo_list.php
+++ b/interface/web/admin/software_repo_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php
index 682a644bc526d178a48dbb6705ebe1f134b09d32..9a1df8a37f4cd6d66b97f0c101d9e9046fe53215 100644
--- a/interface/web/admin/software_update_list.php
+++ b/interface/web/admin/software_update_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -42,7 +42,7 @@ $updates_added = 0;
 $repos = $app->db->queryAllRecords("SELECT software_repo_id, repo_url, repo_username, repo_password FROM software_repo WHERE active = 'y'");
 if(is_array($repos)) {
 	foreach($repos as $repo) {
-	
+
 		/*
 		SELECT software_package.package_name, v1, v2, v3, v4
 		FROM software_package
@@ -51,26 +51,26 @@ if(is_array($repos)) {
 		GROUP BY package_name
 		ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC
 		*/
-		
+
 		$client = new SoapClient(null, array('location' => $repo['repo_url'],
-                                     		 'uri'      => $repo['repo_url']));
-		
+				'uri'      => $repo['repo_url']));
+
 		$packages = $app->db->queryAllRecords("SELECT software_package.package_name, v1, v2, v3, v4 FROM software_package LEFT JOIN software_update ON ( software_package.package_name = software_update.package_name ) GROUP BY package_name ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC");
 		if(is_array($packages)) {
 			foreach($packages as $p) {
-			
+
 				$version = $p['v1'].'.'.$p['v2'].'.'.$p['v3'].'.'.$p['v4'];
-				$updates = $client->get_updates($p['package_name'], $version,$repo['repo_username'], $repo['repo_password']);
-				
+				$updates = $client->get_updates($p['package_name'], $version, $repo['repo_username'], $repo['repo_password']);
+
 				if(is_array($updates)) {
 					foreach($updates as $u) {
-						
-						$version_array = explode('.',$u['version']);
+
+						$version_array = explode('.', $u['version']);
 						$v1 = $app->functions->intval($version_array[0]);
 						$v2 = $app->functions->intval($version_array[1]);
 						$v3 = $app->functions->intval($version_array[2]);
 						$v4 = $app->functions->intval($version_array[3]);
-						
+
 						$package_name = $app->db->quote($u['package_name']);
 						$software_repo_id = $app->functions->intval($repo['software_repo_id']);
 						$update_url = $app->db->quote($u['url']);
@@ -78,18 +78,18 @@ if(is_array($repos)) {
 						$update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):'';
 						$update_title = $app->db->quote($u['title']);
 						$type = $app->db->quote($u['type']);
-						
+
 						// Check that we do not have this update in the database yet
 						$sql = "SELECT * FROM software_update WHERE package_name = '$package_name' and v1 = '$v1' and v2 = '$v2' and v3 = '$v3' and v4 = '$v4'";
 						$tmp = $app->db->queryOneRecord($sql);
 						if(!isset($tmp['software_update_id'])) {
 							// Insert the update in the datbase
-							$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type) 
+							$sql = "INSERT INTO software_update (software_repo_id, package_name, update_url, update_md5, update_dependencies, update_title, v1, v2, v3, v4, type)
 							VALUES ($software_repo_id, '$package_name', '$update_url', '$update_md5', '$update_dependencies', '$update_title', '$v1', '$v2', '$v3', '$v4', '$type')";
 							//die($sql);
 							$app->db->query($sql);
 						}
-						
+
 					}
 				}
 			}
@@ -103,11 +103,11 @@ if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] !=
 	$package_name = $app->db->quote($_GET['package']);
 	$server_id = $app->functions->intval($_GET['server_id']);
 	$software_update_id = $app->functions->intval($_GET['id']);
-	
+
 	$insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')";
 	// $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installed')";
 	$app->db->datalogInsert('software_update_inst', $insert_data, 'software_update_inst_id');
-	
+
 }
 
 
@@ -116,7 +116,7 @@ if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] !=
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/software_update_list.htm');
+$app->tpl->setInclude('content_tpl', 'templates/software_update_list.htm');
 
 /*
 SELECT software_package.package_name, software_package.package_title, software_update.update_title, v1, v2, v3, v4, software_update_inst.status
@@ -144,7 +144,7 @@ foreach($servers as $key => $server) {
 	}
 }
 
-$app->tpl->setLoop('servers',$servers);
+$app->tpl->setLoop('servers', $servers);
 
 $sql = "SELECT v1, v2, v3, v4, software_update.update_title, software_update.software_update_id, software_update.package_name, v1, v2, v3, v4, software_update_inst.status
 		FROM software_update LEFT JOIN software_update_inst ON ( software_update.software_update_id = software_update_inst.software_update_id )
@@ -159,25 +159,25 @@ $records_out = array();
 
 if(is_array($installed_packages)) {
 	foreach($installed_packages as $ip) {
-		
+
 		// Get version number of the latest installed version
 		$sql = "SELECT v1, v2, v3, v4 FROM software_update, software_update_inst WHERE software_update.software_update_id = software_update_inst.software_update_id AND server_id = ".$server_id." ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC LIMIT 0,1";
 		$lu = $app->db->queryOneRecord($sql);
-		
+
 		// Get all installable updates
 		$sql = "SELECT * FROM software_update WHERE v1 >= $lu[v1] AND v2 >= $lu[v2] AND v3 >= $lu[v3] AND v4 >= $lu[v4] AND package_name = '$ip[package_name]' ORDER BY v1 DESC , v2 DESC , v3 DESC , v4 DESC";
 		$updates = $app->db->queryAllRecords($sql);
 		//die($sql);
-		
+
 		if(is_array($updates)) {
 			// Delete the last record as it is already installed
 			unset($updates[count($updates)-1]);
-			
+
 			foreach($updates as $key => $u) {
 				$version = $u['v1'].'.'.$u['v2'].'.'.$u['v3'].'.'.$u['v4'];
 				$installed_txt = "<a href=\"#\" onclick=\"loadContent('admin/software_update_list.php?action=install&package=".$u["package_name"]."&id=".$u["software_update_id"]."&server_id=".$server_id."');\">Install Update</a><br />";
 				$records_out[] = array('version' => $version, 'update_title' => $u["update_title"], 'installed' => $installed_txt);
-		
+
 			}
 		}
 	}
@@ -193,7 +193,7 @@ $updates = $app->db->queryAllRecords('SELECT software_update.update_title, softw
 if(is_array($updates)) {
 	foreach($updates as $key => $u) {
 		$installed_txt = '';
-		
+
 		$version = $u['v1'].'.'.$u['v2'].'.'.$u['v3'].'.'.$u['v4'];
 		$updates[$key]['version'] = $version;
 		if($u['status'] == 'installed' || $u['status'] == 'installing' || $u['status'] == 'deleting') {
@@ -202,17 +202,17 @@ if(is_array($updates)) {
 			$installed_txt .= "<a href=\"#\" onclick=\"loadContent('admin/software_update_list.php?action=install&package=".$u["package_name"]."&id=".$u["software_update_id"]."&server_id=".$server_id."');\">Install now</a><br />";
 		}
 		$updates[$key]['installed'] = $installed_txt;
-		
+
 	}
 }
 */
 
 
 
-$app->tpl->setLoop('records',$records_out);
+$app->tpl->setLoop('records', $records_out);
 
 $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
-include_once('lib/lang/'.$language.'_software_update_list.lng');
+include_once 'lib/lang/'.$language.'_software_update_list.lng';
 $app->tpl->setVar($wb);
 
 
@@ -220,4 +220,4 @@ $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/system_config_edit.php b/interface/web/admin/system_config_edit.php
index c2702c78f74b42fc911035b63952b6df4bc847fc..d267c8eea8dd320936d26a920b63b2519f0c4b27 100644
--- a/interface/web/admin/system_config_edit.php
+++ b/interface/web/admin/system_config_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/system_config.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -54,15 +54,15 @@ class page_action extends tform_actions {
 
 	function onShowEdit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
-		
+
 		if($app->tform->errorMessage == '') {
 			$app->uses('ini_parser,getconf');
-			
+
 			$section = $this->active_tab;
 			$server_id = $this->id;
-		
+
 			$this->dataRecord = $app->getconf->get_global_config($section);
 			if ($section == 'domains'){
 				if (isset($this->dataRecord['use_domain_module'])){
@@ -70,61 +70,61 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
-		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
-		
+
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
+
 		$record['warning'] = $app->tform->lng('warning');
 		$record['id'] = $this->id;
 		$app->tpl->setVar($record);
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// available dashlets
 		$available_dashlets_txt = '';
-		$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets'); 
-		while ($file = @readdir ($handle)) { 
+		$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
+		while ($file = @readdir($handle)) {
 			if ($file != '.' && $file != '..' && !is_dir($file)) {
-				$available_dashlets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.substr($file,0,-4).']<pre class="addPlaceholderContent" style="display:none;">['.substr($file,0,-4).'],</pre></a> ';
+				$available_dashlets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.substr($file, 0, -4).']<pre class="addPlaceholderContent" style="display:none;">['.substr($file, 0, -4).'],</pre></a> ';
 			}
 		}
-		
+
 		if($available_dashlets_txt == '') $available_dashlets_txt = '------';
-		$app->tpl->setVar("available_dashlets_txt",$available_dashlets_txt);
-		
+		$app->tpl->setVar("available_dashlets_txt", $available_dashlets_txt);
+
 		parent::onShowEnd();
 	}
-	
-    function onSubmit() {
-        global $app;
-        
-        $app->uses('ini_parser,getconf');
-		
-        $section = $app->tform->getCurrentTab();
-		
+
+	function onSubmit() {
+		global $app;
+
+		$app->uses('ini_parser,getconf');
+
+		$section = $app->tform->getCurrentTab();
+
 		$server_config_array = $app->getconf->get_global_config();
-		$new_config = $app->tform->encode($this->dataRecord,$section);
-        if($section == 'mail') {
-            if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
-            if($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) {
-                $app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt");
-            }
-        }
-        
-        parent::onSubmit();
-    }
-    
+		$new_config = $app->tform->encode($this->dataRecord, $section);
+		if($section == 'mail') {
+			if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
+			if($new_config['smtp_enabled'] == 'y' && ($new_config['admin_mail'] == '' || $new_config['admin_name'] == '')) {
+				$app->tform->errorMessage .= $app->tform->lng("smtp_missing_admin_mail_txt");
+			}
+		}
+
+		parent::onSubmit();
+	}
+
 	function onUpdateSave($sql) {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
 		$app->uses('ini_parser,getconf');
-		
+
 		$section = $app->tform->getCurrentTab();
-		
+
 		$server_config_array = $app->getconf->get_global_config();
-		
+
 		foreach($app->tform->formDef['tabs'][$section]['fields'] as $key => $field) {
 			if ($field['formtype'] == 'CHECKBOX') {
 				if($this->dataRecord[$key] == '') {
@@ -133,26 +133,26 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		/*
 		if((isset($this->dataRecord['use_loadindicator']) && $this->dataRecord['use_loadindicator'] != $server_config_array[$section]['use_loadindicator']) || (isset($this->dataRecord['use_combobox']) && $this->dataRecord['use_combobox'] != $server_config_array[$section]['use_combobox'])){
 			$this->_js_changed = true;
 		}
 		*/
 
-		$new_config = $app->tform->encode($this->dataRecord,$section);
-        if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') {
-            // check for existing vhost subdomains, if found the mode cannot be disabled
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'");
-            if($check['cnt'] > 0) {
-                $new_config['vhost_subdomains'] = 'y';
-            }
-        } elseif($section == 'mail') {
-            if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
-        }
-        $server_config_array[$section] = $new_config;
+		$new_config = $app->tform->encode($this->dataRecord, $section);
+		if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') {
+			// check for existing vhost subdomains, if found the mode cannot be disabled
+			$check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'");
+			if($check['cnt'] > 0) {
+				$new_config['vhost_subdomains'] = 'y';
+			}
+		} elseif($section == 'mail') {
+			if($new_config['smtp_pass'] == '') $new_config['smtp_pass'] = $server_config_array['smtp_pass'];
+		}
+		$server_config_array[$section] = $new_config;
 		$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
-		
+
 		//$sql = "UPDATE sys_ini SET config = '".$app->db->quote($server_config_str)."' WHERE sysini_id = 1";
 		//if($conf['demo_mode'] != true) $app->db->query($sql);
 		if($conf['demo_mode'] != true) $app->db->datalogUpdate('sys_ini', "config = '".$app->db->quote($server_config_str)."'", 'sysini_id', 1);
@@ -161,9 +161,9 @@ class page_action extends tform_actions {
 		 * If we should use the domain-module, we have to insert all existing domains into the table
 		 * (only the first time!)
 		 */
-		if (($section == 'domains') && 
-				($_SESSION['use_domain_module_old_value'] == '') &&
-				($server_config_array['domains']['use_domain_module'] == 'y')){
+		if (($section == 'domains') &&
+			($_SESSION['use_domain_module_old_value'] == '') &&
+			($server_config_array['domains']['use_domain_module'] == 'y')){
 			$sql = "REPLACE INTO domain (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain ) " .
 				"SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, domain " .
 				"FROM mail_domain";
@@ -173,7 +173,7 @@ class page_action extends tform_actions {
 				"FROM web_domain WHERE type NOT IN ('subdomain','vhostsubdomain')";
 			$app->db->query($sql);
 		}
-		
+
 		// Maintenance mode
 		if($server_config_array['misc']['maintenance_mode'] == 'y'){
 			//print_r($_SESSION);
@@ -181,7 +181,7 @@ class page_action extends tform_actions {
 			$app->db->query("DELETE FROM sys_session WHERE session_id != '".$_SESSION['s']['id']."'");
 		}
 	}
-	
+
 	/*
 	function onAfterUpdate() {
         if($this->_js_changed == true) {
@@ -192,11 +192,11 @@ class page_action extends tform_actions {
         }
     }
 	*/
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/tpl_default.php b/interface/web/admin/tpl_default.php
index 80de37b8e84df42f12ab9c31977d6a3308ffed12..b9477f1e39da58875d3ee46ac8c28396ec035eb7 100644
--- a/interface/web/admin/tpl_default.php
+++ b/interface/web/admin/tpl_default.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/tpl_default.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -50,24 +50,24 @@ $app->load('tform_actions');
 
 class page_action extends tform_actions {
 
-//	function onBeforeUpdate() {
-//		global $app, $conf;
-//
-//		//* Check if the server has been changed
-//		// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
-//		if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["server_id"])) {
-//			$rec = $app->db->queryOneRecord("SELECT server_id from server_php WHERE server_php_id = ".$this->id);
-//			if($rec['server_id'] != $this->dataRecord["server_id"]) {
-//				//* Add a error message and switch back to old server
-//				$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
-//				$this->dataRecord["server_id"] = $rec['server_id'];
-//			}
-//			unset($rec);
-//		}
-//	}
+	// function onBeforeUpdate() {
+	//  global $app, $conf;
+	//
+	//  //* Check if the server has been changed
+	//  // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
+	//  if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["server_id"])) {
+	//   $rec = $app->db->queryOneRecord("SELECT server_id from server_php WHERE server_php_id = ".$this->id);
+	//   if($rec['server_id'] != $this->dataRecord["server_id"]) {
+	//    //* Add a error message and switch back to old server
+	//    $app->tform->errorMessage .= $app->lng('The Server can not be changed.');
+	//    $this->dataRecord["server_id"] = $rec['server_id'];
+	//   }
+	//   unset($rec);
+	//  }
+	// }
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/users_del.php b/interface/web/admin/users_del.php
index dfea889740a8d2b96380b386988cc53fb3c99c4e..299eed2755d5b2f7aa9c638654a2220eab8cfdcc 100644
--- a/interface/web/admin/users_del.php
+++ b/interface/web/admin/users_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/users.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,4 +49,4 @@ if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This functio
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/users_edit.php b/interface/web/admin/users_edit.php
index 487be72ce8d667de3e05cdb737e1b0cb431bcdb0..d94ef61243e5c3f2f49fe6402c338da992df8e47 100644
--- a/interface/web/admin/users_edit.php
+++ b/interface/web/admin/users_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/users.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -49,33 +49,33 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onBeforeInsert() {
 		global $app, $conf;
-		
-		if(!in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(!in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true && $_REQUEST['id'] <= 3) $app->error('This function is disabled in demo mode.');
-		
-		if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
 		$this->oldDataRecord = $app->tform->getDataRecord($this->id);
 	}
-	
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
 	*/
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		$client = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = ".$this->id);
 		$client_id = $client['client_id'];
 		$username = $app->db->quote($this->dataRecord["username"]);
@@ -89,28 +89,28 @@ class page_action extends tform_actions {
 			$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
 			unset($tmp);
 		}
-		
+
 		// password changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["passwort"]) && $this->dataRecord["passwort"] != '') {
 			$password = $app->db->quote($this->dataRecord["passwort"]);
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 			for ($n=0;$n<8;$n++) {
-				$salt.=$base64_alphabet[mt_rand(0,63)];
+				$salt.=$base64_alphabet[mt_rand(0, 63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
+			$password = crypt(stripslashes($password), $salt);
 			$sql = "UPDATE client SET password = '$password' WHERE client_id = $client_id AND username = '$username'";
 			$app->db->query($sql);
 		}
-		
+
 		// language changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
 			$sql = "UPDATE client SET language = '$language' WHERE client_id = $client_id AND username = '$username'";
 			$app->db->query($sql);
 		}
-		
+
 		// reseller status changed
 		/*
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
@@ -130,4 +130,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/admin/users_list.php b/interface/web/admin/users_list.php
index 412d4fa562e0ec4b9776ee8541417498bf002c07..1f83258929cc1942f3b7fea786cf89f91dc9b2ef 100644
--- a/interface/web/admin/users_list.php
+++ b/interface/web/admin/users_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY sys_user.username';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/capp.php b/interface/web/capp.php
index 7917aa0bbbeb6bc81c50928cb62bc03c0f79b1e1..2c143180f0cb24f459c53757af4f5a158a3346cd 100644
--- a/interface/web/capp.php
+++ b/interface/web/capp.php
@@ -28,8 +28,8 @@ 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');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 //* Import module variable
 $mod = $_REQUEST["mod"];
@@ -45,28 +45,28 @@ if($_SESSION["s"]["user"]['active'] != 1) {
 if(!preg_match("/^[a-z]{2,20}$/i", $mod)) die('module name contains unallowed chars.');
 
 //* Check if user may use the module.
-$user_modules = explode(",",$_SESSION["s"]["user"]["modules"]);
+$user_modules = explode(",", $_SESSION["s"]["user"]["modules"]);
 
-if(!in_array($mod,$user_modules)) $app->error($app->lng(301));
+if(!in_array($mod, $user_modules)) $app->error($app->lng(301));
 
 //* Load module configuration into the session.
 if(is_file($mod."/lib/module.conf.php")) {
-	include_once($mod."/lib/module.conf.php");
-	
-    $menu_dir = ISPC_WEB_PATH.'/' . $mod . '/lib/menu.d';
+	include_once $mod."/lib/module.conf.php";
 
-    if (is_dir($menu_dir)) {
-        if ($dh = opendir($menu_dir)) {
-            //** Go through all files in the menu dir
-            while (($file = readdir($dh)) !== false) {
-                if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
-                    include_once($menu_dir . '/' . $file);
-                }
-            }
-        }
-    }
-    
-    $_SESSION["s"]["module"] = $module;
+	$menu_dir = ISPC_WEB_PATH.'/' . $mod . '/lib/menu.d';
+
+	if (is_dir($menu_dir)) {
+		if ($dh = opendir($menu_dir)) {
+			//** Go through all files in the menu dir
+			while (($file = readdir($dh)) !== false) {
+				if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+					include_once $menu_dir . '/' . $file;
+				}
+			}
+		}
+	}
+
+	$_SESSION["s"]["module"] = $module;
 	session_write_close();
 	if($redirect == ''){
 		echo "HEADER_REDIRECT:".$_SESSION["s"]["module"]["startpage"];
@@ -77,4 +77,4 @@ if(is_file($mod."/lib/module.conf.php")) {
 } else {
 	$app->error($app->lng(302));
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_circle_del.php b/interface/web/client/client_circle_del.php
index 5764eb52cfe1a21dcbb161d9b4e0b755d8412a1b..702d54721b1831294965539bd75722f7d5827985 100644
--- a/interface/web/client/client_circle_del.php
+++ b/interface/web/client/client_circle_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/client_circle.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
diff --git a/interface/web/client/client_circle_edit.php b/interface/web/client/client_circle_edit.php
index 407efba55096692bee84aced63631f80f3b44db0..679b8023a683e6a1bdd64018cfeb0512844249ce 100644
--- a/interface/web/client/client_circle_edit.php
+++ b/interface/web/client/client_circle_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/client_circle.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
diff --git a/interface/web/client/client_circle_list.php b/interface/web/client/client_circle_list.php
index f37da38712f98d96cfb963a61fa0de7956ed08f0..94c6d164e64a8e87db50a92070d6346ff3318f61 100644
--- a/interface/web/client/client_circle_list.php
+++ b/interface/web/client/client_circle_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY client_circle.circle_name, client
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php
index ecee8f5b6cb7b2f8deb2336f31b2647eb8464bf0..a8cd7cc954749bbb3ca8809c3763177f2f06206b 100644
--- a/interface/web/client/client_del.php
+++ b/interface/web/client/client_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/client.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -50,90 +50,90 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onDelete() {
-		global $app, $conf,$list_def_file,$tform_def_file;
-		
+		global $app, $conf, $list_def_file, $tform_def_file;
+
 		// Loading tform framework
-        if(!is_object($app->tform)) $app->uses('tform');
-		
+		if(!is_object($app->tform)) $app->uses('tform');
+
 		if($_POST["confirm"] == 'yes') {
 			parent::onDelete();
 		} else {
-		
-		$app->uses('tpl');
-		$app->tpl->newTemplate("form.tpl.htm");
-		$app->tpl->setInclude('content_tpl', 'templates/client_del.htm');
-		
-		include_once($list_def_file);
-		
-		// Load table definition from file
-        $app->tform->loadFormDef($tform_def_file);
-		
-		$this->id = $app->functions->intval($_REQUEST["id"]);
-		
-		$this->dataRecord = $app->tform->getDataRecord($this->id);
-		$client_id = $app->functions->intval($this->dataRecord['client_id']);
 
-        
-		//$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
-		//$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
-		$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-		
-		// Get all records (sub-clients, mail, web, etc....)  of this client.
-		$tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain';
-		$tables_array = explode(',',$tables);
-		$client_group_id = $app->functions->intval($client_group['groupid']);
-		
-		$table_list = array();
-		if($client_group_id > 1) {
-			foreach($tables_array as $table) {
-				if($table != '') {
-					$records = $app->db->queryAllRecords("SELECT * FROM $table WHERE sys_groupid = ".$client_group_id);
-					$number = count($records);
-					if($number > 0) $table_list[] = array('table' => $table."(".$number.")");
+			$app->uses('tpl');
+			$app->tpl->newTemplate("form.tpl.htm");
+			$app->tpl->setInclude('content_tpl', 'templates/client_del.htm');
+
+			include_once $list_def_file;
+
+			// Load table definition from file
+			$app->tform->loadFormDef($tform_def_file);
+
+			$this->id = $app->functions->intval($_REQUEST["id"]);
+
+			$this->dataRecord = $app->tform->getDataRecord($this->id);
+			$client_id = $app->functions->intval($this->dataRecord['client_id']);
+
+
+			//$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
+			//$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
+			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
+
+			// Get all records (sub-clients, mail, web, etc....)  of this client.
+			$tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain';
+			$tables_array = explode(',', $tables);
+			$client_group_id = $app->functions->intval($client_group['groupid']);
+
+			$table_list = array();
+			if($client_group_id > 1) {
+				foreach($tables_array as $table) {
+					if($table != '') {
+						$records = $app->db->queryAllRecords("SELECT * FROM $table WHERE sys_groupid = ".$client_group_id);
+						$number = count($records);
+						if($number > 0) $table_list[] = array('table' => $table."(".$number.")");
+					}
 				}
 			}
-		}
-		
-		$app->tpl->setVar('id',$this->id);
-		$app->tpl->setVar('number_records',$number);
-		$app->tpl->setLoop('records', $table_list);
-		
-		//* load language file 
-		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_del.lng';
-		include($lng_file);
-		$app->tpl->setVar($wb);
-		
-		$app->tpl_defaults();
-		$app->tpl->pparse();
+
+			$app->tpl->setVar('id', $this->id);
+			$app->tpl->setVar('number_records', $number);
+			$app->tpl->setLoop('records', $table_list);
+
+			//* load language file
+			$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_del.lng';
+			include $lng_file;
+			$app->tpl->setVar($wb);
+
+			$app->tpl_defaults();
+			$app->tpl->pparse();
 		}
 	}
-	
-	
-	
-	
+
+
+
+
 	function onBeforeDelete() {
 		global $app, $conf;
-		
+
 		$client_id = $app->functions->intval($this->dataRecord['client_id']);
-		
-		if($client_id > 0) {			
+
+		if($client_id > 0) {
 			// remove the group of the client from the resellers group
 			$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
 			$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
 			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-			$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
-			
+			$app->auth->remove_group_from_user($parent_user['userid'], $client_group['groupid']);
+
 			// delete the group of the client
 			$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
-			
+
 			// delete the sys user(s) of the client
 			$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
-			
+
 			// Delete all records (sub-clients, mail, web, etc....)  of this client.
 			$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_folder,web_folder_user,domain';
-			$tables_array = explode(',',$tables);
+			$tables_array = explode(',', $tables);
 			$client_group_id = $app->functions->intval($client_group['groupid']);
 			if($client_group_id > 1) {
 				foreach($tables_array as $table) {
@@ -161,16 +161,17 @@ class page_action extends tform_actions {
 								}
 							}
 						}
-						
+
 					}
 				}
 			}
-			
-			
-			
+
+
+
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index ab33d9e12669eeb839a384830d4936c75a06df60..3fa78377447002602666315aab9c048435c9500a 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/client.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -49,18 +49,18 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-    var $_template_additional = array();
-    
+	var $_template_additional = array();
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -69,21 +69,21 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
-	
+
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user' && $this->id == 0) {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -92,28 +92,28 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-        
-        if($this->id != 0) {
-            $this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
-            if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
-                // check previous type of storing templates
-                $tpls = explode('/', $this->oldDataRecord['template_additional']);
-                $this->oldTemplatesAssigned = array();
-                foreach($tpls as $item) {
-                    $item = trim($item);
-                    if(!$item) continue;
-                    $this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
-                }
-                unset($tpls);
-            }
-        } else {
-            $this->oldTemplatesAssigned = array();
-        }
-        
-        $this->_template_additional = explode('/', $this->dataRecord['template_additional']);
-        $this->dataRecord['template_additional'] = '';
-        
-        parent::onSubmit();
+
+		if($this->id != 0) {
+			$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
+			if(!is_array($this->oldTemplatesAssigned) || count($this->oldTemplatesAssigned) < 1) {
+				// check previous type of storing templates
+				$tpls = explode('/', $this->oldDataRecord['template_additional']);
+				$this->oldTemplatesAssigned = array();
+				foreach($tpls as $item) {
+					$item = trim($item);
+					if(!$item) continue;
+					$this->oldTemplatesAssigned[] = array('assigned_template_id' => 0, 'client_template_id' => $item, 'client_id' => $this->id);
+				}
+				unset($tpls);
+			}
+		} else {
+			$this->oldTemplatesAssigned = array();
+		}
+
+		$this->_template_additional = explode('/', $this->dataRecord['template_additional']);
+		$this->dataRecord['template_additional'] = '';
+
+		parent::onSubmit();
 	}
 
 	function onShowEnd() {
@@ -128,54 +128,54 @@ class page_action extends tform_actions {
 			$option .= '<option value="' . $item['template_id'] . '|' .  $item['template_name'] . '">' . $item['template_name'] . '</option>';
 			$tpl[$item['template_id']] = $item['template_name'];
 		}
-		$app->tpl->setVar('tpl_add_select',$option);
-
-        // check for new-style records
-        $result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
-        if($result && count($result) > 0) {
-            // new style
-            $items = array();
-            $text = '';
-            foreach($result as $item){
-                if (trim($item['client_template_id']) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']];
-                    $text .= '<a href="#" class="button icons16 icoDelete"></a>';
-                                        $tmp = new stdClass();
-                    $tmp->id = $item['assigned_template_id'];
-                    $tmp->data = '';
-                    $app->plugin->raiseEvent('get_client_template_details', $tmp);
-                    if($tmp->data != '') $text .= '<br /><em>' . $tmp->data . '</em>';
-
-                    $text .= '</li>';
-                    $items[] = $item['assigned_template_id'] . ':' . $item['client_template_id'];
-                }
-            }
-
-            $tmprec = $app->tform->getHTML(array('template_additional' => implode('/', $items)), $this->active_tab, 'EDIT');
-            $app->tpl->setVar('template_additional', $tmprec['template_additional']);
-            unset($tmprec);
-        } else {
-            // old style
-            $sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
-            $result = $app->db->queryOneRecord($sql);
-            $tplAdd = explode("/", $result['template_additional']);
-            $text = '';
-            foreach($tplAdd as $item){
-                if (trim($item) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
-                }
-            }
-        }
+		$app->tpl->setVar('tpl_add_select', $option);
+
+		// check for new-style records
+		$result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
+		if($result && count($result) > 0) {
+			// new style
+			$items = array();
+			$text = '';
+			foreach($result as $item){
+				if (trim($item['client_template_id']) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']];
+					$text .= '<a href="#" class="button icons16 icoDelete"></a>';
+					$tmp = new stdClass();
+					$tmp->id = $item['assigned_template_id'];
+					$tmp->data = '';
+					$app->plugin->raiseEvent('get_client_template_details', $tmp);
+					if($tmp->data != '') $text .= '<br /><em>' . $tmp->data . '</em>';
+
+					$text .= '</li>';
+					$items[] = $item['assigned_template_id'] . ':' . $item['client_template_id'];
+				}
+			}
+
+			$tmprec = $app->tform->getHTML(array('template_additional' => implode('/', $items)), $this->active_tab, 'EDIT');
+			$app->tpl->setVar('template_additional', $tmprec['template_additional']);
+			unset($tmprec);
+		} else {
+			// old style
+			$sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
+			$result = $app->db->queryOneRecord($sql);
+			$tplAdd = explode("/", $result['template_additional']);
+			$text = '';
+			foreach($tplAdd as $item){
+				if (trim($item) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
+				}
+			}
+		}
 
 		$app->tpl->setVar('template_additional_list', $text);
-		$app->tpl->setVar('app_module','client');
+		$app->tpl->setVar('app_module', 'client');
 
 		parent::onShowEnd();
 
 	}
-    
+
 	/*
 	 This function is called automatically right after
 	 the data was successful inserted in the database.
@@ -185,36 +185,36 @@ class page_action extends tform_actions {
 		// Create the group for the client
 		$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('".$app->db->quote($this->dataRecord["username"])."','',".$this->id.")", 'groupid');
 		$groups = $groupid;
-		
+
 		$username = $app->db->quote($this->dataRecord["username"]);
 		$password = $app->db->quote($this->dataRecord["password"]);
 		$modules = $conf['interface_modules_enabled'];
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] > 0) $modules .= ',client';
-		$startmodule = (stristr($modules,'dashboard'))?'dashboard':'client';
+		$startmodule = (stristr($modules, 'dashboard'))?'dashboard':'client';
 		$usertheme = $app->db->quote($this->dataRecord["usertheme"]);
 		$type = 'user';
 		$active = 1;
 		$language = $app->db->quote($this->dataRecord["language"]);
 		$password = $app->auth->crypt_password($password);
-		
+
 		// Create the controlpaneluser for the client
 		//Generate ssh-rsa-keys
 		exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
 		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$this->id);
 		exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
-		
+
 		// Create the controlpaneluser for the client
 		$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
 		VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
 		$app->db->query($sql);
-		
-		//* If the user who inserted the client is a reseller (not admin), we will have to add this new client group 
+
+		//* If the user who inserted the client is a reseller (not admin), we will have to add this new client group
 		//* to his groups, so he can administrate the records of this client.
 		if($_SESSION['s']['user']['typ'] == 'user') {
-			$app->auth->add_group_to_user($_SESSION['s']['user']['userid'],$groupid);
+			$app->auth->add_group_to_user($_SESSION['s']['user']['userid'], $groupid);
 			$app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id);
 		}
-		
+
 		//* Set the default servers
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 AND mirror_server_id = 0 LIMIT 0,1');
 		$default_mailserver = $app->functions->intval($tmp['server_id']);
@@ -224,19 +224,19 @@ class page_action extends tform_actions {
 		$default_dnsserver = $app->functions->intval($tmp['server_id']);
 		$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_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
 		$app->db->query($sql);
-		
-        if(isset($this->dataRecord['template_master'])) {
-            $app->uses('client_templates');
-            $app->client_templates->update_client_templates($this->id, $this->_template_additional);
-        }
+
+		if(isset($this->dataRecord['template_master'])) {
+			$app->uses('client_templates');
+			$app->client_templates->update_client_templates($this->id, $this->_template_additional);
+		}
 
 		parent::onAfterInsert();
 	}
-	
-	
+
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
@@ -249,120 +249,121 @@ class page_action extends tform_actions {
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
 			$app->db->query($sql);
-			
+
 			$tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = $client_id");
 			$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
 			unset($tmp);
 		}
-		
+
 		// password changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 			for ($n=0;$n<8;$n++) {
-				$salt.=$base64_alphabet[mt_rand(0,63)];
+				$salt.=$base64_alphabet[mt_rand(0, 63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
+			$password = crypt(stripslashes($password), $salt);
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
-        if(!isset($this->dataRecord['locked'])) $this->dataRecord['locked'] = 'n';
-        if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["locked"] != $this->oldDataRecord['locked']) {
-            /** lock all the things like web, mail etc. - easy to extend */
-            
-            // get tmp_data of client
-            $client_data = $app->db->queryOneRecord('SELECT `tmp_data` FROM `client` WHERE `client_id` = ' . $this->id);
-            
-            if($client_data['tmp_data'] == '') $tmp_data = array();
-            else $tmp_data = unserialize($client_data['tmp_data']);
-            
-            if(!is_array($tmp_data)) $tmp_data = array();
-            
-            // database tables with their primary key columns
-            $to_disable = array('cron' => 'id',
-                                'ftp_user' => 'ftp_user_id',
-                                'mail_domain' => 'domain_id',
-                                'mail_forwarding' => 'forwarding_id',
-                                'mail_get' => 'mailget_id',
-                                'openvz_vm' => 'vm_id',
-                                'shell_user' => 'shell_user_id',
-                                'webdav_user' => 'webdav_user_id',
-                                'web_database' => 'database_id',
-                                'web_domain' => 'domain_id',
-                                'web_folder' => 'web_folder_id',
-                                'web_folder_user' => 'web_folder_user_id'
-                               );
-            
-            $udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user` WHERE `client_id` = ' . $this->id);
-            $gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_group` WHERE `client_id` = ' . $this->id);
-            $sys_groupid = $gdata['groupid'];
-            $sys_userid = $udata['userid'];
-            
-            $entries = array();
-            if($this->dataRecord['locked'] == 'y') {
-                $prev_active = array();
-                $prev_sysuser = array();
-                foreach($to_disable as $current => $keycolumn) {
-                    $prev_active[$current] = array();
-                    $prev_sysuser[$current] = array();
-                    
-                    $entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id`, `sys_userid`, `active` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
-                    foreach($entries as $item) {
-                        
-                        if($item['active'] != 'y') $prev_active[$current][$item['id']]['active'] = 'n';
-                        if($item['sys_userid'] != $sys_userid) $prev_sysuser[$current][$item['id']]['active'] = $item['sys_userid'];
-                        // we don't have to store these if y, as everything without previous state gets enabled later
-                        
-                        $app->db->datalogUpdate($current, array('active' => 'n', 'sys_userid' => $_SESSION["s"]["user"]["userid"]), $keycolumn, $item['id']);
-                    }
-                }
-                
-                $tmp_data['prev_active'] = $prev_active;
-                $tmp_data['prev_sys_userid'] = $prev_sysuser;
-                $app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
-                unset($prev_active);
-                unset($prev_sysuser);
-            } elseif($this->dataRecord['locked'] == 'n') {
-                foreach($to_disable as $current => $keycolumn) {
-                    $entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
-                    foreach($entries as $item) {
-                        $set_active = 'y';
-                        $set_sysuser = $sys_userid;
-                        if(array_key_exists('prev_active', $tmp_data) == true
-                            && array_key_exists($current, $tmp_data['prev_active']) == true
-                            && array_key_exists($item['id'], $tmp_data['prev_active'][$current]) == true
-                            && $tmp_data['prev_active'][$current][$item['id']] == 'n') $set_active = 'n';
-                        if(array_key_exists('prev_sysuser', $tmp_data) == true
-                            && array_key_exists($current, $tmp_data['prev_sysuser']) == true
-                            && array_key_exists($item['id'], $tmp_data['prev_sysuser'][$current]) == true
-                            && $tmp_data['prev_sysuser'][$current][$item['id']] != $sys_userid) $set_sysuser = $tmp_data['prev_sysuser'][$current][$item['id']];
-                        
-                        $app->db->datalogUpdate($current, array('active' => $set_active, 'sys_userid' => $set_sysuser), $keycolumn, $item['id']);
-                    }
-                }
-                if(array_key_exists('prev_active', $tmp_data)) unset($tmp_data['prev_active']);
-                $app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
-            }
-            unset($tmp_data);
-            unset($entries);
-            unset($to_disable);
-        }
-        
-        if(!isset($this->dataRecord['canceled'])) $this->dataRecord['canceled'] = 'n';
-        if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["canceled"] != $this->oldDataRecord['canceled']) {
-            if($this->dataRecord['canceled'] == 'y') {
-                $sql = "UPDATE sys_user SET active = '0' WHERE client_id = " . $this->id;
-                $app->db->query($sql);
-            } elseif($this->dataRecord['canceled'] == 'n') {
-                $sql = "UPDATE sys_user SET active = '1' WHERE client_id = " . $this->id;
-                $app->db->query($sql);
-            }
-        }
-        
+
+		if(!isset($this->dataRecord['locked'])) $this->dataRecord['locked'] = 'n';
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["locked"] != $this->oldDataRecord['locked']) {
+			/** lock all the things like web, mail etc. - easy to extend */
+
+
+			// get tmp_data of client
+			$client_data = $app->db->queryOneRecord('SELECT `tmp_data` FROM `client` WHERE `client_id` = ' . $this->id);
+
+			if($client_data['tmp_data'] == '') $tmp_data = array();
+			else $tmp_data = unserialize($client_data['tmp_data']);
+
+			if(!is_array($tmp_data)) $tmp_data = array();
+
+			// database tables with their primary key columns
+			$to_disable = array('cron' => 'id',
+				'ftp_user' => 'ftp_user_id',
+				'mail_domain' => 'domain_id',
+				'mail_forwarding' => 'forwarding_id',
+				'mail_get' => 'mailget_id',
+				'openvz_vm' => 'vm_id',
+				'shell_user' => 'shell_user_id',
+				'webdav_user' => 'webdav_user_id',
+				'web_database' => 'database_id',
+				'web_domain' => 'domain_id',
+				'web_folder' => 'web_folder_id',
+				'web_folder_user' => 'web_folder_user_id'
+			);
+
+			$udata = $app->db->queryOneRecord('SELECT `userid` FROM `sys_user` WHERE `client_id` = ' . $this->id);
+			$gdata = $app->db->queryOneRecord('SELECT `groupid` FROM `sys_group` WHERE `client_id` = ' . $this->id);
+			$sys_groupid = $gdata['groupid'];
+			$sys_userid = $udata['userid'];
+
+			$entries = array();
+			if($this->dataRecord['locked'] == 'y') {
+				$prev_active = array();
+				$prev_sysuser = array();
+				foreach($to_disable as $current => $keycolumn) {
+					$prev_active[$current] = array();
+					$prev_sysuser[$current] = array();
+
+					$entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id`, `sys_userid`, `active` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
+					foreach($entries as $item) {
+
+						if($item['active'] != 'y') $prev_active[$current][$item['id']]['active'] = 'n';
+						if($item['sys_userid'] != $sys_userid) $prev_sysuser[$current][$item['id']]['active'] = $item['sys_userid'];
+						// we don't have to store these if y, as everything without previous state gets enabled later
+
+						$app->db->datalogUpdate($current, array('active' => 'n', 'sys_userid' => $_SESSION["s"]["user"]["userid"]), $keycolumn, $item['id']);
+					}
+				}
+
+				$tmp_data['prev_active'] = $prev_active;
+				$tmp_data['prev_sys_userid'] = $prev_sysuser;
+				$app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
+				unset($prev_active);
+				unset($prev_sysuser);
+			} elseif($this->dataRecord['locked'] == 'n') {
+				foreach($to_disable as $current => $keycolumn) {
+					$entries = $app->db->queryAllRecords('SELECT `' . $keycolumn . '` as `id` FROM `' . $current . '` WHERE `sys_groupid` = ' . $sys_groupid);
+					foreach($entries as $item) {
+						$set_active = 'y';
+						$set_sysuser = $sys_userid;
+						if(array_key_exists('prev_active', $tmp_data) == true
+							&& array_key_exists($current, $tmp_data['prev_active']) == true
+							&& array_key_exists($item['id'], $tmp_data['prev_active'][$current]) == true
+							&& $tmp_data['prev_active'][$current][$item['id']] == 'n') $set_active = 'n';
+						if(array_key_exists('prev_sysuser', $tmp_data) == true
+							&& array_key_exists($current, $tmp_data['prev_sysuser']) == true
+							&& array_key_exists($item['id'], $tmp_data['prev_sysuser'][$current]) == true
+							&& $tmp_data['prev_sysuser'][$current][$item['id']] != $sys_userid) $set_sysuser = $tmp_data['prev_sysuser'][$current][$item['id']];
+
+						$app->db->datalogUpdate($current, array('active' => $set_active, 'sys_userid' => $set_sysuser), $keycolumn, $item['id']);
+					}
+				}
+				if(array_key_exists('prev_active', $tmp_data)) unset($tmp_data['prev_active']);
+				$app->db->query("UPDATE `client` SET `tmp_data` = '" . $app->db->quote(serialize($tmp_data)) . "' WHERE `client_id` = " . $this->id);
+			}
+			unset($tmp_data);
+			unset($entries);
+			unset($to_disable);
+		}
+
+		if(!isset($this->dataRecord['canceled'])) $this->dataRecord['canceled'] = 'n';
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && $this->dataRecord["canceled"] != $this->oldDataRecord['canceled']) {
+			if($this->dataRecord['canceled'] == 'y') {
+				$sql = "UPDATE sys_user SET active = '0' WHERE client_id = " . $this->id;
+				$app->db->query($sql);
+			} elseif($this->dataRecord['canceled'] == 'n') {
+				$sql = "UPDATE sys_user SET active = '1' WHERE client_id = " . $this->id;
+				$app->db->query($sql);
+			}
+		}
+
 		// language changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
@@ -370,7 +371,7 @@ class page_action extends tform_actions {
 			$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
+
 		// reseller status changed
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
 			$modules = $conf['interface_modules_enabled'];
@@ -380,14 +381,15 @@ class page_action extends tform_actions {
 			$sql = "UPDATE sys_user SET modules = '$modules' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
-        if(isset($this->dataRecord['template_master'])) {
-            $app->uses('client_templates');
-            $app->client_templates->update_client_templates($this->id, $this->_template_additional);
-        }
-        
+
+		if(isset($this->dataRecord['template_master'])) {
+			$app->uses('client_templates');
+			$app->client_templates->update_client_templates($this->id, $this->_template_additional);
+		}
+
 		parent::onAfterUpdate();
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/client/client_list.php b/interface/web/client/client_list.php
index 35258b8582fdf977dfd242837620bce010a9e773..7d092177105f9770ba528549b49629dfb22afe26 100644
--- a/interface/web/client/client_list.php
+++ b/interface/web/client/client_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->listform_actions->SQLExtSelect = ', client.country as countryiso';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php
index 73c43bb4c64e81b5393a2111c972b91a852293f9..4275edb304c693d257e01b52737f95024f7a0038 100644
--- a/interface/web/client/client_message.php
+++ b/interface/web/client/client_message.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -41,9 +41,9 @@ $app->uses('tpl,tform');
 $app->tpl->newTemplate('form.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/client_message.htm');
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_client_message.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $msg = '';
@@ -51,18 +51,18 @@ $error = '';
 
 //* Save data
 if(isset($_POST) && count($_POST) > 1) {
-	
+
 	//* Check values
 	if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $_POST['sender'])) $error .= $wb['sender_invalid_error'].'<br />';
 	if(empty($_POST['subject'])) $error .= $wb['subject_invalid_error'].'<br />';
 	if(empty($_POST['message'])) $error .= $wb['message_invalid_error'].'<br />';
-	
+
 	//* Send message
 	if($error == '') {
 		if($app->functions->intval($_POST['recipient']) > 0){
 			$circle = $app->db->queryOneRecord("SELECT client_ids FROM client_circle WHERE active = 'y' AND circle_id = ".$app->functions->intval($_POST['recipient'])." AND ".$app->tform->getAuthSQL('r'));
 			if(isset($circle['client_ids']) && $circle['client_ids'] != ''){
-				$tmp_client_ids = explode(',',$circle['client_ids']);
+				$tmp_client_ids = explode(',', $circle['client_ids']);
 				$where = array();
 				foreach($tmp_client_ids as $tmp_client_id){
 					$where[] = 'client_id = '.$tmp_client_id;
@@ -82,7 +82,7 @@ if(isset($_POST) && count($_POST) > 1) {
 				$sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'";
 			}
 		}
-		
+
 		//* Get clients
 		$clients = $app->db->queryAllRecords($sql);
 		if(is_array($clients)) {
@@ -92,28 +92,28 @@ if(isset($_POST) && count($_POST) > 1) {
 				$message = $_POST['message'];
 				foreach($client as $key => $val) {
 					switch ($key) {
-						case 'password':
-							$message = str_replace('{'.$key.'}', '---', $message);
-							break;
-						case 'gender':
-							$message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
-							break;
-						default:
-							$message = str_replace('{'.$key.'}', $val, $message);
+					case 'password':
+						$message = str_replace('{'.$key.'}', '---', $message);
+						break;
+					case 'gender':
+						$message = str_replace('{salutation}', $wb['gender_'.$val.'_txt'], $message);
+						break;
+					default:
+						$message = str_replace('{'.$key.'}', $val, $message);
 					}
 				}
-				
+
 				//* Send the email
 				$app->functions->mail($client['email'], $_POST['subject'], $message, $_POST['sender']);
 				$msg .= $client['email'].', ';
 			}
-			$msg = substr($msg,0,-2);
+			$msg = substr($msg, 0, -2);
 		}
-		
+
 	} else {
-		$app->tpl->setVar('sender',$_POST['sender']);
-		$app->tpl->setVar('subject',$_POST['subject']);
-		$app->tpl->setVar('message',$_POST['message']);
+		$app->tpl->setVar('sender', $_POST['sender']);
+		$app->tpl->setVar('subject', $_POST['subject']);
+		$app->tpl->setVar('message', $_POST['message']);
 	}
 } else {
 	// pre-fill Sender field with reseller's email address
@@ -122,7 +122,7 @@ if(isset($_POST) && count($_POST) > 1) {
 		if($client_id > 0){
 			$sql = "SELECT email FROM client WHERE client_id = ".$client_id;
 			$client = $app->db->queryOneRecord($sql);
-			if($client['email'] != '') $app->tpl->setVar('sender',$client['email']);
+			if($client['email'] != '') $app->tpl->setVar('sender', $client['email']);
 		}
 	}
 }
@@ -136,12 +136,12 @@ if(is_array($circles) && !empty($circles)){
 		$recipient .= '<option value="'.$circle['circle_id'].'"'.($app->functions->intval($_POST['recipient']) == $circle['circle_id'] ? ' selected="selected"' : '').'>'.$circle['circle_name'].'</option>';
 	}
 }
-$app->tpl->setVar('recipient',$recipient);
+$app->tpl->setVar('recipient', $recipient);
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
-	$app->tpl->setVar('form_legend_txt',$wb['form_legend_admin_txt']);
+	$app->tpl->setVar('form_legend_txt', $wb['form_legend_admin_txt']);
 } else {
-	$app->tpl->setVar('form_legend_txt',$wb['form_legend_client_txt']);
+	$app->tpl->setVar('form_legend_txt', $wb['form_legend_client_txt']);
 }
 
 //message variables
@@ -159,10 +159,10 @@ if(!empty($field_names) && is_array($field_names)){
 		}
 	}
 }
-$app->tpl->setVar('message_variables',trim($message_variables));
+$app->tpl->setVar('message_variables', trim($message_variables));
 
-$app->tpl->setVar('okmsg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('okmsg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
diff --git a/interface/web/client/client_template_del.php b/interface/web/client/client_template_del.php
index 647ad7c54b328cedc697fa1ba696c3f7a6927e92..b57224f8ebfd3d73f4852f5f5185491a49f4ad16 100644
--- a/interface/web/client/client_template_del.php
+++ b/interface/web/client/client_template_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/client_template.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -52,23 +52,24 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app;
-		
+
 		// check new style
-        $rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client_template_assigned WHERE client_template_id = ".$this->id);
+		$rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client_template_assigned WHERE client_template_id = ".$this->id);
 		if($rec['number'] > 0) {
 			$app->error($app->tform->lng('template_del_aborted_txt'));
 		}
-        
-        // check old style
+
+		// check old style
 		$rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE template_master = ".$this->id." OR template_additional like '%/".$this->id."/%'");
 		if($rec['number'] > 0) {
 			$app->error($app->tform->lng('template_del_aborted_txt'));
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete()
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/client_template_edit.php b/interface/web/client/client_template_edit.php
index e14c7465ac431095c4a8477ae10a7d8aa7d86570..d956faf98c997f5a62ad68009138b50eafde7b6c 100644
--- a/interface/web/client/client_template_edit.php
+++ b/interface/web/client/client_template_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/client_template.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -53,7 +53,7 @@ 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);
@@ -65,16 +65,16 @@ class page_action extends tform_actions {
 			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');
+
+		$app->uses('client_templates');
 		/*
 		 * the template has changed. apply the new data to all clients
 		 */
@@ -86,10 +86,11 @@ class page_action extends tform_actions {
 		$clients = $app->db->queryAllRecords($sql);
 		if (is_array($clients)){
 			foreach ($clients as $client){
-                $app->client_templates->apply_client_templates($client['client_id']);
+				$app->client_templates->apply_client_templates($client['client_id']);
 			}
 		}
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/client/client_template_list.php b/interface/web/client/client_template_list.php
index bdfe1d11ef1745bcfc6dc6e5fdabd547ceefeac1..c87cea01eddb99c84e2f8e6fae9df51c76eb87f2 100644
--- a/interface/web/client/client_template_list.php
+++ b/interface/web/client/client_template_list.php
@@ -26,8 +26,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
diff --git a/interface/web/client/domain_del.php b/interface/web/client/domain_del.php
index 6e80480058e3ab7f4168e6e5b598aaec9b340624..2ec8e86bae9ea7de04d30ec2b4fafefb2deaab1d 100644
--- a/interface/web/client/domain_del.php
+++ b/interface/web/client/domain_del.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/domain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -52,11 +52,11 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
+
 		//* load language file
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
-		include($lng_file);
-		
+		include $lng_file;
+
 		/*
 		 * We can only delete domains if they are NOT in use
 		 */
@@ -67,16 +67,17 @@ class page_action extends tform_actions {
 		if (is_array($res)){
 			$app->error($wb['error_domain_in mailuse']);
 		}
-		
+
 		$sql = "SELECT domain_id FROM web_domain WHERE domain = '" . $app->db->quote($domain) . "'";
 		$res = $app->db->queryOneRecord($sql);
 		if (is_array($res)){
 			$app->error($wb['error_domain_in webuse']);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php
index 13e35b81ac3dfcc0684977dc7a623100dbb290a7..3c20ddbae72813f573d777127e29fe4747adf582 100644
--- a/interface/web/client/domain_edit.php
+++ b/interface/web/client/domain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/domain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -50,7 +50,7 @@ $app->load('tform_actions');
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
-include($lng_file);
+include $lng_file;
 
 class page_action extends tform_actions {
 
@@ -80,7 +80,7 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		}
 
@@ -146,9 +146,10 @@ class page_action extends tform_actions {
 			$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/domain_list.php b/interface/web/client/domain_list.php
index e4ef725b06ee35588f7649be708f3f9870608547..622e52a97e3a62d9dd94b20d1b2dd0c4321d9b8e 100644
--- a/interface/web/client/domain_list.php
+++ b/interface/web/client/domain_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -49,4 +49,4 @@ $app->uses('listform_actions');
 $app->listform_actions->SQLOrderBy = 'ORDER BY domain.domain';
 $app->listform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/domain_new_client.php b/interface/web/client/domain_new_client.php
index 81ce07536b6bd562683bfeac469ea4756804835b..d24174a779f1718a9cabaf1499e04c84161ea76c 100644
--- a/interface/web/client/domain_new_client.php
+++ b/interface/web/client/domain_new_client.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php
index 37d51bdd8a17ee05fea2420a3f4854df946978fd..16e68c01e635908f6a57bccf073cd6235fdfdac6 100644
--- a/interface/web/client/form/client.tform.php
+++ b/interface/web/client/form/client.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 		= "Client";
+$form["title"]   = "Client";
 $form["description"]    = "";
-$form["name"] 		= "client";
-$form["action"]		= "client_edit.php";
-$form["db_table"]	= "client";
-$form["db_table_idx"]	= "client_id";
-$form["db_history"]	= "yes";
-$form["tab_default"]	= "address";
-$form["list_default"]	= "client_list.php";
-$form["auth"]		= 'yes';
+$form["name"]   = "client";
+$form["action"]  = "client_edit.php";
+$form["db_table"] = "client";
+$form["db_table_idx"] = "client_id";
+$form["db_history"] = "yes";
+$form["tab_default"] = "address";
+$form["list_default"] = "client_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
@@ -58,1033 +58,1033 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form["tabs"]['address'] = array (
-	'title' 	=> "Address",
-	'width' 	=> 100,
-	'template' 	=> "templates/client_edit_address.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Address",
+	'width'  => 100,
+	'template'  => "templates/client_edit_address.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'company_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'gender' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
 		),
 		'contact_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 0 => array (	'type'	=> 'NOTEMPTY',
-                                                                'errmsg'=> 'contact_error_empty'),
-                                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'contact_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'customer_no' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'customer_no_error_unique',
-														'allowempty' => 'y'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'customer_no_error_unique',
+					'allowempty' => 'y'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-                                                                        'errmsg'=> 'username_error_empty'),
-                                                        1 => array (	'type'	=> 'CUSTOM',
-                                                                        'class' => 'validate_client',
-                                                                        'function' => 'username_unique',
-                                                                        'errmsg'=> 'username_error_unique'),
-                                                        2 => array (	'type'	=> 'CUSTOM',
-                                                                        'class' => 'validate_client',
-                                                                        'function' => 'username_collision',
-                                                                        'errmsg'=> 'username_error_collision'),
-                                                        3 => array (	'type'	=> 'REGEX',
-                                                                        'regex' => '/^[\w\.\-\_]{0,64}$/',
-                                                                        'errmsg'=> 'username_error_regex'),
-                                                        ),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_error_empty'),
+				1 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_unique',
+					'errmsg'=> 'username_error_unique'),
+				2 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_collision',
+					'errmsg'=> 'username_error_collision'),
+				3 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["language"],
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["language"],
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'usertheme' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["theme"],
-			'value'		=> $themes_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["theme"],
+			'value'  => $themes_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'street' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'zip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'city' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'country' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> (isset($conf['language']) ? strtoupper($conf['language']) : ''),
-			'datasource'	=> array (  'type'          => 'SQL',
-                                                    'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
-                                                    'keyfield'      => 'iso',
-                                                    'valuefield'    => 'printable_name'
-                                                ),
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => (isset($conf['language']) ? strtoupper($conf['language']) : ''),
+			'datasource' => array (  'type'          => 'SQL',
+				'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
+				'keyfield'      => 'iso',
+				'valuefield'    => 'printable_name'
+			),
+			'value'  => ''
 		),
 		'telephone' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'mobile' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'fax' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'internet' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'icq' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'vat_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'company_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_owner' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_number' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_code' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_iban' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_swift' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'notes' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
 		'paypal_email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'paypal_email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'paypal_email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'locked' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'canceled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-	##################################
-	# END Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['limits'] = array (
-	'title' 	=> "Limits",
-	'width' 	=> 80,
-	'template' 	=> "templates/client_edit_limits.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Limits",
+	'width'  => 80,
+	'template'  => "templates/client_edit_limits.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_master' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'master_templates'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'master_templates'
+			),
+			'value'  => ''
 		),
 		'template_additional' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 		),
 		'default_mailserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_mailserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_mailserver'
 		),
 		'limit_maildomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_maildomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_maildomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailbox' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailbox_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailbox_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailalias' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailalias_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailalias_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailaliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailaliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailmailinglist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailmailinglist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailmailinglist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailforward' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailforward_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailforward_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailcatchall' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailcatchall_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailcatchall_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailrouting' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailrouting_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailrouting_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailfilter' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfilter_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfilter_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_fetchmail' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfetchmail_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfetchmail_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailquota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailquota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailquota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_wblist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_policy' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_policy_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_policy_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_webserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_webserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_webserver'
 		),
 		'limit_web_domain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_domain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_domain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'web_php_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'web_php_options_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'web_php_options_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
+			'value'  => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
 		),
 		'limit_cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'force_suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_hterror' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_wildcard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_web_aliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_aliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_aliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_subdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_subdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_subdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_ftp_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_ftp_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_ftp_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_shell_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_shell_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_shell_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ssh_chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ssh_chroot_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ssh_chroot_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:ssh_chroot',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'limit_webdav_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_webdav_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_webdav_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dnsserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_dnsserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_dnsserver'
 		),
 		'limit_dns_zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_zone_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_zone_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'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'
+			'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'          => ''
-        ),
+			'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'          => ''
+		),
 		'limit_dns_record' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_record_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_record_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_client' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_client_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_client_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dbserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'client_servers'
-									 ),
-			'value'		=> '',
-			'name'		=> 'default_dbserver'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'client_servers'
+			),
+			'value'  => '',
+			'name'  => 'default_dbserver'
 		),
 		'limit_database' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_database_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
-		),
-        'limit_cron' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_notint'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'limit_cron_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'value'     => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron')
-        ),
-        'limit_cron_frequency' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_frequency'),
-                                    ),
-            'default'   => '-1',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_database_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		'limit_cron' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_notint'),
+			),
+			'default'   => '0',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'limit_cron_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
+		),
+		'limit_cron_frequency' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_frequency'),
+			),
+			'default'   => '-1',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
 		'limit_traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_traffic_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_traffic_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_openvz_vm_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_openvz_vm_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm_template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'template_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'limit_aps' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_aps_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
-		),
-	##################################
-	# END Datatable fields
-	##################################
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_aps_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/form/client_circle.tform.php b/interface/web/client/form/client_circle.tform.php
index bb5a140f36a6e56600bbba6a8e62dc2775a4a4c7..91b96b3549d94c773198732b255e69a079acfbeb 100644
--- a/interface/web/client/form/client_circle.tform.php
+++ b/interface/web/client/form/client_circle.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Client Circle";
-$form["description"] 	= "";
-$form["name"] 			= "client_circle";
-$form["action"]			= "client_circle_edit.php";
-$form["db_table"]		= "client_circle";
-$form["db_table_idx"]	= "circle_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "circle";
-$form["list_default"]	= "client_circle_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Client Circle";
+$form["description"]  = "";
+$form["name"]    = "client_circle";
+$form["action"]   = "client_circle_edit.php";
+$form["db_table"]  = "client_circle";
+$form["db_table_idx"] = "circle_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "circle";
+$form["list_default"] = "client_circle_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
@@ -58,80 +58,80 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form["tabs"]['circle'] = array (
-	'title' 	=> "Circle",
-	'width' 	=> 100,
-	'template' 	=> "templates/client_circle_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Circle",
+	'width'  => 100,
+	'template'  => "templates/client_circle_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'circle_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'client_ids' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'default' => '',
 			'separator' => ',',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
-										'keyfield'=> 'client_id',
-										'valuefield'=> 'contact_name'
-									 ),
-			'value'		=> ''
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT client_id,contact_name FROM client WHERE {AUTHSQL} ORDER BY contact_name',
+				'keyfield'=> 'client_id',
+				'valuefield'=> 'contact_name'
+			),
+			'value'  => ''
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php
index 917266eef4e31fe2f6217fc040809bd111cd64aa..ecf61f7af05c7e6951d35a5ce314477a34f2cb05 100644
--- a/interface/web/client/form/client_template.tform.php
+++ b/interface/web/client/form/client_template.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Client-Templates";
-$form["description"] 	= "";
-$form["name"] 			= "client_template";
-$form["action"]			= "client_template_edit.php";
-$form["db_table"]		= "client_template";
-$form["db_table_idx"]	= "template_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "template";
-$form["list_default"]	= "client_template_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Client-Templates";
+$form["description"]  = "";
+$form["name"]    = "client_template";
+$form["action"]   = "client_template_edit.php";
+$form["db_table"]  = "client_template";
+$form["db_table_idx"] = "template_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "template";
+$form["list_default"] = "client_template_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
@@ -53,465 +53,465 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 $form["tabs"]['template'] = array (
-	'title' 	=> "Template",
-	'width' 	=> 80,
-	'template' 	=> "templates/client_template_edit_template.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Template",
+	'width'  => 80,
+	'template'  => "templates/client_template_edit_template.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'm',
-			'value'		=> array('m' => "Main Template",'a' => "Additional Template"),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'm',
+			'value'  => array('m' => "Main Template", 'a' => "Additional Template"),
 		),
 		'template_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'error_template_name_empty'),
-										),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# END Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'error_template_name_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['limits'] = array (
-	'title' 	=> "Limits",
-	'width' 	=> 80,
-	'template' 	=> "templates/client_template_edit_limits.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Limits",
+	'width'  => 80,
+	'template'  => "templates/client_template_edit_limits.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'limit_maildomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_maildomain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_maildomain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailbox' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailbox_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailbox_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailalias' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailalias_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailalias_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailaliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailaliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailmailinglist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailmailinglist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailmailinglist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailforward' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailforward_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailforward_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailcatchall' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailcatchall_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailcatchall_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailrouting' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailrouting_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailrouting_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailfilter' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfilter_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfilter_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_fetchmail' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfetchmail_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfetchmail_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailquota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailquota_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailquota_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_wblist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_policy' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_policy_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_policy_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_domain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_domain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_domain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'web_php_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
+			'value'  => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
 		),
 		'limit_cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'force_suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_hterror' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_wildcard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_web_aliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_aliasdomain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_aliasdomain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_subdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_subdomain_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_subdomain_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_ftp_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_ftp_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_ftp_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_shell_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_shell_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_shell_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ssh_chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array (
-			  0 => array (
-			    'type'=> 'NOTEMPTY',
-			    'errmsg'=> 'ssh_chroot_notempty'
-			  ),
-			),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (
+				0 => array (
+					'type'=> 'NOTEMPTY',
+					'errmsg'=> 'ssh_chroot_notempty'
+				),
+			),
+			'default' => '',
 			'separator' => ',',
 			'valuelimit' => 'client:ssh_chroot',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'limit_webdav_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_webdav_user_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_webdav_user_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_dns_zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_zone_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_zone_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		'limit_dns_slave_zone' => array (
+			'datatype'      => 'INTEGER',
+			'formtype'      => 'TEXT',
+			'validators'    => array (      0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_dns_slave_zone_error_notint'),
+			),
+			'default'       => '0',
+			'value'         => '',
+			'separator'     => '',
+			'width'         => '10',
+			'maxlength'     => '10',
+			'rows'          => '',
+			'cols'          => ''
 		),
-                'limit_dns_slave_zone' => array (
-                        'datatype'      => 'INTEGER',
-                        'formtype'      => 'TEXT',
-                        'validators'    => array (      0 => array (    'type'  => 'ISINT',
-                                                                                                                'errmsg'=> 'limit_dns_slave_zone_error_notint'),
-                                                                        ),
-                        'default'       => '0',
-                        'value'         => '',
-                        'separator'     => '',
-                        'width'         => '10',
-                        'maxlength'     => '10',
-                        'rows'          => '',
-                        'cols'          => ''
-                ),
 		'limit_dns_record' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_record_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_record_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		/*
 		'limit_client' => array (
@@ -530,109 +530,109 @@ $form["tabs"]['limits'] = array (
 		),
 		*/
 		'limit_database' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_database_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_database_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		'limit_cron' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_notint'),
+			),
+			'default'   => '0',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'limit_cron_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
+		),
+		'limit_cron_frequency' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_frequency'),
+			),
+			'default'   => '-1',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
 		),
-        'limit_cron' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_notint'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'limit_cron_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'value'     => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron')
-        ),
-        'limit_cron_frequency' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_frequency'),
-                                    ),
-            'default'   => '-1',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
 		'limit_traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_traffic_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_traffic_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_openvz_vm_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_openvz_vm_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm_template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'template_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'limit_aps' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_aps_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
-		),
-	##################################
-	# END Datatable fields
-	##################################
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_aps_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/form/domain.tform.php b/interface/web/client/form/domain.tform.php
index 40f9a90a8e072aca87a2c39446d4cc726212ed4a..a12878380f57947f917a796f465b5cff219c5e08 100644
--- a/interface/web/client/form/domain.tform.php
+++ b/interface/web/client/form/domain.tform.php
@@ -60,16 +60,16 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form["title"] 			= "Domain";
-$form["description"] 	= "";
-$form["name"] 			= "domain";
-$form["action"]			= "domain_edit.php";
-$form["db_table"]		= "domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "domain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Domain";
+$form["description"]  = "";
+$form["name"]    = "domain";
+$form["action"]   = "domain_edit.php";
+$form["db_table"]  = "domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "domain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -78,41 +78,41 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/domain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/domain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'domain_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'domain_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php
index c78ed8ea4211e93e6aafe21866fa1e115e8bffb3..fad0cd7653683a823c1ad56d43e4710402a8385b 100644
--- a/interface/web/client/form/reseller.tform.php
+++ b/interface/web/client/form/reseller.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Reseller";
-$form["description"] 	= "";
-$form["name"] 			= "reseller";
-$form["action"]			= "reseller_edit.php";
-$form["db_table"]		= "client";
-$form["db_table_idx"]	= "client_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "address";
-$form["list_default"]	= "reseller_list.php";
-$form["auth"]			= 'yes';
+$form["title"]    = "Reseller";
+$form["description"]  = "";
+$form["name"]    = "reseller";
+$form["action"]   = "reseller_edit.php";
+$form["db_table"]  = "client";
+$form["db_table_idx"] = "client_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "address";
+$form["list_default"] = "reseller_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
@@ -58,1031 +58,1031 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
 //* Load themes
 $themes_list = array();
 $handle = @opendir(ISPC_THEMES_PATH);
-while ($file = @readdir ($handle)) {
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
-    }
+				$themes_list[$file] = $file;
+			}
+		}
+	}
 }
 
 //* Languages
 $language_list = array();
 $handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
-while ($file = @readdir ($handle)) {
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
 }
 
 $form["tabs"]['address'] = array (
-	'title' 	=> "Address",
-	'width' 	=> 100,
-	'template' 	=> "templates/reseller_edit_address.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Address",
+	'width'  => 100,
+	'template'  => "templates/reseller_edit_address.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'company_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'gender' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => '', 'm' => 'gender_m_txt', 'f' => 'gender_f_txt')
 		),
 		'contact_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'contact_error_empty'),
-										),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'contact_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'customer_no' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'customer_no_error_unique',
-														'allowempty' => 'y'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'customer_no_error_unique',
+					'allowempty' => 'y'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'username_error_empty'),
-										1 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_client',
-														'function' => 'username_unique',
-														'errmsg'=> 'username_error_unique'),
-										2 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_client',
-														'function' => 'username_collision',
-														'errmsg'=> 'username_error_collision'),
-										3 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\_]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-										),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'username_error_empty'),
+				1 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_unique',
+					'errmsg'=> 'username_error_unique'),
+				2 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_client',
+					'function' => 'username_collision',
+					'errmsg'=> 'username_error_collision'),
+				3 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["language"],
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["language"],
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'usertheme' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> $conf["theme"],
-			'value'		=> $themes_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => $conf["theme"],
+			'value'  => $themes_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'street' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'zip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'city' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'country' => array (
-			'datatype'	=> 'VARCHAR',
+			'datatype' => 'VARCHAR',
 
-			'formtype'	=> 'SELECT',
-			'default'	=> (isset($conf['language']) ? strtoupper($conf['language']) : ''),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
-										'keyfield'=> 'iso',
-										'valuefield'=> 'printable_name'
-									 ),
-			'value'		=> ''
+			'formtype' => 'SELECT',
+			'default' => (isset($conf['language']) ? strtoupper($conf['language']) : ''),
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+				'keyfield'=> 'iso',
+				'valuefield'=> 'printable_name'
+			),
+			'value'  => ''
 		),
 		'telephone' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'mobile' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'fax' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'internet' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'http://',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'http://',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'icq' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'vat_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'company_id' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '20',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '20',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_owner' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_number' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_code' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_iban' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'bank_account_swift' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'notes' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
 		),
 		'paypal_email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'paypal_email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'paypal_email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 2
 		),
 		'locked' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'canceled' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-	##################################
-	# END Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['limits'] = array (
-	'title' 	=> "Limits",
-	'width' 	=> 80,
-	'template' 	=> "templates/reseller_edit_limits.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Limits",
+	'width'  => 80,
+	'template'  => "templates/reseller_edit_limits.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_master' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'master_templates'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'master_templates'
+			),
+			'value'  => ''
 		),
 		'template_additional' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 		),
 		'default_mailserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_maildomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_maildomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_maildomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailmailinglist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailmailinglist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailmailinglist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailbox' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailbox_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailbox_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailalias' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailalias_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailalias_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailaliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailaliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailaliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailforward' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailforward_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailforward_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailcatchall' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailcatchall_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailcatchall_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailrouting' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailrouting_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailrouting_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailfilter' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfilter_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfilter_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_fetchmail' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailfetchmail_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailfetchmail_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_mailquota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_mailquota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_mailquota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_wblist' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_wblist_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_spamfilter_policy' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_spamfilter_policy_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_spamfilter_policy_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_webserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_web_domain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_domain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_domain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'web_php_options' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'web_php_options_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'web_php_options_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
-			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
+			'value'  => array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM')
 		),
 		'limit_cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'force_suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_hterror' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_wildcard' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'limit_web_aliasdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_aliasdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_aliasdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_web_subdomain' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_web_subdomain_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_web_subdomain_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_ftp_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_ftp_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_ftp_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_shell_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_shell_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_shell_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'ssh_chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ssh_chroot_notempty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ssh_chroot_notempty'),
+			),
+			'default' => '',
 			'separator' => ',',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'limit_webdav_user' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_webdav_user_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_webdav_user_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_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'		=> ''
+			'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_zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_zone_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_zone_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'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',
-                        'validators'    => array (      0 => array (    'type'  => 'ISINT',
-                                                                                                                'errmsg'=> 'limit_dns_slave_zone_error_notint'),
-                                                                        ),
-                        'default'       => '-1',
-                        'value'         => '',
-                        'separator'     => '',
-                        'width'         => '10',
-                        'maxlength'     => '10',
-                        'rows'          => '',
-                        'cols'          => ''
-                ),
+			'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',
+			'validators'    => array (      0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_dns_slave_zone_error_notint'),
+			),
+			'default'       => '-1',
+			'value'         => '',
+			'separator'     => '',
+			'width'         => '10',
+			'maxlength'     => '10',
+			'rows'          => '',
+			'cols'          => ''
+		),
 		'limit_dns_record' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_dns_record_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_dns_record_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_client' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_client_error_notint'),
-										1 => array (	'type'	=> 'CUSTOM',
-														'class' => 'validate_reseller',
-														'function' => 'limit_client'),
-									),
-			'default'	=> '1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_client_error_notint'),
+				1 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_reseller',
+					'function' => 'limit_client'),
+			),
+			'default' => '1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'default_dbserver' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '1',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE db_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '1',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE db_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'limit_database' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_database_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
-		),
-        'limit_cron' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_notint'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
-        'limit_cron_type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'value'     => array('full' => 'Full Cron','chrooted' => 'Chrooted Cron','url' => 'URL Cron')
-        ),
-        'limit_cron_frequency' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'ISINT',
-                                                        'errmsg'=> 'limit_cron_error_frequency'),
-                                    ),
-            'default'   => '-1',
-            'value'     => '',
-            'separator' => '',
-            'width'     => '10',
-            'maxlength' => '10',
-            'rows'      => '',
-            'cols'      => ''
-        ),
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_database_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		'limit_cron' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_notint'),
+			),
+			'default'   => '0',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
+		'limit_cron_type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'value'     => array('full' => 'Full Cron', 'chrooted' => 'Chrooted Cron', 'url' => 'URL Cron')
+		),
+		'limit_cron_frequency' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'ISINT',
+					'errmsg'=> 'limit_cron_error_frequency'),
+			),
+			'default'   => '-1',
+			'value'     => '',
+			'separator' => '',
+			'width'     => '10',
+			'maxlength' => '10',
+			'rows'      => '',
+			'cols'      => ''
+		),
 		'limit_traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_traffic_quota_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_traffic_quota_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_openvz_vm_error_notint'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_openvz_vm_error_notint'),
+			),
+			'default' => '0',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'limit_openvz_vm_template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> array(0 => ' ')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'template_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => array(0 => ' ')
 		),
 		'limit_aps' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'limit_aps_error_notint'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10',
-			'rows'		=> '',
-			'cols'		=> ''
-		),
-	##################################
-	# END Datatable fields
-	##################################
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'limit_aps_error_notint'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '10',
+			'maxlength' => '10',
+			'rows'  => '',
+			'cols'  => ''
+		),
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/client/lib/admin.conf.php b/interface/web/client/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/client/lib/admin.conf.php
+++ b/interface/web/client/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/lib/module.conf.php b/interface/web/client/lib/module.conf.php
index f0564f12629a1db7cf9fe35a5e8df1f2107d2060..bfb6ac80ddea1ede6d68f0354cce5e500f5b581c 100644
--- a/interface/web/client/lib/module.conf.php
+++ b/interface/web/client/lib/module.conf.php
@@ -1,68 +1,68 @@
 <?php
 
-$module["name"] 	= "client";
-$module["title"] 	= "top_menu_client";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "client/client_list.php";
+$module["name"]  = "client";
+$module["title"]  = "top_menu_client";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "client/client_list.php";
 $module["tab_width"]    = '';
 
 
-$items[] = array(   'title' 	=> "Edit Client",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_list.php',
-                    'html_id'   => 'client_list');
+$items[] = array(   'title'  => "Edit Client",
+	'target'  => 'content',
+	'link' => 'client/client_list.php',
+	'html_id'   => 'client_list');
+
+$items[] = array(   'title'  => "Add Client",
+	'target'  => 'content',
+	'link' => 'client/client_edit.php',
+	'html_id'   => 'client_add');
 
-$items[] = array(   'title' 	=> "Add Client",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_edit.php',
-                    'html_id'   => 'client_add');
-				  
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
-$items[] = array(   'title' 	=> "Edit Client-Templates",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_template_list.php',
-                    'html_id'   => 'client_template_list');
+	$items[] = array(   'title'  => "Edit Client-Templates",
+		'target'  => 'content',
+		'link' => 'client/client_template_list.php',
+		'html_id'   => 'client_template_list');
 }
 
-$module["nav"][] = array(   'title'	=> 'Clients',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module["nav"][] = array(   'title' => 'Clients',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'){
 
-$items[] = array(   'title' 	=> "Edit Reseller",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/reseller_list.php',
-                    'html_id'   => 'reseller_list');
+	$items[] = array(   'title'  => "Edit Reseller",
+		'target'  => 'content',
+		'link' => 'client/reseller_list.php',
+		'html_id'   => 'reseller_list');
 
-$items[] = array(   'title' 	=> "Add Reseller",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/reseller_edit.php',
-                    'html_id'   => 'reseller_add');
+	$items[] = array(   'title'  => "Add Reseller",
+		'target'  => 'content',
+		'link' => 'client/reseller_edit.php',
+		'html_id'   => 'reseller_add');
 
-$module["nav"][] = array(   'title'	=> 'Resellers',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+	$module["nav"][] = array(   'title' => 'Resellers',
+		'open'  => 1,
+		'items' => $items);
 
-unset($items);
+	unset($items);
 }
 
-$items[] = array(   'title' 	=> "Edit Client Circle",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_circle_list.php',
-                    'html_id'   => 'client_circle_list');
+$items[] = array(   'title'  => "Edit Client Circle",
+	'target'  => 'content',
+	'link' => 'client/client_circle_list.php',
+	'html_id'   => 'client_circle_list');
 
-$items[] = array(   'title' 	=> "Send email",
-                    'target' 	=> 'content',
-                    'link'	=> 'client/client_message.php',
-                    'html_id'   => 'reseller_add');
+$items[] = array(   'title'  => "Send email",
+	'target'  => 'content',
+	'link' => 'client/client_message.php',
+	'html_id'   => 'reseller_add');
 
-$module["nav"][] = array(   'title'	=> 'Messaging',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module["nav"][] = array(   'title' => 'Messaging',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
@@ -71,13 +71,13 @@ $settings = $app->getconf->get_global_config('domains');
 
 if ($settings['use_domain_module'] == 'y') {
 	$items = array();
-	$items[] = array( 'title' 	=> 'Domains',
-					'target' 	=> 'content',
-					'link'	=> 'client/domain_list.php');
+	$items[] = array( 'title'  => 'Domains',
+		'target'  => 'content',
+		'link' => 'client/domain_list.php');
 
-	$module['nav'][] = array(	'title'	=> 'Domains',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Domains',
+		'open'  => 1,
+		'items' => $items);
 
 	unset($items);
 }
@@ -97,4 +97,4 @@ $module["nav"][] = array(   'title'	=> 'Reseller Panel',
 unset($items);
 }
 */
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/list/client.list.php b/interface/web/client/list/client.list.php
index 0169810e4170343e56ccf0c9c7c44e40011c5e92..40af2a7b018b1a2e7ce368d078c2f503df17ad6a 100644
--- a/interface/web/client/list/client.list.php
+++ b/interface/web/client/list/client.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "clients";
+$liste["name"]    = "clients";
 
 // Database table
-$liste["table"] 		= "client";
+$liste["table"]   = "client";
 
 // Index index field of the database table
-$liste["table_idx"]		= "client_id";
+$liste["table_idx"]  = "client_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "client_list.php";
+$liste["file"]   = "client_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "client_edit.php";
+$liste["edit_file"]  = "client_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "client_del.php";
+$liste["delete_file"]  = "client_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -48,71 +48,71 @@ $liste["auth"]			= "yes";
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "client_id",
-                            'datatype'	=> "INTEGER",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "company_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "contact_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "customer_no",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");							
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "username",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> ""); 
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "city",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "country",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'datasource'=> array (  'type'          => 'SQL',
-                                                    'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
-                                                    'keyfield'      => 'iso',
-                                                    'valuefield'    => 'printable_name'
-                                                ),
-                            'width'	=> "",
-                            'value'	=> "");
-
-?>
\ No newline at end of file
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource'=> array (  'type'          => 'SQL',
+		'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY iso ASC',
+		'keyfield'      => 'iso',
+		'valuefield'    => 'printable_name'
+	),
+	'width' => "",
+	'value' => "");
+
+?>
diff --git a/interface/web/client/list/client_circle.list.php b/interface/web/client/list/client_circle.list.php
index 075c9cda2c63c6365dedc6b46fc442a272f7e89e..d1ef3ad50b832e36fd464f46ad7d87f178938981 100644
--- a/interface/web/client/list/client_circle.list.php
+++ b/interface/web/client/list/client_circle.list.php
@@ -13,74 +13,74 @@
 
 
 // Name of the list
-$liste["name"] 				= "client_circle";
+$liste["name"]     = "client_circle";
 
 // Database table
-$liste["table"] 			= "client_circle";
+$liste["table"]    = "client_circle";
 
 // Index index field of the database table
-$liste["table_idx"]			= "circle_id";
+$liste["table_idx"]   = "circle_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "client_circle_list.php";
+$liste["file"]    = "client_circle_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "client_circle_edit.php";
+$liste["edit_file"]   = "client_circle_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "client_circle_del.php";
+$liste["delete_file"]  = "client_circle_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "circle_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "circle_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "description",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "circle_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "circle_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "description",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/client/list/client_template.list.php b/interface/web/client/list/client_template.list.php
index ef348e37122937b0de87f13b518363dd826be0f9..cb37eb3f22161167320587721363af4f991040a3 100644
--- a/interface/web/client/list/client_template.list.php
+++ b/interface/web/client/list/client_template.list.php
@@ -11,65 +11,65 @@
 */
 
 // Name of the list
-$liste["name"] 				= "client_template";
+$liste["name"]     = "client_template";
 
 // Database table
-$liste["table"] 			= "client_template";
+$liste["table"]    = "client_template";
 
 // Index index field of the database table
-$liste["table_idx"]			= "template_id";
+$liste["table_idx"]   = "template_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "client_template_list.php";
+$liste["file"]    = "client_template_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "client_template_edit.php";
+$liste["edit_file"]   = "client_template_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "client_template_del.php";
+$liste["delete_file"]  = "client_template_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "template_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "template_type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('m' => "Main Template",'a' => "Additional Template"));
-
-$liste["item"][] = array(	'field'		=> "template_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "template_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "template_type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('m' => "Main Template", 'a' => "Additional Template"));
+
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 ?>
diff --git a/interface/web/client/list/domain.list.php b/interface/web/client/list/domain.list.php
index a7534a228cb1a95790c7cfb98722b3d066948e43..82c67721552e7d3e95115cf2d531a30e4c12a507 100644
--- a/interface/web/client/list/domain.list.php
+++ b/interface/web/client/list/domain.list.php
@@ -40,63 +40,63 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 // Name of the list
-$liste["name"] 				= "domain";
+$liste["name"]     = "domain";
 
 // Database table
-$liste["table"] 			= "domain";
+$liste["table"]    = "domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "domain_list.php";
+$liste["file"]    = "domain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "domain_edit.php";
+$liste["edit_file"]   = "domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "domain_del.php";
+$liste["delete_file"]  = "domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "LIKE",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT a.groupid, a.name FROM sys_group a, domain b WHERE (a.groupid = b.sys_groupid) AND ({AUTHSQL-B}) ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "LIKE",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "sys_groupid",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT a.groupid, a.name FROM sys_group a, domain b WHERE (a.groupid = b.sys_groupid) AND ({AUTHSQL-B}) ORDER BY name',
+		'keyfield'=> 'groupid',
+		'valuefield'=> 'name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/client/list/reseller.list.php b/interface/web/client/list/reseller.list.php
index 67ae88274ca356ebf05ff6187d67dcf6d6f1528c..625a5cf274f9a6ad028946402cb36de0b03f1702 100644
--- a/interface/web/client/list/reseller.list.php
+++ b/interface/web/client/list/reseller.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "resellers";
+$liste["name"]    = "resellers";
 
 // Database table
-$liste["table"] 		= "client";
+$liste["table"]   = "client";
 
 // Index index field of the database table
-$liste["table_idx"]		= "client_id";
+$liste["table_idx"]  = "client_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "reseller_list.php";
+$liste["file"]   = "reseller_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "reseller_edit.php";
+$liste["edit_file"]  = "reseller_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "reseller_del.php";
+$liste["delete_file"]  = "reseller_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -48,71 +48,71 @@ $liste["auth"]			= "yes";
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "client_id",
-                            'datatype'	=> "INTEGER",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> "");
-
-$liste["item"][] = array(   'field'	=> "company_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
-
-$liste["item"][] = array(   'field'	=> "contact_name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");  
-							
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => "");
+
+$liste["item"][] = array(   'field' => "company_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
+$liste["item"][] = array(   'field' => "contact_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
 $liste["item"][] = array(   'field'     => "customer_no",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");	
-							
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
 $liste["item"][] = array(   'field'     => "username",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
-
-$liste["item"][] = array(   'field'	=> "city",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
-
-$liste["item"][] = array(   'field'	=> "country",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'datasource'=> array (  'type'          => 'SQL',
-                                                    'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY printable_name ASC',
-                                                    'keyfield'      => 'iso',
-                                                    'valuefield'    => 'printable_name'
-                                                ),
-                            'width'	=> "",
-                            'value'	=> "" );
-
-?>
\ No newline at end of file
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
+$liste["item"][] = array(   'field' => "city",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
+$liste["item"][] = array(   'field' => "country",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource'=> array (  'type'          => 'SQL',
+		'querystring'   => 'SELECT iso,printable_name FROM country ORDER BY printable_name ASC',
+		'keyfield'      => 'iso',
+		'valuefield'    => 'printable_name'
+	),
+	'width' => "",
+	'value' => "" );
+
+?>
diff --git a/interface/web/client/reseller_del.php b/interface/web/client/reseller_del.php
index 2cf2003fd67c858ddf40d8d3488937e257daae19..e9d1dd32b8947a67bd2544b269fe4d61cbcc81ee 100644
--- a/interface/web/client/reseller_del.php
+++ b/interface/web/client/reseller_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/reseller.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -51,44 +51,45 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onBeforeDelete() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
-		
+
 		$client_id = $app->functions->intval($this->dataRecord['client_id']);
-		
+
 		$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE parent_client_id = ".$client_id);
 		if($tmp["number"] > 0) $app->error($app->lng('error_has_clients'));
-		
+
 	}
-	
+
 	function onAfterDelete() {
 		global $app, $conf;
-		
+
 		$client_id = $app->functions->intval($this->dataRecord['client_id']);
-		
+
 		if($client_id > 0) {
 			// TODO: Delete all records (sub-clients, mail, web, etc....)  of this client.
-			
+
 			// remove the group of the client from the resellers group
 			$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']);
 			$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id");
 			$client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
-			$app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']);
-			
+			$app->auth->remove_group_from_user($parent_user['userid'], $client_group['groupid']);
+
 			// delete the group of the client
 			$app->db->query("DELETE FROM sys_group WHERE client_id = $client_id");
-			
+
 			// delete the sys user(s) of the client
 			$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete()
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index ca2780cea8d5cdb35063952ad185a9cc42243b61..3007ce0a8611af4a6deeac6befb3a9e6dbd4aa7b 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/reseller.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('client');
@@ -55,14 +55,14 @@ class page_action extends tform_actions {
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -71,21 +71,21 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
-	
+
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user' && $this->id == 0) {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_client FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another website.
 			if($client["limit_client"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE sys_groupid = $client_group_id");
@@ -94,7 +94,7 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onSubmit();
 	}
 
@@ -111,32 +111,32 @@ class page_action extends tform_actions {
 			$option .= '<option value="' . $item['template_id'] . '|' .  $item['template_name'] . '">' . $item['template_name'] . '</option>';
 			$tpl[$item['template_id']] = $item['template_name'];
 		}
-		$app->tpl->setVar('tpl_add_select',$option);
-
-        // check for new-style records
-        $result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
-        if($result && count($result) > 0) {
-            // new style
-            $text = '';
-            foreach($result as $item){
-                if (trim($item['client_template_id']) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]. '<a href="#" class="button icons16 icoDelete"></a></li>';
-                }
-            }
-        } else {
-            // old style
-            $sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
-            $result = $app->db->queryOneRecord($sql);
-            $tplAdd = explode("/", $result['template_additional']);
-            $text = '';
-            foreach($tplAdd as $item){
-                if (trim($item) != ''){
-                    if ($text != '') $text .= '';
-                    $text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
-                }
-            }
-        }
+		$app->tpl->setVar('tpl_add_select', $option);
+
+		// check for new-style records
+		$result = $app->db->queryAllRecords('SELECT assigned_template_id, client_template_id FROM client_template_assigned WHERE client_id = ' . $this->id);
+		if($result && count($result) > 0) {
+			// new style
+			$text = '';
+			foreach($result as $item){
+				if (trim($item['client_template_id']) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li rel="' . $item['assigned_template_id'] . '">' . $tpl[$item['client_template_id']]. '<a href="#" class="button icons16 icoDelete"></a></li>';
+				}
+			}
+		} else {
+			// old style
+			$sql = "SELECT template_additional FROM client WHERE client_id = " . $this->id;
+			$result = $app->db->queryOneRecord($sql);
+			$tplAdd = explode("/", $result['template_additional']);
+			$text = '';
+			foreach($tplAdd as $item){
+				if (trim($item) != ''){
+					if ($text != '') $text .= '';
+					$text .= '<li>' . $tpl[$item]. '<a href="#" class="button icons16 icoDelete"></a></li>';
+				}
+			}
+		}
 
 		$app->tpl->setVar('template_additional_list', $text);
 
@@ -153,32 +153,32 @@ class page_action extends tform_actions {
 		// Create the group for the reseller
 		$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('".$app->db->quote($this->dataRecord["username"])."','',".$this->id.")", 'groupid');
 		$groups = $groupid;
-		
+
 		$username = $app->db->quote($this->dataRecord["username"]);
 		$password = $app->db->quote($this->dataRecord["password"]);
 		$modules = $conf['interface_modules_enabled'] . ',client';
-		$startmodule = (stristr($modules,'dashboard'))?'dashboard':'client'; 
+		$startmodule = (stristr($modules, 'dashboard'))?'dashboard':'client';
 		$usertheme = $app->db->quote($this->dataRecord["usertheme"]);
 		$type = 'user';
 		$active = 1;
 		$language = $app->db->quote($this->dataRecord["language"]);
-		
+
 		$salt="$1$";
 		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 		for ($n=0;$n<8;$n++) {
-			$salt.=$base64_alphabet[mt_rand(0,63)];
+			$salt.=$base64_alphabet[mt_rand(0, 63)];
 		}
 		$salt.="$";
-		$password = crypt(stripslashes($password),$salt);
-		
+		$password = crypt(stripslashes($password), $salt);
+
 		// Create the controlpaneluser for the reseller
 		$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
 		VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
 		$app->db->query($sql);
-		
+
 		//* set the number of clients to 1
 		$app->db->query("UPDATE client SET limit_client = 1 WHERE client_id = ".$this->id);
-		
+
 		//* Set the default servers
 		$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 LIMIT 0,1');
 		$default_mailserver = $app->functions->intval($tmp['server_id']);
@@ -188,33 +188,33 @@ class page_action extends tform_actions {
 		$default_dnsserver = $app->functions->intval($tmp['server_id']);
 		$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_slave_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id;
 		$app->db->query($sql);
 
 		parent::onAfterInsert();
 	}
-	
-	
+
+
 	/*
 	 This function is called automatically right after
 	 the data was successful updated in the database.
 	*/
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		// username changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
 			$username = $app->db->quote($this->dataRecord["username"]);
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
 			$app->db->query($sql);
-			
+
 			$tmp = $app->db->queryOneRecord("SELECT * FROM sys_group WHERE client_id = $client_id");
 			$app->db->datalogUpdate("sys_group", "name = '$username'", 'groupid', $tmp['groupid']);
 			unset($tmp);
 		}
-		
+
 		// password changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
@@ -222,14 +222,14 @@ class page_action extends tform_actions {
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 			for ($n=0;$n<8;$n++) {
-				$salt.=$base64_alphabet[mt_rand(0,63)];
+				$salt.=$base64_alphabet[mt_rand(0, 63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
+			$password = crypt(stripslashes($password), $salt);
 			$sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
+
 		// language changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
@@ -237,14 +237,14 @@ class page_action extends tform_actions {
 			$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
-		
+
 		// ensure that a reseller is not converted to a client in demo mode when client_id <= 2
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] == true && $this->id <= 2) {
 			if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != -1) {
 				$app->db->query('UPDATE client set limit_client = -1 WHERE client_id = '.$this->id);
 			}
 		}
-		
+
 		// reseller status changed
 		if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != $this->oldDataRecord["limit_client"]) {
 			$modules = $conf['interface_modules_enabled'] . ',client';
@@ -256,9 +256,10 @@ class page_action extends tform_actions {
 
 		parent::onAfterUpdate();
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/client/reseller_list.php b/interface/web/client/reseller_list.php
index fd8fca0c7a7969dda1d41556dbc0c7a706597dc5..83f5d6199110b6a6d638c3ba8384281f3f2ec647 100644
--- a/interface/web/client/reseller_list.php
+++ b/interface/web/client/reseller_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -53,4 +53,4 @@ $app->listform_actions->SQLExtSelect = ', client.country as countryiso';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/content.php b/interface/web/content.php
index 52ea21652aedc8fbdaf43e9cd5479721a2042cb0..ea23f5a2523c8f3e75266cf388601ca421b9ae23 100644
--- a/interface/web/content.php
+++ b/interface/web/content.php
@@ -28,8 +28,8 @@ 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');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 /*
 $module = $_REQUEST["s_mod"];
@@ -43,36 +43,36 @@ if(!preg_match("/^[a-z]{2,20}$/i", $module)) die('module name contains unallowed
 if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('page name contains unallowed chars.');
 
 if(is_file(ISPC_WEB_PATH."/$module/$page.php")) {
-	
-	include_once(ISPC_WEB_PATH."/$module/$page.php");
+
+	include_once ISPC_WEB_PATH."/$module/$page.php";
 
 	$classname = $module.'_'.$page;
 	$page = new $classname();
-	
+
 	$content = $page->render();
 	if($page->status == 'OK') {
 		echo $content;
 	} elseif($page->status == 'REDIRECT') {
-		$target_parts = explode(':',$page->target);
+		$target_parts = explode(':', $page->target);
 		$module = $target_parts[0];
 		$page = $target_parts[1];
 		if(!preg_match("/^[a-z]{2,20}$/i", $module)) die('target module name contains unallowed chars.');
 		if(!preg_match("/^[a-z]{2,20}$/i", $page)) die('target page name contains unallowed chars.');
-		
+
 		if(is_file(ISPC_WEB_PATH."/$module/$page.php")) {
-			include_once(ISPC_WEB_PATH."/$module/$page.php");
-			
+			include_once ISPC_WEB_PATH."/$module/$page.php";
+
 			$classname = $module.'_'.$page;
 			$page = new $classname();
-			
+
 			$content = $page->render();
 			if($page->status == 'OK') {
 				echo $content;
 			}
 		}
-		
+
 	}
-	
+
 } elseif (is_array($_SESSION["s"]['user']) or is_array($_SESSION["s"]["module"])) {
 	// If the user is logged in, we try to load the default page of the module
 	die('- error -');
@@ -80,4 +80,4 @@ if(is_file(ISPC_WEB_PATH."/$module/$page.php")) {
 	die('Page does not exist.');
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/ajax_get_json.php b/interface/web/dashboard/ajax_get_json.php
index e761f3e832ba87fff8b1fd9c12b30f7642da9ba6..48294188deec943ed8ef344cff8321f8ee86b94d 100644
--- a/interface/web/dashboard/ajax_get_json.php
+++ b/interface/web/dashboard/ajax_get_json.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dashboard');
@@ -40,46 +40,46 @@ $type = $_GET["type"];
 
 //if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-	
-	if($type == 'globalsearch'){
-		$q = $app->db->quote(trim($_GET["q"]));
-		$authsql = " AND ".$app->tform->getAuthSQL('r');
-		$modules = explode(',', $_SESSION['s']['user']['modules']);
-		
-		$result = array();
-		
-		// clients
-		$result[] = _search('client', 'client', "AND limit_client = 0");
-		
-		// resellers
-		$result[] = _search('client', 'reseller', "AND limit_client != 0");
-		
-		// web sites
-		$result[] = _search('sites', 'web_domain', "AND type = 'vhost'");
-		
-		// subdomains
-		$result[] = _search('sites', 'web_subdomain', "AND type = 'subdomain'");
-		
-		// web site aliases
-		$result[] = _search('sites', 'web_aliasdomain', "AND type = 'alias'");
-		
-		// vhostsubdomains
-		$result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'");
-		
-		// FTP users
-		$result[] = _search('sites', 'ftp_user');
-		
-		// shell users
-		$result[] = _search('sites', 'shell_user');
-		
-		// databases
-		/*
+
+if($type == 'globalsearch'){
+	$q = $app->db->quote(trim($_GET["q"]));
+	$authsql = " AND ".$app->tform->getAuthSQL('r');
+	$modules = explode(',', $_SESSION['s']['user']['modules']);
+
+	$result = array();
+
+	// clients
+	$result[] = _search('client', 'client', "AND limit_client = 0");
+
+	// resellers
+	$result[] = _search('client', 'reseller', "AND limit_client != 0");
+
+	// web sites
+	$result[] = _search('sites', 'web_domain', "AND type = 'vhost'");
+
+	// subdomains
+	$result[] = _search('sites', 'web_subdomain', "AND type = 'subdomain'");
+
+	// web site aliases
+	$result[] = _search('sites', 'web_aliasdomain', "AND type = 'alias'");
+
+	// vhostsubdomains
+	$result[] = _search('sites', 'web_vhost_subdomain', "AND type = 'vhostsubdomain'");
+
+	// FTP users
+	$result[] = _search('sites', 'ftp_user');
+
+	// shell users
+	$result[] = _search('sites', 'shell_user');
+
+	// databases
+	/*
 		$result_databases = array('cheader' => array(), 'cdata' => array());
 		if(in_array('sites', $modules)){
 			$sql = "SELECT * FROM web_database WHERE database_name LIKE '%".$q."%' OR database_user LIKE '%".$q."%' OR remote_ips LIKE '%".$q."%'".$authsql." ORDER BY database_name";
 			$results = $app->db->queryAllRecords($sql);
 
-			if(is_array($results) && !empty($results)){	
+			if(is_array($results) && !empty($results)){
 				$result_databases['cheader'] = array('title' => 'Databases',
 														'total' => count($results),
 														'limit' => count($results)
@@ -91,65 +91,65 @@ $type = $_GET["type"];
 												'onclick' => 'capp(\'sites\',\'sites/database_edit.php?id='.$result['database_id'].'\');',
 												'fill_text' => strtolower($result['database_name'])
 												);
-				}	
+				}
 			}
 		}
 		*/
-		$result[] = _search('sites', 'database');
-		
-		// database users
-		$result[] = _search('sites', 'database_user');
-		
-		// email domains
-		$result[] = _search('mail', 'mail_domain');
-		
-		// email alias domains
-		$result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'");
-		
-		// email mailboxes
-		$result[] = _search('mail', 'mail_user');
-		
-		// email aliases
-		$result[] = _search('mail', 'mail_alias', "AND type = 'alias'");
-		
-		// email forwards
-		$result[] = _search('mail', 'mail_forward', "AND type = 'forward'");
-		
-		// email catchalls
-		$result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'");
-		
-		// email transports
-		$result[] = _search('mail', 'mail_transport');
-		
-		// mailinglists
-		$result[] = _search('mail', 'mail_mailinglist');
-		
-		// getmails
-		$result[] = _search('mail', 'mail_get');
-		
-		// dns zones
-		$result[] = _search('dns', 'dns_soa');
-		
-		// secondary dns zones
-		$result[] = _search('dns', 'dns_slave');
-		
-		// virtual machines
-		$result[] = _search('vm', 'openvz_vm');
-		
-		// virtual machines os templates
-		$result[] = _search('vm', 'openvz_ostemplate');
-		
-		// virtual machines vm templates
-		$result[] = _search('vm', 'openvz_template');
-		
-		// virtual machines ip addresses
-		$result[] = _search('vm', 'openvz_ip');
-		
-		// directive snippets
-		$result[] = _search('admin', 'directive_snippets');
-
-		$json = $app->functions->json_encode($result);
-	}
+	$result[] = _search('sites', 'database');
+
+	// database users
+	$result[] = _search('sites', 'database_user');
+
+	// email domains
+	$result[] = _search('mail', 'mail_domain');
+
+	// email alias domains
+	$result[] = _search('mail', 'mail_aliasdomain', "AND type = 'aliasdomain'");
+
+	// email mailboxes
+	$result[] = _search('mail', 'mail_user');
+
+	// email aliases
+	$result[] = _search('mail', 'mail_alias', "AND type = 'alias'");
+
+	// email forwards
+	$result[] = _search('mail', 'mail_forward', "AND type = 'forward'");
+
+	// email catchalls
+	$result[] = _search('mail', 'mail_domain_catchall', "AND type = 'catchall'");
+
+	// email transports
+	$result[] = _search('mail', 'mail_transport');
+
+	// mailinglists
+	$result[] = _search('mail', 'mail_mailinglist');
+
+	// getmails
+	$result[] = _search('mail', 'mail_get');
+
+	// dns zones
+	$result[] = _search('dns', 'dns_soa');
+
+	// secondary dns zones
+	$result[] = _search('dns', 'dns_slave');
+
+	// virtual machines
+	$result[] = _search('vm', 'openvz_vm');
+
+	// virtual machines os templates
+	$result[] = _search('vm', 'openvz_ostemplate');
+
+	// virtual machines vm templates
+	$result[] = _search('vm', 'openvz_template');
+
+	// virtual machines ip addresses
+	$result[] = _search('vm', 'openvz_ip');
+
+	// directive snippets
+	$result[] = _search('admin', 'directive_snippets');
+
+	$json = $app->functions->json_encode($result);
+}
 
 //}
 
@@ -161,14 +161,14 @@ function _search($module, $section, $additional_sql = ''){
 		$search_fields = array();
 		$desc_fields = array();
 		if(is_file('../'.$module.'/form/'.$section.'.tform.php')){
-			include_once('../'.$module.'/form/'.$section.'.tform.php');
-			
+			include_once '../'.$module.'/form/'.$section.'.tform.php';
+
 			$category_title = $form["title"];
 			$form_file = $form["action"];
 			$db_table = $form["db_table"];
 			$db_table_idx = $form["db_table_idx"];
 			$order_by = $db_table_idx;
-			
+
 			if(is_array($form["tabs"]) && !empty($form["tabs"])){
 				foreach($form["tabs"] as $tab){
 					if(is_array($tab['fields']) && !empty($tab['fields'])){
@@ -189,7 +189,7 @@ function _search($module, $section, $additional_sql = ''){
 			}
 		}
 		unset($form);
-		
+
 		$where_clause = '';
 		if(!empty($search_fields)){
 			$where_clause = implode(' OR ', $search_fields);
@@ -201,17 +201,17 @@ function _search($module, $section, $additional_sql = ''){
 		if($additional_sql != '') $where_clause .= ' '.$additional_sql.' ';
 		$order_clause = '';
 		if($order_by != '') $order_clause = ' ORDER BY '.$order_by;
-		
+
 		$sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10";
 		$results = $app->db->queryAllRecords($sql);
-		
-		if(is_array($results) && !empty($results)){	
+
+		if(is_array($results) && !empty($results)){
 			$lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng';
-			if(is_file($lng_file)) include($lng_file);
+			if(is_file($lng_file)) include $lng_file;
 			$result_array['cheader'] = array('title' => $category_title,
-											'total' => count($results),
-											'limit' => count($results)
-											);
+				'total' => count($results),
+				'limit' => count($results)
+			);
 			foreach($results as $result){
 				$description = '';
 				if(!empty($desc_fields)){
@@ -221,18 +221,18 @@ function _search($module, $section, $additional_sql = ''){
 					}
 					if(!empty($desc_items)) $description = implode(' - ', $desc_items);
 				}
-				
+
 				$result_array['cdata'][] = array('title' => $wb[$title_key.'_txt'].': '.$result[$title_key],
-												'description' => $description,
-												'onclick' => "capp('".$module."','".$module."/".$form_file."?id=".$result[$db_table_idx]."');",
-												'fill_text' => strtolower($result[$title_key])
-												);
-			}	
+					'description' => $description,
+					'onclick' => "capp('".$module."','".$module."/".$form_file."?id=".$result[$db_table_idx]."');",
+					'fill_text' => strtolower($result[$title_key])
+				);
+			}
 		}
 	}
 	return $result_array;
 }
-		
+
 header('Content-type: application/json');
 echo $json;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php
index 0626758d01b08fbe46b929bbbcbd0da13332cf69..485bb320651be3b9fea60873e17ec934db078277 100644
--- a/interface/web/dashboard/dashboard.php
+++ b/interface/web/dashboard/dashboard.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dashboard');
@@ -39,7 +39,7 @@ $app->tpl->newTemplate("templates/dashboard.htm");
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 //* set Default - Values
@@ -94,12 +94,12 @@ $app->tpl->setVar('welcome_user', $welcome);
 $info = array();
 
 if(isset($_SESSION['show_info_msg'])) {
-    $info[] = array('info_msg' => '<p>'.$_SESSION['show_info_msg'].'</p>');
-    unset($_SESSION['show_info_msg']);
+	$info[] = array('info_msg' => '<p>'.$_SESSION['show_info_msg'].'</p>');
+	unset($_SESSION['show_info_msg']);
 }
 if(isset($_SESSION['show_error_msg'])) {
-    $app->tpl->setloop('error', array(array('error_msg' => '<p>'.$_SESSION['show_error_msg'].'</p>')));
-    unset($_SESSION['show_error_msg']);
+	$app->tpl->setloop('error', array(array('error_msg' => '<p>'.$_SESSION['show_error_msg'].'</p>')));
+	unset($_SESSION['show_error_msg']);
 }
 
 
@@ -113,7 +113,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') {
 	}
 	$v1 = ISPC_APP_VERSION;
 	$v2 = $_SESSION['s']['new_ispconfig_version'];
-	$this_version = explode(".",$v1);
+	$this_version = explode(".", $v1);
 	/*
 	$this_fullversion = (($this_version[0] < 10) ? '0'.$this_version[0] : $this_version[0]) .
 			    ((isset($this_version[1]) && $this_version[1] < 10) ? '0'.$this_version[1] : $this_version[1]) .
@@ -121,20 +121,20 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			    ((isset($this_version[3]) && $this_version[3] < 10) ? (($this_version[3] < 1) ? '00' : '0'.$this_version[3]) : @$this_version[3]);
 
 	*/
-	
-	$new_version = explode(".",$v2);
+
+	$new_version = explode(".", $v2);
 	/*
 	$new_fullversion =  (($new_version[0] < 10) ? '0'.$new_version[0] : $new_version[0]) .
 			    ((isset($new_version[1]) && $new_version[1] < 10) ? '0'.$new_version[1] : $new_version[1]) .
 			    ((isset($new_version[2]) && $new_version[2] < 10) ? '0'.$new_version[2] : $new_version[2]) .
 			    ((isset($new_version[3]) && $new_version[3] < 10) ? (($new_version[3] < 1) ? '00' : '0'.$new_version[3]) : @$new_version[3]);
 	*/
-	
-	$this_fullversion = str_pad($this_version[0], 2,'0',STR_PAD_LEFT).str_pad($this_version[1], 2,'0',STR_PAD_LEFT).@str_pad($this_version[2], 2,'0',STR_PAD_LEFT).@str_pad($this_version[3], 2,'0',STR_PAD_LEFT);
-	$new_fullversion = str_pad($new_version[0], 2,'0',STR_PAD_LEFT).str_pad($new_version[1], 2,'0',STR_PAD_LEFT).@str_pad($new_version[2], 2,'0',STR_PAD_LEFT).@str_pad($new_version[3], 2,'0',STR_PAD_LEFT);
+
+	$this_fullversion = str_pad($this_version[0], 2, '0', STR_PAD_LEFT).str_pad($this_version[1], 2, '0', STR_PAD_LEFT).@str_pad($this_version[2], 2, '0', STR_PAD_LEFT).@str_pad($this_version[3], 2, '0', STR_PAD_LEFT);
+	$new_fullversion = str_pad($new_version[0], 2, '0', STR_PAD_LEFT).str_pad($new_version[1], 2, '0', STR_PAD_LEFT).@str_pad($new_version[2], 2, '0', STR_PAD_LEFT).@str_pad($new_version[3], 2, '0', STR_PAD_LEFT);
 	if($new_fullversion > $this_fullversion) {
-		$info[] = array('info_msg' => '<p>There is a new Version of ISPConfig 3 available!</p>' . 
-			'<p>This Version: <b>' . $v1 . '</b></p>' . 
+		$info[] = array('info_msg' => '<p>There is a new Version of ISPConfig 3 available!</p>' .
+			'<p>This Version: <b>' . $v1 . '</b></p>' .
 			'<p>New Version : <b>' . $v2 .  '</b></p>' .
 			'<p><a href="http://www.ispconfig.org/ispconfig-3/download" target="ISPC">See more...</a></p>');
 	}
@@ -144,12 +144,12 @@ $app->tpl->setloop('info', $info);
 
 /* Load the dashlets*/
 $dashlet_list = array();
-$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..' && !is_dir($file)) {
-        $dashlet_name = substr($file,0,-4);
+$handle = @opendir(ISPC_WEB_PATH.'/dashboard/dashlets');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..' && !is_dir($file)) {
+		$dashlet_name = substr($file, 0, -4);
 		$dashlet_class = 'dashlet_'.$dashlet_name;
-		include_once(ISPC_WEB_PATH.'/dashboard/dashlets/'.$file);
+		include_once ISPC_WEB_PATH.'/dashboard/dashlets/'.$file;
 		$dashlet_list[$dashlet_name] = new $dashlet_class;
 	}
 }
@@ -157,7 +157,7 @@ while ($file = @readdir ($handle)) {
 
 /* Which dashlets in which column */
 /******************************************************************************/
-$default_leftcol_dashlets = array('modules','invoices','quota','mailquota');
+$default_leftcol_dashlets = array('modules', 'invoices', 'quota', 'mailquota');
 $default_rightcol_dashlets = array('limits');
 
 $app->uses('getconf');
@@ -165,10 +165,10 @@ $dashlets_config = $app->getconf->get_global_config('misc');
 //* Client: If the logged in user is not admin and has no sub clients (no reseller)
 if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 	$role = 'client';
-//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
+	//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
 } elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 	$role = 'reseller';
-//* Admin: If the logged in user is admin
+	//* Admin: If the logged in user is admin
 } else {
 	$role = 'admin';
 }
@@ -177,7 +177,7 @@ $dashlets_config[$role.'_dashlets_right'] = trim($dashlets_config[$role.'_dashle
 
 if($dashlets_config[$role.'_dashlets_left'] != ''){
 	preg_match_all('@\[(.*?)\]@', $dashlets_config[$role.'_dashlets_left'], $matches);
-	$leftcol_dashlets = $matches[1]; 
+	$leftcol_dashlets = $matches[1];
 } else {
 	$leftcol_dashlets = $default_leftcol_dashlets;
 }
@@ -212,4 +212,4 @@ $app->tpl->setloop('rightcol', $rightcol);
 //* Do Output
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashlets/limits.php b/interface/web/dashboard/dashlets/limits.php
index 16144f218b8f02a1165e406ffb382af0e7f321de..2d63925b4b0ff1ad4a979cef1fb9783b60e4f348 100644
--- a/interface/web/dashboard/dashlets/limits.php
+++ b/interface/web/dashboard/dashlets/limits.php
@@ -1,136 +1,136 @@
 <?php
 
 class dashlet_limits {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		$limits = array();
-		
+
 		/* Limits to be shown*/
-		
+
 		$limits[] = array('field' => 'limit_maildomain',
-						  'db_table' => 'mail_domain',
-						  'db_where' => '');
-						  
+			'db_table' => 'mail_domain',
+			'db_where' => '');
+
 		$limits[] = array('field' => 'limit_mailmailinglist',
-						  'db_table' => 'mail_mailinglist',
-						  'db_where' => '');
-		
+			'db_table' => 'mail_mailinglist',
+			'db_where' => '');
+
 		$limits[] = array('field' => 'limit_mailbox',
-						  'db_table' => 'mail_user',
-						  'db_where' => '');
-		
+			'db_table' => 'mail_user',
+			'db_where' => '');
+
 		$limits[] = array('field' => 'limit_mailalias',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'alias'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'alias'");
+
 		$limits[] = array('field' => 'limit_mailaliasdomain',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'aliasdomain'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'aliasdomain'");
+
 		$limits[] = array('field' => 'limit_mailforward',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'forward'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'forward'");
+
 		$limits[] = array('field' => 'limit_mailcatchall',
-						  'db_table' => 'mail_forwarding',
-						  'db_where' => "type = 'catchall'");
-		
+			'db_table' => 'mail_forwarding',
+			'db_where' => "type = 'catchall'");
+
 		$limits[] = array('field' => 'limit_mailrouting',
-						  'db_table' => 'mail_transport',
-						  'db_where' => "");
-		
+			'db_table' => 'mail_transport',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_mailfilter',
-						  'db_table' => 'mail_user_filter',
-						  'db_where' => "");
-		
+			'db_table' => 'mail_user_filter',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_fetchmail',
-						  'db_table' => 'mail_get',
-						  'db_where' => "");
-		
+			'db_table' => 'mail_get',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_spamfilter_wblist',
-						  'db_table' => 'spamfilter_wblist',
-						  'db_where' => "");
-		
+			'db_table' => 'spamfilter_wblist',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_spamfilter_user',
-						  'db_table' => 'spamfilter_users',
-						  'db_where' => "");
-		
+			'db_table' => 'spamfilter_users',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_spamfilter_policy',
-						  'db_table' => 'spamfilter_policy',
-						  'db_where' => "");
-		
+			'db_table' => 'spamfilter_policy',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_web_domain',
-						  'db_table' => 'web_domain',
-						  'db_where' => "type = 'vhost'");
-		
+			'db_table' => 'web_domain',
+			'db_where' => "type = 'vhost'");
+
 		$limits[] = array('field' => 'limit_web_subdomain',
-						  'db_table' => 'web_domain',
-						  'db_where' => "(type = 'subdomain' OR type = 'vhostsubdomain')");
-		
+			'db_table' => 'web_domain',
+			'db_where' => "(type = 'subdomain' OR type = 'vhostsubdomain')");
+
 		$limits[] = array('field' => 'limit_web_aliasdomain',
-						  'db_table' => 'web_domain',
-						  'db_where' => "type = 'alias'");
-		
+			'db_table' => 'web_domain',
+			'db_where' => "type = 'alias'");
+
 		$limits[] = array('field' => 'limit_ftp_user',
-						  'db_table' => 'ftp_user',
-						  'db_where' => "");
+			'db_table' => 'ftp_user',
+			'db_where' => "");
 
 		$limits[] = array('field' => 'limit_shell_user',
-						  'db_table' => 'shell_user',
-						  'db_where' => "");
-		
+			'db_table' => 'shell_user',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_dns_zone',
-						  'db_table' => 'dns_soa',
-						  'db_where' => "");
+			'db_table' => 'dns_soa',
+			'db_where' => "");
 
 		$limits[] = array('field' => 'limit_dns_slave_zone',
-						  'db_table' => 'dns_slave',
-						  'db_where' => "");
+			'db_table' => 'dns_slave',
+			'db_where' => "");
 
 		$limits[] = array('field' => 'limit_dns_record',
-						  'db_table' => 'dns_rr',
-						  'db_where' => "");
-		
+			'db_table' => 'dns_rr',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_database',
-						  'db_table' => 'web_database',
-						  'db_where' => "");
-		
+			'db_table' => 'web_database',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_cron',
-						  'db_table' => 'cron',
-						  'db_where' => "");
-		
+			'db_table' => 'cron',
+			'db_where' => "");
+
 		$limits[] = array('field' => 'limit_client',
-						  'db_table' => 'client',
-						  'db_where' => "");
-		
-		
-		
-		
+			'db_table' => 'client',
+			'db_where' => "");
+
+
+
+
 		//* Loading Template
 		$app->uses('tpl,tform');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/limits.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_limits.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		if($app->auth->is_admin()) {
 			$user_is_admin = true;
 		} else {
 			$user_is_admin = false;
 		}
-		$tpl->setVar('is_admin',$user_is_admin);
-		
+		$tpl->setVar('is_admin', $user_is_admin);
+
 		if($user_is_admin == false) {
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT * FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 		}
-		
+
 		$rows = array();
 		foreach($limits as $limit) {
 			$field = $limit['field'];
@@ -142,29 +142,29 @@ class dashlet_limits {
 			if($value != 0 || $value == $wb['unlimited_txt']) {
 				$value_formatted = ($value == '-1')?$wb['unlimited_txt']:$value;
 				$rows[] = array('field' => $field,
-								'field_txt' => $wb[$field.'_txt'],
-								'value' => $value_formatted,
-								'usage' => $this->_get_limit_usage($limit));
+					'field_txt' => $wb[$field.'_txt'],
+					'value' => $value_formatted,
+					'usage' => $this->_get_limit_usage($limit));
 			}
 		}
-		$tpl->setLoop('rows',$rows);
-		
-		
+		$tpl->setLoop('rows', $rows);
+
+
 		return $tpl->grab();
-		
+
 	}
-	
+
 	function _get_limit_usage($limit) {
 		global $app;
-		
+
 		$sql = "SELECT count(sys_userid) as number FROM ".$limit['db_table']." WHERE ";
 		if($limit['db_where'] != '') $sql .= $limit['db_where']." AND ";
 		$sql .= $app->tform->getAuthSQL('r');
 		$rec = $app->db->queryOneRecord($sql);
 		return $rec['number'];
-		
+
 	}
-	
+
 }
 
 
diff --git a/interface/web/dashboard/dashlets/mailquota.php b/interface/web/dashboard/dashlets/mailquota.php
index dd8d72bbf451c84ba59d9d24841414839b7dd290..956c4e65cc97bda3638ccb983cb92b6fd2c5f05d 100644
--- a/interface/web/dashboard/dashlets/mailquota.php
+++ b/interface/web/dashboard/dashlets/mailquota.php
@@ -1,21 +1,21 @@
 <?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);
+		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)) {
@@ -33,7 +33,7 @@ class dashlet_mailquota {
 		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);
@@ -41,11 +41,11 @@ class dashlet_mailquota {
 		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){
@@ -59,28 +59,29 @@ class dashlet_mailquota {
 				if($emails[$i]['quota'] == 0){
 					$emails[$i]['quota'] = $app->lng('unlimited');
 				} else {
-					$emails[$i]['quota'] = round($emails[$i]['quota'] / 1048576,4).' MB';
+					$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';
+					$emails[$i]['used'] = round($emails[$i]['used'] / 1024, 4).' KB';
 				} else {
-					$emails[$i]['used'] = round($emails[$i]['used'] / 1048576,4).' MB';
-				} 
-		
+					$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);
-		
+
+		$tpl->setVar('has_mailquota', $has_mailquota);
+
 		return $tpl->grab();
-		
-		
+
+
 	}
+
 }
 
 
@@ -90,4 +91,4 @@ class dashlet_mailquota {
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashlets/modules.php b/interface/web/dashboard/dashlets/modules.php
index 2f16329f827b549962a813df93d8b803b02d83c6..1b1d2ef99fcd5cc540f7375e4a7b75a19d219a4b 100644
--- a/interface/web/dashboard/dashlets/modules.php
+++ b/interface/web/dashboard/dashlets/modules.php
@@ -1,21 +1,21 @@
 <?php
 
 class dashlet_modules {
-	
+
 	function show() {
 		global $app, $conf;
-		
+
 		//* Loading Template
 		$app->uses('tpl');
-		
+
 		$tpl = new tpl;
 		$tpl->newTemplate("dashlets/templates/modules.htm");
-		
+
 		$wb = array();
 		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_modules.lng';
-		if(is_file($lng_file)) include($lng_file);
+		if(is_file($lng_file)) include $lng_file;
 		$tpl->setVar($wb);
-		
+
 		/*
 		 * Show all modules, the user is allowed to use
 		*/
@@ -25,28 +25,29 @@ class dashlet_modules {
 			foreach($modules as $mt) {
 				if(is_file('../' . $mt . '/lib/module.conf.php')) {
 					if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
-					include_once('../' . $mt.'/lib/module.conf.php');
+					include_once '../' . $mt.'/lib/module.conf.php';
 					/* We don't want to show the dashboard */
 					if ($mt != 'dashboard') {
 						$module_title = $app->lng($module['title']);
 						if(function_exists('mb_strlen')) {
-							if(mb_strlen($module_title,"UTF-8") > 8) $module_title = mb_substr($module_title,0,7,"UTF-8").'..';
+							if(mb_strlen($module_title, "UTF-8") > 8) $module_title = mb_substr($module_title, 0, 7, "UTF-8").'..';
 						} else {
-							if(strlen($module_title) > 8) $module_title = substr($module_title,0,7).'..';
+							if(strlen($module_title) > 8) $module_title = substr($module_title, 0, 7).'..';
 						}
-						$mod[] = array(	'modules_title' 	=> $module_title,
-								'modules_startpage'	=> $module['startpage'],
-								'modules_name'  	=> $module['name']);
+						$mod[] = array( 'modules_title'  => $module_title,
+							'modules_startpage' => $module['startpage'],
+							'modules_name'   => $module['name']);
 					}
 				}
 			}
 
 			$tpl->setloop('modules', $mod);
 		}
-		
+
 		return $tpl->grab();
-		
+
 	}
+
 }
 
 
@@ -56,4 +57,4 @@ class dashlet_modules {
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/dashlets/quota.php b/interface/web/dashboard/dashlets/quota.php
index 29d1d3b832e8201997d722e1c561b777c7130e7b..1cb56713662408b3633e69274c5b06895734cfab 100644
--- a/interface/web/dashboard/dashlets/quota.php
+++ b/interface/web/dashboard/dashlets/quota.php
@@ -1,33 +1,33 @@
 <?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);
+		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'])));
+				$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' AND type = 'vhost'".$sql_where);
@@ -39,7 +39,7 @@ class dashlet_quota {
 				$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];
@@ -50,7 +50,7 @@ class dashlet_quota {
 				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){
@@ -60,50 +60,51 @@ class dashlet_quota {
 				}
 				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';
+					$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';
+					$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';
+					$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);
-		
+
+		$tpl->setVar('has_quota', $has_quota);
+
 		return $tpl->grab();
-		
-		
+
+
 	}
+
 }
 
 
@@ -113,4 +114,4 @@ class dashlet_quota {
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/lib/admin.conf.php b/interface/web/dashboard/lib/admin.conf.php
index 584f28bad6bb16793a5f8f488d9ebf48b7b92683..b4b2eb9167391d5c3e8f0c0eeaed5a64c34b664e 100644
--- a/interface/web/dashboard/lib/admin.conf.php
+++ b/interface/web/dashboard/lib/admin.conf.php
@@ -26,4 +26,4 @@ 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.
 */
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dashboard/lib/custom_menu.inc.php b/interface/web/dashboard/lib/custom_menu.inc.php
index 8796023c642d83ba0dd305bcb8d715c9b5e7607f..b71bd16f6db677ae14e5df56ae412131c46c49ff 100644
--- a/interface/web/dashboard/lib/custom_menu.inc.php
+++ b/interface/web/dashboard/lib/custom_menu.inc.php
@@ -38,24 +38,24 @@ $misc_config = $app->getconf->get_global_config('misc');
 
 
 switch($_SESSION['s']['user']['typ']) {
-	case 'admin':
-		$atom_url = $misc_config['dashboard_atom_url_admin'];
-		break;
-	case 'user':
-		if ($app->auth->has_clients($_SESSION['s']['user']['userid']) === true)
-			$atom_url = $misc_config['dashboard_atom_url_reseller'];
-		else
-			$atom_url = $misc_config['dashboard_atom_url_client'];
-		break;
-	default:
-		$atom_url = "";
+case 'admin':
+	$atom_url = $misc_config['dashboard_atom_url_admin'];
+	break;
+case 'user':
+	if ($app->auth->has_clients($_SESSION['s']['user']['userid']) === true)
+		$atom_url = $misc_config['dashboard_atom_url_reseller'];
+	else
+		$atom_url = $misc_config['dashboard_atom_url_client'];
+	break;
+default:
+	$atom_url = "";
 }
 
 $rows = array();
 
 if( $atom_url != '' ) {
 	if(!isset($_SESSION['s']['rss_news'])) {
-		
+
 		$app->simplepie->set_feed_url($atom_url);
 		$app->simplepie->enable_cache(false);
 		$app->simplepie->init();
@@ -69,24 +69,24 @@ if( $atom_url != '' ) {
 			//* We want to show only the first 10 news records
 			if($n <= 10) {
 				$rows[] = array('title' => $item->get_title(),
-								'link' => $item->get_link(),
-								'content' => $item->get_content(),
-								'date' => $item->get_date('Y-m-d')
-								);
+					'link' => $item->get_link(),
+					'content' => $item->get_content(),
+					'date' => $item->get_date('Y-m-d')
+				);
 			}
 			$n++;
 		}
-		
+
 		$_SESSION['s']['rss_news'] = $rows;
-		
+
 	} else {
 		$rows = $_SESSION['s']['rss_news'];
 	}
-	
-	$app->tpl->setVar('latest_news_txt',$app->lng('latest_news_txt'));
+
+	$app->tpl->setVar('latest_news_txt', $app->lng('latest_news_txt'));
 
 }
 
-$app->tpl->setLoop('news',$rows);
+$app->tpl->setLoop('news', $rows);
 
 ?>
diff --git a/interface/web/dashboard/lib/module.conf.php b/interface/web/dashboard/lib/module.conf.php
index 337d6b7001f214609668b61fae26c84c4ec2b63b..67f769e6b927271bdbe1455d611f172578726375 100644
--- a/interface/web/dashboard/lib/module.conf.php
+++ b/interface/web/dashboard/lib/module.conf.php
@@ -27,22 +27,22 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-$module['name'] 		= 'dashboard'; 
-$module['title'] 		= 'top_menu_dashboard';
-$module['template'] 	= 'dashboard.tpl.htm';
-$module['startpage'] 	= 'dashboard/dashboard.php';
+$module['name']   = 'dashboard';
+$module['title']   = 'top_menu_dashboard';
+$module['template']  = 'dashboard.tpl.htm';
+$module['startpage']  = 'dashboard/dashboard.php';
 $module['tab_width']    = '';
 
 //$items = array();
 //
-//$items[] = array( 'title' 	=> 'Dashboard 1',
-//				  'target' 	=> 'content',
-//				  'link'	=> 'dashboard/dashboard.php');
+//$items[] = array( 'title'  => 'Dashboard 1',
+//      'target'  => 'content',
+//      'link' => 'dashboard/dashboard.php');
 //
-//$module['nav'][] = array(	'title'	=> 'Dashboard 2',
-//							'open' 	=> 1,
-//							'items'	=> $items);
+//$module['nav'][] = array( 'title' => 'Dashboard 2',
+//       'open'  => 1,
+//       'items' => $items);
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/form_edit.php b/interface/web/designer/form_edit.php
index 90acd2e1b51c910a4c92db242a2ad7401e5d071f..2127fea68824378dfeb6fa675ef0b3e6d93dabb1 100644
--- a/interface/web/designer/form_edit.php
+++ b/interface/web/designer/form_edit.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,15 +39,15 @@ $app->auth->check_module_permissions('designer');
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/form_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/form_edit.htm');
 
 // Importing variables
 $module_name = $_REQUEST["module_name"];
 $form_name = $_REQUEST["form_name"];
 
 // Checking imported variables
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$form_name)) die("form_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $form_name)) die("form_name contains invalid chars.");
 
 $id = $form_name;
 
@@ -59,52 +59,52 @@ if(count($_POST) > 1) {
 		$action = 'INSERT';
 	}
 
-	
+
 	if($error == '') {
-		
+
 		$filename = "../".$module_name."/form/".$form_name.".tform.php";
 		$form_new = $_POST["form"];
-		
+
 		if(@is_file($filename)) {
-			include_once($filename);
+			include_once $filename;
 			$tabs = $form["tabs"];
 			unset($form["tabs"]);
 			$form_new["tabs"] = $tabs;
 		}
-		
-		$file_content = "<?php\r\n".'$form = '.var_export($form_new,true)."\r\n?>";
-		
+
+		$file_content = "<?php\r\n".'$form = '.var_export($form_new, true)."\r\n?>";
+
 		die($file_content);
-		
+
 		// writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			print "Cannot open file ($filename)"; 
-			exit; 
-		} 
-
-		if (!fwrite($handle, $file_content)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
-		} 
-    
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $file_content)) {
+			print "Cannot write to file ($filename)";
+			exit;
+		}
+
 		fclose($handle);
-		
+
 		// zu Liste springen
-    	header("Location: form_list.php");
-        exit;
-			
+		header("Location: form_list.php");
+		exit;
+
 	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar("error", "<b>Fehler:</b><br>".$error);
 		$app->tpl->setVar($_POST);
 	}
 }
 
 if($id != '') {
-// Datensatz besteht bereits
+	// Datensatz besteht bereits
 	// bestehenden Datensatz anzeigen
 	if($error == '') {
 		// es liegt ein Fehler vor
-		include_once("../".$module_name."/form/".$form_name.".tform.php");
+		include_once "../".$module_name."/form/".$form_name.".tform.php";
 		//$tabs = $form["tabs"];
 		unset($form["tabs"]);
 		$record = $form;
@@ -123,7 +123,7 @@ if($id != '') {
 	}
 	$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-// neuer datensatz
+	// neuer datensatz
 	if($error == '') {
 		// es liegt kein Fehler vor
 		// Pewsets
@@ -132,7 +132,7 @@ if($id != '') {
 		// ein Fehler
 		$record = $_POST;
 		unset($_POST["tabs"]);
-		
+
 	}
 	$record["readonly"] = '';
 }
@@ -141,7 +141,7 @@ $record["id"] = $form_name;
 
 $app->tpl->setVar($record);
 
-include_once("lib/lang/".$_SESSION["s"]["language"]."_form_edit.lng");
+include_once "lib/lang/".$_SESSION["s"]["language"]."_form_edit.lng";
 $app->tpl->setVar($wb);
 
 // Defaultwerte setzen
@@ -150,4 +150,4 @@ $app->tpl_defaults();
 // Template parsen
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/form_list.php b/interface/web/designer/form_list.php
index 6bd8bc69c99946374708ae2415d55cf093eebb56..0093275979593cef58a3dbdc9d8984d9bbb3a098 100644
--- a/interface/web/designer/form_list.php
+++ b/interface/web/designer/form_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -40,50 +40,50 @@ $app->tpl->setInclude('content_tpl', 'templates/form_list.htm');
 
 function getinfo($file, $form_file, $bgcolor) {
 	$module_name = $file;
-	include(ISPC_WEB_PATH."/$file/form/$form_file");
-	return array( 	'name' =>        $form['name'],
-					'title' =>       $form['title'],
-					'description' => $form['description'],
-					'module_name' => $module_name,
-					'bgcolor' =>     $bgcolor
-                );
+	include ISPC_WEB_PATH."/$file/form/$form_file";
+	return array(  'name' =>        $form['name'],
+		'title' =>       $form['title'],
+		'description' => $form['description'],
+		'module_name' => $module_name,
+		'bgcolor' =>     $bgcolor
+	);
 }
 
 // lese Module aus
 $bgcolor = '#FFFFFF';
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH.'/'.$file.'/lib/module.conf.php') and $file != 'login') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH.'/'.$file.'/lib/module.conf.php') and $file != 'login') {
 				if(@is_dir(ISPC_WEB_PATH."/$file/form")) {
 					$handle2 = opendir(ISPC_WEB_PATH."/$file/form");
-					while ($form_file = @readdir ($handle2)) {
-						if (substr($form_file,0,1) != ".") {
-						    //echo ISPC_ROOT_PATH."/web/".$file."/form/$form_file<br>";
+					while ($form_file = @readdir($handle2)) {
+						if (substr($form_file, 0, 1) != ".") {
+							//echo ISPC_ROOT_PATH."/web/".$file."/form/$form_file<br>";
 							//include_once(ISPC_ROOT_PATH."/web/".$file."/form/$form_file");
 							// Farbwechsel
-							$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';				
+							$bgcolor = ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 							$modules_list[] = getinfo($file, $form_file, $bgcolor);
 
 						}
 					}
 				}
 			}
-        }
+		}
 	}
 }
 
 $app->tpl->setLoop('records', $modules_list);
 
-//* load language file 
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_form_list.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/form_show.php b/interface/web/designer/form_show.php
index 4cb805668ee79192337476fe84ff3422632b20fb..74e609bf17e8a7e795659ed3f04d0bc675731f8e 100644
--- a/interface/web/designer/form_show.php
+++ b/interface/web/designer/form_show.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -38,26 +38,26 @@ if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 $app->uses('tpl');
 
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/form_show.htm');
+$app->tpl->setInclude('content_tpl', 'templates/form_show.htm');
 
 
 // TODO: Check ID for malicius chars
 $module_name = $_REQUEST["module_name"];
 $form_name = $_REQUEST["form_name"];
 
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$form_name)) die("form_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $form_name)) die("form_name contains invalid chars.");
 
-include_once("../".$module_name."/form/".$form_name.".tform.php");
+include_once "../".$module_name."/form/".$form_name.".tform.php";
 $tabs = $form["tabs"];
 unset($form["tabs"]);
 $record = $form;
 $record["form_name"] = $form_name;
 $record["module_name"] = $module_name;
 
-// loading language file 
+// loading language file
 $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_form_show.lng";
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 // baue Tabs navi
@@ -65,8 +65,8 @@ $content = "";
 $n1 = 0;
 $n2 = 0;
 if(is_array($tabs)) {
-foreach($tabs as $tab_id => $tab) {
-	$content .= "<tr>
+	foreach($tabs as $tab_id => $tab) {
+		$content .= "<tr>
     <td colspan='2' class='frmText11'>
 	  <table width='100%'>
 	  	<tr>
@@ -79,12 +79,12 @@ foreach($tabs as $tab_id => $tab) {
 		  <input type=\"button\" name=\"bt5$n2\" value=\"$wb[down_txt]\" onclick=\"location.href='form_tab_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&dir=down'\" class=\"button\" />
 		  </td>
 		</tr>";
-	//$content .= "<tr><td bgcolor='#EEEEEE' class='frmText11'>Bereich:</td><td class='frmText11' bgcolor='#EEEEEE'><input name=\"module[nav][$n1][title]\" type=\"text\" class=\"text\" value=\"$section[title]\" size=\"30\" maxlength=\"255\"><input name=\"module[nav][$n1][open]\" type=\"hidden\" value=\"$section[open]\"></td></tr>\r\n";
-	foreach($tab["fields"] as $field_id => $field) {
-		//$content .= "<tr><td class='frmText11'>Titel:</td><td class='frmText11'><input name=\"module[nav][$n1][items][$n2][title]\" type=\"text\" class=\"text\" value=\"$item[title]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
-		//$content .= "<tr><td class='frmText11'>Ziel:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][target]\" type=\"text\" class=\"text\" value=\"$item[target]\" size=\"10\" maxlength=\"255\"></td></tr>\r\n";
-		//$content .= "<tr><td class='frmText11'>Link:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][link]\" type=\"text\" class=\"text\" value=\"$item[link]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
-		$content .= "<tr>
+		//$content .= "<tr><td bgcolor='#EEEEEE' class='frmText11'>Bereich:</td><td class='frmText11' bgcolor='#EEEEEE'><input name=\"module[nav][$n1][title]\" type=\"text\" class=\"text\" value=\"$section[title]\" size=\"30\" maxlength=\"255\"><input name=\"module[nav][$n1][open]\" type=\"hidden\" value=\"$section[open]\"></td></tr>\r\n";
+		foreach($tab["fields"] as $field_id => $field) {
+			//$content .= "<tr><td class='frmText11'>Titel:</td><td class='frmText11'><input name=\"module[nav][$n1][items][$n2][title]\" type=\"text\" class=\"text\" value=\"$item[title]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
+			//$content .= "<tr><td class='frmText11'>Ziel:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][target]\" type=\"text\" class=\"text\" value=\"$item[target]\" size=\"10\" maxlength=\"255\"></td></tr>\r\n";
+			//$content .= "<tr><td class='frmText11'>Link:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][link]\" type=\"text\" class=\"text\" value=\"$item[link]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
+			$content .= "<tr>
 		  <td class='frmText11'>$field_id</td>
 		  <td class='frmText11' width='220' align='right'>
 		  <input type=\"button\" name=\"bt6$n2\" value=\"$wb[edit_txt]\" onclick=\"location.href='form_field_edit.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id'\" class=\"button\" />
@@ -93,14 +93,14 @@ foreach($tabs as $tab_id => $tab) {
 		  <input type=\"button\" name=\"bt9$n2\" value=\"$wb[down_txt]\" onclick=\"location.href='form_field_flip.php?module_name=$module_name&form_name=$form_name&tab_id=$tab_id&field_id=$field_id&dir=down'\" class=\"button\" />
 		  </td>
 		</tr>";
-		$n2++;
-	}
-	$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
+			$n2++;
+		}
+		$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
 	  </table>
 	</td>
   </tr>";
-	$n1++;
-}
+		$n1++;
+	}
 }
 
 $record["nav"] = $content;
@@ -109,11 +109,11 @@ $record["nav"] = $content;
 $app->tpl->setVar($record);
 
 
-$app->tpl->setLoop('records',$modules_list);
+$app->tpl->setLoop('records', $modules_list);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/index.php b/interface/web/designer/index.php
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..8b137891791fe96927ad78e64b0aad7bded08bdc 100644
--- a/interface/web/designer/index.php
+++ b/interface/web/designer/index.php
@@ -0,0 +1 @@
+
diff --git a/interface/web/designer/lib/admin.conf.php b/interface/web/designer/lib/admin.conf.php
index dc10d563346f39f58a736ed6bf9960cb11622d4e..6eff33c4ecc38463c5c95351e136842d6fdc3d25 100644
--- a/interface/web/designer/lib/admin.conf.php
+++ b/interface/web/designer/lib/admin.conf.php
@@ -1,4 +1,4 @@
 <?php
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/lib/module.conf.php b/interface/web/designer/lib/module.conf.php
index 117f79b565da7e41867995327fd68e3aa1b929aa..6104f497ceae53c6f1866cfe4fd9a3c33e064c80 100644
--- a/interface/web/designer/lib/module.conf.php
+++ b/interface/web/designer/lib/module.conf.php
@@ -1,47 +1,47 @@
 <?php
 $module = array (
-  'name' => 'designer',
-  'title' => 'BE Designer',
-  'template' => 'module.tpl.htm',
-  'navframe_page' => '',
-  'startpage' => 'designer/module_list.php',
-  'tab_width' => '',
-  'nav' => 
-  array (
-    0 => 
-    array (
-      'title' => 'Modules',
-      'open' => '1',
-      'items' => 
-      array (
-        0 => 
-        array (
-          'title' => 'Add',
-          'target' => 'content',
-          'link' => 'designer/module_edit.php',
-        ),
-        1 => 
-        array (
-          'title' => 'Edit',
-          'target' => 'content',
-          'link' => 'designer/module_list.php',
-        ),
-      ),
-    ),
-    /*
-	1 => 
+	'name' => 'designer',
+	'title' => 'BE Designer',
+	'template' => 'module.tpl.htm',
+	'navframe_page' => '',
+	'startpage' => 'designer/module_list.php',
+	'tab_width' => '',
+	'nav' =>
+	array (
+		0 =>
+		array (
+			'title' => 'Modules',
+			'open' => '1',
+			'items' =>
+			array (
+				0 =>
+				array (
+					'title' => 'Add',
+					'target' => 'content',
+					'link' => 'designer/module_edit.php',
+				),
+				1 =>
+				array (
+					'title' => 'Edit',
+					'target' => 'content',
+					'link' => 'designer/module_list.php',
+				),
+			),
+		),
+		/*
+	1 =>
     array (
       'title' => 'Formulare',
       'open' => '1',
-      'items' => 
+      'items' =>
       array (
-        2 => 
+        2 =>
         array (
           'title' => 'Add',
           'target' => 'content',
           'link' => 'designer/form_edit.php',
         ),
-        3 => 
+        3 =>
         array (
           'title' => 'Edit',
           'target' => 'content',
@@ -49,19 +49,19 @@ $module = array (
         ),
       ),
     ),
-    2 => 
+    2 =>
     array (
       'title' => 'Lists',
       'open' => '1',
-      'items' => 
+      'items' =>
       array (
-        4 => 
+        4 =>
         array (
           'title' => 'Add',
           'target' => 'content',
           'link' => 'designer/list_edit.php',
         ),
-        5 => 
+        5 =>
         array (
           'title' => 'Edit',
           'target' => 'content',
@@ -69,19 +69,19 @@ $module = array (
         ),
       ),
     ),
-    3 => 
+    3 =>
     array (
       'title' => 'Languages',
       'open' => '1',
-      'items' => 
+      'items' =>
       array (
-        6 => 
+        6 =>
         array (
           'title' => 'Add',
           'target' => 'content',
           'link' => 'designer/lang_edit.php',
         ),
-        7 => 
+        7 =>
         array (
           'title' => 'Edit',
           'target' => 'content',
@@ -90,6 +90,6 @@ $module = array (
       ),
     ),
 	*/
-  ),
+	),
 )
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_edit.php b/interface/web/designer/module_edit.php
index 26e229a7d8b90f6800b816f53a3f569d60f708e0..af7dbb0271b34c602f708e8f92e3cc955eadcfb3 100644
--- a/interface/web/designer/module_edit.php
+++ b/interface/web/designer/module_edit.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,11 +39,11 @@ $app->auth->check_module_permissions('designer');
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_edit.htm');
 
 // ID importieren
 $id = $_REQUEST["id"];
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$id)) die("id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $id)) die("id contains invalid chars.");
 
 if(count($_POST) > 1) {
 	// Bestimme aktion
@@ -53,24 +53,24 @@ if(count($_POST) > 1) {
 		$action = 'INSERT';
 	}
 
-	
+
 	if($error == '') {
-		
+
 		$id = $_POST["module"]["name"];
-		if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$id)) die("id contains invalid chars.");
-		
+		if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $id)) die("id contains invalid chars.");
+
 		$filename = "../".$id."/lib/module.conf.php";
 		$module_new = $_POST["module"];
-		
+
 		if(@is_file($filename)) {
-			include_once($filename);
+			include_once $filename;
 			$navi = $module["nav"];
 			unset($module);
 			$module_new["nav"] = $navi;
 		}
-		
-		$m = "<?php\r\n".'$module = '.var_export($module_new,true)."\r\n?>";
-		
+
+		$m = "<?php\r\n".'$module = '.var_export($module_new, true)."\r\n?>";
+
 		// creating the module directories
 		if(!@is_dir("../".$id)) mkdir("../".$id) or die("Cannot make directory: ../".$id);
 		if(!@is_dir("../".$id."/lib")) mkdir("../".$id."/lib") or die("Cannot make directory: ../".$id."/lib");
@@ -78,52 +78,52 @@ if(count($_POST) > 1) {
 		if(!@is_dir("../".$id."/form")) mkdir("../".$id."/form") or die("Cannot make directory: ../".$id."/form");
 		if(!@is_dir("../".$id."/list")) mkdir("../".$id."/list") or die("Cannot make directory: ../".$id."/list");
 		if(!@is_dir("../".$id."/templates")) mkdir("../".$id."/templates") or die("Cannot make directory: ../".$id."/templates");
-		
+
 		// writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			print "Cannot open file ($filename)"; 
-			exit; 
-		} 
-
-		if (!fwrite($handle, $m)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
-		} 
-    
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $m)) {
+			print "Cannot write to file ($filename)";
+			exit;
+		}
+
 		fclose($handle);
-		
+
 		// writing admin conf
 		$admin_conf_filename = "../".$id."/lib/admin.conf.php";
 		if(!is_file($admin_conf_filename)) {
-			if (!$handle = fopen($admin_conf_filename, 'w')) { 
-				print "Cannot open file ($admin_conf_filename)"; 
-				exit; 
-			} 
-
-			if (!fwrite($handle, "<?php\r\n?>")) { 
-				print "Cannot write to file ($admin_conf_filename)"; 
-				exit; 
-			} 
-    
-			fclose($handle); 
+			if (!$handle = fopen($admin_conf_filename, 'w')) {
+				print "Cannot open file ($admin_conf_filename)";
+				exit;
+			}
+
+			if (!fwrite($handle, "<?php\r\n?>")) {
+				print "Cannot write to file ($admin_conf_filename)";
+				exit;
+			}
+
+			fclose($handle);
 		}
-		
+
 		// zu Liste springen
-    	header("Location: module_list.php");
-        exit;
-			
+		header("Location: module_list.php");
+		exit;
+
 	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar("error", "<b>Fehler:</b><br>".$error);
 		$app->tpl->setVar($_POST);
 	}
 }
 
 if($id != '') {
-// Datensatz besteht bereits
+	// Datensatz besteht bereits
 	// bestehenden Datensatz anzeigen
 	if($error == '') {
 		// es liegt ein Fehler vor
-		include_once("../".$id."/lib/module.conf.php");
+		include_once "../".$id."/lib/module.conf.php";
 		//$navi = $module["nav"];
 		unset($module["nav"]);
 		$record = $module;
@@ -135,7 +135,7 @@ if($id != '') {
 	}
 	$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-// neuer datensatz
+	// neuer datensatz
 	if($error == '') {
 		// es liegt ein Fehler vor
 		$record["template"] = "module.tpl.htm";
@@ -144,7 +144,7 @@ if($id != '') {
 		$record = $_POST;
 		//$navi = $_POST["nav"];
 		unset($_POST["nav"]);
-		
+
 	}
 	$record["readonly"] = '';
 }
@@ -172,7 +172,7 @@ $record["nav"] = $content;
 
 $app->tpl->setVar($record);
 
-include_once("lib/lang/".$_SESSION["s"]["language"]."_module_edit.lng");
+include_once "lib/lang/".$_SESSION["s"]["language"]."_module_edit.lng";
 $app->tpl->setVar($wb);
 
 // Defaultwerte setzen
@@ -181,4 +181,4 @@ $app->tpl_defaults();
 // Template parsen
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_list.php b/interface/web/designer/module_list.php
index 92aa4f0e8d79941ccfede22cb0cb57ec170de24e..b08707e14eef47cb7e7ea571c7de14deb75873ee 100644
--- a/interface/web/designer/module_list.php
+++ b/interface/web/designer/module_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -36,34 +36,34 @@ $app->auth->check_module_permissions('designer');
 $app->uses('tpl');
 
 $app->tpl->newTemplate('form.tpl.htm');
-$app->tpl->setInclude('content_tpl','templates/module_list.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_list.htm');
 
 //* Pick out modules
 $bgcolor = '#FFFFFF';
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
-				include_once(ISPC_WEB_PATH."/$file/lib/module.conf.php");
-				$modules_list[] = array( 	'module' =>   $module['name'],
-											'title' =>    $module['title'],
-											'bgcolor' =>  ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'
-                                        );
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login') {
+				include_once ISPC_WEB_PATH."/$file/lib/module.conf.php";
+				$modules_list[] = array(  'module' =>   $module['name'],
+					'title' =>    $module['title'],
+					'bgcolor' =>  ($bgcolor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'
+				);
 			}
-        }
+		}
 	}
 }
 
 $app->tpl->setLoop('records', $modules_list);
 
-//* loading language file 
+//* loading language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_module_list.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_del.php b/interface/web/designer/module_nav_del.php
index b0fd55a7be45f7a4044282a7cb0ddd30a46dc978..c5781d979bfa8781b8da5e745637ddffb18a4bbb 100644
--- a/interface/web/designer/module_nav_del.php
+++ b/interface/web/designer/module_nav_del.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
@@ -39,43 +39,43 @@ if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mo
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $nav_id)) die("nav_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	unset($module["nav"][$nav_id]);
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	header("Location: module_show.php?id=$module_name");
-    exit;
+	header("Location: module_show.php?id=$module_name");
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_edit.php b/interface/web/designer/module_nav_edit.php
index a7acf40c10e7a6a5b2c054a6cf77f43b3865f2b6..e7e63e149db15487abbd5da1cd93767d075b69f7 100644
--- a/interface/web/designer/module_nav_edit.php
+++ b/interface/web/designer/module_nav_edit.php
@@ -27,12 +27,12 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Security checkpoint
 if($_SESSION['s']['user']['typ'] != 'admin'){
-    die('Admin permissions required.');
+	die('Admin permissions required.');
 }
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
 
@@ -50,61 +50,61 @@ $nav_id = $_REQUEST['nav_id'];
 
 //** Sanity checks of module
 if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)){
-    die('module_name contains invalid chars.');
+	die('module_name contains invalid chars.');
 }
 if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $nav_id)){
-    die('nav_id contains invalid chars.');
+	die('nav_id contains invalid chars.');
 }
 if(empty($module_name)){
-    die('module is empty.');
+	die('module is empty.');
 }
 
 if(count($_POST) > 0) {
 	//* Determine Action
 	$action = ($nav_id != '') ? 'UPDATE' : 'INSERT';
 	$error = '';
-	
+
 	// TODO: Check variables
-	
+
 	if($error == '') {
-	
+
 		$filename = '../'.$module_name.'/lib/module.conf.php';
-		
+
 		if(!@is_file($filename)){
-            die("File not found: $filename");
-        }
-		include_once($filename);
-		
-        $items = ($action == 'UPDATE') ?  $module['nav'][$nav_id]['items'] : array();
-		
+			die("File not found: $filename");
+		}
+		include_once $filename;
+
+		$items = ($action == 'UPDATE') ?  $module['nav'][$nav_id]['items'] : array();
+
 		$tmp = array('title' => $_POST['nav']['title'],
-					 'open' =>  1,
-					 'items' => $items);
-        
+			'open' =>  1,
+			'items' => $items);
+
 		if($action == 'UPDATE') {
 			$module['nav'][$nav_id] = $tmp;
 		} else {
 			$module['nav'][] = $tmp;
 		}
-		
-		$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-				
+
+		$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 		//* writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			die("Cannot open file ($filename)"); 
-		} 
-
-		if (!fwrite($handle, $m)) { 
-			die("Cannot write to file ($filename)"); 
-		} 
-    
+		if (!$handle = fopen($filename, 'w')) {
+			die("Cannot open file ($filename)");
+		}
+
+		if (!fwrite($handle, $m)) {
+			die("Cannot write to file ($filename)");
+		}
+
 		fclose($handle);
-		
-		
+
+
 		//* Jump to list
-    	header('Location: module_show.php?id='.urlencode($module_name));
-        exit;
-			
+		header('Location: module_show.php?id='.urlencode($module_name));
+		exit;
+
 	} else {
 		$app->tpl->setVar('error', '<b>Fehler:</b><br>'.$error);
 		$app->tpl->setVar($_POST);
@@ -112,9 +112,9 @@ if(count($_POST) > 0) {
 }
 
 if($nav_id != '') {
-    //* Data record exists
+	//* Data record exists
 	if($error == '') {
-		include_once('../'.$module_name.'/lib/module.conf.php');
+		include_once '../'.$module_name.'/lib/module.conf.php';
 		$record = $module['nav'][$nav_id];
 	} else {
 		//* error
@@ -122,13 +122,13 @@ if($nav_id != '') {
 	}
 	//$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-    //* New data record
+	//* New data record
 	if($error == '') {
 		//* es liegt kein Fehler vor
 	} else {
 		//* error
 		$record = $_POST;
-		
+
 	}
 	//$record["readonly"] = '';
 }
@@ -138,10 +138,10 @@ $record['module_name'] = $module_name;
 
 $app->tpl->setVar($record);
 
-include_once('lib/lang/'.$_SESSION['s']['language'].'_module_nav_edit.lng');
+include_once 'lib/lang/'.$_SESSION['s']['language'].'_module_nav_edit.lng';
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_flip.php b/interface/web/designer/module_nav_flip.php
index 6599a5ff6b19e7b8b7a9c8eafbb389665f1404e7..09cdd17bfeabe12c62ab743dd00cc07d326bc435 100644
--- a/interface/web/designer/module_nav_flip.php
+++ b/interface/web/designer/module_nav_flip.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 
@@ -39,54 +39,54 @@ if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mo
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 $dir = $_REQUEST["dir"];
 
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $nav_id)) die("nav_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	if($dir == 'up' and $nav_id > 0) {
 		$tmp = $module["nav"][$nav_id - 1];
 		$module["nav"][$nav_id - 1] = $module["nav"][$nav_id];
 		$module["nav"][$nav_id] = $tmp;
 	}
-	
+
 	if($dir == 'down' and $nav_id < count($module["nav"]) -1) {
 		$tmp = $module["nav"][$nav_id + 1];
 		$module["nav"][$nav_id + 1] = $module["nav"][$nav_id];
 		$module["nav"][$nav_id] = $tmp;
 	}
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	echo "HEADER_REDIRECT:designer/module_show.php?id=$module_name";
-    exit;
+	echo "HEADER_REDIRECT:designer/module_show.php?id=$module_name";
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_item_del.php b/interface/web/designer/module_nav_item_del.php
index 6360c46edb00e7012786d44015e7177b9a84949e..66a17b589239016ca158997521d0f7732287b276 100644
--- a/interface/web/designer/module_nav_item_del.php
+++ b/interface/web/designer/module_nav_item_del.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,45 +39,45 @@ $app->auth->check_module_permissions('designer');
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 $item_id = $_REQUEST["item_id"];
 
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$nav_id)) die("nav_id contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$item_id)) die("item_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $item_id)) die("item_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	unset($module["nav"][$nav_id]["items"][$item_id]);
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	header("Location: module_show.php?id=$module_name");
-    exit;
+	header("Location: module_show.php?id=$module_name");
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_item_edit.php b/interface/web/designer/module_nav_item_edit.php
index 21e1e3594e885d4b5b4bc7ec2aa6c53e959ba848..2faff74fec78eae0edd993e676c19b060d15955e 100644
--- a/interface/web/designer/module_nav_item_edit.php
+++ b/interface/web/designer/module_nav_item_edit.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,16 +39,16 @@ $app->auth->check_module_permissions('designer');
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_item_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_item_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
 $nav_id = $_REQUEST["nav_id"];
 $item_id = $_REQUEST["item_id"];
 
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$nav_id)) die("nav_id contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$item_id)) die("item_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $item_id)) die("item_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
@@ -59,61 +59,61 @@ if(count($_POST) > 0) {
 	} else {
 		$action = 'INSERT';
 	}
-	
+
 	$error = '';
-	
+
 	// TODO: Check variables
 
-	
+
 	if($error == '') {
-	
+
 		$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 		if(!@is_file($filename)) die("File not found: $filename");
-		include_once($filename);
-		
+		include_once $filename;
+
 		$tmp = array('title' =>$_POST["title"],
-					 'target' => $_POST["target"],
-					 'link' => $_POST["link"]);
-		
+			'target' => $_POST["target"],
+			'link' => $_POST["link"]);
+
 		if($action == 'UPDATE') {
 			$module["nav"][$nav_id]["items"][$item_id] = $tmp;
 		} else {
 			$module["nav"][$nav_id]["items"][] = $tmp;
 		}
-		
-		$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-				
+
+		$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 		// writing module.conf
-		if (!$handle = fopen($filename, 'w')) { 
-			print "Cannot open file ($filename)"; 
-			exit; 
-		} 
-
-		if (!fwrite($handle, $m)) { 
-			print "Cannot write to file ($filename)"; 
-			exit; 
-		} 
-    
+		if (!$handle = fopen($filename, 'w')) {
+			print "Cannot open file ($filename)";
+			exit;
+		}
+
+		if (!fwrite($handle, $m)) {
+			print "Cannot write to file ($filename)";
+			exit;
+		}
+
 		fclose($handle);
-		
-		
+
+
 		// zu Liste springen
-    	header("Location: module_show.php?id=$module_name");
-        exit;
-			
+		header("Location: module_show.php?id=$module_name");
+		exit;
+
 	} else {
-		$app->tpl->setVar("error","<b>Fehler:</b><br>".$error);
+		$app->tpl->setVar("error", "<b>Fehler:</b><br>".$error);
 		$app->tpl->setVar($_POST);
 	}
 }
 
 if($item_id != '') {
-// Datensatz besteht bereits
+	// Datensatz besteht bereits
 	// bestehenden Datensatz anzeigen
 	if($error == '') {
 		// es liegt ein Fehler vor
-		include_once("../".$module_name."/lib/module.conf.php");
+		include_once "../".$module_name."/lib/module.conf.php";
 		$record = $module["nav"][$nav_id]["items"][$item_id];
 	} else {
 		// ein Fehler
@@ -121,14 +121,14 @@ if($item_id != '') {
 	}
 	//$record["readonly"] = 'style="background-color: #EEEEEE;" readonly';
 } else {
-// neuer datensatz
+	// neuer datensatz
 	if($error == '') {
 		// es liegt kein Fehler vor
 		$record["target"] = "content";
 	} else {
 		// ein Fehler
 		$record = $_POST;
-		
+
 	}
 	//$record["readonly"] = '';
 }
@@ -139,7 +139,7 @@ $record["module_name"] = $module_name;
 
 $app->tpl->setVar($record);
 
-include_once("lib/lang/".$_SESSION["s"]["language"]."_module_nav_item_edit.lng");
+include_once "lib/lang/".$_SESSION["s"]["language"]."_module_nav_item_edit.lng";
 $app->tpl->setVar($wb);
 
 // Defaultwerte setzen
@@ -148,4 +148,4 @@ $app->tpl_defaults();
 // Template parsen
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_nav_item_flip.php b/interface/web/designer/module_nav_item_flip.php
index 1aec179fff65b70c13bc02e9429c805f5248fac4..94f210b138915976a1e1b01b46e336caafbf8334 100644
--- a/interface/web/designer/module_nav_item_flip.php
+++ b/interface/web/designer/module_nav_item_flip.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
@@ -39,7 +39,7 @@ $app->auth->check_module_permissions('designer');
 // Lade Template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_nav_edit.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_nav_edit.htm');
 
 // ID importieren
 $module_name = $_REQUEST["module_name"];
@@ -47,48 +47,48 @@ $nav_id = $_REQUEST["nav_id"];
 $item_id = $_REQUEST["item_id"];
 $dir = $_REQUEST["dir"];
 
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$module_name)) die("module_name contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{1,50}$/',$nav_id)) die("nav_id contains invalid chars.");
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$item_id)) die("item_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $module_name)) die("module_name contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{1,50}$/', $nav_id)) die("nav_id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $item_id)) die("item_id contains invalid chars.");
 
 if(empty($module_name)) die("module is empty.");
 
 if($nav_id != '') {
 
 	$filename = "../".$module_name."/lib/module.conf.php";
-		
+
 	if(!@is_file($filename)) die("File not found: $filename");
-	include_once($filename);
-	
+	include_once $filename;
+
 	if($dir == 'up' and $item_id > 0) {
 		$tmp = $module["nav"][$nav_id]["items"][$item_id - 1];
 		$module["nav"][$nav_id]["items"][$item_id -1] = $module["nav"][$nav_id]["items"][$item_id];
 		$module["nav"][$nav_id]["items"][$item_id] = $tmp;
 	}
-	
+
 	if($dir == 'down' and $item_id < count($module["nav"][$nav_id]["items"]) -1) {
 		$tmp = $module["nav"][$nav_id]["items"][$item_id + 1];
 		$module["nav"][$nav_id]["items"][$item_id + 1] = $module["nav"][$nav_id]["items"][$item_id];
 		$module["nav"][$nav_id]["items"][$item_id] = $tmp;
 	}
-	
-	$m = "<?php\r\n".'$module = '.var_export($module,true)."\r\n?>";
-			
+
+	$m = "<?php\r\n".'$module = '.var_export($module, true)."\r\n?>";
+
 	// writing module.conf
-	if (!$handle = fopen($filename, 'w')) { 
-		print "Cannot open file ($filename)"; 
-		exit; 
-	} 
-	if (!fwrite($handle, $m)) { 
-		print "Cannot write to file ($filename)"; 
-		exit; 
-	} 
-   
+	if (!$handle = fopen($filename, 'w')) {
+		print "Cannot open file ($filename)";
+		exit;
+	}
+	if (!fwrite($handle, $m)) {
+		print "Cannot write to file ($filename)";
+		exit;
+	}
+
 	fclose($handle);
-	
-	
+
+
 	// zu Liste springen
-   	header("Location: module_show.php?id=$module_name");
-    exit;
+	header("Location: module_show.php?id=$module_name");
+	exit;
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/designer/module_show.php b/interface/web/designer/module_show.php
index 504d313d5b695a7a6ae51108ff45dbf3ffe186a9..f3e9812f9b7834935520fe31e1c4cf72e8082f38 100644
--- a/interface/web/designer/module_show.php
+++ b/interface/web/designer/module_show.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('designer');
@@ -38,20 +38,20 @@ if($_SESSION["s"]["user"]["typ"] != "admin") die("Admin permissions required.");
 $app->uses('tpl');
 
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/module_show.htm');
+$app->tpl->setInclude('content_tpl', 'templates/module_show.htm');
 
 
 $module_name = $_REQUEST["id"];
-if(!preg_match('/^[A-Za-z0-9_]{0,50}$/',$module_name)) die("id contains invalid chars.");
+if(!preg_match('/^[A-Za-z0-9_]{0,50}$/', $module_name)) die("id contains invalid chars.");
 
-include_once("../".$module_name."/lib/module.conf.php");
+include_once "../".$module_name."/lib/module.conf.php";
 $navi = $module["nav"];
 unset($module["nav"]);
 $record = $module;
 
-// loading language file 
+// loading language file
 $lng_file = "lib/lang/".$_SESSION["s"]["user"]["language"]."_module_show.lng";
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 // baue Modul navi
@@ -59,8 +59,8 @@ $content = "";
 $n1 = 0;
 $n2 = 0;
 if(is_array($navi)) {
-foreach($navi as $nav_id => $section) {
-	$content .= "<tr>
+	foreach($navi as $nav_id => $section) {
+		$content .= "<tr>
     <td colspan='2' class='frmText11'>
 	  <table width='100%'>
 	  	<tr>
@@ -73,12 +73,12 @@ foreach($navi as $nav_id => $section) {
 		  <input type=\"button\" name=\"bt5$n2\" value=\"$wb[down_txt]\" onclick=\"loadContent('designer/module_nav_flip.php?module_name=$module_name&nav_id=$nav_id&dir=down');\" class=\"button\" /><div class=\"buttonEnding\"></div>
 		  </td>
 		</tr>";
-	//$content .= "<tr><td bgcolor='#EEEEEE' class='frmText11'>Bereich:</td><td class='frmText11' bgcolor='#EEEEEE'><input name=\"module[nav][$n1][title]\" type=\"text\" class=\"text\" value=\"$section[title]\" size=\"30\" maxlength=\"255\"><input name=\"module[nav][$n1][open]\" type=\"hidden\" value=\"$section[open]\"></td></tr>\r\n";
-	foreach($section["items"] as $item_id => $item) {
-		//$content .= "<tr><td class='frmText11'>Titel:</td><td class='frmText11'><input name=\"module[nav][$n1][items][$n2][title]\" type=\"text\" class=\"text\" value=\"$item[title]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
-		//$content .= "<tr><td class='frmText11'>Ziel:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][target]\" type=\"text\" class=\"text\" value=\"$item[target]\" size=\"10\" maxlength=\"255\"></td></tr>\r\n";
-		//$content .= "<tr><td class='frmText11'>Link:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][link]\" type=\"text\" class=\"text\" value=\"$item[link]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
-		$content .= "<tr>
+		//$content .= "<tr><td bgcolor='#EEEEEE' class='frmText11'>Bereich:</td><td class='frmText11' bgcolor='#EEEEEE'><input name=\"module[nav][$n1][title]\" type=\"text\" class=\"text\" value=\"$section[title]\" size=\"30\" maxlength=\"255\"><input name=\"module[nav][$n1][open]\" type=\"hidden\" value=\"$section[open]\"></td></tr>\r\n";
+		foreach($section["items"] as $item_id => $item) {
+			//$content .= "<tr><td class='frmText11'>Titel:</td><td class='frmText11'><input name=\"module[nav][$n1][items][$n2][title]\" type=\"text\" class=\"text\" value=\"$item[title]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
+			//$content .= "<tr><td class='frmText11'>Ziel:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][target]\" type=\"text\" class=\"text\" value=\"$item[target]\" size=\"10\" maxlength=\"255\"></td></tr>\r\n";
+			//$content .= "<tr><td class='frmText11'>Link:</td><td class='frmText11'>&nbsp; &nbsp; &nbsp; &nbsp;<input name=\"module[nav][$n1][items][$n2][link]\" type=\"text\" class=\"text\" value=\"$item[link]\" size=\"30\" maxlength=\"255\"></td></tr>\r\n";
+			$content .= "<tr>
 		  <td class='frmText11'>$item[title]</td>
 		  <td class='frmText11' width='280' align='right'>
 		  <input type=\"button\" name=\"bt6$n2\" value=\"$wb[edit_txt]\" onclick=\"loadContent('designer/module_nav_item_edit.php?module_name=$module_name&nav_id=$nav_id&item_id=$item_id');\" class=\"button\" /><div class=\"buttonEnding\"></div>
@@ -87,14 +87,14 @@ foreach($navi as $nav_id => $section) {
 		  <input type=\"button\" name=\"bt9$n2\" value=\"$wb[down_txt]\" onclick=\"loadContent('designer/module_nav_item_flip.php?module_name=$module_name&nav_id=$nav_id&item_id=$item_id&dir=down');\" class=\"button\" /><div class=\"buttonEnding\"></div>
 		  </td>
 		</tr>";
-		$n2++;
-	}
-	$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
+			$n2++;
+		}
+		$content .= "<tr><td colspan='2' class='tblFooter'>&nbsp;</td></tr>
 	  </table>
 	</td>
   </tr>";
-	$n1++;
-}
+		$n1++;
+	}
 }
 
 $record["nav"] = $content;
@@ -103,11 +103,11 @@ $record["nav"] = $content;
 $app->tpl->setVar($record);
 
 
-$app->tpl->setLoop('records',$modules_list);
+$app->tpl->setLoop('records', $modules_list);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/ajax_get_json.php b/interface/web/dns/ajax_get_json.php
index 4ff46c23404f72ac657ca5f0605cf0b35abe616c..781fa8e8c1c9d99c8c17f7fa91a91676f45efac0 100644
--- a/interface/web/dns/ajax_get_json.php
+++ b/interface/web/dns/ajax_get_json.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -40,34 +40,34 @@ $type = $_GET["type"];
 
 //if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-	
-	if($type == 'get_ipv4'){
-		//$q = $app->db->quote(trim($_GET["q"]));
-		//$authsql = " AND ".$app->tform->getAuthSQL('r');
-		//$modules = explode(',', $_SESSION['s']['user']['modules']);
-		
-		$result = array();
-		
-		// ipv4
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv4');
-
-		$json = $app->functions->json_encode($result);
-	}
-	
-	if($type == 'get_ipv6'){
-		//$q = $app->db->quote(trim($_GET["q"]));
-		//$authsql = " AND ".$app->tform->getAuthSQL('r');
-		//$modules = explode(',', $_SESSION['s']['user']['modules']);
-		
-		$result = array();
-		
-		// ipv6
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv6');
-		
-		$json = $app->functions->json_encode($result);
-	}
+
+if($type == 'get_ipv4'){
+	//$q = $app->db->quote(trim($_GET["q"]));
+	//$authsql = " AND ".$app->tform->getAuthSQL('r');
+	//$modules = explode(',', $_SESSION['s']['user']['modules']);
+
+	$result = array();
+
+	// ipv4
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv4');
+
+	$json = $app->functions->json_encode($result);
+}
+
+if($type == 'get_ipv6'){
+	//$q = $app->db->quote(trim($_GET["q"]));
+	//$authsql = " AND ".$app->tform->getAuthSQL('r');
+	//$modules = explode(',', $_SESSION['s']['user']['modules']);
+
+	$result = array();
+
+	// ipv6
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv6');
+
+	$json = $app->functions->json_encode($result);
+}
 
 //}
 
@@ -81,13 +81,13 @@ function _search($module, $section, $additional_sql = '', $unique = false){
 		$desc_fields = array();
 		if(is_file('../'.$module.'/form/'.$section.'.tform.php')){
 			include_once('../'.$module.'/form/'.$section.'.tform.php');
-			
+
 			$category_title = $form["title"];
 			$form_file = $form["action"];
 			$db_table = $form["db_table"];
 			$db_table_idx = $form["db_table_idx"];
 			$order_by = $db_table_idx;
-			
+
 			if(is_array($form["tabs"]) && !empty($form["tabs"])){
 				foreach($form["tabs"] as $tab){
 					if(is_array($tab['fields']) && !empty($tab['fields'])){
@@ -108,7 +108,7 @@ function _search($module, $section, $additional_sql = '', $unique = false){
 			}
 		}
 		unset($form);
-		
+
 		$where_clause = '';
 		if(!empty($search_fields)){
 			$where_clause = implode(' OR ', $search_fields);
@@ -120,11 +120,11 @@ function _search($module, $section, $additional_sql = '', $unique = false){
 		if($additional_sql != '') $where_clause .= ' '.$additional_sql.' ';
 		$order_clause = '';
 		if($order_by != '') $order_clause = ' ORDER BY '.$order_by;
-		
+
 		$sql = "SELECT * FROM ".$db_table." WHERE ".$where_clause.$authsql.$order_clause." LIMIT 0,10";
 		$results = $app->db->queryAllRecords($sql);
-		
-		if(is_array($results) && !empty($results)){	
+
+		if(is_array($results) && !empty($results)){
 			$lng_file = '../'.$module.'/lib/lang/'.$_SESSION['s']['language'].'_'.$section.'.lng';
 			if(is_file($lng_file)) include($lng_file);
 			$result_array['cheader'] = array('title' => $category_title,
@@ -140,7 +140,7 @@ function _search($module, $section, $additional_sql = '', $unique = false){
 					}
 					if(!empty($desc_items)) $description = implode(' - ', $desc_items);
 				}
-				
+
 				$result_array['cdata'][] = array(	'title' => $wb[$title_key.'_txt'].': '.$result[$title_key],
 													'description' => $description,
 													'onclick' => '',
@@ -156,7 +156,7 @@ function _search($module, $section, $additional_sql = '', $unique = false){
 	return $result_array;
 }
 */
-		
+
 header('Content-type: application/json');
 echo $json;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_a_edit.php b/interface/web/dns/dns_a_edit.php
index 1f94633ffc15e4e5e8acc5ae435a4f6fbb12c60c..99d0d992593a6c8d14c372e54163d6d0f21cf644 100644
--- a/interface/web/dns/dns_a_edit.php
+++ b/interface/web/dns/dns_a_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_a.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,27 +95,27 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
+
 		//* Check for duplicates where IP and hostname are the same
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and data = '".$this->dataRecord["data"]."' and id != ".$this->id.") OR (type = 'CNAME' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.")");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
 		unset($tmp);
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -125,17 +125,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_a_list.php b/interface/web/dns/dns_a_list.php
index afe76b6cd5b09ee2ac58c47ffffd757b8d3e4334..d525585f08e274d001c9b14ef424a52170c87401 100644
--- a/interface/web/dns/dns_a_list.php
+++ b/interface/web/dns/dns_a_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->listform_actions->SQLExtWhere = "dns_rr.type = 'A'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_aaaa_edit.php b/interface/web/dns/dns_aaaa_edit.php
index ccd6fe8ad2d97f16e8415867df320ebbe15d750a..02aea58cd8ccf94aa1ae9fae4574ebf1130e8140 100644
--- a/interface/web/dns/dns_aaaa_edit.php
+++ b/interface/web/dns/dns_aaaa_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_aaaa.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,17 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_alias_edit.php b/interface/web/dns/dns_alias_edit.php
index 86a6dcd07de0a2852a8acbbaa4ae8b8c3123d05b..dc370a6420d527104783b35b0a6a52a1d6764a14 100644
--- a/interface/web/dns/dns_alias_edit.php
+++ b/interface/web/dns/dns_alias_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_alias.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_cname_edit.php b/interface/web/dns/dns_cname_edit.php
index 75ec7c45be83ab9da7d02a639a6bdf205bdeab60..5d9d19bfb625f00346c2db9b5e7bf4a6db314e01 100644
--- a/interface/web/dns/dns_cname_edit.php
+++ b/interface/web/dns/dns_cname_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_cname.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,27 +95,27 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
+
 		//* Check for duplicates where IP and hostname are the same
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.") OR (type = 'CNAME' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.")");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
 		unset($tmp);
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -125,16 +125,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_dkim_edit.php b/interface/web/dns/dns_dkim_edit.php
index 2395bb01d9d499191273913b16a908ad01cef7b0..46c5a1390a679c0f2301d9b3f2b72821001afe77 100644
--- a/interface/web/dns/dns_dkim_edit.php
+++ b/interface/web/dns/dns_dkim_edit.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/dns_dkim.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -50,16 +50,16 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another record.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -78,7 +78,7 @@ class page_action extends tform_actions {
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -92,10 +92,10 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// add dkim-settings to the public-key in the txt-record
 		$this->dataRecord['data']='v=DKIM1; t=s; p='.$this->dataRecord['data'];
 		$this->dataRecord['name']='default._domainkey.'.$this->dataRecord['name'];
@@ -104,17 +104,17 @@ class page_action extends tform_actions {
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		// check for duplicate entry
 		$check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ".$this->dataRecord["zone"]." AND type = '".$this->dataRecord["type"]."' AND data ='".$this->dataRecord["data"]."' AND name = '".$this->dataRecord['name']."'");
 		if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"];
 
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -124,16 +124,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_dkim_get.php b/interface/web/dns/dns_dkim_get.php
index da917b96b32ff900fc0dbc85fcb639a0aaae9947..6c58d4078f0b25f4f5a9824e51e533ed7aeaa9ab 100644
--- a/interface/web/dns/dns_dkim_get.php
+++ b/interface/web/dns/dns_dkim_get.php
@@ -1,42 +1,42 @@
 <?php
 /**
-Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
-Copyright (c) 2013, Florian Schaal, info@schaal-24.de
-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.
-*/
+ Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
+ Copyright (c) 2013, Florian Schaal, info@schaal-24.de
+ 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.
+ */
 
-/**
-* This script is invoked by interface/web/dns/templates/dns_dkim_edit.htm
-* when generating the DKIM Private-key.
-*
-* return DKIM Public-Key for the DNS-record
-*/ 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+/**
+ * This script is invoked by interface/web/dns/templates/dns_dkim_edit.htm
+ * when generating the DKIM Private-key.
+ *
+ * return DKIM Public-Key for the DNS-record
+ */
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,33 +49,34 @@ $app->uses('tform,tform_actions');
 header('Content-Type: text/xml; charset=utf-8');
 header('Cache-Control: must-revalidate, pre-check=0, no-store, no-cache, max-age=0, post-check=0');
 
-/**
-* This function fix PHP's messing up POST input containing characters space, dot,
-* open square bracket and others to be compatible with with the deprecated register_globals
-* @return array POST
-*/
 
+/**
+ * This function fix PHP's messing up POST input containing characters space, dot,
+ * open square bracket and others to be compatible with with the deprecated register_globals
+ * @return array POST
+ */
 function getRealPOST() {
-    $pairs = explode("&", file_get_contents("php://input"));
-    $vars = array();
-    foreach ($pairs as $pair) {
-        $nv = explode("=", $pair, 2);
-        $name = urldecode($nv[0]);
-        $value = $nv[1];
-        $vars[$name] = $value;
-    }
-    return $vars;
+	$pairs = explode("&", file_get_contents("php://input"));
+	$vars = array();
+	foreach ($pairs as $pair) {
+		$nv = explode("=", $pair, 2);
+		$name = urldecode($nv[0]);
+		$value = $nv[1];
+		$vars[$name] = $value;
+	}
+	return $vars;
 }
 
+
 /**
-* This function formats the public-key
-* @param array $pubkey
-* @return string public-key
-*/
+ * This function formats the public-key
+ * @param array $pubkey
+ * @return string public-key
+ */
 function pub_key($pubkey) {
-        $public_key='';
-        foreach($pubkey as $values) $public_key=$public_key.$values;
-        return $public_key;
+	$public_key='';
+	foreach($pubkey as $values) $public_key=$public_key.$values;
+	return $public_key;
 }
 
 $_POST=getRealPost();
@@ -84,11 +85,11 @@ if (ctype_digit($_POST['zone'])) {
 	// Get the parent soa record of the domain
 	$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->db->quote($_POST['zone'])."' AND ".$app->tform->getAuthSQL('r'));
 
-	$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".substr_replace($soa['origin'],'',-1)."' AND ".$app->tform->getAuthSQL('r'));		
+	$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".substr_replace($soa['origin'], '', -1)."' AND ".$app->tform->getAuthSQL('r'));
 
 	$public_key=pub_key($public_key);
 
-	$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$public_key);
+	$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----', '-----END PUBLIC KEY-----', "\r", "\n"), '', $public_key);
 
 	echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
 	echo "<formatname>\n";
diff --git a/interface/web/dns/dns_hinfo_edit.php b/interface/web/dns/dns_hinfo_edit.php
index 910ebeaba70e37ebdee09b1ced14aefef44dbe01..0c3f0045c961ff7dc00a9788a74ce70afc61e50a 100644
--- a/interface/web/dns/dns_hinfo_edit.php
+++ b/interface/web/dns/dns_hinfo_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_hinfo.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_import.php b/interface/web/dns/dns_import.php
index 255d290639ef1b28359690897a5959e64b9afa66..b015453ff634f5957c868596b543527939e677b6 100644
--- a/interface/web/dns/dns_import.php
+++ b/interface/web/dns/dns_import.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -40,7 +40,7 @@ $error = '';
 // Loading the template
 $app->uses('tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/dns_import.htm');
+$app->tpl->setInclude('content_tpl', 'templates/dns_import.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
 // import variables
@@ -69,11 +69,11 @@ foreach($records as $rec){
 	$n++;
 }
 unset($n);
-$app->tpl->setVar("template_id_option",$template_id_option);
+$app->tpl->setVar("template_id_option", $template_id_option);
 
 // If the user is administrator
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	
+
 	// Load the list of servers
 	$records = $app->db->queryAllRecords("SELECT server_id, server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 ORDER BY server_name");
 	$server_id_option = '';
@@ -81,8 +81,8 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		$checked = ($rec['server_id'] == $server_id)?' SELECTED':'';
 		$server_id_option .= '<option value="'.$rec['server_id'].'"'.$checked.'>'.$rec['server_name'].'</option>';
 	}
-	$app->tpl->setVar("server_id",$server_id_option);
-	
+	$app->tpl->setVar("server_id", $server_id_option);
+
 	// load the list of clients
 	$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);
@@ -95,16 +95,16 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-	
+
 	// 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(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(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);
@@ -117,37 +117,37 @@ if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSIO
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dns_import.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 // Import the zone-file
 //if(1=="1")
 if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'])){
 	$valid_zone_file = FALSE;
-	
+
 	$sql = "SELECT server_name FROM `server` WHERE server_id=".$app->functions->intval($server_id)." OR mirror_server_id=".$app->functions->intval($server_id)." ORDER BY server_name ASC";
 	$servers = $app->db->queryAllRecords($sql);
 	for ($i=0;$i<count($servers);$i++)
 	{
-		if (substr($servers[$i]['server_name'],strlen($servers[$i]['server_name'])-1) != ".")
+		if (substr($servers[$i]['server_name'], strlen($servers[$i]['server_name'])-1) != ".")
 		{
 			$servers[$i]['server_name'] .= ".";
 		}
 	}
 	$lines = file($_FILES['file']['tmp_name']);
-	
+
 	// Remove empty lines, comments, whitespace, tabs, etc.
 	$new_lines = array();
 	foreach($lines as $line){
 		$line = trim($line);
-		if ($line != '' && substr($line,0,1) != ';'){
-			if(strpos($line,";") !== FALSE) $line = substr($line,0,strpos($line,";"));
-			if(strpos($line,"(") !== FALSE) $line = substr($line,0,strpos($line,"("));
-			if(strpos($line,")") !== FALSE) $line = substr($line,0,strpos($line,")"));
+		if ($line != '' && substr($line, 0, 1) != ';'){
+			if(strpos($line, ";") !== FALSE) $line = substr($line, 0, strpos($line, ";"));
+			if(strpos($line, "(") !== FALSE) $line = substr($line, 0, strpos($line, "("));
+			if(strpos($line, ")") !== FALSE) $line = substr($line, 0, strpos($line, ")"));
 			$line = trim($line);
 			if ($line != ''){
 				$sPattern = '/\s+/m';
@@ -159,19 +159,19 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 	unset($lines);
 	$lines = $new_lines;
 	unset($new_lines);
-	
+
 	//$lines = file("apriqot.se.txt");
-	$name = str_replace("txt","",$_FILES['file']['name']);
-	$name = str_replace("zone","",$name);
+	$name = str_replace("txt", "", $_FILES['file']['name']);
+	$name = str_replace("zone", "", $name);
 
 	if ($domain !== NULL){
 		$name = $domain;
 	}
-	
-	if (substr($name,-1) != "."){
+
+	if (substr($name, -1) != "."){
 		$name .= ".";
 	}
-	
+
 	$i = 0;
 	$origin_exists = FALSE;
 	$soa_array_key = -1;
@@ -180,9 +180,9 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 	$r = 0;
 	$dns_rr = array();
 	foreach($lines as $line){
-	
+
 		$parts = explode(' ', $line);
-		
+
 		// make all elements lowercase
 		$new_parts = array();
 		foreach($parts as $part){
@@ -191,7 +191,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 		unset($parts);
 		$parts = $new_parts;
 		unset($new_parts);
-		
+
 		// if ORIGIN exists, overwrite $soa['name']
 		if($parts[0] == '$origin'){
 			$soa['name'] = $parts[1];
@@ -199,25 +199,25 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 		}
 		// TTL
 		if($parts[0] == '$ttl'){
-			$time_format = strtolower(substr($parts[1],-1));
+			$time_format = strtolower(substr($parts[1], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1));
-					break;
-				case 'm':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 604800;
-					break;
-				default:
-					$soa['ttl'] = $app->functions->intval($parts[1]);
+			case 's':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1));
+				break;
+			case 'm':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['ttl'] = $app->functions->intval(substr($parts[1], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['ttl'] = $app->functions->intval($parts[1]);
 			}
 			unset($time_format);
 		}
@@ -237,103 +237,103 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 		if($i == ($soa_array_key + 1)) $soa['serial'] = $app->functions->intval($parts[0]);
 		// REFRESH
 		if($i == ($soa_array_key + 2)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['refresh'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['refresh'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['refresh'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// RETRY
 		if($i == ($soa_array_key + 3)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['retry'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['retry'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['retry'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// EXPIRE
 		if($i == ($soa_array_key + 4)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['expire'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['expire'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['expire'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// MINIMUM
 		if($i == ($soa_array_key + 5)){
-			$time_format = strtolower(substr($parts[0],-1));
+			$time_format = strtolower(substr($parts[0], -1));
 			switch ($time_format) {
-				case 's':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1));
-					break;
-				case 'm':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 60;
-					break;
-				case 'h':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600;
-					break;
-				case 'd':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400;
-					break;
-				case 'w':
-					$soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800;
-					break;
-				default:
-					$soa['minimum'] = $app->functions->intval($parts[0]);
+			case 's':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1));
+				break;
+			case 'm':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 60;
+				break;
+			case 'h':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 3600;
+				break;
+			case 'd':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 86400;
+				break;
+			case 'w':
+				$soa['minimum'] = $app->functions->intval(substr($parts[0], 0, -1)) * 604800;
+				break;
+			default:
+				$soa['minimum'] = $app->functions->intval($parts[0]);
 			}
 			unset($time_format);
 		}
 		// RESOURCE RECORDS
 		if($i > ($soa_array_key + 5)){
-			if(substr($parts[0],-1) == '.' || $parts[0] == '@' || ($parts[0] != 'a' && $parts[0] != 'aaaa' && $parts[0] != 'ns' && $parts[0] != 'cname' && $parts[0] != 'hinfo' && $parts[0] != 'mx' && $parts[0] != 'naptr' && $parts[0] != 'ptr' && $parts[0] != 'rp' && $parts[0] != 'srv' && $parts[0] != 'txt')){
+			if(substr($parts[0], -1) == '.' || $parts[0] == '@' || ($parts[0] != 'a' && $parts[0] != 'aaaa' && $parts[0] != 'ns' && $parts[0] != 'cname' && $parts[0] != 'hinfo' && $parts[0] != 'mx' && $parts[0] != 'naptr' && $parts[0] != 'ptr' && $parts[0] != 'rp' && $parts[0] != 'srv' && $parts[0] != 'txt')){
 				if(is_numeric($parts[1])){
 					if($parts[2] == 'in'){
 						$resource_type = $parts[3];
@@ -363,20 +363,20 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 					$dns_rr[$r]['ttl'] = $soa['ttl'];
 				}
 				switch ($resource_type) {
-					case 'mx':
-					case 'srv':
-						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-						$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-						break;
-					case 'txt':
-						$dns_rr[$r]['aux'] = 0;
-						$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-						if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-						if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-						break;
-					default:
-						$dns_rr[$r]['aux'] = 0;
-						$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+				case 'mx':
+				case 'srv':
+					$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+					$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+					break;
+				case 'txt':
+					$dns_rr[$r]['aux'] = 0;
+					$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+					if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+					if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+					break;
+				default:
+					$dns_rr[$r]['aux'] = 0;
+					$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 				}
 			} else {
 				// a 3600 IN A 1.2.3.4
@@ -387,22 +387,22 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 					$dns_rr[$r]['name'] = $parts[0];
 					$dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]);
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
-				} 
+				}
 				// a IN A 1.2.3.4
 				elseif($parts[1] == 'in' && ($parts[2] == 'a' || $parts[2] == 'aaaa' || $parts[2] == 'ns'|| $parts[2] == 'cname' || $parts[2] == 'hinfo' || $parts[2] == 'mx' || $parts[2] == 'naptr' || $parts[2] == 'ptr' || $parts[2] == 'rp' || $parts[2] == 'srv' || $parts[2] == 'txt')){
 					$resource_type = $parts[2];
@@ -411,22 +411,22 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 					$dns_rr[$r]['name'] = $parts[0];
 					$dns_rr[$r]['ttl'] = $soa['ttl'];
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
-				} 
+				}
 				// a 3600 A 1.2.3.4
 				elseif(is_numeric($parts[1]) && ($parts[2] == 'a' || $parts[2] == 'aaaa' || $parts[2] == 'ns'|| $parts[2] == 'cname' || $parts[2] == 'hinfo' || $parts[2] == 'mx' || $parts[2] == 'naptr' || $parts[2] == 'ptr' || $parts[2] == 'rp' || $parts[2] == 'srv' || $parts[2] == 'txt')){
 					$resource_type = $parts[2];
@@ -435,22 +435,22 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 					$dns_rr[$r]['name'] = $parts[0];
 					$dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]);
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
-				} 
+				}
 				// A 1.2.3.4
 				// MX 10 mail
 				// TXT "v=spf1 a mx ptr -all"
@@ -461,20 +461,20 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 					$dns_rr[$r]['name'] = $soa['name'];
 					$dns_rr[$r]['ttl'] = $soa['ttl'];
 					switch ($resource_type) {
-						case 'mx':
-						case 'srv':
-							$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2));
-							break;
-						case 'txt':
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
-							if(substr($dns_rr[$r]['data'],0,1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],1);
-							if(substr($dns_rr[$r]['data'],-1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'],0,-1);
-							break;
-						default:
-							$dns_rr[$r]['aux'] = 0;
-							$dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+1));
+					case 'mx':
+					case 'srv':
+						$dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]);
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+2));
+						break;
+					case 'txt':
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
+						if(substr($dns_rr[$r]['data'], 0, 1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 1);
+						if(substr($dns_rr[$r]['data'], -1) == '"') $dns_rr[$r]['data'] = substr($dns_rr[$r]['data'], 0, -1);
+						break;
+					default:
+						$dns_rr[$r]['aux'] = 0;
+						$dns_rr[$r]['data'] = implode(' ', array_slice($parts, $pkey+1));
 					}
 				}
 			}
@@ -486,7 +486,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 		}
 		$i++;
 	}
-	
+
 	/*
 	$i = 0;
 	$r = 0;
@@ -586,7 +586,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 							if (!empty($mx[$r][$m]))
 								$dns_rr[$r]['data'] = $mx[$r][$m];
 						}
-						
+
 						$dns_rr[$r]['aux'] = $mx[$r][0];
 					}
 					else if (strtolower($dns_rr[$r]['type'])=='txt')
@@ -618,11 +618,11 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 		$dns_rr[$r]['aux'] = 0;
 		$r++;
 	}
-					//print('<pre>');
-					//print_r($dns_rr);
-					//print('</pre>');
-					
-					
+	//print('<pre>');
+	//print_r($dns_rr);
+	//print('</pre>');
+
+
 	// Insert the soa record
 	$sys_userid = $_SESSION['s']['user']['userid'];
 	$origin = $app->db->quote($soa['name']);
@@ -641,7 +641,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES
 		('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer')";
 		$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
-	
+
 		// Insert the dns_rr records
 		if(is_array($dns_rr) && $dns_soa_id > 0)
 		{
@@ -664,11 +664,11 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'
 }
 
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_mx_edit.php b/interface/web/dns/dns_mx_edit.php
index 8ce9b872b53bffa61a052cec3ffff4ee0b7128b6..a839f70ffd493cf952784739018448e877b45b71 100644
--- a/interface/web/dns/dns_mx_edit.php
+++ b/interface/web/dns/dns_mx_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_mx.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,44 +95,44 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onInsert() {
 		global $app, $conf;
-		
+
 		// Check if record is existing already
 		$duplicate_mx = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($this->dataRecord["zone"])." AND name = '".$this->dataRecord["name"]."' AND type = '".$this->dataRecord["type"]."' AND data = '".$this->dataRecord["data"]."' AND ".$app->tform->getAuthSQL('r'));
-		
+
 		if(is_array($duplicate_mx) && !empty($duplicate_mx)) $app->error($app->tform->wordbook["duplicate_mx_record_txt"]);
-		
+
 		parent::onInsert();
 	}
-	
+
 	function onUpdate() {
 		global $app, $conf;
-		
+
 		// Check if record is existing already
 		$duplicate_mx = $app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($this->dataRecord["zone"])." AND name = '".$this->dataRecord["name"]."' AND type = '".$this->dataRecord["type"]."' AND data = '".$this->dataRecord["data"]."' AND id != ".$app->functions->intval($this->dataRecord["id"])." AND ".$app->tform->getAuthSQL('r'));
-		
+
 		if(is_array($duplicate_mx) && !empty($duplicate_mx)) $app->error($app->tform->wordbook["duplicate_mx_record_txt"]);
-		
+
 		parent::onUpdate();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -142,16 +142,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_ns_edit.php b/interface/web/dns/dns_ns_edit.php
index 059c0e0505bb3d6a450230cdf444adcf033cdf3d..31df6ef339bcb9d83a9ec42520617d6cc1a6a554 100644
--- a/interface/web/dns/dns_ns_edit.php
+++ b/interface/web/dns/dns_ns_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_ns.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_ptr_edit.php b/interface/web/dns/dns_ptr_edit.php
index 8dc790e997a59f256db2d133e4d0bdcb1c842afd..323d76c4cba9aff92ec10aba4135f3db5d66505a 100644
--- a/interface/web/dns/dns_ptr_edit.php
+++ b/interface/web/dns/dns_ptr_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_ptr.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_rp_edit.php b/interface/web/dns/dns_rp_edit.php
index 0e4eb0b6c52807704cfe1464dd6cecf8d99e3491..a4f81a046dec6290486cf07e987c295f7d458557 100644
--- a/interface/web/dns/dns_rp_edit.php
+++ b/interface/web/dns/dns_rp_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_rp.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_rr_del.php b/interface/web/dns/dns_rr_del.php
index 46356e18d7ba6450ef148623acbe0a196037f24a..a20c9c07d3c637d711106846b08cf6cdf226bef4 100644
--- a/interface/web/dns/dns_rr_del.php
+++ b/interface/web/dns/dns_rr_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/dns_a.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -52,16 +52,17 @@ class page_action extends tform_actions {
 
 	function onAfterDelete() {
 		global $app; $conf;
-				
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($this->dataRecord["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_slave_del.php b/interface/web/dns/dns_slave_del.php
index a2bba0022ada75f58e84c3b92dae2ab532416b14..d3ca18fbc1ed3f700a5459aaae0433a164b587b4 100644
--- a/interface/web/dns/dns_slave_del.php
+++ b/interface/web/dns/dns_slave_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/dns_slave.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -52,18 +52,19 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		// Delete all records that belog to this zone.
 		$records = $app->db->queryAllRecords("SELECT id FROM dns_slave WHERE zone = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('dns_slave','id',$rec['id']);
+			$app->db->datalogDelete('dns_slave', 'id', $rec['id']);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_slave_edit.php b/interface/web/dns/dns_slave_edit.php
index 46e251a3beb55ec4d1b1f09c713c6e120a653f64..a9688044fa6ab4f596bd8069be0293f8d98a7c90 100644
--- a/interface/web/dns/dns_slave_edit.php
+++ b/interface/web/dns/dns_slave_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_slave.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,10 +49,10 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_dns_slave_zone')) {
@@ -62,13 +62,13 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_dns_slave_zone_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// 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
@@ -83,29 +83,29 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-		$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 		} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-		
-			// 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(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(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['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[contactname]</option>\r\n";
+
+				// 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(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(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['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[contactname]</option>\r\n";
+					}
 				}
+				$app->tpl->setVar("client_group_id", $client_select);
+
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-		
-		}
-		
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -113,29 +113,29 @@ class page_action extends tform_actions {
 		} else {
 			$app->tpl->setVar("edit_disabled", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		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_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) {
 				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_slave WHERE id = ".$app->functions->intval($this->id));
 				$this->dataRecord["server_id"] = $tmp["server_id"];
 				unset($tmp);
-			// When the record is inserted
+				// When the record is inserted
 			} else {
 				// set the server ID to the default dnsserver of the client
 				$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')) {
 					$app->error($app->tform->wordbook["limit_dns_slave_zone_txt"]);
@@ -145,33 +145,33 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		//* Check if the zone name has a dot at the end
-		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"],-1,1) != '.') $this->dataRecord["origin"] .= '.';
-	
-		//* Check if a primary zone with the same name already exists 	
+		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"], -1, 1) != '.') $this->dataRecord["origin"] .= '.';
+
+		//* Check if a primary zone with the same name already exists
 		$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE origin = \"".$this->dataRecord["origin"]."\" AND server_id= \"".$this->dataRecord["server_id"]."\"");
 		if($tmp["number"] > 0) {
-  			$app->error($app->tform->wordbook["origin_error_unique"]);
+			$app->error($app->tform->wordbook["origin_error_unique"]);
 		}
 
 		parent::onSubmit();
 	}
-	
+
 	function onInsert() {
 		global $app, $conf;
-		
+
 		// Check if record is existing already
 		$duplicate_slave = $app->db->queryOneRecord("SELECT * FROM dns_slave WHERE origin = '".$this->dataRecord["origin"]."' AND server_id = ".$app->functions->intval($this->dataRecord["server_id"])." AND ".$app->tform->getAuthSQL('r'));
-		
+
 		if(is_array($duplicate_slave) && !empty($duplicate_slave)) $app->error($app->tform->wordbook["origin_error_unique"]);
-		
+
 		parent::onInsert();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -183,11 +183,11 @@ class page_action extends tform_actions {
 		}
 
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		$tmp = $app->db->diffrec($this->oldDataRecord,$app->tform->getDataRecord($this->id));
+
+		$tmp = $app->db->diffrec($this->oldDataRecord, $app->tform->getDataRecord($this->id));
 
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -198,7 +198,7 @@ class page_action extends tform_actions {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
 			$app->db->query("UPDATE dns_slave SET sys_groupid = $client_group_id WHERE id = ".$this->id);
 		}
-		
+
 		//** When the client group has changed, change also the owner of the record if the owner is not the admin user
 		if($this->oldDataRecord["client_group_id"] != $this->dataRecord["client_group_id"] && $this->dataRecord["sys_userid"] != 1) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -207,9 +207,9 @@ class page_action extends tform_actions {
 				$app->db->query("UPDATE dns_slave SET sys_userid = ".$tmp["userid"]." WHERE id = ".$this->id);
 			}
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_slave_list.php b/interface/web/dns/dns_slave_list.php
index fe78ca205a94d6d5a0dc06bca0eacefd738b4d66..b277a86bf02e4844b98ca84f32ba4e39b1669ec4 100644
--- a/interface/web/dns/dns_slave_list.php
+++ b/interface/web/dns/dns_slave_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -22,4 +22,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY dns_slave.origin';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_soa_del.php b/interface/web/dns/dns_soa_del.php
index 82d680b0cde66c35e019523619a42d5bca07ab8e..f9a06fcfbd4535ac8f7c3d380c4de8ae58a318f7 100644
--- a/interface/web/dns/dns_soa_del.php
+++ b/interface/web/dns/dns_soa_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/dns_soa.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -52,18 +52,19 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		// Delete all records that belog to this zone.
 		$records = $app->db->queryAllRecords("SELECT id FROM dns_rr WHERE zone = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('dns_rr','id',$rec['id']);
+			$app->db->datalogDelete('dns_rr', 'id', $rec['id']);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php
index 9f524e89636b6c325bb3947633afe289b3f39ffb..94ce065fa86d3b15564e6cd233e0887dba426817 100644
--- a/interface/web/dns/dns_soa_edit.php
+++ b/interface/web/dns/dns_soa_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_soa.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,7 +49,7 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
 		global $app;
 		//* Reset the page number of the list form for the dns
@@ -59,10 +59,10 @@ class page_action extends tform_actions {
 		}
 		parent::onShow();
 	}
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_dns_zone')) {
@@ -72,13 +72,13 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_dns_zone_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// 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
@@ -93,29 +93,29 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-		$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 		} else if($app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-		
-			// 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(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(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['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[contactname]</option>\r\n";
+
+				// 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(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(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['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[contactname]</option>\r\n";
+					}
 				}
+				$app->tpl->setVar("client_group_id", $client_select);
+
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-		
-		}
-		
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -123,29 +123,29 @@ class page_action extends tform_actions {
 		} else {
 			$app->tpl->setVar("edit_disabled", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		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_zone, default_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) {
 				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".$app->functions->intval($this->id));
 				$this->dataRecord["server_id"] = $tmp["server_id"];
 				unset($tmp);
-			// When the record is inserted
+				// When the record is inserted
 			} else {
 				// set the server ID to the default dnsserver of the client
 				$this->dataRecord["server_id"] = $client["default_dnsserver"];
-				
+
 				// Check if the user may add another maildomain.
 				if($client["limit_dns_zone"] >= 0) {
 					$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_soa WHERE sys_groupid = $client_group_id");
@@ -155,39 +155,39 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		/*
 		// Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		*/
-		
-		
+
+
 		//* Check if soa, ns and mbox have a dot at the end
-		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"],-1,1) != '.') $this->dataRecord["origin"] .= '.';
-		if(strlen($this->dataRecord["ns"]) > 0 && substr($this->dataRecord["ns"],-1,1) != '.') $this->dataRecord["ns"] .= '.';
-		if(strlen($this->dataRecord["mbox"]) > 0 && substr($this->dataRecord["mbox"],-1,1) != '.') $this->dataRecord["mbox"] .= '.';
-		
+		if(strlen($this->dataRecord["origin"]) > 0 && substr($this->dataRecord["origin"], -1, 1) != '.') $this->dataRecord["origin"] .= '.';
+		if(strlen($this->dataRecord["ns"]) > 0 && substr($this->dataRecord["ns"], -1, 1) != '.') $this->dataRecord["ns"] .= '.';
+		if(strlen($this->dataRecord["mbox"]) > 0 && substr($this->dataRecord["mbox"], -1, 1) != '.') $this->dataRecord["mbox"] .= '.';
+
 		//* Replace @ in mbox
-		if(stristr($this->dataRecord["mbox"],'@')) {
-			$this->dataRecord["mbox"] = str_replace('@','.',$this->dataRecord["mbox"]);
+		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 	
+		//* 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"]."\"");
 		if($tmp["number"] > 0) {
-  			$app->error($app->tform->wordbook["origin_error_unique"]);
-		}		
+			$app->error($app->tform->wordbook["origin_error_unique"]);
+		}
 
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -203,7 +203,7 @@ class page_action extends tform_actions {
 		}
 
 	}
-	
+
 	function onBeforeUpdate () {
 		global $app, $conf;
 
@@ -212,7 +212,7 @@ class page_action extends tform_actions {
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT origin from dns_soa WHERE id = ".$this->id);
-			if(isset($this->dataRecord["origin"]) && $rec['origin'] != $this->dataRecord["origin"] && $app->tform->checkPerm($this->id,'u')) {
+			if(isset($this->dataRecord["origin"]) && $rec['origin'] != $this->dataRecord["origin"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Zone (soa) can not be changed. Please ask your Administrator if you want to change the Zone name.');
 				$this->dataRecord["origin"] = $rec['origin'];
@@ -220,17 +220,17 @@ class page_action extends tform_actions {
 			unset($rec);
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		$tmp = $app->db->diffrec($this->oldDataRecord,$app->tform->getDataRecord($this->id));
+
+		$tmp = $app->db->diffrec($this->oldDataRecord, $app->tform->getDataRecord($this->id));
 		if($tmp['diff_num'] > 0) {
 			// Update the serial number of the SOA record
 			$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = ".$this->id);
 			$app->db->query("UPDATE dns_soa SET serial = '".$app->validate_dns->increase_serial($soa["serial"])."' WHERE id = ".$this->id);
 		}
-		
+
 		// make sure that the record belongs to the client group and not the admin group when a dmin inserts it
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -244,7 +244,7 @@ class page_action extends tform_actions {
 			// And we want to update all rr records too, that belong to this record
 			$app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id);
 		}
-		
+
 		//** When the client group has changed, change also the owner of the record if the owner is not the admin user
 		if($this->oldDataRecord["client_group_id"] != $this->dataRecord["client_group_id"] && $this->dataRecord["sys_userid"] != 1) {
 			$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
@@ -254,9 +254,9 @@ class page_action extends tform_actions {
 				$app->db->query("UPDATE dns_rr SET sys_userid = ".$tmp["userid"]." WHERE zone = ".$this->id);
 			}
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_soa_list.php b/interface/web/dns/dns_soa_list.php
index 27604fb541d806bd92515a08855bd122f695427d..da02729ff370dbe1c816ad008324486b08520da0 100644
--- a/interface/web/dns/dns_soa_list.php
+++ b/interface/web/dns/dns_soa_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -22,4 +22,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY dns_soa.origin';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_srv_edit.php b/interface/web/dns/dns_srv_edit.php
index e41b5542b9a0f2f4ca865b97d3ad875074cedd77..a382e617848b654a91d144b5e66e81ac29477d20 100644
--- a/interface/web/dns/dns_srv_edit.php
+++ b/interface/web/dns/dns_srv_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_srv.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -77,7 +77,7 @@ class page_action extends tform_actions {
 
 		// Split the 3 parts of the SRV Record apart
 		$split = explode(' ', $this->dataRecord['data']);
-		
+
 		$app->tpl->setVar('weight', $split[0]);
 		$app->tpl->setVar('port', $split[1]);
 		$app->tpl->setVar('target', $split[2]);
@@ -151,6 +151,7 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_template_del.php b/interface/web/dns/dns_template_del.php
index bfb343cbf861bb37ef07a2034edb6e33db29cb09..fee0900b903328e07a25f778c15c578722624dbd 100644
--- a/interface/web/dns/dns_template_del.php
+++ b/interface/web/dns/dns_template_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/dns_template.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -55,4 +55,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_template_edit.php b/interface/web/dns/dns_template_edit.php
index 5dda4dac191091b1c5acb5647496562cf3fc0fc9..1b63eaa148df20af05355c9f72f90cf0b7c1ac03 100644
--- a/interface/web/dns/dns_template_edit.php
+++ b/interface/web/dns/dns_template_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_template.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -51,10 +51,10 @@ $app->load('tform_actions');
 if($_SESSION["s"]["user"]["typ"] != 'admin') die('Access denied for non admin users.');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_template_list.php b/interface/web/dns/dns_template_list.php
index acad5d37ace9889ed2a71284a48df122229b587e..3fab001a070c9c8597db361a066c36a58a30dc3c 100644
--- a/interface/web/dns/dns_template_list.php
+++ b/interface/web/dns/dns_template_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -22,4 +22,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY dns_template.name';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/dns_txt_edit.php b/interface/web/dns/dns_txt_edit.php
index 2445f03211f23b958cb58f5509d82941c12c122d..2bacd357629417f7c5b8e30fc7db895872d02bc6 100644
--- a/interface/web/dns/dns_txt_edit.php
+++ b/interface/web/dns/dns_txt_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/dns_txt.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -49,17 +49,17 @@ $app->uses('tpl,tform,tform_actions,validate_dns');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -68,25 +68,25 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent soa record of the domain
 		$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 
 		// Check if Domain belongs to user
 		if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_dns_record FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_dns_record"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE sys_groupid = $client_group_id");
@@ -95,22 +95,22 @@ class page_action extends tform_actions {
 				}
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID of the rr record to the same server ID as the parent record.
 		$this->dataRecord["server_id"] = $soa["server_id"];
-		
+
 		// Update the serial number  and timestamp of the RR record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ".$this->id);
 		$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
 		$this->dataRecord["stamp"] = date('Y-m-d H:i:s');
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
 		$soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
@@ -120,16 +120,17 @@ class page_action extends tform_actions {
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Update the serial number of the SOA record
 		$soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
 		$soa_id = $app->functions->intval($_POST["zone"]);
 		$serial = $app->validate_dns->increase_serial($soa["serial"]);
 		$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php
index 10cfd9a757318145ecd1f70ab908c3ec256fc167..d4b07f748fbb8909f0445a4da040812207ddf0b5 100644
--- a/interface/web/dns/dns_wizard.php
+++ b/interface/web/dns/dns_wizard.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('dns');
@@ -38,7 +38,7 @@ $app->auth->check_module_permissions('dns');
 // Loading the template
 $app->uses('tpl,validate_dns');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/dns_wizard.htm');
+$app->tpl->setInclude('content_tpl', 'templates/dns_wizard.htm');
 $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng');
 
 // import variables
@@ -66,11 +66,11 @@ foreach($records as $rec){
 	$n++;
 }
 unset($n);
-$app->tpl->setVar("template_id_option",$template_id_option);
+$app->tpl->setVar("template_id_option", $template_id_option);
 
 // If the user is administrator
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	
+
 	// Load the list of servers
 	$records = $app->db->queryAllRecords("SELECT server_id, server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 ORDER BY server_name");
 	$server_id_option = '';
@@ -78,8 +78,8 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		$checked = ($rec['server_id'] == $server_id)?' SELECTED':'';
 		$server_id_option .= '<option value="'.$rec['server_id'].'"'.$checked.'>'.$rec['server_name'].'</option>';
 	}
-	$app->tpl->setVar("server_id",$server_id_option);
-	
+	$app->tpl->setVar("server_id", $server_id_option);
+
 	// load the list of clients
 	$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);
@@ -92,16 +92,16 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-	
+
 	// 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(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(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);
@@ -114,24 +114,24 @@ if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSIO
 		}
 	}
 
-	$app->tpl->setVar("client_group_id",$client_select);
+	$app->tpl->setVar("client_group_id", $client_select);
 }
 
 
 $template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'");
-$fields = explode(',',$template_record['fields']);
+$fields = explode(',', $template_record['fields']);
 if(is_array($fields)) {
 	foreach($fields as $field) {
-		$app->tpl->setVar($field."_VISIBLE",1);
+		$app->tpl->setVar($field."_VISIBLE", 1);
 		$field = strtolower($field);
-		$app->tpl->setVar($field,$_POST[$field]);
+		$app->tpl->setVar($field, $_POST[$field]);
 	}
 }
 
 if($_POST['create'] == 1) {
-	
+
 	$error = '';
-	
+
 	// apply filters
 	if(isset($_POST['domain']) && $_POST['domain'] != ''){
 		$_POST['domain'] = $app->functions->idn_encode($_POST['domain']);
@@ -149,22 +149,22 @@ if($_POST['create'] == 1) {
 		$_POST['email'] = $app->functions->idn_encode($_POST['email']);
 		$_POST['email'] = strtolower($_POST['email']);
 	}
-	
-	
+
+
 	if(isset($_POST['domain']) && $_POST['domain'] == '') $error .= $app->lng('error_domain_empty').'<br />';
-	elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,30}$/',$_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
+	elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,30}$/', $_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
 
 	if(isset($_POST['ip']) && $_POST['ip'] == '') $error .= $app->lng('error_ip_empty').'<br />';
 
 	if(isset($_POST['ns1']) && $_POST['ns1'] == '') $error .= $app->lng('error_ns1_empty').'<br />';
-	elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/',$_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
+	elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
 
 	if(isset($_POST['ns2']) && $_POST['ns2'] == '') $error .= $app->lng('error_ns2_empty').'<br />';
-	elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/',$_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
+	elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
 
 	if(isset($_POST['email']) && $_POST['email'] == '') $error .= $app->lng('error_email_empty').'<br />';
-	elseif(isset($_POST['email']) && !preg_match('/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z0-9\-]{2,30}$/i',$_POST['email'])) $error .= $app->lng('error_email_regex').'<br />';
-	
+	elseif(isset($_POST['email']) && !preg_match('/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z0-9\-]{2,30}$/i', $_POST['email'])) $error .= $app->lng('error_email_regex').'<br />';
+
 	// make sure that the record belongs to the client group and not the admin group when admin inserts it
 	if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($_POST['client_group_id'])) {
 		$sys_groupid = $app->functions->intval($_POST['client_group_id']);
@@ -173,11 +173,11 @@ if($_POST['create'] == 1) {
 	} else {
 		$sys_groupid = $_SESSION["s"]["user"]["default_group"];
 	}
-	
+
 	$tform_def_file = "form/dns_soa.tform.php";
 	$app->uses('tform');
 	$app->tform->loadFormDef($tform_def_file);
-	
+
 	if($_SESSION['s']['user']['typ'] != 'admin') {
 		if(!$app->tform->checkClientLimit('limit_dns_zone')) {
 			$error .= $app->tform->wordbook["limit_dns_zone_txt"];
@@ -186,31 +186,31 @@ if($_POST['create'] == 1) {
 			$error .= $app->tform->wordbook["limit_dns_zone_txt"];
 		}
 	}
-	
-	
+
+
 	// replace template placeholders
 	$tpl_content = $template_record['template'];
-	if($_POST['domain'] != '') $tpl_content = str_replace('{DOMAIN}',$_POST['domain'],$tpl_content);
-	if($_POST['ip'] != '') $tpl_content = str_replace('{IP}',$_POST['ip'],$tpl_content);
-	if($_POST['ns1'] != '') $tpl_content = str_replace('{NS1}',$_POST['ns1'],$tpl_content);
-	if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}',$_POST['ns2'],$tpl_content);
-	if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}',$_POST['email'],$tpl_content);
-        if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',$_POST['domain'])) {
-                $public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".$app->db->quote($_POST['domain'])."' AND dkim = 'y' AND ".$app->tform->getAuthSQL('r'));
-                if ($public_key!='') {
-                        $dns_record=str_replace(array("\r\n", "\n", "\r","-----BEGIN PUBLIC KEY-----","-----END PUBLIC KEY-----"),'',$public_key['dkim_public']);
-                        $tpl_content = str_replace('{DKIM}','TXT|default._domainkey.'.$_POST['domain'].'.|v=DKIM1; t=s; p='.$dns_record,$tpl_content);
-                }
-        }
-	
+	if($_POST['domain'] != '') $tpl_content = str_replace('{DOMAIN}', $_POST['domain'], $tpl_content);
+	if($_POST['ip'] != '') $tpl_content = str_replace('{IP}', $_POST['ip'], $tpl_content);
+	if($_POST['ns1'] != '') $tpl_content = str_replace('{NS1}', $_POST['ns1'], $tpl_content);
+	if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}', $_POST['ns2'], $tpl_content);
+	if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}', $_POST['email'], $tpl_content);
+	if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/', $_POST['domain'])) {
+		$public_key=$app->db->queryOneRecord("SELECT dkim_public FROM mail_domain WHERE domain = '".$app->db->quote($_POST['domain'])."' AND dkim = 'y' AND ".$app->tform->getAuthSQL('r'));
+		if ($public_key!='') {
+			$dns_record=str_replace(array("\r\n", "\n", "\r", "-----BEGIN PUBLIC KEY-----", "-----END PUBLIC KEY-----"), '', $public_key['dkim_public']);
+			$tpl_content = str_replace('{DKIM}', 'TXT|default._domainkey.'.$_POST['domain'].'.|v=DKIM1; t=s; p='.$dns_record, $tpl_content);
+		}
+	}
+
 	// Parse the template
-	$tpl_rows = explode("\n",$tpl_content);
+	$tpl_rows = explode("\n", $tpl_content);
 	$section = '';
 	$vars = array();
 	$dns_rr = array();
 	foreach($tpl_rows as $row) {
 		$row = trim($row);
-		if(substr($row,0,1) == '[') {
+		if(substr($row, 0, 1) == '[') {
 			if($row == '[ZONE]') {
 				$section = 'zone';
 			} elseif($row == '[DNS_RECORDS]') {
@@ -222,14 +222,14 @@ if($_POST['create'] == 1) {
 			if($row != '') {
 				// Handle zone section
 				if($section == 'zone') {
-					$parts = explode('=',$row);
+					$parts = explode('=', $row);
 					$key = trim($parts[0]);
 					$val = trim($parts[1]);
 					if($key != '') $vars[$key] = $val;
 				}
 				// Handle DNS Record rows
 				if($section == 'dns_records') {
-					$parts = explode('|',$row);
+					$parts = explode('|', $row);
 					$dns_rr[] = array(
 						'name' => $app->db->quote($parts[1]),
 						'type' => $app->db->quote($parts[0]),
@@ -240,9 +240,9 @@ if($_POST['create'] == 1) {
 				}
 			}
 		}
-		
+
 	} // end foreach
-	
+
 	if($vars['origin'] == '') $error .= $app->lng('error_origin_empty').'<br />';
 	if($vars['ns'] == '') $error .= $app->lng('error_ns_empty').'<br />';
 	if($vars['mbox'] == '') $error .= $app->lng('error_mbox_empty').'<br />';
@@ -251,13 +251,13 @@ if($_POST['create'] == 1) {
 	if($vars['expire'] == '') $error .= $app->lng('error_expire_empty').'<br />';
 	if($vars['minimum'] == '') $error .= $app->lng('error_minimum_empty').'<br />';
 	if($vars['ttl'] == '') $error .= $app->lng('error_ttl_empty').'<br />';
-	
+
 	if($error == '') {
 		// Insert the soa record
 		$sys_userid = $_SESSION['s']['user']['userid'];
 		$origin = $app->db->quote($vars['origin']);
 		$ns = $app->db->quote($vars['ns']);
-		$mbox = $app->db->quote(str_replace('@','.',$vars['mbox']));
+		$mbox = $app->db->quote(str_replace('@', '.', $vars['mbox']));
 		$refresh = $app->db->quote($vars['refresh']);
 		$retry = $app->db->quote($vars['retry']);
 		$expire = $app->db->quote($vars['expire']);
@@ -267,35 +267,35 @@ if($_POST['create'] == 1) {
 		$also_notify = $app->db->quote($vars['also_notify']);
 		$update_acl = $app->db->quote($vars['update_acl']);
 		$serial = $app->validate_dns->increase_serial(0);
-		
-		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES 
+
+		$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`, `also_notify`, `update_acl`) VALUES
 		('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '$xfer', '$also_notify', '$update_acl')";
 		$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
-		
+
 		// Insert the dns_rr records
 		if(is_array($dns_rr) && $dns_soa_id > 0) {
 			foreach($dns_rr as $rr) {
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 				('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$rr[name]', '$rr[type]', '$rr[data]', '$rr[aux]', '$rr[ttl]', 'Y')";
 				$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 			}
 		}
-		
+
 		header("Location: dns_soa_list.php");
 		exit;
-		
+
 	} else {
-		$app->tpl->setVar("error",$error);
+		$app->tpl->setVar("error", $error);
 	}
-	
+
 }
 
 
 
-$app->tpl->setVar("title",'DNS Wizard');
+$app->tpl->setVar("title", 'DNS Wizard');
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
diff --git a/interface/web/dns/form/dns_a.tform.php b/interface/web/dns/form/dns_a.tform.php
index d6e93ffb5bf3de523dab5aea1d322a2632d3ba28..7d4d276e8abc45572f0591afaf284e407a0d37ae 100644
--- a/interface/web/dns/form/dns_a.tform.php
+++ b/interface/web/dns/form/dns_a.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS A";
-$form["description"] 	= "";
-$form["name"] 			= "dns_a";
-$form["action"]			= "dns_a_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS A";
+$form["description"]  = "";
+$form["name"]    = "dns_a";
+$form["action"]   = "dns_a_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,69 +52,69 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS A",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_a_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS A",
+	'width'  => 100,
+	'template'  => "templates/dns_a_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\a-zA-Z0-9\.\-\*]{0,64}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\a-zA-Z0-9\.\-\*]{0,64}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'A',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'A',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9]{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^([1-9]{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])\.(\d{1}|[1-9]\d|[1]\d\d|2[0-4]\d|25[0-5])$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -127,41 +127,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_aaaa.tform.php b/interface/web/dns/form/dns_aaaa.tform.php
index d674913c249fb7afc7efa972e8a7a50261f2076e..c03423b8b5020b77cf323cf5725468e89327a349 100644
--- a/interface/web/dns/form/dns_aaaa.tform.php
+++ b/interface/web/dns/form/dns_aaaa.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS AAAA";
-$form["description"] 	= "";
-$form["name"] 			= "dns_aaaa";
-$form["action"]			= "dns_aaaa_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS AAAA";
+$form["description"]  = "";
+$form["name"]    = "dns_aaaa";
+$form["action"]   = "dns_aaaa_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,62 +52,62 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS AAAA",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_aaaa_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS AAAA",
+	'width'  => 100,
+	'template'  => "templates/dns_aaaa_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\*]{0,64}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\*]{0,64}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'AAAA',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'AAAA',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?\s*$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?\s*$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -120,41 +120,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index b358b720c7f8ad22d3631e826c2122b52dab2996..b97889bb39db089b491e9caa14729912e887614b 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS ALIAS";
-$form["description"] 	= "";
-$form["name"] 			= "dns_alias";
-$form["action"]			= "dns_alias_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS ALIAS";
+$form["description"]  = "";
+$form["name"]    = "dns_alias";
+$form["action"]   = "dns_alias_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,78 +52,78 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS ALIAS",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_alias_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS ALIAS",
+	'width'  => 100,
+	'template'  => "templates/dns_alias_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'name_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'name_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'ALIAS',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'ALIAS',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -136,41 +136,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php
index ccfef7368457b3ddb8a43e635ffd388361c47f69..b9d246c9513a78ed39bb87821763feba7e62635e 100644
--- a/interface/web/dns/form/dns_cname.tform.php
+++ b/interface/web/dns/form/dns_cname.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS CNAME";
-$form["description"] 	= "";
-$form["name"] 			= "dns_cname";
-$form["action"]			= "dns_cname_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS CNAME";
+$form["description"]  = "";
+$form["name"]    = "dns_cname";
+$form["action"]   = "dns_cname_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,76 +52,76 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS CNAME",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_cname_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS CNAME",
+	'width'  => 100,
+	'template'  => "templates/dns_cname_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\*]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\*]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'CNAME',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'CNAME',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -134,41 +134,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_dkim.tform.php b/interface/web/dns/form/dns_dkim.tform.php
index 71607c765ee64fd306223ccdc9ac795ed87354a9..89ee8a002afc9c98ab2d38733f603f2809d70e5d 100644
--- a/interface/web/dns/form/dns_dkim.tform.php
+++ b/interface/web/dns/form/dns_dkim.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS DKIM Record";
-$form["description"] 	= "";
-$form["name"] 			= "dns_dkim";
-$form["action"]			= "dns_dkim_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS DKIM Record";
+$form["description"]  = "";
+$form["name"]    = "dns_dkim";
+$form["action"]   = "dns_dkim_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,100 +52,100 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS DKIM",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_dkim_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS DKIM",
+	'width'  => 100,
+	'template'  => "templates/dns_dkim_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-	        'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'TXT',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'TXT',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/dns/form/dns_hinfo.tform.php b/interface/web/dns/form/dns_hinfo.tform.php
index 70971cf77ef4805d45d52bb93cb6121b3bd1cd0c..c64dea02dad7a2f594b633b7e8ae0a6cdfa110ca 100644
--- a/interface/web/dns/form/dns_hinfo.tform.php
+++ b/interface/web/dns/form/dns_hinfo.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS hinfo";
-$form["description"] 	= "";
-$form["name"] 			= "dns_hinfo";
-$form["action"]			= "dns_hinfo_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS hinfo";
+$form["description"]  = "";
+$form["name"]    = "dns_hinfo";
+$form["action"]   = "dns_hinfo_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,68 +52,68 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS HINFO",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_hinfo_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS HINFO",
+	'width'  => 100,
+	'template'  => "templates/dns_hinfo_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'name_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,64}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'name_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,64}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'HINFO',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'HINFO',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -126,41 +126,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_mx.tform.php b/interface/web/dns/form/dns_mx.tform.php
index a1f7b78b9c3cca8aff3db36edee12a7a7ca284a9..34268f9ef9503a6c51e4e4536673a4b6cfc80510 100644
--- a/interface/web/dns/form/dns_mx.tform.php
+++ b/interface/web/dns/form/dns_mx.tform.php
@@ -35,16 +35,16 @@
 
 global $app;
 
-$form["title"] 			= "DNS mx";
-$form["description"] 	= "";
-$form["name"] 			= "dns_mx";
-$form["action"]			= "dns_mx_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS mx";
+$form["description"]  = "";
+$form["name"]    = "dns_mx";
+$form["action"]   = "dns_mx_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -53,123 +53,123 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS mx",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_mx_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS mx",
+	'width'  => 100,
+	'template'  => "templates/dns_mx_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\*]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\*]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'MX',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'MX',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-		
+
 		'aux' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '10',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-		
+
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php
index 00a842f8496c139dcbfcf124b514542fdcd6a2de..3eb39a927a775956222fba0d9499bd7057c9a55f 100644
--- a/interface/web/dns/form/dns_ns.tform.php
+++ b/interface/web/dns/form/dns_ns.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS ns";
-$form["description"] 	= "";
-$form["name"] 			= "dns_ns";
-$form["action"]			= "dns_ns_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS ns";
+$form["description"]  = "";
+$form["name"]    = "dns_ns";
+$form["action"]   = "dns_ns_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,76 +52,76 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS ns",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_ns_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS ns",
+	'width'  => 100,
+	'template'  => "templates/dns_ns_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'NS',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'NS',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -134,41 +134,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_ptr.tform.php b/interface/web/dns/form/dns_ptr.tform.php
index 68ea83c54d4fc441f44230759d7fe5aadf6f9051..3ba441b17a62ef3fb401a566037b6a6a50bf3199 100644
--- a/interface/web/dns/form/dns_ptr.tform.php
+++ b/interface/web/dns/form/dns_ptr.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS ptr";
-$form["description"] 	= "";
-$form["name"] 			= "dns_ptr";
-$form["action"]			= "dns_ptr_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS ptr";
+$form["description"]  = "";
+$form["name"]    = "dns_ptr";
+$form["action"]   = "dns_ptr_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,76 +52,76 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS ptr",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_ptr_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS ptr",
+	'width'  => 100,
+	'template'  => "templates/dns_ptr_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,256}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,256}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'PTR',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'PTR',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,256}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,256}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -134,41 +134,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php
index 5a7ff8314a83a3367d5824a9384a7210c3ff8716..86c43ed3286d0c4e18932aece91b4ff843778f62 100644
--- a/interface/web/dns/form/dns_rp.tform.php
+++ b/interface/web/dns/form/dns_rp.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS RP";
-$form["description"] 	= "";
-$form["name"] 			= "dns_rp";
-$form["action"]			= "dns_rp_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS RP";
+$form["description"]  = "";
+$form["name"]    = "dns_rp";
+$form["action"]   = "dns_rp_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,69 +52,69 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS RP",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_rp_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS RP",
+	'width'  => 100,
+	'template'  => "templates/dns_rp_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
 			'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                          'type' => 'IDNTOASCII'),
-                              1 => array( 'event' => 'SHOW',
-                                          'type' => 'IDNTOUTF8'),
-                              2 => array( 'event' => 'SAVE',
-                                          'type' => 'TOLOWER')
-                            ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'RP',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'RP',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\s]{1,128}$/',
-														'errmsg'=> 'data_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\s]{1,128}$/',
+					'errmsg'=> 'data_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -127,41 +127,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_slave.tform.php b/interface/web/dns/form/dns_slave.tform.php
index 0ff6a5e941c5649ad61dd8a4814a102a5a86390a..c5187317b8b373f96b5ee797f9d6b5e0485b5b7b 100644
--- a/interface/web/dns/form/dns_slave.tform.php
+++ b/interface/web/dns/form/dns_slave.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Secondary DNS Zone";
-$form["description"] 	= "";
-$form["name"] 			= "dns_slave";
-$form["action"]			= "dns_slave_edit.php";
-$form["db_table"]		= "dns_slave";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns_slave";
-$form["list_default"]	= "dns_slave_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Secondary DNS Zone";
+$form["description"]  = "";
+$form["name"]    = "dns_slave";
+$form["action"]   = "dns_slave_edit.php";
+$form["db_table"]  = "dns_slave";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns_slave";
+$form["list_default"] = "dns_slave_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,85 +56,85 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns_slave'] = array (
-	'title' 	=> "Secondary DNS Zone",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_slave_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Secondary DNS Zone",
+	'width'  => 100,
+	'template'  => "templates/dns_slave_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'server_id_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'server_id_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'origin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'origin_error_empty'),
-										/*
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'origin_error_empty'),
+				/*
 										1 => array (	'type'	=> 'UNIQUE',
 														'errmsg'=> 'origin_error_unique'),
 										*/
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,10}[\.]{0,1}$/',
-														'errmsg'=> 'origin_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,10}[\.]{0,1}$/',
+					'errmsg'=> 'origin_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'ns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[0-9\.]{1,255}$/',
-														'errmsg'=> 'ns_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[0-9\.]{1,255}$/',
+					'errmsg'=> 'ns_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
-                'xfer' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'TEXT',
-                        'default'       => '',
-                        'value'         => '',
-                        'width'         => '30',
-                        'maxlength'     => '255'
-                ),
+		'xfer' => array (
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'TEXT',
+			'default'       => '',
+			'value'         => '',
+			'width'         => '30',
+			'maxlength'     => '255'
+		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index ebc49cfceb30df253f45794c66ce3ffce94701a5..fd41c87c99f4c6b2f2d4eb5120bfe7361ee01354 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -39,16 +39,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS Zone";
-$form["description"] 	= "";
-$form["name"] 			= "dns_soa";
-$form["action"]			= "dns_soa_edit.php";
-$form["db_table"]		= "dns_soa";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns_soa";
-$form["list_default"]	= "dns_soa_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS Zone";
+$form["description"]  = "";
+$form["name"]    = "dns_soa";
+$form["action"]   = "dns_soa_edit.php";
+$form["db_table"]  = "dns_soa";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns_soa";
+$form["list_default"] = "dns_soa_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -57,235 +57,235 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns_soa'] = array (
-	'title' 	=> "DNS Zone",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_soa_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS Zone",
+	'width'  => 100,
+	'template'  => "templates/dns_soa_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'server_id_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND dns_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'server_id_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'origin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'origin_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'origin_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
-														'errmsg'=> 'origin_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'origin_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'origin_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
+					'errmsg'=> 'origin_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'ns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{1,255}$/',
-														'errmsg'=> 'ns_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{1,255}$/',
+					'errmsg'=> 'ns_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'mbox' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mbox_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,255}\.$/',
-														'errmsg'=> 'mbox_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mbox_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,255}\.$/',
+					'errmsg'=> 'mbox_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'refresh' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'refresh_range_error'),
-									),
-			'default'	=> '7200',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'refresh_range_error'),
+			),
+			'default' => '7200',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'retry' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'retry_range_error'),
-									),
-			'default'	=> '540',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'retry_range_error'),
+			),
+			'default' => '540',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'expire' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'expire_range_error'),
-									),
-			'default'	=> '604800',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'expire_range_error'),
+			),
+			'default' => '604800',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'minimum' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'minimum_range_error'),
-									),
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'minimum_range_error'),
+			),
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'RANGE',
-														'range' => '60:',
-														'errmsg'=> 'ttl_range_error'),
-									),
-			'default'	=> '3600',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'RANGE',
+					'range' => '60:',
+					'errmsg'=> 'ttl_range_error'),
+			),
+			'default' => '3600',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'xfer' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIP',
-														'allowempty' => 'y',
-														'separator' => ',',
-														'errmsg'=> 'xfer_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISIP',
+					'allowempty' => 'y',
+					'separator' => ',',
+					'errmsg'=> 'xfer_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'also_notify' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'    => array (  0 => array (	'type'	=> 'ISIP',
-														'allowempty' => 'y',
-														'separator' => ',',
-														'errmsg'=> 'also_notify_error_regex'
-													),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators'    => array (  0 => array ( 'type' => 'ISIP',
+					'allowempty' => 'y',
+					'separator' => ',',
+					'errmsg'=> 'also_notify_error_regex'
+				),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'update_acl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['dns_records'] = array (
-	'title' 	=> "Records",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_records_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+	'title'  => "Records",
+	'width'  => 100,
+	'template'  => "templates/dns_records_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'dns_records' => array (
-         	'class'   => 'plugin_listview',
-     		'options' => array(
+		'dns_records' => array (
+			'class'   => 'plugin_listview',
+			'options' => array(
 				'listdef' => 'list/dns_a.list.php',
 				'sqlextwhere' => "zone = ".@$app->functions->intval(@$_REQUEST['id']),
 				'sql_order_by' => "ORDER BY type, name"
 			)
-        )
+		)
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php
index 736bbc920607f2b8be48aaf968f3eedb99333e87..b737bbd97a1bddfef5c226d4c38f61d6a815281e 100644
--- a/interface/web/dns/form/dns_srv.tform.php
+++ b/interface/web/dns/form/dns_srv.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS SRV";
-$form["description"] 	= "";
-$form["name"] 			= "dns_srv";
-$form["action"]			= "dns_srv_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS SRV";
+$form["description"]  = "";
+$form["name"]    = "dns_srv";
+$form["action"]   = "dns_srv_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,114 +52,114 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS SRV",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_srv_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS SRV",
+	'width'  => 100,
+	'template'  => "templates/dns_srv_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'SRV',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'SRV',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
- 										1 => array (	'type'	=> 'REGEX',
- 														'regex' => '/^[\w\.\-]{0,64}\s[\w\.\-]{0,64}\s[\w\.\-]{0,64}$/',
- 														'errmsg'=> 'srv_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}\s[\w\.\-]{0,64}\s[\w\.\-]{0,64}$/',
+					'errmsg'=> 'srv_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'aux' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/form/dns_template.tform.php b/interface/web/dns/form/dns_template.tform.php
index 38227193589a7dd3508c7b00000d09c306d99843..e209153f747fc6b86042ba97f24476abba11e775 100644
--- a/interface/web/dns/form/dns_template.tform.php
+++ b/interface/web/dns/form/dns_template.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "DNS Wizard template";
-$form["description"] 	= "";
-$form["name"] 			= "dns_template";
-$form["action"]			= "dns_template_edit.php";
-$form["db_table"]		= "dns_template";
-$form["db_table_idx"]	= "template_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "template";
-$form["list_default"]	= "dns_template_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS Wizard template";
+$form["description"]  = "";
+$form["name"]    = "dns_template";
+$form["action"]   = "dns_template_edit.php";
+$form["db_table"]  = "dns_template";
+$form["db_table_idx"] = "template_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "template";
+$form["list_default"] = "dns_template_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,53 +51,53 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['template'] = array (
-	'title' 	=> "DNS Template",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_template_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS Template",
+	'width'  => 100,
+	'template'  => "templates/dns_template_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'name_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'name_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'fields' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOXARRAY',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOXARRAY',
+			'default' => '',
 			'separator' => ',',
-			'value'		=> array('DOMAIN' => 'Domain','IP' => 'IP Address','NS1' => 'NS 1','NS2' => 'NS 2','EMAIL' => 'Email', 'DKIM' => 'DKIM (use {DKIM}|0|3600 in your Template)'),
-                        'validators'    => array (  0 => array ('type'  => 'CUSTOM',
-                                                                'class' => 'validate_dkim',
-                                                                'function' => 'check_template',
-                                                                'errmsg'=> 'dkim_domain_error'),
-                                                 ),
+			'value'  => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM (use {DKIM}|0|3600 in your Template)'),
+			'validators'    => array (  0 => array ('type'  => 'CUSTOM',
+					'class' => 'validate_dkim',
+					'function' => 'check_template',
+					'errmsg'=> 'dkim_domain_error'),
+			),
 		),
 		'template' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '40',
-			'rows'		=> '15'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'cols'  => '40',
+			'rows'  => '15'
 		),
 		'visible' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php
index c59fa75e553eed830ed3de71387577787de905a7..159629b20367510eb91e69b472fd9a73992f64c9 100644
--- a/interface/web/dns/form/dns_txt.tform.php
+++ b/interface/web/dns/form/dns_txt.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "DNS TXT Record";
-$form["description"] 	= "";
-$form["name"] 			= "dns_txt";
-$form["action"]			= "dns_txt_edit.php";
-$form["db_table"]		= "dns_rr";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "dns";
-$form["list_default"]	= "dns_a_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "DNS TXT Record";
+$form["description"]  = "";
+$form["name"]    = "dns_txt";
+$form["action"]   = "dns_txt_edit.php";
+$form["db_table"]  = "dns_rr";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "dns";
+$form["list_default"] = "dns_a_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,66 +52,66 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['dns'] = array (
-	'title' 	=> "DNS TXT",
-	'width' 	=> 100,
-	'template' 	=> "templates/dns_txt_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "DNS TXT",
+	'width'  => 100,
+	'template'  => "templates/dns_txt_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'zone' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["zone"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["zone"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,255}$/',
-														'errmsg'=> 'name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,255}$/',
+					'errmsg'=> 'name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'TXT',
-			'value'		=> '',
-			'width'		=> '5',
-			'maxlength'	=> '5'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'TXT',
+			'value'  => '',
+			'width'  => '5',
+			'maxlength' => '5'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'data_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'data_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		/*
 		'aux' => array (
@@ -124,41 +124,41 @@ $form["tabs"]['dns'] = array (
 		),
 		*/
 		'ttl' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '86400',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '86400',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'Y',
-			'value'		=> array(0 => 'N',1 => 'Y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'Y',
+			'value'  => array(0 => 'N', 1 => 'Y')
 		),
 		'stamp' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'serial' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/lib/admin.conf.php b/interface/web/dns/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/dns/lib/admin.conf.php
+++ b/interface/web/dns/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/lib/module.conf.php b/interface/web/dns/lib/module.conf.php
index 1af3a893d3eb55d059c4475abffc385b9a760e84..83027c67d2c9cf7af8a6023519b87090b60ff196 100644
--- a/interface/web/dns/lib/module.conf.php
+++ b/interface/web/dns/lib/module.conf.php
@@ -1,33 +1,33 @@
 <?php
 
-$module["name"] 		= "dns";
-$module["title"] 		= "top_menu_dns";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "dns/dns_soa_list.php";
+$module["name"]   = "dns";
+$module["title"]   = "top_menu_dns";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "dns/dns_soa_list.php";
 $module["tab_width"]    = '';
 
 
-$items[] = array( 'title' 	=> "Add DNS Zone",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_wizard.php',
-				  'html_id' => 'dns_wizard');
+$items[] = array( 'title'  => "Add DNS Zone",
+	'target'  => 'content',
+	'link' => 'dns/dns_wizard.php',
+	'html_id' => 'dns_wizard');
 
-$items[] = array( 'title' 	=> "Import Zone File",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_import.php',
-				  'html_id' => 'dns_import');
+$items[] = array( 'title'  => "Import Zone File",
+	'target'  => 'content',
+	'link' => 'dns/dns_import.php',
+	'html_id' => 'dns_import');
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-  $items[] = array( 	'title' 	=> "Templates",
-				  'target' 	=> 'content',
-				  'link'		=> 'dns/dns_template_list.php',
-				  'html_id' => 'dns_template_list');
+	$items[] = array(  'title'  => "Templates",
+		'target'  => 'content',
+		'link'  => 'dns/dns_template_list.php',
+		'html_id' => 'dns_template_list');
 }
 
 
-$module["nav"][] = array(	'title'	=> 'DNS Wizard',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module["nav"][] = array( 'title' => 'DNS Wizard',
+	'open'  => 1,
+	'items' => $items);
 
 
 unset($items);
@@ -37,10 +37,10 @@ unset($items);
 */
 
 
-$items[] = array( 'title' 	=> "Zones",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_soa_list.php',
-				  'html_id' => 'dns_soa_list');
+$items[] = array( 'title'  => "Zones",
+	'target'  => 'content',
+	'link' => 'dns/dns_soa_list.php',
+	'html_id' => 'dns_soa_list');
 /*
 $items[] = array( 'title' 	=> "A-Records",
 				  'target' 	=> 'content',
@@ -49,20 +49,20 @@ $items[] = array( 'title' 	=> "A-Records",
 */
 
 
-$module["nav"][] = array(	'title'	=> 'DNS',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module["nav"][] = array( 'title' => 'DNS',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
-$items[] = array( 'title' 	=> "Secondary Zones",
-				  'target' 	=> 'content',
-				  'link'	=> 'dns/dns_slave_list.php',
-				  'html_id' => 'dns_slave_list');
+$items[] = array( 'title'  => "Secondary Zones",
+	'target'  => 'content',
+	'link' => 'dns/dns_slave_list.php',
+	'html_id' => 'dns_slave_list');
 
-$module["nav"][] = array(	'title'	=> 'Secondary DNS',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module["nav"][] = array( 'title' => 'Secondary DNS',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
@@ -70,4 +70,4 @@ unset($items);
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/lib/remote.conf.php b/interface/web/dns/lib/remote.conf.php
index e14b5b7f5ccbe7a9c44d2d8f7186d1626c63f861..dcabf948575e69ebd707b0f1fd489ce0e6738e0f 100644
--- a/interface/web/dns/lib/remote.conf.php
+++ b/interface/web/dns/lib/remote.conf.php
@@ -13,4 +13,4 @@ $function_list['dns_rp_get,dns_rp_add,dns_rp_update,dns_rp_delete'] = 'DNS rp fu
 $function_list['dns_srv_get,dns_srv_add,dns_srv_update,dns_srv_delete'] = 'DNS srv functions';
 $function_list['dns_txt_get,dns_txt_add,dns_txt_update,dns_txt_delete'] = 'DNS txt functions';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/list/dns_a.list.php b/interface/web/dns/list/dns_a.list.php
index 75076d017bbc2d9d87571b412ff750a9d522663f..3b47cf10c279b729b7bae3018a41fdf4f335d400 100644
--- a/interface/web/dns/list/dns_a.list.php
+++ b/interface/web/dns/list/dns_a.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "dns_a";
+$liste["name"]     = "dns_a";
 
 // Database table
-$liste["table"] 			= "dns_rr";
+$liste["table"]    = "dns_rr";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "dns_a_list.php";
+$liste["file"]    = "dns_a_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "dns_a_edit.php";
+$liste["edit_file"]   = "dns_a_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_a_del.php";
+$liste["delete_file"]  = "dns_a_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,91 +48,91 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "zone",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,origin FROM dns_soa WHERE {AUTHSQL} ORDER BY origin',
-														'keyfield'=> 'id',
-														'valuefield'=> 'origin'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "data",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "aux",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "ttl",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('A'=>'A','AAAA' => 'AAAA','ALIAS'=>'ALIAS','CNAME'=>'CNAME','HINFO'=>'HINFO','MX'=>'MX','NS'=>'NS','PTR'=>'PTR','RP'=>'RP','SRV'=>'SRV','TXT'=>'TXT'));
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "zone",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,origin FROM dns_soa WHERE {AUTHSQL} ORDER BY origin',
+		'keyfield'=> 'id',
+		'valuefield'=> 'origin'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "data",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "aux",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "ttl",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('A'=>'A', 'AAAA' => 'AAAA', 'ALIAS'=>'ALIAS', 'CNAME'=>'CNAME', 'HINFO'=>'HINFO', 'MX'=>'MX', 'NS'=>'NS', 'PTR'=>'PTR', 'RP'=>'RP', 'SRV'=>'SRV', 'TXT'=>'TXT'));
+
+
+?>
diff --git a/interface/web/dns/list/dns_slave.list.php b/interface/web/dns/list/dns_slave.list.php
index f00d33baf5b77bcb808f0f0c36945f6e3593beec..5a242de14c07aa60067ee16867c9e4054350bd6b 100644
--- a/interface/web/dns/list/dns_slave.list.php
+++ b/interface/web/dns/list/dns_slave.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "dns_slave";
+$liste["name"]    = "dns_slave";
 
 // Database table
-$liste["table"] 		= "dns_slave";
+$liste["table"]   = "dns_slave";
 
 // Index index field of the database table
-$liste["table_idx"]		= "id";
+$liste["table_idx"]  = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "dns_slave_list.php";
+$liste["file"]   = "dns_slave_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "dns_slave_edit.php";
+$liste["edit_file"]  = "dns_slave_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_slave_del.php";
+$liste["delete_file"]  = "dns_slave_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -49,51 +49,51 @@ $liste["auth"]			= "yes";
 
 
 $liste["item"][] = array(   'field'     => "active",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(   'field'	=> "server_id",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'datasource'=> array (  'type' => 'CUSTOM',
-                                                    'class' => 'custom_datasource',
-                                                    'function' => 'slave_dns_servers'
-                                                ),
-                            'width'	=> "",
-                            'value'	=> "");
-
-$liste["item"][] = array(   'field'	=> "origin",
-                            'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
-
-
-$liste["item"][] = array(   'field'	=> "ns",
-                            'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
-
-?>
\ No newline at end of file
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array(   'field' => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource'=> array (  'type' => 'CUSTOM',
+		'class' => 'custom_datasource',
+		'function' => 'slave_dns_servers'
+	),
+	'width' => "",
+	'value' => "");
+
+$liste["item"][] = array(   'field' => "origin",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
+
+$liste["item"][] = array(   'field' => "ns",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
+?>
diff --git a/interface/web/dns/list/dns_soa.list.php b/interface/web/dns/list/dns_soa.list.php
index 46ec9c9b8f935531988b1770b63794fb588e9399..e3b240a7cd840eaf9d1b87ba724c4b9f972fb80d 100644
--- a/interface/web/dns/list/dns_soa.list.php
+++ b/interface/web/dns/list/dns_soa.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "dns_soa";
+$liste["name"]     = "dns_soa";
 
 // Database table
-$liste["table"] 			= "dns_soa";
+$liste["table"]    = "dns_soa";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "dns_soa_list.php";
+$liste["file"]    = "dns_soa_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "dns_soa_edit.php";
+$liste["edit_file"]   = "dns_soa_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_soa_del.php";
+$liste["delete_file"]  = "dns_soa_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,66 +48,66 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-														'class'=> 'custom_datasource',
-														'function'=> 'dns_servers'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'CUSTOM',
+		'class'=> 'custom_datasource',
+		'function'=> 'dns_servers'
+	),
+	'width'  => "",
+	'value'  => "");
 
-$liste["item"][] = array(	'field'		=> "origin",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "origin",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "ns",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "ns",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "mbox",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "mbox",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
 
@@ -117,4 +117,4 @@ $liste["item"][] = array(	'field'		=> "mbox",
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/dns/list/dns_template.list.php b/interface/web/dns/list/dns_template.list.php
index 58055fbb4ae6137ba58970336b8d17e238e83f68..63302d956e43681b39043332c6d5e4aac6ca529a 100644
--- a/interface/web/dns/list/dns_template.list.php
+++ b/interface/web/dns/list/dns_template.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "dns_template";
+$liste["name"]    = "dns_template";
 
 // Database table
-$liste["table"] 		= "dns_template";
+$liste["table"]   = "dns_template";
 
 // Index index field of the database table
-$liste["table_idx"]		= "template_id";
+$liste["table_idx"]  = "template_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "dns_template_list.php";
+$liste["file"]   = "dns_template_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "dns_template_edit.php";
+$liste["edit_file"]  = "dns_template_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "dns_template_del.php";
+$liste["delete_file"]  = "dns_template_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -49,22 +49,22 @@ $liste["auth"]			= "yes";
 
 
 $liste["item"][] = array(   'field'     => "visible",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(   'field'	=> "name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
-
-?>
\ No newline at end of file
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array(   'field' => "name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
+
+?>
diff --git a/interface/web/help/faq_delete.php b/interface/web/help/faq_delete.php
index 2e501d4937f7755ee5666f9676ef795519c94400..e8f36272786fec032bb0d9d23df22a8258b4199a 100644
--- a/interface/web/help/faq_delete.php
+++ b/interface/web/help/faq_delete.php
@@ -5,11 +5,11 @@ $list_def_file = 'list/faq_manage_questions_list.php';
 $tform_def_file = 'form/faq.tform.php';
 
 // Include the base libraries
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_edit.php b/interface/web/help/faq_edit.php
index 028c5112c65fe26cc13124fda649a06ce84b47e1..629bde88c798f7105ad1b3621ab3cfcfa85fc06f 100644
--- a/interface/web/help/faq_edit.php
+++ b/interface/web/help/faq_edit.php
@@ -4,11 +4,11 @@
 $tform_def_file = 'form/faq.tform.php';
 
 // include the core configuration and application classes
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check the  module permissions and redirect if not allowed.
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_list.php b/interface/web/help/faq_list.php
index 79e9b6f63cdb9ab7ec82783ab535892bfc383c2b..2f48b4df3917caf342c84e3ee1a7e6a91f089ee6 100644
--- a/interface/web/help/faq_list.php
+++ b/interface/web/help/faq_list.php
@@ -1,13 +1,13 @@
 <?php
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Path to the list definition file
 $list_def_file = 'list/faq_list.php';
 
 // Check the module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die();
 }
@@ -18,7 +18,7 @@ $app->uses('listform_actions');
 // Optional limit
 $hf_section = 0;
 if(isset($_GET['hfs_id']))
-	$hf_section = preg_replace("/[^0-9]/","",$_GET['hfs_id']);
+	$hf_section = preg_replace("/[^0-9]/", "", $_GET['hfs_id']);
 
 // if section id is not specified in the url, choose the first existing section
 if(!$hf_section)
diff --git a/interface/web/help/faq_manage_questions_list.php b/interface/web/help/faq_manage_questions_list.php
index ad34619abdff6f61f6cbbf927883c6ee9370ecff..e72824458683f78bd7a2c8323049a5c636931bd3 100644
--- a/interface/web/help/faq_manage_questions_list.php
+++ b/interface/web/help/faq_manage_questions_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Path to the list definition file
 $list_def_file = "list/faq_manage_questions_list.php";
@@ -12,7 +12,7 @@ $app->auth->check_module_permissions('help');
 $app->uses('listform_actions');
 
 //* Optional limit
-#$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
+//$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
 
 //* Start the form rendering and action ahndling
 $app->listform_actions->onLoad();
diff --git a/interface/web/help/faq_sections_delete.php b/interface/web/help/faq_sections_delete.php
index 9a47e9b6f5daab94be88d26b28e6465c3ba06915..adcacf4376233fe21b53068b89986d736282ae68 100644
--- a/interface/web/help/faq_sections_delete.php
+++ b/interface/web/help/faq_sections_delete.php
@@ -5,11 +5,11 @@ $list_def_file = 'list/faq_sections_list.php';
 $tform_def_file = 'form/faq_sections.tform.php';
 
 // Include the base libraries
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_sections_edit.php b/interface/web/help/faq_sections_edit.php
index 73d02800b6fa4722c4732c18e4b45f4816a695d7..32f0123466c98c6c80235cf4888a459521569afe 100644
--- a/interface/web/help/faq_sections_edit.php
+++ b/interface/web/help/faq_sections_edit.php
@@ -4,11 +4,11 @@
 $tform_def_file = 'form/faq_sections.tform.php';
 
 // include the core configuration and application classes
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Check the  module permissions and redirect if not allowed.
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die;
 }
diff --git a/interface/web/help/faq_sections_list.php b/interface/web/help/faq_sections_list.php
index e6f99795759037e79ffd38d396209d38c7033967..4acb4ae20e107942d62815d38d93baa176d39373 100644
--- a/interface/web/help/faq_sections_list.php
+++ b/interface/web/help/faq_sections_list.php
@@ -1,13 +1,13 @@
 <?php
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Path to the list definition file
 $list_def_file = 'list/faq_sections_list.php';
 
 // Check the module permissions
-if(!stristr($_SESSION['s']['user']['modules'],'help')) {
+if(!stristr($_SESSION['s']['user']['modules'], 'help')) {
 	header('Location: ../index.php');
 	die();
 }
diff --git a/interface/web/help/form/faq.tform.php b/interface/web/help/form/faq.tform.php
index 276b9d8145b0fd67fc29314059f1cb3d6daad1bd..e795f3566f034c9f56a2f79f1f221e31b45a2fc2 100644
--- a/interface/web/help/form/faq.tform.php
+++ b/interface/web/help/form/faq.tform.php
@@ -1,105 +1,105 @@
 <?php
 
 // Title of the form.
-$form['title'] 			= 'Frequently Asked Questions';
+$form['title']    = 'Frequently Asked Questions';
 
 // Optional description of the form.
-$form['description'] 	= '';
+$form['description']  = '';
 
 // Name of the form which cannot contain spaces or foreign characters.
-$form['name'] 			= 'faq_form';
+$form['name']    = 'faq_form';
 
 // The file that is used to call the form in the browser.
-$form['action']			= 'faq_edit.php';
+$form['action']   = 'faq_edit.php';
 
 // The name of the database table used to store the data
-$form['db_table']		= 'help_faq';
+$form['db_table']  = 'help_faq';
 
 // The name of the database table index field.
 // This field must be a numeric auto increment column.
-$form['db_table_idx']	= 'hf_id';
+$form['db_table_idx'] = 'hf_id';
 
 // Should changes to this table be stored in the database history (sys_datalog) table.
 // This should be set to 'yes' for all tables that store configuration information.
-$form['db_history']		= 'no'; 
+$form['db_history']  = 'no';
 
 // The name of the tab that is shown when the form is opened
-$form['tab_default']	= 'message';
+$form['tab_default'] = 'message';
 
 // The name of the default list file of this form
-$form['list_default']	= 'faq_manage_questions_list.php';
+$form['list_default'] = 'faq_manage_questions_list.php';
 
 // Use the internal authentication system for this table. This should
 // be set to 'yes' in most cases, otherwise 'no'.
-$form['auth']			= 'yes'; 
+$form['auth']   = 'yes';
 
 //** Authentication presets. The defaults below does not need to be changed in most cases.
 
 // 0 = id of the user, > 0 id must match with id of current user
 $form['auth_preset']['userid']  = 0;
 
- // 0 = default groupid of the user, > 0 id must match with groupid of current
+// 0 = default groupid of the user, > 0 id must match with groupid of current
 $form['auth_preset']['groupid'] = 0;
 
 // Permissions with the following codes: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user'] = 'riud';
 $form['auth_preset']['perm_group'] = 'riud';
-$form['auth_preset']['perm_other'] = 'r'; 
+$form['auth_preset']['perm_other'] = 'r';
 
 // The form definition of the first tab. The name of the tab is called 'message'. We refer
 // to this name in the $form['tab_default'] setting above.
 $form['tabs']['message'] = array(
-	'title'		=> 'FAQ', // Title of the Tab
-	'width' 	=> 100,       // Tab width
-	'template' 	=> 'templates/faq_edit.htm', // Template file name
-	'fields' 	=> array(
-
-        //*** BEGIN Datatable columns **********************************
-
-	'hf_section' => array (
-		'datatype'      => 'INTEGER',
-		'formtype'      => 'SELECT',
-		'default'       => '',
-		'datasource'    => array (	'type'		=> 'SQL',
-						'querystring'	=> 'SELECT hfs_id,hfs_name FROM help_faq_sections',
-						'keyfield'	=> 'hfs_id',
-						'valuefield'    => 'hfs_name'
-						),
-		'validators'	=> array (	0 => array (
-							'type'  => 'ISINT',
-							'errmsg'=> 'recipient_id_is_not_integer'),
-						),
-		'value'		=> ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
+	'title'  => 'FAQ', // Title of the Tab
+	'width'  => 100,       // Tab width
+	'template'  => 'templates/faq_edit.htm', // Template file name
+	'fields'  => array(
+
+		//*** BEGIN Datatable columns **********************************
+
+		'hf_section' => array (
+			'datatype'      => 'INTEGER',
+			'formtype'      => 'SELECT',
+			'default'       => '',
+			'datasource'    => array ( 'type'  => 'SQL',
+				'querystring' => 'SELECT hfs_id,hfs_name FROM help_faq_sections',
+				'keyfield' => 'hfs_id',
+				'valuefield'    => 'hfs_name'
+			),
+			'validators' => array ( 0 => array (
+					'type'  => 'ISINT',
+					'errmsg'=> 'recipient_id_is_not_integer'),
+			),
+			'value'  => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
 		),
 
-	'hf_question' => array(
-		'datatype'	=> 'VARCHAR',
-		'formtype'	=> 'TEXT',
-		'validators'	=> array( 0 => array(	'type'  => 'NOTEMPTY',
-							'errmsg'=> 'subject_is_empty'
-					),
+		'hf_question' => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array( 0 => array( 'type'  => 'NOTEMPTY',
+					'errmsg'=> 'subject_is_empty'
+				),
 			),
-		'default'     => '',
-		'value'      => '',
-		'width'      => '30',
-		'maxlength'  => '255'
-	),
-
-	'hf_answer' => array(
-		'datatype'	=> 'TEXT',
-		'formtype'	=> 'TEXTAREA',
-		'validators' => array( 0 => array( 	'type'		=> 'NOTEMPTY',
-							'errmsg'	=> 'message_is_empty'
-					),
+			'default'     => '',
+			'value'      => '',
+			'width'      => '30',
+			'maxlength'  => '255'
+		),
+
+		'hf_answer' => array(
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'validators' => array( 0 => array(  'type'  => 'NOTEMPTY',
+					'errmsg' => 'message_is_empty'
 				),
-		'default'	=> '',
-		'value'		=> '',
-		'cols'		=> '30',
-		'rows'		=> '10',
-		'maxlength'	=> '255'
-	),
-
-	//*** END Datatable columns **********************************
+			),
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '10',
+			'maxlength' => '255'
+		),
+
+		//*** END Datatable columns **********************************
 	)
 );
 ?>
diff --git a/interface/web/help/form/faq_sections.tform.php b/interface/web/help/form/faq_sections.tform.php
index d849f27e8bb3d5763bd59060ea17fde8bb6f03fd..1a1076876ee720b2ce11ee564377db65ad96b5ae 100644
--- a/interface/web/help/form/faq_sections.tform.php
+++ b/interface/web/help/form/faq_sections.tform.php
@@ -1,72 +1,72 @@
 <?php
 
 // Title of the form.
-$form['title'] 			= 'FAQ Sections';
+$form['title']    = 'FAQ Sections';
 
 // Optional description of the form.
-$form['description'] 	= '';
+$form['description']  = '';
 
 // Name of the form which cannot contain spaces or foreign characters.
-$form['name'] 			= 'faq_sections_form';
+$form['name']    = 'faq_sections_form';
 
 // The file that is used to call the form in the browser.
-$form['action']			= 'faq_sections_edit.php';
+$form['action']   = 'faq_sections_edit.php';
 
 // The name of the database table used to store the data
-$form['db_table']		= 'help_faq_sections';
+$form['db_table']  = 'help_faq_sections';
 
 // The name of the database table index field.
 // This field must be a numeric auto increment column.
-$form['db_table_idx']	= 'hfs_id';
+$form['db_table_idx'] = 'hfs_id';
 
 // Should changes to this table be stored in the database history (sys_datalog) table.
 // This should be set to 'yes' for all tables that store configuration information.
-$form['db_history']		= 'no'; 
+$form['db_history']  = 'no';
 
 // The name of the tab that is shown when the form is opened
-$form['tab_default']	= 'message';
+$form['tab_default'] = 'message';
 
 // The name of the default list file of this form
-$form['list_default']	= 'faq_sections_list.php';
+$form['list_default'] = 'faq_sections_list.php';
 
 // Use the internal authentication system for this table. This should
 // be set to 'yes' in most cases, otherwise 'no'.
-$form['auth']			= 'yes'; 
+$form['auth']   = 'yes';
 
 //** Authentication presets. The defaults below does not need to be changed in most cases.
 
 // 0 = id of the user, > 0 id must match with id of current user
 $form['auth_preset']['userid']  = 0;
 
- // 0 = default groupid of the user, > 0 id must match with groupid of current
+// 0 = default groupid of the user, > 0 id must match with groupid of current
 $form['auth_preset']['groupid'] = 0;
 
 // Permissions with the following codes: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user'] = 'riud';
 $form['auth_preset']['perm_group'] = 'riud';
-$form['auth_preset']['perm_other'] = ''; 
+$form['auth_preset']['perm_other'] = '';
 
 // The form definition of the first tab. The name of the tab is called 'message'. We refer
 // to this name in the $form['tab_default'] setting above.
 $form['tabs']['message'] = array(
-	'title' 	=> 'FAQ', // Title of the Tab
-	'width' 	=> 100,       // Tab width
-	'template' 	=> 'templates/faq_sections_edit.htm', // Template file name
-	'fields' 	=> array(
-
-	//*** BEGIN Datatable columns **********************************
-
-	'hfs_name' 	=> array(
-		'datatype'	=> 'VARCHAR',
-		'formtype'	=> 'TEXT',
-		'validators'=> array( 0 => array( 	'type'	=> 'NOTEMPTY',
-											'errmsg'=> 'subject_is_empty'
-										),
-							),
-		'default'	=> '',
-		'value'		=> '',
-		'width'		=> '30',
-		'maxlength'	=> '255'
+	'title'  => 'FAQ', // Title of the Tab
+	'width'  => 100,       // Tab width
+	'template'  => 'templates/faq_sections_edit.htm', // Template file name
+	'fields'  => array(
+
+		//*** BEGIN Datatable columns **********************************
+
+		'hfs_name'  => array(
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators'=> array( 0 => array(  'type' => 'NOTEMPTY',
+					'errmsg'=> 'subject_is_empty'
+				),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		//*** END Datatable columns *********************************
 	)
diff --git a/interface/web/help/form/support_message.tform.php b/interface/web/help/form/support_message.tform.php
index a8c0847a732df7d0e6c6c62ab458eb6de404dfec..d982712c6499f4a77de2d80b07dc28653f7f072a 100644
--- a/interface/web/help/form/support_message.tform.php
+++ b/interface/web/help/form/support_message.tform.php
@@ -1,36 +1,36 @@
 <?php
 
 //* Title of the form
-$form["title"] 			= "Support Message";
+$form["title"]    = "Support Message";
 
 //* Description of the form (optional)
-$form["description"] 	= "";
+$form["description"]  = "";
 
 //* Name of the form. The name shall not contain spaces or foreign characters
-$form["name"] 			= "support_message";
+$form["name"]    = "support_message";
 
 //* The file that is used to call the form in the browser
-$form["action"]			= "support_message_edit.php";
+$form["action"]   = "support_message_edit.php";
 
 //* The name of the database table that shall be used to store the data
-$form["db_table"]		= "support_message";
+$form["db_table"]  = "support_message";
 
 //* The name of the database table index field, this field must be a numeric auto increment column
-$form["db_table_idx"]	= "support_message_id";
+$form["db_table_idx"] = "support_message_id";
 
 //* Shall changes to this table be stored in the database history (sys_datalog) table.
 //* This should be set to "yes" for all tables that store configuration information.
-$form["db_history"]		= "no"; // yes / no
+$form["db_history"]  = "no"; // yes / no
 
 //* The name of the tab that is shown when the form is opened
-$form["tab_default"]	= "message";
+$form["tab_default"] = "message";
 
 //* The name of the default list file of this form
-$form["list_default"]	= "support_message_list.php";
+$form["list_default"] = "support_message_list.php";
 
 //* Use the internal authentication system for this table. This should
 //* be set to yes in most cases
-$form["auth"]			= 'yes'; // yes / no
+$form["auth"]   = 'yes'; // yes / no
 
 //* Authentication presets. The defaults below does not need to be changed in most cases.
 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
@@ -45,12 +45,12 @@ $sm_default_recipient_id = '';
 $sm_default_subject = '';
 if(isset($_GET['reply']))
 {
-	$sm_msg_id = preg_replace("/[^0-9]/","",$_GET['reply']);
+	$sm_msg_id = preg_replace("/[^0-9]/", "", $_GET['reply']);
 	$res = $app->db->queryOneRecord("SELECT sender_id, subject FROM support_message WHERE support_message_id=$sm_msg_id");
 	if($res['sender_id'])
 	{
-		$sm_default_recipient_id = $res['sender_id'];	
-		$sm_default_subject = (preg_match("/^Re:/",$res['subject'])?"":"Re: ") . $res['subject'];
+		$sm_default_recipient_id = $res['sender_id'];
+		$sm_default_subject = (preg_match("/^Re:/", $res['subject'])?"":"Re: ") . $res['subject'];
 	}
 }
 
@@ -59,75 +59,75 @@ $authsql = $app->tform->getAuthSQL('r', 'client');
 //* Begin of the form definition of the first tab. The name of the tab is called "message". We refer
 //* to this name in the $form["tab_default"] setting above.
 $form["tabs"]['message'] = array (
-	'title' 	=> "Message", // Title of the Tab
-	'width' 	=> 100, // Tab width
-	'template' 	=> "templates/support_message_edit.htm", // Template file name
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Message", // Title of the Tab
+	'width'  => 100, // Tab width
+	'template'  => "templates/support_message_edit.htm", // Template file name
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'recipient_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> $sm_default_recipient_id,
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'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'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'recipient_id_is_not_integer'),
-									),
-			'value'		=> ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => $sm_default_recipient_id,
+			'datasource' => array (  'type'   => 'SQL',
+				'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'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'recipient_id_is_not_integer'),
+			),
+			'value'  => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
 		),
 		'sender_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
-										'keyfield'		=> 'userid',
-										'valuefield'	=> 'username'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'recipient_id_is_not_integer'),
-									),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
+				'keyfield'  => 'userid',
+				'valuefield' => 'username'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'recipient_id_is_not_integer'),
+			),
+			'value'  => ''
 		),
 		'subject' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'subject_is_empty'),
-									),
-			'default'	=> $sm_default_subject,
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'subject_is_empty'),
+			),
+			'default' => $sm_default_subject,
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'message' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXTAREA',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'message_is_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXTAREA',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'message_is_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '10',
+			'maxlength' => '255'
 		),
 		'tstamp' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> time(),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '30'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => time(),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '30'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/help/index.php b/interface/web/help/index.php
index 93204bc52586a7f8e6c63998048328bdb2402d77..5aa5f9cf6f9e686bed7220bd58a599fc132df7cf 100644
--- a/interface/web/help/index.php
+++ b/interface/web/help/index.php
@@ -13,4 +13,4 @@
   <p>&nbsp;</p>
 </div>
 </BODY>
-</HTML>
\ No newline at end of file
+</HTML>
diff --git a/interface/web/help/lib/admin.conf.php b/interface/web/help/lib/admin.conf.php
index b0163e53cb4df0a65e1c0bf6a881bf53b5926b42..62616b1019febe010446348dccd351c71902e44a 100644
--- a/interface/web/help/lib/admin.conf.php
+++ b/interface/web/help/lib/admin.conf.php
@@ -5,4 +5,4 @@
 */
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/lib/module.conf.php b/interface/web/help/lib/module.conf.php
index 0761a4cbf095a8fb1d1c406c90bf4ed246fd2113..bee099d1ba1a44661b838e24272c4d54f49b180f 100644
--- a/interface/web/help/lib/module.conf.php
+++ b/interface/web/help/lib/module.conf.php
@@ -31,52 +31,52 @@ $items = array();
 
 //* Add a menu item with the label 'Send message'
 $items[] = array( 'title'   => 'Send message',
-                  'target'  => 'content',
-                  'link'    => 'help/support_message_edit.php',
-                  'html_id' => 'help_message_send');
+	'target'  => 'content',
+	'link'    => 'help/support_message_edit.php',
+	'html_id' => 'help_message_send');
 
 //* Add a menu item with the label 'View messages'
 $items[] = array( 'title'   => 'View messages',
-                  'target'  => 'content',
-                  'link'    => 'help/support_message_list.php',
-                  'html_id' => 'help_message_list');
+	'target'  => 'content',
+	'link'    => 'help/support_message_list.php',
+	'html_id' => 'help_message_list');
 
 
 //* Add the menu items defined above to a menu section labeled 'Support'
 $module['nav'][] = array( 'title' => 'Support',
-                          'open'  => 1,
-                          'items'	=> $items);
+	'open'  => 1,
+	'items' => $items);
 
 //* the FAQ menu section
 $itemsfaq = array();
 //* admin's tools
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$itemsfaq[] = array( 	'title'		=> 'Manage Sections',
-							'target'	=> 'content',
-							'link'		=> 'help/faq_sections_list.php');
-	$itemsfaq[] = array( 	'title'		=> 'Manage Questions',
-							'target'	=> 'content',
-							'link'		=> 'help/faq_manage_questions_list.php');
-							
-	$module['nav'][] = array( 	'title'	=> 'FAQ',
-								'open'	=> 1,
-								'items'	=> $itemsfaq);
+	$itemsfaq[] = array(  'title'  => 'Manage Sections',
+		'target' => 'content',
+		'link'  => 'help/faq_sections_list.php');
+	$itemsfaq[] = array(  'title'  => 'Manage Questions',
+		'target' => 'content',
+		'link'  => 'help/faq_manage_questions_list.php');
+
+	$module['nav'][] = array(  'title' => 'FAQ',
+		'open' => 1,
+		'items' => $itemsfaq);
 }
 else
-{ //* the user
+	{ //* the user
 	$sql = "SELECT * FROM help_faq_sections";
 	$res = $app->db->queryAllRecords($sql);
 	//* all the content sections
 	if(is_array($res) && !empty($res)) {
 		foreach($res as $v) {
-			$itemsfaq[] = array( 	'title'		=> $v['hfs_name'],
-									'target'	=> 'content',
-									'link'		=> 'help/faq_list.php?hfs_id='.$v['hfs_id']);
+			$itemsfaq[] = array(  'title'  => $v['hfs_name'],
+				'target' => 'content',
+				'link'  => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
 		}
 		// Display 'FAQ' menu only if there are sections
-		$module['nav'][] = array( 	'title'	=> 'FAQ',
-									'open'	=> 1,
-									'items'	=> $itemsfaq);
+		$module['nav'][] = array(  'title' => 'FAQ',
+			'open' => 1,
+			'items' => $itemsfaq);
 	}
 }
 //* -- end of the FAQ menu section
@@ -84,23 +84,23 @@ else
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-//* make sure that the items array is empty
-$items = array();
+	//* make sure that the items array is empty
+	$items = array();
 
-//* Add a menu item with the label 'Version'
-$items[] = array( 'title'   => 'Version',
-                  'target'  => 'content',
-                  'link'    => 'help/version.php',
-                  'html_id' => 'help_version' );
+	//* Add a menu item with the label 'Version'
+	$items[] = array( 'title'   => 'Version',
+		'target'  => 'content',
+		'link'    => 'help/version.php',
+		'html_id' => 'help_version' );
 
 
-//* Add the menu items defined above to a menu section labeled 'Support'
-$module['nav'][] = array( 'title' => 'About ISPConfig',
-                          'open'  => 1,
-                          'items'	=> $items);
+	//* Add the menu items defined above to a menu section labeled 'Support'
+	$module['nav'][] = array( 'title' => 'About ISPConfig',
+		'open'  => 1,
+		'items' => $items);
 
 }
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/list/faq_list.php b/interface/web/help/list/faq_list.php
index 0893e90ce72c96e4ce10b142f6582561363b1a75..1f7e2bce857adcff241f5aaaee48c07cd403ebc2 100644
--- a/interface/web/help/list/faq_list.php
+++ b/interface/web/help/list/faq_list.php
@@ -10,7 +10,7 @@ $liste['table'] = 'help_faq';
 $liste['table_idx'] = 'hf_id';
 
 // Search Field Prefix
-#$liste['search_prefix'] = 'search_';
+//$liste['search_prefix'] = 'search_';
 
 // Records per page
 $liste['records_per_page']= 100;
diff --git a/interface/web/help/list/faq_manage_questions_list.php b/interface/web/help/list/faq_manage_questions_list.php
index 6bff574efae31519e1c12755e3e71f501f2fc6d3..aac10fa202f418fc59f5faae76c811fd8f3fca73 100644
--- a/interface/web/help/list/faq_manage_questions_list.php
+++ b/interface/web/help/list/faq_manage_questions_list.php
@@ -10,7 +10,7 @@ $liste['table'] = 'help_faq';
 $liste['table_idx'] = 'hf_id';
 
 // Search Field Prefix
-#$liste['search_prefix'] = 'search_';
+//$liste['search_prefix'] = 'search_';
 
 // Records per page
 $liste['records_per_page']= 30;
@@ -32,16 +32,16 @@ $liste['auth'] = 'yes';
 
 
 $liste["item"][] = array(   'field'     => "hf_section",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'datasource'    => array (  'type'  => 'SQL',
-														'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)',
-                                                        'keyfield'=> 'hf_section',
-                                                        'valuefield'=> 'hfs_name'
-                                                      ),
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'datasource'    => array (  'type'  => 'SQL',
+		'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)',
+		'keyfield'=> 'hf_section',
+		'valuefield'=> 'hfs_name'
+	),
+	'width'     => "",
+	'value'     => "");
 ?>
diff --git a/interface/web/help/list/faq_sections_list.php b/interface/web/help/list/faq_sections_list.php
index 59e30e75619e963c99095642b7bfe5e884167649..cfe391516bd16290f599caf69ab85ee233a64f74 100644
--- a/interface/web/help/list/faq_sections_list.php
+++ b/interface/web/help/list/faq_sections_list.php
@@ -10,7 +10,7 @@ $liste['table'] = 'help_faq_sections';
 $liste['table_idx'] = 'hfs_id';
 
 // Search Field Prefix
-#$liste['search_prefix'] = 'search_';
+//$liste['search_prefix'] = 'search_';
 
 // Records per page
 $liste['records_per_page'] = 100;
diff --git a/interface/web/help/list/support_message.list.php b/interface/web/help/list/support_message.list.php
index 14749595f7dc30cc572ddd609a339331f35aaa2f..1724c5489b3f32b30cc571dad473ba5b676232bc 100644
--- a/interface/web/help/list/support_message.list.php
+++ b/interface/web/help/list/support_message.list.php
@@ -1,71 +1,71 @@
 <?php
 
 //* Name of the list
-$liste['name'] 				= 'support_message';
+$liste['name']     = 'support_message';
 
 //* Database table
-$liste['table'] 			= 'support_message';
+$liste['table']    = 'support_message';
 
 //* Index index field of the database table
-$liste['table_idx']			= 'support_message_id';
+$liste['table_idx']   = 'support_message_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= 15;
+$liste['records_per_page']  = 15;
 
 //* Script File of the list
-$liste['file']				= 'support_message_list.php';
+$liste['file']    = 'support_message_list.php';
 
 //* Script file of the edit form
-$liste['edit_file']			= 'support_message_edit.php';
+$liste['edit_file']   = 'support_message_edit.php';
 
 //* Script File of the delete script
-$liste['delete_file']		= 'support_message_del.php';
+$liste['delete_file']  = 'support_message_del.php';
 
 //* Paging Template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'yes';
+$liste['auth']    = 'yes';
 
 
 /*****************************************************
 * Search fields
 *****************************************************/
 
-$liste['item'][] = array(	'field'		=> 'sender_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '',
-							'datasource'=> array ( 	'type' => 'SQL',
-										'querystring' 	=> 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
-										'keyfield'		=> 'userid',
-										'valuefield'	=> 'username'
-									 ),
-							'value'		=> '');
-
-$liste['item'][] = array(	'field'		=> 'subject',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'TEXT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'width'		=> '',
-							'value'		=> '');
-							
-$liste['item'][] = array(	'field'		=> 'tstamp',
-							'datatype'	=> 'DATETIMETSTAMP',
-							'formtype'	=> 'TEXT',
-							'op'		=> '=',
-							'prefix'	=> '',
-							'suffix'	=> '',
-							'width'		=> '',
-							'value'		=> '');
-
-
-?>
\ No newline at end of file
+$liste['item'][] = array( 'field'  => 'sender_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '',
+	'datasource'=> array (  'type' => 'SQL',
+		'querystring'  => 'SELECT userid,username FROM sys_user WHERE {AUTHSQL} ORDER BY username',
+		'keyfield'  => 'userid',
+		'valuefield' => 'username'
+	),
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'subject',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'width'  => '',
+	'value'  => '');
+
+$liste['item'][] = array( 'field'  => 'tstamp',
+	'datatype' => 'DATETIMETSTAMP',
+	'formtype' => 'TEXT',
+	'op'  => '=',
+	'prefix' => '',
+	'suffix' => '',
+	'width'  => '',
+	'value'  => '');
+
+
+?>
diff --git a/interface/web/help/support_message_del.php b/interface/web/help/support_message_del.php
index 63c23a0aa3036c157a9c5da186846fbf118bacc9..6b66d8ef4a12466cc95eeb187e5461ece31db40f 100644
--- a/interface/web/help/support_message_del.php
+++ b/interface/web/help/support_message_del.php
@@ -35,8 +35,8 @@ $list_def_file = 'list/support_message.list.php';
 $tform_def_file = 'form/support_message.tform.php';
 
 //* Include the base libraries
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('help');
@@ -45,4 +45,4 @@ $app->auth->check_module_permissions('help');
 $app->uses('tform_actions');
 $app->tform_actions->onDelete();
 
-?>
\ 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 b1cbf2a83aa452a0252870e021a8e3973850ac03..a3b6fa5a7ee58a6ea7eb057eac10e11613025c05 100644
--- a/interface/web/help/support_message_edit.php
+++ b/interface/web/help/support_message_edit.php
@@ -4,8 +4,8 @@
 $tform_def_file = 'form/support_message.tform.php';
 
 //* include the basic application and configuration files
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('help');
@@ -19,18 +19,18 @@ class page_action extends tform_actions {
 
 	//* Custom onSubmit Event handler
 	function onSubmit()
-    {
+	{
 		global $app, $conf;
-		
+
 		//* If the current user is not the admin user
 		if($_SESSION['s']['user']['typ'] != 'admin') {
 			//* Set the admin as recipient
 			$this->dataRecord['recipient_id'] = 1;
 		}
-		
+
 		//* 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";
@@ -41,7 +41,7 @@ class page_action extends tform_actions {
 			$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";
@@ -52,7 +52,7 @@ class page_action extends tform_actions {
 			$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'];
@@ -64,7 +64,7 @@ class page_action extends tform_actions {
 			$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');
@@ -77,47 +77,47 @@ class page_action extends tform_actions {
 		} 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();
 	}
-	
+
 	//* Custom onShow Event handler
-	function onShow() 
-    {
+	function onShow()
+	{
 		global $app, $conf;
 
-		//* We do not want that messages get edited, so we switch to a 
+		//* We do not want that messages get edited, so we switch to a
 		//*  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']));
-							}
-						}
+				// 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
 		parent::onShow();
 	}
-	
-	function onAfterInsert() 
-    {
+
+	function onAfterInsert()
+	{
 		global $app, $conf;
-		
+
 		if($_SESSION['s']['user']['typ'] == 'admin') {
 			$app->db->query("UPDATE support_message SET sys_userid = ".$this->dataRecord['recipient_id']." WHERE support_message_id = ".$this->id);
 		}
-		
+
 	}
-	
+
 }
 
 //* Create the new page object
@@ -126,4 +126,4 @@ $page = new page_action();
 //* Start the page rendering and action handling
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/support_message_list.php b/interface/web/help/support_message_list.php
index b2ac8c0952906fd84bb7e41138b5afcf022a7506..42db17de46e71650acba05bea4f266115ca9b80d 100644
--- a/interface/web/help/support_message_list.php
+++ b/interface/web/help/support_message_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Path to the list definition file
 $list_def_file = "list/support_message.list.php";
@@ -17,4 +17,4 @@ $app->listform_actions->SQLExtWhere = "support_message.recipient_id = ".$_SESSIO
 //* Start the form rendering and action ahndling
 $app->listform_actions->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/help/version.php b/interface/web/help/version.php
index dc0577e4a491526639f02c8d146b86e888798e4c..4110c96adc91b0273201314c2b3bf14663f75eb6 100644
--- a/interface/web/help/version.php
+++ b/interface/web/help/version.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/user_settings.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('help');
@@ -49,4 +49,4 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 	echo '<p>&nbsp;</p><p>&nbsp;</p><p class="frmTextHead" style="text-align:center;">'.$app->lng('ISPConfig Version:').' '.ISPC_APP_VERSION.'</p>';
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/index.php b/interface/web/index.php
index c0005bc56d3a3af803047952ae3627bd7f66700e..8b448419aee9e3576bcc5601688a521842742831 100644
--- a/interface/web/index.php
+++ b/interface/web/index.php
@@ -28,8 +28,8 @@ 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');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 if(!isset($_SESSION['s']['module']['name'])) $_SESSION['s']['module']['name'] = 'login';
 
@@ -41,37 +41,37 @@ $app->tpl->newTemplate('main.tpl.htm');
 $app->uses('getconf');
 $sys_config = $app->getconf->get_global_config('misc');
 if($sys_config['tab_change_warning'] == 'y') {
-    $app->tpl->setVar('tabchange_warning_enabled', 'y');
-    $app->tpl->setVar('global_tabchange_warning_txt', $app->lng('global_tabchange_warning_txt'));
+	$app->tpl->setVar('tabchange_warning_enabled', 'y');
+	$app->tpl->setVar('global_tabchange_warning_txt', $app->lng('global_tabchange_warning_txt'));
 } else {
-    $app->tpl->setVar('tabchange_warning_enabled', 'n');
+	$app->tpl->setVar('tabchange_warning_enabled', 'n');
 }
 $app->tpl->setVar('tabchange_discard_enabled', $sys_config['tab_change_discard']);
 if($sys_config['tab_change_discard'] == 'y') {
-    $app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
+	$app->tpl->setVar('global_tabchange_discard_txt', $app->lng('global_tabchange_discard_txt'));
 }
 
 if(isset($_SESSION['show_info_msg'])) {
-    $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-    unset($_SESSION['show_info_msg']);
+	$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+	unset($_SESSION['show_info_msg']);
 }
 if(isset($_SESSION['show_error_msg'])) {
-    $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-    unset($_SESSION['show_error_msg']);
+	$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+	unset($_SESSION['show_error_msg']);
 }
 
 // read js.d files
 $js_d = ISPC_WEB_PATH . '/js/js.d';
 $js_d_files = array();
 if(@is_dir($js_d)) {
-    $dir = opendir($js_d);
-    while($file = readdir($dir)) {
-        $filename = $js_d . '/' . $file;
-        if($file === '.' || $file === '..' || !is_file($filename)) continue;
-        if(substr($file, -3) !== '.js') continue;
-        $js_d_files[] = array('file' => $file);
-    }
-    closedir($dir);
+	$dir = opendir($js_d);
+	while($file = readdir($dir)) {
+		$filename = $js_d . '/' . $file;
+		if($file === '.' || $file === '..' || !is_file($filename)) continue;
+		if(substr($file, -3) !== '.js') continue;
+		$js_d_files[] = array('file' => $file);
+	}
+	closedir($dir);
 }
 
 $app->tpl->setLoop('js_d_includes', $js_d_files);
@@ -79,4 +79,4 @@ unset($js_d_files);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/js/scrigo.js.php b/interface/web/js/scrigo.js.php
index 33be65e01cbcfeb16299c7f5d1b5c1c333e0a115..3927b80f3bd9ad95158ba33f25023c30ec6b9f0c 100644
--- a/interface/web/js/scrigo.js.php
+++ b/interface/web/js/scrigo.js.php
@@ -1,13 +1,13 @@
 <?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');
-	
-	$app->uses('ini_parser,getconf');
-	$server_config_array = $app->getconf->get_global_config();
+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';
+
+$app->uses('ini_parser,getconf');
+$server_config_array = $app->getconf->get_global_config();
 ?>
 var pageFormChanged = false;
 var tabChangeWarningTxt = '';
@@ -22,10 +22,10 @@ var registeredHooks = new Array();
 redirect = '';
 
 function reportError(request) {
-	/* Error reporting is disabled by default as some browsers like safari 
-	   sometimes throw errors when a ajax request is delayed even if the 
+	/* Error reporting is disabled by default as some browsers like safari
+	   sometimes throw errors when a ajax request is delayed even if the
 	   ajax request worked. */
-	   
+
 	/*alert(request);*/
 }
 
@@ -54,7 +54,7 @@ function showLoadIndicator() {
 if($server_config_array['misc']['use_loadindicator'] == 'y'){
 ?>
     requestsRunning += 1;
-    
+
     if(requestsRunning < 2) {
         var indicator = jQuery('#ajaxloader');
         if(indicator.length < 1) {
@@ -64,7 +64,7 @@ if($server_config_array['misc']['use_loadindicator'] == 'y'){
         var parent = jQuery('#content');
         if(parent.length < 1) return;
         indicatorCompleted = false;
-        
+
         var atx = parent.offset().left + 150; //((parent.outerWidth(true) - indicator.outerWidth(true)) / 2);
         var aty = parent.offset().top + 150;
         indicator.css( {'left': atx, 'top': aty } ).fadeIn('fast', function() {
@@ -102,9 +102,9 @@ if($server_config_array['misc']['use_combobox'] == 'y'){
 }
 
 function loadContentRefresh(pagename) {
-	
+
   if(document.getElementById('refreshinterval').value > 0) {
-	var pageContentObject2 = jQuery.ajax({	type: "GET", 
+	var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
 											data: "refresh="+document.getElementById('refreshinterval').value,
 											dataType: "html",
@@ -127,8 +127,8 @@ function loadContentRefresh(pagename) {
 }
 
 function capp(module, redirect) {
-	var submitFormObj = jQuery.ajax({		type: "GET", 
-											url: "capp.php", 
+	var submitFormObj = jQuery.ajax({		type: "GET",
+											url: "capp.php",
 											data: "mod="+module+((redirect != undefined) ? '&redirect='+redirect : ''),
 											dataType: "html",
 											beforeSend: function() {
@@ -169,12 +169,12 @@ function submitLoginForm(formname) {
         passwordObj.focus();
         return;
     }
-	
+
 	$('#dummy_username').val(userNameObj.value);
 	$('#dummy_passwort').val(passwordObj.value);
 	$('#dummy_login_form').submit();
 
-	var submitFormObj = jQuery.ajax({		type: "POST", 
+	var submitFormObj = jQuery.ajax({		type: "POST",
 											url: "content.php",
 											data: jQuery('#'+formname).serialize(),
 											dataType: "html",
@@ -211,11 +211,11 @@ function submitLoginForm(formname) {
 	}
 	document.getElementById('footer').innerHTML = 'Powered by <a href="http://www.ispconfig.org" target="_blank">ISPConfig</a>';
 	*/
-	
+
 }
 
 function submitForm(formname,target) {
-	var submitFormObj = jQuery.ajax({		type: "POST", 
+	var submitFormObj = jQuery.ajax({		type: "POST",
 											url: target,
 											data: jQuery('#'+formname).serialize(),
 											dataType: "html",
@@ -253,7 +253,7 @@ function submitForm(formname,target) {
 function submitFormConfirm(formname,target,confirmation) {
 	var successMessage = arguments[3];
 	if(window.confirm(confirmation)) {
-		var submitFormObj = jQuery.ajax({	type: "POST", 
+		var submitFormObj = jQuery.ajax({	type: "POST",
 											url: target,
 											data: jQuery('#'+formname).serialize(),
 											dataType: "html",
@@ -284,10 +284,10 @@ function submitFormConfirm(formname,target,confirmation) {
 	}
 }
 
-function submitUploadForm(formname,target) {		
+function submitUploadForm(formname,target) {
 	var handleResponse = function(loadedFrame) {
 		var response, responseStr = loadedFrame.contentWindow.document.body.innerHTML;
-		
+
 		try {
 			response = JSON.parse(responseStr);
 		} catch(e) {
@@ -303,9 +303,9 @@ function submitUploadForm(formname,target) {
 			msg = msg+'<div id="errorMsg">'+errormsg+'</div>';
 		}
 		return msg;
-		
+
     };
-	
+
 	var frame_id = 'ajaxUploader-iframe-' + Math.round(new Date().getTime() / 1000);
 	jQuery('body').after('<iframe width="0" height="0" style="display:none;" name="'+frame_id+'" id="'+frame_id+'"/>');
 	jQuery('input[type="file"]').closest("form").attr({target: frame_id, action: target}).submit();
@@ -327,7 +327,7 @@ function submitUploadForm(formname,target) {
 
 function loadContent(pagename) {
   var params = arguments[1];
-  var pageContentObject2 = jQuery.ajax({	type: "GET", 
+  var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
                                             data: (params ? params : null),
 											dataType: "html",
@@ -346,7 +346,7 @@ function loadContent(pagename) {
 													//var reponse = jQuery(jqXHR.responseText);
 													//var reponseScript = reponse.filter("script");
 													//jQuery.each(reponseScript, function(idx, val) { eval(val.text); } );
-													
+
 													jQuery('#pageContent').html(jqXHR.responseText);
                                                     onAfterContentLoad(pagename, (params ? params : null));
                                                     pageFormChanged = false;
@@ -362,7 +362,7 @@ function loadContent(pagename) {
 
 
 function loadInitContent() {
-	var pageContentObject = jQuery.ajax({	type: "GET", 
+	var pageContentObject = jQuery.ajax({	type: "GET",
 											url: "content.php",
 											data: "s_mod=login&s_pg=index",
 											dataType: "html",
@@ -385,7 +385,7 @@ function loadInitContent() {
 												reportError('Ajax Request was not successful. 114');
 											}
 										});
-  
+
   loadMenus();
   keepalive();
   setTimeout("setFocus()",1000);
@@ -401,7 +401,7 @@ function setFocus() {
 
 
 function loadMenus() {
-  var sideNavObject = jQuery.ajax({			type: "GET", 
+  var sideNavObject = jQuery.ajax({			type: "GET",
 											url: "nav.php",
 											data: "nav=side",
 											dataType: "html",
@@ -417,8 +417,8 @@ function loadMenus() {
 												reportError('Ajax Request was not successful. 115');
 											}
 									});
-	
-  var topNavObject = jQuery.ajax({			type: "GET", 
+
+  var topNavObject = jQuery.ajax({			type: "GET",
 											url: "nav.php",
 											data: "nav=top",
 											dataType: "html",
@@ -440,7 +440,7 @@ function loadMenus() {
 function changeTab(tab,target,force) {
 	//document.forms[0].next_tab.value = tab;
 	document.pageForm.next_tab.value = tab;
-    
+
     var idel = jQuery('form#pageForm').find('[name="id"]');
     var id = null;
     if(idel.length > 0) id = idel.val();
@@ -466,7 +466,7 @@ function changeTab(tab,target,force) {
         }
     }
 }
-	
+
 function del_record(link,confirmation) {
   if(window.confirm(confirmation)) {
           loadContent(link);
@@ -480,7 +480,7 @@ function confirm_action(link,confirmation) {
 }
 
 function loadContentInto(elementid,pagename) {
-  var pageContentObject2 = jQuery.ajax({	type: "GET", 
+  var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
 											dataType: "html",
 											beforeSend: function() {
@@ -498,7 +498,7 @@ function loadContentInto(elementid,pagename) {
 }
 
 function loadOptionInto(elementid,pagename) {
-	var pageContentObject2 = jQuery.ajax({	type: "GET", 
+	var pageContentObject2 = jQuery.ajax({	type: "GET",
 											url: pagename,
 											dataType: "html",
 											beforeSend: function() {
@@ -526,7 +526,7 @@ function loadOptionInto(elementid,pagename) {
 }
 
 function keepalive() {
-	var pageContentObject3 = jQuery.ajax({	type: "GET", 
+	var pageContentObject3 = jQuery.ajax({	type: "GET",
 											url: "keepalive.php",
 											dataType: "html",
 											success: function(data, textStatus, jqXHR) {
@@ -581,24 +581,24 @@ function pass_check(password) {
 		pass_result(0);
 		return;
 	}
-	
+
 	if (length < 5) {
 		pass_result(1);
 		return;
 	}
-	
+
 	if (pass_contains(password, "ABCDEFGHIJKLNMOPQRSTUVWXYZ")) {
 		points += 1;
 	}
-	
+
 	if (pass_contains(password, "0123456789")) {
 		points += 1;
 	}
-	
+
 	if (pass_contains(password, "`~!@#$%^&*()_+|\=-[]}{';:/?.>,<\" ")) {
 		points += 1;
 	}
-	
+
 	if (points == 0) {
 		if (length >= 5 && length <=6) {
 			pass_result(1);
@@ -689,7 +689,7 @@ function delAdditionalTemplate(tpl_id){
 		var $el = jQuery('#template_additional_list ul').find('li[rel="' + tpl_id + '"]').eq(0); // only the first
         var addTplText = $el.text();
         $el.remove();
-        
+
 		var oldVal = tpl_add.split('/');
 		var newVal = new Array();
         for(var i = 0; i < oldVal.length; i++) {
@@ -713,7 +713,7 @@ function delAdditionalTemplate(tpl_id){
             }
             return this;
         });
-        
+
 		var newVal = tpl_add;
         var repl = new RegExp('(^|\/)' + addTplId + '(\/|$)');
 		newVal = newVal.replace(repl, '');
@@ -723,7 +723,7 @@ function delAdditionalTemplate(tpl_id){
   } else {
   	alert('no additional template selcted');
   }
-  
+
 }
 
 function getInternetExplorerVersion() {
@@ -814,7 +814,7 @@ jQuery('.addPlaceholderContent').live("click", function(){
 	var template2 = jQuery(this).siblings(':input');
 	template2.insertAtCaret(placeholderContentText);
 });
-		
+
 jQuery.fn.extend({
 	insertAtCaret: function(myValue){
 		return this.each(function(i) {
@@ -841,4 +841,3 @@ jQuery.fn.extend({
 		})
 	}
 });
-
diff --git a/interface/web/keepalive.php b/interface/web/keepalive.php
index fd9c1d7219e52a44f598b5eeadb7c85bdb0fe109..fe91978645ab8a1cd7c96a8e945846057b9ca002 100644
--- a/interface/web/keepalive.php
+++ b/interface/web/keepalive.php
@@ -30,7 +30,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 error_reporting(E_ALL|E_STRICT);
 
-require_once('../lib/config.inc.php');
-require_once('../lib/app.inc.php');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index 2c596f8b81455396078bfb97fc60effcefd1c8e2..950c692956624a92c1de312000fe671991ba8dae 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -51,7 +51,7 @@ class login_index {
 		$app->uses('tpl');
 		$app->tpl->newTemplate('form.tpl.htm');
 
-	    $error = '';
+		$error = '';
 
 		$app->load_language_file('web/login/lib/lang/'.$conf["language"].'.lng');
 
@@ -72,14 +72,14 @@ class login_index {
 			if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
 			if(!preg_match("/^.{1,64}$/i", $_POST['passwort'])) $error = $app->lng('pw_error_length');
 
-	        //** iporting variables
-	        $ip 	  = $app->db->quote(ip2long($_SERVER['REMOTE_ADDR']));
-	        $username = $app->db->quote($_POST['username']);
-	        $passwort = $app->db->quote($_POST['passwort']);
+			//** iporting variables
+			$ip    = $app->db->quote(ip2long($_SERVER['REMOTE_ADDR']));
+			$username = $app->db->quote($_POST['username']);
+			$passwort = $app->db->quote($_POST['passwort']);
 			$loginAs  = false;
 			$time = time();
 
-	        if($username != '' && $passwort != '' && $error == '') {
+			if($username != '' && $passwort != '' && $error == '') {
 				/*
 				 *  Check, if there is a "login as" instead of a "normal" login
 				 */
@@ -108,28 +108,28 @@ class login_index {
 					$loginAs = false;
 				}
 
-	        	//* Check if there are already wrong logins
-	        	$sql = "SELECT * FROM `attempts_login` WHERE `ip`= '{$ip}' AND  `login_time` > (NOW() - INTERVAL 1 MINUTE) LIMIT 1";
-	        	$alreadyfailed = $app->db->queryOneRecord($sql);
-	        	//* too many failedlogins
-	        	if($alreadyfailed['times'] > 5) {
-	        		$error = $app->lng('error_user_too_many_logins');
-	        	} else {
+				//* Check if there are already wrong logins
+				$sql = "SELECT * FROM `attempts_login` WHERE `ip`= '{$ip}' AND  `login_time` > (NOW() - INTERVAL 1 MINUTE) LIMIT 1";
+				$alreadyfailed = $app->db->queryOneRecord($sql);
+				//* too many failedlogins
+				if($alreadyfailed['times'] > 5) {
+					$error = $app->lng('error_user_too_many_logins');
+				} else {
 
 					if ($loginAs){
-			        	$sql = "SELECT * FROM sys_user WHERE USERNAME = '$username' and PASSWORT = '". $passwort. "'";
+						$sql = "SELECT * FROM sys_user WHERE USERNAME = '$username' and PASSWORT = '". $passwort. "'";
 						$user = $app->db->queryOneRecord($sql);
 					} else {
-						if(stristr($username,'@')) {
+						if(stristr($username, '@')) {
 							//* mailuser login
 							$sql = "SELECT * FROM mail_user WHERE login = '$username'";
 							$mailuser = $app->db->queryOneRecord($sql);
 							$user = false;
 							if($mailuser) {
 								$saved_password = stripslashes($mailuser['password']);
-								$salt = '$1$'.substr($saved_password,3,8).'$';
+								$salt = '$1$'.substr($saved_password, 3, 8).'$';
 								//* Check if mailuser password is correct
-								if(crypt(stripslashes($passwort),$salt) == $saved_password) {
+								if(crypt(stripslashes($passwort), $salt) == $saved_password) {
 									//* we build a fake user here which has access to the mailuser module only and userid 0
 									$user = array();
 									$user['userid'] = 0;
@@ -155,11 +155,11 @@ class login_index {
 							if($user) {
 								$saved_password = stripslashes($user['passwort']);
 
-								if(substr($saved_password,0,3) == '$1$') {
+								if(substr($saved_password, 0, 3) == '$1$') {
 									//* The password is crypt-md5 encrypted
-									$salt = '$1$'.substr($saved_password,3,8).'$';
+									$salt = '$1$'.substr($saved_password, 3, 8).'$';
 
-									if(crypt(stripslashes($passwort),$salt) != $saved_password) {
+									if(crypt(stripslashes($passwort), $salt) != $saved_password) {
 										$user = false;
 									}
 								} else {
@@ -175,8 +175,8 @@ class login_index {
 						}
 					}
 
-		            if($user) {
-		                if($user['active'] == 1) {
+					if($user) {
+						if($user['active'] == 1) {
 							// Maintenance mode - allow logins only when maintenance mode is off or if the user is admin
 							if(!$maintenance_mode || $user['typ'] == 'admin'){
 								// User login right, so attempts can be deleted
@@ -194,34 +194,34 @@ class login_index {
 								$_SESSION["s"]['theme'] = $_SESSION['s']['user']['theme'];
 
 								if(is_file($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php')) {
-									include_once($_SESSION['s']['user']['startmodule'].'/lib/module.conf.php');
-                                    $menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
-
-                                    if (is_dir($menu_dir)) {
-                                        if ($dh = opendir($menu_dir)) {
-                                            //** Go through all files in the menu dir
-                                            while (($file = readdir($dh)) !== false) {
-                                                if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
-                                                    include_once($menu_dir . '/' . $file);
-                                                }
-                                            }
-                                        }
-                                    }
+									include_once $_SESSION['s']['user']['startmodule'].'/lib/module.conf.php';
+									$menu_dir = ISPC_WEB_PATH.'/' . $_SESSION['s']['user']['startmodule'] . '/lib/menu.d';
+
+									if (is_dir($menu_dir)) {
+										if ($dh = opendir($menu_dir)) {
+											//** Go through all files in the menu dir
+											while (($file = readdir($dh)) !== false) {
+												if ($file != '.' && $file != '..' && substr($file, -9, 9) == '.menu.php' && $file != 'dns_resync.menu.php') {
+													include_once $menu_dir . '/' . $file;
+												}
+											}
+										}
+									}
 									$_SESSION['s']['module'] = $module;
 								}
-                                
-                                // check if the user theme is valid
-                                if($_SESSION['s']['user']['theme'] != 'default') {
-                                    $tmp_path = ISPC_THEMES_PATH."/".$_SESSION['s']['user']['theme'];
-                                    if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ispconfig_version") || trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION) {
-                                        // fall back to default theme if this one is not compatible with current ispc version
-                                        $_SESSION['s']['user']['theme'] = 'default';
-                                        $_SESSION['s']['theme'] = 'default';
-                                        $_SESSION['show_error_msg'] = $app->lng('theme_not_compatible');
-                                    }
-                                }
-
-								$app->plugin->raiseEvent('login',$this);
+
+								// check if the user theme is valid
+								if($_SESSION['s']['user']['theme'] != 'default') {
+									$tmp_path = ISPC_THEMES_PATH."/".$_SESSION['s']['user']['theme'];
+									if(!@is_dir($tmp_path) || !@file_exists($tmp_path."/ispconfig_version") || trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION) {
+										// fall back to default theme if this one is not compatible with current ispc version
+										$_SESSION['s']['user']['theme'] = 'default';
+										$_SESSION['s']['theme'] = 'default';
+										$_SESSION['show_error_msg'] = $app->lng('theme_not_compatible');
+									}
+								}
+
+								$app->plugin->raiseEvent('login', $this);
 
 								//* Save successfull login message to var
 								$authlog = 'Successful login for user \''. $username .'\' from '. long2ip($ip) .' at '. date('Y-m-d H:i:s');
@@ -237,55 +237,55 @@ class login_index {
 
 								exit;
 							}
-		             	} else {
-		                	$error = $app->lng('error_user_blocked');
-		                }
-
-		        	} else {
-		        		if(!$alreadyfailed['times'] )
-		        		{
-		        			//* user login the first time wrong
-		        			$sql = "INSERT INTO `attempts_login` (`ip`, `times`, `login_time`) VALUES ('{$ip}', 1, NOW())";
-		        			$app->db->query($sql);
-		        		} elseif($alreadyfailed['times'] >= 1) {
-		        			//* update times wrong
-		        			$sql = "UPDATE `attempts_login` SET `times`=`times`+1, `login_time`=NOW() WHERE `login_time` >= '{$time}' LIMIT 1";
-		        			$app->db->query($sql);
-		        		}
-		            	//* Incorrect login - Username and password incorrect
-		                $error = $app->lng('error_user_password_incorrect');
-		                if($app->db->errorMessage != '') $error .= '<br />'.$app->db->errorMessage != '';
-
-						$app->plugin->raiseEvent('login_failed',$this);
+						} else {
+							$error = $app->lng('error_user_blocked');
+						}
+
+					} else {
+						if(!$alreadyfailed['times'] )
+						{
+							//* user login the first time wrong
+							$sql = "INSERT INTO `attempts_login` (`ip`, `times`, `login_time`) VALUES ('{$ip}', 1, NOW())";
+							$app->db->query($sql);
+						} elseif($alreadyfailed['times'] >= 1) {
+							//* update times wrong
+							$sql = "UPDATE `attempts_login` SET `times`=`times`+1, `login_time`=NOW() WHERE `login_time` >= '{$time}' LIMIT 1";
+							$app->db->query($sql);
+						}
+						//* Incorrect login - Username and password incorrect
+						$error = $app->lng('error_user_password_incorrect');
+						if($app->db->errorMessage != '') $error .= '<br />'.$app->db->errorMessage != '';
+
+						$app->plugin->raiseEvent('login_failed', $this);
 
 						//* Save failed login message to var
 						$authlog = 'Failed login for user \''. $username .'\' from '. long2ip($ip) .' at '. date('Y-m-d H:i:s');
 						$authlog_handle = fopen($conf['ispconfig_log_dir'].'/auth.log', 'a');
 						fwrite($authlog_handle, $authlog ."\n");
 						fclose($authlog_handle);
-		           	}
-	        	}
+					}
+				}
 
-	      	} else {
-	       		//* Username or password empty
-	            if($error == '') $error = $app->lng('error_user_password_empty');
+			} else {
+				//* Username or password empty
+				if($error == '') $error = $app->lng('error_user_password_empty');
 
-				$app->plugin->raiseEvent('login_empty',$this);
-	        }
+				$app->plugin->raiseEvent('login_empty', $this);
+			}
 		}
 
 		// Maintenance mode - show message when people try to log in and also when people are forcedly logged off
 		if($maintenance_mode_error != '') $error = '<strong>'.$maintenance_mode_error.'</strong><br><br>'.$error;
 		if($error != ''){
-	  		$error = '<div class="box box_error"><h1>Error</h1>'.$error.'</div>';
+			$error = '<div class="box box_error"><h1>Error</h1>'.$error.'</div>';
 		}
 
 		$app->tpl->setVar('error', $error);
-        $app->tpl->setVar('pw_lost_txt', $app->lng('pw_lost_txt'));
+		$app->tpl->setVar('pw_lost_txt', $app->lng('pw_lost_txt'));
 		$app->tpl->setVar('username_txt', $app->lng('username_txt'));
 		$app->tpl->setVar('password_txt', $app->lng('password_txt'));
 		$app->tpl->setVar('login_button_txt', $app->lng('login_button_txt'));
-		$app->tpl->setInclude('content_tpl','login/templates/index.htm');
+		$app->tpl->setInclude('content_tpl', 'login/templates/index.htm');
 		$app->tpl_defaults();
 
 		$this->status = 'OK';
@@ -296,4 +296,4 @@ class login_index {
 
 } // << end class
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/login/lib/module.conf.php b/interface/web/login/lib/module.conf.php
index 477bd9edd2fd81cb7f901a561dd01b6d2d671de9..0936235bbb6e722f6384435d076ea4e8cba81e4c 100644
--- a/interface/web/login/lib/module.conf.php
+++ b/interface/web/login/lib/module.conf.php
@@ -1,6 +1,6 @@
 <?php
-$module["name"] 		= "login";
-$module["title"] 		= "top_menu_login";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "login/index.php";
-?>
\ No newline at end of file
+$module["name"]   = "login";
+$module["title"]   = "top_menu_login";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "login/index.php";
+?>
diff --git a/interface/web/login/logout.php b/interface/web/login/logout.php
index c56b73dec66037ddc04ccaae0a77f408e3bb2551..b2b1ac248ddd8c31f8b994f404900d9d2f0791ab 100644
--- a/interface/web/login/logout.php
+++ b/interface/web/login/logout.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /*
  * Check if the logout is forced
@@ -59,7 +59,7 @@ if ((isset($_SESSION['s_old']) && ($_SESSION['s_old']['user']['typ'] == 'admin')
 	exit;
 }
 
-$app->plugin->raiseEvent('logout',true);
+$app->plugin->raiseEvent('logout', true);
 
 $_SESSION["s"]["user"] = null;
 $_SESSION["s"]["module"] = null;
@@ -68,12 +68,12 @@ $_SESSION['s_old'] = null;
 //header("Location: ../index.php?phpsessid=".$_SESSION["s"]["id"]);
 
 if($_SESSION["s"]["site"]["logout"] != '') {
-	echo('URL_REDIRECT:'.$_SESSION["s"]["site"]["logout"]);
+	echo 'URL_REDIRECT:'.$_SESSION["s"]["site"]["logout"];
 } else {
 	if($conf["interface_logout_url"] != '') {
-		echo('URL_REDIRECT:'.$conf["interface_logout_url"]);
+		echo 'URL_REDIRECT:'.$conf["interface_logout_url"];
 	} else {
-		echo('URL_REDIRECT:index.php');
+		echo 'URL_REDIRECT:index.php';
 	}
 }
 // Destroy the session completely now
diff --git a/interface/web/login/password_reset.php b/interface/web/login/password_reset.php
index cea20568b992f9e223e59acbf4380ac5cf22d6ae..e29b1637dd0834f42e77197d3dcbc88e5137e9d6 100644
--- a/interface/web/login/password_reset.php
+++ b/interface/web/login/password_reset.php
@@ -28,39 +28,39 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/password_reset.htm');
+$app->tpl->setInclude('content_tpl', 'templates/password_reset.htm');
 
 $app->tpl_defaults();
 
-include(ISPC_ROOT_PATH.'/web/login/lib/lang/'.$_SESSION['s']['language'].'.lng');
+include ISPC_ROOT_PATH.'/web/login/lib/lang/'.$_SESSION['s']['language'].'.lng';
 $app->tpl->setVar($wb);
 
 if(isset($_POST['username']) && $_POST['username'] != '' && $_POST['email'] != '' && $_POST['username'] != 'admin') {
-	
+
 	if(!preg_match("/^[\w\.\-\_]{1,64}$/", $_POST['username'])) die($app->lng('user_regex_error'));
 	if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $_POST['email'])) die($app->lng('email_error'));
-	
+
 	$username = $app->db->quote($_POST['username']);
 	$email = $app->db->quote($_POST['email']);
-	
+
 	$client = $app->db->queryOneRecord("SELECT * FROM client WHERE username = '$username' AND email = '$email'");
 
 	if($client['client_id'] > 0) {
 		$new_password = $app->auth->get_random_password();
 		$new_password_encrypted = $app->auth->crypt_password($new_password);
 		$new_password_encrypted = $app->db->quote($new_password_encrypted);
-		
+
 		$username = $app->db->quote($client['username']);
 		$app->db->query("UPDATE sys_user SET passwort = '$new_password_encrypted' WHERE username = '$username'");
 		$app->db->query("UPDATE client SET password = '$new_password_encrypted' WHERE username = '$username'");
-		$app->tpl->setVar("message",$wb['pw_reset']);
-		
+		$app->tpl->setVar("message", $wb['pw_reset']);
+
 		$app->uses('getconf,ispcmail');
 		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config['smtp_enabled'] == 'y') {
@@ -72,15 +72,15 @@ if(isset($_POST['username']) && $_POST['username'] != '' && $_POST['email'] != '
 		$app->ispcmail->setMailText($wb['pw_reset_mail_msg'].$new_password);
 		$app->ispcmail->send(array($client['contact_name'] => $client['email']));
 		$app->ispcmail->finish();
-		
-		$app->plugin->raiseEvent('password_reset',true);
-		$app->tpl->setVar("msg",$wb['pw_reset']);
+
+		$app->plugin->raiseEvent('password_reset', true);
+		$app->tpl->setVar("msg", $wb['pw_reset']);
 	} else {
-		$app->tpl->setVar("error",$wb['pw_error']);
+		$app->tpl->setVar("error", $wb['pw_error']);
 	}
-	
+
 } else {
-	$app->tpl->setVar("msg",$wb['pw_error_noinput']);
+	$app->tpl->setVar("msg", $wb['pw_error_noinput']);
 }
 
 
@@ -91,4 +91,4 @@ $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_alias.tform.php b/interface/web/mail/form/mail_alias.tform.php
index 181cdc9f389755ba27d3652e1f719dacc6e983a7..e20ac765c861c0442518b91d5df23fbf15ef0d65 100644
--- a/interface/web/mail/form/mail_alias.tform.php
+++ b/interface/web/mail/form/mail_alias.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Alias";
-$form["description"] 	= "";
-$form["name"] 			= "mail_alias";
-$form["action"]			= "mail_alias_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "alias";
-$form["list_default"]	= "mail_alias_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Alias";
+$form["description"]  = "";
+$form["name"]    = "mail_alias";
+$form["action"]   = "mail_alias_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "alias";
+$form["list_default"] = "mail_alias_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,80 +56,80 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['alias'] = array (
-	'title' 	=> "Email Alias",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_alias_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email Alias",
+	'width'  => 100,
+	'template'  => "templates/mail_alias_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'		=> 'email',
-										'valuefield'	=> 'email'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'destination_error_isemail'),
-									),
-			'value'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'  => 'email',
+				'valuefield' => 'email'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'destination_error_isemail'),
+			),
+			'value'  => '',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('alias' => 'Alias','forward'=>'Forward')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('alias' => 'Alias', 'forward'=>'Forward')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_aliasdomain.tform.php b/interface/web/mail/form/mail_aliasdomain.tform.php
index 29ed73f9853053b0bba227cead9c6ab8485622ce..fb935003bb65e53e5f2d1e0a77075170eca9a743 100644
--- a/interface/web/mail/form/mail_aliasdomain.tform.php
+++ b/interface/web/mail/form/mail_aliasdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Domain Alias";
-$form["description"] 	= "";
-$form["name"] 			= "mail_aliasdomain";
-$form["action"]			= "mail_aliasdomain_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "alias";
-$form["list_default"]	= "mail_aliasdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Domain Alias";
+$form["description"]  = "";
+$form["name"]    = "mail_aliasdomain";
+$form["action"]   = "mail_aliasdomain_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "alias";
+$form["list_default"] = "mail_aliasdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,79 +56,79 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['alias'] = array (
-	'title' 	=> "Domain Alias",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_aliasdomain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain Alias",
+	'width'  => 100,
+	'template'  => "templates/mail_aliasdomain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'source_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,10}$/',
-														'errmsg'=> 'source_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'source_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^\@[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,10}$/',
+					'errmsg'=> 'source_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('alias' => 'Alias','forward'=>'Forward')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('alias' => 'Alias', 'forward'=>'Forward')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_blacklist.tform.php b/interface/web/mail/form/mail_blacklist.tform.php
index df63f7f75523a6c729a4fe7571d3fd6b46aea7e3..66d63ac617b8b48efd5b2483b1b76c3c3a34e824 100644
--- a/interface/web/mail/form/mail_blacklist.tform.php
+++ b/interface/web/mail/form/mail_blacklist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Email Blacklist";
-$form["description"] 	= "";
-$form["name"] 			= "mail_blacklist";
-$form["action"]			= "mail_blacklist_edit.php";
-$form["db_table"]		= "mail_access";
-$form["db_table_idx"]	= "access_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "blacklist";
-$form["list_default"]	= "mail_blacklist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Blacklist";
+$form["description"]  = "";
+$form["name"]    = "mail_blacklist";
+$form["action"]   = "mail_blacklist_edit.php";
+$form["db_table"]  = "mail_access";
+$form["db_table_idx"] = "access_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "blacklist";
+$form["list_default"] = "mail_blacklist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,60 +51,60 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['blacklist'] = array (
-	'title' 	=> "Blacklist",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_blacklist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Blacklist",
+	'width'  => 100,
+	'template'  => "templates/mail_blacklist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'REJECT',
-			'value'		=> 'REJECT',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'REJECT',
+			'value'  => 'REJECT',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_content_filter.tform.php b/interface/web/mail/form/mail_content_filter.tform.php
index a838e0abee8798cbf8a6949995df0b652eca04b2..517174d9651ab39ad6bd1e3a7c60cc7bf057415e 100644
--- a/interface/web/mail/form/mail_content_filter.tform.php
+++ b/interface/web/mail/form/mail_content_filter.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Mail Content Filter";
-$form["description"] 	= "";
-$form["name"] 			= "mail_content_filter";
-$form["action"]			= "mail_content_filter_edit.php";
-$form["db_table"]		= "mail_content_filter";
-$form["db_table_idx"]	= "content_filter_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "filter";
-$form["list_default"]	= "mail_content_filter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mail Content Filter";
+$form["description"]  = "";
+$form["name"]    = "mail_content_filter";
+$form["action"]   = "mail_content_filter_edit.php";
+$form["db_table"]  = "mail_content_filter";
+$form["db_table_idx"] = "content_filter_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "filter";
+$form["list_default"] = "mail_content_filter_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,66 +51,66 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['filter'] = array (
-	'title' 	=> "Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_content_filter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_content_filter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('header' => 'Header Filter','body' => 'Body Filter','mime_header' => 'MIME-Header Filter','nested_header' => 'Nested-Header Filter')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('header' => 'Header Filter', 'body' => 'Body Filter', 'mime_header' => 'MIME-Header Filter', 'nested_header' => 'Nested-Header Filter')
 		),
 		'pattern' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'pattern_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'pattern_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'data' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('DISCARD' => 'DISCARD','DUNNO'=>'DUNNO','FILTER'=>'FILTER','HOLD'=>'HOLD','IGNORE'=>'IGNORE','PREPEND'=>'PREPEND','REDIRECT'=>'REDIRECT','REPLACE'=>'REPLACE','REJECT'=>'REJECT','WARN'=>'WARN')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('DISCARD' => 'DISCARD', 'DUNNO'=>'DUNNO', 'FILTER'=>'FILTER', 'HOLD'=>'HOLD', 'IGNORE'=>'IGNORE', 'PREPEND'=>'PREPEND', 'REDIRECT'=>'REDIRECT', 'REPLACE'=>'REPLACE', 'REJECT'=>'REJECT', 'WARN'=>'WARN')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_domain.tform.php b/interface/web/mail/form/mail_domain.tform.php
index caf48d50b363c809e0b8abcaf89666dd6f41fe29..398b76e76f96348c7f9503d02f6802c25eb234e0 100644
--- a/interface/web/mail/form/mail_domain.tform.php
+++ b/interface/web/mail/form/mail_domain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Mail Domain";
-$form["description"] 	= "";
-$form["name"] 			= "mail_domain";
-$form["action"]			= "mail_domain_edit.php";
-$form["db_table"]		= "mail_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "mail_domain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mail Domain";
+$form["description"]  = "";
+$form["name"]    = "mail_domain";
+$form["action"]   = "mail_domain_edit.php";
+$form["db_table"]  = "mail_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "mail_domain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,84 +56,84 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_domain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/mail_domain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'domain_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'domain_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
-                'dkim' => array (
-                        'datatype'      => 'VARCHAR',
-                        'formtype'      => 'CHECKBOX',
-                        'default'       => 'n',
-                        'value'         => array(0 => 'n',1 => 'y')
-                ),
-                'dkim_private' => array (
-                        'datatype'      => 'TEXT',
-                        'formtype'      => 'TEXTAREA',
-                        'default'       => '',
-                        'value'         => '',
-                        'cols'          => '30',
-                        'rows'          => '10',
-                        'validators'    => array (  0 => array ('type'  => 'CUSTOM',
-                                                                'class' => 'validate_dkim',
-                                                                'function' => 'check_private_key',
-                                                                'errmsg'=> 'dkim_private_key_error'),
-                                    ),
-                ),
-                'dkim_public' => array (
-                        'datatype'      => 'TEXT',
-                        'formtype'      => 'TEXTAREA',
-                        'default'       => '',
-                        'value'         => '',
-                        'cols'          => '30',
-                        'rows'          => '10'
-                ),
+		'dkim' => array (
+			'datatype'      => 'VARCHAR',
+			'formtype'      => 'CHECKBOX',
+			'default'       => 'n',
+			'value'         => array(0 => 'n', 1 => 'y')
+		),
+		'dkim_private' => array (
+			'datatype'      => 'TEXT',
+			'formtype'      => 'TEXTAREA',
+			'default'       => '',
+			'value'         => '',
+			'cols'          => '30',
+			'rows'          => '10',
+			'validators'    => array (  0 => array ('type'  => 'CUSTOM',
+					'class' => 'validate_dkim',
+					'function' => 'check_private_key',
+					'errmsg'=> 'dkim_private_key_error'),
+			),
+		),
+		'dkim_public' => array (
+			'datatype'      => 'TEXT',
+			'formtype'      => 'TEXTAREA',
+			'default'       => '',
+			'value'         => '',
+			'cols'          => '30',
+			'rows'          => '10'
+		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mail/form/mail_domain_catchall.tform.php b/interface/web/mail/form/mail_domain_catchall.tform.php
index ea8fb564aa664d6f1f491b73bcdc0f63c406340f..8d0c0296bdcbe756479d3a127316b6fc4702178f 100644
--- a/interface/web/mail/form/mail_domain_catchall.tform.php
+++ b/interface/web/mail/form/mail_domain_catchall.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Catchall";
-$form["description"] 	= "";
-$form["name"] 			= "mail_domain_catchall";
-$form["action"]			= "mail_domain_catchall_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "catchall";
-$form["list_default"]	= "mail_domain_catchall_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Catchall";
+$form["description"]  = "";
+$form["name"]    = "mail_domain_catchall";
+$form["action"]   = "mail_domain_catchall_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "catchall";
+$form["list_default"] = "mail_domain_catchall_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,56 +56,56 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['catchall'] = array (
-	'title' 	=> "Email Catchall",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_domain_catchall_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email Catchall",
+	'width'  => 100,
+	'template'  => "templates/mail_domain_catchall_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'domain_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,30}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'domain_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,30}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
 			/*
 			'datasource'	=> array ( 	'type'			=> 'SQL',
 										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
@@ -113,30 +113,30 @@ $form["tabs"]['catchall'] = array (
 										'valuefield'	=> 'email'
 									 ),
 			*/
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'destination_error_isemail'),
-									),
-			'value'		=> '',
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'destination_error_isemail'),
+			),
+			'value'  => '',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('alias' => 'Alias','forward'=>'Forward','catchall'=>'Catchall')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('alias' => 'Alias', 'forward'=>'Forward', 'catchall'=>'Catchall')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_forward.tform.php b/interface/web/mail/form/mail_forward.tform.php
index cdfb785f345c0e16d4512f0c2d9032c4d520b521..dcd5e5478e6b4968cd859c1082f446d5f764d120 100644
--- a/interface/web/mail/form/mail_forward.tform.php
+++ b/interface/web/mail/form/mail_forward.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Forward";
-$form["description"] 	= "";
-$form["name"] 			= "mail_forward";
-$form["action"]			= "mail_forward_edit.php";
-$form["db_table"]		= "mail_forwarding";
-$form["db_table_idx"]	= "forwarding_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "forward";
-$form["list_default"]	= "mail_forward_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Forward";
+$form["description"]  = "";
+$form["name"]    = "mail_forward";
+$form["action"]   = "mail_forward_edit.php";
+$form["db_table"]  = "mail_forwarding";
+$form["db_table_idx"] = "forwarding_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "forward";
+$form["list_default"] = "mail_forward_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,74 +56,74 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['forward'] = array (
-	'title' 	=> "Email Forward",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_forward_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email Forward",
+	'width'  => 100,
+	'template'  => "templates/mail_forward_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('forward'=>'Forward','alias' => 'Alias')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('forward'=>'Forward', 'alias' => 'Alias')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_get.tform.php b/interface/web/mail/form/mail_get.tform.php
index e23c4e1b24da403682795385c7343f16cf9d1ef9..7ed96994b4f202add9d91e9a63b47ffdf7d9bbca 100644
--- a/interface/web/mail/form/mail_get.tform.php
+++ b/interface/web/mail/form/mail_get.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Get Email";
-$form["description"] 	= "";
-$form["name"] 			= "mail_get";
-$form["action"]			= "mail_get_edit.php";
-$form["db_table"]		= "mail_get";
-$form["db_table_idx"]	= "mailget_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailget";
-$form["list_default"]	= "mail_get_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Get Email";
+$form["description"]  = "";
+$form["name"]    = "mail_get";
+$form["action"]   = "mail_get_edit.php";
+$form["db_table"]  = "mail_get";
+$form["db_table_idx"] = "mailget_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailget";
+$form["list_default"] = "mail_get_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,122 +56,122 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailget'] = array (
-	'title' 	=> "Get Email",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_get_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Get Email",
+	'width'  => 100,
+	'template'  => "templates/mail_get_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value' => array('pop3' => 'POP3','imap'=>'IMAP','pop3ssl' => 'POP3SSL','imapssl'=>'IMAPSSL'),
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value' => array('pop3' => 'POP3', 'imap'=>'IMAP', 'pop3ssl' => 'POP3SSL', 'imapssl'=>'IMAPSSL'),
 			'searchable' => 2
 		),
 		'source_server' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_server_error_isempty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z\-]{2,10}$/',
-														'errmsg'=> 'source_server_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_server_error_isempty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,64}\.[a-zA-Z\-]{2,10}$/',
+					'errmsg'=> 'source_server_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'source_username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_username_error_isempty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_username_error_isempty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'source_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_password_error_isempty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_password_error_isempty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source_delete' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'source_read_all' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'destination' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'			=> 'SQL',
-										'querystring' 	=> 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'		=> 'email',
-										'valuefield'	=> 'email'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'destination_error_isemail'),
-									),
-			'value'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'datasource' => array (  'type'   => 'SQL',
+				'querystring'  => 'SELECT email FROM mail_user WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'  => 'email',
+				'valuefield' => 'email'
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'destination_error_isemail'),
+			),
+			'value'  => '',
 			'searchable' => 1
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_mailinglist.tform.php b/interface/web/mail/form/mail_mailinglist.tform.php
index 3166c26a2be272ad0df07c0f17c45e3cf95259ff..dbd7c0e042245b60a35857b29cb18511c047722f 100644
--- a/interface/web/mail/form/mail_mailinglist.tform.php
+++ b/interface/web/mail/form/mail_mailinglist.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Mailing List";
-$form["description"] 	= "";
-$form["name"] 			= "mail_mailinglist";
-$form["action"]			= "mail_mailinglist_edit.php";
-$form["db_table"]		= "mail_mailinglist";
-$form["db_table_idx"]	= "mailinglist_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailinglist";
-$form["list_default"]	= "mail_mailinglist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mailing List";
+$form["description"]  = "";
+$form["name"]    = "mail_mailinglist";
+$form["action"]   = "mail_mailinglist_edit.php";
+$form["db_table"]  = "mail_mailinglist";
+$form["db_table_idx"] = "mailinglist_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailinglist";
+$form["list_default"] = "mail_mailinglist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,91 +56,91 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailinglist'] = array (
-	'title' 	=> "Mailing List",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_mailinglist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mailing List",
+	'width'  => 100,
+	'template'  => "templates/mail_mailinglist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'	=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mail_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value' => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'domain_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
-														'errmsg'=> 'domain_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'domain_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z\-]{2,10}$/',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'listname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'listname_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'listname_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'listname_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'listname_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CLEARTEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_relay_recipient.tform.php b/interface/web/mail/form/mail_relay_recipient.tform.php
index 69dfe2825064df3a8733a2c88923c44fd27c686e..be8066869c4cd416d7b06603f0b09d1badf60834 100644
--- a/interface/web/mail/form/mail_relay_recipient.tform.php
+++ b/interface/web/mail/form/mail_relay_recipient.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Email relay recipient";
-$form["description"] 	= "";
-$form["name"] 			= "mail_relay_recipient";
-$form["action"]			= "mail_relay_recipient_edit.php";
-$form["db_table"]		= "mail_relay_recipient";
-$form["db_table_idx"]	= "relay_recipient_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "relay_recipient";
-$form["list_default"]	= "mail_relay_recipient_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email relay recipient";
+$form["description"]  = "";
+$form["name"]    = "mail_relay_recipient";
+$form["action"]   = "mail_relay_recipient_edit.php";
+$form["db_table"]  = "mail_relay_recipient";
+$form["db_table_idx"] = "relay_recipient_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "relay_recipient";
+$form["list_default"] = "mail_relay_recipient_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,54 +51,54 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['relay_recipient'] = array (
-	'title' 	=> "Relay recipient",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_relay_recipient_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Relay recipient",
+	'width'  => 100,
+	'template'  => "templates/mail_relay_recipient_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'OK',
-			'value'		=> 'OK',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'OK',
+			'value'  => 'OK',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_spamfilter.tform.php b/interface/web/mail/form/mail_spamfilter.tform.php
index aee5d855dfd894403e3a0882883ec3b728c5ed51..a197c3ef57d4b9757c3e63091931773ed510c156 100644
--- a/interface/web/mail/form/mail_spamfilter.tform.php
+++ b/interface/web/mail/form/mail_spamfilter.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter";
-$form["description"] 	= "";
-$form["name"] 			= "mail_spamfilter";
-$form["action"]			= "mail_spamfilter_edit.php";
-$form["db_table"]		= "mail_spamfilter";
-$form["db_table_idx"]	= "spamfilter_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "spamfilter";
-$form["list_default"]	= "mail_spamfilter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter";
+$form["description"]  = "";
+$form["name"]    = "mail_spamfilter";
+$form["action"]   = "mail_spamfilter_edit.php";
+$form["db_table"]  = "mail_spamfilter";
+$form["db_table_idx"] = "spamfilter_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "spamfilter";
+$form["list_default"] = "mail_spamfilter_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,96 +51,96 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['spamfilter'] = array (
-	'title' 	=> "Spamfilter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_spamfilter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Spamfilter",
+	'width'  => 100,
+	'template'  => "templates/mail_spamfilter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'email_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'email_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_rewrite_score_int' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '5.00',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '5.00',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'spam_redirect_score_int' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '7.00',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '7.00',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'spam_delete_score_int' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '15.00',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '15.00',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'spam_rewrite_subject' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '***SPAM***',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '***SPAM***',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_redirect_maildir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT mailbox_id,email FROM mail_box WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'=> 'mailbox_id',
-										'valuefield'=> 'email'
-									 ),
-			'default'	=> '',
-			'value'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT mailbox_id,email FROM mail_box WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'=> 'mailbox_id',
+				'valuefield'=> 'email'
+			),
+			'default' => '',
+			'value'  => ''
 		),
 		'spam_redirect_maildir_purge' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '7',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '7',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_transport.tform.php b/interface/web/mail/form/mail_transport.tform.php
index a7ae27d990b668246b6bc9662aa278243ceddde4..000584246bbd0b8999832707ab5360732ab4cdb9 100644
--- a/interface/web/mail/form/mail_transport.tform.php
+++ b/interface/web/mail/form/mail_transport.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Email Routing";
-$form["description"] 	= "";
-$form["name"] 			= "mail_transport";
-$form["action"]			= "mail_transport_edit.php";
-$form["db_table"]		= "mail_transport";
-$form["db_table_idx"]	= "transport_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "transport";
-$form["list_default"]	= "mail_transport_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Routing";
+$form["description"]  = "";
+$form["name"]    = "mail_transport";
+$form["action"]   = "mail_transport_edit.php";
+$form["db_table"]  = "mail_transport";
+$form["db_table_idx"] = "transport_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "transport";
+$form["list_default"] = "mail_transport_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,67 +56,67 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['transport'] = array (
-	'title' 	=> "Email transport",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_transport_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Email transport",
+	'width'  => 100,
+	'template'  => "templates/mail_transport_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'transport' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'sort_order' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php
index ddccdbf060a0e8ed4c15fe3a633535c62cf2c6cc..0f5248a9daf68c990b132f0fc3a126417e642ed7 100644
--- a/interface/web/mail/form/mail_user.tform.php
+++ b/interface/web/mail/form/mail_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -41,16 +41,16 @@ global $app;
 $app->uses('getconf');
 $global_config = $app->getconf->get_global_config();
 
-$form["title"] 			= "Mailbox";
-$form["description"] 	= "";
-$form["name"] 			= "mail_user";
-$form["action"]			= "mail_user_edit.php";
-$form["db_table"]		= "mail_user";
-$form["db_table_idx"]	= "mailuser_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailuser";
-$form["list_default"]	= "mail_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Mailbox";
+$form["description"]  = "";
+$form["name"]    = "mail_user";
+$form["action"]   = "mail_user_edit.php";
+$form["db_table"]  = "mail_user";
+$form["db_table_idx"] = "mailuser_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailuser";
+$form["list_default"] = "mail_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -59,152 +59,152 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "Mailbox",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_mailbox_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mailbox",
+	'width'  => 100,
+	'template'  => "templates/mail_user_mailbox_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISEMAIL',
-														'errmsg'=> 'email_error_isemail'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'email_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'ISEMAIL',
+					'errmsg'=> 'email_error_isemail'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'email_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
-    'login' => array (
-      'datatype'  => 'VARCHAR',
-      'formtype'  => 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-      'validators'  => array (
-                    0 => array (  'type'  => 'UNIQUE',
-                            'errmsg'=> 'login_error_unique'),
-                    1 => array (  'type'  => 'REGEX',
-                            'regex' => '/^[a-z0-9][\w\.\-_\+@]{1,63}$/',
-                            'errmsg'=> 'login_error_regex'),
-                  ),
-      'default' => '',
-      'value'   => '',
-      'width'   => '30',
-      'maxlength' => '255'
-    ),
+		'login' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'  => array (
+				0 => array (  'type'  => 'UNIQUE',
+					'errmsg'=> 'login_error_unique'),
+				1 => array (  'type'  => 'REGEX',
+					'regex' => '/^[a-z0-9][\w\.\-_\+@]{1,63}$/',
+					'errmsg'=> 'login_error_regex'),
+			),
+			'default' => '',
+			'value'   => '',
+			'width'   => '30',
+			'maxlength' => '255'
+		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'quota' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	1 => array (	'type'	=> 'ISINT',
-														'errmsg'=> 'quota_error_isint'),
-										0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,})$/',
-														'errmsg'=> 'quota_error_value'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  1 => array ( 'type' => 'ISINT',
+					'errmsg'=> 'quota_error_isint'),
+				0 => array ( 'type' => 'REGEX',
+					'regex' => '/^([0-9]{1,})$/',
+					'errmsg'=> 'quota_error_value'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'cc_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'cc_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'maildir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'homedir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'uid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'gid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '10'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '10'
 		),
 		'postfix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		/*
 		'access' => array (
@@ -215,75 +215,75 @@ $form["tabs"]['mailuser'] = array (
 		),
 		*/
 		'disableimap' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		'disablepop3' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
 	$form["tabs"]['autoresponder'] = array (
-		'title' 	=> "Autoresponder",
-		'width' 	=> 100,
-		'template' 	=> "templates/mail_user_autoresponder_edit.htm",
-		'fields' 	=> array (
-		##################################
-		# Begin Datatable fields
-		##################################
+		'title'  => "Autoresponder",
+		'width'  => 100,
+		'template'  => "templates/mail_user_autoresponder_edit.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
 			'autoresponder_subject' => array (
 				'datatype'  => 'VARCHAR',
 				'formtype'  => 'TEXT',
 				'default'   => 'Out of office reply',
 				'value'     => '',
-				'width'		=> '30',
-				'maxlength'	=> '255'
+				'width'  => '30',
+				'maxlength' => '255'
 			),
 			'autoresponder_text' => array (
-				'datatype'	=> 'TEXT',
-				'formtype'	=> 'TEXTAREA',
-				'default'	=> '',
-				'value'		=> '',
-				'cols'		=> '30',
-				'rows'		=> '15'
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '15'
 			),
 			'autoresponder' => array (
-				'datatype'	=> 'VARCHAR',
-				'formtype'	=> 'CHECKBOX',
-				'default'	=> 'n',
-				'value'		=> array(1 => 'y',0 => 'n')
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'n',
+				'value'  => array(1 => 'y', 0 => 'n')
 			),
 			'autoresponder_start_date' => array (
-				'datatype'	=> 'DATETIME',
-				'formtype'	=> 'DATETIME',
+				'datatype' => 'DATETIME',
+				'formtype' => 'DATETIME',
 				'validators'=> array ( 0 => array ( 'type' => 'CUSTOM',
-					'class' => 'validate_autoresponder',
-					'function' => 'start_date',
-					'errmsg'=> 'autoresponder_start_date_is_required'),
+						'class' => 'validate_autoresponder',
+						'function' => 'start_date',
+						'errmsg'=> 'autoresponder_start_date_is_required'),
 				)
 			),
 			'autoresponder_end_date' => array (
-				'datatype'	=> 'DATETIME',
-				'formtype'	=> 'DATETIME',
-				'validators'=> array ( 	0 => array (	'type'	=> 'CUSTOM',
-					'class' => 'validate_autoresponder',
-					'function' => 'end_date',
-					'errmsg'=> 'autoresponder_end_date_isgreater'),
-				 ),
+				'datatype' => 'DATETIME',
+				'formtype' => 'DATETIME',
+				'validators'=> array (  0 => array ( 'type' => 'CUSTOM',
+						'class' => 'validate_autoresponder',
+						'function' => 'end_date',
+						'errmsg'=> 'autoresponder_end_date_isgreater'),
+				),
 			),
-		##################################
-		# END Datatable fields
-		##################################
+			//#################################
+			// END Datatable fields
+			//#################################
 		)
 	);
 }
@@ -291,31 +291,31 @@ if ($global_config['mail']['mailbox_show_autoresponder_tab'] === 'y') {
 
 if ($global_config['mail']['mailbox_show_mail_filter_tab'] === 'y') {
 	$form["tabs"]['filter_records'] = array (
-		'title' 	=> "Mail Filter",
-		'width' 	=> 100,
-		'template' 	=> "templates/mail_user_mailfilter_edit.htm",
-		'fields' 	=> array (
-		##################################
-		# Begin Datatable fields
-		##################################
+		'title'  => "Mail Filter",
+		'width'  => 100,
+		'template'  => "templates/mail_user_mailfilter_edit.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
 			'move_junk' => array (
-				'datatype'	=> 'VARCHAR',
-				'formtype'	=> 'CHECKBOX',
-				'default'	=> 'n',
-				'value'		=> array(0 => 'n',1 => 'y')
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'n',
+				'value'  => array(0 => 'n', 1 => 'y')
 			),
-		##################################
-		# END Datatable fields
-		##################################
+			//#################################
+			// END Datatable fields
+			//#################################
 		),
 		'plugins' => array (
 			'filter_records' => array (
 				'class'   => 'plugin_listview',
 				'options' => array(
-						'listdef' => 'list/mail_user_filter.list.php',
-						'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
-						'sql_order_by' => "ORDER BY rulename"
-					)
+					'listdef' => 'list/mail_user_filter.list.php',
+					'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']),
+					'sql_order_by' => "ORDER BY rulename"
+				)
 			)
 		)
 	);
@@ -324,24 +324,24 @@ if ($global_config['mail']['mailbox_show_mail_filter_tab'] === 'y') {
 
 if ($_SESSION["s"]["user"]["typ"] == 'admin' && $global_config['mail']['mailbox_show_custom_rules_tab'] === 'y') {
 	$form["tabs"]['mailfilter'] = array (
-		'title' 	=> "Custom Rules",
-		'width' 	=> 100,
-		'template' 	=> "templates/mail_user_custom_rules_edit.htm",
-		'fields' 	=> array (
-		##################################
-		# Begin Datatable fields
-		##################################
+		'title'  => "Custom Rules",
+		'width'  => 100,
+		'template'  => "templates/mail_user_custom_rules_edit.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
 			'custom_mailfilter' => array (
-				'datatype'	=> 'TEXT',
-				'formtype'	=> 'TEXTAREA',
-				'default'	=> '',
-				'value'		=> '',
-				'cols'		=> '30',
-				'rows'		=> '15'
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '15'
 			),
-		##################################
-		# END Datatable fields
-		##################################
+			//#################################
+			// END Datatable fields
+			//#################################
 		)
 	);
 }
diff --git a/interface/web/mail/form/mail_user_filter.tform.php b/interface/web/mail/form/mail_user_filter.tform.php
index 8962e79ee6e53b1c10be4992db34299c4b668d7a..e001f684261db14b8073b791ad543438deef0976 100644
--- a/interface/web/mail/form/mail_user_filter.tform.php
+++ b/interface/web/mail/form/mail_user_filter.tform.php
@@ -34,16 +34,16 @@
 */
 global $app;
 
-$form["title"] 			= "Email filter";
-$form["description"] 	= "";
-$form["name"] 			= "mail_user_filter";
-$form["action"]			= "mail_user_filter_edit.php";
-$form["db_table"]		= "mail_user_filter";
-$form["db_table_idx"]	= "filter_id";
-$form["db_history"]		= "no";
-$form["tab_default"]	= "filter";
-$form["list_default"]	= "mail_user_filter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email filter";
+$form["description"]  = "";
+$form["name"]    = "mail_user_filter";
+$form["action"]   = "mail_user_filter_edit.php";
+$form["db_table"]  = "mail_user_filter";
+$form["db_table_idx"] = "filter_id";
+$form["db_history"]  = "no";
+$form["tab_default"] = "filter";
+$form["list_default"] = "mail_user_filter_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -52,83 +52,83 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['filter'] = array (
-	'title' 	=> "Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_filter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_user_filter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'mailuser_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["mailuser_id"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["mailuser_id"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'rulename' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'rulename_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'rulename_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('Subject' => 'subject_txt','From'=>'from_txt','To'=>'to_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('Subject' => 'subject_txt', 'From'=>'from_txt', 'To'=>'to_txt')
 		),
 		'op' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			#'value'		=> array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
-			'value'		=> array('contains'=>'contains_txt','is' => 'is_txt','begins'=>'begins_with_txt','ends'=>'ends_with_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			//'value'  => array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
+			'value'  => array('contains'=>'contains_txt', 'is' => 'is_txt', 'begins'=>'begins_with_txt', 'ends'=>'ends_with_txt')
 		),
 		'searchterm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'searchterm_is_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'searchterm_is_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('move' => 'move_to_txt','delete'=>'delete_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('move' => 'move_to_txt', 'delete'=>'delete_txt')
 		),
 		'target' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\p{Latin}0-9\.\-\_\ ]{0,100}$/u',
-														'errmsg'=> 'target_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\p{Latin}0-9\.\-\_\ ]{0,100}$/u',
+					'errmsg'=> 'target_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mail/form/mail_whitelist.tform.php b/interface/web/mail/form/mail_whitelist.tform.php
index 8d98346cf628a94d39c0fe4aec34191e1d77f83a..3edb132df35d2c4542a4978c36ac99864fdbfd8a 100644
--- a/interface/web/mail/form/mail_whitelist.tform.php
+++ b/interface/web/mail/form/mail_whitelist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Email Whitelist";
-$form["description"] 	= "";
-$form["name"] 			= "mail_whitelist";
-$form["action"]			= "mail_whitelist_edit.php";
-$form["db_table"]		= "mail_access";
-$form["db_table_idx"]	= "access_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "whitelist";
-$form["list_default"]	= "mail_whitelist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Email Whitelist";
+$form["description"]  = "";
+$form["name"]    = "mail_whitelist";
+$form["action"]   = "mail_whitelist_edit.php";
+$form["db_table"]  = "mail_access";
+$form["db_table_idx"] = "access_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "whitelist";
+$form["list_default"] = "mail_whitelist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,60 +51,60 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['whitelist'] = array (
-	'title' 	=> "Witelist",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_whitelist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Witelist",
+	'width'  => 100,
+	'template'  => "templates/mail_whitelist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'source_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'source_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'OK',
-			'value'		=> 'OK',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'OK',
+			'value'  => 'OK',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_blacklist.tform.php b/interface/web/mail/form/spamfilter_blacklist.tform.php
index a51addb9183c84476fc756fe15681e025c9bba80..091fb450633cb13d1bee1e48e3563dbdad70f6e9 100644
--- a/interface/web/mail/form/spamfilter_blacklist.tform.php
+++ b/interface/web/mail/form/spamfilter_blacklist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter blacklist";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_blacklist";
-$form["action"]			= "spamfilter_blacklist_edit.php";
-$form["db_table"]		= "spamfilter_wblist";
-$form["db_table_idx"]	= "wblist_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "blacklist";
-$form["list_default"]	= "spamfilter_blacklist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter blacklist";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_blacklist";
+$form["action"]   = "spamfilter_blacklist_edit.php";
+$form["db_table"]  = "spamfilter_wblist";
+$form["db_table_idx"] = "wblist_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "blacklist";
+$form["list_default"] = "spamfilter_blacklist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,69 +51,69 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['blacklist'] = array (
-	'title' 	=> "Blacklist",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_blacklist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Blacklist",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_blacklist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'wb' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'B',
-			'value'		=> array('W' => 'blacklist', 'B' => 'Blacklist')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'B',
+			'value'  => array('W' => 'blacklist', 'B' => 'Blacklist')
 		),
 		'rid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'=> 'id',
-										'valuefield'=> 'email'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'=> 'id',
+				'valuefield'=> 'email'
+			),
+			'value'  => ''
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_config.tform.php b/interface/web/mail/form/spamfilter_config.tform.php
index 224cb606c958f63d33ac825447525647b1e2e1f9..39c1b35621575c1f7c1f4d5e8f0ba20e70176e83 100644
--- a/interface/web/mail/form/spamfilter_config.tform.php
+++ b/interface/web/mail/form/spamfilter_config.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter Config";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_config";
-$form["action"]			= "spamfilter_config_edit.php";
-$form["db_table"]		= "server";
-$form["db_table_idx"]	= "server_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "server";
-$form["list_default"]	= "spamfilter_config_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter Config";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_config";
+$form["action"]   = "spamfilter_config_edit.php";
+$form["db_table"]  = "server";
+$form["db_table_idx"] = "server_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "server";
+$form["list_default"] = "spamfilter_config_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,232 +51,232 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['server'] = array (
-	'title' 	=> "Server",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_config_server_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Server",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_config_server_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '192.168.0.105',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ip_address_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '192.168.0.105',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ip_address_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '15',
+			'maxlength' => '255'
 		),
 		'netmask' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '255.255.255.0',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'netmask_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '255.255.255.0',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'netmask_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '15',
+			'maxlength' => '255'
 		),
 		'gateway' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '192.168.0.1',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'gateway_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '15',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '192.168.0.1',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'gateway_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '15',
+			'maxlength' => '255'
 		),
 		'hostname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'server1.domain.tld',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'hostname_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'server1.domain.tld',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'hostname_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'nameservers' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '192.168.0.1,192.168.0.2',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'nameservers_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '192.168.0.1,192.168.0.2',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'nameservers_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['mail'] = array (
-	'title' 	=> "Mail",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_config_mail_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Mail",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_config_mail_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'module' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('postfix_mysql' => 'postfix_mysql')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('postfix_mysql' => 'postfix_mysql')
 		),
 		'maildir_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '/home/vmail/[domain]/[localpart]/',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'maildir_path_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '/home/vmail/[domain]/[localpart]/',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'maildir_path_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'homedir_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '/home/vmail/',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'homedir_path_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '/home/vmail/',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'homedir_path_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'mailuser_uid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '5000',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_uid_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '5000',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_uid_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'mailuser_gid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '5000',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_gid_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '5000',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_gid_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'mailuser_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'vmail',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_name_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'vmail',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_name_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'mailuser_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'vmail',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'mailuser_group_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'vmail',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'mailuser_group_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'relayhost' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'relayhost_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'relayhost_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
 		'mailbox_size_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '15'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '15'
 		),
 		'message_size_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '15'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '15'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['getmail'] = array (
-	'title' 	=> "Getmail",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_config_getmail_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Getmail",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_config_getmail_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'getmail_config_dir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'getmail_config_dir_error_empty'),
-									),
-			'value'		=> '',
-			'width'		=> '40',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'getmail_config_dir_error_empty'),
+			),
+			'value'  => '',
+			'width'  => '40',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_policy.tform.php b/interface/web/mail/form/spamfilter_policy.tform.php
index 0e83e678e3c224ddbd4cac6105ed3fd63d85f185..da63732c80a24a3a5e6695980c9fcc767e4bb09b 100644
--- a/interface/web/mail/form/spamfilter_policy.tform.php
+++ b/interface/web/mail/form/spamfilter_policy.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter policy";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_policy";
-$form["action"]			= "spamfilter_policy_edit.php";
-$form["db_table"]		= "spamfilter_policy";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "policy";
-$form["list_default"]	= "spamfilter_policy_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter policy";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_policy";
+$form["action"]   = "spamfilter_policy_edit.php";
+$form["db_table"]  = "spamfilter_policy";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "policy";
+$form["list_default"] = "spamfilter_policy_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,332 +51,332 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = 'r'; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['policy'] = array (
-	'title' 	=> "Policy",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_policy_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Policy",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_policy_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'policy_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'policyname_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'policyname_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'virus_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'spam_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'banned_files_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bad_header_lover' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bypass_virus_checks' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bypass_banned_checks' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'bypass_header_checks' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['quarantine'] = array (
-	'title' 	=> "Quarantine",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_quarantine_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Quarantine",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_quarantine_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'virus_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'banned_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'bad_header_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'clean_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'other_quarantine_to' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['taglevel'] = array (
-	'title' 	=> "Tag-Level",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_taglevel_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Tag-Level",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_taglevel_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'spam_tag_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_tag2_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_kill_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_dsn_cutoff_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_quarantine_cutoff_level' => array (
-			'datatype'	=> 'DOUBLE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'DOUBLE',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'spam_modifies_subj' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'spam_subject_tag' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_subject_tag2' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['other'] = array (
-	'title' 	=> "Other",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_other_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Other",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_other_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'addr_extension_virus' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'addr_extension_spam' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'addr_extension_banned' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'addr_extension_bad_header' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'warnvirusrecip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'warnbannedrecip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'warnbadhrecip' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'N',
-			'value'		=> array('N' => 'No','Y' => 'Yes')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'N',
+			'value'  => array('N' => 'No', 'Y' => 'Yes')
 		),
 		'newvirus_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'virus_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'banned_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'bad_header_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'spam_admin' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+
 		'message_size_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '10',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '10',
+			'maxlength' => '255'
 		),
 		'banned_rulenames' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/form/spamfilter_users.tform.php b/interface/web/mail/form/spamfilter_users.tform.php
index 980a64fd3ff87f9aa765bb5cda30967ab97349fc..7bd6c460f726a5c02f8cbe9606f2f3d14747ee84 100644
--- a/interface/web/mail/form/spamfilter_users.tform.php
+++ b/interface/web/mail/form/spamfilter_users.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter users";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_users";
-$form["action"]			= "spamfilter_users_edit.php";
-$form["db_table"]		= "spamfilter_users";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "users";
-$form["list_default"]	= "spamfilter_users_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter users";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_users";
+$form["action"]   = "spamfilter_users_edit.php";
+$form["db_table"]  = "spamfilter_users";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "users";
+$form["list_default"] = "spamfilter_users_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,80 +51,80 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['users'] = array (
-	'title' 	=> "Users",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_users_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Users",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_users_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'policy_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '5',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
-										'keyfield'=> 'id',
-										'valuefield'=> 'policy_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '5',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
+				'keyfield'=> 'id',
+				'valuefield'=> 'policy_name'
+			),
+			'value'  => ''
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'fullname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'fullname_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'fullname_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'local' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'Y',
-			'value'		=> array('Y' => 'Yes','N' => 'No')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'Y',
+			'value'  => array('Y' => 'Yes', 'N' => 'No')
 		),
-		
-	##################################
-	# ENDE Datatable fields
-	##################################
+
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mail/form/spamfilter_whitelist.tform.php b/interface/web/mail/form/spamfilter_whitelist.tform.php
index 73d53f887dc952b3c9bf01947751483606cf38fc..bf2ae439c45dacdb4c09d4ef3bb286fc149dd7f3 100644
--- a/interface/web/mail/form/spamfilter_whitelist.tform.php
+++ b/interface/web/mail/form/spamfilter_whitelist.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Spamfilter Whitelist";
-$form["description"] 	= "";
-$form["name"] 			= "spamfilter_whitelist";
-$form["action"]			= "spamfilter_whitelist_edit.php";
-$form["db_table"]		= "spamfilter_wblist";
-$form["db_table_idx"]	= "wblist_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "whitelist";
-$form["list_default"]	= "spamfilter_whitelist_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Spamfilter Whitelist";
+$form["description"]  = "";
+$form["name"]    = "spamfilter_whitelist";
+$form["action"]   = "spamfilter_whitelist_edit.php";
+$form["db_table"]  = "spamfilter_wblist";
+$form["db_table_idx"] = "wblist_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "whitelist";
+$form["list_default"] = "spamfilter_whitelist_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,76 +51,76 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['whitelist'] = array (
-	'title' 	=> "Whitelist",
-	'width' 	=> 100,
-	'template' 	=> "templates/spamfilter_whitelist_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Whitelist",
+	'width'  => 100,
+	'template'  => "templates/spamfilter_whitelist_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'wb' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> 'W',
-			'value'		=> array('W' => 'Whitelist', 'B' => 'Blacklist')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => 'W',
+			'value'  => array('W' => 'Whitelist', 'B' => 'Blacklist')
 		),
 		'rid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-										'keyfield'=> 'id',
-										'valuefield'=> 'email'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+				'keyfield'=> 'id',
+				'valuefield'=> 'email'
+			),
+			'value'  => ''
 		),
 		'email' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'email_error_notempty'),
-									),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'email_error_notempty'),
+			),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> 5,
-			'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => 5,
+			'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10)
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/lib/admin.conf.php b/interface/web/mail/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/mail/lib/admin.conf.php
+++ b/interface/web/mail/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/lib/module.conf.php b/interface/web/mail/lib/module.conf.php
index 731fa91341a3b001c3e98f58b68887e5008af1e5..45e06f2267ce499b842b94cb5bab9476039e57d2 100644
--- a/interface/web/mail/lib/module.conf.php
+++ b/interface/web/mail/lib/module.conf.php
@@ -2,150 +2,150 @@
 
 $userid=$app->auth->get_user_id();
 
-$module['name'] 		= 'mail';
-$module['title'] 		= 'top_menu_email';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'mail/mail_domain_list.php';
+$module['name']   = 'mail';
+$module['title']   = 'top_menu_email';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'mail/mail_domain_list.php';
 $module['tab_width']    = '';
 
 
 //**** Email accounts menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'maildomain') != 0)
+if($app->auth->get_client_limit($userid, 'maildomain') != 0)
 {
-	$items[] = array( 'title' 	=> 'Domain',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_domain_list.php',
-					  'html_id' => 'mail_domain_list');
+	$items[] = array( 'title'  => 'Domain',
+		'target'  => 'content',
+		'link' => 'mail/mail_domain_list.php',
+		'html_id' => 'mail_domain_list');
 }
-	
-if($app->auth->get_client_limit($userid,'mailaliasdomain') != 0)
+
+if($app->auth->get_client_limit($userid, 'mailaliasdomain') != 0)
 {
-	$items[] = array( 'title' 	=> 'Domain Alias',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_aliasdomain_list.php',
-					  'html_id' => 'mail_aliasdomain_list');
+	$items[] = array( 'title'  => 'Domain Alias',
+		'target'  => 'content',
+		'link' => 'mail/mail_aliasdomain_list.php',
+		'html_id' => 'mail_aliasdomain_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailbox') != 0)
+if($app->auth->get_client_limit($userid, 'mailbox') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Mailbox',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_user_list.php',
-					  'html_id' => 'mail_user_list');
+	$items[] = array( 'title'  => 'Email Mailbox',
+		'target'  => 'content',
+		'link' => 'mail/mail_user_list.php',
+		'html_id' => 'mail_user_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailalias') != 0)
+if($app->auth->get_client_limit($userid, 'mailalias') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Alias',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_alias_list.php',
-					  'html_id' => 'mail_alias_list');
+	$items[] = array( 'title'  => 'Email Alias',
+		'target'  => 'content',
+		'link' => 'mail/mail_alias_list.php',
+		'html_id' => 'mail_alias_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailforward') != 0)
+if($app->auth->get_client_limit($userid, 'mailforward') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Forward',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_forward_list.php',
-					  'html_id' => 'mail_forward_list');
+	$items[] = array( 'title'  => 'Email Forward',
+		'target'  => 'content',
+		'link' => 'mail/mail_forward_list.php',
+		'html_id' => 'mail_forward_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailcatchall') != 0)
+if($app->auth->get_client_limit($userid, 'mailcatchall') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Catchall',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_domain_catchall_list.php',
-					  'html_id' => 'mail_domain_catchall_list');
+	$items[] = array( 'title'  => 'Email Catchall',
+		'target'  => 'content',
+		'link' => 'mail/mail_domain_catchall_list.php',
+		'html_id' => 'mail_domain_catchall_list');
 }
 
-if($app->auth->get_client_limit($userid,'mailrouting') != 0)
+if($app->auth->get_client_limit($userid, 'mailrouting') != 0)
 {
-	$items[] = array( 'title' 	=> 'Email Routing',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_transport_list.php',
-					  'html_id' => 'mail_transport_list');
+	$items[] = array( 'title'  => 'Email Routing',
+		'target'  => 'content',
+		'link' => 'mail/mail_transport_list.php',
+		'html_id' => 'mail_transport_list');
 }
 
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'Email Accounts',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Email Accounts',
+		'open'  => 1,
+		'items' => $items);
 }
 
 //**** Mailinglist menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'mailmailinglist') != 0)
+if($app->auth->get_client_limit($userid, 'mailmailinglist') != 0)
 {
-	$items[] = array( 'title' 	=> 'Mailing List',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_mailinglist_list.php',
-					  'html_id' => 'mail_mailinglist_list');
+	$items[] = array( 'title'  => 'Mailing List',
+		'target'  => 'content',
+		'link' => 'mail/mail_mailinglist_list.php',
+		'html_id' => 'mail_mailinglist_list');
 }
 
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'Mailing List',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Mailing List',
+		'open'  => 1,
+		'items' => $items);
 }
 
 //**** Spamfilter menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'spamfilter_wblist') != 0)
+if($app->auth->get_client_limit($userid, 'spamfilter_wblist') != 0)
 {
-	$items[] = array( 'title' 	=> 'Whitelist',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/spamfilter_whitelist_list.php',
-					  'html_id' => 'spamfilter_whitelist_list');
-		
-	$items[] = array( 'title' 	=> 'Blacklist',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/spamfilter_blacklist_list.php',
-					  'html_id' => 'spamfilter_blacklist_list');
+	$items[] = array( 'title'  => 'Whitelist',
+		'target'  => 'content',
+		'link' => 'mail/spamfilter_whitelist_list.php',
+		'html_id' => 'spamfilter_whitelist_list');
+
+	$items[] = array( 'title'  => 'Blacklist',
+		'target'  => 'content',
+		'link' => 'mail/spamfilter_blacklist_list.php',
+		'html_id' => 'spamfilter_blacklist_list');
 }
 
 if($app->auth->is_admin()) {
 
-	$items[] = array( 	'title' 	=> 'User / Domain',
-				  		'target' 	=> 'content',
-				  		'link'	    => 'mail/spamfilter_users_list.php',
-				  		'html_id' => 'spamfilter_users_list');
+	$items[] = array(  'title'  => 'User / Domain',
+		'target'  => 'content',
+		'link'     => 'mail/spamfilter_users_list.php',
+		'html_id' => 'spamfilter_users_list');
 
-	$items[] = array( 	'title' 	=> 'Policy',
-				  		'target' 	=> 'content',
-				  		'link'	    => 'mail/spamfilter_policy_list.php',
-				  		'html_id' => 'spamfilter_policy_list');
+	$items[] = array(  'title'  => 'Policy',
+		'target'  => 'content',
+		'link'     => 'mail/spamfilter_policy_list.php',
+		'html_id' => 'spamfilter_policy_list');
 
-//	$items[] = array( 	'title' 	=> 'Server Settings',
-//				  		'target' 	=> 'content',
-//				  		'link'	    => 'mail/spamfilter_config_list.php');
+	// $items[] = array(  'title'  => 'Server Settings',
+	//        'target'  => 'content',
+	//        'link'     => 'mail/spamfilter_config_list.php');
 }
 
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'Spamfilter',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Spamfilter',
+		'open'  => 1,
+		'items' => $items);
 }
 
 //**** Fetchmail menu
 $items = array();
 
-if($app->auth->get_client_limit($userid,'fetchmail') != 0)
+if($app->auth->get_client_limit($userid, 'fetchmail') != 0)
 {
-	$items[] = array( 'title' 	=> 'Fetchmail',
-					  'target' 	=> 'content',
-					  'link'	=> 'mail/mail_get_list.php',
-					  'html_id' => 'mail_get_list');
-		
-	$module['nav'][] = array(	'title'	=> 'Fetchmail',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$items[] = array( 'title'  => 'Fetchmail',
+		'target'  => 'content',
+		'link' => 'mail/mail_get_list.php',
+		'html_id' => 'mail_get_list');
+
+	$module['nav'][] = array( 'title' => 'Fetchmail',
+		'open'  => 1,
+		'items' => $items);
 }
 
 
@@ -156,52 +156,52 @@ $items = array();
 
 //** Email Quotas
 $items[] = array( 'title'   => 'Mailbox quota',
-                  'target'  => 'content',
-                  'link'    => 'mail/user_quota_stats.php',
-                  'html_id' => 'user_quota_stats');
+	'target'  => 'content',
+	'link'    => 'mail/user_quota_stats.php',
+	'html_id' => 'user_quota_stats');
 
-$items[] = array( 'title' 	=> 'Mailbox traffic',
-				  'target' 	=> 'content',
-				  'link'	=> 'mail/mail_user_stats.php',
-				  'html_id' => 'mail_user_stats');
+$items[] = array( 'title'  => 'Mailbox traffic',
+	'target'  => 'content',
+	'link' => 'mail/mail_user_stats.php',
+	'html_id' => 'mail_user_stats');
 
 
 
-$module['nav'][] = array(	'title'	=> 'Statistics',
-							'open' 	=> 1,
-							'items'	=> $items);
+$module['nav'][] = array( 'title' => 'Statistics',
+	'open'  => 1,
+	'items' => $items);
 
 
 //**** Global filters menu
 $items = array();
 if($_SESSION['s']['user']['typ'] == 'admin') {
 
-	$items[] = array(   'title' 	=> 'Postfix Whitelist',
-  				  	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_whitelist_list.php',
-				  	    'html_id' => 'mail_whitelist_list');
+	$items[] = array(   'title'  => 'Postfix Whitelist',
+		'target'  => 'content',
+		'link'     => 'mail/mail_whitelist_list.php',
+		'html_id' => 'mail_whitelist_list');
 
 
-	$items[] = array(   'title' 	=> 'Postfix Blacklist',
-				 	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_blacklist_list.php',
-				  	    'html_id' => 'mail_blacklist_list');
+	$items[] = array(   'title'  => 'Postfix Blacklist',
+		'target'  => 'content',
+		'link'     => 'mail/mail_blacklist_list.php',
+		'html_id' => 'mail_blacklist_list');
 
 
-	$items[] = array(   'title' 	=> 'Content Filter',
-				 	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_content_filter_list.php',
-				  	    'html_id' => 'mail_content_filter_list');
+	$items[] = array(   'title'  => 'Content Filter',
+		'target'  => 'content',
+		'link'     => 'mail/mail_content_filter_list.php',
+		'html_id' => 'mail_content_filter_list');
 
 
-	$items[] = array(   'title' 	=> 'Relay Recipients',
-				 	    'target' 	=> 'content',
-				  	    'link'	    => 'mail/mail_relay_recipient_list.php',
-				  	    'html_id' => 'mail_relay_recipient_list');
+	$items[] = array(   'title'  => 'Relay Recipients',
+		'target'  => 'content',
+		'link'     => 'mail/mail_relay_recipient_list.php',
+		'html_id' => 'mail_relay_recipient_list');
 
 
-	$module['nav'][] = array(	'title'	=> 'Global Filters',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Global Filters',
+		'open'  => 1,
+		'items' => $items);
 }
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/lib/remote.conf.php b/interface/web/mail/lib/remote.conf.php
index 8d426d5ac71c1394d3623e0a9f17d6b603fb050a..acb9aea16420638c2bda90b3aafdc068659f76e9 100644
--- a/interface/web/mail/lib/remote.conf.php
+++ b/interface/web/mail/lib/remote.conf.php
@@ -19,4 +19,4 @@ $function_list['mail_user_filter_get,mail_user_filter_add,mail_user_filter_updat
 $function_list['mail_filter_get,mail_filter_add,mail_filter_update,mail_filter_delete'] = 'Mail filter functions';
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_alias.list.php b/interface/web/mail/list/mail_alias.list.php
index 101644410b298a3f4036de0d959ff9cfef49fc4a..2f92e2c1c649fd3466efb8323479ead9eb696292 100644
--- a/interface/web/mail/list/mail_alias.list.php
+++ b/interface/web/mail/list/mail_alias.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_alias";
+$liste["name"]     = "mail_alias";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_alias_list.php";
+$liste["file"]    = "mail_alias_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_alias_edit.php";
+$liste["edit_file"]   = "mail_alias_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_alias_del.php";
+$liste["delete_file"]  = "mail_alias_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_aliasdomain.list.php b/interface/web/mail/list/mail_aliasdomain.list.php
index f4385d8efc6d1ed4efc36015eeedecc23b72a2a6..c5dc4e3cf16065c9d11a696c0b38c36bcbf84b85 100644
--- a/interface/web/mail/list/mail_aliasdomain.list.php
+++ b/interface/web/mail/list/mail_aliasdomain.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_aliasdomain";
+$liste["name"]     = "mail_aliasdomain";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_aliasdomain_list.php";
+$liste["file"]    = "mail_aliasdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_aliasdomain_edit.php";
+$liste["edit_file"]   = "mail_aliasdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_aliasdomain_del.php";
+$liste["delete_file"]  = "mail_aliasdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_blacklist.list.php b/interface/web/mail/list/mail_blacklist.list.php
index fd3ab4fa9f5dcfcaedcf8bdd26161bad552dd273..434656b729cbf86f35d9575f8b3baeb81a4ee8d8 100644
--- a/interface/web/mail/list/mail_blacklist.list.php
+++ b/interface/web/mail/list/mail_blacklist.list.php
@@ -13,83 +13,83 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_blacklist";
+$liste["name"]     = "mail_blacklist";
 
 // Database table
-$liste["table"] 			= "mail_access";
+$liste["table"]    = "mail_access";
 
 // Index index field of the database table
-$liste["table_idx"]			= "access_id";
+$liste["table_idx"]   = "access_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_blacklist_list.php";
+$liste["file"]    = "mail_blacklist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_blacklist_edit.php";
+$liste["edit_file"]   = "mail_blacklist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_blacklist_del.php";
+$liste["delete_file"]  = "mail_blacklist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('recipient' => 'Recipient', 'sender' => 'Sender', 'client' => 'Client'));
+
+
+?>
diff --git a/interface/web/mail/list/mail_content_filter.list.php b/interface/web/mail/list/mail_content_filter.list.php
index 1588d5813a94f2e05a508d943c18757bb86c8060..aa79312a486d357b908d303ae353389e9fde76b1 100644
--- a/interface/web/mail/list/mail_content_filter.list.php
+++ b/interface/web/mail/list/mail_content_filter.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_content_filter";
+$liste["name"]     = "mail_content_filter";
 
 // Database table
-$liste["table"] 			= "mail_content_filter";
+$liste["table"]    = "mail_content_filter";
 
 // Index index field of the database table
-$liste["table_idx"]			= "content_filter_id";
+$liste["table_idx"]   = "content_filter_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_content_filter_list.php";
+$liste["file"]    = "mail_content_filter_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_content_filter_edit.php";
+$liste["edit_file"]   = "mail_content_filter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_content_filter_del.php";
+$liste["delete_file"]  = "mail_content_filter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,49 +48,49 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "pattern",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "action",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> array('DISCARD' => 'DISCARD','DUNNO'=>'DUNNO','FILTER'=>'FILTER','HOLD'=>'HOLD','IGNORE'=>'IGNORE','PREPEND'=>'PREPEND','REDIRECT'=>'REDIRECT','REPLACE'=>'REPLACE','REJECT'=>'REJECT','WARN'=>'WARN'));
-
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "pattern",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "action",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => array('DISCARD' => 'DISCARD', 'DUNNO'=>'DUNNO', 'FILTER'=>'FILTER', 'HOLD'=>'HOLD', 'IGNORE'=>'IGNORE', 'PREPEND'=>'PREPEND', 'REDIRECT'=>'REDIRECT', 'REPLACE'=>'REPLACE', 'REJECT'=>'REJECT', 'WARN'=>'WARN'));
+
+
+
+?>
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index 0012e1c83bd7a6fc54dae5f26205d4df9ed75b26..5524f28c0bf75293e64702b54aedec7ad7cbc738 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -14,37 +14,37 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "mail_domain_admin";
+	$liste["name"]     = "mail_domain_admin";
 } else {
-	$liste["name"] 				= "mail_domain";
+	$liste["name"]     = "mail_domain";
 }
 
 // Database table
-$liste["table"] 			= "mail_domain";
+$liste["table"]    = "mail_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_domain_list.php";
+$liste["file"]    = "mail_domain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_domain_edit.php";
+$liste["edit_file"]   = "mail_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_domain_del.php";
+$liste["delete_file"]  = "mail_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -52,58 +52,58 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
 
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT a.server_id, a.server_name FROM server a, mail_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT a.server_id, a.server_name FROM server a, mail_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_domain_catchall.list.php b/interface/web/mail/list/mail_domain_catchall.list.php
index 07f7e9f14866393b6b6ca6555ce45ad59eb64c41..75d311df73c804a231d639c13eb19436657756ef 100644
--- a/interface/web/mail/list/mail_domain_catchall.list.php
+++ b/interface/web/mail/list/mail_domain_catchall.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_domain_catchall";
+$liste["name"]     = "mail_domain_catchall";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_domain_catchall_list.php";
+$liste["file"]    = "mail_domain_catchall_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_domain_catchall_edit.php";
+$liste["edit_file"]   = "mail_domain_catchall_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_domain_catchall_del.php";
+$liste["delete_file"]  = "mail_domain_catchall_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_forward.list.php b/interface/web/mail/list/mail_forward.list.php
index 5aae2bb4a312351cd91e457f3262e84dc90e794d..524c2a7e8d7c909a5f9346a0a8f111a948c4ac0d 100644
--- a/interface/web/mail/list/mail_forward.list.php
+++ b/interface/web/mail/list/mail_forward.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_forward";
+$liste["name"]     = "mail_forward";
 
 // Database table
-$liste["table"] 			= "mail_forwarding";
+$liste["table"]    = "mail_forwarding";
 
 // Index index field of the database table
-$liste["table_idx"]			= "forwarding_id";
+$liste["table_idx"]   = "forwarding_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_forward_list.php";
+$liste["file"]    = "mail_forward_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_forward_edit.php";
+$liste["edit_file"]   = "mail_forward_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_forward_del.php";
+$liste["delete_file"]  = "mail_forward_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_get.list.php b/interface/web/mail/list/mail_get.list.php
index bcce2c07747cea50899125ed9bcb468abbb57e43..aa9338620350599ee746777cb75c81f1bb8a7afc 100644
--- a/interface/web/mail/list/mail_get.list.php
+++ b/interface/web/mail/list/mail_get.list.php
@@ -13,93 +13,93 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_get";
+$liste["name"]     = "mail_get";
 
 // Database table
-$liste["table"] 			= "mail_get";
+$liste["table"]    = "mail_get";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailget_id";
+$liste["table_idx"]   = "mailget_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_get_list.php";
+$liste["file"]    = "mail_get_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_get_edit.php";
+$liste["edit_file"]   = "mail_get_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_get_del.php";
+$liste["delete_file"]  = "mail_get_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "source_server",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "source_username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "destination",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "source_server",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "source_username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "destination",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_mailinglist.list.php b/interface/web/mail/list/mail_mailinglist.list.php
index 4bc3b0612bfeb8b11d6c3b2fa72005ae6904a6a1..b72a9ec7b350265d57e4608b9b37cb549f30e51b 100644
--- a/interface/web/mail/list/mail_mailinglist.list.php
+++ b/interface/web/mail/list/mail_mailinglist.list.php
@@ -13,58 +13,58 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_mailinglist";
+$liste["name"]     = "mail_mailinglist";
 
 // Database table
-$liste["table"] 			= "mail_mailinglist";
+$liste["table"]    = "mail_mailinglist";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailinglist_id";
+$liste["table_idx"]   = "mailinglist_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_mailinglist_list.php";
+$liste["file"]    = "mail_mailinglist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_mailinglist_edit.php";
+$liste["edit_file"]   = "mail_mailinglist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_mailinglist_del.php";
+$liste["delete_file"]  = "mail_mailinglist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
-$liste["item"][] = array(	'field'		=> "listname",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "listname",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/mail/list/mail_relay_recipient.list.php b/interface/web/mail/list/mail_relay_recipient.list.php
index a442ece3a76e627da8c11e3ca2eea0317c1cde60..cc26721430ad46c98bfaa16f761da4b93547fa4c 100644
--- a/interface/web/mail/list/mail_relay_recipient.list.php
+++ b/interface/web/mail/list/mail_relay_recipient.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_relay_recipient";
+$liste["name"]     = "mail_relay_recipient";
 
 // Database table
-$liste["table"] 			= "mail_relay_recipient";
+$liste["table"]    = "mail_relay_recipient";
 
 // Index index field of the database table
-$liste["table_idx"]			= "relay_recipient_id";
+$liste["table_idx"]   = "relay_recipient_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_relay_recipient_list.php";
+$liste["file"]    = "mail_relay_recipient_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_relay_recipient_edit.php";
+$liste["edit_file"]   = "mail_relay_recipient_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_relay_recipient_del.php";
+$liste["delete_file"]  = "mail_relay_recipient_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/mail_spamfilter.list.php b/interface/web/mail/list/mail_spamfilter.list.php
index 8c154f0f42d299c4cc38f187d081053da780df3a..645feac0bd803a4ab44315f6812f0b47533de17b 100644
--- a/interface/web/mail/list/mail_spamfilter.list.php
+++ b/interface/web/mail/list/mail_spamfilter.list.php
@@ -13,73 +13,73 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_spamfilter";
+$liste["name"]     = "mail_spamfilter";
 
 // Database table
-$liste["table"] 			= "server";
+$liste["table"]    = "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "server_id";
+$liste["table_idx"]   = "server_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_spamfilter_list.php";
+$liste["file"]    = "mail_spamfilter_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_spamfilter_edit.php";
+$liste["edit_file"]   = "mail_spamfilter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_spamfilter_del.php";
+$liste["delete_file"]  = "mail_spamfilter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "server_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('1' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", '0' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "server_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+
+?>
diff --git a/interface/web/mail/list/mail_transport.list.php b/interface/web/mail/list/mail_transport.list.php
index ccea270ea77b860aa99ae91b69460ca0f492fb1b..d554da96cc611c6e3af7076c042bed39d2c42627 100644
--- a/interface/web/mail/list/mail_transport.list.php
+++ b/interface/web/mail/list/mail_transport.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_transport";
+$liste["name"]     = "mail_transport";
 
 // Database table
-$liste["table"] 			= "mail_transport";
+$liste["table"]    = "mail_transport";
 
 // Index index field of the database table
-$liste["table_idx"]			= "transport_id";
+$liste["table_idx"]   = "transport_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_transport_list.php";
+$liste["file"]    = "mail_transport_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_transport_edit.php";
+$liste["edit_file"]   = "mail_transport_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_transport_del.php";
+$liste["delete_file"]  = "mail_transport_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,60 +48,60 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "transport",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "sort_order",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "transport",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "sort_order",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+?>
diff --git a/interface/web/mail/list/mail_user.list.php b/interface/web/mail/list/mail_user.list.php
index 8d0377355b2772aacc9860b9f45fc6ee4b665bfe..0b17bf7ce24cc2b3c8b976f2a71832b42cd8f78b 100644
--- a/interface/web/mail/list/mail_user.list.php
+++ b/interface/web/mail/list/mail_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 			= "mail_user";
+$liste["name"]    = "mail_user";
 
 // Database table
-$liste["table"] 		= "mail_user";
+$liste["table"]   = "mail_user";
 
 // Index index field of the database table
-$liste["table_idx"]		= "mailuser_id";
+$liste["table_idx"]  = "mailuser_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]			= "mail_user_list.php";
+$liste["file"]   = "mail_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]		= "mail_user_edit.php";
+$liste["edit_file"]  = "mail_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_del.php";
+$liste["delete_file"]  = "mail_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]			= "yes";
+$liste["auth"]   = "yes";
 
 
 /*****************************************************
@@ -48,45 +48,45 @@ $liste["auth"]			= "yes";
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "email",
-                            'datatype'  => "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "login",
-                            'datatype'  => "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "name",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "TEXT",
-                            'op'	=> "like",
-                            'prefix'	=> "%",
-                            'suffix'	=> "%",
-                            'width'	=> "",
-                            'value'	=> "");
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op' => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width' => "",
+	'value' => "");
 
 $liste["item"][] = array(   'field'     => "autoresponder",
-                            'datatype'	=> "VARCHAR",
-                            'formtype'	=> "SELECT",
-                            'op'	=> "=",
-                            'prefix'	=> "",
-                            'suffix'	=> "",
-                            'width'	=> "",
-                            'value'	=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));							
-							
-?>
\ No newline at end of file
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op' => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width' => "",
+	'value' => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+?>
diff --git a/interface/web/mail/list/mail_user_filter.list.php b/interface/web/mail/list/mail_user_filter.list.php
index 445fe6faa38cf1143d66aafab3ebb0ec4f99a2fa..6b71b41f8761cd733cf9f4f9db0d601eade9bc9f 100644
--- a/interface/web/mail/list/mail_user_filter.list.php
+++ b/interface/web/mail/list/mail_user_filter.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_user_filter";
+$liste["name"]     = "mail_user_filter";
 
 // Database table
-$liste["table"] 			= "mail_user_filter";
+$liste["table"]    = "mail_user_filter";
 
 // Index index field of the database table
-$liste["table_idx"]			= "filter_id";
+$liste["table_idx"]   = "filter_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_user_list.php";
+$liste["file"]    = "mail_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_filter_edit.php";
+$liste["edit_file"]   = "mail_user_filter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_filter_del.php";
+$liste["delete_file"]  = "mail_user_filter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "no";
+$liste["auth"]    = "no";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "rulename",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "rulename",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_user_stats.list.php b/interface/web/mail/list/mail_user_stats.list.php
index aa144313ffaa78692f30a703bf0a5f78ee0f1390..4bc0d2bbfd59207aa6fbbbd7ff151f0df89a5e4c 100644
--- a/interface/web/mail/list/mail_user_stats.list.php
+++ b/interface/web/mail/list/mail_user_stats.list.php
@@ -13,51 +13,51 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_user_stats";
+$liste["name"]     = "mail_user_stats";
 
 // Database table
-$liste["table"] 			= "mail_user";
+$liste["table"]    = "mail_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailuser_id";
+$liste["table_idx"]   = "mailuser_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_user_stats.php";
+$liste["file"]    = "mail_user_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_edit.php";
+$liste["edit_file"]   = "mail_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_del.php";
+$liste["delete_file"]  = "mail_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "email",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "email",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/mail_whitelist.list.php b/interface/web/mail/list/mail_whitelist.list.php
index beb3cabf1e4c88170bdab67e4b429c36d62a870d..2069a6b533af8f12f004c1d07396b67f56a86922 100644
--- a/interface/web/mail/list/mail_whitelist.list.php
+++ b/interface/web/mail/list/mail_whitelist.list.php
@@ -13,82 +13,82 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_whitelist";
+$liste["name"]     = "mail_whitelist";
 
 // Database table
-$liste["table"] 			= "mail_access";
+$liste["table"]    = "mail_access";
 
 // Index index field of the database table
-$liste["table_idx"]			= "access_id";
+$liste["table_idx"]   = "access_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_whitelist_list.php";
+$liste["file"]    = "mail_whitelist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_whitelist_edit.php";
+$liste["edit_file"]   = "mail_whitelist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_whitelist_del.php";
+$liste["delete_file"]  = "mail_whitelist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "source",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('recipient' => 'recipient_txt', 'sender' => 'sender_txt', 'client' => 'client_txt'));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "source",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('recipient' => 'recipient_txt', 'sender' => 'sender_txt', 'client' => 'client_txt'));
 
 
 ?>
diff --git a/interface/web/mail/list/spamfilter_blacklist.list.php b/interface/web/mail/list/spamfilter_blacklist.list.php
index 2978161825620bffd35f7e3c81bfe7605f9c57c9..faadd53263bf0dd35bb19a5f2d05b0f480e8abe7 100644
--- a/interface/web/mail/list/spamfilter_blacklist.list.php
+++ b/interface/web/mail/list/spamfilter_blacklist.list.php
@@ -13,96 +13,96 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_blacklist";
+$liste["name"]     = "spamfilter_blacklist";
 
 // Database table
-$liste["table"] 			= "spamfilter_wblist";
+$liste["table"]    = "spamfilter_wblist";
 
 // Index index field of the database table
-$liste["table_idx"]			= "wblist_id";
+$liste["table_idx"]   = "wblist_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_blacklist_list.php";
+$liste["file"]    = "spamfilter_blacklist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_blacklist_edit.php";
+$liste["edit_file"]   = "spamfilter_blacklist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_blacklist_del.php";
+$liste["delete_file"]  = "spamfilter_blacklist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "priority",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
-
-$liste["item"][] = array(	'field'		=> "rid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-														'keyfield'=> 'id',
-														'valuefield'=> 'email'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "email",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "priority",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
+
+$liste["item"][] = array( 'field'  => "rid",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+		'keyfield'=> 'id',
+		'valuefield'=> 'email'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "email",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/spamfilter_config.list.php b/interface/web/mail/list/spamfilter_config.list.php
index 2263ffa06c31ba03c96b720d6395a783c3039fd0..315856f3005bdb09838b6ca62b36349326896a67 100644
--- a/interface/web/mail/list/spamfilter_config.list.php
+++ b/interface/web/mail/list/spamfilter_config.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_config";
+$liste["name"]     = "spamfilter_config";
 
 // Database table
-$liste["table"] 			= "server";
+$liste["table"]    = "server";
 
 // Index index field of the database table
-$liste["table_idx"]			= "server_id";
+$liste["table_idx"]   = "server_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_config_list.php";
+$liste["file"]    = "spamfilter_config_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_config_edit.php";
+$liste["edit_file"]   = "spamfilter_config_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_config_del.php";
+$liste["delete_file"]  = "spamfilter_config_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "server_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/spamfilter_policy.list.php b/interface/web/mail/list/spamfilter_policy.list.php
index a486294f2a9cf74335619dc8690bd107874f7a17..03b39722a8b211aece7a68c87353feca96646903 100644
--- a/interface/web/mail/list/spamfilter_policy.list.php
+++ b/interface/web/mail/list/spamfilter_policy.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_policy";
+$liste["name"]     = "spamfilter_policy";
 
 // Database table
-$liste["table"] 			= "spamfilter_policy";
+$liste["table"]    = "spamfilter_policy";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_policy_list.php";
+$liste["file"]    = "spamfilter_policy_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_policy_edit.php";
+$liste["edit_file"]   = "spamfilter_policy_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_policy_del.php";
+$liste["delete_file"]  = "spamfilter_policy_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,54 +48,54 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "policy_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "policy_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-$liste["item"][] = array(	'field'		=> "virus_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "virus_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "spam_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "spam_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "banned_files_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "banned_files_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "bad_header_lover",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "bad_header_lover",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
 
@@ -113,4 +113,4 @@ $liste["item"][] = array(	'field'		=> "bad_header_lover",
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/list/spamfilter_users.list.php b/interface/web/mail/list/spamfilter_users.list.php
index d02b4ca9fb1fe931d7e9b23014797d9599dd0fb3..6438d9fff09023db41ee47ee2ed90f50e71c5c44 100644
--- a/interface/web/mail/list/spamfilter_users.list.php
+++ b/interface/web/mail/list/spamfilter_users.list.php
@@ -13,96 +13,96 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_users";
+$liste["name"]     = "spamfilter_users";
 
 // Database table
-$liste["table"] 			= "spamfilter_users";
+$liste["table"]    = "spamfilter_users";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_users_list.php";
+$liste["file"]    = "spamfilter_users_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_users_edit.php";
+$liste["edit_file"]   = "spamfilter_users_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_users_del.php";
+$liste["delete_file"]  = "spamfilter_users_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "local",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "priority",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
-
-$liste["item"][] = array(	'field'		=> "policy_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
-														'keyfield'=> 'id',
-														'valuefield'=> 'policy_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "fullname",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "local",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('Y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'N' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "priority",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
+
+$liste["item"][] = array( 'field'  => "policy_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,policy_name FROM spamfilter_policy WHERE {AUTHSQL} ORDER BY policy_name',
+		'keyfield'=> 'id',
+		'valuefield'=> 'policy_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "fullname",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/spamfilter_whitelist.list.php b/interface/web/mail/list/spamfilter_whitelist.list.php
index f49e235d3225ff020cb7f1ba810f0a78b827faf0..8e5d8b7fc3456061c3775d4dd8ab71e3c0225665 100644
--- a/interface/web/mail/list/spamfilter_whitelist.list.php
+++ b/interface/web/mail/list/spamfilter_whitelist.list.php
@@ -13,96 +13,96 @@
 
 
 // Name of the list
-$liste["name"] 				= "spamfilter_whitelist";
+$liste["name"]     = "spamfilter_whitelist";
 
 // Database table
-$liste["table"] 			= "spamfilter_wblist";
+$liste["table"]    = "spamfilter_wblist";
 
 // Index index field of the database table
-$liste["table_idx"]			= "wblist_id";
+$liste["table_idx"]   = "wblist_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "spamfilter_whitelist_list.php";
+$liste["file"]    = "spamfilter_whitelist_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "spamfilter_whitelist_edit.php";
+$liste["edit_file"]   = "spamfilter_whitelist_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "spamfilter_whitelist_del.php";
+$liste["delete_file"]  = "spamfilter_whitelist_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "priority",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
-
-$liste["item"][] = array(	'field'		=> "rid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
-														'keyfield'=> 'id',
-														'valuefield'=> 'email'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "email",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "priority",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10));
+
+$liste["item"][] = array( 'field'  => "rid",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT id,email FROM spamfilter_users WHERE {AUTHSQL} ORDER BY email',
+		'keyfield'=> 'id',
+		'valuefield'=> 'email'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "email",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/mail/list/user_quota_stats.list.php b/interface/web/mail/list/user_quota_stats.list.php
index 5787556129448358d5ff345b63c2f2ca4244e1e4..e8faae36340d654ab2545669c21c378858920f4c 100644
--- a/interface/web/mail/list/user_quota_stats.list.php
+++ b/interface/web/mail/list/user_quota_stats.list.php
@@ -11,34 +11,34 @@
 */
 
 // Name of the list
-$liste["name"] 				= "user_quota_stats";
+$liste["name"]     = "user_quota_stats";
 
 // Database table
-$liste["table"] 			= "mail_user";
+$liste["table"]    = "mail_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "mailuser_id";
+$liste["table_idx"]   = "mailuser_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "user_quota_stats.php";
+$liste["file"]    = "user_quota_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_edit.php";
+$liste["edit_file"]   = "mail_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_del.php";
+$liste["delete_file"]  = "mail_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 // mark columns for php sorting (no real mySQL columns)
 $liste["phpsort"] = array('used_sort', 'percentage_sort');
@@ -48,34 +48,34 @@ $liste["phpsort"] = array('used_sort', 'percentage_sort');
 *****************************************************/
 
 $liste["item"][] = array(   'field'     => "email",
-                            'datatype'  => "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "name",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "quota",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'     => "",
+	'value'     => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_alias_del.php b/interface/web/mail/mail_alias_del.php
index 6457f6d86c9da18a809f3c9b8d912d93151317bf..74f6047de320a71b9ad95235bec5ab3a39e807aa 100644
--- a/interface/web/mail/mail_alias_del.php
+++ b/interface/web/mail/mail_alias_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_alias.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_alias_edit.php b/interface/web/mail/mail_alias_edit.php
index bb96a7e3a9d5d01a3fe49a1dffaedde0c306d956..30eae1424007626fd7c40c528d501d6fc86d4843 100644
--- a/interface/web/mail/mail_alias_edit.php
+++ b/interface/web/mail/mail_alias_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_alias.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,31 +49,31 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailalias',"type = 'alias'")) {
+			if(!$app->tform->checkClientLimit('limit_mailalias', "type = 'alias'")) {
 				$app->error($app->tform->wordbook["limit_mailalias_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailalias',"type = 'alias'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailalias', "type = 'alias'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailalias_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["source"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
-        $email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-		
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
+		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
+
 		// Getting Domains of the user
 		// $sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$sql = "SELECT domain FROM mail_domain WHERE domain NOT IN (SELECT SUBSTR(source,2) FROM mail_forwarding WHERE type = 'aliasdomain') AND ".$app->tform->getAuthSQL('r')." ORDER BY domain";
@@ -81,29 +81,29 @@ class page_action extends tform_actions {
 		$domain_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = ($domain["domain"] == @$email_parts[1])?'SELECTED':'';
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		//* Check if destination email belongs to user
 		if(isset($_POST["destination"])) {
 			$email = $app->db->queryOneRecord("SELECT email FROM mail_user WHERE email = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 			if($email["email"] != $app->functions->idn_encode($_POST["destination"])) $app->tform->errorMessage .= $app->tform->lng("no_destination_perm");
 		}
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -119,21 +119,21 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
-		 		
+
+
 		// compose the email field
 		$this->dataRecord["source"] = $_POST["email_local_part"]."@".$app->functions->idn_encode($_POST["email_domain"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($this->dataRecord["source"])."'");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."<br>";
 		unset($tmp);
-		
+
 		//* Check if email alias exists
 		if($this->id > 0) {
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE source = '".$app->db->quote($this->dataRecord["source"])."' AND destination = '".$app->db->quote($this->dataRecord["destination"])."' AND forwarding_id != ".$this->id);
@@ -142,22 +142,22 @@ class page_action extends tform_actions {
 		}
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_email_alias_txt")."<br>";
 		unset($tmp);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
-	
+
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_alias_list.php b/interface/web/mail/mail_alias_list.php
index 692189425ed68aee14a41b64f68f2a84692a2eff..c3b208c22b8742e17716eef18b1b24672b4e8704 100644
--- a/interface/web/mail/mail_alias_list.php
+++ b/interface/web/mail/mail_alias_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'alias'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_aliasdomain_del.php b/interface/web/mail/mail_aliasdomain_del.php
index fba0aea366b0e289f24b01ef2a2aedba896dcaea..9e9777984d91f2e37866d6470e8b50bba36be268 100644
--- a/interface/web/mail/mail_aliasdomain_del.php
+++ b/interface/web/mail/mail_aliasdomain_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_aliasdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_aliasdomain_edit.php b/interface/web/mail/mail_aliasdomain_edit.php
index 8c7b554b2e6bcb375e470e58047c545ad4aa47c9..0f2c6848bd854e542be663a89a1ef6ab02f89603 100644
--- a/interface/web/mail/mail_aliasdomain_edit.php
+++ b/interface/web/mail/mail_aliasdomain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_aliasdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,94 +49,94 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkClientLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error($app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
-		$source_domain = $app->functions->idn_decode(substr($this->dataRecord["source"],1));
-		$destination_domain = $app->functions->idn_decode(substr($this->dataRecord["destination"],1));
-		
+
+		$source_domain = $app->functions->idn_decode(substr($this->dataRecord["source"], 1));
+		$destination_domain = $app->functions->idn_decode(substr($this->dataRecord["destination"], 1));
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$domains = $app->db->queryAllRecords($sql);
-		
+
 		$source_select = '';
 		$destination_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = ($domain["domain"] == @$source_domain)?'SELECTED':'';
 				$source_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 				$selected = ($domain["domain"] == @$destination_domain)?'SELECTED':'';
 				$destination_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("source_domain",$source_select);
-		$app->tpl->setVar("destination_domain",$destination_select);
-		
+		$app->tpl->setVar("source_domain", $source_select);
+		$app->tpl->setVar("destination_domain", $destination_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if source Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["source"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["source"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check if the destination domain belongs to the user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["destination"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
-			if(!$app->tform->checkClientLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkClientLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error($app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain',"type = 'aliasdomain'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailaliasdomain', "type = 'aliasdomain'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailaliasdomain_txt"]);
 			}
 		} // end if user is not admin
-		
+
 		if($this->dataRecord["source"] == $this->dataRecord["destination"]) $app->tform->errorMessage .= $app->tform->wordbook["source_destination_identical_txt"];
-		 		
+
 		// compose the source and destination field
 		$this->dataRecord["source"] = "@".$app->db->quote($this->dataRecord["source"]);
 		$this->dataRecord["destination"] = "@".$app->db->quote($this->dataRecord["destination"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
-	
+
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_aliasdomain_list.php b/interface/web/mail/mail_aliasdomain_list.php
index 396aa61a974a26635f2da44bbfe4bf92deb2ccf8..3734f1882f1de426920796cce3de5872a54efbd9 100644
--- a/interface/web/mail/mail_aliasdomain_list.php
+++ b/interface/web/mail/mail_aliasdomain_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'aliasdomain'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_blacklist_del.php b/interface/web/mail/mail_blacklist_del.php
index 52308e615921b311499f7548e19c2f9effa7ae11..3cb83a50a00dcc3859335bc5f7e3df4546c1994b 100644
--- a/interface/web/mail/mail_blacklist_del.php
+++ b/interface/web/mail/mail_blacklist_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_blacklist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_blacklist_edit.php b/interface/web/mail/mail_blacklist_edit.php
index b2f4f6761a22204ef9f2cc8bdd7624261721fa58..2358ef942acfe749957f1eefe24462db0a52101f 100644
--- a/interface/web/mail/mail_blacklist_edit.php
+++ b/interface/web/mail/mail_blacklist_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_blacklist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,10 +49,10 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailfilter')) {
@@ -62,7 +62,7 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
@@ -85,7 +85,7 @@ class page_action extends tform_actions {
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -101,14 +101,14 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_blacklist_list.php b/interface/web/mail/mail_blacklist_list.php
index 9c118b3737a29aa48562b3a647d957ac40f91979..cf1e50ddaaf5a319cc605f1376ac47d0e6921a4a 100644
--- a/interface/web/mail/mail_blacklist_list.php
+++ b/interface/web/mail/mail_blacklist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->listform_actions->SQLExtWhere = "mail_access.access = 'REJECT'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_content_filter_del.php b/interface/web/mail/mail_content_filter_del.php
index 1cf9246dfc5d2a623f670fdbe5e4c79ea21cb343..86f5937e0a7c87c85aad237e91a1685be7a5c002 100644
--- a/interface/web/mail/mail_content_filter_del.php
+++ b/interface/web/mail/mail_content_filter_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_content_filter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_content_filter_edit.php b/interface/web/mail/mail_content_filter_edit.php
index 7ec4322b9e2b65821003da7d2a02ed6a8b7a6ec2..5672135ca1172c1e37018f44890e9d3c582bac7b 100644
--- a/interface/web/mail/mail_content_filter_edit.php
+++ b/interface/web/mail/mail_content_filter_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_content_filter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -67,9 +67,10 @@ class page_action extends tform_actions {
 			unset($rec);
 		}
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_content_filter_list.php b/interface/web/mail/mail_content_filter_list.php
index c2eb5e1382d3b057b21d00afa8c3f75bad79fdac..daa202d79886fa3f7b2b3ad45c2a960be61288d5 100644
--- a/interface/web/mail/mail_content_filter_list.php
+++ b/interface/web/mail/mail_content_filter_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_catchall_del.php b/interface/web/mail/mail_domain_catchall_del.php
index 7eb21c7416651a5ccbbe219c3b483e21b6f48704..e862d861c6f3c323f12e8a53af15a32932cb91fd 100644
--- a/interface/web/mail/mail_domain_catchall_del.php
+++ b/interface/web/mail/mail_domain_catchall_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_domain_catchall.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_catchall_edit.php b/interface/web/mail/mail_domain_catchall_edit.php
index 7dc73306c61b95df117a01bd5fc371b25f41fe72..db49e46bc603456fea29c9e79861027969a2830a 100644
--- a/interface/web/mail/mail_domain_catchall_edit.php
+++ b/interface/web/mail/mail_domain_catchall_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_domain_catchall.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,54 +49,54 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailcatchall',"type = 'catchall'")) {
+			if(!$app->tform->checkClientLimit('limit_mailcatchall', "type = 'catchall'")) {
 				$app->error($app->tform->wordbook["limit_mailcatchall_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailcatchall',"type = 'catchall'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailcatchall', "type = 'catchall'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailcatchall_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["source"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
 		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-        
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r');
 		$domains = $app->db->queryAllRecords($sql);
 		$domain_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = (isset($email_parts[1]) && $domain["domain"] == $email_parts[1])?'SELECTED':'';
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -112,29 +112,29 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		 		
+
 		// compose the email field
 		$this->dataRecord["source"] = "@".$app->functions->idn_encode($_POST["email_domain"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		//unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_catchall_list.php b/interface/web/mail/mail_domain_catchall_list.php
index a703a1784cab50da791cff6c7afa5ad492ba7945..49b41230f9c0e33eb75464f7947fa92efedfcc15 100644
--- a/interface/web/mail/mail_domain_catchall_list.php
+++ b/interface/web/mail/mail_domain_catchall_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'catchall'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_del.php b/interface/web/mail/mail_domain_del.php
index 806996aa312585155e13df4e348efbe41682510c..ba715a6dfc6bedcf432b6eaaf804986616a46faf 100644
--- a/interface/web/mail/mail_domain_del.php
+++ b/interface/web/mail/mail_domain_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_domain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -53,46 +53,47 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
+
 		$domain = $this->dataRecord['domain'];
-		
+
 		// Before we delete the email domain,
 		// we will delete all depending records.
-		
+
 		// Delete all forwardings where the source or destination belongs to this domain
 		$records = $app->db->queryAllRecords("SELECT forwarding_id as id FROM mail_forwarding WHERE source like '%@".$app->db->quote($domain)."' OR (destination like '%@".$app->db->quote($domain)."' AND type != 'forward')");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_forwarding','forwarding_id',$rec['id']);
+			$app->db->datalogDelete('mail_forwarding', 'forwarding_id', $rec['id']);
 		}
-		
+
 		// Delete all fetchmail accounts where destination belongs to this domain
 		$records = $app->db->queryAllRecords("SELECT mailget_id as id FROM mail_get WHERE destination like '%@".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_get','mailget_id',$rec['id']);
+			$app->db->datalogDelete('mail_get', 'mailget_id', $rec['id']);
 		}
-		
+
 		// Delete all mailboxes where destination belongs to this domain
 		$records = $app->db->queryAllRecords("SELECT mailuser_id as id FROM mail_user WHERE email like '%@".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_user','mailuser_id',$rec['id']);
+			$app->db->datalogDelete('mail_user', 'mailuser_id', $rec['id']);
 		}
-		
+
 		// Delete all spamfilters that belong to this domain
 		$records = $app->db->queryAllRecords("SELECT id FROM spamfilter_users WHERE email = '%@".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('spamfilter_users','id',$rec['id']);
+			$app->db->datalogDelete('spamfilter_users', 'id', $rec['id']);
 		}
-		
+
 		// Delete all mailinglists that belong to this domain
 		$records = $app->db->queryAllRecords("SELECT mailinglist_id FROM mail_mailinglist WHERE domain = '".$app->db->quote($domain)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('mail_mailinglist','mailinglist_id',$rec['id']);
+			$app->db->datalogDelete('mail_mailinglist', 'mailinglist_id', $rec['id']);
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_dkim_create.php b/interface/web/mail/mail_domain_dkim_create.php
index 495c8df274a9ed773debd2e629494ccecc9eb7ab..2640894c51562c968a07e3588b0e817f1586fc8c 100644
--- a/interface/web/mail/mail_domain_dkim_create.php
+++ b/interface/web/mail/mail_domain_dkim_create.php
@@ -1,41 +1,42 @@
 <?php
 
 /**
-Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
-Copyright (c) 2013, Florian Schaal, info@schaal-24.de
-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.
-
-This script is invoked by interface/js/mail_domain_dkim.js
-to generate or show the DKIM Private-key and to show the Private-key.
-returns DKIM Private-Key and DKIM Public-Key
-*/ 
-
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
-require_once('../../lib/classes/validate_dkim.inc.php');
+ Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
+ Copyright (c) 2013, Florian Schaal, info@schaal-24.de
+ 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.
+
+ This script is invoked by interface/js/mail_domain_dkim.js
+ to generate or show the DKIM Private-key and to show the Private-key.
+ returns DKIM Private-Key and DKIM Public-Key
+ */
+
+
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
+require_once '../../lib/classes/validate_dkim.inc.php';
 
 $validate_dkim=new validate_dkim ();
 
@@ -45,54 +46,57 @@ $app->auth->check_module_permissions('mail');
 header('Content-Type: text/xml; charset=utf-8');
 header('Cache-Control: must-revalidate, pre-check=0, no-store, no-cache, max-age=0, post-check=0');
 
+
 /**
-* This function fix PHP's messing up POST input containing characters space, dot, 
-* open square bracket and others to be compatible with with the deprecated register_globals
-* @return array POST
-*/
+ * This function fix PHP's messing up POST input containing characters space, dot,
+ * open square bracket and others to be compatible with with the deprecated register_globals
+ * @return array POST
+ */
 function getRealPOST() {
-    $pairs = explode("&", file_get_contents("php://input"));
-    $vars = array();
-    foreach ($pairs as $pair) {
-        $nv = explode("=", $pair, 2);
-        $name = urldecode($nv[0]);
-        $value = $nv[1];
-        $vars[$name] = $value;
-    }
-    return $vars;
+	$pairs = explode("&", file_get_contents("php://input"));
+	$vars = array();
+	foreach ($pairs as $pair) {
+		$nv = explode("=", $pair, 2);
+		$name = urldecode($nv[0]);
+		$value = $nv[1];
+		$vars[$name] = $value;
+	}
+	return $vars;
 }
 
+
 /**
-* This function formats the public-key
-* @param array $pubkey
-* @return string public-key
-*/
+ * This function formats the public-key
+ * @param array $pubkey
+ * @return string public-key
+ */
 function pub_key($pubkey) {
-        $public_key='';
-        foreach($pubkey as $values) $public_key=$public_key.$values."\n";
-        return $public_key;
+	$public_key='';
+	foreach($pubkey as $values) $public_key=$public_key.$values."\n";
+	return $public_key;
 }
+
 $_POST=getRealPOST();
 
 switch ($_POST['action']) {
-	case 'create':	/* create DKIM Private-key */
-		exec('openssl rand -out /usr/local/ispconfig/server/temp/random-data.bin 4096',$output,$result);
-		exec('openssl genrsa -rand /usr/local/ispconfig/server/temp/random-data.bin 1024',$privkey,$result);
-		unlink("/usr/local/ispconfig/server/temp/random-data.bin");
-		$private_key='';
-		foreach($privkey as $values) $private_key=$private_key.$values."\n";
-		if($validate_dkim->validate_post('private',$private_key)) { /* validate the $_POST-value */
-			exec('echo '.escapeshellarg($private_key).'|openssl rsa -pubout -outform PEM',$pubkey,$result);
-			$public_key=pub_key($pubkey);
-		} else { $public_key='invalid key'; }
+case 'create': /* create DKIM Private-key */
+	exec('openssl rand -out /usr/local/ispconfig/server/temp/random-data.bin 4096', $output, $result);
+	exec('openssl genrsa -rand /usr/local/ispconfig/server/temp/random-data.bin 1024', $privkey, $result);
+	unlink("/usr/local/ispconfig/server/temp/random-data.bin");
+	$private_key='';
+	foreach($privkey as $values) $private_key=$private_key.$values."\n";
+	if($validate_dkim->validate_post('private', $private_key)) { /* validate the $_POST-value */
+		exec('echo '.escapeshellarg($private_key).'|openssl rsa -pubout -outform PEM', $pubkey, $result);
+		$public_key=pub_key($pubkey);
+	} else { $public_key='invalid key'; }
 	break;
-	case 'show': /* show the DNS-Record onLoad */
-		$private_key=$_POST['pkey'];
-		if($validate_dkim->validate_post('private',$private_key)) { /* validate the $_POST-value */
-			/* get the public-key */
-			exec('echo '.escapeshellarg($private_key).'|openssl rsa -pubout -outform PEM',$pubkey,$result);
-			$public_key=pub_key($pubkey);
-		} else { $public_key='invalid key'; }
+case 'show': /* show the DNS-Record onLoad */
+	$private_key=$_POST['pkey'];
+	if($validate_dkim->validate_post('private', $private_key)) { /* validate the $_POST-value */
+		/* get the public-key */
+		exec('echo '.escapeshellarg($private_key).'|openssl rsa -pubout -outform PEM', $pubkey, $result);
+		$public_key=pub_key($pubkey);
+	} else { $public_key='invalid key'; }
 	break;
 }
 echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index f8ce78d5e14ae1f01878e526b899780be3b1a980..0f90dd6416490648f4639bb6ce7c4eb0927bf067 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_domain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -72,7 +72,7 @@ class page_action extends tform_actions {
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Clients of the user
 			$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>";
@@ -83,7 +83,7 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
@@ -93,7 +93,7 @@ class page_action extends tform_actions {
 
 			// 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]");
-			$app->tpl->setVar("server_id","<option value='$client[default_mailserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_mailserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 			// Fill the client select field
@@ -108,7 +108,7 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		}
 
@@ -142,7 +142,7 @@ class page_action extends tform_actions {
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
+			$app->tpl->setVar("domain_option", $domain_select);
 		}
 
 
@@ -157,7 +157,7 @@ class page_action extends tform_actions {
 				$policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("policy",$policy_select);
+		$app->tpl->setVar("policy", $policy_select);
 		unset($policys);
 		unset($policy_select);
 		unset($tmp_user);
@@ -175,21 +175,21 @@ class page_action extends tform_actions {
 
 	function onSubmit() {
 		global $app, $conf;
-		
-        /* check if the domain module is used - and check if the selected domain can be used! */
+
+		/* check if the domain module is used - and check if the selected domain can be used! */
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
-            $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
-            if(!$domain_check) {
-                // invalid domain selected
-                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-            } else {
-                $this->dataRecord['domain'] = $domain_check;
-            }
-        }
-        
-        if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+			if(!$domain_check) {
+				// invalid domain selected
+				$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+			} else {
+				$this->dataRecord['domain'] = $domain_check;
+			}
+		}
+
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -275,7 +275,7 @@ class page_action extends tform_actions {
 		} else {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT domain from mail_domain WHERE domain_id = ".$this->id);
-			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
 				$this->dataRecord["domain"] = $rec['domain'];
@@ -328,7 +328,7 @@ class page_action extends tform_actions {
 		//** If the domain name or owner has been changed, change the domain and owner in all mailbox records
 		if($this->oldDataRecord['domain'] != $this->dataRecord['domain'] || (isset($this->dataRecord['client_group_id']) && $this->oldDataRecord['sys_groupid'] != $this->dataRecord['client_group_id'])) {
 			$app->uses('getconf');
-			$mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"],'mail');
+			$mail_config = $app->getconf->get_server_config($this->dataRecord["server_id"], 'mail');
 
 			//* Update the mailboxes
 			$mailusers = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE email like '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
@@ -338,9 +338,9 @@ class page_action extends tform_actions {
 			if(is_array($mailusers)) {
 				foreach($mailusers as $rec) {
 					// setting Maildir, Homedir, UID and GID
-					$mail_parts = explode("@",$rec['email']);
-					$maildir = str_replace("[domain]",$this->dataRecord['domain'],$mail_config["maildir_path"]);
-					$maildir = str_replace("[localpart]",$mail_parts[0],$maildir);
+					$mail_parts = explode("@", $rec['email']);
+					$maildir = str_replace("[domain]", $this->dataRecord['domain'], $mail_config["maildir_path"]);
+					$maildir = str_replace("[localpart]", $mail_parts[0], $maildir);
 					$maildir = $app->db->quote($maildir);
 					$email = $app->db->quote($mail_parts[0].'@'.$this->dataRecord['domain']);
 					$app->db->datalogUpdate('mail_user', "maildir = '$maildir', email = '$email', sys_userid = $client_user_id, sys_groupid = '$sys_groupid'", 'mailuser_id', $rec['mailuser_id']);
@@ -351,12 +351,12 @@ class page_action extends tform_actions {
 			$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE source like '%@".$app->db->quote($this->oldDataRecord['domain'])."' OR destination like '%@".$app->db->quote($this->oldDataRecord['domain'])."'");
 			if(is_array($forwardings)) {
 				foreach($forwardings as $rec) {
-					$destination = $app->db->quote(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['destination']));
-					$source = $app->db->quote(str_replace($this->oldDataRecord['domain'],$this->dataRecord['domain'],$rec['source']));
+					$destination = $app->db->quote(str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['destination']));
+					$source = $app->db->quote(str_replace($this->oldDataRecord['domain'], $this->dataRecord['domain'], $rec['source']));
 					$app->db->datalogUpdate('mail_forwarding', "source = '$source', destination = '$destination', sys_userid = $client_user_id, sys_groupid = '$sys_groupid'", 'forwarding_id', $rec['forwarding_id']);
 				}
 			}
-			
+
 			//* Update the mailinglist
 			$app->db->query("UPDATE mail_mailinglist SET sys_userid = $client_user_id, sys_groupid = $sys_groupid WHERE domain = '".$app->db->quote($this->oldDataRecord['domain'])."'");
 
@@ -374,4 +374,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_domain_list.php b/interface/web/mail/mail_domain_list.php
index cad650643748ca4535e06b1266ca3e39e16a2a9b..ac2d3949e828f610b75a111227af508184490931 100644
--- a/interface/web/mail/mail_domain_list.php
+++ b/interface/web/mail/mail_domain_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -25,4 +25,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY mail_domain.domain';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_forward_del.php b/interface/web/mail/mail_forward_del.php
index 716a780b7095076a8a52ee47d5083431a9849f8a..3e2a80ac99d2a9a97d59c0c865e581dbeec4a800 100644
--- a/interface/web/mail/mail_forward_del.php
+++ b/interface/web/mail/mail_forward_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_forward.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php
index e9fca4747058805a300177deb1d9bf4c1cc053bf..808e394225821fd9fa0b372474c1f9d3b50b5bc4 100644
--- a/interface/web/mail/mail_forward_edit.php
+++ b/interface/web/mail/mail_forward_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_forward.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,53 +49,53 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailforward',"type = 'forward'")) {
+			if(!$app->tform->checkClientLimit('limit_mailforward', "type = 'forward'")) {
 				$app->error($app->tform->wordbook["limit_mailforward_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailforward',"type = 'forward'")) {
+			if(!$app->tform->checkResellerLimit('limit_mailforward', "type = 'forward'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailforward_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["source"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
 		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-        
+
 		// Getting Domains of the user
 		//$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$sql = "SELECT domain FROM mail_domain WHERE domain NOT IN (SELECT SUBSTR(source,2) FROM mail_forwarding WHERE type = 'aliasdomain') AND ".$app->tform->getAuthSQL('r')." ORDER BY domain";
 		$domains = $app->db->queryAllRecords($sql);
 		$domain_select = '';
 		foreach( $domains as $domain) {
-            $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+			$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 			$selected = (isset($email_parts[1]) && $domain["domain"] == $email_parts[1])?'SELECTED':'';
 			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -111,34 +111,34 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		 		
+
 		// compose the email field
 		$this->dataRecord["source"] = $_POST["email_local_part"]."@".$app->functions->idn_encode($_POST["email_domain"]);
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		//* Check if there is no active mailbox with this address
 		$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE postfix = 'y' AND email = '".$app->db->quote($this->dataRecord["source"])."'");
 		if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."<br>";
 		unset($tmp);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("update mail_forwarding SET sys_groupid = ".$domain['sys_groupid']." WHERE forwarding_id = ".$this->id);
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_forward_list.php b/interface/web/mail/mail_forward_list.php
index 4fd479012e208056dadd28801b3f850869f14c44..48b8975bb51f7dd3a91b348f6cadb150864947a6 100644
--- a/interface/web/mail/mail_forward_list.php
+++ b/interface/web/mail/mail_forward_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->listform_actions->SQLExtWhere = "mail_forwarding.type = 'forward'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_get_del.php b/interface/web/mail/mail_get_del.php
index 5a528a8b0c63b556059b49a0c99e8af279644547..0476047489569250d53754b789ccc498b9822a80 100644
--- a/interface/web/mail/mail_get_del.php
+++ b/interface/web/mail/mail_get_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_get.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_get_edit.php b/interface/web/mail/mail_get_edit.php
index cd7741b65824dff1fef370600f3ee51b17c16d59..815990f76976fb8ea781bb3112ef23da183019a9 100644
--- a/interface/web/mail/mail_get_edit.php
+++ b/interface/web/mail/mail_get_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_get.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,10 +49,10 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_fetchmail')) {
@@ -62,19 +62,19 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_fetchmail_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		//* Check if destination email belongs to user
 		if(isset($_POST["destination"])) {
 			$email = $app->db->queryOneRecord("SELECT email FROM mail_user WHERE email = '".$app->db->quote($app->functions->idn_encode($_POST["destination"]))."' AND ".$app->tform->getAuthSQL('r'));
 			if($email["email"] != $app->functions->idn_encode($_POST["destination"])) $app->tform->errorMessage .= $app->tform->lng("no_destination_perm");
 		}
-		
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -90,32 +90,32 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
-		
+
+
 		// Set the server ID according to the selected destination
 		$tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["destination"])."'");
 		$this->dataRecord["server_id"] = $tmp["server_id"];
 		unset($tmp);
-		
+
 		//* Check that no illegal combination of options is set
 		if((!isset($this->dataRecord['source_delete']) || @$this->dataRecord['source_delete'] == 'n') && $this->dataRecord['source_read_all'] == 'y') {
 			$app->tform->errorMessage .= $app->tform->lng('error_delete_read_all_combination')."<br>";
 		}
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app;
-		
+
 		$tmp = $app->db->queryOneRecord("SELECT sys_groupid FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["destination"])."'");
 		$app->db->query("update mail_get SET sys_groupid = ".$tmp['sys_groupid']." WHERE mailget_id = ".$this->id);
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_get_list.php b/interface/web/mail/mail_get_list.php
index f4850583f31ad0c372946329413ce6e64ed244f4..eb9c42bee67c13b6159561233d1f147187dc0733 100644
--- a/interface/web/mail/mail_get_list.php
+++ b/interface/web/mail/mail_get_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_mailinglist_del.php b/interface/web/mail/mail_mailinglist_del.php
index 1622aefb010b4efb0ab4d1abdb2f6467e8f7373e..2782ec5603ea2257a0819366b3447ae40687ecc7 100644
--- a/interface/web/mail/mail_mailinglist_del.php
+++ b/interface/web/mail/mail_mailinglist_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_mailinglist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -55,4 +55,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_mailinglist_edit.php b/interface/web/mail/mail_mailinglist_edit.php
index 5864396f585c0343fd08fd3c6f9919f4b5acbace..837995c52a94a1a91d0fbe0f089b67fe4a1fa0b1 100644
--- a/interface/web/mail/mail_mailinglist_edit.php
+++ b/interface/web/mail/mail_mailinglist_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_mailinglist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,11 +49,11 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
-	
+
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailmailinglist')) {
@@ -63,13 +63,13 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailmailinglist_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
 			// Getting Clients of the user
 			$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";
@@ -83,7 +83,7 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
@@ -103,9 +103,9 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 		}
-		
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$domains = $app->db->queryAllRecords($sql);
@@ -116,8 +116,8 @@ class page_action extends tform_actions {
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("domain_option",$domain_select);
-		
+		$app->tpl->setVar("domain_option", $domain_select);
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -127,19 +127,19 @@ class page_action extends tform_actions {
 		} else {
 			$app->tpl->setVar("edit_disabled", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		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_mailmailinglist, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Check if Domain belongs to user
 			if(isset($_POST["domain"])) {
 				$domain = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."' AND ".$app->tform->getAuthSQL('r'));
@@ -151,19 +151,19 @@ class page_action extends tform_actions {
 				//Check if email is in use
 				$check = $app->db->queryOneRecord("SELECT count(source) as number FROM mail_forwarding WHERE source = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'");
 				if($check['number'] != 0) {
-						$app->error($app->tform->wordbook["email_in_use_txt"]);
+					$app->error($app->tform->wordbook["email_in_use_txt"]);
 				}
-				
+
 				$check = $app->db->queryOneRecord("SELECT count(email) as number FROM mail_user WHERE email = '".$this->dataRecord["listname"]."@".$this->dataRecord["domain"]."'");
 				if($check['number'] != 0) {
-						$app->error($app->tform->wordbook["email_in_use_txt"]);
+					$app->error($app->tform->wordbook["email_in_use_txt"]);
 				}
-				
+
 				$check = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE listname = '".$this->dataRecord["listname"]."' AND domain = '".$this->dataRecord["domain"]."'");
 				if($check['number'] != 0) {
-						$app->error($app->tform->wordbook["email_in_use_txt"]);
+					$app->error($app->tform->wordbook["email_in_use_txt"]);
 				}
-				
+
 				// Check if the user may add another mail_domain
 				if($client["limit_mailmailinglist"] >= 0) {
 					$tmp = $app->db->queryOneRecord("SELECT count(mailinglist_id) as number FROM mail_mailinglist WHERE sys_groupid = $client_group_id");
@@ -182,7 +182,7 @@ class page_action extends tform_actions {
 
 		parent::onSubmit();
 	}
-	
+
 	function onBeforeInsert() {
 		global $app, $conf;
 
@@ -190,7 +190,7 @@ class page_action extends tform_actions {
 		$domain = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain = '".$this->dataRecord["domain"]."'");
 		$this->dataRecord["server_id"] = $domain['server_id'];
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
 
@@ -205,10 +205,10 @@ class page_action extends tform_actions {
 			$app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id);
 		}
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		//* Check if the server has been changed
 		// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
 		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -219,7 +219,7 @@ class page_action extends tform_actions {
 		} else {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT domain from mail_mailinglist WHERE mailinglist_id = ".$this->id);
-			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+			if($rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
 				$this->dataRecord["domain"] = $rec['domain'];
@@ -227,10 +227,10 @@ class page_action extends tform_actions {
 			unset($rec);
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		// make sure that the record belongs to the clinet group and not the admin group when admin inserts it
 		// also make sure that the user can not delete domain created by a admin
 		if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
@@ -242,7 +242,7 @@ class page_action extends tform_actions {
 			$app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id);
 		}
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_mailinglist_list.php b/interface/web/mail/mail_mailinglist_list.php
index 732b14391bae62c2af3f109317aa5a659d090806..e1e2daf9127c1bf8744f9ef3a58d5319909cbea8 100644
--- a/interface/web/mail/mail_mailinglist_list.php
+++ b/interface/web/mail/mail_mailinglist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -19,26 +19,26 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('mail');
-		
+
 		if($global_config['mailmailinglist_link'] == 'y') {
-			$app->tpl->setVar('mailmailinglist_link',1);
+			$app->tpl->setVar('mailmailinglist_link', 1);
 		} else {
-			$app->tpl->setVar('mailmailinglist_link',0);
+			$app->tpl->setVar('mailmailinglist_link', 0);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_relay_recipient_del.php b/interface/web/mail/mail_relay_recipient_del.php
index 62972ec1750a645a46eff6d9b961fdafa46336c4..8cbba81d8927c9436d87b585c3217144a1364cfc 100644
--- a/interface/web/mail/mail_relay_recipient_del.php
+++ b/interface/web/mail/mail_relay_recipient_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_relay_recipient.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_relay_recipient_edit.php b/interface/web/mail/mail_relay_recipient_edit.php
index 46a5d4cbb77cd56743bde212aef62f42ce236eaf..f0ca7847f74ee5e08ceb1a6a9f86b19deb971837 100644
--- a/interface/web/mail/mail_relay_recipient_edit.php
+++ b/interface/web/mail/mail_relay_recipient_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_relay_recipient.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,11 +49,11 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_relay_recipient_list.php b/interface/web/mail/mail_relay_recipient_list.php
index 5e6963c7bac01e5981df21500e6840d2bf15335f..d03609c69679f0d8d042deff304e97945f6cf8fd 100644
--- a/interface/web/mail/mail_relay_recipient_list.php
+++ b/interface/web/mail/mail_relay_recipient_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -16,9 +16,9 @@ $list_def_file = "list/mail_relay_recipient.list.php";
 $app->auth->check_module_permissions('mail');
 
 $app->uses('listform_actions');
-# $app->listform_actions->SQLExtWhere = "access = 'OK'";
+// $app->listform_actions->SQLExtWhere = "access = 'OK'";
 
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_spamfilter_del.php b/interface/web/mail/mail_spamfilter_del.php
index 6d922b50839549a3140fda1296f68d7bde991378..06763b0637465f5a9cb47d9ccd8a0e8c8cb08ef6 100644
--- a/interface/web/mail/mail_spamfilter_del.php
+++ b/interface/web/mail/mail_spamfilter_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_spamfilter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_spamfilter_edit.php b/interface/web/mail/mail_spamfilter_edit.php
index 768ec9b95d0fbcdbdd61938f0a24e8ef4b815213..50ecb4ff376e1613dcfdfc135db5c2e8b7d0d686 100644
--- a/interface/web/mail/mail_spamfilter_edit.php
+++ b/interface/web/mail/mail_spamfilter_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_spamfilter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,15 +49,15 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		// Getting email from data record
 		$email = $this->dataRecord["email"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
-		
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
+
 		// Getting Domains of the user
 		$sql = "SELECT domain FROM mail_domain WHERE type = 'local' AND ".$app->tform->getAuthSQL('r');
 		$domains = $app->db->queryAllRecords($sql);
@@ -66,30 +66,30 @@ class page_action extends tform_actions {
 			$selected = ($domain["domain"] == $email_parts[1])?'SELECTED':'';
 			$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
-		
+		$app->tpl->setVar("email_domain", $domain_select);
+
 		// calculate scores
 		if(count($this->dataRecord) > 0) {
-			$app->tpl->setVar("spam_rewrite_score_int",number_format($this->dataRecord["spam_rewrite_score_int"] / 100, 2, '.', ''));
-			$app->tpl->setVar("spam_redirect_score_int",number_format($this->dataRecord["spam_redirect_score_int"] / 100, 2, '.', ''));
-			$app->tpl->setVar("spam_delete_score_int",number_format($this->dataRecord["spam_delete_score_int"] / 100, 2, '.', ''));
+			$app->tpl->setVar("spam_rewrite_score_int", number_format($this->dataRecord["spam_rewrite_score_int"] / 100, 2, '.', ''));
+			$app->tpl->setVar("spam_redirect_score_int", number_format($this->dataRecord["spam_redirect_score_int"] / 100, 2, '.', ''));
+			$app->tpl->setVar("spam_delete_score_int", number_format($this->dataRecord["spam_delete_score_int"] / 100, 2, '.', ''));
 		}
-		
+
 		// Changing maildir to mailbox_id
 		$sql = "SELECT mailbox_id FROM mail_box WHERE maildir = '".$this->dataRecord["spam_redirect_maildir"]."' AND ".$app->tform->getAuthSQL('r');
 		$mailbox = $app->db->queryOneRecord($sql);
 		$this->dataRecord["spam_redirect_maildir"] = $mailbox["mailbox_id"];
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Check if Domain belongs to user
 		$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
 		if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
-		
+
 		// compose the email field
 		if($_POST["email_local_part"] != '') {
 			$this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
@@ -98,27 +98,27 @@ class page_action extends tform_actions {
 		}
 		// Set the server id of the mailbox = server ID of mail domain.
 		$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 		unset($this->dataRecord["email_local_part"]);
 		unset($this->dataRecord["email_domain"]);
-		
+
 		// calculate scores
-		$this->dataRecord["spam_rewrite_score_int"] 	= $_POST["spam_rewrite_score_int"] * 100;
-		$this->dataRecord["spam_redirect_score_int"] 	= $_POST["spam_redirect_score_int"] * 100;
-		$this->dataRecord["spam_delete_score_int"] 		= $_POST["spam_delete_score_int"] * 100;
-		
+		$this->dataRecord["spam_rewrite_score_int"]  = $_POST["spam_rewrite_score_int"] * 100;
+		$this->dataRecord["spam_redirect_score_int"]  = $_POST["spam_redirect_score_int"] * 100;
+		$this->dataRecord["spam_delete_score_int"]   = $_POST["spam_delete_score_int"] * 100;
+
 		// Changing mailbox_id to maildir
 		$sql = "SELECT maildir FROM mail_box WHERE mailbox_id = '".$app->functions->intval($_POST["spam_redirect_maildir"])."' AND ".$app->tform->getAuthSQL('r');
 		$mailbox = $app->db->queryOneRecord($sql);
 		$this->dataRecord["spam_redirect_maildir"] = $mailbox["maildir"];
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_spamfilter_list.php b/interface/web/mail/mail_spamfilter_list.php
index 8979a4696c42e687d25c34c5212f071122c630aa..39bc8ced3df42a9cf8edabfa445e970488375613 100644
--- a/interface/web/mail/mail_spamfilter_list.php
+++ b/interface/web/mail/mail_spamfilter_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_transport_del.php b/interface/web/mail/mail_transport_del.php
index 1c2ec67e2aaa38a95896dd4a0e9f1747b375d371..5c40b91e73faa40107d5be90841a2170884dbd7a 100644
--- a/interface/web/mail/mail_transport_del.php
+++ b/interface/web/mail/mail_transport_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_transport.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_transport_edit.php b/interface/web/mail/mail_transport_edit.php
index c33970eea7e6c259e94b9d8836d8f00525e99b8a..51abd68e7224410a94d221e1d5e48f9b8a290bfc 100644
--- a/interface/web/mail/mail_transport_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_transport.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -50,10 +50,10 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailrouting')) {
@@ -63,15 +63,15 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailrouting_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
-		$tmp_parts = explode(":",$this->dataRecord["transport"]);
-		if(!empty($this->id) && !stristr($this->dataRecord["transport"],':')) {
+
+		$tmp_parts = explode(":", $this->dataRecord["transport"]);
+		if(!empty($this->id) && !stristr($this->dataRecord["transport"], ':')) {
 			$rec["type"] = 'custom';
 		} else {
 			if(empty($this->id) && empty($tmp_parts[0])) {
@@ -87,15 +87,15 @@ class page_action extends tform_actions {
 		} else {
 			$dest = $this->dataRecord["transport"];
 		}
-		if(@substr($dest,0,1) == '[') {
+		if(@substr($dest, 0, 1) == '[') {
 			$rec["mx"] = 'checked="CHECKED"';
-			$rec["destination"] = @str_replace(']','',@str_replace('[','',$dest));
+			$rec["destination"] = @str_replace(']', '', @str_replace('[', '', $dest));
 		} else {
 			$rec["mx"] = '';
 			$rec["destination"] = @$dest;
 		}
-		
-		$types = array('smtp' => 'smtp','uucp' => 'uucp','slow' => 'slow', 'error' => 'error', 'custom' => 'custom','' => 'null');
+
+		$types = array('smtp' => 'smtp', 'uucp' => 'uucp', 'slow' => 'slow', 'error' => 'error', 'custom' => 'custom', '' => 'null');
 		$type_select = '';
 		if(is_array($types)) {
 			foreach( $types as $key => $val) {
@@ -107,7 +107,7 @@ class page_action extends tform_actions {
 		$app->tpl->setVar($rec);
 		unset($type);
 		unset($types);
-		
+
 		parent::onShowEnd();
 	}
 
@@ -129,7 +129,7 @@ class page_action extends tform_actions {
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -145,11 +145,11 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		//* Compose transport field
 		if($this->dataRecord["mx"] == 'y') {
-			if(stristr($this->dataRecord["destination"],':')) {
-				$tmp_parts = explode(":",$this->dataRecord["destination"]);
+			if(stristr($this->dataRecord["destination"], ':')) {
+				$tmp_parts = explode(":", $this->dataRecord["destination"]);
 				$transport = '['.$tmp_parts[0].']:'.$tmp_parts[1];
 			} else {
 				$transport = '['.$this->dataRecord["destination"].']';
@@ -157,23 +157,23 @@ class page_action extends tform_actions {
 		} else {
 			$transport = $this->dataRecord["destination"];
 		}
-		
+
 		if($this->dataRecord["type"] == 'custom') {
 			$this->dataRecord["transport"] = $transport;
 		} else {
 			$this->dataRecord["transport"] = $this->dataRecord["type"].':'.$transport;
 		}
-		
+
 		unset($this->dataRecord["type"]);
 		unset($this->dataRecord["mx"]);
 		unset($this->dataRecord["destination"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_transport_list.php b/interface/web/mail/mail_transport_list.php
index 9d87728e6b6ed995885d7ae9f6fb08929542ef1b..d96959f524d93c4c7dc3a9f54a0b1baaa4e07235 100644
--- a/interface/web/mail/mail_transport_list.php
+++ b/interface/web/mail/mail_transport_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,4 +23,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_del.php b/interface/web/mail/mail_user_del.php
index a6d5346ef56031b588167b53e6e83a5b7562950e..6b309f88f15b70c8bc92c2800909cb1d7fe784f3 100644
--- a/interface/web/mail/mail_user_del.php
+++ b/interface/web/mail/mail_user_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -53,21 +53,22 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-			
-			$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
-			$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
-			
-			$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = '".$this->id."'");
-			if(is_array($tmp_filters)) {
-				foreach($tmp_filters as $tmp) {
-					$app->db->datalogDelete('mail_user_filter', 'filter_id', $tmp["filter_id"]);
-				}
+
+		$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
+		$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
+
+		$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = '".$this->id."'");
+		if(is_array($tmp_filters)) {
+			foreach($tmp_filters as $tmp) {
+				$app->db->datalogDelete('mail_user_filter', 'filter_id', $tmp["filter_id"]);
 			}
-			
 		}
+
+	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php
index da3f99cb419c8fdcfe6de89f39cb9fcc8315222b..7e983ae9a52d8c873ff73d4a291a410dcdf31883 100644
--- a/interface/web/mail/mail_user_edit.php
+++ b/interface/web/mail/mail_user_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,11 +49,11 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
-	
+
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailbox')) {
@@ -63,18 +63,18 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailbox_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$email = $this->dataRecord["email"];
-		$email_parts = explode("@",$email);
-		$app->tpl->setVar("email_local_part",$email_parts[0]);
+		$email_parts = explode("@", $email);
+		$app->tpl->setVar("email_local_part", $email_parts[0]);
 		$email_parts[1] = $app->functions->idn_decode($email_parts[1]);
-        
+
 		// Getting Domains of the user
 		// $sql = "SELECT domain, server_id FROM mail_domain WHERE ".$app->tform->getAuthSQL('r').' ORDER BY domain';
 		$sql = "SELECT domain, server_id FROM mail_domain WHERE domain NOT IN (SELECT SUBSTR(source,2) FROM mail_forwarding WHERE type = 'aliasdomain') AND ".$app->tform->getAuthSQL('r')." ORDER BY domain";
@@ -82,15 +82,15 @@ class page_action extends tform_actions {
 		$domain_select = '';
 		if(is_array($domains)) {
 			foreach( $domains as $domain) {
-                $domain['domain'] = $app->functions->idn_decode($domain['domain']);
+				$domain['domain'] = $app->functions->idn_decode($domain['domain']);
 				$selected = ($domain["domain"] == @$email_parts[1])?'SELECTED':'';
 				$domain_select .= "<option value='$domain[domain]' $selected>$domain[domain]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("email_domain",$domain_select);
+		$app->tpl->setVar("email_domain", $domain_select);
 		unset($domains);
 		unset($domain_select);
-		
+
 		// Get the spamfilter policys for the user
 		$tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '".$this->dataRecord["email"]."'");
 		$sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r');
@@ -102,59 +102,59 @@ class page_action extends tform_actions {
 				$policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("policy",$policy_select);
+		$app->tpl->setVar("policy", $policy_select);
 		unset($policys);
 		unset($policy_select);
 		unset($tmp_user);
-		
+
 		// Convert quota from Bytes to MB
-		if($this->dataRecord["quota"] != -1) $app->tpl->setVar("quota",$this->dataRecord["quota"] / 1024 / 1024);
-		
+		if($this->dataRecord["quota"] != -1) $app->tpl->setVar("quota", $this->dataRecord["quota"] / 1024 / 1024);
+
 		// Is autoresponder set?
 		if (!empty($this->dataRecord['autoresponder']) && $this->dataRecord['autoresponder'] == 'y') {
 			$app->tpl->setVar("ar_active", 'checked="checked"');
 		} else {
 			$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']);
 		}
-		
-    $app->uses('getconf');
-    $mail_config = $app->getconf->get_global_config('mail');
+
+		$app->uses('getconf');
+		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config["enable_custom_login"] == "y") {
-		    $app->tpl->setVar("enable_custom_login", 1);
+			$app->tpl->setVar("enable_custom_login", 1);
 		} else {
-		    $app->tpl->setVar("enable_custom_login", 0);
+			$app->tpl->setVar("enable_custom_login", 0);
 		}
-		
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		//* Check if Domain belongs to user
 		if(isset($_POST["email_domain"])) {
 			$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 			if($domain["domain"] != $app->functions->idn_encode($_POST["email_domain"])) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 		}
-		
-		
+
+
 		//* if its an insert, check that the password is not empty
 		if($this->id == 0 && $_POST["password"] == '') {
 			$app->tform->errorMessage .= $app->tform->lng("error_no_pwd")."<br>";
 		}
-		
+
 		//* Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_mailbox, limit_mailquota FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 
 			// Check if the user may add another mailbox.
 			if($this->id == 0 && $client["limit_mailbox"] >= 0) {
@@ -164,7 +164,7 @@ class page_action extends tform_actions {
 				}
 				unset($tmp);
 			}
-			
+
 			// Check the quota and adjust
 			if(isset($_POST["quota"]) && $client["limit_mailquota"] >= 0 && $app->functions->intval($this->dataRecord["quota"]) * 1024 * 1024 != $this->oldDataRecord['quota']) {
 				$tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u'));
@@ -180,62 +180,62 @@ class page_action extends tform_actions {
 				unset($tmp_quota);
 			}
 		} // end if user is not admin
-		
 
-    $app->uses('getconf');
-    $mail_config = $app->getconf->get_server_config(!empty($domain["server_id"]) ? $domain["server_id"] : '','mail');
-		
+
+		$app->uses('getconf');
+		$mail_config = $app->getconf->get_server_config(!empty($domain["server_id"]) ? $domain["server_id"] : '', 'mail');
+
 		//* compose the email field
 		if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
 			$this->dataRecord["email"] = strtolower($_POST["email_local_part"]."@".$app->functions->idn_encode($_POST["email_domain"]));
-		
+
 			// Set the server id of the mailbox = server ID of mail domain.
 			$this->dataRecord["server_id"] = $domain["server_id"];
-		
+
 			unset($this->dataRecord["email_local_part"]);
 			unset($this->dataRecord["email_domain"]);
-		
+
 			// Convert quota from MB to Bytes
 			if($this->dataRecord["quota"] != -1) $this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
-		
+
 			// setting Maildir, Homedir, UID and GID
-			$maildir = str_replace("[domain]",$domain["domain"],$mail_config["maildir_path"]);
-			$maildir = str_replace("[localpart]",strtolower($_POST["email_local_part"]),$maildir);
+			$maildir = str_replace("[domain]", $domain["domain"], $mail_config["maildir_path"]);
+			$maildir = str_replace("[localpart]", strtolower($_POST["email_local_part"]), $maildir);
 			$this->dataRecord["maildir"] = $maildir;
 			$this->dataRecord["homedir"] = $mail_config["homedir_path"];
 			$this->dataRecord["uid"] = $mail_config["mailuser_uid"];
 			$this->dataRecord["gid"] = $mail_config["mailuser_gid"];
-			
+
 			//* Check if there is no alias or forward with this address
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE active = 'y' AND source = '".$app->db->quote($this->dataRecord["email"])."'");
 			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_alias_or_forward_txt")."<br>";
 			unset($tmp);
-			
+
 		}
-		
-    $sys_config = $app->getconf->get_global_config('mail');
-    if($sys_config["enable_custom_login"] == "y") {
-        if(!isset($_POST["login"]) || $_POST["login"] == '') $this->dataRecord["login"] = $this->dataRecord["email"];
-        elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
+
+		$sys_config = $app->getconf->get_global_config('mail');
+		if($sys_config["enable_custom_login"] == "y") {
+			if(!isset($_POST["login"]) || $_POST["login"] == '') $this->dataRecord["login"] = $this->dataRecord["email"];
+			elseif(strpos($_POST["login"], '@') !== false && $_POST["login"] != $this->dataRecord["email"]) $app->tform->errorMessage .= $app->tform->lng("error_login_email_txt")."<br>";
 		} else {
-        $this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
+			$this->dataRecord["login"] = isset($this->dataRecord["email"]) ? $this->dataRecord["email"] : '';
 		}
 		//* if autoresponder checkbox not selected, do not save dates
 		if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
-			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
-			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_end_date']);
+			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_start_date']);
+			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_end_date']);
 		}
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		// Set the domain owner as mailbox owner
 		$domain = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 		$app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id);
-		
+
 		// Spamfilter policy
 		$policy_id = $app->functions->intval($this->dataRecord["policy"]);
 		if($policy_id > 0) {
@@ -245,33 +245,33 @@ class page_action extends tform_actions {
 				$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
 			} else {
 				// We create a new record
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
 				        VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($this->dataRecord["email"])."', '".$app->db->quote($this->dataRecord["email"])."', 'Y')";
 				$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
 			}
 		}  // endif spamfilter policy
-		
-		
+
+
 		// Set the fields for dovecot
 		if(isset($this->dataRecord["email"])) {
 			$disableimap = ($this->dataRecord["disableimap"])?'y':'n';
 			$disablepop3 = ($this->dataRecord["disablepop3"])?'y':'n';
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
-		
+
 			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		// Set the domain owner as mailbox owner
 		if(isset($_POST["email_domain"])) {
 			$domain = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($app->functions->idn_encode($_POST["email_domain"]))."' AND ".$app->tform->getAuthSQL('r'));
 			$app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id);
-		
+
 			// Spamfilter policy
 			$policy_id = $app->functions->intval($this->dataRecord["policy"]);
 			$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'");
@@ -281,7 +281,7 @@ class page_action extends tform_actions {
 					$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
 				} else {
 					// We create a new record
-					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) 
+					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
 				        	VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($this->dataRecord["email"])."', '".$app->db->quote($this->dataRecord["email"])."', 'Y')";
 					$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
 				}
@@ -292,22 +292,22 @@ class page_action extends tform_actions {
 				}
 			} // endif spamfilter policy
 		}
-		
+
 		// Set the fields for dovecot
 		if(isset($this->dataRecord["email"])) {
 			$disableimap = (isset($this->dataRecord["disableimap"]) && $this->dataRecord["disableimap"])?'y':'n';
 			$disablepop3 = (isset($this->dataRecord["disablepop3"]) && $this->dataRecord["disablepop3"])?'y':'n';
 			$disabledeliver = ($this->dataRecord["postfix"] == 'y')?'n':'y';
 			$disablesmtp = ($this->dataRecord["postfix"] == 'y')?'n':'y';
-		
+
 			$sql = "UPDATE mail_user SET disableimap = '$disableimap', disablesieve = '$disableimap', disablepop3 = '$disablepop3', disablesmtp = '$disablesmtp', disabledeliver = '$disabledeliver', disablelda = '$disabledeliver', disabledoveadm = '$disableimap' WHERE mailuser_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//** If the email address has been changed, change it in all aliases too
 		if(isset($this->dataRecord['email']) && $this->oldDataRecord['email'] != $this->dataRecord['email']) {
-		//if($this->oldDataRecord['email'] != $this->dataRecord['email']) {
-			
+			//if($this->oldDataRecord['email'] != $this->dataRecord['email']) {
+
 			//* Update the aliases
 			$forwardings = $app->db->queryAllRecords("SELECT * FROM mail_forwarding WHERE destination = '".$app->db->quote($this->oldDataRecord['email'])."'");
 			if(is_array($forwardings)) {
@@ -316,11 +316,11 @@ class page_action extends tform_actions {
 					$app->db->datalogUpdate('mail_forwarding', "destination = '$destination'", 'forwarding_id', $rec['forwarding_id']);
 				}
 			}
-			
+
 		} // end if email addess changed
-		
+
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mail/mail_user_filter_del.php b/interface/web/mail/mail_user_filter_del.php
index a02d68df059a8cf649c54814f3a1279a49c65644..e352a8e73629b6420aac17c63b210798cd955247 100644
--- a/interface/web/mail/mail_user_filter_del.php
+++ b/interface/web/mail/mail_user_filter_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_user_filter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -50,17 +50,17 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	/*
 	//* Code moved to mailfilter plugin
 	function onAfterDelete() {
 		global $app, $conf;
-		
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
 		$skip = false;
 		$lines = explode("\n",$mailuser['custom_mailfilter']);
 		$out = '';
-		
+
 		foreach($lines as $line) {
 			$line = trim($line);
 			if($line == '### BEGIN FILTER_ID:'.$this->id) {
@@ -71,16 +71,16 @@ class page_action extends tform_actions {
 				$skip = false;
 			}
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $this->dataRecord["mailuser_id"]);
-	
+
 	}
 	*/
-	
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_filter_edit.php b/interface/web/mail/mail_user_filter_edit.php
index d74a85a2f6a0e61a849f9bd56184400a94239aba..be62674b33633c7a090351d7a45581e655d5ad80 100644
--- a/interface/web/mail/mail_user_filter_edit.php
+++ b/interface/web/mail/mail_user_filter_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user_filter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,38 +49,38 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkClientLimit('limit_mailfilter', "")) {
 				$app->error($app->tform->lng("limit_mailfilter_txt"));
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkResellerLimit('limit_mailfilter', "")) {
 				$app->error('Reseller: '.$app->tform->lng("limit_mailfilter_txt"));
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent mail_user record
 		$mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".$app->functions->intval($_REQUEST["mailuser_id"])."' AND ".$app->tform->getAuthSQL('r'));
-		
+
 		// Check if Domain belongs to user
 		if($mailuser["mailuser_id"] != $_POST["mailuser_id"]) $app->tform->errorMessage .= $app->tform->wordbook["no_mailuser_perm"];
-		
+
 		// Set the mailuser_id
 		$this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
-		
+
 		// Remove leading dots
-		if(substr($this->dataRecord['target'],0,1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'],1);
-		
+		if(substr($this->dataRecord['target'], 0, 1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'], 1);
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -96,28 +96,28 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 	/*
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$this->onAfterUpdate();
-		
+
 		$app->db->query("UPDATE mail_user_filter SET sys_groupid = ".$mailuser['sys_groupid']." WHERE filter_id = ".$this->id);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		$mailuser = $app->db->queryOneRecord("SELECT custom_mailfilter FROM mail_user WHERE mailuser_id = ".$this->dataRecord["mailuser_id"]);
 		$skip = false;
 		$lines = explode("\n",$mailuser['custom_mailfilter']);
 		$out = '';
 		$found = false;
-		
+
 		foreach($lines as $line) {
 			$line = rtrim($line);
 			if($line == '### BEGIN FILTER_ID:'.$this->id) {
@@ -130,41 +130,41 @@ class page_action extends tform_actions {
 				$skip = false;
 			}
 		}
-		
+
 		// We did not found our rule, so we add it now as first rule.
 		if($found == false) {
 			$new_rule = $this->getRule();
 			$out = $new_rule . $out;
 		}
-		
+
 		$out = $app->db->quote($out);
 		$app->db->datalogUpdate('mail_user', "custom_mailfilter = '$out'", 'mailuser_id', $this->dataRecord["mailuser_id"]);
-	
+
 	}
-	
+
 	function getRule() {
-		
+
 		global $app,$conf;
-		
+
 		$app->uses("getconf");
 		$mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".$app->functions->intval($this->dataRecord["mailuser_id"]));
 		$mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]),'mail');
-		
+
 		if($mail_config['mail_filter_syntax'] == 'sieve') {
-			
+
 			// #######################################################
 			// Filter in Sieve Syntax
 			// #######################################################
-			
+
 			$content = '';
 			$content .= '### BEGIN FILTER_ID:'.$this->id."\n";
-			
+
 			//$content .= 'require ["fileinto", "regex", "vacation"];'."\n";
-			
+
 			$content .= 'if header :regex    ["'.strtolower($this->dataRecord["source"]).'"] ["';
-			
+
 			$searchterm = preg_quote($this->dataRecord["searchterm"]);
-			
+
 			if($this->dataRecord["op"] == 'contains') {
 				$content .= ".*".$searchterm;
 			} elseif ($this->dataRecord["op"] == 'is') {
@@ -174,21 +174,21 @@ class page_action extends tform_actions {
 			} elseif ($this->dataRecord["op"] == 'ends') {
 				$content .= ".*".$searchterm."$";
 			}
-			
+
 			$content .= '"] {'."\n";
-			
+
 			if($this->dataRecord["action"] == 'move') {
 				$content .= '    fileinto "'.$this->dataRecord["target"].'";' . "\n";
 			} else {
 				$content .= "    discard;\n";
 			}
-			
+
 			$content .= "    stop;\n}\n";
-			
+
 			$content .= '### END FILTER_ID:'.$this->id."\n";
-		
+
 		} else {
-		
+
 			// #######################################################
 			// Filter in Maildrop Syntax
 			// #######################################################
@@ -245,20 +245,20 @@ if ( ".'$RETURNCODE'." != 1 )
 
 			$content .= "}\n";
 			$content .= "}\n";
-		
+
 			//}
-		
+
 			$content .= '### END FILTER_ID:'.$this->id."\n";
-		
+
 		}
-		
+
 		return $content;
 	}
 	*/
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_list.php b/interface/web/mail/mail_user_list.php
index 7f93e2b436197a17645d1a24361e04a8463a5f3f..fa26861c7931256524d33b6bdf7c99c35133c766 100644
--- a/interface/web/mail/mail_user_list.php
+++ b/interface/web/mail/mail_user_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -19,28 +19,28 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('mail');
-		
+
 		if($global_config['mailboxlist_webmail_link'] == 'y') {
-			$app->tpl->setVar('mailboxlist_webmail_link',1);
+			$app->tpl->setVar('mailboxlist_webmail_link', 1);
 		} else {
-			$app->tpl->setVar('mailboxlist_webmail_link',0);
+			$app->tpl->setVar('mailboxlist_webmail_link', 0);
+		}
+
+		if($global_config["enable_custom_login"] == "y") {
+			$app->tpl->setVar("enable_custom_login", 1);
+		} else {
+			$app->tpl->setVar("enable_custom_login", 0);
 		}
 
-    if($global_config["enable_custom_login"] == "y") {
-        $app->tpl->setVar("enable_custom_login", 1);
-    } else {
-        $app->tpl->setVar("enable_custom_login", 0);
-    }
-		
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -48,4 +48,4 @@ $list->SQLOrderBy = 'ORDER BY mail_user.email';
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_user_stats.php b/interface/web/mail/mail_user_stats.php
index 65b179d8374a7bd305860b3c39416fa962eeb24a..2e385e7dc145197a3df2467020da8e1c4ea39008 100644
--- a/interface/web/mail/mail_user_stats.php
+++ b/interface/web/mail/mail_user_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -18,43 +18,43 @@ $app->auth->check_module_permissions('mail');
 $app->load('listform_actions');
 
 class list_action extends listform_actions {
-	
+
 	function prepareDataRow($rec)
-    {
+	{
 		global $app;
-		
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
-		
+
 		//* Set the statistics colums
 		//** Traffic of the current month
 		$tmp_date = date('Y-m');
 		$tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'");
 		$rec['this_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//** Traffic of the current year
 		$tmp_date = date('Y');
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'");
 		$rec['this_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//** Traffic of the last month
-		$tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
+		$tmp_date = date('Y-m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y")));
 		$tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'");
 		$rec['last_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//** Traffic of the last year
-		$tmp_date = date('Y',mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
+		$tmp_date = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'");
 		$rec['last_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' ');
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
-	
+
 	function getQueryString() {
 		global $app;
 		$sql_where = '';
@@ -64,62 +64,62 @@ class list_action extends listform_actions {
 			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';
+				$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);
+		$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;
-		  }
+			$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; 
+			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']);
@@ -134,10 +134,11 @@ class list_action extends listform_actions {
 		$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->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_whitelist_del.php b/interface/web/mail/mail_whitelist_del.php
index bb083e652fc4f4592284dfd82077df2d76731262..94be228f67035481bbfc4dd24057b325ce8a8445 100644
--- a/interface/web/mail/mail_whitelist_del.php
+++ b/interface/web/mail/mail_whitelist_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_whitelist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_whitelist_edit.php b/interface/web/mail/mail_whitelist_edit.php
index a377729d2d848cb93c54da173b0cc1a5749fc902..67075e2dfef6b2cbfe6260c7bba1c3f441e96150 100644
--- a/interface/web/mail/mail_whitelist_edit.php
+++ b/interface/web/mail/mail_whitelist_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_whitelist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -52,7 +52,7 @@ class page_action extends tform_actions {
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_mailfilter')) {
@@ -62,10 +62,10 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_mailfilter_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
 
@@ -84,7 +84,7 @@ class page_action extends tform_actions {
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -100,14 +100,14 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mail_whitelist_list.php b/interface/web/mail/mail_whitelist_list.php
index a4c39a99b5155d923a04bcd2c4f9e7b2cfb213bc..4fd33dd977b0259f46c83c2f2634ff787a9f7910 100644
--- a/interface/web/mail/mail_whitelist_list.php
+++ b/interface/web/mail/mail_whitelist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->listform_actions->SQLExtWhere = "mail_access.access = 'OK'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/mailinglist.php b/interface/web/mail/mailinglist.php
index dfabb48069d8993667aa6fba8b80861b169d4190..6ef779cbd61f7d3e6459cab3c696374fba15547a 100644
--- a/interface/web/mail/mailinglist.php
+++ b/interface/web/mail/mailinglist.php
@@ -28,15 +28,15 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
 
 /* get the id of the mail (must be int!) */
 if (!isset($_GET['id'])){
-    die ("No List selected!");
+	die ("No List selected!");
 }
 $listId = $app->functions->intval($_GET['id']);
 
@@ -46,7 +46,7 @@ $listId = $app->functions->intval($_GET['id']);
 $dbData = $app->db->queryAllRecords("SELECT server_id, listname FROM mail_mailinglist WHERE mailinglist_id = " . $listId);
 $serverId = $app->functions->intval($dbData[0]['server_id']);
 if ($serverId == 0){
-    die ("No List - Server found!");
+	die ("No List - Server found!");
 }
 
 $serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$serverId);
@@ -58,11 +58,11 @@ if($global_config['mailmailinglist_url'] != '') {
 	header('Location:' . $global_config['mailmailinglist_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'] . '/cgi-bin/mailman/admin/' . $dbData[0]['listname']);
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_blacklist_del.php b/interface/web/mail/spamfilter_blacklist_del.php
index 479d6fd18f804c301185337307083eaa408ae502..76db812b51f1419dc5e5f5b0be76d2a6825e3eda 100644
--- a/interface/web/mail/spamfilter_blacklist_del.php
+++ b/interface/web/mail/spamfilter_blacklist_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/spamfilter_blacklist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_blacklist_edit.php b/interface/web/mail/spamfilter_blacklist_edit.php
index 860319c4b0d539a69451aa40ab24b5fddeec86c3..a601674973a9cc36f491c3faf009560d60a0210e 100644
--- a/interface/web/mail/spamfilter_blacklist_edit.php
+++ b/interface/web/mail/spamfilter_blacklist_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/spamfilter_blacklist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_wblist')) {
@@ -61,10 +61,10 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_wblist_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	/*
 	function onBeforeUpdate() {
 		global $app, $conf;
@@ -83,9 +83,9 @@ class page_action extends tform_actions {
 	}
 	*/
 
-function onSubmit() {
+	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -101,18 +101,19 @@ function onSubmit() {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		// Select and set the server_id so it matches the server_id of the spa,filter_users record
 		$tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".$app->functions->intval($this->dataRecord["rid"]));
 		$this->dataRecord["server_id"] = $tmp["server_id"];
 		unset($tmp);
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_blacklist_list.php b/interface/web/mail/spamfilter_blacklist_list.php
index 087e533740396ea3e6f98914f9be07542d26f53e..0d233a55d009150adb1f59706ce65e74ad3246ec 100644
--- a/interface/web/mail/spamfilter_blacklist_list.php
+++ b/interface/web/mail/spamfilter_blacklist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->listform_actions->SQLExtWhere = "spamfilter_wblist.wb = 'B'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_config_del.php b/interface/web/mail/spamfilter_config_del.php
index 8da9f45defc8347c4770bebfa7131e5ca56e005b..07793e41403c4983b429ba7a37f7a9145ddd9cdc 100644
--- a/interface/web/mail/spamfilter_config_del.php
+++ b/interface/web/mail/spamfilter_config_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/spamfilter_config.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_config_edit.php b/interface/web/mail/spamfilter_config_edit.php
index ad9d2b561f250d91b84deff400fda7f10332a7ea..aeba3f4bb8d1989f161eb40f28bf90718914fb80 100644
--- a/interface/web/mail/spamfilter_config_edit.php
+++ b/interface/web/mail/spamfilter_config_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/spamfilter_config.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -49,48 +49,48 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowEdit() {
 		global $app, $conf;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
-		
+
 		if($app->tform->errorMessage == '') {
 			$app->uses('ini_parser,getconf');
-		
+
 			$section = $this->active_tab;
 			$server_id = $this->id;
-		
-			$this->dataRecord = $app->getconf->get_server_config($server_id,$section);
+
+			$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
 		}
-		
-		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab,'EDIT');
-		
+
+		$record = $app->tform->getHTML($this->dataRecord, $this->active_tab, 'EDIT');
+
 		$record['id'] = $this->id;
 		$app->tpl->setVar($record);
 	}
-	
+
 	function onUpdateSave($sql) {
 		global $app;
-		
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') die('This function needs admin priveliges');
 		$app->uses('ini_parser,getconf');
-		
+
 		$section = $app->tform->getCurrentTab();
 		$server_id = $this->id;
-		
+
 		$server_config_array = $app->getconf->get_server_config($server_id);
-		$server_config_array[$section] = $app->tform->encode($this->dataRecord,$section);
+		$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
 		$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
-		
+
 		$sql = "UPDATE server SET config = '".$app->db->quote($server_config_str)."' WHERE server_id = ".$server_id;
 		$app->db->query($sql);
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_config_list.php b/interface/web/mail/spamfilter_config_list.php
index b61472b307ccc57ad6deb26767dfbf9d292007b0..019f2f37c1fef2099c8bf6ae92a183751a08fd8c 100644
--- a/interface/web/mail/spamfilter_config_list.php
+++ b/interface/web/mail/spamfilter_config_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_policy_del.php b/interface/web/mail/spamfilter_policy_del.php
index 12b6a199268b4e9b2ae2b5c739553e476019e5e7..7a113a9170f207465870acdc17c9ae8544cdc8e0 100644
--- a/interface/web/mail/spamfilter_policy_del.php
+++ b/interface/web/mail/spamfilter_policy_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/spamfilter_policy.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_policy_edit.php b/interface/web/mail/spamfilter_policy_edit.php
index abc28e9e7c12ffb853eccaf0cf65c0d0cb03b63e..0321cb5528304f69813ac91949dc47812a2f737c 100644
--- a/interface/web/mail/spamfilter_policy_edit.php
+++ b/interface/web/mail/spamfilter_policy_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/spamfilter_policy.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_policy')) {
@@ -61,13 +61,13 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_policy_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -83,13 +83,14 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_policy_list.php b/interface/web/mail/spamfilter_policy_list.php
index 504a2bd54de04811ede1c975b98f81c0e43b6c68..c2ab38d5f7eea35dd36a9fac367ebea1e1c443ca 100644
--- a/interface/web/mail/spamfilter_policy_list.php
+++ b/interface/web/mail/spamfilter_policy_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_users_del.php b/interface/web/mail/spamfilter_users_del.php
index 83418c8888dbf17bdecbdba1ac86e88a1e3ad15a..0dc92935c136a0e00c3e24afad521848407cf8d8 100644
--- a/interface/web/mail/spamfilter_users_del.php
+++ b/interface/web/mail/spamfilter_users_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/spamfilter_users.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_users_edit.php b/interface/web/mail/spamfilter_users_edit.php
index 02cebbf40aa92417ce24ca4f7fd4859e2e8a2eb7..c1e50f3b4967223a475645a3ed3887d1fd2e88e7 100644
--- a/interface/web/mail/spamfilter_users_edit.php
+++ b/interface/web/mail/spamfilter_users_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/spamfilter_users.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_user')) {
@@ -61,10 +61,10 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_user_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf;
 
@@ -81,9 +81,9 @@ class page_action extends tform_actions {
 		}
 	}
 
-function onSubmit() {
+	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -99,13 +99,14 @@ function onSubmit() {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_users_list.php b/interface/web/mail/spamfilter_users_list.php
index af17f134f5f5a9cc9cff7b870e29d69aa60305bc..edd24013fadc60b9430c4332627a44187bd919ef 100644
--- a/interface/web/mail/spamfilter_users_list.php
+++ b/interface/web/mail/spamfilter_users_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_whitelist_del.php b/interface/web/mail/spamfilter_whitelist_del.php
index 2f27d02ea67e14741fe67f063fe927e078bb9e4e..5a3c93dd047139b6bfafeba6ec306cca48ea3d25 100644
--- a/interface/web/mail/spamfilter_whitelist_del.php
+++ b/interface/web/mail/spamfilter_whitelist_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/spamfilter_whitelist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('mail');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_whitelist_edit.php b/interface/web/mail/spamfilter_whitelist_edit.php
index 167059771e3d6ad64034b43136f3436eb18aeafe..f73023f07c79a459c1d9f507f94d47a4215cb2be 100644
--- a/interface/web/mail/spamfilter_whitelist_edit.php
+++ b/interface/web/mail/spamfilter_whitelist_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/spamfilter_whitelist.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
@@ -51,7 +51,7 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_spamfilter_wblist')) {
@@ -61,10 +61,10 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_spamfilter_wblist_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	/*
 	function onBeforeUpdate() {
 		global $app, $conf;
@@ -85,7 +85,7 @@ class page_action extends tform_actions {
 
 	function onSubmit() {
 		global $app, $conf;
-				
+
 		// Check the client limits, if user is not the admin
 		if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin
 			// Get the limits of the client
@@ -101,19 +101,20 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		// Select and set the server_id so it matches the server_id of the spa,filter_users record
 		$tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".$app->functions->intval($this->dataRecord["rid"]));
 		$this->dataRecord["server_id"] = $tmp["server_id"];
 		unset($tmp);
-		
-		
+
+
 		parent::onSubmit();
 	}
+
 }
 
 $app->tform_actions = new page_action;
 $app->tform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/spamfilter_whitelist_list.php b/interface/web/mail/spamfilter_whitelist_list.php
index ffb0fc94831d6f8197ff84f77b8bdece6a141bcb..313c595714b52d1fe6f4a77de1c028d0dc8fbaf7 100644
--- a/interface/web/mail/spamfilter_whitelist_list.php
+++ b/interface/web/mail/spamfilter_whitelist_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -21,4 +21,4 @@ $app->listform_actions->SQLExtWhere = "spamfilter_wblist.wb = 'W'";
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/user_quota_stats.php b/interface/web/mail/user_quota_stats.php
index dfc1d8a820534aca4dfeeaa7ebbede3c289d62bd..d4910716a45ba60d5b6ec21db2492a5e254ee3d9 100644
--- a/interface/web/mail/user_quota_stats.php
+++ b/interface/web/mail/user_quota_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -35,44 +35,45 @@ if(is_array($tmp_rec)) {
 
 
 class list_action extends listform_actions {
-	
+
 	function prepareDataRow($rec)
-    {
-		global $app,$monitor_data;
-		
+	{
+		global $app, $monitor_data;
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
 		$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];
-		
+
 		if($rec['quota'] == 0){
 			$rec['quota'] = $app->lng('unlimited');
-            $rec['percentage'] = '';
-            $rec['percentage_sort'] = 0;
+			$rec['percentage'] = '';
+			$rec['percentage_sort'] = 0;
 		} else {
-            $rec['percentage'] = round(100 * $rec['used'] / $rec['quota']) . '%';
+			$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['quota'] = round($rec['quota'] / 1048576, 4).' MB';
 		}
 
 
-        $rec['used_sort'] = $rec['used'];
-        if($rec['used'] < 1544000) {
-            $rec['used'] = round($rec['used'] / 1024,4).' KB';
-        } else {
-            $rec['used'] = round($rec['used'] / 1048576,4).' MB';
-        }
+		$rec['used_sort'] = $rec['used'];
+		if($rec['used'] < 1544000) {
+			$rec['used'] = round($rec['used'] / 1024, 4).' KB';
+		} else {
+			$rec['used'] = round($rec['used'] / 1048576, 4).' MB';
+		}
 
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
+
 }
 
 $list = new list_action;
@@ -81,4 +82,4 @@ $list->SQLExtWhere = "";
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mail/webmailer.php b/interface/web/mail/webmailer.php
index 7b3e86245cac7fef91c771659ec93cd832356761..3a10c0fde2aa1ef1fa1ea8ba41a06996238df9a2 100644
--- a/interface/web/mail/webmailer.php
+++ b/interface/web/mail/webmailer.php
@@ -28,15 +28,15 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
 
 /* get the id of the mail (must be int!) */
 if (!isset($_GET['id'])){
-    die ("No E-Mail selected!");
+	die ("No E-Mail selected!");
 }
 $emailId = $app->functions->intval($_GET['id']);
 
@@ -46,7 +46,7 @@ $emailId = $app->functions->intval($_GET['id']);
 $dbData = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = " . $emailId);
 $serverId = $app->functions->intval($dbData['server_id']);
 if ($serverId == 0){
-    die ("No E-Mail - Server found!");
+	die ("No E-Mail - Server found!");
 }
 
 $serverData = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".$serverId);
@@ -60,7 +60,7 @@ if($global_config['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';
@@ -72,4 +72,4 @@ if($global_config['webmail_url'] != '') {
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_autoresponder.tform.php b/interface/web/mailuser/form/mail_user_autoresponder.tform.php
index 9414772d7edc5423ecbc9c32f42f688a05c92e6c..44ce15cd5c9bc2830c8da3a4305fd6eb617449ad 100644
--- a/interface/web/mailuser/form/mail_user_autoresponder.tform.php
+++ b/interface/web/mailuser/form/mail_user_autoresponder.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_autoresponder_txt";
+$form["title"]    = "mailbox_autoresponder_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_autoresponder";
-$form["action"]			= "mail_user_autoresponder_edit.php";
-$form["db_table"]		= "mail_user";
+$form["name"]    = "mail_user_autoresponder";
+$form["action"]   = "mail_user_autoresponder_edit.php";
+$form["db_table"]  = "mail_user";
 $form["db_table_idx"]           = "mailuser_id";
-$form["db_history"]		= "yes";
+$form["db_history"]  = "yes";
 $form["tab_default"]            = "autoresponder";
 $form["list_default"]           = "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["auth"]   = 'no'; // yes / no
 
 $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
@@ -52,58 +52,58 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
 
 
 $form["tabs"]['autoresponder'] = array (
-	'title' 	=> "Autoresponder",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_autoresponder_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Autoresponder",
+	'width'  => 100,
+	'template'  => "templates/mail_user_autoresponder_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'autoresponder_subject' => array (
 			'datatype'      => 'VARCHAR',
 			'formtype'      => 'TEXT',
 			'default'       => 'Out of office reply',
 			'value'         => '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'autoresponder_text' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '15'
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'cols'  => '30',
+			'rows'  => '15'
 		),
 		'autoresponder' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(1 => 'y',0 => 'n')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(1 => 'y', 0 => 'n')
 		),
 		'autoresponder_start_date' => array (
-			'datatype'	=> 'DATETIME',
-			'formtype'	=> 'DATETIME',
-			'validators'=> array ( 	0 => array (	'type'	=> 'CUSTOM',
-													'class' => 'validate_autoresponder',
-													'function' => 'start_date',
-													'errmsg'=> 'autoresponder_start_date_isfuture'),
-								 ),
+			'datatype' => 'DATETIME',
+			'formtype' => 'DATETIME',
+			'validators'=> array (  0 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_autoresponder',
+					'function' => 'start_date',
+					'errmsg'=> 'autoresponder_start_date_isfuture'),
+			),
 		),
 		'autoresponder_end_date' => array (
-			'datatype'	=> 'DATETIME',
-			'formtype'	=> 'DATETIME',
-			'validators'    => array ( 	0 => array (	'type'	=> 'CUSTOM',
-													'class' => 'validate_autoresponder',
-													'function' => 'end_date',
-													'errmsg'=> 'autoresponder_end_date_isgreater'),
-								 ),
+			'datatype' => 'DATETIME',
+			'formtype' => 'DATETIME',
+			'validators'    => array (  0 => array ( 'type' => 'CUSTOM',
+					'class' => 'validate_autoresponder',
+					'function' => 'end_date',
+					'errmsg'=> 'autoresponder_end_date_isgreater'),
+			),
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_cc.tform.php b/interface/web/mailuser/form/mail_user_cc.tform.php
index 222745d9c2010a54c2f095de44805745b00d9433..6458bb730a9a7bb8c450d089917bb759c8cf80dd 100644
--- a/interface/web/mailuser/form/mail_user_cc.tform.php
+++ b/interface/web/mailuser/form/mail_user_cc.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_cc_txt";
+$form["title"]    = "mailbox_cc_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_cc";
-$form["action"]			= "mail_user_cc_edit.php";
-$form["db_table"]		= "mail_user";
+$form["name"]    = "mail_user_cc";
+$form["action"]   = "mail_user_cc_edit.php";
+$form["db_table"]  = "mail_user";
 $form["db_table_idx"]           = "mailuser_id";
-$form["db_history"]		= "yes";
+$form["db_history"]  = "yes";
 $form["tab_default"]            = "mailuser";
 $form["list_default"]           = "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["auth"]   = 'no'; // yes / no
 
 $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
@@ -51,37 +51,37 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "cc_txt",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_cc_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "cc_txt",
+	'width'  => 100,
+	'template'  => "templates/mail_user_cc_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'cc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
-														'errmsg'=> 'cc_error_isemail'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z\-]{2,10}){0,1}$/i',
+					'errmsg'=> 'cc_error_isemail'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_filter.tform.php b/interface/web/mailuser/form/mail_user_filter.tform.php
index 02b6c79fa4b63ef985085c3f88611057457e2b17..b785ae0263ab03176d5b2677bff31827804e80a6 100644
--- a/interface/web/mailuser/form/mail_user_filter.tform.php
+++ b/interface/web/mailuser/form/mail_user_filter.tform.php
@@ -35,16 +35,16 @@
 
 global $app;
 
-$form["title"] 			= "mailbox_filter_txt";
+$form["title"]    = "mailbox_filter_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_filter";
-$form["action"]			= "mail_user_filter_edit.php";
-$form["db_table"]		= "mail_user_filter";
+$form["name"]    = "mail_user_filter";
+$form["action"]   = "mail_user_filter_edit.php";
+$form["db_table"]  = "mail_user_filter";
 $form["db_table_idx"]           = "filter_id";
-$form["db_history"]		= "no";
+$form["db_history"]  = "no";
 $form["tab_default"]            = "filter";
 $form["list_default"]           = "mail_user_filter_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -53,83 +53,83 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['filter'] = array (
-	'title' 	=> "Filter",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_filter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Filter",
+	'width'  => 100,
+	'template'  => "templates/mail_user_filter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'mailuser_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> @$app->functions->intval($_REQUEST["mailuser_id"]),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => @$app->functions->intval($_REQUEST["mailuser_id"]),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'rulename' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'rulename_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'rulename_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'source' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('Subject' => 'subject_txt','From'=>'from_txt','To'=>'to_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('Subject' => 'subject_txt', 'From'=>'from_txt', 'To'=>'to_txt')
 		),
 		'op' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			#'value'		=> array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
-			'value'		=> array('contains'=>'contains_txt','is' => 'is_txt','begins'=>'begins_with_txt','ends'=>'ends_with_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			//'value'  => array('contains'=>'contains_txt','is' => 'Is','begins'=>'Begins with','ends'=>'Ends with')
+			'value'  => array('contains'=>'contains_txt', 'is' => 'is_txt', 'begins'=>'begins_with_txt', 'ends'=>'ends_with_txt')
 		),
 		'searchterm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'searchterm_is_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'searchterm_is_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('move' => 'move_to_txt','delete'=>'delete_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('move' => 'move_to_txt', 'delete'=>'delete_txt')
 		),
 		'target' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9\.\-\_\ ]{0,100}$/',
-														'errmsg'=> 'target_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-9\.\-\_\ ]{0,100}$/',
+					'errmsg'=> 'target_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
diff --git a/interface/web/mailuser/form/mail_user_password.tform.php b/interface/web/mailuser/form/mail_user_password.tform.php
index 193de19e08fa243a7bb484ad6177a26efebf18a4..65cf076e318cc1da4fed753fcc7a57f25b274efb 100644
--- a/interface/web/mailuser/form/mail_user_password.tform.php
+++ b/interface/web/mailuser/form/mail_user_password.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_password_txt";
+$form["title"]    = "mailbox_password_txt";
 $form["description"]            = "";
-$form["name"] 			= "mail_user_password";
-$form["action"]			= "mail_user_password_edit.php";
-$form["db_table"]		= "mail_user";
+$form["name"]    = "mail_user_password";
+$form["action"]   = "mail_user_password_edit.php";
+$form["db_table"]  = "mail_user";
 $form["db_table_idx"]           = "mailuser_id";
-$form["db_history"]		= "yes";
+$form["db_history"]  = "yes";
 $form["tab_default"]            = "mailuser";
 $form["list_default"]           = "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["auth"]   = 'no'; // yes / no
 
 $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
@@ -51,27 +51,27 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "password_txt",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_password_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "password_txt",
+	'width'  => 100,
+	'template'  => "templates/mail_user_password_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'    => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# END Datatable fields
-	##################################
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/form/mail_user_spamfilter.tform.php b/interface/web/mailuser/form/mail_user_spamfilter.tform.php
index cb16645dae7171e9b3b5616c91e0b3e85dcb0ea8..81b23a87dabe806a70adff27bacc970c7c9a94a2 100644
--- a/interface/web/mailuser/form/mail_user_spamfilter.tform.php
+++ b/interface/web/mailuser/form/mail_user_spamfilter.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "mailbox_spamfilter_txt";
-$form["description"] 	= "";
-$form["name"] 			= "mail_user_spamfilter";
-$form["action"]			= "mail_user_spamfilter_edit.php";
-$form["db_table"]		= "mail_user";
-$form["db_table_idx"]	= "mailuser_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "mailuser";
-$form["list_default"]	= "index.php";
-$form["auth"]			= 'no'; // yes / no
+$form["title"]    = "mailbox_spamfilter_txt";
+$form["description"]  = "";
+$form["name"]    = "mail_user_spamfilter";
+$form["action"]   = "mail_user_spamfilter_edit.php";
+$form["db_table"]  = "mail_user";
+$form["db_table_idx"] = "mailuser_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "mailuser";
+$form["list_default"] = "index.php";
+$form["auth"]   = 'no'; // yes / no
 
 $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
@@ -51,19 +51,19 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['mailuser'] = array (
-	'title' 	=> "spamfilter_txt",
-	'width' 	=> 100,
-	'template' 	=> "templates/mail_user_spamfilter_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-	
-	##################################
-	# END Datatable fields
-	##################################
+	'title'  => "spamfilter_txt",
+	'width'  => 100,
+	'template'  => "templates/mail_user_spamfilter_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
+
+		//#################################
+		// END Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/index.php b/interface/web/mailuser/index.php
index a67fb74aee2c6e9b646bdc129a99dd727878b070..05f150bf3e041254ae0f6ce7ff923b9c5d894c57 100644
--- a/interface/web/mailuser/index.php
+++ b/interface/web/mailuser/index.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -14,7 +14,7 @@ $error = '';
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_index.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 $sql = "SELECT * FROM mail_user WHERE mailuser_id = ".$_SESSION['s']['user']['mailuser_id'];
@@ -35,20 +35,20 @@ $rec2 = $app->db->queryOneRecord($sql2);
 
 $app->tpl->setVar($rec2);
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 if(isset($_SESSION['show_info_msg'])) {
-    $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
-    unset($_SESSION['show_info_msg']);
+	$app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
+	unset($_SESSION['show_info_msg']);
 }
 if(isset($_SESSION['show_error_msg'])) {
-    $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
-    unset($_SESSION['show_error_msg']);
+	$app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
+	unset($_SESSION['show_error_msg']);
 }
 
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/lib/admin.conf.php b/interface/web/mailuser/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/mailuser/lib/admin.conf.php
+++ b/interface/web/mailuser/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/lib/module.conf.php b/interface/web/mailuser/lib/module.conf.php
index b6084aabf40d8105ad2f241341eba58ef32375ae..68f63920c3c5b3a14c787d34564605c9474c93a8 100644
--- a/interface/web/mailuser/lib/module.conf.php
+++ b/interface/web/mailuser/lib/module.conf.php
@@ -2,8 +2,8 @@
 
 $userid=$app->auth->get_user_id();
 
-$module['name'] 		= 'mailuser';
-$module['title'] 		= 'top_menu_mailuser';
+$module['name']   = 'mailuser';
+$module['title']   = 'top_menu_mailuser';
 $module['template']             = 'module.tpl.htm';
 $module['startpage']            = 'mailuser/index.php';
 $module['tab_width']            = '';
@@ -12,41 +12,41 @@ $module['tab_width']            = '';
 //**** menu
 $items = array();
 
-$items[] = array( 	'title'     => 'Overview',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/index.php',
-                        'html_id'   => 'mail_user_index');
+$items[] = array(  'title'     => 'Overview',
+	'target'    => 'content',
+	'link'      => 'mailuser/index.php',
+	'html_id'   => 'mail_user_index');
 
-$items[] = array( 	'title'     => 'Password',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_password_edit.php',
-                        'html_id'   => 'mail_user_password');
+$items[] = array(  'title'     => 'Password',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_password_edit.php',
+	'html_id'   => 'mail_user_password');
 
-$items[] = array( 	'title'     => 'Autoresponder',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_autoresponder_edit.php',
-                        'html_id'   => 'mail_user_autoresponder');
+$items[] = array(  'title'     => 'Autoresponder',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_autoresponder_edit.php',
+	'html_id'   => 'mail_user_autoresponder');
 
-$items[] = array( 	'title'     => 'Send copy',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_cc_edit.php',
-                        'html_id'   => 'mail_user_cc');
+$items[] = array(  'title'     => 'Send copy',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_cc_edit.php',
+	'html_id'   => 'mail_user_cc');
 
-$items[] = array( 	'title'     => 'Spamfilter',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_spamfilter_edit.php',
-                        'html_id'   => 'mail_user_cc');
+$items[] = array(  'title'     => 'Spamfilter',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_spamfilter_edit.php',
+	'html_id'   => 'mail_user_cc');
 
-$items[] = array( 	'title'     => 'Email Filters',
-                        'target'    => 'content',
-                        'link'      => 'mailuser/mail_user_filter_list.php',
-                        'html_id'   => 'mail_user_filter_list');
+$items[] = array(  'title'     => 'Email Filters',
+	'target'    => 'content',
+	'link'      => 'mailuser/mail_user_filter_list.php',
+	'html_id'   => 'mail_user_filter_list');
 
 
 if(count($items)) {
 	$module['nav'][] = array(   'title' => 'Email Account',
-                                    'open'  => 1,
-                                    'items' => $items);
+		'open'  => 1,
+		'items' => $items);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/lib/remote.conf.php b/interface/web/mailuser/lib/remote.conf.php
index 15c5adc7fae9b7dab7ba2410a6cabc4361f76852..62a2de0c86e67cd85333eb6effb08b9f6eea76f6 100644
--- a/interface/web/mailuser/lib/remote.conf.php
+++ b/interface/web/mailuser/lib/remote.conf.php
@@ -1,3 +1,3 @@
 <?php
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/list/mail_user_filter.list.php b/interface/web/mailuser/list/mail_user_filter.list.php
index 445fe6faa38cf1143d66aafab3ebb0ec4f99a2fa..6b71b41f8761cd733cf9f4f9db0d601eade9bc9f 100644
--- a/interface/web/mailuser/list/mail_user_filter.list.php
+++ b/interface/web/mailuser/list/mail_user_filter.list.php
@@ -13,48 +13,48 @@
 
 
 // Name of the list
-$liste["name"] 				= "mail_user_filter";
+$liste["name"]     = "mail_user_filter";
 
 // Database table
-$liste["table"] 			= "mail_user_filter";
+$liste["table"]    = "mail_user_filter";
 
 // Index index field of the database table
-$liste["table_idx"]			= "filter_id";
+$liste["table_idx"]   = "filter_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "mail_user_list.php";
+$liste["file"]    = "mail_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "mail_user_filter_edit.php";
+$liste["edit_file"]   = "mail_user_filter_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "mail_user_filter_del.php";
+$liste["delete_file"]  = "mail_user_filter_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "no";
+$liste["auth"]    = "no";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "rulename",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "rulename",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ 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 5e580810d19637fded122a7b2b0a40449cd6d19e..8007c0fd814ee934db7d7b08f43d18321fcffc41 100644
--- a/interface/web/mailuser/mail_user_autoresponder_edit.php
+++ b/interface/web/mailuser/mail_user_autoresponder_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user_autoresponder.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,29 +49,29 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onShow();
-		
+
 	}
-	
+
 	function onSubmit() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		//* if autoresponder checkbox not selected, do not save dates
 		if (!isset($_POST['autoresponder']) && array_key_exists('autoresponder_start_date', $_POST)) {
-			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_start_date']);
-			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item','return 0;'), $this->dataRecord['autoresponder_end_date']);
+			$this->dataRecord['autoresponder_start_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_start_date']);
+			$this->dataRecord['autoresponder_end_date'] = array_map(create_function('$item', 'return 0;'), $this->dataRecord['autoresponder_end_date']);
 		}
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
+
 	function onShowEnd() {
 		global $app;
 		// Is autoresponder set?
@@ -80,17 +80,17 @@ class page_action extends tform_actions {
 		} else {
 			$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();
 	}
-	
-	
+
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mailuser/mail_user_cc_edit.php b/interface/web/mailuser/mail_user_cc_edit.php
index 2c001c22b848007ce4f6ebc3b2453737cd0edc3f..39e5bdf6f95b01fdf1d865aca92b70138ac5186e 100644
--- a/interface/web/mailuser/mail_user_cc_edit.php
+++ b/interface/web/mailuser/mail_user_cc_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user_cc.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,38 +49,38 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onShow();
-		
+
 	}
-	
+
 	function onSubmit() {
 		global $app;
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
 		$rec = $app->tform->getDataRecord($this->id);
 		if(isset($_POST['cc']) && trim($_POST['cc']) == $rec['email']) {
 			$app->tform->errorMessage .= $app->tform->lng('email_is_cc_error');
 		}
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
-function onShowEnd() {
+
+	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($this->id);
 		$app->tpl->setVar("email", $rec['email']);
-		
+
 		parent::onShowEnd();
 	}
-	
-	
+
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mailuser/mail_user_filter_del.php b/interface/web/mailuser/mail_user_filter_del.php
index f1696d974da0676e9f3fabfa2dd4982eee7cabb1..285c34c83f1727c4a80a7930ff55082298465042 100644
--- a/interface/web/mailuser/mail_user_filter_del.php
+++ b/interface/web/mailuser/mail_user_filter_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/mail_user_filter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -50,10 +50,10 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_filter_edit.php b/interface/web/mailuser/mail_user_filter_edit.php
index 14f8dd5c3614e7115975907f1524926d5f441bfa..9274e3d056f4016e37deac2c2eb35847ede6883d 100644
--- a/interface/web/mailuser/mail_user_filter_edit.php
+++ b/interface/web/mailuser/mail_user_filter_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user_filter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -52,40 +52,40 @@ class page_action extends tform_actions {
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check the limits only when the email address belongs to a client and not the admin
 		if($_SESSION["s"]["user"]["default_group"] > 0) {
-			if(!$app->tform->checkClientLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkClientLimit('limit_mailfilter', "")) {
 				$app->error($app->tform->lng("limit_mailfilter_txt"));
 			}
-			if(!$app->tform->checkResellerLimit('limit_mailfilter',"")) {
+			if(!$app->tform->checkResellerLimit('limit_mailfilter', "")) {
 				$app->error('Reseller: '.$app->tform->lng("limit_mailfilter_txt"));
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the parent mail_user record
 		$mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".$app->functions->intval($_SESSION['s']['user']['mailuser_id'])."'");
-				
+
 		// Set the mailuser_id
 		$this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"];
-		
+
 		// Remove leading dots
-		if(substr($this->dataRecord['target'],0,1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'],1);
-		
+		if(substr($this->dataRecord['target'], 0, 1) == '.') $this->dataRecord['target'] = substr($this->dataRecord['target'], 1);
+
 
 		// Check the client limits if the email address is assigned to a client
 		if($_SESSION["s"]["user"]["default_group"] > 0) { // if user is not admin
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT limit_mailfilter FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Check if the user may add another filter
 			if($this->id == 0 && $client["limit_mailfilter"] >= 0) {
 				$tmp = $app->db->queryOneRecord("SELECT count(filter_id) as number FROM mail_user_filter WHERE sys_groupid = $client_group_id");
@@ -95,13 +95,13 @@ class page_action extends tform_actions {
 				unset($tmp);
 			}
 		} // end if user is not admin
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_filter_list.php b/interface/web/mailuser/mail_user_filter_list.php
index d896aa5f021319263342fea55f1247104f99d48a..cda05d3c888b2604c77c21f64a65ec2a3e1c698e 100644
--- a/interface/web/mailuser/mail_user_filter_list.php
+++ b/interface/web/mailuser/mail_user_filter_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -19,7 +19,7 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 }
 
 $list = new list_action;
@@ -29,4 +29,4 @@ $list->SQLExtWhere = "mail_user_filter.mailuser_id = ".$_SESSION['s']['user']['m
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/mailuser/mail_user_password_edit.php b/interface/web/mailuser/mail_user_password_edit.php
index 22eea896fc29141f617be9eb4ee3b93e648c5f00..5bbcedbd487b64a79a90332768ce491a446e3ee0 100644
--- a/interface/web/mailuser/mail_user_password_edit.php
+++ b/interface/web/mailuser/mail_user_password_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user_password.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,24 +49,24 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onSubmit() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($_SESSION['s']['user']['mailuser_id']);
 		$app->tpl->setVar("email", $rec['email']);
-		
+
 		parent::onShowEnd();
 	}
-	
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/mailuser/mail_user_spamfilter_edit.php b/interface/web/mailuser/mail_user_spamfilter_edit.php
index 905149cf74ba27174c03d4e5a100a4be8dbcd794..632a5079f850d6130dcf6f1d25e533aa299fb142 100644
--- a/interface/web/mailuser/mail_user_spamfilter_edit.php
+++ b/interface/web/mailuser/mail_user_spamfilter_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/mail_user_spamfilter.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('mailuser');
@@ -49,32 +49,32 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShow() {
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onShow();
-		
+
 	}
-	
+
 	function onSubmit() {
 		global $app;
-		
+
 		$this->id = $_SESSION['s']['user']['mailuser_id'];
-		
+
 		parent::onSubmit();
-		
+
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($this->id);
-		$email_parts = explode('@',$rec['email']);
+		$email_parts = explode('@', $rec['email']);
 		$email_domain = $email_parts[1];
 		$domain = $app->db->queryOneRecord("SELECT sys_userid, sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($email_domain)."'");
-		
+
 		// Spamfilter policy
 		$policy_id = $app->functions->intval($this->dataRecord["policy"]);
 		$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($rec["email"])."'");
@@ -84,7 +84,7 @@ class page_action extends tform_actions {
 				$app->db->datalogUpdate('spamfilter_users', "policy_id = $policy_id", 'id', $tmp_user["id"]);
 			} else {
 				// We create a new record
-				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`) 
+				$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
 				        VALUES (".$domain["sys_userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 10, ".$policy_id.", '".$app->db->quote($rec["email"])."', '".$app->db->quote($rec["email"])."', 'Y')";
 				$app->db->datalogInsert('spamfilter_users', $insert_data, 'id');
 			}
@@ -95,13 +95,13 @@ class page_action extends tform_actions {
 			}
 		} // endif spamfilter policy
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$rec = $app->tform->getDataRecord($this->id);
 		$app->tpl->setVar("email", $rec['email']);
-		
+
 		// Get the spamfilter policys for the user
 		$tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '".$rec['email']."'");
 		$sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r');
@@ -113,15 +113,15 @@ class page_action extends tform_actions {
 				$policy_select .= "<option value='$p[id]' $selected>$p[policy_name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("policy",$policy_select);
+		$app->tpl->setVar("policy", $policy_select);
 		unset($policys);
 		unset($policy_select);
 		unset($tmp_user);
-		
+
 		parent::onShowEnd();
 	}
-	
-	
+
+
 }
 
 $app->tform_actions = new page_action;
diff --git a/interface/web/monitor/datalog_del.php b/interface/web/monitor/datalog_del.php
index 372c0a9c874bcd32ef9940fa19682731d2c955de..79253075fb11a7d2e16901c663ac51bfbf0dd1f9 100644
--- a/interface/web/monitor/datalog_del.php
+++ b/interface/web/monitor/datalog_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/datalog.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('monitor');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/datalog_list.php b/interface/web/monitor/datalog_list.php
index dd5bfb30a2c8440f750caf70d9f261702c2a639b..a67501ffc98277c7924f5dc38cecb0d2f3d1930c 100644
--- a/interface/web/monitor/datalog_list.php
+++ b/interface/web/monitor/datalog_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,7 +52,7 @@ $sql = '(';
 foreach($servers as $sv) {
 	$sql .= " (sys_datalog.datalog_id > ".$sv['updated']." AND sys_datalog.server_id = ".$sv['server_id'].") OR ";
 }
-$sql = substr($sql,0,-4);
+$sql = substr($sql, 0, -4);
 $sql .= ')';
 
 $app->listform_actions->SQLExtWhere = $sql;
@@ -61,4 +61,4 @@ $app->listform_actions->SQLOrderBy = "ORDER BY sys_datalog.tstamp DESC, sys_data
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/lib/admin.conf.php b/interface/web/monitor/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/monitor/lib/admin.conf.php
+++ b/interface/web/monitor/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/lib/module.conf.php b/interface/web/monitor/lib/module.conf.php
index ca68ade867f9e6cda3a657a61ee92e8dd9ba843f..dc51ae3942b63ae0c0832e382ce864175bc2241e 100644
--- a/interface/web/monitor/lib/module.conf.php
+++ b/interface/web/monitor/lib/module.conf.php
@@ -3,31 +3,31 @@
 /*
  Config of the Module
  */
-$module["name"] 		= "monitor";
-$module["title"] 		= "top_menu_monitor";
-$module["template"] 	= "module.tpl.htm";
+$module["name"]   = "monitor";
+$module["title"]   = "top_menu_monitor";
+$module["template"]  = "module.tpl.htm";
 $module["tab_width"]    = '';
-$module["startpage"] 	= "monitor/show_sys_state.php?state=system";
+$module["startpage"]  = "monitor/show_sys_state.php?state=system";
 
 unset($items);
-$items[] = array( 'title' 	=> "Show Overview",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_sys_state.php?state=system',
-                  'html_id' => 'system');
+$items[] = array( 'title'  => "Show Overview",
+	'target'  => 'content',
+	'link' => 'monitor/show_sys_state.php?state=system',
+	'html_id' => 'system');
 
-$items[] = array( 'title' 	=> "Show System-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/log_list.php',
-                  'html_id' => 'system_log');
+$items[] = array( 'title'  => "Show System-Log",
+	'target'  => 'content',
+	'link' => 'monitor/log_list.php',
+	'html_id' => 'system_log');
 
-$items[] = array( 'title' 	=> 'Show Jobqueue',
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/datalog_list.php',
-                  'html_id' => 'jobqueue');
+$items[] = array( 'title'  => 'Show Jobqueue',
+	'target'  => 'content',
+	'link' => 'monitor/datalog_list.php',
+	'html_id' => 'jobqueue');
 
-$module["nav"][] = array(	'title'	=> 'System State (All Servers)',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$module["nav"][] = array( 'title' => 'System State (All Servers)',
+	'open'  => 1,
+	'items' => $items);
 
 
 /*
@@ -40,7 +40,7 @@ $servers = $app->db->queryAllRecords("SELECT server_id, server_name FROM server
 $dropDown = "<select id='server_id' onchange=\"loadContent('monitor/show_sys_state.php?state=server&server=' + document.getElementById('server_id').value);\">";
 foreach ($servers as $server)
 {
-    $dropDown .= "<option value='" . $server['server_id'] . "|" . $server['server_name'] . "'>" . $server['server_name'] . "</option>";
+	$dropDown .= "<option value='" . $server['server_id'] . "|" . $server['server_name'] . "'>" . $server['server_name'] . "</option>";
 }
 $dropDown .= "</select>";
 
@@ -48,14 +48,14 @@ $dropDown .= "</select>";
  Now add them as dropdown to the navigation
  */
 unset($items);
-$items[] = array( 'title' 	=> $dropDown,
-        'target' 	=> '', // no action!
-        'link'	=> '',     // no action!
-        'html_id' => 'select_server');
+$items[] = array( 'title'  => $dropDown,
+	'target'  => '', // no action!
+	'link' => '',     // no action!
+	'html_id' => 'select_server');
 
-$module["nav"][] = array(	'title'	=> 'Server to Monitor',
-        'open' 	=> 1,
-        'items'	=> $items);
+$module["nav"][] = array( 'title' => 'Server to Monitor',
+	'open'  => 1,
+	'items' => $items);
 
 /*
   The first Server at the list is the server first selected
@@ -68,144 +68,144 @@ $_SESSION['monitor']['server_name'] = $servers[0]['server_name'];
  */
 unset($items);
 
-$items[] = array( 'title' 	=> "Show CPU info",
-        'target' 	=> 'content',
-        'link'	=> 'monitor/show_data.php?type=cpu_info',
-        'html_id' => 'cpu_info');
+$items[] = array( 'title'  => "Show CPU info",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=cpu_info',
+	'html_id' => 'cpu_info');
 
-$module["nav"][] = array(	'title'	=> 'Hardware-Information',
-        'open' 	=> 1,
-        'items'	=> $items);
+$module["nav"][] = array( 'title' => 'Hardware-Information',
+	'open'  => 1,
+	'items' => $items);
 
 /*
  * Clear and set the Navigation-Items
  */
 unset($items);
-$items[] = array( 'title' 	=> "Show Overview",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_sys_state.php?state=server',
-                  'html_id' => 'server');
-
-$items[] = array( 'title' 	=> "Show Update State",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=system_update',
-                  'html_id' => 'system_update');
-
-$items[] = array( 'title' 	=> "Show RAID state",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=raid_state',
-                  'html_id' => 'raid_state');
-
-$items[] = array( 'title' 	=> "Show Server load",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=server_load',
-                  'html_id' => 'serverload');
-
-$items[] = array( 'title' 	=> "Show Disk usage",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=disk_usage',
-                  'html_id' => 'disk_usage');
+$items[] = array( 'title'  => "Show Overview",
+	'target'  => 'content',
+	'link' => 'monitor/show_sys_state.php?state=server',
+	'html_id' => 'server');
+
+$items[] = array( 'title'  => "Show Update State",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=system_update',
+	'html_id' => 'system_update');
+
+$items[] = array( 'title'  => "Show RAID state",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=raid_state',
+	'html_id' => 'raid_state');
+
+$items[] = array( 'title'  => "Show Server load",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=server_load',
+	'html_id' => 'serverload');
+
+$items[] = array( 'title'  => "Show Disk usage",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=disk_usage',
+	'html_id' => 'disk_usage');
 
 $items[] = array( 'title'       => "Show MySQL Database size",
-                  'target'      => 'content',
-                  'link'        => 'monitor/show_data.php?type=database_size',
-                  'html_id' => 'database_usage');
-
-$items[] = array( 'title' 	=> "Show Memory usage",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=mem_usage',
-                  'html_id' => 'mem_usage');
-
-$items[] = array( 'title' 	=> "Show Services",
-                  '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,
-                            'items'	=> $items);
+	'target'      => 'content',
+	'link'        => 'monitor/show_data.php?type=database_size',
+	'html_id' => 'database_usage');
+
+$items[] = array( 'title'  => "Show Memory usage",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=mem_usage',
+	'html_id' => 'mem_usage');
+
+$items[] = array( 'title'  => "Show Services",
+	'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,
+	'items' => $items);
 
 /*
  * Clear and set the Navigation-Items
  */
 unset($items);
 
-$items[] = array( 'title' 	=> "Show Mail-Queue",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=mailq',
-                  'html_id' => 'mailq');
-
-$items[] = array( 'title' 	=> "Show Mail-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_mail',
-                  'html_id' => 'log_mail');
-
-$items[] = array( 'title' 	=> "Show Mail warn-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_mail_warn',
-                  'html_id' => 'log_mail_warn');
-
-$items[] = array( 'title' 	=> "Show Mail err-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_mail_err',
-                  'html_id' => 'log_mail_err');
-
-$items[] = array( 'title' 	=> "Show System-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_messages',
-                  'html_id' => 'log_messages');
-
-$items[] = array( 'title' 	=> "Show ISPC Cron-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_ispc_cron',
-                  'html_id' => 'log_ispc_cron');
-
-$items[] = array( 'title' 	=> "Show Freshclam-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_freshclam',
-                  'html_id' => 'log_freshclam');
-
-$items[] = array( 'title' 	=> "Show Clamav-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_log.php?log=log_clamav',
-                  'html_id' => 'log_clamav');
-
-$items[] = array( 'title' 	=> "Show RKHunter-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=rkhunter',
-                  'html_id' => 'rkhunter');
-
-$items[] = array( 'title' 	=> "Show fail2ban-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=fail2ban',
-                  'html_id' => 'fai2ban');
-
-$items[] = array( 'title' 	=> "Show MongoDB-Log",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=mongodb',
-                  'html_id' => 'mongodb');
-
-$items[] = array( 'title' 	=> "Show IPTables",
-                  'target' 	=> 'content',
-                  'link'	=> 'monitor/show_data.php?type=iptables',
-                  'html_id' => 'iptables');
-
-$module["nav"][] = array(	'title'	=> 'Logfiles',
-                            'open' 	=> 1,
-                            'items'	=> $items);
+$items[] = array( 'title'  => "Show Mail-Queue",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=mailq',
+	'html_id' => 'mailq');
+
+$items[] = array( 'title'  => "Show Mail-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_mail',
+	'html_id' => 'log_mail');
+
+$items[] = array( 'title'  => "Show Mail warn-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_mail_warn',
+	'html_id' => 'log_mail_warn');
+
+$items[] = array( 'title'  => "Show Mail err-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_mail_err',
+	'html_id' => 'log_mail_err');
+
+$items[] = array( 'title'  => "Show System-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_messages',
+	'html_id' => 'log_messages');
+
+$items[] = array( 'title'  => "Show ISPC Cron-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_ispc_cron',
+	'html_id' => 'log_ispc_cron');
+
+$items[] = array( 'title'  => "Show Freshclam-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_freshclam',
+	'html_id' => 'log_freshclam');
+
+$items[] = array( 'title'  => "Show Clamav-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_log.php?log=log_clamav',
+	'html_id' => 'log_clamav');
+
+$items[] = array( 'title'  => "Show RKHunter-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=rkhunter',
+	'html_id' => 'rkhunter');
+
+$items[] = array( 'title'  => "Show fail2ban-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=fail2ban',
+	'html_id' => 'fai2ban');
+
+$items[] = array( 'title'  => "Show MongoDB-Log",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=mongodb',
+	'html_id' => 'mongodb');
+
+$items[] = array( 'title'  => "Show IPTables",
+	'target'  => 'content',
+	'link' => 'monitor/show_data.php?type=iptables',
+	'html_id' => 'iptables');
+
+$module["nav"][] = array( 'title' => 'Logfiles',
+	'open'  => 1,
+	'items' => $items);
 ?>
diff --git a/interface/web/monitor/list/datalog.list.php b/interface/web/monitor/list/datalog.list.php
index 01362c1c62e72deab92d12aabe5596bbffd32a23..81326e32a7bcac311d8ebbd8bcbea7b2191383b9 100644
--- a/interface/web/monitor/list/datalog.list.php
+++ b/interface/web/monitor/list/datalog.list.php
@@ -10,82 +10,82 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'datalog';
+$liste['name']     = 'datalog';
 
 //* Database table
-$liste['table'] 			= 'sys_datalog';
+$liste['table']    = 'sys_datalog';
 
 //* Primary index column
-$liste['table_idx']			= 'datalog_id';
+$liste['table_idx']   = 'datalog_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'datalog_list.php';
+$liste['file']    = 'datalog_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'datalog_list.php';
+$liste['edit_file']   = 'datalog_list.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'datalog_del.php';
+$liste['delete_file']  = 'datalog_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "tstamp",
-							'datatype'	=> "DATETIME",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
-
-$liste["item"][] = array(	'field'		=> "action",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('i' => "Insert",'u' => "Update",'d' => "Delete"));
-
-
-$liste["item"][] = array(	'field'		=> "dbtable",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
- 
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "tstamp",
+	'datatype' => "DATETIME",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
+
+$liste["item"][] = array( 'field'  => "action",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('i' => "Insert", 'u' => "Update", 'd' => "Delete"));
+
+
+$liste["item"][] = array( 'field'  => "dbtable",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/monitor/list/log.list.php b/interface/web/monitor/list/log.list.php
index 9490090c5281cfcc853c1a77d46b20d9f08bddfe..49e0a08f37b3d677a7da110ba1f1ee1dec0e7d74 100644
--- a/interface/web/monitor/list/log.list.php
+++ b/interface/web/monitor/list/log.list.php
@@ -10,81 +10,81 @@
 */
 
 //* Name of list
-$liste['name'] 				= 'syslog';
+$liste['name']     = 'syslog';
 
 //* Database table
-$liste['table'] 			= 'sys_log';
+$liste['table']    = 'sys_log';
 
 //* Primary index column
-$liste['table_idx']			= 'syslog_id';
+$liste['table_idx']   = 'syslog_id';
 
 //* Search Field Prefix
-$liste['search_prefix'] 	= 'search_';
+$liste['search_prefix']  = 'search_';
 
 //* Records per page
-$liste['records_per_page'] 	= "15";
+$liste['records_per_page']  = "15";
 
 //* Script file for listing
-$liste['file']				= 'log_list.php';
+$liste['file']    = 'log_list.php';
 
 //* Script file to edit
-$liste['edit_file']			= 'log_list.php';
+$liste['edit_file']   = 'log_list.php';
 
 //* Script file to delete
-$liste['delete_file']		= 'log_del.php';
+$liste['delete_file']  = 'log_del.php';
 
 //* Paging template
-$liste['paging_tpl']		= 'templates/paging.tpl.htm';
+$liste['paging_tpl']  = 'templates/paging.tpl.htm';
 
 //* Enable auth
-$liste['auth']				= 'no';
+$liste['auth']    = 'no';
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "tstamp",
-							'datatype'	=> "DATETIME",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste['item'][] = array(	'field'		=> 'server_id',
-							'datatype'	=> 'VARCHAR',
-							'formtype'	=> 'SELECT',
-							'op'		=> 'like',
-							'prefix'	=> '%',
-							'suffix'	=> '%',
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> '',
-							'value'		=> '');
-
-$liste["item"][] = array(	'field'		=> "loglevel",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('0' => "Debug",'1' => "Warning",'2' => "Error"));
-
-
-$liste["item"][] = array(	'field'		=> "message",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
- 
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "tstamp",
+	'datatype' => "DATETIME",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste['item'][] = array( 'field'  => 'server_id',
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'  => 'like',
+	'prefix' => '%',
+	'suffix' => '%',
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => '',
+	'value'  => '');
+
+$liste["item"][] = array( 'field'  => "loglevel",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('0' => "Debug", '1' => "Warning", '2' => "Error"));
+
+
+$liste["item"][] = array( 'field'  => "message",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/monitor/log_del.php b/interface/web/monitor/log_del.php
index 09b339b70a118dc3b81e49b75ae6c08a7bbef732..04d11e9665ec8d12ed77ee7a97ec4987a3d65678 100644
--- a/interface/web/monitor/log_del.php
+++ b/interface/web/monitor/log_del.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -41,4 +41,4 @@ header('Location: log_list.php');
 exit;
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/log_list.php b/interface/web/monitor/log_list.php
index 2d5edb25cb58e839a88cbcaeddd3ead2c8bdfd99..c694a41ec9fee0af771681c389e72a4e8928cc74 100644
--- a/interface/web/monitor/log_list.php
+++ b/interface/web/monitor/log_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->listform_actions->SQLOrderBy = "ORDER BY sys_log.tstamp DESC, sys_log.sysl
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/monitor/show_data.php b/interface/web/monitor/show_data.php
index 42f4766485e4495beced685e88ba088627f485af..c8f46bbb10f909658c98234c40060549d40f69ab 100644
--- a/interface/web/monitor/show_data.php
+++ b/interface/web/monitor/show_data.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -47,107 +47,107 @@ $monTransSrv = $app->lng("monitor_settings_server_txt");
 $output = '';
 
 switch($dataType) {
-    case 'server_load':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showServerLoad();
-        $time = $app->tools_monitor->getDataTime('server_load');
-        $title = $app->lng("Server Load").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'disk_usage':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showDiskUsage();
-        $time = $app->tools_monitor->getDataTime('disk_usage');
-        $title = $app->lng("Disk usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'database_size':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showDatabaseSize();
-        $time = $app->tools_monitor->getDataTime('database_size');
-        $title = $app->lng("Database size").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'mem_usage':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showMemUsage();
-        $time = $app->tools_monitor->getDataTime('mem_usage');
-        $title = $app->lng("Memory usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'cpu_info':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showCpuInfo();
-        $time = $app->tools_monitor->getDataTime('cpu_info');
-        $title = $app->lng("monitor_title_cpuinfo_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'services':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showServices();
-        $time = $app->tools_monitor->getDataTime('services');
-        $title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'openvz_beancounter':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showOpenVzBeanCounter();
-        $time = $app->tools_monitor->getDataTime('openvz_beancounter');
-        $title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'system_update':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showSystemUpdate();
-        $time = $app->tools_monitor->getDataTime('system_update');
-        $title = $app->lng("monitor_title_updatestate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'mailq':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showMailq();
-        $time = $app->tools_monitor->getDataTime('mailq');
-        $title = $app->lng("monitor_title_mailq_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'raid_state':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showRaidState();
-        $time = $app->tools_monitor->getDataTime('raid_state');
-        $title = $app->lng("monitor_title_raidstate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'rkhunter':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showRKHunter();
-        $time = $app->tools_monitor->getDataTime('rkhunter');
-        $title = $app->lng("monitor_title_rkhunterlog_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'fail2ban':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showFail2ban();
-        $time = $app->tools_monitor->getDataTime('log_fail2ban');
-        $title = $app->lng("monitor_title_fail2ban_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'mongodb':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showMongoDB();
-        $time = $app->tools_monitor->getDataTime('log_mongodb');
-        $title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    case 'iptables':
-        $template = 'templates/show_data.htm';
-        $output .= $app->tools_monitor->showIPTables();
-        $time = $app->tools_monitor->getDataTime('iptables_rules');
-        $title = $app->lng("monitor_title_iptables_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
-        $description = '';
-        break;
-    default:
-        $template = '';
-        break;
+case 'server_load':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showServerLoad();
+	$time = $app->tools_monitor->getDataTime('server_load');
+	$title = $app->lng("Server Load").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'disk_usage':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showDiskUsage();
+	$time = $app->tools_monitor->getDataTime('disk_usage');
+	$title = $app->lng("Disk usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'database_size':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showDatabaseSize();
+	$time = $app->tools_monitor->getDataTime('database_size');
+	$title = $app->lng("Database size").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'mem_usage':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showMemUsage();
+	$time = $app->tools_monitor->getDataTime('mem_usage');
+	$title = $app->lng("Memory usage").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'cpu_info':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showCpuInfo();
+	$time = $app->tools_monitor->getDataTime('cpu_info');
+	$title = $app->lng("monitor_title_cpuinfo_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'services':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showServices();
+	$time = $app->tools_monitor->getDataTime('services');
+	$title = $app->lng("Status of services").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'openvz_beancounter':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showOpenVzBeanCounter();
+	$time = $app->tools_monitor->getDataTime('openvz_beancounter');
+	$title = $app->lng("monitor_title_beancounter_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'system_update':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showSystemUpdate();
+	$time = $app->tools_monitor->getDataTime('system_update');
+	$title = $app->lng("monitor_title_updatestate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'mailq':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showMailq();
+	$time = $app->tools_monitor->getDataTime('mailq');
+	$title = $app->lng("monitor_title_mailq_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'raid_state':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showRaidState();
+	$time = $app->tools_monitor->getDataTime('raid_state');
+	$title = $app->lng("monitor_title_raidstate_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'rkhunter':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showRKHunter();
+	$time = $app->tools_monitor->getDataTime('rkhunter');
+	$title = $app->lng("monitor_title_rkhunterlog_txt"). ' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'fail2ban':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showFail2ban();
+	$time = $app->tools_monitor->getDataTime('log_fail2ban');
+	$title = $app->lng("monitor_title_fail2ban_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'mongodb':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showMongoDB();
+	$time = $app->tools_monitor->getDataTime('log_mongodb');
+	$title = $app->lng("monitor_title_mongodb_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'iptables':
+	$template = 'templates/show_data.htm';
+	$output .= $app->tools_monitor->showIPTables();
+	$time = $app->tools_monitor->getDataTime('iptables_rules');
+	$title = $app->lng("monitor_title_iptables_txt") . ' (' . $monTransSrv . ' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+default:
+	$template = '';
+	break;
 }
 
 
diff --git a/interface/web/monitor/show_log.php b/interface/web/monitor/show_log.php
index cb9e4c1074f80c670f0256d69426cd1fff92e446..96217dada18dee68771d738e4b896c9e30ea9379 100644
--- a/interface/web/monitor/show_log.php
+++ b/interface/web/monitor/show_log.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -39,7 +39,7 @@ $app->uses('tools_monitor');
 // Loading the template
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/show_log.htm');
+$app->tpl->setInclude('content_tpl', 'templates/show_log.htm');
 
 // Importing the GET values
 $refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0;
@@ -54,51 +54,51 @@ $monTransRefreshsq = $app->lng("monitor_settings_refreshsq_txt");
  Setting the db-type and the caption
  */
 switch($logParam) {
-	case 'log_mail':
-		$logId = 'log_mail';
-		$title = $app->lng("monitor_logs_mail_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_mail_warn':
-		$logId = 'log_mail_warn';
-		$title = $app->lng("monitor_logs_mailwarn_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_mail_err':
-		$logId = 'log_mail_err';
-		$title = $app->lng("monitor_logs_mailerr_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_messages':
-		$logId = 'log_messages';
-		$title = $app->lng("monitor_logs_messages_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_ispc_cron':
-		$logId = 'log_ispc_cron';
-		$title = $app->lng("monitor_logs_ispccron_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_freshclam':
-		$logId = 'log_freshclam';
-		$title = $app->lng("monitor_logs_freshclam_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_clamav':
-		$logId = 'log_clamav';
-		$title = $app->lng("monitor_logs_clamav_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	case 'log_ispconfig':
-		$logId = 'log_ispconfig';
-		$title = $app->lng("monitor_logs_ispc_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
-		$description = '';
-		break;
-	default:
-		$logId = '???';
-		$title = '???';
-		$description = '';
-		break;
+case 'log_mail':
+	$logId = 'log_mail';
+	$title = $app->lng("monitor_logs_mail_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_mail_warn':
+	$logId = 'log_mail_warn';
+	$title = $app->lng("monitor_logs_mailwarn_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_mail_err':
+	$logId = 'log_mail_err';
+	$title = $app->lng("monitor_logs_mailerr_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_messages':
+	$logId = 'log_messages';
+	$title = $app->lng("monitor_logs_messages_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_ispc_cron':
+	$logId = 'log_ispc_cron';
+	$title = $app->lng("monitor_logs_ispccron_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_freshclam':
+	$logId = 'log_freshclam';
+	$title = $app->lng("monitor_logs_freshclam_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_clamav':
+	$logId = 'log_clamav';
+	$title = $app->lng("monitor_logs_clamav_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+case 'log_ispconfig':
+	$logId = 'log_ispconfig';
+	$title = $app->lng("monitor_logs_ispc_txt").' ('. $monTransSrv .' : ' . $_SESSION['monitor']['server_name'] . ')';
+	$description = '';
+	break;
+default:
+	$logId = '???';
+	$title = '???';
+	$description = '';
+	break;
 }
 
 
@@ -107,7 +107,7 @@ switch($logParam) {
  Attention: the core-moule ist triggered every 5 minutes,
             so reload every 2 minutes is impossible!
 */
-$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes"));
+$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -', '5' => '5 '.$app->lng("minutes"), '10' => '10 '.$app->lng("minutes"), '15' => '15 '.$app->lng("minutes"), '30' => '30 '.$app->lng("minutes"), '60' => '60 '.$app->lng("minutes"));
 $tmp = '';
 foreach($refresh_values as $key => $val) {
 	if($key == $refresh) {
@@ -116,7 +116,7 @@ foreach($refresh_values as $key => $val) {
 		$tmp .= "<option value='$key'>$val</option>";
 	}
 }
-$app->tpl->setVar("refresh",$tmp);
+$app->tpl->setVar("refresh", $tmp);
 
 
 /* fetch the Data from the DB */
@@ -125,20 +125,20 @@ $record = $app->db->queryOneRecord("SELECT data, state FROM monitor_data WHERE t
 if(isset($record['data'])) {
 	$data = unserialize($record['data']);
 
-  $logData = explode("\n", htmlspecialchars($data));
-  $logDataHtml = '';
-  /* set css class for each line of log, depending on key words in each line */
-  foreach($logData as $val) {
-    if (strpos($val, 'ERROR') !== FALSE) {
-      $logDataHtml .= "<div class='logerror'>$val</div>";   
-    } elseif (strpos($val, 'WARN') !== FALSE) {
-      $logDataHtml .= "<div class='logwarn'>$val</div>";   
-    } elseif (strpos($val, 'INFO') !== FALSE) {
-      $logDataHtml .= "<div class='loginfo'>$val</div>";   
-    } else {
-      $logDataHtml .= "<div class='log'>$val</div>";   
-    }
-  }
+	$logData = explode("\n", htmlspecialchars($data));
+	$logDataHtml = '';
+	/* set css class for each line of log, depending on key words in each line */
+	foreach($logData as $val) {
+		if (strpos($val, 'ERROR') !== FALSE) {
+			$logDataHtml .= "<div class='logerror'>$val</div>";
+		} elseif (strpos($val, 'WARN') !== FALSE) {
+			$logDataHtml .= "<div class='logwarn'>$val</div>";
+		} elseif (strpos($val, 'INFO') !== FALSE) {
+			$logDataHtml .= "<div class='loginfo'>$val</div>";
+		} else {
+			$logDataHtml .= "<div class='log'>$val</div>";
+		}
+	}
 
 	$app->tpl->setVar("log_data", $logData);
 } else {
@@ -146,7 +146,7 @@ if(isset($record['data'])) {
 }
 
 $app->tpl->setVar("list_head_txt", $title);
-$app->tpl->setVar("log_id",$logId);
+$app->tpl->setVar("log_id", $logId);
 $app->tpl->setVar("list_desc_txt", $description);
 $app->tpl->setVar("time", $app->tools_monitor->getDataTime($logId));
 $app->tpl->setVar("monTransDate", $monTransDate);
diff --git a/interface/web/monitor/show_monit.php b/interface/web/monitor/show_monit.php
index 0121a688464411e9b6af6efaa5e99ab22ad3fe73..7bd69df43f5dd84713525bdbea9c4a8bbd8ac6f0 100644
--- a/interface/web/monitor/show_monit.php
+++ b/interface/web/monitor/show_monit.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -47,9 +47,9 @@ $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');
+	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'], 'server');
 
 	$monit_url = trim($server_config['monit_url']);
 	if($monit_url != ''){
@@ -64,11 +64,11 @@ if($_SESSION["s"]["user"]["typ"] == 'admin'){
 			$auth_string .= ':'.rawurlencode($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"));
diff --git a/interface/web/monitor/show_munin.php b/interface/web/monitor/show_munin.php
index 5db6adf6f153368d7aa6e71f91f55a1db3121b05..ecc94dab23ef8c482920181b0c2449740f3cfcb2 100644
--- a/interface/web/monitor/show_munin.php
+++ b/interface/web/monitor/show_munin.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('monitor');
@@ -47,9 +47,9 @@ $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');
+	$server_config = $app->getconf->get_server_config($_SESSION['monitor']['server_id'], 'server');
 
 	$munin_url = trim($server_config['munin_url']);
 	if($munin_url != ''){
@@ -64,11 +64,11 @@ if($_SESSION["s"]["user"]["typ"] == 'admin'){
 			$auth_string .= ':'.rawurlencode($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"));
diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php
index d251cdc4891857f350fffeebdc7ef87dc725e0ea..aa97317ade9a0bb94a31748b0680ea182b763779 100644
--- a/interface/web/monitor/show_sys_state.php
+++ b/interface/web/monitor/show_sys_state.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /* Check permissions for module */
 $app->auth->check_module_permissions('monitor');
@@ -45,7 +45,7 @@ if (isset($_GET['server'])) {
 */
 $app->uses('tpl');
 $app->tpl->newTemplate("form.tpl.htm");
-$app->tpl->setInclude('content_tpl','templates/show_sys_state.htm');
+$app->tpl->setInclude('content_tpl', 'templates/show_sys_state.htm');
 
 /* Get some translations */
 $monTransRefreshsq = $app->lng("monitor_settings_refreshsq_txt");
@@ -65,10 +65,10 @@ else {
 	$stateType = 'system';
 }
 
-$app->tpl->setVar("state_data",$output);
-$app->tpl->setVar("state_type",$stateType);
-$app->tpl->setVar("list_head_txt",$title);
-$app->tpl->setVar("list_desc_txt",(isset($description) ? $description : ''));
+$app->tpl->setVar("state_data", $output);
+$app->tpl->setVar("state_type", $stateType);
+$app->tpl->setVar("list_head_txt", $title);
+$app->tpl->setVar("list_desc_txt", (isset($description) ? $description : ''));
 $app->tpl->setVar("monTransRefreshsq", $monTransRefreshsq);
 
 /*
@@ -78,7 +78,7 @@ $app->tpl->setVar("monTransRefreshsq", $monTransRefreshsq);
 */
 $refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0;
 
-$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes"));
+$refresh_values = array('0' => '- '.$app->lng("No Refresh").' -', '5' => '5 '.$app->lng("minutes"), '10' => '10 '.$app->lng("minutes"), '15' => '15 '.$app->lng("minutes"), '30' => '30 '.$app->lng("minutes"), '60' => '60 '.$app->lng("minutes"));
 $tmp = '';
 foreach($refresh_values as $key => $val) {
 	if($key == $refresh) {
@@ -103,6 +103,8 @@ function _getSysState() {
 	global $app;
 
 	/** The data of all Servers as (sorted by name) array */
+
+
 	$serverData = array();
 
 	/*
@@ -198,7 +200,7 @@ function _getServerState($serverId, $serverName) {
 		$tmp = _processDbState($record['type'], $serverId, $serverState, $messages);
 		$serverState = $tmp['serverState'];
 		$messages = $tmp['messages'];
-		
+
 		/* if we have the os-info, get it */
 		if ($record['type'] == 'os_info') {
 			$osData = unserialize($record['data']);
@@ -222,12 +224,12 @@ function _getServerState($serverId, $serverName) {
 	 * Info of a VE inside a OpenVz-Host
 	*/
 	$html_ve  = '<div class="systemmonitor-ve state-' . $serverState . '-ve os-' . $osData['name'] . '">';
-        if ($osData != null) {
-            $html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
-        else {
-            $html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
+	if ($osData != null) {
+		$html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
+	else {
+		$html_ve .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
 	$html_ve .= '<div class="statusDevice"><p>' . $serverName;
 	if ($osData != null) {
 		$html_ve .= ' (' . $osData['name'] . ' ' . $osData['version'] . ') ';
@@ -235,9 +237,9 @@ function _getServerState($serverId, $serverName) {
 	if ($ispcData != null) {
 		$html_ve .= $ispcData['name'] . ' ' . $ispcData['version'] . '</p>';
 	}
-        else {
-            $html_ve .= '</p>';
-        }
+	else {
+		$html_ve .= '</p>';
+	}
 	$html_ve .= '<p>' . $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . '</p>';
 
 	/*
@@ -245,21 +247,21 @@ function _getServerState($serverId, $serverName) {
 	*/
 	$html_server = '<div class="systemmonitor-server state-' . $serverState . ' os-' . $osData['name'] . '">';
 	if ($osData != null) {
-            $html_server .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
-        else {
-            $html_server .= '<div class="icoDevice"><p class="status"></p></div>';
-        }
+		$html_server .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
+	else {
+		$html_server .= '<div class="icoDevice"><p class="status"></p></div>';
+	}
 	$html_server .= '<div class="statusDevice"><p>' . $app->lng("monitor_serverstate_server_txt") . ': ' . $serverName;
 	if ($osData != null) {
-            $html_server .= ' (' . $osData['name'] . ' ' . $osData['version'] . ') ';
+		$html_server .= ' (' . $osData['name'] . ' ' . $osData['version'] . ') ';
 	}
 	if ($ispcData != null) {
-            $html_server .= $ispcData['name'] . ' ' . $ispcData['version'] . '</p>';
+		$html_server .= $ispcData['name'] . ' ' . $ispcData['version'] . '</p>';
+	}
+	else {
+		$html_server .= '</p>';
 	}
-        else {
-            $html_server .= '</p>';
-        }
 
 	$html_server .= '<p>' . $app->lng("monitor_serverstate_state_txt") . ': ' . $serverState . ' (';
 	$html_server .= sizeof((isset($messages[$app->lng("monitor_serverstate_listunknown_txt")]) ? $messages[$app->lng("monitor_serverstate_listunknown_txt")] : array())) . ' ' . $app->lng("monitor_serverstate_unknown_txt") . ', ';
@@ -270,7 +272,7 @@ function _getServerState($serverId, $serverName) {
 	$html_server .= ')</p>';
 
 	/*
-	 * Verbose - Info 
+	 * Verbose - Info
 	*/
 	$html_verbose = $html_server;
 	foreach($messages as $key => $state) {
@@ -336,31 +338,31 @@ function _processDbState($type, $serverId, $serverState, $messages) {
 	}
 	if ($type == 'disk_usage') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_hdok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_hdgoingfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_hdnearlyfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_hdveryfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_hdfull_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_hdunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_hdok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_hdgoingfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_hdnearlyfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_hdveryfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_hdfull_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_hdunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=disk_usage\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 	if ($type == 'mem_usage') {
@@ -368,180 +370,180 @@ function _processDbState($type, $serverId, $serverState, $messages) {
 	}
 	if ($type == 'server_load') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_loadok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_loadheavy_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_loadhigh_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_loadhigher_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_loadhighest_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_loadunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_loadok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_loadheavy_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_loadhigh_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_loadhigher_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_loadhighest_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_loadunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=server_load\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 	if ($type == 'services') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_servicesonline_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_servicesoffline_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_servicesunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_servicesonline_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_servicesoffline_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_servicesunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=services\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 	if ($type == 'system_update') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_updatesok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_updatesneeded_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'no_state':
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_updatesok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_updatesneeded_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'no_state':
 			/*
                  *  not debian and not Ubuntu, so the state could not be monitored...
 			*/
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_updatesunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_updatesunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=system_update\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
 	if ($type == 'raid_state') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_raidok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_raidresync_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_raidfault_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_raiderror_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'no_state':
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_raidok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_raidresync_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_raidfault_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_raiderror_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'no_state':
 			/*
                  *  mdadm is not installed or the RAID is not supported...
 			*/
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_raidunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_raidunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=raid_state\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
 	/*
 	 * ignore, until we find a better solution
 	 */
-//	if ($type == 'openvz_beancounter') {
-//		switch ($record['state']) {
-//			case 'ok':
-//				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_beancounterok_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'info':
-//				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterinfo_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'warning':
-//				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterwarning_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'critical':
-//				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_beancountercritical_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			case 'error':
-//				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_beancountererror_txt") . ' ' .
-//						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-//				break;
-//			default:
-//				break;
-//		}
-//	}
+	// if ($type == 'openvz_beancounter') {
+	//  switch ($record['state']) {
+	//   case 'ok':
+	//    $messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_beancounterok_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'info':
+	//    $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterinfo_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'warning':
+	//    $messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_beancounterwarning_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'critical':
+	//    $messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_beancountercritical_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   case 'error':
+	//    $messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_beancountererror_txt") . ' ' .
+	//      "<a href='#' onclick='loadContent(\"monitor/show_data.php?type=openvz_beancounter\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+	//    break;
+	//   default:
+	//    break;
+	//  }
+	// }
 
 
 	if ($type == 'mailq') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mailqok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_mailqheavy_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mailqhigh_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'critical':
-				$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_mailqhigher_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_mailqhighest_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mailqunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_mailqok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listinfo_txt")][] = $app->lng("monitor_serverstate_mailqheavy_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_mailqhigh_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'critical':
+			$messages[$app->lng("monitor_serverstate_listcritical_txt")][] = $app->lng("monitor_serverstate_mailqhigher_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_mailqhighest_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_mailqunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_data.php?type=mailq\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
 	if ($type == 'sys_log') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_syslogok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'warning':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_syslogwarning_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'error':
-				$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_syslogerror_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_syslogunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_syslogok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'warning':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_syslogwarning_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'error':
+			$messages[$app->lng("monitor_serverstate_listerror_txt")][] = $app->lng("monitor_serverstate_syslogerror_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_syslogunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/log_list.php\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
@@ -551,18 +553,18 @@ function _processDbState($type, $serverId, $serverState, $messages) {
 
 	if ($type == 'log_freshclam') {
 		switch ($record['state']) {
-			case 'ok':
-				$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_fclamok_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			case 'info':
-				$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_fclamoutdated_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
-			default:
-				$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_fclamunknown_txt") . ' ' .
-						"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
-				break;
+		case 'ok':
+			$messages[$app->lng("monitor_serverstate_listok_txt")][] = $app->lng("monitor_serverstate_fclamok_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		case 'info':
+			$messages[$app->lng("monitor_serverstate_listwarning_txt")][] = $app->lng("monitor_serverstate_fclamoutdated_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
+		default:
+			$messages[$app->lng("monitor_serverstate_listunknown_txt")][] = $app->lng("monitor_serverstate_fclamunknown_txt") . ' ' .
+				"<a href='#' onclick='loadContent(\"monitor/show_log.php?log=log_freshclam\");'>[" . $app->lng("monitor_serverstate_more_txt") . "]</a>";
+			break;
 		}
 	}
 
@@ -584,8 +586,8 @@ function _processDbState($type, $serverId, $serverState, $messages) {
 	if ($type == 'rkhunter') {
 		/* this type has no state */
 	}
-	
-	return array('serverState' => $serverState,'messages' => $messages);
+
+	return array('serverState' => $serverState, 'messages' => $messages);
 }
 
 /*
@@ -601,39 +603,39 @@ function _setState($oldState, $newState) {
     * Calculate the weight of the old state
 	*/
 	switch ($oldState) {
-		case 'no_state': $oldInt = 0;
-			break;
-		case 'ok': $oldInt = 1;
-			break;
-		case 'unknown': $oldInt = 2;
-			break;
-		case 'info': $oldInt = 3;
-			break;
-		case 'warning': $oldInt = 4;
-			break;
-		case 'critical': $oldInt = 5;
-			break;
-		case 'error': $oldInt = 6;
-			break;
+	case 'no_state': $oldInt = 0;
+		break;
+	case 'ok': $oldInt = 1;
+		break;
+	case 'unknown': $oldInt = 2;
+		break;
+	case 'info': $oldInt = 3;
+		break;
+	case 'warning': $oldInt = 4;
+		break;
+	case 'critical': $oldInt = 5;
+		break;
+	case 'error': $oldInt = 6;
+		break;
 	}
 	/*
          * Calculate the weight of the new state
 	*/
 	switch ($newState) {
-		case 'no_state': $newInt = 0 ;
-			break;
-		case 'ok': $newInt = 1 ;
-			break;
-		case 'unknown': $newInt = 2 ;
-			break;
-		case 'info': $newInt = 3 ;
-			break;
-		case 'warning': $newInt = 4 ;
-			break;
-		case 'critical': $newInt = 5 ;
-			break;
-		case 'error': $newInt = 6 ;
-			break;
+	case 'no_state': $newInt = 0 ;
+		break;
+	case 'ok': $newInt = 1 ;
+		break;
+	case 'unknown': $newInt = 2 ;
+		break;
+	case 'info': $newInt = 3 ;
+		break;
+	case 'warning': $newInt = 4 ;
+		break;
+	case 'critical': $newInt = 5 ;
+		break;
+	case 'error': $newInt = 6 ;
+		break;
 	}
 
 	/*
diff --git a/interface/web/nav.php b/interface/web/nav.php
index 909392ffd8b31b555799a6ea708fcf413bd4b100..4d8617cac7b1dc8d3de8836545ed760ba41955e7 100644
--- a/interface/web/nav.php
+++ b/interface/web/nav.php
@@ -28,8 +28,8 @@ 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');
+require_once '../lib/config.inc.php';
+require_once '../lib/app.inc.php';
 
 $app->uses('tpl');
 
@@ -55,28 +55,28 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
 			foreach($modules as $mt) {
 				if(is_file($mt.'/lib/module.conf.php')) {
 					if(!preg_match("/^[a-z]{2,20}$/i", $mt)) die('module name contains unallowed chars.');
-					include_once($mt.'/lib/module.conf.php');
+					include_once $mt.'/lib/module.conf.php';
 					$language = (isset($_SESSION['s']['user']['language']))?$_SESSION['s']['user']['language']:$conf['language'];
 					$app->load_language_file('web/'.$mt.'/lib/'.$language.'.lng');
 					$active = ($module['name'] == $_SESSION['s']['module']['name']) ? 1 : 0;
-					$topnav[] = array(	'title' 	=> $app->lng($module['title']),
-							'active' 	=> $active,
-							'module'	=> $module['name']);
+					$topnav[] = array( 'title'  => $app->lng($module['title']),
+						'active'  => $active,
+						'module' => $module['name']);
 				}
 			}
 		}
 	} else {
 		//*  Loading Login Module
-		include_once('login/lib/module.conf.php');
+		include_once 'login/lib/module.conf.php';
 		$_SESSION['s']['module'] = $module;
-		$topnav[] = array(	'title' 	=> 'Login',
-				'active' 	=> 1);
+		$topnav[] = array( 'title'  => 'Login',
+			'active'  => 1);
 		$module = null;
 		unset($module);
 	}
 
 	//* Topnavigation
-	$app->tpl->setLoop('nav_top',$topnav);
+	$app->tpl->setLoop('nav_top', $topnav);
 
 }
 
@@ -84,9 +84,9 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'top') {
 if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
 
 	if(isset($_SESSION['s']['module']['name']) && is_file($_SESSION['s']['module']['name'].'/lib/custom_menu.inc.php')) {
-		include_once($_SESSION['s']['module']['name'].'/lib/custom_menu.inc.php');
+		include_once $_SESSION['s']['module']['name'].'/lib/custom_menu.inc.php';
 	} else {
-	
+
 		$app->tpl->newTemplate('sidenav.tpl.htm');
 
 		//* translating module navigation
@@ -106,8 +106,8 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
 		} else {
 			$nav_translated = null;
 		}
-		$app->tpl->setLoop('nav_left',$nav_translated);
-	
+		$app->tpl->setLoop('nav_left', $nav_translated);
+
 	}
 
 }
@@ -115,4 +115,4 @@ if(isset($_GET['nav']) && $_GET['nav'] == 'side') {
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/remote/index.php b/interface/web/remote/index.php
index 2ce92206fbc01b1b062a0fed8acae31fbddad299..369cb2accb022bd590d987278a8eebd129103491 100644
--- a/interface/web/remote/index.php
+++ b/interface/web/remote/index.php
@@ -1,8 +1,8 @@
 <?php
 
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 $conf['start_session'] = false;
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
 
@@ -12,4 +12,4 @@ $server = new SoapServer(null, array('uri' => $_SERVER['REQUEST_URI']));
 $server->setObject(new ISPConfigSoapHandler());
 $server->handle();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/remote/json.php b/interface/web/remote/json.php
index f8e666c38fdcbb6effde190fed3d0020ca9ba379..a7bad846c347f2f38925e6b3aa11245e2ed0e5b0 100644
--- a/interface/web/remote/json.php
+++ b/interface/web/remote/json.php
@@ -1,11 +1,11 @@
 <?php
 
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 $conf['start_session'] = false;
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 $app->load('json_handler');
 $json_handler = new ISPConfigJSONHandler();
 $json_handler->run();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/remote/monitor.php b/interface/web/remote/monitor.php
index f49b1695d0a4668917f95adee760617356577bbb..9cc0084bba6eb101ace67453bb7843d7301e5eec 100644
--- a/interface/web/remote/monitor.php
+++ b/interface/web/remote/monitor.php
@@ -1,7 +1,7 @@
 <?php
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 $conf['start_session'] = false;
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.');
 
@@ -29,14 +29,14 @@ if($token == '' or $secret == '' or $token != $secret) {
 	if($type == 'serverlist') {
 		$sql = 'SELECT server_id, server_name FROM server WHERE 1 ORDER BY server_id';
 		$records = $app->db->queryAllRecords($sql);
-        foreach($records as $index => $rec) {
-            $rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE server_id = " . $rec['server_id'] . " AND state NOT IN ('ok', 'no_state', 'info')");
-            if($rec) $records[$index]['state'] = 'warn';
-            else $records[$index]['state'] = 'ok';
-        }
+		foreach($records as $index => $rec) {
+			$rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE server_id = " . $rec['server_id'] . " AND state NOT IN ('ok', 'no_state', 'info')");
+			if($rec) $records[$index]['state'] = 'warn';
+			else $records[$index]['state'] = 'ok';
+		}
 		$out['state'] = 'ok';
 		$out['data'] = $records;
-		$out['time'] = date('Y-m-d H:i',$rec['created']);
+		$out['time'] = date('Y-m-d H:i', $rec['created']);
 	} else {
 		$rec = $app->db->queryOneRecord("SELECT * FROM monitor_data WHERE type = '$type' AND server_id = $server_id");
 		if(is_array($rec)) {
@@ -47,7 +47,7 @@ if($token == '' or $secret == '' or $token != $secret) {
 					if(!$val) $out['data'][$key] = "&nbsp;";
 				}
 			}
-			$out['time'] = date('Y-m-d H:i',$rec['created']);
+			$out['time'] = date('Y-m-d H:i', $rec['created']);
 		} else {
 			$out['state'] = 'syserror';
 			$out['data'] = 'No monitor record found.';
@@ -60,66 +60,66 @@ if($token == '' or $secret == '' or $token != $secret) {
 }
 $out['type'] = $type;
 
-function __json_encode($data) {           
-    if( is_array($data) || is_object($data) ) {
-        $islist = is_array($data) && ( empty($data) || array_keys($data) === range(0,count($data)-1) );
-       
-        if( $islist ) {
-            $json = '[' . implode(',', array_map('__json_encode', $data) ) . ']';
-        } else {
-            $items = Array();
-            foreach( $data as $key => $value ) {
-                $items[] = __json_encode("$key") . ':' . __json_encode($value);
-            }
-            $json = '{' . implode(',', $items) . '}';
-        }
-    } elseif( is_string($data) ) {
-        # Escape non-printable or Non-ASCII characters.
-        # I also put the \\ character first, as suggested in comments on the 'addcslashes' page.
-        $string = '"' . addcslashes($data, "\\\"\n\r\t/" . chr(8) . chr(12)) . '"';
-        $json    = '';
-        $len    = strlen($string);
-        # Convert UTF-8 to Hexadecimal Codepoints.
-        for( $i = 0; $i < $len; $i++ ) {
-           
-            $char = $string[$i];
-            $c1 = ord($char);
-           
-            # Single byte;
-            if( $c1 <128 ) {
-                $json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
-                continue;
-            }
-           
-            # Double byte
-            $c2 = ord($string[++$i]);
-            if ( ($c1 & 32) === 0 ) {
-                $json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
-                continue;
-            }
-           
-            # Triple
-            $c3 = ord($string[++$i]);
-            if( ($c1 & 16) === 0 ) {
-                $json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
-                continue;
-            }
-               
-            # Quadruple
-            $c4 = ord($string[++$i]);
-            if( ($c1 & 8 ) === 0 ) {
-                $u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
-           
-                $w1 = (54<<10) + ($u<<6) + (($c2 & 15) << 2) + (($c3>>4) & 3);
-                $w2 = (55<<10) + (($c3 & 15)<<6) + ($c4-128);
-                $json .= sprintf("\\u%04x\\u%04x", $w1, $w2);
-            }
-        }
-    } else {
-        # int, floats, bools, null
-        $json = strtolower(var_export( $data, true ));
-    }
-    return $json;
+function __json_encode($data) {
+	if( is_array($data) || is_object($data) ) {
+		$islist = is_array($data) && ( empty($data) || array_keys($data) === range(0, count($data)-1) );
+
+		if( $islist ) {
+			$json = '[' . implode(',', array_map('__json_encode', $data) ) . ']';
+		} else {
+			$items = array();
+			foreach( $data as $key => $value ) {
+				$items[] = __json_encode("$key") . ':' . __json_encode($value);
+			}
+			$json = '{' . implode(',', $items) . '}';
+		}
+	} elseif( is_string($data) ) {
+		// Escape non-printable or Non-ASCII characters.
+		// I also put the \\ character first, as suggested in comments on the 'addcslashes' page.
+		$string = '"' . addcslashes($data, "\\\"\n\r\t/" . chr(8) . chr(12)) . '"';
+		$json    = '';
+		$len    = strlen($string);
+		// Convert UTF-8 to Hexadecimal Codepoints.
+		for( $i = 0; $i < $len; $i++ ) {
+
+			$char = $string[$i];
+			$c1 = ord($char);
+
+			// Single byte;
+			if( $c1 <128 ) {
+				$json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
+				continue;
+			}
+
+			// Double byte
+			$c2 = ord($string[++$i]);
+			if ( ($c1 & 32) === 0 ) {
+				$json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
+				continue;
+			}
+
+			// Triple
+			$c3 = ord($string[++$i]);
+			if( ($c1 & 16) === 0 ) {
+				$json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
+				continue;
+			}
+
+			// Quadruple
+			$c4 = ord($string[++$i]);
+			if( ($c1 & 8 ) === 0 ) {
+				$u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
+
+				$w1 = (54<<10) + ($u<<6) + (($c2 & 15) << 2) + (($c3>>4) & 3);
+				$w2 = (55<<10) + (($c3 & 15)<<6) + ($c4-128);
+				$json .= sprintf("\\u%04x\\u%04x", $w1, $w2);
+			}
+		}
+	} else {
+		// int, floats, bools, null
+		$json = strtolower(var_export( $data, true ));
+	}
+	return $json;
 }
 
 if(function_exists('json_encode')) { // PHP >= 5.2
@@ -128,4 +128,4 @@ if(function_exists('json_encode')) { // PHP >= 5.2
 	echo __json_encode($out);
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/ajax_get_ip.php b/interface/web/sites/ajax_get_ip.php
index 34fbab86aee5ac86e993dc6ba556f7257acd0abd..4101a807e17c8c4aa3db2bd4319d6d2d27e3f6a6 100644
--- a/interface/web/sites/ajax_get_ip.php
+++ b/interface/web/sites/ajax_get_ip.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -43,7 +43,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION
 
 	//* Get global web config
 	$web_config = $app->getconf->get_server_config($server_id, 'web');
-	
+
 	$sql = "SELECT ip_address FROM server_ip WHERE ip_type = '$ip_type' AND server_id = $server_id";
 	$ips = $app->db->queryAllRecords($sql);
 	// $ip_select = "<option value=''></option>";
@@ -62,5 +62,5 @@ if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION
 	unset($ips);
 }
 
-echo substr($ip_select,0,-1);
-?>
\ No newline at end of file
+echo substr($ip_select, 0, -1);
+?>
diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index 9da45131d46728d05c20b4d5b2ef84822d2bf8ce..68008976cba334cdaaa1bdc8a55f5fe52be21ef6 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -44,154 +44,154 @@ $type = $_GET["type"];
 
 //if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-	if($type == 'getservertype'){
-		$json = '{"servertype":"';
-		$server_type = 'apache';
-		$web_config = $app->getconf->get_server_config($server_id, 'web');
-		if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
-		$json .= $server_type;
-		unset($webconfig);
-		$json .= '"}';
-	}
-	
-	if($type == 'getserverid'){
-		$json = '{"serverid":"';
-		$sql = "SELECT server_id FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-		$server = $app->db->queryOneRecord($sql);
-		$json .= $server['server_id'];
-		unset($server);
-		$json .= '"}';
-	}
-	
-	if($type == 'getphpfastcgi'){
-		$json = '{';
-		
-		$server_type = 'apache';
-		$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';
-		$sql_where = '';
-		
-		//* Client: If the logged in user is not admin and has no sub clients (no reseller)
-		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"] . ")";
+if($type == 'getservertype'){
+	$json = '{"servertype":"';
+	$server_type = 'apache';
+	$web_config = $app->getconf->get_server_config($server_id, 'web');
+	if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
+	$json .= $server_type;
+	unset($webconfig);
+	$json .= '"}';
+}
+
+if($type == 'getserverid'){
+	$json = '{"serverid":"';
+	$sql = "SELECT server_id FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$server = $app->db->queryOneRecord($sql);
+	$json .= $server['server_id'];
+	unset($server);
+	$json .= '"}';
+}
+
+if($type == 'getphpfastcgi'){
+	$json = '{';
+
+	$server_type = 'apache';
+	$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';
+	$sql_where = '';
+
+	//* Client: If the logged in user is not admin and has no sub clients (no reseller)
+	if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+		$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"] . ")";
 		//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
-		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
-			//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
-			$sql_where = " AND (client_id = 0";
-			if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
-			$sql_where .= ")";
+	} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+		$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
+		//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
+		$sql_where = " AND (client_id = 0";
+		if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
+		$sql_where .= ")";
 		//* Admin: If the logged in user is admin
-		} else {
-			//$sql_where = '';
-			$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
-			//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
-			$sql_where = " AND (client_id = 0";
-			if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
-			$sql_where .= ")";
-		}
-		
-		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".$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".$sql_where);
-		}
-		$php_select = "";
-		if(is_array($php_records) && !empty($php_records)) {
-			foreach( $php_records as $php_record) {
-				if($php_type == 'php-fpm'){
-					$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
-				} else {
-					$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
-				}
-				$json .= '"'.$php_version.'": "'.$php_record['name'].'",';
-			}
-		}
-		unset($php_records);
-		if(substr($json,-1) == ',') $json = substr($json,0,-1);
-		$json .= '}';
-	}
-	
-	if($type == 'getphptype'){
-		$json = '{"phptype":"';
-		$sql = "SELECT php FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-		$php = $app->db->queryOneRecord($sql);
-		$json .= $php['php'];
-		unset($php);
-		$json .= '"}';
+	} else {
+		//$sql_where = '';
+		$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = $client_group_id");
+		//$sql_where = " AND (client_id = 0 OR client_id = ".$_SESSION["s"]["user"]["client_id"];
+		$sql_where = " AND (client_id = 0";
+		if($app->functions->intval($client['client_id']) > 0) $sql_where .= " OR client_id = ".$app->functions->intval($client['client_id']);
+		$sql_where .= ")";
 	}
-	
-	if($type == 'getredirecttype'){
-		$json = '{"redirecttype":"';
-		$sql = "SELECT redirect_type FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-		$redirect = $app->db->queryOneRecord($sql);
-		$json .= $redirect['redirect_type'];
-		unset($redirect);
-		$json .= '"}';
-	}
-	
-	if($type == 'get_ipv4'){		
-		$result = array();
-		
-		// ipv4
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv4');
-
-		$json = $app->functions->json_encode($result);
+
+	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".$sql_where);
 	}
-	
-	if($type == 'get_ipv6'){		
-		$result = array();
-		
-		// ipv6
-		//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
-		$result[] = $app->functions->suggest_ips('IPv6');
-		
-		$json = $app->functions->json_encode($result);
+	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".$sql_where);
 	}
-    
-    if($type == 'getdatabaseusers') {
-        $json = '{}';
-		
-		$sql = "SELECT sys_groupid FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
-        $group = $app->db->queryOneRecord($sql);
-        if($group) {
-            $sql = "SELECT database_user_id, database_user FROM web_database_user WHERE sys_groupid = '" . $group['sys_groupid'] . "'";
-            $records = $app->db->queryAllRecords($sql);
-            
-			$tmp_array = array();
-            foreach($records as $record) {
-				$tmp_array[$record['database_user_id']] = $record['database_user'];
-            }
-			$json = $app->functions->json_encode($tmp_array);
-            unset($records, $group, $tmp_array);
-        }
-    }
-	
-	if($type == 'get_use_combobox'){
-		$json = '{"usecombobox":"';
-		$use_combobox = 'y';
-		$server_config_array = $app->getconf->get_global_config();
-		if($server_config_array['misc']['use_combobox'] != 'y') $use_combobox = 'n';
-		$json .= $use_combobox;
-		unset($server_config_array);
-		$json .= '"}';
+	$php_select = "";
+	if(is_array($php_records) && !empty($php_records)) {
+		foreach( $php_records as $php_record) {
+			if($php_type == 'php-fpm'){
+				$php_version = $php_record['name'].':'.$php_record['php_fpm_init_script'].':'.$php_record['php_fpm_ini_dir'].':'.$php_record['php_fpm_pool_dir'];
+			} else {
+				$php_version = $php_record['name'].':'.$php_record['php_fastcgi_binary'].':'.$php_record['php_fastcgi_ini_dir'];
+			}
+			$json .= '"'.$php_version.'": "'.$php_record['name'].'",';
+		}
 	}
-	
-	if($type == 'get_use_loadindicator'){
-		$json = '{"useloadindicator":"';
-		$use_loadindicator = 'y';
-		$server_config_array = $app->getconf->get_global_config();
-		if($server_config_array['misc']['use_loadindicator'] != 'y') $use_loadindicator = 'n';
-		$json .= $use_loadindicator;
-		unset($server_config_array);
-		$json .= '"}';
+	unset($php_records);
+	if(substr($json, -1) == ',') $json = substr($json, 0, -1);
+	$json .= '}';
+}
+
+if($type == 'getphptype'){
+	$json = '{"phptype":"';
+	$sql = "SELECT php FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$php = $app->db->queryOneRecord($sql);
+	$json .= $php['php'];
+	unset($php);
+	$json .= '"}';
+}
+
+if($type == 'getredirecttype'){
+	$json = '{"redirecttype":"';
+	$sql = "SELECT redirect_type FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$redirect = $app->db->queryOneRecord($sql);
+	$json .= $redirect['redirect_type'];
+	unset($redirect);
+	$json .= '"}';
+}
+
+if($type == 'get_ipv4'){
+	$result = array();
+
+	// ipv4
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv4');
+
+	$json = $app->functions->json_encode($result);
+}
+
+if($type == 'get_ipv6'){
+	$result = array();
+
+	// ipv6
+	//$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")");
+	$result[] = $app->functions->suggest_ips('IPv6');
+
+	$json = $app->functions->json_encode($result);
+}
+
+if($type == 'getdatabaseusers') {
+	$json = '{}';
+
+	$sql = "SELECT sys_groupid FROM web_domain WHERE domain_id = $web_id AND ".$app->tform->getAuthSQL('r');
+	$group = $app->db->queryOneRecord($sql);
+	if($group) {
+		$sql = "SELECT database_user_id, database_user FROM web_database_user WHERE sys_groupid = '" . $group['sys_groupid'] . "'";
+		$records = $app->db->queryAllRecords($sql);
+
+		$tmp_array = array();
+		foreach($records as $record) {
+			$tmp_array[$record['database_user_id']] = $record['database_user'];
+		}
+		$json = $app->functions->json_encode($tmp_array);
+		unset($records, $group, $tmp_array);
 	}
+}
+
+if($type == 'get_use_combobox'){
+	$json = '{"usecombobox":"';
+	$use_combobox = 'y';
+	$server_config_array = $app->getconf->get_global_config();
+	if($server_config_array['misc']['use_combobox'] != 'y') $use_combobox = 'n';
+	$json .= $use_combobox;
+	unset($server_config_array);
+	$json .= '"}';
+}
+
+if($type == 'get_use_loadindicator'){
+	$json = '{"useloadindicator":"';
+	$use_loadindicator = 'y';
+	$server_config_array = $app->getconf->get_global_config();
+	if($server_config_array['misc']['use_loadindicator'] != 'y') $use_loadindicator = 'n';
+	$json .= $use_loadindicator;
+	unset($server_config_array);
+	$json .= '"}';
+}
 
 //}
 
 header('Content-type: application/json');
 echo $json;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_availablepackages_list.php b/interface/web/sites/aps_availablepackages_list.php
index 0966df9a66ff76a294789da3bc81be2bb1d2736c..d883754ce58edac61502ca44d19c596bbc13395f 100644
--- a/interface/web/sites/aps_availablepackages_list.php
+++ b/interface/web/sites/aps_availablepackages_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.base.php'); // for constants
 $app->load('aps_base');
 
@@ -38,7 +38,7 @@ $list_def_file = "list/aps_availablepackages.list.php";
 
 // Check the module permissions
 $app->auth->check_module_permissions('sites');
-        
+
 // Load needed classes
 $app->uses('tpl,listform_actions');
 
@@ -53,4 +53,4 @@ $app->tpl->setVar("package_count", $pkg_count['COUNT(*)']);
 
 // Start the form rendering and action handling
 $app->listform_actions->onLoad();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_cron_apscrawler_if.php b/interface/web/sites/aps_cron_apscrawler_if.php
index caa9b02d75189eac40e74429894cd19f04ebebd7..fca04f205784e9b0bd8f1fc493d2bcc2e0904870 100644
--- a/interface/web/sites/aps_cron_apscrawler_if.php
+++ b/interface/web/sites/aps_cron_apscrawler_if.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //require_once('classes/class.crawler.php');
 $app->load('aps_crawler');
@@ -60,4 +60,4 @@ echo '<div id="OKMsg"><p>'.$app->lng('packagelist_update_finished_txt').'</p></d
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_do_operation.php b/interface/web/sites/aps_do_operation.php
index ada193c759cd5e7193ab4813999d93b9cd5fa20b..b4d949316623077aed39de67d28d3fe711e47587 100644
--- a/interface/web/sites/aps_do_operation.php
+++ b/interface/web/sites/aps_do_operation.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 $app->load('aps_guicontroller');
 
 // Check the module permissions
@@ -43,70 +43,70 @@ if(!isset($_GET['action'])) die('No action');
 // List of operations which can be performed
 if($_GET['action'] == 'change_status')
 {
-    // Only admins can perform this operation
-    if($_SESSION['s']['user']['typ'] != 'admin') die('For admin use only.');
-    
-    // Make sure a valid package ID is given
-    if(!$gui->isValidPackageID($_GET['id'], true)) die($app->lng('Invalid ID'));
-    
-    // Change the existing status to the opposite
-    $get_status = $app->db->queryOneRecord("SELECT package_status FROM aps_packages WHERE id = '".$app->functions->intval($_GET['id'])."';");
-    if($get_status['package_status'] == strval(PACKAGE_LOCKED))
-    {
-        $app->db->query("UPDATE aps_packages SET package_status = ".PACKAGE_ENABLED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
-        echo '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>';
-    }
-    else
-    {
-        $app->db->query("UPDATE aps_packages SET Package_status = ".PACKAGE_LOCKED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
-        echo '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>';
-    }
+	// Only admins can perform this operation
+	if($_SESSION['s']['user']['typ'] != 'admin') die('For admin use only.');
+
+	// Make sure a valid package ID is given
+	if(!$gui->isValidPackageID($_GET['id'], true)) die($app->lng('Invalid ID'));
+
+	// Change the existing status to the opposite
+	$get_status = $app->db->queryOneRecord("SELECT package_status FROM aps_packages WHERE id = '".$app->functions->intval($_GET['id'])."';");
+	if($get_status['package_status'] == strval(PACKAGE_LOCKED))
+	{
+		$app->db->query("UPDATE aps_packages SET package_status = ".PACKAGE_ENABLED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
+		echo '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>';
+	}
+	else
+	{
+		$app->db->query("UPDATE aps_packages SET Package_status = ".PACKAGE_LOCKED." WHERE id = '".$app->functions->intval($_GET['id'])."';");
+		echo '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>';
+	}
 }
 else if($_GET['action'] == 'delete_instance')
-{
-    // Make sure a valid package ID is given (also corresponding to the calling user)
-    $client_id = 0;
-    $is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
-    if(!$is_admin)
-    {
-        $cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
-        $client_id = $cid['client_id'];
-    }
-	
-    // Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
-    if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
-    
-    // Only delete the instance if the status is "installed" or "flawed"
-    $check = $app->db->queryOneRecord("SELECT id FROM aps_instances 
-        WHERE id = ".$app->db->quote($_GET['id'])." AND 
+	{
+		// Make sure a valid package ID is given (also corresponding to the calling user)
+		$client_id = 0;
+		$is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
+		if(!$is_admin)
+		{
+			$cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
+			$client_id = $cid['client_id'];
+		}
+
+		// Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
+		if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
+
+		// Only delete the instance if the status is "installed" or "flawed"
+		$check = $app->db->queryOneRecord("SELECT id FROM aps_instances
+        WHERE id = ".$app->db->quote($_GET['id'])." AND
         (instance_status = ".INSTANCE_SUCCESS." OR instance_status = ".INSTANCE_ERROR.");");
-    if($check['id'] > 0) $gui->deleteInstance($_GET['id']);
-    //echo $app->lng('Installation_remove');
-	@header('Location:aps_installedpackages_list.php');
-}
+		if($check['id'] > 0) $gui->deleteInstance($_GET['id']);
+		//echo $app->lng('Installation_remove');
+		@header('Location:aps_installedpackages_list.php');
+	}
 else if($_GET['action'] == 'reinstall_instance')
-{
-    // Make sure a valid package ID is given (also corresponding to the calling user)
-    $client_id = 0;
-    $is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
-    if(!$is_admin)
-    {
-        $cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
-        $client_id = $cid['client_id'];
-    }
-    // Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
-    if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
-    
-    // We've an InstanceID, so make sure the package is not enabled and InstanceStatus is still "installed"
-    $check = $app->db->queryOneRecord("SELECT aps_instances.id FROM aps_instances, aps_packages 
-        WHERE aps_instances.package_id = aps_packages.id 
-        AND aps_instances.instance_status = ".INSTANCE_SUCCESS." 
-        AND aps_packages.package_status = ".PACKAGE_ENABLED." 
+	{
+		// Make sure a valid package ID is given (also corresponding to the calling user)
+		$client_id = 0;
+		$is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
+		if(!$is_admin)
+		{
+			$cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
+			$client_id = $cid['client_id'];
+		}
+		// Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
+		if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
+
+		// We've an InstanceID, so make sure the package is not enabled and InstanceStatus is still "installed"
+		$check = $app->db->queryOneRecord("SELECT aps_instances.id FROM aps_instances, aps_packages
+        WHERE aps_instances.package_id = aps_packages.id
+        AND aps_instances.instance_status = ".INSTANCE_SUCCESS."
+        AND aps_packages.package_status = ".PACKAGE_ENABLED."
         AND aps_instances.id = ".$app->db->quote($_GET['id']).";");
-    if(!$check) die('Check failed'); // normally this might not happen at all, so just die
-    
-    $gui->reinstallInstance($_GET['id']);
-    //echo $app->lng('Installation_task');
-	@header('Location:aps_installedpackages_list.php');
-}
+		if(!$check) die('Check failed'); // normally this might not happen at all, so just die
+
+		$gui->reinstallInstance($_GET['id']);
+		//echo $app->lng('Installation_task');
+		@header('Location:aps_installedpackages_list.php');
+	}
 ?>
diff --git a/interface/web/sites/aps_install_package.php b/interface/web/sites/aps_install_package.php
index ccad334993d2770cc0998468e7943372f0373087..8ba04efd2103d47358df6188f0c0ccdd1e5c6287 100644
--- a/interface/web/sites/aps_install_package.php
+++ b/interface/web/sites/aps_install_package.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.guicontroller.php');
 $app->load('aps_guicontroller');
 
@@ -43,12 +43,12 @@ $app->tpl->setInclude('content_tpl', 'templates/aps_install_package.htm');
 
 // Load the language file
 $lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng';
-require_once($lngfile);
+require_once $lngfile;
 $app->tpl->setVar($wb);
 $app->load_language_file('web/sites/'.$lngfile);
 
 // we will check only users, not admins
-if($_SESSION["s"]["user"]["typ"] == 'user') {		
+if($_SESSION["s"]["user"]["typ"] == 'user') {
 	$app->tform->formDef['db_table_idx'] = 'client_id';
 	$app->tform->formDef['db_table'] = 'client';
 	if(!$app->tform->checkClientLimit('limit_aps')) {
@@ -56,7 +56,7 @@ if($_SESSION["s"]["user"]["typ"] == 'user') {
 	}
 	if(!$app->tform->checkResellerLimit('limit_aps')) {
 		$app->error('Reseller: '.$wb["limit_aps_txt"]);
-	}		
+	}
 }
 
 
@@ -68,13 +68,13 @@ $pkg_id = (isset($_GET['id'])) ? $app->db->quote($_GET['id']) : '';
 // Note: It's intended that here is no strict ID check (see below)
 if(isset($pkg_id))
 {
-    $newest_pkg_id = $gui->getNewestPackageID($pkg_id);
-    if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
+	$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
+	if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
 }
 
 // Make sure an integer ID is given
 if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag))
-    $app->error($app->lng('Invalid ID'));
+	$app->error($app->lng('Invalid ID'));
 
 // Get package details
 $details = $gui->getPackageDetails($pkg_id);
@@ -85,40 +85,40 @@ if(isset($settings['error'])) $app->error($settings['error']);
 // Get domain list
 $domains = array();
 $domain_for_user = '';
-if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' 
+if(!$adminflag) $domain_for_user = "AND (sys_userid = '".$app->db->quote($_SESSION['s']['user']['userid'])."'
     OR sys_groupid = '".$app->db->quote($_SESSION['s']['user']['userid'])."' )";
 $domains_assoc = $app->db->queryAllRecords("SELECT domain FROM web_domain WHERE document_root != '' AND (type = 'vhost' OR type = 'vhostsubdomain') AND active = 'y' ".$domain_for_user." ORDER BY domain;");
 if(!empty($domains_assoc)) foreach($domains_assoc as $domain) $domains[] = $domain['domain'];
 
-// If data has been submitted, validate it
-$result['input'] = array();
+	// If data has been submitted, validate it
+	$result['input'] = array();
 if(count($_POST) > 1)
 {
-    $result = $gui->validateInstallerInput($_POST, $details, $domains, $settings);
-    if(empty($result['error']))
-    {
-        $gui->createPackageInstance($result['input'], $pkg_id);
-        @header('Location:aps_installedpackages_list.php');
-    }
-    else
-    {
-        $app->tpl->setVar('error', implode('<br />', $result['error']));
-        
-        // Set memorized values (license, db password, install location)
-        if(!empty($result['input']))
-            foreach($result['input'] as $key => $value) $app->tpl->setVar('inp_'.$key, $value);
-    }
+	$result = $gui->validateInstallerInput($_POST, $details, $domains, $settings);
+	if(empty($result['error']))
+	{
+		$gui->createPackageInstance($result['input'], $pkg_id);
+		@header('Location:aps_installedpackages_list.php');
+	}
+	else
+	{
+		$app->tpl->setVar('error', implode('<br />', $result['error']));
+
+		// Set memorized values (license, db password, install location)
+		if(!empty($result['input']))
+			foreach($result['input'] as $key => $value) $app->tpl->setVar('inp_'.$key, $value);
+	}
 }
 else $app->tpl->setVar('inp_main_database_password', ucfirst(substr(md5(crypt(rand(0, 10))), 0, 16)));
 
 // Pass the package details to the template
 foreach($details as $key => $value)
 {
-    if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
-    else if($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
+	if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
+	else if($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
 }
 
-// Parse the template as far as possible, then do the rest manually 
+// Parse the template as far as possible, then do the rest manually
 $app->tpl_defaults();
 $parsed_tpl = $app->tpl->grab();
 
@@ -129,20 +129,20 @@ $parsed_tpl = $app->tpl->grab();
 $domains_tpl = '';
 if(!empty($domains))
 {
-    $set = array();
-    $set[] = '<select name="main_domain" id="main_domain" class="selectInput">';
-    foreach($domains as $domain)
-    {
-        $selected = '';
-        if((count($_POST) > 1)
-        && (isset($result['input']['main_domain']))
-        && ($result['input']['main_domain'] == $domain))
-            $selected = ' selected ';
-        $set[] = '<option value="'.$domain.'" '.$selected.'>'.$domain.'</option>';
-    }
-    $set[] = '</select>';
-    
-    $domains_tpl = implode("\n", $set);
+	$set = array();
+	$set[] = '<select name="main_domain" id="main_domain" class="selectInput">';
+	foreach($domains as $domain)
+	{
+		$selected = '';
+		if((count($_POST) > 1)
+			&& (isset($result['input']['main_domain']))
+			&& ($result['input']['main_domain'] == $domain))
+			$selected = ' selected ';
+		$set[] = '<option value="'.$domain.'" '.$selected.'>'.$domain.'</option>';
+	}
+	$set[] = '</select>';
+
+	$domains_tpl = implode("\n", $set);
 }
 $parsed_tpl = str_replace('DOMAIN_LIST_SPACE', $domains_tpl, $parsed_tpl);
 
@@ -150,62 +150,62 @@ $parsed_tpl = str_replace('DOMAIN_LIST_SPACE', $domains_tpl, $parsed_tpl);
 $settings_tpl = '';
 if(!empty($settings))
 {
-    $set = array();
-    $set[] = '<legend>'.$app->lng('package_settings_txt').'</legend>';
-    foreach($settings as $setting)
-    {
-        $set[] = '<div class="ctrlHolder">';
-        $set[] = '<label for="'.$setting['SettingID'].'">'.$setting['SettingName'].'</label>';
-        if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password')
-        {
-            $input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password';
-              
-            $input_value = '';
-            if((count($_POST) > 1) 
-            && (isset($result['input'][$setting['SettingID']]))) 
-                $input_value = $result['input'][$setting['SettingID']];
-            else $input_value = @$setting['SettingDefaultValue'];
-            
-            $set[] = '<input type="'.$input_type.'" class="textInput" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" />
+	$set = array();
+	$set[] = '<legend>'.$app->lng('package_settings_txt').'</legend>';
+	foreach($settings as $setting)
+	{
+		$set[] = '<div class="ctrlHolder">';
+		$set[] = '<label for="'.$setting['SettingID'].'">'.$setting['SettingName'].'</label>';
+		if($setting['SettingInputType'] == 'string' || $setting['SettingInputType'] == 'password')
+		{
+			$input_type = ($setting['SettingInputType'] == 'string') ? 'text' : 'password';
+
+			$input_value = '';
+			if((count($_POST) > 1)
+				&& (isset($result['input'][$setting['SettingID']])))
+				$input_value = $result['input'][$setting['SettingID']];
+			else $input_value = @$setting['SettingDefaultValue'];
+
+			$set[] = '<input type="'.$input_type.'" class="textInput" name="'.$setting['SettingID'].'" maxlength="'.$setting['SettingMaxLength'].'" id="'.$setting['SettingID'].'" value="'.$input_value.'" />
                 <p class="formHint">'.$setting['SettingDescription'].'</p>';
-        }
-        else if($setting['SettingInputType'] == 'checkbox')
-        {
-            $checked = '';
-            if((count($_POST) > 1) 
-            && (isset($result['input'][$setting['SettingID']]) 
-            && ($result['input'][$setting['SettingID']] == 'true'))) 
-                $checked = 'checked ';
-            else if($setting['SettingDefaultValue'] == '1') $checked = 'checked ';
-            
-            $set[] = '<input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/>
+		}
+		else if($setting['SettingInputType'] == 'checkbox')
+			{
+				$checked = '';
+				if((count($_POST) > 1)
+					&& (isset($result['input'][$setting['SettingID']])
+						&& ($result['input'][$setting['SettingID']] == 'true')))
+					$checked = 'checked ';
+				else if($setting['SettingDefaultValue'] == '1') $checked = 'checked ';
+
+					$set[] = '<input type="checkbox" id="'.$setting['SettingID'].'" name="'.$setting['SettingID'].'" '.$checked.'/>
                 <p class="formHint">'.$setting['SettingDescription'].'</p>';
-        }
-        else if($setting['SettingInputType'] == 'select')
-        {
-            $set[] =  '<select size="1" class="selectInput" name="'.$setting['SettingID'].'">';
-            foreach($setting['SettingChoices'] as $choice)
-            {
-                $selected = '';
-                if((count($_POST) > 1)
-                && (isset($result['input'][$setting['SettingID']])))
-                { 
-                    if($result['input'][$setting['SettingID']] == $choice['EnumID'])
-                        $selected = 'selected ';
-                }
-                else if($setting['SettingDefaultValue'] == $choice['EnumID']) $selected = 'selected ';
-                
-                $set[] = '<option value="'.$choice['EnumID'].'" '.$selected.'>'.$choice['EnumName'].'</option>';
-            }
-            $set[] = '</select>
+			}
+		else if($setting['SettingInputType'] == 'select')
+			{
+				$set[] =  '<select size="1" class="selectInput" name="'.$setting['SettingID'].'">';
+				foreach($setting['SettingChoices'] as $choice)
+				{
+					$selected = '';
+					if((count($_POST) > 1)
+						&& (isset($result['input'][$setting['SettingID']])))
+					{
+						if($result['input'][$setting['SettingID']] == $choice['EnumID'])
+							$selected = 'selected ';
+					}
+					else if($setting['SettingDefaultValue'] == $choice['EnumID']) $selected = 'selected ';
+
+						$set[] = '<option value="'.$choice['EnumID'].'" '.$selected.'>'.$choice['EnumName'].'</option>';
+				}
+				$set[] = '</select>
                 <p class="formHint">'.$setting['SettingDescription'].'</p>';
-        }
-        
-        $set[] = '</div>';
-    }
-    $settings_tpl = implode("\n", $set);
+			}
+
+		$set[] = '</div>';
+	}
+	$settings_tpl = implode("\n", $set);
 }
 $parsed_tpl = str_replace('PKG_SETTINGS_SPACE', $settings_tpl, $parsed_tpl);
 
 echo $parsed_tpl;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_installedpackages_list.php b/interface/web/sites/aps_installedpackages_list.php
index e3c318f93e84757a7697b1ce0c37d1545aa0dcbe..418cc43c1120103037421cb3c167f32f9d00d4ec 100644
--- a/interface/web/sites/aps_installedpackages_list.php
+++ b/interface/web/sites/aps_installedpackages_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.base.php'); // for constants
 $app->load('aps_base');
 
@@ -38,21 +38,21 @@ $list_def_file = "list/aps_installedpackages.list.php";
 
 // Check the module permissions
 $app->auth->check_module_permissions('sites');
-        
+
 // Load needed classes
 $app->uses('tpl,tform,listform,listform_actions');
 
 // Show further information only to admins or resellers
 if($_SESSION['s']['user']['typ'] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid']))
-    $app->tpl->setVar('is_noclient', 1);
+	$app->tpl->setVar('is_noclient', 1);
 
 // Show each user the own packages (if not admin)
 $client_ext = '';
 $is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
 if(!$is_admin)
 {
-    $cid = $app->db->queryOneRecord('SELECT client_id FROM client WHERE username = "'.$app->db->quote($_SESSION['s']['user']['username']).'";');
-    //$client_ext = ' AND aps_instances.customer_id = '.$cid['client_id'];
+	$cid = $app->db->queryOneRecord('SELECT client_id FROM client WHERE username = "'.$app->db->quote($_SESSION['s']['user']['username']).'";');
+	//$client_ext = ' AND aps_instances.customer_id = '.$cid['client_id'];
 	$client_ext = ' AND '.$app->tform->getAuthSQL('r', 'aps_instances');
 }
 $app->listform_actions->SQLExtWhere = 'aps_instances.package_id = aps_packages.id'.$client_ext;
@@ -62,79 +62,79 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY package_name';
 // queries over multiple tables so we construct them ourselves
 $_SESSION['s']['form']['return_to'] = '';
 
-// Load the list template		
+// Load the list template
 $app->listform->loadListDef($list_def_file);
-if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) 
+if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm'))
 {
-$app->uses('listform_tpl_generator');
-$app->listform_tpl_generator->buildHTML($app->listform->listDef);
+	$app->uses('listform_tpl_generator');
+	$app->listform_tpl_generator->buildHTML($app->listform->listDef);
 }
 $app->tpl->newTemplate("listpage.tpl.htm");
 $app->tpl->setInclude('content_tpl', 'templates/'.$app->listform->listDef["name"].'_list.htm');
 
 // Build the WHERE query for search
 $sql_where = '';
-if($app->listform_actions->SQLExtWhere != '') 
-  $sql_where .= ' '.$app->listform_actions->SQLExtWhere.' and';
+if($app->listform_actions->SQLExtWhere != '')
+	$sql_where .= ' '.$app->listform_actions->SQLExtWhere.' and';
 $sql_where = $app->listform->getSearchSQL($sql_where);
 $app->tpl->setVar($app->listform->searchValues);
-		
+
 // Paging
 $limit_sql = $app->listform->getPagingSQL($sql_where);
 $app->tpl->setVar('paging', $app->listform->pagingHTML);
 
 if(!$is_admin) {
-// Our query over multiple tables
-$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id, 
-                 aps_instances.customer_id AS customer_id, client.username AS customer_name, 
-                 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name, 
-                 aps_packages.version AS package_version, aps_packages.release AS package_release, 
-                 aps_packages.package_status AS package_status, 
-              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id), 
-                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id)) 
-                  AS install_location  
-          FROM aps_instances, aps_packages, client 
+	// Our query over multiple tables
+	$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id,
+                 aps_instances.customer_id AS customer_id, client.username AS customer_name,
+                 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name,
+                 aps_packages.version AS package_version, aps_packages.release AS package_release,
+                 aps_packages.package_status AS package_status,
+              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id),
+                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id))
+                  AS install_location
+          FROM aps_instances, aps_packages, client
           WHERE client.client_id = aps_instances.customer_id AND ".$sql_where." ".$app->listform_actions->SQLOrderBy." ".$limit_sql;
 } else {
-$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id,  
+	$query = "SELECT aps_instances.id AS id, aps_instances.package_id AS package_id,
                  aps_instances.customer_id AS customer_id, sys_group.name AS customer_name,
-				 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name, 
-                 aps_packages.version AS package_version, aps_packages.release AS package_release, 
-                 aps_packages.package_status AS package_status, 
-              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id), 
-                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id)) 
-                  AS install_location  
-          FROM aps_instances, aps_packages, sys_group 
+				 aps_instances.instance_status AS instance_status, aps_packages.name AS package_name,
+                 aps_packages.version AS package_version, aps_packages.release AS package_release,
+                 aps_packages.package_status AS package_status,
+              CONCAT((SELECT value FROM aps_instances_settings WHERE name='main_domain' AND instance_id = aps_instances.id),
+                 '/', (SELECT value FROM aps_instances_settings WHERE name='main_location' AND instance_id = aps_instances.id))
+                  AS install_location
+          FROM aps_instances, aps_packages, sys_group
           WHERE sys_group.client_id = aps_instances.customer_id AND ".$sql_where." ".$app->listform_actions->SQLOrderBy." ".$limit_sql;
 
-}	  
+}
 
 $records = $app->db->queryAllRecords($query);
 $app->listform_actions->DataRowColor = '#FFFFFF';
 
-// Re-form all result entries and add extra entries 
+// Re-form all result entries and add extra entries
 $records_new = '';
-if(is_array($records)) 
+if(is_array($records))
 {
-    $app->listform_actions->idx_key = $app->listform->listDef["table_idx"]; 
-    foreach($records as $rec)
-    {
-        // Set an abbreviated install location to beware the page layout
-        $ils = '';
-        if(strlen($rec['Install_location']) >= 38) $ils = substr($rec['Install_location'], 0,  35).'...';
-        else $ils = $rec['install_location'];
-        $rec['install_location_short'] = $ils; 
-        
-        // Also set a boolean-like variable for the reinstall button (vlibTemplate doesn't allow variable comparisons)
-        // For a reinstall, the package must be already installed successfully and (still be) enabled
-        if($rec['instance_status'] == INSTANCE_SUCCESS && $rec['package_status'] == PACKAGE_ENABLED) 
-            $rec['reinstall_possible'] = 'true';
-        // Of course an instance can only then be removed when it's not already tagged for removal
-        if($rec['instance_status'] != INSTANCE_REMOVE && $rec['instance_status'] != INSTANCE_INSTALL) 
-            $rec['delete_possible'] = 'true';
-        
-        $records_new[] = $app->listform_actions->prepareDataRow($rec);
-    }
+	$app->listform_actions->idx_key = $app->listform->listDef["table_idx"];
+	foreach($records as $rec)
+	{
+		// Set an abbreviated install location to beware the page layout
+		$ils = '';
+		if(strlen($rec['Install_location']) >= 38) $ils = substr($rec['Install_location'], 0,  35).'...';
+		else $ils = $rec['install_location'];
+		$rec['install_location_short'] = $ils;
+
+		// Also set a boolean-like variable for the reinstall button (vlibTemplate doesn't allow variable comparisons)
+		// For a reinstall, the package must be already installed successfully and (still be) enabled
+		if($rec['instance_status'] == INSTANCE_SUCCESS && $rec['package_status'] == PACKAGE_ENABLED)
+			$rec['reinstall_possible'] = 'true';
+		// Of course an instance can only then be removed when it's not already tagged for removal
+		if($rec['instance_status'] != INSTANCE_REMOVE && $rec['instance_status'] != INSTANCE_INSTALL)
+			$rec['delete_possible'] = 'true';
+
+		$records_new[] = $app->listform_actions->prepareDataRow($rec);
+	}
 }
 $app->tpl->setLoop('records', $records_new);
 
diff --git a/interface/web/sites/aps_packagedetails_show.php b/interface/web/sites/aps_packagedetails_show.php
index 94f5eaa0ae1b91d149afe40da0b92e830f1448cf..7f8ca6bd2b71341504216ff03edf5a941de89dda 100644
--- a/interface/web/sites/aps_packagedetails_show.php
+++ b/interface/web/sites/aps_packagedetails_show.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 //require_once('classes/class.guicontroller.php');
 $app->load('aps_guicontroller');
 
@@ -43,7 +43,7 @@ $app->tpl->setInclude('content_tpl', 'templates/aps_packagedetails_show.htm');
 
 // Load the language file
 $lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng';
-require_once($lngfile);
+require_once $lngfile;
 $app->tpl->setVar($wb);
 
 $gui = new ApsGUIController($app);
@@ -53,14 +53,14 @@ $pkg_id = (isset($_GET['id'])) ? $app->db->quote($_GET['id']) : '';
 // Note: It's intended that here is no strict ID check (see below)
 if(isset($pkg_id))
 {
-    $newest_pkg_id = $gui->getNewestPackageID($pkg_id);
-    if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
+	$newest_pkg_id = $gui->getNewestPackageID($pkg_id);
+	if($newest_pkg_id != 0) $pkg_id = $newest_pkg_id;
 }
 
 // Make sure an integer ID is given
 $adminflag = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
 if(!isset($pkg_id) || !$gui->isValidPackageID($pkg_id, $adminflag))
-    $app->error($app->lng('Invalid ID'));
+	$app->error($app->lng('Invalid ID'));
 
 // Get package details
 $details = $gui->getPackageDetails($pkg_id);
@@ -70,31 +70,31 @@ if(isset($details['error'])) $app->error($details['error']);
 $next_tab = 'details';
 if(isset($_POST['next_tab']) || isset($_GET['next_tab']))
 {
-    $tab = (isset($_POST['next_tab']) ? $_POST['next_tab'] : $_GET['next_tab']);
-    switch($tab)
-    {
-        case 'details': $next_tab = 'details'; break;
-        case 'settings': $next_tab = 'settings'; break;
-        case 'changelog': $next_tab = 'changelog'; break;
-        case 'screenshots': $next_tab = 'screenshots'; break;
-        default: $next_tab = 'details';
-    }
+	$tab = (isset($_POST['next_tab']) ? $_POST['next_tab'] : $_GET['next_tab']);
+	switch($tab)
+	{
+	case 'details': $next_tab = 'details'; break;
+	case 'settings': $next_tab = 'settings'; break;
+	case 'changelog': $next_tab = 'changelog'; break;
+	case 'screenshots': $next_tab = 'screenshots'; break;
+	default: $next_tab = 'details';
+	}
 }
 $app->tpl->setVar('next_tab', $next_tab);
 
 // Parse the package details to the template
 foreach($details as $key => $value)
 {
-    if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
-    else // Special cases
-    {
-        if($key == 'Changelog') $app->tpl->setLoop('pkg_changelog', $details['Changelog']);
-        elseif($key == 'Screenshots') $app->tpl->setLoop('pkg_screenshots', $details['Screenshots']);
-        elseif($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
-    }
+	if(!is_array($value)) $app->tpl->setVar('pkg_'.str_replace(' ', '_', strtolower($key)), $value);
+	else // Special cases
+		{
+		if($key == 'Changelog') $app->tpl->setLoop('pkg_changelog', $details['Changelog']);
+		elseif($key == 'Screenshots') $app->tpl->setLoop('pkg_screenshots', $details['Screenshots']);
+		elseif($key == 'Requirements PHP settings') $app->tpl->setLoop('pkg_requirements_php_settings', $details['Requirements PHP settings']);
+	}
 }
 //print_r($details['Requirements PHP settings']);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/aps_update_packagelist.php b/interface/web/sites/aps_update_packagelist.php
index 10de873e64a645f38b3cb202896cae5decc64dc9..a1278d0ebe318fdb0b9ed5e836f62ad14ec79bd6 100644
--- a/interface/web/sites/aps_update_packagelist.php
+++ b/interface/web/sites/aps_update_packagelist.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -42,16 +42,16 @@ $error = '';
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_aps_update_packagelist.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/cron_del.php b/interface/web/sites/cron_del.php
index 484e5073c739e604fbfaa7cba7549cfa64b2a624..69864eaf07a314bf33545fbb66465b4474131047 100644
--- a/interface/web/sites/cron_del.php
+++ b/interface/web/sites/cron_del.php
@@ -40,8 +40,8 @@ $tform_def_file = "form/cron.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -53,12 +53,13 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php
index fea4a7be164f882f730140cf5bd514adb435fdb0..76733ff2bc2b16458e4ea5518b9f153abbdffc5a 100644
--- a/interface/web/sites/cron_edit.php
+++ b/interface/web/sites/cron_edit.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/cron.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -50,10 +50,10 @@ $app->uses('tpl,tform,tform_actions,validate_cron');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_cron')) {
@@ -63,35 +63,35 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_cron_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
-        if($this->id > 0) {
-            //* we are editing a existing record
-            $app->tpl->setVar("edit_disabled", 1);
-            $app->tpl->setVar("parent_domain_id_value", $this->dataRecord["parent_domain_id"]);
-        } else {
-            $app->tpl->setVar("edit_disabled", 0);
-        }
-		
+
+		if($this->id > 0) {
+			//* we are editing a existing record
+			$app->tpl->setVar("edit_disabled", 1);
+			$app->tpl->setVar("parent_domain_id_value", $this->dataRecord["parent_domain_id"]);
+		} else {
+			$app->tpl->setVar("edit_disabled", 0);
+		}
+
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		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_cron, limit_cron_type 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) {
-			// When the record is inserted
+				// When the record is inserted
 			} else {
 				// Check if the user may add another cron job.
 				if($client["limit_cron"] >= 0) {
@@ -102,21 +102,21 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
-        // Get the record of the parent domain
-        $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-        
-        // Set fixed values
-        $this->dataRecord["server_id"] = $parent_domain["server_id"];
-
-        //* get type of command
-        $command = $this->dataRecord["command"];
-        if(preg_match("'^http(s)?:\/\/'i", $command)) {
-            $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"]));
-            //* True when the site is assigned to a client
+
+		// Get the record of the parent domain
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
+		// Set fixed values
+		$this->dataRecord["server_id"] = $parent_domain["server_id"];
+
+		//* get type of command
+		$command = $this->dataRecord["command"];
+		if(preg_match("'^http(s)?:\/\/'i", $command)) {
+			$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"]));
+			//* 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';
@@ -127,84 +127,84 @@ class page_action extends tform_actions {
 				//* True when the site is assigned to the admin
 				$this->dataRecord["type"] = 'full';
 			}
-        }
-        
-        parent::onSubmit();
+		}
+
+		parent::onSubmit();
+	}
+
+	function onUpdateSave($sql) {
+		global $app;
+
+		$has_error = false;
+		//* last chance to stop this, so check frequency limit!
+		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_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+			if($client["limit_cron_frequency"] > 1) {
+				if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
+					$app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
+					$has_error = true;
+				}
+			}
+		}
+
+		if($has_error == true) {
+			parent::onError();
+			exit;
+		}
+		else parent::onUpdateSave($sql);
 	}
-	
-    function onUpdateSave($sql) {
-        global $app;
-        
-        $has_error = false;
-        //* last chance to stop this, so check frequency limit!
-        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_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-        
-            if($client["limit_cron_frequency"] > 1) {
-                if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
-                    $app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
-                    $has_error = true;
-                }
-            }
-        }
-        
-        if($has_error == true) {
-            parent::onError();
-            exit;
-        }
-        else parent::onUpdateSave($sql);
-    }
-    
-    function onInsertSave($sql) {
-        global $app;
-    
-        $has_error = false;
-        //* last chance to stop this, so check frequency limit!
-        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_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-        
-            if($client["limit_cron_frequency"] > 1) {
-                if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
-                    $app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
-                    $has_error = true;
-                }
-            }
-        }
-        
-        if($has_error == true) {
-            parent::onError();
-            exit;
-        } else {
+
+	function onInsertSave($sql) {
+		global $app;
+
+		$has_error = false;
+		//* last chance to stop this, so check frequency limit!
+		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_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+
+			if($client["limit_cron_frequency"] > 1) {
+				if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
+					$app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
+					$has_error = true;
+				}
+			}
+		}
+
+		if($has_error == true) {
+			parent::onError();
+			exit;
+		} else {
 			return parent::onInsertSave($sql);
 		}
-    }
-    
+	}
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
-        $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
-        $server_id = $web["server_id"];
-        
-        // The cron shall be owned by the same group then the website
-        $sys_groupid = $web['sys_groupid'];
-        
-        $sql = "UPDATE cron SET server_id = $server_id, sys_groupid = '$sys_groupid' WHERE id = ".$this->id;
-        $app->db->query($sql);
+
+		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
+		$server_id = $web["server_id"];
+
+		// The cron shall be owned by the same group then the website
+		$sys_groupid = $web['sys_groupid'];
+
+		$sql = "UPDATE cron SET server_id = $server_id, sys_groupid = '$sys_groupid' WHERE id = ".$this->id;
+		$app->db->query($sql);
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		
+
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/cron_list.php b/interface/web/sites/cron_list.php
index dcd9a547e8cc6a36a73d6dba849b4195c9178640..70fe68c907c4d843ce143567d6695d6953ef6732 100644
--- a/interface/web/sites/cron_list.php
+++ b/interface/web/sites/cron_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_del.php b/interface/web/sites/database_del.php
index d3c00cd1a34023f82ee7ccf6a582056dc005377f..ba079e220bfcca937a088a92ac505ffe04664070 100644
--- a/interface/web/sites/database_del.php
+++ b/interface/web/sites/database_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/database.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,14 +49,15 @@ $app->uses("tform_actions");
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app; $conf;
-		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);
+		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);
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 99e0bbdfec90e5b24e369adb72f61aec34bf39e9..cdabf7a2ad669c16dd69f7d2123160f45503c775 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/database.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -77,7 +77,7 @@ class page_action extends tform_actions {
 
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_dbserver]");
-			$app->tpl->setVar("server_id","<option value='$client[default_dbserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_dbserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -85,10 +85,10 @@ class page_action extends tform_actions {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.client_id, limit_web_domain, default_webserver, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
-			$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 		} else {
@@ -108,19 +108,19 @@ class page_action extends tform_actions {
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		//* Get the database name and database user prefix
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
-		
+
 		if ($this->dataRecord['database_name'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("database_name", $app->tools_sites->removePrefix($this->dataRecord['database_name'], $this->dataRecord['database_name_prefix'], $dbname_prefix));
 		}
-        
-        $app->tpl->setVar("database_name_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_name_prefix'], $dbname_prefix, $global_config['dbname_prefix']));
-		
+
+		$app->tpl->setVar("database_name_prefix", $app->tools_sites->getPrefix($this->dataRecord['database_name_prefix'], $dbname_prefix, $global_config['dbname_prefix']));
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -136,9 +136,9 @@ class page_action extends tform_actions {
 	function onSubmit() {
 		global $app, $conf;
 
-        $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-        
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
@@ -166,21 +166,21 @@ class page_action extends tform_actions {
 
 			}
 		} else {
-            // check if client of database parent domain is client of db user!
-            $web_group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'");
-            if($this->dataRecord['database_user_id']) {
-                $group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_user_id'])."'");
-                if($group['sys_groupid'] != $web_group['sys_groupid']) {
-                    $app->error($app->tform->wordbook['database_client_differs_txt']);
-                }
-            }
-            if($this->dataRecord['database_ro_user_id']) {
-                $group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_ro_user_id'])."'");
-                if($group['sys_groupid'] != $web_group['sys_groupid']) {
-                    $app->error($app->tform->wordbook['database_client_differs_txt']);
-                }
-            }
-        }
+			// check if client of database parent domain is client of db user!
+			$web_group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = '".$app->functions->intval($this->dataRecord['parent_domain_id'])."'");
+			if($this->dataRecord['database_user_id']) {
+				$group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_user_id'])."'");
+				if($group['sys_groupid'] != $web_group['sys_groupid']) {
+					$app->error($app->tform->wordbook['database_client_differs_txt']);
+				}
+			}
+			if($this->dataRecord['database_ro_user_id']) {
+				$group = $app->db->queryOneRecord("SELECT sys_groupid FROM web_database_user WHERE database_user_id = '".$app->functions->intval($this->dataRecord['database_ro_user_id'])."'");
+				if($group['sys_groupid'] != $web_group['sys_groupid']) {
+					$app->error($app->tform->wordbook['database_client_differs_txt']);
+				}
+			}
+		}
 
 
 		parent::onSubmit();
@@ -191,31 +191,31 @@ class page_action extends tform_actions {
 
 		//* Site shall not be empty
 		if($this->dataRecord['parent_domain_id'] == 0) $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty").'<br />';
-		
+
 		//* Get the database name and database user prefix
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
-		
+
 		//* Prevent that the database name and charset is changed
 		$old_record = $app->tform->getDataRecord($this->id);
-        $dbname_prefix = $app->tools_sites->getPrefix($old_record['database_name_prefix'], $dbname_prefix);
-        $this->dataRecord['database_name_prefix'] = $dbname_prefix;
-        
+		$dbname_prefix = $app->tools_sites->getPrefix($old_record['database_name_prefix'], $dbname_prefix);
+		$this->dataRecord['database_name_prefix'] = $dbname_prefix;
+
 		if($old_record["database_name"] != $dbname_prefix . $this->dataRecord["database_name"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_name_change_txt"].'<br />';
 		}
 		if($old_record["database_charset"] != $this->dataRecord["database_charset"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_charset_change_txt"].'<br />';
 		}
-		
-        if(!$this->dataRecord['database_user_id']) {
-            $app->tform->errorMessage .= $app->tform->wordbook["database_user_missing_txt"].'<br />';
-        }
-        
+
+		if(!$this->dataRecord['database_user_id']) {
+			$app->tform->errorMessage .= $app->tform->wordbook["database_user_missing_txt"].'<br />';
+		}
+
 		//* Database username and database name shall not be empty
 		if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />';
-		
+
 		//* Check if the server has been changed
 		// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
 		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -226,31 +226,31 @@ class page_action extends tform_actions {
 			}
 		}
 		unset($old_record);
-		
-		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}',$dbname_prefix . $this->dataRecord['database_name'],$app->tform->wordbook["database_name_error_len"]).'<br />';
-		
+
+		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}', $dbname_prefix . $this->dataRecord['database_name'], $app->tform->wordbook["database_name_error_len"]).'<br />';
+
 		//* Check database name and user against blacklist
-		$dbname_blacklist = array($conf['db_database'],'mysql');
-		if(in_array($dbname_prefix . $this->dataRecord['database_name'],$dbname_blacklist)) {
+		$dbname_blacklist = array($conf['db_database'], 'mysql');
+		if(in_array($dbname_prefix . $this->dataRecord['database_name'], $dbname_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database name not allowed.').'<br />';
 		}
-		
+
 		if ($app->tform->errorMessage == ''){
 			/* restrict the names if there is no error */
-            /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+			/* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 			$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
 		}
-		
+
 		//* Check for duplicates
 		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."' AND database_id != '".$this->id."'");
 		if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->lng('database_name_error_unique').'<br />';
-		
-        // get the web server ip (parent domain)
-        $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
-        if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
-            // we need remote access rights for this server, so get it's ip address
-            $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
-            if($server_config['ip_address']!='') {
+
+		// get the web server ip (parent domain)
+		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
+		if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
+			// we need remote access rights for this server, so get it's ip address
+			$server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
+			if($server_config['ip_address']!='') {
 				/*
                 if($this->dataRecord['remote_access'] != 'y') $this->dataRecord['remote_ips'] = '';
                 $this->dataRecord['remote_access'] = 'y';
@@ -258,7 +258,7 @@ class page_action extends tform_actions {
                     $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
                 }
 				*/
-				
+
 				if($this->dataRecord['remote_access'] != 'y'){
 					$this->dataRecord['remote_ips'] = $server_config['ip_address'];
 					$this->dataRecord['remote_access'] = 'y';
@@ -267,25 +267,25 @@ class page_action extends tform_actions {
 						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);
+						$tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
+						$tmp = array_unique($tmp);
+						$this->dataRecord['remote_ips'] = implode(',', $tmp);
+						unset($tmp);
 					}
 				}
-            }
-        }
-        
-        
+			}
+		}
+
+
 		parent::onBeforeUpdate();
 	}
 
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
-		
+
 		//* Site shell not be empty
 		if($this->dataRecord['parent_domain_id'] == 0) $app->tform->errorMessage .= $app->tform->lng("database_site_error_empty").'<br />';
-		
+
 		//* Database username and database name shall not be empty
 		if($this->dataRecord['database_name'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_name_error_empty"].'<br />';
 
@@ -293,32 +293,32 @@ class page_action extends tform_actions {
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbname_prefix = $app->tools_sites->replacePrefix($global_config['dbname_prefix'], $this->dataRecord);
-        $this->dataRecord['database_name_prefix'] = $dbname_prefix;
-		
-		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}',$dbname_prefix . $this->dataRecord['database_name'],$app->tform->wordbook["database_name_error_len"]).'<br />';
-		
+		$this->dataRecord['database_name_prefix'] = $dbname_prefix;
+
+		if(strlen($dbname_prefix . $this->dataRecord['database_name']) > 64) $app->tform->errorMessage .= str_replace('{db}', $dbname_prefix . $this->dataRecord['database_name'], $app->tform->wordbook["database_name_error_len"]).'<br />';
+
 		//* Check database name and user against blacklist
-		$dbname_blacklist = array($conf['db_database'],'mysql');
-		if(in_array($dbname_prefix . $this->dataRecord['database_name'],$dbname_blacklist)) {
+		$dbname_blacklist = array($conf['db_database'], 'mysql');
+		if(in_array($dbname_prefix . $this->dataRecord['database_name'], $dbname_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database name not allowed.').'<br />';
 		}
-		
+
 		/* restrict the names */
-        /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+		/* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 		if ($app->tform->errorMessage == ''){
 			$this->dataRecord['database_name'] = substr($dbname_prefix . $this->dataRecord['database_name'], 0, 64);
 		}
-		
+
 		//* Check for duplicates
 		$tmp = $app->db->queryOneRecord("SELECT count(database_id) as dbnum FROM web_database WHERE database_name = '".$this->dataRecord['database_name']."' AND server_id = '".$this->dataRecord["server_id"]."'");
 		if($tmp['dbnum'] > 0) $app->tform->errorMessage .= $app->tform->lng('database_name_error_unique').'<br />';
 
-        // get the web server ip (parent domain)
-        $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
-        if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
-            // we need remote access rights for this server, so get it's ip address
-            $server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
-            if($server_config['ip_address']!='') {
+		// get the web server ip (parent domain)
+		$tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = '".$this->dataRecord['parent_domain_id']."'");
+		if($tmp['server_id'] && $tmp['server_id'] != $this->dataRecord['server_id']) {
+			// we need remote access rights for this server, so get it's ip address
+			$server_config = $app->getconf->get_server_config($tmp['server_id'], 'server');
+			if($server_config['ip_address']!='') {
 				/*
                 if($this->dataRecord['remote_access'] != 'y') $this->dataRecord['remote_ips'] = '';
                 $this->dataRecord['remote_access'] = 'y';
@@ -326,7 +326,7 @@ class page_action extends tform_actions {
                     $this->dataRecord['remote_ips'] .= ($this->dataRecord['remote_ips'] != '' ? ',' : '') . $server_config['ip_address'];
                 }
 				*/
-				
+
 				if($this->dataRecord['remote_access'] != 'y'){
 					$this->dataRecord['remote_ips'] = $server_config['ip_address'];
 					$this->dataRecord['remote_access'] = 'y';
@@ -335,55 +335,55 @@ class page_action extends tform_actions {
 						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);
+						$tmp = preg_split('/\s*,\s*/', $this->dataRecord['remote_ips']);
+						$tmp = array_unique($tmp);
+						$this->dataRecord['remote_ips'] = implode(',', $tmp);
+						unset($tmp);
 					}
 				}
-            }
-        }
-        
+			}
+		}
+
 		parent::onBeforeInsert();
 	}
 
-    function onInsertSave($sql) {
-        global $app, $conf;
-        
-        $app->uses('sites_database_plugin');
-        
-        //$app->sites_database_plugin->processDatabaseInsert($this);
-        
-        $app->db->query($sql);
-        if($app->db->errorMessage != '') die($app->db->errorMessage);
-        $new_id = $app->db->insertID();
-        
-        return $new_id;
-    }
-
-    function onUpdateSave($sql) {
-        global $app;
-        if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(),$this->id)) {
-            
-            $app->uses('sites_database_plugin');
-            //$app->sites_database_plugin->processDatabaseUpdate($this);
-
-            $app->db->query($sql);
-            if($app->db->errorMessage != '') die($app->db->errorMessage);
-        }
-    }
-    
+	function onInsertSave($sql) {
+		global $app, $conf;
+
+		$app->uses('sites_database_plugin');
+
+		//$app->sites_database_plugin->processDatabaseInsert($this);
+
+		$app->db->query($sql);
+		if($app->db->errorMessage != '') die($app->db->errorMessage);
+		$new_id = $app->db->insertID();
+
+		return $new_id;
+	}
+
+	function onUpdateSave($sql) {
+		global $app;
+		if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(), $this->id)) {
+
+			$app->uses('sites_database_plugin');
+			//$app->sites_database_plugin->processDatabaseUpdate($this);
+
+			$app->db->query($sql);
+			if($app->db->errorMessage != '') die($app->db->errorMessage);
+		}
+	}
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		if($this->dataRecord["parent_domain_id"] > 0) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
-		
+
 			//* The Database user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
 			$backup_interval = $web['backup_interval'];
 			$backup_copies = $web['backup_copies'];
-		
+
 			$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
 			$app->db->query($sql);
 		}
@@ -394,12 +394,12 @@ class page_action extends tform_actions {
 
 		if($this->dataRecord["parent_domain_id"] > 0) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
-		
+
 			//* The Database user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
 			$backup_interval = $web['backup_interval'];
 			$backup_copies = $web['backup_copies'];
-		
+
 			$sql = "UPDATE web_database SET sys_groupid = '$sys_groupid', backup_interval = '$backup_interval', backup_copies = '$backup_copies' WHERE database_id = ".$this->id;
 			$app->db->query($sql);
 		}
@@ -411,4 +411,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_list.php b/interface/web/sites/database_list.php
index 42c20058db53053f5f3ade2509f24866bafa43d7..dd0241fd3635ebd9917187d8dd40083cef5a314e 100644
--- a/interface/web/sites/database_list.php
+++ b/interface/web/sites/database_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,22 +48,22 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('sites');
-		
+
 		if($global_config['dblist_phpmyadmin_link'] == 'y') {
-			$app->tpl->setVar('dblist_phpmyadmin_link',1);
+			$app->tpl->setVar('dblist_phpmyadmin_link', 1);
 		} else {
-			$app->tpl->setVar('dblist_phpmyadmin_link',0);
+			$app->tpl->setVar('dblist_phpmyadmin_link', 0);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -71,4 +71,4 @@ $list->SQLOrderBy = 'ORDER BY web_database.database_name';
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_phpmyadmin.php b/interface/web/sites/database_phpmyadmin.php
index e77c5df83ca914d4bf2f873c9da5430146f449c6..5e640dfea438950ca2d93cfb279bcd2bcd981a4d 100644
--- a/interface/web/sites/database_phpmyadmin.php
+++ b/interface/web/sites/database_phpmyadmin.php
@@ -28,8 +28,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -38,7 +38,7 @@ $app->auth->check_module_permissions('sites');
  *  get the id of the database (must be int!)
  */
 if (!isset($_GET['id'])){
-    die ("No DB selected!");
+	die ("No DB selected!");
 }
 $databaseId = $app->functions->intval($_GET['id']);
 
@@ -48,23 +48,23 @@ $databaseId = $app->functions->intval($_GET['id']);
 $dbData = $app->db->queryOneRecord("SELECT server_id, database_name FROM web_database WHERE database_id = " . $databaseId);
 $serverId = $app->functions->intval($dbData['server_id']);
 if ($serverId == 0){
-    die ("No DB-Server found!");
+	die ("No DB-Server found!");
 }
 $serverData = $app->db->queryOneRecord(
-    "SELECT server_name FROM server WHERE server_id = " .
-    $serverId);
-	
+	"SELECT server_name FROM server WHERE server_id = " .
+	$serverId);
+
 $app->uses('getconf');
 $global_config = $app->getconf->get_global_config('sites');
-$web_config = $app->getconf->get_server_config($serverId,'web');
+$web_config = $app->getconf->get_server_config($serverId, 'web');
 
 /*
  * We only redirect to the login-form, so there is no need, to check any rights
  */
- 
+
 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);
+	$phpmyadmin_url = str_replace(array('[SERVERNAME]', '[DATABASENAME]'), array($serverData['server_name'], $dbData['database_name']), $phpmyadmin_url);
 	header('Location: '.$phpmyadmin_url);
 } else {
 	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
@@ -75,4 +75,4 @@ if($global_config['phpmyadmin_url'] != '') {
 	}
 }
 exit;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_user_del.php b/interface/web/sites/database_user_del.php
index 7931fb72436c1d409b51ed6259c9ead7fc8b64cb..3667539c7aefec0abb0f55ad2848ee2d7534a78c 100644
--- a/interface/web/sites/database_user_del.php
+++ b/interface/web/sites/database_user_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/database_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -50,34 +50,35 @@ $app->uses("tform_actions");
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app; $conf;
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-        
-        $old_record = $app->tform->getDataRecord($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
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
+		$old_record = $app->tform->getDataRecord($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
 		global $app; $conf;
-		
+
 		//* Update all records that belog to this user
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_user_id=NULL','database_id', $rec['database_id']);
-            
-        }
-        $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogUpdate('web_database','database_ro_user_id=NULL','database_id', $rec['database_id']);
-        }
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_user_id=NULL', 'database_id', $rec['database_id']);
+
+		}
+		$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogUpdate('web_database', 'database_ro_user_id=NULL', 'database_id', $rec['database_id']);
+		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php
index 4f6979fc4e6ffeca07e8d699645f03ebe0199485..4cb78f99b4bd538fcc54d2dd044d0bbf6c6d402c 100644
--- a/interface/web/sites/database_user_edit.php
+++ b/interface/web/sites/database_user_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/database_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -63,25 +63,25 @@ class page_action extends tform_actions {
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
 
-        if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+		if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$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(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['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[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(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['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[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(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);
@@ -94,8 +94,8 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-        }
+			$app->tpl->setVar("client_group_id", $client_select);
+		}
 
 
 		if ($this->dataRecord['database_user'] != ""){
@@ -109,13 +109,13 @@ class page_action extends tform_actions {
 		parent::onShowEnd();
 	}
 
-    function onSubmit() {
-        global $app;
+	function onSubmit() {
+		global $app;
 
-        if($_SESSION['s']['user']['typ'] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
+		if($_SESSION['s']['user']['typ'] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
 
-        parent::onSubmit();
-    }
+		parent::onSubmit();
+	}
 
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
@@ -125,25 +125,25 @@ class page_action extends tform_actions {
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
 
-        $this->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM web_database_user WHERE database_user_id = '".$this->id."'");
+		$this->oldDataRecord = $app->db->queryOneRecord("SELECT * FROM web_database_user WHERE database_user_id = '".$this->id."'");
 
-        $dbuser_prefix = $app->tools_sites->getPrefix($this->oldDataRecord['database_user_prefix'], $dbuser_prefix);
-        $this->dataRecord['database_user_prefix'] = $dbuser_prefix;
+		$dbuser_prefix = $app->tools_sites->getPrefix($this->oldDataRecord['database_user_prefix'], $dbuser_prefix);
+		$this->dataRecord['database_user_prefix'] = $dbuser_prefix;
 
 		//* Database username shall not be empty
 		if($this->dataRecord['database_user'] == '') $app->tform->errorMessage .= $app->tform->wordbook["database_user_error_empty"].'<br />';
 
-		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}',$dbuser_prefix . $this->dataRecord['database_user'],$app->tform->wordbook["database_user_error_len"]).'<br />';
+		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}', $dbuser_prefix . $this->dataRecord['database_user'], $app->tform->wordbook["database_user_error_len"]).'<br />';
 
 		//* Check database user against blacklist
-		$dbuser_blacklist = array($conf['db_user'],'mysql','root');
-		if(in_array($dbuser_prefix . $this->dataRecord['database_user'],$dbuser_blacklist)) {
+		$dbuser_blacklist = array($conf['db_user'], 'mysql', 'root');
+		if(in_array($dbuser_prefix . $this->dataRecord['database_user'], $dbuser_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database user not allowed.').'<br />';
 		}
 
 		if ($app->tform->errorMessage == ''){
 			/* restrict the names if there is no error */
-            /* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+			/* crop user and db names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
 
@@ -152,7 +152,7 @@ class page_action extends tform_actions {
 		// taking the one from oldData doesn't work as it's encrypted...shit!
 		$this->dataRecord['database_password_mongo'] = $this->dataRecord['database_user'].":mongo:".$this->dataRecord['database_password'];
 
-        $this->dataRecord['server_id'] = 0; // we need this on all servers
+		$this->dataRecord['server_id'] = 0; // we need this on all servers
 
 		parent::onBeforeUpdate();
 	}
@@ -168,18 +168,18 @@ class page_action extends tform_actions {
 		$global_config = $app->getconf->get_global_config('sites');
 		$dbuser_prefix = $app->tools_sites->replacePrefix($global_config['dbuser_prefix'], $this->dataRecord);
 
-        $this->dataRecord['database_user_prefix'] = $dbuser_prefix;
+		$this->dataRecord['database_user_prefix'] = $dbuser_prefix;
 
-		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}',$dbuser_prefix . $this->dataRecord['database_user'],$app->tform->wordbook["database_user_error_len"]).'<br />';
+		if(strlen($dbuser_prefix . $this->dataRecord['database_user']) > 16) $app->tform->errorMessage .= str_replace('{user}', $dbuser_prefix . $this->dataRecord['database_user'], $app->tform->wordbook["database_user_error_len"]).'<br />';
 
 		//* Check database user against blacklist
-		$dbuser_blacklist = array($conf['db_user'],'mysql','root');
-		if(is_array($dbuser_blacklist) && in_array($dbuser_prefix . $this->dataRecord['database_user'],$dbuser_blacklist)) {
+		$dbuser_blacklist = array($conf['db_user'], 'mysql', 'root');
+		if(is_array($dbuser_blacklist) && in_array($dbuser_prefix . $this->dataRecord['database_user'], $dbuser_blacklist)) {
 			$app->tform->errorMessage .= $app->lng('Database user not allowed.').'<br />';
 		}
 
 		/* restrict the names */
-        /* crop user names if they are too long -> mysql: user: 16 chars / db: 64 chars */
+		/* crop user names if they are too long -> mysql: user: 16 chars / db: 64 chars */
 		if ($app->tform->errorMessage == ''){
 			$this->dataRecord['database_user'] = substr($dbuser_prefix . $this->dataRecord['database_user'], 0, 16);
 		}
@@ -235,4 +235,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/database_user_list.php b/interface/web/sites/database_user_list.php
index 84c9535f43426955084a832cd29586ebbf53b99e..1dbd2150c9812abbcb817217dcd808423ad3d508 100644
--- a/interface/web/sites/database_user_list.php
+++ b/interface/web/sites/database_user_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,13 +48,13 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -62,4 +62,4 @@ $list->SQLOrderBy = 'ORDER BY web_database_user.database_user';
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/cron.tform.php b/interface/web/sites/form/cron.tform.php
index 41c2a3199c001ebf659ececd3be1220a9e8ec875..488896731ef28ce5659527b48007c0dc49019ddb 100644
--- a/interface/web/sites/form/cron.tform.php
+++ b/interface/web/sites/form/cron.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Cron Job";
-$form["description"] 	= "";
-$form["name"] 			= "cron";
-$form["action"]			= "cron_edit.php";
-$form["db_table"]		= "cron";
-$form["db_table_idx"]	= "id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "cron";
-$form["list_default"]	= "cron_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Cron Job";
+$form["description"]  = "";
+$form["name"]    = "cron";
+$form["action"]   = "cron_edit.php";
+$form["db_table"]  = "cron";
+$form["db_table_idx"] = "id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "cron";
+$form["list_default"] = "cron_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,139 +51,139 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['cron'] = array (
-	'title' 	=> "Cron Job",
-	'width' 	=> 100,
-	'template' 	=> "templates/cron_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Cron Job",
+	'width'  => 100,
+	'template'  => "templates/cron_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'server_id_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'server_id_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		'parent_domain_id' => array (
+			'datatype'  => 'INTEGER',
+			'formtype'  => 'SELECT',
+			'default'   => '',
+			'datasource'    => array (  'type'  => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'     => ''
+		),
+		'run_min' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_min_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_hour' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_hour_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_mday' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_mday_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_month' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_month_format',
+					'errmsg'=> 'run_month_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
+		),
+		'run_wday' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'TEXT',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'run_time_format',
+					'errmsg'=> 'run_wday_error_format'),
+			),
+			'default'   => '',
+			'value'     => '',
+			'width'     => '30',
+			'maxlength' => '255'
 		),
-        'parent_domain_id' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'SELECT',
-            'default'   => '',
-            'datasource'    => array (  'type'  => 'SQL',
-                                        'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-                                        'keyfield'=> 'domain_id',
-                                        'valuefield'=> 'parent_domain'
-                                     ),
-            'value'     => ''
-        ),
-        'run_min' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_min_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_hour' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_hour_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_mday' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_mday_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_month' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_month_format',
-                                                        'errmsg'=> 'run_month_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'run_wday' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
-                                                        'errmsg'=> 'run_wday_error_format'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
 		'command' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'command_error_empty'),
-                                        1 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_cron',
-                                                        'function' => 'command_format',
-                                                        'errmsg'=> 'command_error_format'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'command_error_empty'),
+				1 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_cron',
+					'function' => 'command_format',
+					'errmsg'=> 'command_error_format'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		'type' => array (
+			'datatype'  => 'VARCHAR',
+			'formtype'  => 'SELECT',
+			'default'   => 'url',
+			'valuelimit' => 'list:url,full,chrooted',
+			'value'     => array('url' => 'Url', 'full' => 'Full', 'chrooted' => 'Chrooted')
 		),
-        'type' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'SELECT',
-            'default'   => 'url',
-            'valuelimit' => 'list:url,full,chrooted',
-            'value'     => array('url' => 'Url', 'full' => 'Full', 'chrooted' => 'Chrooted')
-        ),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/database.tform.php b/interface/web/sites/form/database.tform.php
index e458e066d6954d3384cb1d8852bf34ca45be6095..5207fd5b38cfda45795b90ffa73f4aefb625a047 100644
--- a/interface/web/sites/form/database.tform.php
+++ b/interface/web/sites/form/database.tform.php
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Database";
-$form["description"] 	= "";
-$form["name"] 			= "database";
-$form["action"]			= "database_edit.php";
-$form["db_table"]		= "web_database";
-$form["db_table_idx"]	= "database_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "database";
-$form["list_default"]	= "database_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Database";
+$form["description"]  = "";
+$form["name"]    = "database";
+$form["action"]   = "database_edit.php";
+$form["db_table"]  = "web_database";
+$form["db_table_idx"] = "database_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "database";
+$form["list_default"] = "database_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,125 +56,125 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['database'] = array (
-	'title' 	=> "Database",
-	'width' 	=> 100,
-	'template' 	=> "templates/database_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Database",
+	'width'  => 100,
+	'template'  => "templates/database_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> array('0' => 'select_site_txt')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => array('0' => 'select_site_txt')
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array(
-			                  'mongo' => 'MongoDB',
-			                  'mysql' => 'MySQL'
-			               )
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array(
+				'mongo' => 'MongoDB',
+				'mysql' => 'MySQL'
+			)
 		),
 		'database_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'database_name_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
-														'errmsg'=> 'database_name_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'database_name_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
+					'errmsg'=> 'database_name_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'database_name_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'database_user_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
-										'keyfield'=> 'database_user_id',
-										'valuefield'=> 'database_user'
-									 ),
-			'value'		=> array('0' => 'select_dbuser_txt')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
+				'keyfield'=> 'database_user_id',
+				'valuefield'=> 'database_user'
+			),
+			'value'  => array('0' => 'select_dbuser_txt')
 		),
 		'database_ro_user_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
-										'keyfield'=> 'database_user_id',
-										'valuefield'=> 'database_user'
-									 ),
-			'value'		=> array('0' => 'no_dbuser_txt')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT database_user_id,database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user",
+				'keyfield'=> 'database_user_id',
+				'valuefield'=> 'database_user'
+			),
+			'value'  => array('0' => 'no_dbuser_txt')
 		),
 		'database_charset' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('' => 'DB-Default','latin1' => 'Latin 1','utf8' => 'UTF-8')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('' => 'DB-Default', 'latin1' => 'Latin 1', 'utf8' => 'UTF-8')
 		),
 		'remote_access' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	    'remote_ips' => array (
-	      'datatype'  => 'TEXT',
-	      'formtype'  => 'TEXT',
-	      'validators'  => array (  0 => array (  'type' => 'CUSTOM',
-	                                              'class' => 'validate_database',
-	                                              'function' => 'valid_ip_list',
-	                                              'errmsg' => 'database_remote_error_ips'),
-	                             ),
-	      'default' => '',
-	      'value'   => '',
-	      'width'   => '60',
-		  'searchable' => 2
-	    ),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		'remote_ips' => array (
+			'datatype'  => 'TEXT',
+			'formtype'  => 'TEXT',
+			'validators'  => array (  0 => array (  'type' => 'CUSTOM',
+					'class' => 'validate_database',
+					'function' => 'valid_ip_list',
+					'errmsg' => 'database_remote_error_ips'),
+			),
+			'default' => '',
+			'value'   => '',
+			'width'   => '60',
+			'searchable' => 2
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/database_user.tform.php b/interface/web/sites/form/database_user.tform.php
index d2a2defe7b59ce8f5dfaa99c256ddbe9995b3bb9..039ee7b0443d0ff8331884c1b2a9d1ae1b76a010 100644
--- a/interface/web/sites/form/database_user.tform.php
+++ b/interface/web/sites/form/database_user.tform.php
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Database User";
-$form["description"] 	= "";
-$form["name"] 			= "database_user";
-$form["action"]			= "database_user_edit.php";
-$form["db_table"]		= "web_database_user";
-$form["db_table_idx"]	= "database_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "database_user";
-$form["list_default"]	= "database_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Database User";
+$form["description"]  = "";
+$form["name"]    = "database_user";
+$form["action"]   = "database_user_edit.php";
+$form["db_table"]  = "web_database_user";
+$form["db_table_idx"] = "database_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "database_user";
+$form["list_default"] = "database_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,71 +56,71 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['database_user'] = array (
-	'title' 	=> "Database User",
-	'width' 	=> 100,
-	'template' 	=> "templates/database_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Database User",
+	'width'  => 100,
+	'template'  => "templates/database_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} AND db_server = 1 ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'database_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'database_user_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'database_user_error_unique'),
-										2 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
-														'errmsg'=> 'database_user_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'database_user_error_empty'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'database_user_error_unique'),
+				2 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-zA-Z0-9_]{2,64}$/',
+					'errmsg'=> 'database_user_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'database_user_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'database_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'MYSQL',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'database_password_mongo' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/ftp_user.tform.php b/interface/web/sites/form/ftp_user.tform.php
index 7dece14fae99661f2aaecd7d0828940fb3355b1a..b540ec02676c68c57f06635243f8c047e248ebe9 100644
--- a/interface/web/sites/form/ftp_user.tform.php
+++ b/interface/web/sites/form/ftp_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "FTP User";
-$form["description"] 	= "";
-$form["name"] 			= "ftp_user";
-$form["action"]			= "ftp_user_edit.php";
-$form["db_table"]		= "ftp_user";
-$form["db_table_idx"]	= "ftp_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "ftp";
-$form["list_default"]	= "ftp_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "FTP User";
+$form["description"]  = "";
+$form["name"]    = "ftp_user";
+$form["action"]   = "ftp_user_edit.php";
+$form["db_table"]  = "ftp_user";
+$form["db_table_idx"] = "ftp_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "ftp";
+$form["list_default"] = "ftp_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,215 +56,215 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['ftp'] = array (
-	'title' 	=> "FTP User",
-	'width' 	=> 100,
-	'template' 	=> "templates/ftp_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "FTP User",
+	'width'  => 100,
+	'template'  => "templates/ftp_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'username_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'quota_size' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'quota_size_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'quota_size_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'quota_size_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'quota_size_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($app->auth->is_admin()) {
 
-$form["tabs"]['advanced'] = array (
-    'title'     => "Options",
-    'width'     => 100,
-    'template'  => "templates/ftp_user_advanced.htm",
-    'fields'    => array (
-    ##################################
-    # Begin Datatable fields
-    ##################################
-        'uid' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'uid_error_empty'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'gid' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'gid_error_empty'),
-                                    ),
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'dir' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'directory_error_empty'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-        'quota_files' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'ul_ratio' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'dl_ratio' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'ul_bandwidth' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-        'dl_bandwidth' => array (
-            'datatype'  => 'INTEGER',
-            'formtype'  => 'TEXT',
-            'default'   => '0',
-            'value'     => '',
-            'width'     => '7',
-            'maxlength' => '7'
-        ),
-    ##################################
-    # ENDE Datatable fields
-    ##################################
-    )
-);
+	$form["tabs"]['advanced'] = array (
+		'title'     => "Options",
+		'width'     => 100,
+		'template'  => "templates/ftp_user_advanced.htm",
+		'fields'    => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'uid' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'uid_error_empty'),
+				),
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			'gid' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'gid_error_empty'),
+				),
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			'dir' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'directory_error_empty'),
+				),
+				'default'   => '',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			'quota_files' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'ul_ratio' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'dl_ratio' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'ul_bandwidth' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			'dl_bandwidth' => array (
+				'datatype'  => 'INTEGER',
+				'formtype'  => 'TEXT',
+				'default'   => '0',
+				'value'     => '',
+				'width'     => '7',
+				'maxlength' => '7'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 } else {
 
-$form["tabs"]['advanced'] = array (
-    'title'     => "Options",
-    'width'     => 100,
-    'template'  => "templates/ftp_user_advanced_client.htm",
-    'fields'    => array (
-    ##################################
-    # Begin Datatable fields
-    ##################################
-        'dir' => array (
-            'datatype'  => 'VARCHAR',
-            'formtype'  => 'TEXT',
-            'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'directory_error_empty'),
-                                        1 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_ftpuser',
-                                                        'function' => 'ftp_dir',
-                                                        'errmsg' => 'directory_error_notinweb'),
-                                    ),
-            'default'   => '',
-            'value'     => '',
-            'width'     => '30',
-            'maxlength' => '255'
-        ),
-    ##################################
-    # ENDE Datatable fields
-    ##################################
-    )
-);
+	$form["tabs"]['advanced'] = array (
+		'title'     => "Options",
+		'width'     => 100,
+		'template'  => "templates/ftp_user_advanced_client.htm",
+		'fields'    => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'dir' => array (
+				'datatype'  => 'VARCHAR',
+				'formtype'  => 'TEXT',
+				'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
+						'errmsg'=> 'directory_error_empty'),
+					1 => array (    'type'  => 'CUSTOM',
+						'class' => 'validate_ftpuser',
+						'function' => 'ftp_dir',
+						'errmsg' => 'directory_error_notinweb'),
+				),
+				'default'   => '',
+				'value'     => '',
+				'width'     => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/shell_user.tform.php b/interface/web/sites/form/shell_user.tform.php
index 1ae077d286d58f3b1862fdd8d8a8ab64820a49b8..d9928e6acd068b53d9449ae7f1331cd5dd1fe040 100644
--- a/interface/web/sites/form/shell_user.tform.php
+++ b/interface/web/sites/form/shell_user.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Shell User";
-$form["description"] 	= "";
-$form["name"] 			= "shell_user";
-$form["action"]			= "shell_user_edit.php";
-$form["db_table"]		= "shell_user";
-$form["db_table_idx"]	= "shell_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "shell";
-$form["list_default"]	= "shell_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Shell User";
+$form["description"]  = "";
+$form["name"]    = "shell_user";
+$form["action"]   = "shell_user_edit.php";
+$form["db_table"]  = "shell_user";
+$form["db_table_idx"] = "shell_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "shell";
+$form["list_default"] = "shell_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,160 +56,160 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['shell'] = array (
-	'title' 	=> "Shell User",
-	'width' 	=> 100,
-	'template' 	=> "templates/shell_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Shell User",
+	'width'  => 100,
+	'template'  => "templates/shell_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,32}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,32}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'username_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'chroot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			'valuelimit' => 'client:ssh_chroot',
-			'value'		=> array('no' => 'None', 'jailkit' => 'Jailkit')
+			'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
 		),
 		'quota_size' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'quota_size_error_empty'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'quota_size_error_empty'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ssh_rsa' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'maxlength'	=> '600'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'maxlength' => '600'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/shell_user_advanced.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'puser' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'uid_error_empty'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'pgroup' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'uid_error_empty'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'shell' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '/bin/bash',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'dir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'directory_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/shell_user_advanced.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'puser' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'uid_error_empty'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'pgroup' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'uid_error_empty'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'shell' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '/bin/bash',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'dir' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'directory_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_aliasdomain.tform.php b/interface/web/sites/form/web_aliasdomain.tform.php
index 528234a6d58a630b7376a0bd0cd509f61c7f64f7..35762ef22217dddbdfaca90ec85f6f954b2430f8 100644
--- a/interface/web/sites/form/web_aliasdomain.tform.php
+++ b/interface/web/sites/form/web_aliasdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Web Aliasdomain";
-$form["description"] 	= "";
-$form["name"] 			= "web_aliasdomain";
-$form["action"]			= "web_aliasdomain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_aliasdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web Aliasdomain";
+$form["description"]  = "";
+$form["name"]    = "web_aliasdomain";
+$form["action"]   = "web_aliasdomain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_aliasdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,133 +56,133 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_aliasdomain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_aliasdomain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'alias_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'alias_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'subdomain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'www',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'web_domain_autosub',
-                                                        'errmsg'=> 'domain_error_autosub'),
-                                    ),
-			'value'		=> array('none' => 'none_txt', 'www' => 'www.', '*' => '*.')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'www',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'web_domain_autosub',
+					'errmsg'=> 'domain_error_autosub'),
+			),
+			'value'  => array('none' => 'none_txt', 'www' => 'www.', '*' => '*.')
 		),
 		'seo_redirect' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'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')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'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')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_aliasdomain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_aliasdomain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php
index 861a3d5defe1ff447c478ecb63af5ee49485ad39..ff3365a2eb8ea98831d52c2db4aebdbdd0ecd108 100644
--- a/interface/web/sites/form/web_domain.tform.php
+++ b/interface/web/sites/form/web_domain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Web Domain";
-$form["description"] 	= "";
-$form["name"] 			= "web_domain";
-$form["action"]			= "web_domain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_domain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web Domain";
+$form["description"]  = "";
+$form["name"]    = "web_domain";
+$form["action"]   = "web_domain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_domain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -65,332 +65,332 @@ if($app->auth->has_clients($_SESSION['s']['user']['userid']) || $app->auth->is_a
 $wildcard_available = true;
 $ssl_available = true;
 if(!$app->auth->is_admin()) {
-    $client_group_id = $_SESSION["s"]["user"]["default_group"];
+	$client_group_id = $_SESSION["s"]["user"]["default_group"];
 	$client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-    
-    if($client['limit_wildcard'] != 'y') $wildcard_available = false;
-    if($client['limit_ssl'] != 'y') $ssl_available = false;
+
+	if($client['limit_wildcard'] != 'y') $wildcard_available = false;
+	if($client['limit_ssl'] != 'y') $ssl_available = false;
 }
 
 $app->uses('getconf');
 $web_config = $app->getconf->get_global_config('sites');
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_edit.htm",
-	'readonly'	=> $web_domain_edit_readonly,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_domain_edit.htm",
+	'readonly' => $web_domain_edit_readonly,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
 			'validators'    => array (  0 => array (    'type'  => 'NOTEMPTY',
-                                                        'errmsg'=> 'no_server_error'),
-                                    ),
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+					'errmsg'=> 'no_server_error'),
+			),
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'ipv6_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'web_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'web_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'site' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'site' AND {AUTHSQL} ORDER BY domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'domain'
+			),
+			'value'  => ''
 		),
 		'vhost_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('name' => 'Namebased', 'ip' => 'IP-Based')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('name' => 'Namebased', 'ip' => 'IP-Based')
 		),
 		'hd_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'hd_quota_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'hd_quota_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'hd_quota_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'hd_quota_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'traffic_quota_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'traffic_quota_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'traffic_quota_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'traffic_quota_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'errordocs' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> array(0 => '0',1 => '1')
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '1',
+			'value'  => array(0 => '0', 1 => '1')
 		),
 		'subdomain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'www',
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'web_domain_autosub',
-                                                        'errmsg'=> 'domain_error_autosub'),
-                                    ),
-			'value'		=> ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'www',
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'web_domain_autosub',
+					'errmsg'=> 'domain_error_autosub'),
+			),
+			'value'  => ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
 		),
 		'ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'php' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'fast-cgi',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'fast-cgi',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
+			'value'  => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
 			'searchable' => 2
 		),
 		'fastcgi_php_version' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['redirect'] = array (
-	'title' 	=> "Redirect",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_redirect.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Redirect",
+	'width'  => 100,
+	'template'  => "templates/web_domain_redirect.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'seo_redirect' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'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')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'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
-	##################################
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($ssl_available) {
-$form["tabs"]['ssl'] = array (
-	'title' 	=> "SSL",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_ssl.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'ssl_state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_state_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_locality' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_locality_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_organisation_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation_unit' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
-														'errmsg'=> 'ssl_organistaion_unit_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		/*
+	$form["tabs"]['ssl'] = array (
+		'title'  => "SSL",
+		'width'  => 100,
+		'template'  => "templates/web_domain_ssl.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'ssl_state' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_state_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_locality' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_locality_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_organisation_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation_unit' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'errmsg'=> 'ssl_organistaion_unit_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			/*
 		'ssl_country' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
@@ -404,98 +404,98 @@ $form["tabs"]['ssl'] = array (
 			'maxlength'	=> '2'
 		),
 		*/
-		'ssl_country' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
-										'keyfield'=> 'iso',
-										'valuefield'=> 'printable_name'
-									 ),
-			'value'		=> ''
-		),
-		'ssl_domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_key' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_request' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_cert' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_bundle' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt','del' => 'delete_certificate_txt')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+			'ssl_country' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'datasource' => array (  'type' => 'SQL',
+					'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+					'keyfield'=> 'iso',
+					'valuefield'=> 'printable_name'
+				),
+				'value'  => ''
+			),
+			'ssl_domain' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_key' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_request' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_cert' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_bundle' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_action' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'value'  => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt')
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 }
 
 //* Statistics
 $form["tabs"]['stats'] = array (
-	'title' 	=> "Stats",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_stats.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Stats",
+	'width'  => 100,
+	'template'  => "templates/web_domain_stats.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'stats_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'stats_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'webalizer',
-			'value'		=> array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'webalizer',
+			'value'  => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -503,229 +503,229 @@ $form["tabs"]['stats'] = array (
 
 //* Backup
 $form["tabs"]['backup'] = array (
-	'title' 	=> "Backup",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_backup.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Backup",
+	'width'  => 100,
+	'template'  => "templates/web_domain_backup.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'backup_interval' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
 		),
 		'backup_copies' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'backup_records' => array (
-         	'class'   => 'plugin_backuplist',
-     		'options' => array(
+		'backup_records' => array (
+			'class'   => 'plugin_backuplist',
+			'options' => array(
 			)
-        )
+		)
 	)
 );
 
 // }
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'
-    || ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
+	|| ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'document_root' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'documentroot_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysuser_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysgroup_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'allow_override' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'allow_override_error_empty'),
-									),
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'php_fpm_use_socket' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-		'pm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'dynamic',
-			'value'		=> array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
-		),
-		'pm_max_children' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_children_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_start_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_start_servers_error_regex'),
-									),
-			'default'	=> '2',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_min_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_min_spare_servers_error_regex'),
-									),
-			'default'	=> '1',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_max_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_spare_servers_error_regex'),
-									),
-			'default'	=> '5',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_process_idle_timeout' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_process_idle_timeout_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'pm_max_requests' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,11})$/',
-														'errmsg'=> 'pm_max_requests_error_regex'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'php_open_basedir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_domain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'document_root' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'documentroot_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_user' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysuser_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_group' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysgroup_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'allow_override' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'allow_override_error_empty'),
+				),
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'php_fpm_use_socket' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'n',
+				'value'  => array(0 => 'n', 1 => 'y')
+			),
+			'pm' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => 'dynamic',
+				'value'  => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
+			),
+			'pm_max_children' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_children_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_start_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_start_servers_error_regex'),
+				),
+				'default' => '2',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_min_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_min_spare_servers_error_regex'),
+				),
+				'default' => '1',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_max_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_spare_servers_error_regex'),
+				),
+				'default' => '5',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_process_idle_timeout' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_process_idle_timeout_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'pm_max_requests' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([0-9]{1,11})$/',
+						'errmsg'=> 'pm_max_requests_error_regex'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'php_open_basedir' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'php_open_basedir_error_empty'),
 									),   */
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'custom_php_ini' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'apache_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-        'nginx_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'custom_php_ini' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'apache_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'nginx_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_folder.tform.php b/interface/web/sites/form/web_folder.tform.php
index 2cef461dcc3c576acbe0dd4869d25ad867003224..ab8d4747ce15a3b1fdb3897fbdbfa2cffa38b6cf 100644
--- a/interface/web/sites/form/web_folder.tform.php
+++ b/interface/web/sites/form/web_folder.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Web Folder";
-$form["description"] 	= "";
-$form["name"] 			= "web_folder";
-$form["action"]			= "web_folder_edit.php";
-$form["db_table"]		= "web_folder";
-$form["db_table_idx"]	= "web_folder_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "folder";
-$form["list_default"]	= "web_folder_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web Folder";
+$form["description"]  = "";
+$form["name"]    = "web_folder";
+$form["action"]   = "web_folder_edit.php";
+$form["db_table"]  = "web_folder";
+$form["db_table_idx"] = "web_folder_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "folder";
+$form["list_default"] = "web_folder_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,60 +51,60 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['folder'] = array (
-	'title' 	=> "Folder",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_folder_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Folder",
+	'width'  => 100,
+	'template'  => "templates/web_folder_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE (web_domain.type = 'vhost' OR web_domain.type = 'vhostsubdomain') AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-\_\/]{0,255}$/',
-														'errmsg'=> 'path_error_regex'),
-									),
-			'default'	=> '/',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-\_\/]{0,255}$/',
+					'errmsg'=> 'path_error_regex'),
+			),
+			'default' => '/',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/web_folder_user.tform.php b/interface/web/sites/form/web_folder_user.tform.php
index 1a034dfaa27ee2c32e43ed8171803b1368acc381..19ca71c1dab3790ed0da7f989a0f43a33c31320e 100644
--- a/interface/web/sites/form/web_folder_user.tform.php
+++ b/interface/web/sites/form/web_folder_user.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Web folder user";
-$form["description"] 	= "";
-$form["name"] 			= "web_folder_user";
-$form["action"]			= "web_folder_user_edit.php";
-$form["db_table"]		= "web_folder_user";
-$form["db_table_idx"]	= "web_folder_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "user";
-$form["list_default"]	= "web_folder_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Web folder user";
+$form["description"]  = "";
+$form["name"]    = "web_folder_user";
+$form["action"]   = "web_folder_user_edit.php";
+$form["db_table"]  = "web_folder_user";
+$form["db_table_idx"] = "web_folder_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "user";
+$form["list_default"] = "web_folder_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,72 +51,72 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['user'] = array (
-	'title' 	=> "Folder",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_folder_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Folder",
+	'width'  => 100,
+	'template'  => "templates/web_folder_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'web_folder_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "Select concat(web_domain.domain,' ',web_folder.path, ' :: ', server.server_name) as name, web_folder.web_folder_id from web_domain, web_folder, server WHERE web_domain.domain_id = web_folder.parent_domain_id AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'web_folder_id',
-										'valuefield'=> 'name'
-									 ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'folder_error_empty'),
-									),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "Select concat(web_domain.domain,' ',web_folder.path, ' :: ', server.server_name) as name, web_folder.web_folder_id from web_domain, web_folder, server WHERE web_domain.domain_id = web_folder.parent_domain_id AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'web_folder_id',
+				'valuefield'=> 'name'
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'folder_error_empty'),
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/form/web_subdomain.tform.php b/interface/web/sites/form/web_subdomain.tform.php
index 385945c8daf3abf89b0b4ae62ef6a90f0f2e292a..b79c46add0cbe05f4995f67e0c55e6d33c02d7a8 100644
--- a/interface/web/sites/form/web_subdomain.tform.php
+++ b/interface/web/sites/form/web_subdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Subdomain";
-$form["description"] 	= "";
-$form["name"] 			= "web_subdomain";
-$form["action"]			= "web_subdomain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_subdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Subdomain";
+$form["description"]  = "";
+$form["name"]    = "web_subdomain";
+$form["action"]   = "web_subdomain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_subdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,117 +56,117 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_subdomain_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_subdomain_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'sub_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'sub_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> '',
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => '',
 			'searchable' => 2
 		),
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_subdomain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_subdomain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php
index 7c123d0f69a9204b57cf330a8427519b50c074ce..a4a323fdcae217ef16e07b52a9e33223bfe4045c 100644
--- a/interface/web/sites/form/web_vhost_subdomain.tform.php
+++ b/interface/web/sites/form/web_vhost_subdomain.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Subdomain";
-$form["description"] 	= "";
-$form["name"] 			= "web_vhost_subdomain";
-$form["action"]			= "web_vhost_subdomain_edit.php";
-$form["db_table"]		= "web_domain";
-$form["db_table_idx"]	= "domain_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "domain";
-$form["list_default"]	= "web_vhost_subdomain_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Subdomain";
+$form["description"]  = "";
+$form["name"]    = "web_vhost_subdomain";
+$form["action"]   = "web_vhost_subdomain_edit.php";
+$form["db_table"]  = "web_domain";
+$form["db_table_idx"] = "domain_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "domain";
+$form["list_default"] = "web_vhost_subdomain_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -58,329 +58,329 @@ $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d =
 $wildcard_available = false;
 $ssl_available = true;
 if(!$app->auth->is_admin()) {
-    $client_group_id = $_SESSION["s"]["user"]["default_group"];
+	$client_group_id = $_SESSION["s"]["user"]["default_group"];
 	$client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-    
-    if($client['limit_ssl'] != 'y') $ssl_available = false;
+
+	if($client['limit_ssl'] != 'y') $ssl_available = false;
 }
 
 $app->uses('getconf');
 $web_config = $app->getconf->get_global_config('sites');
 
 $form["tabs"]['domain'] = array (
-	'title' 	=> "Domain",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_edit.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Domain",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_edit.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'ipv6_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> '',
+			'value'  => '',
 			'searchable' => 2
 		),
 		'domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-            'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
-                                                        'class' => 'validate_domain',
-                                                        'function' => 'sub_domain',
-                                                        'errmsg'=> 'domain_error_regex'),
-                                    ),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
+					'class' => 'validate_domain',
+					'function' => 'sub_domain',
+					'errmsg'=> 'domain_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('vhost' => 'Site', 'alias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain')
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'parent_domain'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
+				'keyfield'=> 'domain_id',
+				'valuefield'=> 'parent_domain'
+			),
+			'value'  => ''
 		),
 		'web_folder' => array (
-			'datatype'	=> 'VARCHAR',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@',
-														'errmsg'=> 'web_folder_error_regex'),
-									),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@',
+					'errmsg'=> 'web_folder_error_regex'),
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'vhost_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'y',
-			'value'		=> array('name' => 'Namebased', 'ip' => 'IP-Based')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'y',
+			'value'  => array('name' => 'Namebased', 'ip' => 'IP-Based')
 		),
 		'hd_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'default' => '0',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'traffic_quota' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'traffic_quota_error_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(\-1|[0-9]{1,10})$/',
-														'errmsg'=> 'traffic_quota_error_regex'),
-									),
-			'default'	=> '-1',
-			'value'		=> '',
-			'width'		=> '7',
-			'maxlength'	=> '7'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'traffic_quota_error_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^(\-1|[0-9]{1,10})$/',
+					'errmsg'=> 'traffic_quota_error_regex'),
+			),
+			'default' => '-1',
+			'value'  => '',
+			'width'  => '7',
+			'maxlength' => '7'
 		),
 		'cgi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ssi' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'suexec' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'errordocs' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> '1',
-			'value'		=> array(0 => '0',1 => '1')
+			'datatype' => 'INTEGER',
+			'formtype' => 'CHECKBOX',
+			'default' => '1',
+			'value'  => array(0 => '0', 1 => '1')
 		),
 		'subdomain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'www',
-			'value'		=> ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'www',
+			'value'  => ($wildcard_available ? array('none' => 'none_txt', 'www' => 'www.', '*' => '*.') : array('none' => 'none_txt', 'www' => 'www.'))
 		),
 		'ssl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'php' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'fast-cgi',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'fast-cgi',
 			'valuelimit' => 'client:web_php_options',
-			'value'		=> array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
+			'value'  => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
 			'searchable' => 2
 		),
 		'fastcgi_php_version' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
 										'keyfield'=> 'ip_address',
 										'valuefield'=> 'ip_address'
 									 ),*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'perl' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'ruby' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'python' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
 $form["tabs"]['redirect'] = array (
-	'title' 	=> "Redirect",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_redirect.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Redirect",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_redirect.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'redirect_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('' => 'no_redirect_txt', 'no' => 'no_flag_txt', 'R' => 'R', 'L' => 'L', 'R,L' => 'R,L', 'R=301,L' => 'R=301,L', 'last' => 'last', 'break' => 'break', 'redirect' => 'redirect', 'permanent' => 'permanent', 'proxy' => 'proxy')
 		),
 		'redirect_path' => array (
-			'datatype'	=> 'VARCHAR',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
-														'errmsg'=> 'redirect_error_regex'),
-									),
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'validators' => array (  0 => array ( 'type' => 'REGEX',
+					'regex' => '@^(([\.]{0})|((ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.\,\-\+\?\~!:%]*(\?\S+)?)?)?)|(\[scheme\]://([-\w\.]+)+(:\d+)?(/([\w/_\.\-\,\+\?\~!:%]*(\?\S+)?)?)?)|(/(?!.*\.\.)[\w/_\.\-]{1,255}/))$@',
+					'errmsg'=> 'redirect_error_regex'),
+			),
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'seo_redirect' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'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')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'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
-	##################################
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($ssl_available) {
-$form["tabs"]['ssl'] = array (
-	'title' 	=> "SSL",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_ssl.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'ssl_state' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_state_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_locality' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_locality_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_organisation_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_organisation_unit' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
-														'errmsg'=> 'ssl_organistaion_unit_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		/*
+	$form["tabs"]['ssl'] = array (
+		'title'  => "SSL",
+		'width'  => 100,
+		'template'  => "templates/web_vhost_subdomain_ssl.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'ssl_state' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_state_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_locality' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_locality_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_organisation_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_organisation_unit' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^(([\.]{0})|([a-zA-Z0-9\ \.\-\_\,]{1,255}))$/',
+						'errmsg'=> 'ssl_organistaion_unit_error_regex'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			/*
 		'ssl_country' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'TEXT',
@@ -394,98 +394,98 @@ $form["tabs"]['ssl'] = array (
 			'maxlength'	=> '2'
 		),
 		*/
-		'ssl_country' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
-										'keyfield'=> 'iso',
-										'valuefield'=> 'printable_name'
-									 ),
-			'value'		=> ''
-		),
-		'ssl_domain' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ssl_key' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_request' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_cert' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_bundle' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'cols'		=> '30',
-			'rows'		=> '10'
-		),
-		'ssl_action' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt','del' => 'delete_certificate_txt')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+			'ssl_country' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'datasource' => array (  'type' => 'SQL',
+					'querystring' => 'SELECT iso,printable_name FROM country ORDER BY printable_name',
+					'keyfield'=> 'iso',
+					'valuefield'=> 'printable_name'
+				),
+				'value'  => ''
+			),
+			'ssl_domain' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ssl_key' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_request' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_cert' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_bundle' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXTAREA',
+				'default' => '',
+				'value'  => '',
+				'cols'  => '30',
+				'rows'  => '10'
+			),
+			'ssl_action' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'value'  => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt')
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 }
 
 //* Statistics
 $form["tabs"]['stats'] = array (
-	'title' 	=> "Stats",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_stats.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Stats",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_stats.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'stats_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption' => 'CRYPT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'stats_type' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'webalizer',
-			'value'		=> array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => 'webalizer',
+			'value'  => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
@@ -493,229 +493,229 @@ $form["tabs"]['stats'] = array (
 
 //* Backup
 $form["tabs"]['backup'] = array (
-	'title' 	=> "Backup",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_backup.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Backup",
+	'width'  => 100,
+	'template'  => "templates/web_vhost_subdomain_backup.htm",
+	'readonly' => false,
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'backup_interval' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('none' => 'No backup', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('none' => 'No backup', 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly')
 		),
 		'backup_copies' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'value'		=> array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'value'  => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	),
 	'plugins' => array (
-     	'backup_records' => array (
-         	'class'   => 'plugin_backuplist',
-     		'options' => array(
+		'backup_records' => array (
+			'class'   => 'plugin_backuplist',
+			'options' => array(
 			)
-        )
+		)
 	)
 );
 
 // }
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'
-    || ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
+	|| ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
 
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Options",
-	'width' 	=> 100,
-	'template' 	=> "templates/web_vhost_subdomain_advanced.htm",
-	'readonly'	=> false,
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'document_root' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'documentroot_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_user' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysuser_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'system_group' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'sysgroup_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'allow_override' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'allow_override_error_empty'),
-									),
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'php_fpm_use_socket' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-		'pm' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'default'	=> 'dynamic',
-			'value'		=> array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
-		),
-		'pm_max_children' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_children_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_start_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_start_servers_error_regex'),
-									),
-			'default'	=> '2',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_min_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_min_spare_servers_error_regex'),
-									),
-			'default'	=> '1',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_max_spare_servers' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_max_spare_servers_error_regex'),
-									),
-			'default'	=> '5',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '3'
-		),
-		'pm_process_idle_timeout' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([1-9][0-9]{0,10})$/',
-														'errmsg'=> 'pm_process_idle_timeout_error_regex'),
-									),
-			'default'	=> '10',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'pm_max_requests' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'REGEX',
-														'regex' => '/^([0-9]{1,11})$/',
-														'errmsg'=> 'pm_max_requests_error_regex'),
-									),
-			'default'	=> '0',
-			'value'		=> '',
-			'width'		=> '3',
-			'maxlength'	=> '6'
-		),
-		'php_open_basedir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Options",
+		'width'  => 100,
+		'template'  => "templates/web_vhost_subdomain_advanced.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'document_root' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'documentroot_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_user' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysuser_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'system_group' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'sysgroup_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'allow_override' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'allow_override_error_empty'),
+				),
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'php_fpm_use_socket' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'n',
+				'value'  => array(0 => 'n', 1 => 'y')
+			),
+			'pm' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => 'dynamic',
+				'value'  => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand (PHP Version >= 5.3.9)')
+			),
+			'pm_max_children' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_children_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_start_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_start_servers_error_regex'),
+				),
+				'default' => '2',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_min_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_min_spare_servers_error_regex'),
+				),
+				'default' => '1',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_max_spare_servers' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_max_spare_servers_error_regex'),
+				),
+				'default' => '5',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '3'
+			),
+			'pm_process_idle_timeout' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([1-9][0-9]{0,10})$/',
+						'errmsg'=> 'pm_process_idle_timeout_error_regex'),
+				),
+				'default' => '10',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'pm_max_requests' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([0-9]{1,11})$/',
+						'errmsg'=> 'pm_max_requests_error_regex'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'php_open_basedir' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				/*'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
 														'errmsg'=> 'php_open_basedir_error_empty'),
 									),   */
-			'default'	=> 'All',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'custom_php_ini' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'apache_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-        'nginx_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'proxy_directives' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+				'default' => 'All',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'custom_php_ini' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'apache_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'nginx_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'proxy_directives' => array (
+				'datatype' => 'TEXT',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 
 }
 
diff --git a/interface/web/sites/form/webdav_user.tform.php b/interface/web/sites/form/webdav_user.tform.php
index 29a52dc1351168aee2e03ee63327e693a70b5147..d17f3ed4af389d2d0c88b5f0085be28745974d87 100644
--- a/interface/web/sites/form/webdav_user.tform.php
+++ b/interface/web/sites/form/webdav_user.tform.php
@@ -33,16 +33,16 @@
 
 */
 
-$form["title"] 			= "Webdav-User";
-$form["description"] 	= "";
-$form["name"] 			= "webdav_user";
-$form["action"]			= "webdav_user_edit.php";
-$form["db_table"]		= "webdav_user";
-$form["db_table_idx"]	= "webdav_user_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "webdav";
-$form["list_default"]	= "webdav_user_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Webdav-User";
+$form["description"]  = "";
+$form["name"]    = "webdav_user";
+$form["action"]   = "webdav_user_edit.php";
+$form["db_table"]  = "webdav_user";
+$form["db_table_idx"] = "webdav_user_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "webdav";
+$form["list_default"] = "webdav_user_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -51,85 +51,85 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['webdav'] = array (
-	'title' 	=> "Webdav User",
-	'width' 	=> 100,
-	'template' 	=> "templates/webdav_user_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Webdav User",
+	'width'  => 100,
+	'template'  => "templates/webdav_user_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'parent_domain_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'CUSTOM',
-										'class'=> 'custom_datasource',
-										'function'=> 'webdav_domains'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'CUSTOM',
+				'class'=> 'custom_datasource',
+				'function'=> 'webdav_domains'
+			),
+			'value'  => ''
 		),
 		'username' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'username_error_unique'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[\w\.\-]{0,64}$/',
-														'errmsg'=> 'username_error_regex'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'username_error_unique'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[\w\.\-]{0,64}$/',
+					'errmsg'=> 'username_error_regex'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'username_prefix' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '25'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '25'
 		),
 		'password' => array (
-			'datatype'	=> 'VARCHAR',
-			'encryption' => 'CLEARTEXT', 
-			'formtype'	=> 'PASSWORD',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'encryption' => 'CLEARTEXT',
+			'formtype' => 'PASSWORD',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'dir' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'directory_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'directory_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/ftp_user_del.php b/interface/web/sites/ftp_user_del.php
index 7663f4036c3fa5220a1e4811ef02290dbaf4bc9e..32ef028366727ac4564675c1c0e98170850d42e5 100644
--- a/interface/web/sites/ftp_user_del.php
+++ b/interface/web/sites/ftp_user_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/ftp_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('sites');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index 59a36805ce62ebf4a7e9f80df7c494f8fc7d1c09..4f71118c96f953376ab8ce447e2dceb4db0ae393 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/ftp_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,10 +49,10 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_ftp_user')) {
@@ -62,7 +62,7 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_ftp_user_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
@@ -72,24 +72,24 @@ class page_action extends tform_actions {
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
-		
+
 		if ($this->dataRecord['username'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $ftpuser_prefix));
 		}
-        
-        $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $ftpuser_prefix, $global_config['ftpuser_prefix']));
+
+		$app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $ftpuser_prefix, $global_config['ftpuser_prefix']));
 
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		if(isset($this->dataRecord["parent_domain_id"])) {
 			$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
@@ -100,51 +100,51 @@ class page_action extends tform_actions {
 			if(!$parent_domain) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 			unset($tmp);
 		}
-		
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		//die(print_r($this->dataRecord));
-		
+
 		if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
 		if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'./')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
-		
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], '..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], './')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
+
 		parent::onSubmit();
 	}
-	
+
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
 
-        $this->dataRecord['username_prefix'] = $ftpuser_prefix;
-		
+		$this->dataRecord['username_prefix'] = $ftpuser_prefix;
+
 		if ($app->tform->errorMessage == '') {
 			$this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
 		}
-		
+
 		parent::onBeforeInsert();
 	}
 
-		function onAfterInsert() {
+	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
 		$server_id = $web["server_id"];
 		$dir = $web["document_root"];
 		$uid = $web["system_user"];
 		$gid = $web["system_group"];
-		
+
 		// The FTP user shall be owned by the same group then the website
 		$sys_groupid = $web['sys_groupid'];
-		
+
 		$sql = "UPDATE ftp_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid', sys_groupid = '$sys_groupid' WHERE ftp_user_id = ".$this->id;
 		$app->db->query($sql);
-		}
+	}
 
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
@@ -152,24 +152,24 @@ class page_action extends tform_actions {
 		/*
 		 * If the names should be restricted -> do it!
 		 */
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$ftpuser_prefix = $app->tools_sites->replacePrefix($global_config['ftpuser_prefix'], $this->dataRecord);
-		
-        $old_record = $app->tform->getDataRecord($this->id);
-        $ftpuser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $ftpuser_prefix);
-        $this->dataRecord['username_prefix'] = $ftpuser_prefix;
-        
+
+		$old_record = $app->tform->getDataRecord($this->id);
+		$ftpuser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $ftpuser_prefix);
+		$this->dataRecord['username_prefix'] = $ftpuser_prefix;
+
 		/* restrict the names */
 		if ($app->tform->errorMessage == '') {
 			$this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* When the site of the FTP user has been changed
 		if(isset($this->dataRecord['parent_domain_id']) && $this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) {
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
@@ -177,14 +177,14 @@ class page_action extends tform_actions {
 			$dir = $web["document_root"];
 			$uid = $web["system_user"];
 			$gid = $web["system_group"];
-		
+
 			// The FTP user shall be owned by the same group then the website
 			$sys_groupid = $web['sys_groupid'];
-		
+
 			$sql = "UPDATE ftp_user SET server_id = $server_id, dir = '$dir', uid = '$uid', gid = '$gid', sys_groupid = '$sys_groupid' WHERE ftp_user_id = ".$this->id;
 			$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;
@@ -199,10 +199,11 @@ class page_action extends tform_actions {
 				$app->db->query($sql);
 				$app->log("Error in FTP path settings of FTP user ".$this->dataRecord['username'], 1);
 			}
-			
+
 		}
-		
+
 	}
+
 }
 
 $page = new page_action;
diff --git a/interface/web/sites/ftp_user_list.php b/interface/web/sites/ftp_user_list.php
index d5b648c0ddf56ddfb8a45f5e665d52c8ca595454..c9770cb5d55475a64dc04d3bdb7501b2172eb2b2 100644
--- a/interface/web/sites/ftp_user_list.php
+++ b/interface/web/sites/ftp_user_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,23 +48,23 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 	function onShow() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$global_config = $app->getconf->get_global_config('sites');
-		
+
 		if($global_config['webftp_url'] != '') {
-			$app->tpl->setVar('webftp_link',1);
-			$app->tpl->setVar('webftp_url',$global_config['webftp_url']);
+			$app->tpl->setVar('webftp_link', 1);
+			$app->tpl->setVar('webftp_url', $global_config['webftp_url']);
 		} else {
-			$app->tpl->setVar('webftp_link',0);
+			$app->tpl->setVar('webftp_link', 0);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 }
 
 $list = new list_action;
@@ -72,4 +72,4 @@ $list->SQLOrderBy = 'ORDER BY ftp_user.username';
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/lib/admin.conf.php b/interface/web/sites/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/sites/lib/admin.conf.php
+++ b/interface/web/sites/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php
index 1f7067ee47b01a324ed379e687c1a99a2eaddd85..7bb6f8e16a565716edcc0bf5fee30bd09c5a3bd3 100644
--- a/interface/web/sites/lib/module.conf.php
+++ b/interface/web/sites/lib/module.conf.php
@@ -2,182 +2,182 @@
 
 $userid=$app->auth->get_user_id();
 
-$module["name"] 	= "sites";
-$module["title"] 	= "top_menu_sites";
-$module["template"] 	= "module.tpl.htm";
-$module["startpage"] 	= "sites/web_domain_list.php";
+$module["name"]  = "sites";
+$module["title"]  = "top_menu_sites";
+$module["template"]  = "module.tpl.htm";
+$module["startpage"]  = "sites/web_domain_list.php";
 $module["tab_width"]    = '';
 
 // Websites menu
 $items=array();
 
-if($app->auth->get_client_limit($userid,'web_domain') != 0)
+if($app->auth->get_client_limit($userid, 'web_domain') != 0)
 {
-$items[] = array(   'title' 	=> "Website",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/web_domain_list.php',
-                    'html_id'   => 'domain_list');
+	$items[] = array(   'title'  => "Website",
+		'target'  => 'content',
+		'link' => 'sites/web_domain_list.php',
+		'html_id'   => 'domain_list');
 }
 
-if($app->auth->get_client_limit($userid,'web_subdomain') != 0)
+if($app->auth->get_client_limit($userid, 'web_subdomain') != 0)
 {
-$items[] = array(   'title' 	=> "Subdomain",
-                    'target' 	=> 'content',
-                    'link'      => 'sites/web_subdomain_list.php',
-                    'html_id'   => 'subdomain_list');
-
-    // read web config
-    $app->uses('getconf');
-    $sys_config = $app->getconf->get_global_config('sites');
-    if($sys_config['vhost_subdomains'] == 'y') {
-$items[] = array(   'title' 	=> "Subdomain (Vhost)",
-                    'target' 	=> 'content',
-                    'link'      => 'sites/web_vhost_subdomain_list.php',
-                    'html_id'   => 'subdomain_list');
-    }
+	$items[] = array(   'title'  => "Subdomain",
+		'target'  => 'content',
+		'link'      => 'sites/web_subdomain_list.php',
+		'html_id'   => 'subdomain_list');
+
+	// read web config
+	$app->uses('getconf');
+	$sys_config = $app->getconf->get_global_config('sites');
+	if($sys_config['vhost_subdomains'] == 'y') {
+		$items[] = array(   'title'  => "Subdomain (Vhost)",
+			'target'  => 'content',
+			'link'      => 'sites/web_vhost_subdomain_list.php',
+			'html_id'   => 'subdomain_list');
+	}
 }
 
-if($app->auth->get_client_limit($userid,'web_aliasdomain') != 0)
+if($app->auth->get_client_limit($userid, 'web_aliasdomain') != 0)
 {
-$items[] = array(   'title'   => "Aliasdomain",
-                    'target'  => 'content',
-                    'link'    => 'sites/web_aliasdomain_list.php',
-                    'html_id' => 'aliasdomain_list');
+	$items[] = array(   'title'   => "Aliasdomain",
+		'target'  => 'content',
+		'link'    => 'sites/web_aliasdomain_list.php',
+		'html_id' => 'aliasdomain_list');
 }
 
 if(count($items))
 {
-$module["nav"][] = array(   'title' => 'Websites',
-                            'open'  => 1,
-                            'items' => $items);
+	$module["nav"][] = array(   'title' => 'Websites',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // Databases menu
-if($app->auth->get_client_limit($userid,'database') != 0)
+if($app->auth->get_client_limit($userid, 'database') != 0)
 {
-$items=array();
+	$items=array();
 
-$items[] = array(   'title'     => "Database",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/database_list.php',
-                    'html_id'   => 'database_list');
+	$items[] = array(   'title'     => "Database",
+		'target'  => 'content',
+		'link' => 'sites/database_list.php',
+		'html_id'   => 'database_list');
 
 
-$items[] = array(   'title'     => "Database User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/database_user_list.php',
-                    'html_id'   => 'database_user_list'
-);
+	$items[] = array(   'title'     => "Database User",
+		'target'  => 'content',
+		'link' => 'sites/database_user_list.php',
+		'html_id'   => 'database_user_list'
+	);
 
-$module["nav"][] = array(   'title' => 'Database',
-                            'open'  => 1,
-                            'items' => $items);
+	$module["nav"][] = array(   'title' => 'Database',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // Web menu
 $items=array();
-if($app->auth->get_client_limit($userid,'ftp_user') != 0)
+if($app->auth->get_client_limit($userid, 'ftp_user') != 0)
 {
-$items[] = array(   'title'     => "FTP-User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/ftp_user_list.php',
-                    'html_id'   => 'ftp_user_list');
+	$items[] = array(   'title'     => "FTP-User",
+		'target'  => 'content',
+		'link' => 'sites/ftp_user_list.php',
+		'html_id'   => 'ftp_user_list');
 }
 
-if($app->auth->get_client_limit($userid,'webdav_user') != 0)
+if($app->auth->get_client_limit($userid, 'webdav_user') != 0)
 {
-$items[] = array(   'title' 	=> "Webdav-User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/webdav_user_list.php',
-                    'html_id'   => 'webdav_user_list');
+	$items[] = array(   'title'  => "Webdav-User",
+		'target'  => 'content',
+		'link' => 'sites/webdav_user_list.php',
+		'html_id'   => 'webdav_user_list');
 }
 
 $items[] = array(   'title'     => "Folder",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/web_folder_list.php',
-                    'html_id'   => 'web_folder_list');
-	
-$items[] = array(   'title' 	=> "Folder users",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/web_folder_user_list.php',
-                    'html_id'   => 'web_folder_user_list');
-	
+	'target'  => 'content',
+	'link' => 'sites/web_folder_list.php',
+	'html_id'   => 'web_folder_list');
+
+$items[] = array(   'title'  => "Folder users",
+	'target'  => 'content',
+	'link' => 'sites/web_folder_user_list.php',
+	'html_id'   => 'web_folder_user_list');
+
 $module["nav"][] = array(   'title' => 'Web Access',
-                            'open'  => 1,
-                            'items' => $items);
+	'open'  => 1,
+	'items' => $items);
 
 
 // CMD menu
-if($app->auth->get_client_limit($userid,'shell_user') != 0 OR $app->auth->get_client_limit($userid,'cron') != 0)
-{
-$items=array();
-
-if($app->auth->get_client_limit($userid,'shell_user') != 0)
+if($app->auth->get_client_limit($userid, 'shell_user') != 0 or $app->auth->get_client_limit($userid, 'cron') != 0)
 {
-$items[] = array(   'title'     => "Shell-User",
-                    'target' 	=> 'content',
-                    'link'	=> 'sites/shell_user_list.php',
-                    'html_id'   => 'shell_user_list');	
-}
-if($app->auth->get_client_limit($userid,'cron') != 0)
-{	
-$items[] = array(   'title'   => "Cron Jobs",
-                    'target'  => 'content',
-                    'link'    => 'sites/cron_list.php',
-                    'html_id' => 'cron_list');	
-}
-$module["nav"][] = array(   'title' => 'Command Line',
-                            'open'  => 1,
-                            'items' => $items);
+	$items=array();
+
+	if($app->auth->get_client_limit($userid, 'shell_user') != 0)
+	{
+		$items[] = array(   'title'     => "Shell-User",
+			'target'  => 'content',
+			'link' => 'sites/shell_user_list.php',
+			'html_id'   => 'shell_user_list');
+	}
+	if($app->auth->get_client_limit($userid, 'cron') != 0)
+	{
+		$items[] = array(   'title'   => "Cron Jobs",
+			'target'  => 'content',
+			'link'    => 'sites/cron_list.php',
+			'html_id' => 'cron_list');
+	}
+	$module["nav"][] = array(   'title' => 'Command Line',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // APS menu
-if($app->auth->get_client_limit($userid,'aps') != 0)
+if($app->auth->get_client_limit($userid, 'aps') != 0)
 {
-$items = array();
-
-$items[] = array(   'title'   => 'Available packages',
-                    'target'  => 'content',
-                    'link'    => 'sites/aps_availablepackages_list.php',
-                    'html_id' => 'aps_availablepackages_list');
-
-$items[] = array(   'title'   => 'Installed packages',
-                    'target'  => 'content',
-                    'link'    => 'sites/aps_installedpackages_list.php',
-                    'html_id' => 'aps_installedpackages_list');
-                
-
-// Second menu group, available only for admins
-if($_SESSION['s']['user']['typ'] == 'admin') 
-{
-$items[] = array(   'title'   => 'Update Packagelist',
-                    'target'  => 'content',
-                    'link'    => 'sites/aps_update_packagelist.php',
-                    'html_id' => 'aps_packagedetails_show');
-}
-
-$module['nav'][] = array(   'title' => 'APS Installer',
-                            'open'  => 1,
-                            'items' => $items);
+	$items = array();
+
+	$items[] = array(   'title'   => 'Available packages',
+		'target'  => 'content',
+		'link'    => 'sites/aps_availablepackages_list.php',
+		'html_id' => 'aps_availablepackages_list');
+
+	$items[] = array(   'title'   => 'Installed packages',
+		'target'  => 'content',
+		'link'    => 'sites/aps_installedpackages_list.php',
+		'html_id' => 'aps_installedpackages_list');
+
+
+	// Second menu group, available only for admins
+	if($_SESSION['s']['user']['typ'] == 'admin')
+	{
+		$items[] = array(   'title'   => 'Update Packagelist',
+			'target'  => 'content',
+			'link'    => 'sites/aps_update_packagelist.php',
+			'html_id' => 'aps_packagedetails_show');
+	}
+
+	$module['nav'][] = array(   'title' => 'APS Installer',
+		'open'  => 1,
+		'items' => $items);
 }
 
 // Statistics menu
 $items = array();
 
 $items[] = array(   'title'   => 'Web traffic',
-                    'target'  => 'content',
-                    'link'    => 'sites/web_sites_stats.php',
-                    'html_id' => 'websites_stats');
+	'target'  => 'content',
+	'link'    => 'sites/web_sites_stats.php',
+	'html_id' => 'websites_stats');
 
 $items[] = array(   'title'   => 'Website quota (Harddisk)',
-                    'target'  => 'content',
-                    'link'    => 'sites/user_quota_stats.php',
-                    'html_id' => 'user_quota_stats');
+	'target'  => 'content',
+	'link'    => 'sites/user_quota_stats.php',
+	'html_id' => 'user_quota_stats');
 
 $module['nav'][] = array(   'title' => 'Statistics',
-                            'open'  => 1,
-                            'items' => $items);
+	'open'  => 1,
+	'items' => $items);
 
 // clean up
 unset($items);
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/lib/remote.conf.php b/interface/web/sites/lib/remote.conf.php
index 4cdc6fc3a3bfca5e80a64926abaa5279c4e8a457..10a4640137a03f3e478306027c276f4f05fe295e 100644
--- a/interface/web/sites/lib/remote.conf.php
+++ b/interface/web/sites/lib/remote.conf.php
@@ -9,4 +9,4 @@ $function_list['sites_web_aliasdomain_get,sites_web_aliasdomain_add,sites_web_al
 $function_list['sites_web_subdomain_get,sites_web_subdomain_add,sites_web_subdomain_update,sites_web_subdomain_delete'] = 'Sites Subdomain functions';
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/aps_availablepackages.list.php b/interface/web/sites/list/aps_availablepackages.list.php
index b6f52cff8295b8c325106108f7048a5aff4337b1..812e57fd60782c2392848ae15262430e685c4ad7 100644
--- a/interface/web/sites/list/aps_availablepackages.list.php
+++ b/interface/web/sites/list/aps_availablepackages.list.php
@@ -41,46 +41,46 @@ $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'    => '');
+	'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'    => '');
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'       => 'like',
+	'prefix'   => '%',
+	'suffix'   => '%',
+	'width'    => '',
+	'value'    => '');
 
 $liste["item"][] = array('field'    => 'category',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'datasource' => array('type' => 'SQL',
-                                               'querystring' => 'SELECT category FROM aps_packages ORDER BY category',
-                                               'keyfield' => 'category',
-                                               'valuefield' => 'category'),
-                         'width'    => '',
-                         'value'    => '');
+	'datatype' => 'VARCHAR',
+	'formtype' => 'SELECT',
+	'op'       => '=',
+	'prefix'   => '',
+	'suffix'   => '',
+	'datasource' => array('type' => 'SQL',
+		'querystring' => 'SELECT category FROM aps_packages ORDER BY category',
+		'keyfield' => 'category',
+		'valuefield' => 'category'),
+	'width'    => '',
+	'value'    => '');
 
-if($_SESSION['s']['user']['typ'] == 'admin') 
+if($_SESSION['s']['user']['typ'] == 'admin')
 {
-$liste['item'][] = array('field'    => 'package_status',
-                         'datatype' => 'VARCHAR',
-                         'formtype' => 'SELECT',
-                         'op'       => '=',
-                         'prefix'   => '',
-                         'suffix'   => '',
-                         'width'    => '',
-                         'value'    => array(PACKAGE_ENABLED => '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>',
-                                             PACKAGE_LOCKED => '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>'));
-}      
-?>
\ No newline at end of file
+	$liste['item'][] = array('field'    => 'package_status',
+		'datatype' => 'VARCHAR',
+		'formtype' => 'SELECT',
+		'op'       => '=',
+		'prefix'   => '',
+		'suffix'   => '',
+		'width'    => '',
+		'value'    => array(PACKAGE_ENABLED => '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>',
+			PACKAGE_LOCKED => '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>'));
+}
+?>
diff --git a/interface/web/sites/list/aps_installedpackages.list.php b/interface/web/sites/list/aps_installedpackages.list.php
index 0f90a7322145aa21f71f6f1f33401a5e05d7f0d2..d9a51d8befbd98ea1699cc188134ed368e5a1262 100644
--- a/interface/web/sites/list/aps_installedpackages.list.php
+++ b/interface/web/sites/list/aps_installedpackages.list.php
@@ -48,26 +48,26 @@ $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');
- 
+	'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');
- 
- /*
+	'datatype' => 'VARCHAR',
+	'formtype' => 'TEXT',
+	'op'       => 'like',
+	'prefix'   => '%',
+	'suffix'   => '%',
+	'width'    => '',
+	'value'    => '',
+	'table' => 'aps_packages');
+
+/*
 $liste["item"][] = array('field'    => 'customer_id',
                          'datatype' => 'INTEGER',
                          'formtype' => 'SELECT',
@@ -77,17 +77,17 @@ $liste["item"][] = array('field'    => 'customer_id',
                          '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
+	'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');
+?>
diff --git a/interface/web/sites/list/cron.list.php b/interface/web/sites/list/cron.list.php
index 7275a06cf4f660528ed629c937e1e793f2428aef..f13beabfbbc48da07aa252dd9d20cfd7c891dbde 100644
--- a/interface/web/sites/list/cron.list.php
+++ b/interface/web/sites/list/cron.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "cron";
+$liste["name"]     = "cron";
 
 // Database table
-$liste["table"] 			= "cron";
+$liste["table"]    = "cron";
 
 // Index index field of the database table
-$liste["table_idx"]			= "id";
+$liste["table_idx"]   = "id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "cron_list.php";
+$liste["file"]    = "cron_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "cron_edit.php";
+$liste["edit_file"]   = "cron_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "cron_del.php";
+$liste["delete_file"]  = "cron_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,98 +48,98 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
 
 $liste["item"][] = array(   'field'     => "parent_domain_id",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "SELECT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'datasource'    => array (  'type'  => 'SQL',
-                                        'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-                                        'keyfield'=> 'domain_id',
-                                        'valuefield'=> 'domain'
-                                     ),
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "SELECT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'datasource'    => array (  'type'  => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_min",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_hour",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_mday",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_month",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 $liste["item"][] = array(   'field'     => "run_wday",
-                            'datatype'  => "VARCHAR",
-                            'formtype'  => "TEXT",
-                            'op'        => "=",
-                            'prefix'    => "",
-                            'suffix'    => "",
-                            'width'     => "",
-                            'value'     => "");
+	'datatype'  => "VARCHAR",
+	'formtype'  => "TEXT",
+	'op'        => "=",
+	'prefix'    => "",
+	'suffix'    => "",
+	'width'     => "",
+	'value'     => "");
 
 
-$liste["item"][] = array(	'field'		=> "command",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "command",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
 
@@ -149,4 +149,4 @@ $liste["item"][] = array(	'field'		=> "command",
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/database.list.php b/interface/web/sites/list/database.list.php
index 76dbec54fdd89b612d214048b6371539b351c0a0..599cf96f436f05583b3abc808f570ffbd8743d3b 100644
--- a/interface/web/sites/list/database.list.php
+++ b/interface/web/sites/list/database.list.php
@@ -14,37 +14,37 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "database_admin";
+	$liste["name"]     = "database_admin";
 } else {
-	$liste["name"] 				= "database";
+	$liste["name"]     = "database";
 }
 
 // Database table
-$liste["table"] 			= "web_database";
+$liste["table"]    = "web_database";
 
 // Index index field of the database table
-$liste["table_idx"]			= "database_id";
+$liste["table_idx"]   = "database_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "database_list.php";
+$liste["file"]    = "database_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "database_edit.php";
+$liste["edit_file"]   = "database_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "database_del.php";
+$liste["delete_file"]  = "database_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -52,105 +52,105 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "remote_access",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "type",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array(
-							                  'mongo' => "MongoDB",
-							                  'mysql' => "MySQL"
-							               )
-						);
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "remote_access",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "type",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array(
+		'mongo' => "MongoDB",
+		'mysql' => "MySQL"
+	)
+);
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "database_user_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT database_user_id, database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user',
-														'keyfield'=> 'database_user_id',
-														'valuefield'=> 'database_user'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} AND db_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "database_user_id",
+	'datatype' => "INTEGER",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT database_user_id, database_user FROM web_database_user WHERE {AUTHSQL} ORDER BY database_user',
+		'keyfield'=> 'database_user_id',
+		'valuefield'=> 'database_user'
+	),
+	'width'  => "",
+	'value'  => "");
 
 $liste["item"][] = array(    'field'        => "database_name",
-                            'datatype'    => "VARCHAR",
-                            'formtype'    => "TEXT",
-                            'op'        => "like",
-                            'prefix'    => "%",
-                            'suffix'    => "%",
-                            'width'        => "",
-                            'value'        => "");
+	'datatype'    => "VARCHAR",
+	'formtype'    => "TEXT",
+	'op'        => "like",
+	'prefix'    => "%",
+	'suffix'    => "%",
+	'width'        => "",
+	'value'        => "");
 
 ?>
diff --git a/interface/web/sites/list/database_user.list.php b/interface/web/sites/list/database_user.list.php
index 67796a8374fa1eafaf3d828bedc2ea0776116be2..202916e9211ee179ea58c9de628c785d032a0f38 100644
--- a/interface/web/sites/list/database_user.list.php
+++ b/interface/web/sites/list/database_user.list.php
@@ -14,37 +14,37 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "database_user_admin";
+	$liste["name"]     = "database_user_admin";
 } else {
-	$liste["name"] 				= "database_user";
+	$liste["name"]     = "database_user";
 }
 
 // Database table
-$liste["table"] 			= "web_database_user";
+$liste["table"]    = "web_database_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "database_user_id";
+$liste["table_idx"]   = "database_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "database_user_list.php";
+$liste["file"]    = "database_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "database_user_edit.php";
+$liste["edit_file"]   = "database_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "database_user_del.php";
+$liste["delete_file"]  = "database_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -53,29 +53,29 @@ $liste["auth"]				= "yes";
 
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
 
-$liste["item"][] = array(	'field'		=> "database_user",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "database_user",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/ftp_user.list.php b/interface/web/sites/list/ftp_user.list.php
index 2c64a948762ec22c2aa1567a322fd6763b9595a4..fc15170e96491a1c4b77232b9d229a8c5b80b0d5 100644
--- a/interface/web/sites/list/ftp_user.list.php
+++ b/interface/web/sites/list/ftp_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "ftp_user";
+$liste["name"]     = "ftp_user";
 
 // Database table
-$liste["table"] 			= "ftp_user";
+$liste["table"]    = "ftp_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "ftp_user_id";
+$liste["table_idx"]   = "ftp_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "ftp_user_list.php";
+$liste["file"]    = "ftp_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "ftp_user_edit.php";
+$liste["edit_file"]   = "ftp_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "ftp_user_del.php";
+$liste["delete_file"]  = "ftp_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,55 +48,55 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/shell_user.list.php b/interface/web/sites/list/shell_user.list.php
index 2dd2b4ea21142af7f638536a99291a4f1426aaf7..cd88eb2ad0b65480847e0b75932a5c20467f396b 100644
--- a/interface/web/sites/list/shell_user.list.php
+++ b/interface/web/sites/list/shell_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "shell_user";
+$liste["name"]     = "shell_user";
 
 // Database table
-$liste["table"] 			= "shell_user";
+$liste["table"]    = "shell_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "shell_user_id";
+$liste["table_idx"]   = "shell_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "shell_user_list.php";
+$liste["file"]    = "shell_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "shell_user_edit.php";
+$liste["edit_file"]   = "shell_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "shell_user_del.php";
+$liste["delete_file"]  = "shell_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,55 +48,55 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/user_quota_stats.list.php b/interface/web/sites/list/user_quota_stats.list.php
index 646da2755e87439ca723d15b4b12b442f34ce56d..3dc904e8a77e19b0185bbc124a5aad4b1a41eb17 100644
--- a/interface/web/sites/list/user_quota_stats.list.php
+++ b/interface/web/sites/list/user_quota_stats.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "user_quota_stats";
+$liste["name"]     = "user_quota_stats";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "user_quota_stats.php";
+$liste["file"]    = "user_quota_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_domain_edit.php";
+$liste["edit_file"]   = "web_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_domain_del.php";
+$liste["delete_file"]  = "web_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 // mark columns for php sorting (no real mySQL columns)
 $liste["phpsort"] = array('used_sort', 'files');
@@ -50,27 +50,27 @@ $liste["phpsort"] = array('used_sort', 'files');
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "system_user",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "system_user",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+
+?>
diff --git a/interface/web/sites/list/web_aliasdomain.list.php b/interface/web/sites/list/web_aliasdomain.list.php
index a6921565dadf7430d10a83a0753ad5c2c85391a9..713cfc0ca2aa3fbd47414c91196c654bfb7f1cea 100644
--- a/interface/web/sites/list/web_aliasdomain.list.php
+++ b/interface/web/sites/list/web_aliasdomain.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_aliasdomain";
+$liste["name"]     = "web_aliasdomain";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_aliasdomain_list.php";
+$liste["file"]    = "web_aliasdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_aliasdomain_edit.php";
+$liste["edit_file"]   = "web_aliasdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_aliasdomain_del.php";
+$liste["delete_file"]  = "web_aliasdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,58 +48,58 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/web_domain.list.php b/interface/web/sites/list/web_domain.list.php
index 8f98f6e13269ebe5db1ad7db455567f4eacba96f..a455f54d3c9e3a5171a8171a638c98a2773e260f 100644
--- a/interface/web/sites/list/web_domain.list.php
+++ b/interface/web/sites/list/web_domain.list.php
@@ -14,103 +14,103 @@
 
 // Name of the list
 if($_SESSION['s']['user']['typ'] == 'admin') {
-	$liste["name"] 				= "web_domain_admin";
+	$liste["name"]     = "web_domain_admin";
 } else {
-	$liste["name"] 				= "web_domain";
+	$liste["name"]     = "web_domain";
 }
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_domain_list.php";
+$liste["file"]    = "web_domain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_domain_edit.php";
+$liste["edit_file"]   = "web_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_domain_del.php";
+$liste["delete_file"]  = "web_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "domain_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "domain_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 if($_SESSION['s']['user']['typ'] == 'admin') {
-$liste["item"][] = array(	'field'		=> "sys_groupid",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
-														'keyfield'=> 'groupid',
-														'valuefield'=> 'name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
+	$liste["item"][] = array( 'field'  => "sys_groupid",
+		'datatype' => "INTEGER",
+		'formtype' => "SELECT",
+		'op'  => "=",
+		'prefix' => "",
+		'suffix' => "",
+		'datasource' => array (  'type' => 'SQL',
+			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'keyfield'=> 'groupid',
+			'valuefield'=> 'name'
+		),
+		'width'  => "",
+		'value'  => "");
 }
-	
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "INTEGER",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT a.server_id, a.server_name FROM server a, web_domain b WHERE (a.server_id = b.server_id) AND ({AUTHSQL-B}) ORDER BY a.server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/web_folder.list.php b/interface/web/sites/list/web_folder.list.php
index dfcb3799d735160698a653d0649792181c0cd613..aa23fac6734749edb9b6b58376b693a3feee5bf3 100644
--- a/interface/web/sites/list/web_folder.list.php
+++ b/interface/web/sites/list/web_folder.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_folder";
+$liste["name"]     = "web_folder";
 
 // Database table
-$liste["table"] 			= "web_folder";
+$liste["table"]    = "web_folder";
 
 // Index index field of the database table
-$liste["table_idx"]			= "web_folder_id";
+$liste["table_idx"]   = "web_folder_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_folder_list.php";
+$liste["file"]    = "web_folder_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_folder_edit.php";
+$liste["edit_file"]   = "web_folder_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_folder_del.php";
+$liste["delete_file"]  = "web_folder_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,55 +48,55 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "path",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE (type = 'vhost' OR type = 'vhostsubdomain') AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "path",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/web_folder_user.list.php b/interface/web/sites/list/web_folder_user.list.php
index f2843660d33f704af4d484650549b44e105ef59e..04a8513526f704c0269fa5f9dc08fe455b2a7580 100644
--- a/interface/web/sites/list/web_folder_user.list.php
+++ b/interface/web/sites/list/web_folder_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_folder_user";
+$liste["name"]     = "web_folder_user";
 
 // Database table
-$liste["table"] 			= "web_folder_user";
+$liste["table"]    = "web_folder_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "web_folder_user_id";
+$liste["table_idx"]   = "web_folder_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_folder_user_list.php";
+$liste["file"]    = "web_folder_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_folder_user_edit.php";
+$liste["edit_file"]   = "web_folder_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_folder_user_del.php";
+$liste["delete_file"]  = "web_folder_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 $auth_sql = $app->tform->getAuthSQL('r', 'web_domain');
 
@@ -50,41 +50,41 @@ $auth_sql = $app->tform->getAuthSQL('r', 'web_domain');
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "web_folder_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "Select concat(web_domain.domain,' ',web_folder.path) as name, web_folder.web_folder_id from web_domain, web_folder WHERE web_domain.domain_id = web_folder.parent_domain_id AND ".$auth_sql." ORDER BY web_domain.domain",
-										'keyfield'=> 'web_folder_id',
-										'valuefield'=> 'name'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "web_folder_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "Select concat(web_domain.domain,' ',web_folder.path) as name, web_folder.web_folder_id from web_domain, web_folder WHERE web_domain.domain_id = web_folder.parent_domain_id AND ".$auth_sql." ORDER BY web_domain.domain",
+		'keyfield'=> 'web_folder_id',
+		'valuefield'=> 'name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/web_sites_stats.list.php b/interface/web/sites/list/web_sites_stats.list.php
index 8539c7e55669018cd73174ece016f44f24ec5140..25afcc4eb5deccb4247cb4fd0e834dd586ff7af1 100644
--- a/interface/web/sites/list/web_sites_stats.list.php
+++ b/interface/web/sites/list/web_sites_stats.list.php
@@ -13,51 +13,51 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_sites_stats";
+$liste["name"]     = "web_sites_stats";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_sites_stats.php";
+$liste["file"]    = "web_sites_stats.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_domain_edit.php";
+$liste["edit_file"]   = "web_domain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_domain_del.php";
+$liste["delete_file"]  = "web_domain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/list/web_subdomain.list.php b/interface/web/sites/list/web_subdomain.list.php
index 637de0e14e77ce4899650733ca30b54a9deae947..2a47d77c2071f96fb1b73660e39e41ccc02c3c79 100644
--- a/interface/web/sites/list/web_subdomain.list.php
+++ b/interface/web/sites/list/web_subdomain.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_subdomain";
+$liste["name"]     = "web_subdomain";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_subdomain_list.php";
+$liste["file"]    = "web_subdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_subdomain_edit.php";
+$liste["edit_file"]   = "web_subdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_subdomain_del.php";
+$liste["delete_file"]  = "web_subdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,58 +48,58 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/web_vhost_subdomain.list.php b/interface/web/sites/list/web_vhost_subdomain.list.php
index 192613c298a3dade41ced5958b02215c58dc1cc2..975814d099454cd88853b92bae89c95660457d44 100644
--- a/interface/web/sites/list/web_vhost_subdomain.list.php
+++ b/interface/web/sites/list/web_vhost_subdomain.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "web_vhost_subdomain";
+$liste["name"]     = "web_vhost_subdomain";
 
 // Database table
-$liste["table"] 			= "web_domain";
+$liste["table"]    = "web_domain";
 
 // Index index field of the database table
-$liste["table_idx"]			= "domain_id";
+$liste["table_idx"]   = "domain_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "web_vhost_subdomain_list.php";
+$liste["file"]    = "web_vhost_subdomain_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "web_vhost_subdomain_edit.php";
+$liste["edit_file"]   = "web_vhost_subdomain_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "web_vhost_subdomain_del.php";
+$liste["delete_file"]  = "web_vhost_subdomain_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,58 +48,58 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "domain",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "domain",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/list/webdav_user.list.php b/interface/web/sites/list/webdav_user.list.php
index 6211a2fba767adafd1536a0a2727073be151afe1..339bc0d1e19945896d4a4d2b690e0bfbe02ee605 100644
--- a/interface/web/sites/list/webdav_user.list.php
+++ b/interface/web/sites/list/webdav_user.list.php
@@ -13,34 +13,34 @@
 
 
 // Name of the list
-$liste["name"] 				= "webdav_user";
+$liste["name"]     = "webdav_user";
 
 // Database table
-$liste["table"] 			= "webdav_user";
+$liste["table"]    = "webdav_user";
 
 // Index index field of the database table
-$liste["table_idx"]			= "webdav_user_id";
+$liste["table_idx"]   = "webdav_user_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= "15";
+$liste["records_per_page"]  = "15";
 
 // Script File of the list
-$liste["file"]				= "webdav_user_list.php";
+$liste["file"]    = "webdav_user_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "webdav_user_edit.php";
+$liste["edit_file"]   = "webdav_user_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "webdav_user_del.php";
+$liste["delete_file"]  = "webdav_user_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
@@ -48,52 +48,52 @@ $liste["auth"]				= "yes";
 *****************************************************/
 
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>",'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "parent_domain_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
-										'keyfield'=> 'domain_id',
-										'valuefield'=> 'domain'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "username",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id,server_name FROM server WHERE {AUTHSQL} ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "parent_domain_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
+		'keyfield'=> 'domain_id',
+		'valuefield'=> 'domain'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "username",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/sites/shell_user_del.php b/interface/web/sites/shell_user_del.php
index c6c0cdd4cb564654c2c575c6e2b60434d68a9ace..1df8c321a9f742df28bb4f22202b211e566ea317 100644
--- a/interface/web/sites/shell_user_del.php
+++ b/interface/web/sites/shell_user_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/shell_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('sites');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index a18dd8e555e1a37b8c1f7e635d52cfca9b42625c..24ef09307b8854dde69ab82f597c9053b4ad1c49 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/shell_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,10 +49,10 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_shell_user')) {
@@ -62,7 +62,7 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_shell_user_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
 
@@ -72,18 +72,18 @@ class page_action extends tform_actions {
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		
+
 		$app->uses('getconf,tools_sites');
 		$global_config = $app->getconf->get_global_config('sites');
 		$shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
-		
+
 		if ($this->dataRecord['username'] != ""){
 			/* REMOVE the restriction */
 			$app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $shelluser_prefix));
 		}
-        
-        $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $shelluser_prefix, $global_config['shelluser_prefix']));
-		
+
+		$app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $shelluser_prefix, $global_config['shelluser_prefix']));
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -94,13 +94,13 @@ class page_action extends tform_actions {
 
 		parent::onShowEnd();
 	}
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		//$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        //if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+		//if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 		if(isset($this->dataRecord["parent_domain_id"])) {
 			$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
 			if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
@@ -110,20 +110,20 @@ class page_action extends tform_actions {
 			if(!$parent_domain) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 			unset($tmp);
 		}
-		
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
 		if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'./')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
-		
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], '..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], './')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
+
 		if(isset($this->dataRecord['ssh_rsa'])) $this->dataRecord['ssh_rsa'] = trim($this->dataRecord['ssh_rsa']);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
 
@@ -135,45 +135,45 @@ class page_action extends tform_actions {
 			}
 		}
 		unset($blacklist);
-		
+
 		/*
 		 * If the names should be restricted -> do it!
 		 */
 		if ($app->tform->errorMessage == ''){
-			
+
 			$app->uses('getconf,tools_sites');
 			$global_config = $app->getconf->get_global_config('sites');
 			$shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
-			
-            $this->dataRecord['username_prefix'] = $shelluser_prefix;
+
+			$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();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"]));
 		$server_id = $web["server_id"];
 		$dir = $web["document_root"];
 		$puser = $web["system_user"];
 		$pgroup = $web["system_group"];
-		
+
 		// The FTP user shall be owned by the same group then the website
 		$sys_groupid = $web['sys_groupid'];
-		
+
 		$sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$puser', pgroup = '$pgroup', sys_groupid = '$sys_groupid' WHERE shell_user_id = ".$this->id;
 		$app->db->query($sql);
-		
+
 	}
-	
+
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
-		
+
 		// check if the username is not blacklisted
 		$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
 		foreach($blacklist as $line) {
@@ -193,26 +193,27 @@ class page_action extends tform_actions {
 			$app->uses('getconf,tools_sites');
 			$global_config = $app->getconf->get_global_config('sites');
 			$shelluser_prefix = $app->tools_sites->replacePrefix($global_config['shelluser_prefix'], $this->dataRecord);
-			
-            $old_record = $app->tform->getDataRecord($this->id);
-            $shelluser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $shelluser_prefix);
-            $this->dataRecord['username_prefix'] = $shelluser_prefix;
-            
+
+			$old_record = $app->tform->getDataRecord($this->id);
+			$shelluser_prefix = $app->tools_sites->getPrefix($old_record['username_prefix'], $shelluser_prefix);
+			$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");
 		}
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
-		
+
+
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/shell_user_list.php b/interface/web/sites/shell_user_list.php
index cba130c56dde5b01b2fe62b4acb6f74a4f0f8d4c..8a47ebc0f4ef7b8c675fcf0e1fe52d47b2d2c57a 100644
--- a/interface/web/sites/shell_user_list.php
+++ b/interface/web/sites/shell_user_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -53,4 +53,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY shell_user.username';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/user_quota_stats.php b/interface/web/sites/user_quota_stats.php
index 32aa7066b24e7ad714483671bddbdbfafe20ee30..aed8e2260651117690afd5f2f2bab1ee895ef9fb 100644
--- a/interface/web/sites/user_quota_stats.php
+++ b/interface/web/sites/user_quota_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -23,30 +23,30 @@ $tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type
 $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'])));
+		$monitor_data = array_merge_recursive($monitor_data, unserialize($app->db->unquote($tmp_mon['data'])));
 	}
 }
 
 
 class list_action extends listform_actions {
-	
+
 	function prepareDataRow($rec)
-    {
-		global $app,$monitor_data;
-		
+	{
+		global $app, $monitor_data;
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
 		$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'];
-		
+
 		if (!is_numeric($rec['used'])){
 			if ($rec['used'][0] > $rec['used'][1]){
 				$rec['used'] = $rec['used'][0];
@@ -57,42 +57,43 @@ class list_action extends listform_actions {
 		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];
-		
+
 		if($rec['used'] > 1024) {
-			$rec['used'] = round($rec['used'] / 1024,2).' MB';
+			$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';
+			$rec['soft'] = round($rec['soft'] / 1024, 2).' MB';
 		} else {
 			$rec['soft'] .= ' KB';
 		}
-		
+
 		if($rec['hard'] > 1024) {
-			$rec['hard'] = round($rec['hard'] / 1024,2).' MB';
+			$rec['hard'] = round($rec['hard'] / 1024, 2).' MB';
 		} else {
 			$rec['hard'] .= ' KB';
 		}
-		
+
 		if($rec['soft'] == " KB") $rec['soft'] = $app->lng('unlimited');
 		if($rec['hard'] == " KB") $rec['hard'] = $app->lng('unlimited');
-		
-		
+
+
 		/*
 		if(!strstr($rec['used'],'M') && !strstr($rec['used'],'K')) $rec['used'].= ' B';
 		if(!strstr($rec['soft'],'M') && !strstr($rec['soft'],'K')) $rec['soft'].= ' B';
 		if(!strstr($rec['hard'],'M') && !strstr($rec['hard'],'K')) $rec['hard'].= ' B';
 		*/
-		
+
 		if($rec['soft'] == '0 B' || $rec['soft'] == '0 KB' || $rec['soft'] == '0') $rec['soft'] = $app->lng('unlimited');
 		if($rec['hard'] == '0 B' || $rec['hard'] == '0 KB' || $rec['hard'] == '0') $rec['hard'] = $app->lng('unlimited');
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
 		return $rec;
 	}
+
 }
 
 $list = new list_action;
@@ -101,4 +102,4 @@ $list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_aliasdomain_del.php b/interface/web/sites/web_aliasdomain_del.php
index bb3973694b3f33c1c3ac49fb1f21782448606b34..6793eba2fc4660f72b23768b7f2005b2ba67fa4a 100644
--- a/interface/web/sites/web_aliasdomain_del.php
+++ b/interface/web/sites/web_aliasdomain_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/web_aliasdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('sites');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php
index 1d05a5e8ff9ec76c5fcb99d4e56f2980ca10ee15..5dbcb12db84f1d9fb99885ac27c341aed44f3a9f 100644
--- a/interface/web/sites/web_aliasdomain_edit.php
+++ b/interface/web/sites/web_aliasdomain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/web_aliasdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,28 +49,28 @@ $app->uses('tpl,tform,tform_actions,tools_sites');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	var $parent_domain_record;
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_aliasdomain',"type = 'alias'")) {
+			if(!$app->tform->checkClientLimit('limit_web_aliasdomain', "type = 'alias'")) {
 				$app->error($app->tform->wordbook["limit_web_aliasdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_aliasdomain',"type = 'alias'")) {
+			if(!$app->tform->checkResellerLimit('limit_web_aliasdomain', "type = 'alias'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_aliasdomain_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		/*
 		 * Now we have to check, if we should use the domain-module to select the domain
 		 * or not
@@ -101,11 +101,11 @@ class page_action extends tform_actions {
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
+			$app->tpl->setVar("domain_option", $domain_select);
 		}
-		
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
-			// Directive Snippets		
+			// Directive Snippets
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
@@ -114,78 +114,78 @@ class page_action extends tform_actions {
 				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
-		
+
 		parent::onShowEnd();
-		
+
 	}
 
 	function onSubmit() {
 		global $app, $conf;
-		
-        /* check if the domain module is used - and check if the selected domain can be used! */
+
+		/* check if the domain module is used - and check if the selected domain can be used! */
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
-            $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
-            if(!$domain_check) {
-                // invalid domain selected
-                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-            } else {
-                $this->dataRecord['domain'] = $domain_check;
-            }
-        }
-		
+			$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+			if(!$domain_check) {
+				// invalid domain selected
+				$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+			} else {
+				$this->dataRecord['domain'] = $domain_check;
+			}
+		}
+
 		// nginx: if redirect type is proxy and redirect path is no URL, display error
-		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
+		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'], 0, 1) == '/'){
 			$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
 		}
-        
+
 		// Get the record of the parent domain
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-		
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'alias';
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
 		//$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-		
+
 		$this->parent_domain_record = $parent_domain;
-		
+
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-		
+
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Check if parent domain has been changed
 		if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) {
-			
+
 			//* Update the domain owner
 			$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-			
+
 			//* Update the old website, so that the vhost alias gets removed
 			//* We force the update by inserting a transaction record without changes manually.
 			$old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$this->oldDataRecord['domain_id']);
-            $app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
+			$app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_aliasdomain_list.php b/interface/web/sites/web_aliasdomain_list.php
index c5e63bed56c21aad5d241d2a4dc0d40bc9e47faf..e99e0ce0f617a9bf5da3873d59ecdde43cd480e9 100644
--- a/interface/web/sites/web_aliasdomain_list.php
+++ b/interface/web/sites/web_aliasdomain_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_domain_del.php b/interface/web/sites/web_domain_del.php
index cefb0ec41364cd0795d49ff64d876f320d99b01c..f451813ccbc82a14f96a0ee5c821f5a12bae7f34 100644
--- a/interface/web/sites/web_domain_del.php
+++ b/interface/web/sites/web_domain_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/web_domain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -52,45 +52,45 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		//* Delete all records that belong to this web.
 		$records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE parent_domain_id = '".$app->functions->intval($this->id)."' AND type != 'vhost'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('web_domain','domain_id',$rec['domain_id']);
+			$app->db->datalogDelete('web_domain', 'domain_id', $rec['domain_id']);
 		}
-		
+
 		//* Delete all records that belong to this web.
 		$records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('ftp_user','ftp_user_id',$rec['ftp_user_id']);
+			$app->db->datalogDelete('ftp_user', 'ftp_user_id', $rec['ftp_user_id']);
 		}
-		
+
 		//* Delete all records that belong to this web.
 		$records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('shell_user','shell_user_id',$rec['shell_user_id']);
+			$app->db->datalogDelete('shell_user', 'shell_user_id', $rec['shell_user_id']);
+		}
+
+		//* Delete all records that belong to this web.
+		$records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogDelete('cron', 'id', $rec['id']);
 		}
-        
-        //* Delete all records that belong to this web.
-        $records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogDelete('cron','id',$rec['id']);
-        }
-		
+
 		//* Delete all records that belong to this web
-        $records = $app->db->queryAllRecords("SELECT webdav_user_id FROM webdav_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogDelete('webdav_user','webdav_user_id',$rec['webdav_user_id']);
-        }
-		
+		$records = $app->db->queryAllRecords("SELECT webdav_user_id FROM webdav_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogDelete('webdav_user', 'webdav_user_id', $rec['webdav_user_id']);
+		}
+
 		//* Delete all records that belong to this web
-        $records = $app->db->queryAllRecords("SELECT backup_id FROM web_backup WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            $app->db->datalogDelete('web_backup','backup_id',$rec['backup_id']);
-        }
-		
+		$records = $app->db->queryAllRecords("SELECT backup_id FROM web_backup WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			$app->db->datalogDelete('web_backup', 'backup_id', $rec['backup_id']);
+		}
+
 		//* Delete all records that belog to this web.
 		$web_domain = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
 		if($web_domain['domain'] != ''){
@@ -98,27 +98,28 @@ class page_action extends tform_actions {
 			if(is_array($aps_instances) && !empty($aps_instances)){
 				foreach($aps_instances as $aps_instance){
 					if($aps_instance['instance_id'] > 0){
-						$app->db->datalogDelete('aps_instances_settings','instance_id',$aps_instance['instance_id']);
-						$app->db->datalogDelete('aps_instances','id',$aps_instance['instance_id']);
+						$app->db->datalogDelete('aps_instances_settings', 'instance_id', $aps_instance['instance_id']);
+						$app->db->datalogDelete('aps_instances', 'id', $aps_instance['instance_id']);
 					}
 				}
 			}
 		}
-		
+
 		//* Delete all web folders
-        $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            //* Delete all web folder users
+		$records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			//* Delete all web folder users
 			$records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$rec['web_folder_id']."'");
 			foreach($records2 as $rec2) {
-				$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec2['web_folder_user_id']);
-        }
-			$app->db->datalogDelete('web_folder','web_folder_id',$rec['web_folder_id']);
-        }
+				$app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec2['web_folder_user_id']);
+			}
+			$app->db->datalogDelete('web_folder', 'web_folder_id', $rec['web_folder_id']);
+		}
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index ee3b2558e94dfae4ed9613cb9823e56735343480..29ed9080518b31b229b52ccea79521b2a58b855c 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/web_domain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -51,7 +51,7 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 
 	//* Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -62,35 +62,35 @@ class page_action extends tform_actions {
 		}
 		return $hash;
 	}
-	
+
 	function onShowNew() {
 		global $app, $conf;
 
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_domain',"type = 'vhost'")) {
+			if(!$app->tform->checkClientLimit('limit_web_domain', "type = 'vhost'")) {
 				$app->error($app->tform->wordbook["limit_web_domain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_domain',"type = 'vhost'")) {
+			if(!$app->tform->checkResellerLimit('limit_web_domain', "type = 'vhost'")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_domain_txt"]);
 			}
-			
+
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 			$app->tpl->setVar("server_id_value", $client['default_webserver']);
 		}
-        $app->tform->formDef['tabs']['domain']['readonly'] = false;
+		$app->tform->formDef['tabs']['domain']['readonly'] = false;
 
 		parent::onShowNew();
 	}
 
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$app->uses('ini_parser,getconf');
 
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
 
 		//* Client: If the logged in user is not admin and has no sub clients (no reseller)
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -98,13 +98,13 @@ class page_action extends tform_actions {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.limit_web_domain, client.default_webserver, 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');
-			
+
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".intval($client['default_webserver']));
-			$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
@@ -118,10 +118,10 @@ class page_action extends tform_actions {
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ip_address",$ip_select);
+			$app->tpl->setVar("ip_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//* Fill the IPv6 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 			$ips = $app->db->queryAllRecords($sql);
@@ -133,10 +133,10 @@ class page_action extends tform_actions {
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ipv6_address",$ip_select);
+			$app->tpl->setVar("ipv6_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -159,26 +159,26 @@ class page_action extends tform_actions {
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
 
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
 			//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 			// 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(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');
-			
+
 			// Set the webserver to the default server of the client
 			$tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = ".intval($client['default_webserver']));
-			$app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+			$app->tpl->setVar("server_id", "<option value='$client[default_webserver]'>$tmp[server_name]</option>");
 			unset($tmp);
 
 			// Fill the client select field
@@ -196,7 +196,7 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
+			$app->tpl->setVar("client_group_id", $client_select);
 
 			//* Fill the IPv4 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
@@ -209,10 +209,10 @@ class page_action extends tform_actions {
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ip_address",$ip_select);
+			$app->tpl->setVar("ip_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//* Fill the IPv6 select field with the IP addresses that are allowed for this client
 			$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".intval($client['default_webserver'])." AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 			$ips = $app->db->queryAllRecords($sql);
@@ -224,10 +224,10 @@ class page_action extends tform_actions {
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ipv6_address",$ip_select);
+			$app->tpl->setVar("ipv6_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -253,60 +253,60 @@ class page_action extends tform_actions {
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
-            
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            $sites_config = $app->getconf->get_global_config('sites');
-            if($sites_config['reseller_can_use_options']) {
-                // Directive Snippets
-                $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
-                $php_directive_snippets_txt = '';
-                if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
-                        foreach($php_directive_snippets as $php_directive_snippet){
-                            $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
-                        }
-                }
-                if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
-                $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-                
-                if($server_type == 'apache'){
-                    $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
-                    $apache_directive_snippets_txt = '';
-                    if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
-                            foreach($apache_directive_snippets as $apache_directive_snippet){
-                                $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
-                            }
-                    }
-                    if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
-                    $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
-                }
-                
-                if($server_type == 'nginx'){
-                    $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
-                    $nginx_directive_snippets_txt = '';
-                    if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
-                            foreach($nginx_directive_snippets as $nginx_directive_snippet){
-                                $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
-                            }
-                    }
-                    if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
-                    $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
-                }
-                
-                $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
-                $proxy_directive_snippets_txt = '';
-                if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
-                        foreach($proxy_directive_snippets as $proxy_directive_snippet){
-                            $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
-                        }
-                }
-                if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-                $app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
-            }
-            
+
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+			$sites_config = $app->getconf->get_global_config('sites');
+			if($sites_config['reseller_can_use_options']) {
+				// Directive Snippets
+				$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
+				$php_directive_snippets_txt = '';
+				if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
+					foreach($php_directive_snippets as $php_directive_snippet){
+						$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
+					}
+				}
+				if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
+				$app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt);
+
+				if($server_type == 'apache'){
+					$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
+					$apache_directive_snippets_txt = '';
+					if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
+						foreach($apache_directive_snippets as $apache_directive_snippet){
+							$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
+						}
+					}
+					if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
+					$app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt);
+				}
+
+				if($server_type == 'nginx'){
+					$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
+					$nginx_directive_snippets_txt = '';
+					if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
+						foreach($nginx_directive_snippets as $nginx_directive_snippet){
+							$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
+						}
+					}
+					if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
+					$app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt);
+				}
+
+				$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
+				$proxy_directive_snippets_txt = '';
+				if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
+					foreach($proxy_directive_snippets as $proxy_directive_snippet){
+						$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
+					}
+				}
+				if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
+				$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
+			}
+
 			//* Admin: If the logged in user is admin
 		} else {
 
@@ -323,10 +323,10 @@ class page_action extends tform_actions {
 				$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']);
 			}
-			
+
 			//* get global web config
 			$web_config = $app->getconf->get_server_config($server_id, 'web');
-		
+
 			//* Fill the IPv4 select field
 			$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv4' AND server_id = $server_id";
 			$ips = $app->db->queryAllRecords($sql);
@@ -338,10 +338,10 @@ class page_action extends tform_actions {
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ip_address",$ip_select);
+			$app->tpl->setVar("ip_address", $ip_select);
 			unset($tmp);
 			unset($ips);
-			
+
 			//* Fill the IPv6 select field
 			$sql = "SELECT ip_address FROM server_ip WHERE ip_type = 'IPv6' AND server_id = $server_id";
 			$ips = $app->db->queryAllRecords($sql);
@@ -353,7 +353,7 @@ class page_action extends tform_actions {
 					$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("ipv6_address",$ip_select);
+			$app->tpl->setVar("ipv6_address", $ip_select);
 			unset($tmp);
 			unset($ips);
 
@@ -372,8 +372,8 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-			
+			$app->tpl->setVar("client_group_id", $client_select);
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -399,67 +399,67 @@ class page_action extends tform_actions {
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
-            
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
-			
+
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
+
 			// Directive Snippets
 			$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
 			$php_directive_snippets_txt = '';
 			if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
-					foreach($php_directive_snippets as $php_directive_snippet){
-						$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
-					}
+				foreach($php_directive_snippets as $php_directive_snippet){
+					$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($php_directive_snippet['snippet']).'</pre></a> ';
+				}
 			}
 			if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
-			$app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-			
+			$app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt);
+
 			if($server_type == 'apache'){
 				$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
 				$apache_directive_snippets_txt = '';
 				if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
-						foreach($apache_directive_snippets as $apache_directive_snippet){
-							$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
-						}
+					foreach($apache_directive_snippets as $apache_directive_snippet){
+						$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($apache_directive_snippet['snippet']).'</pre></a> ';
+					}
 				}
 				if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
-				$app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
+				$app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt);
 			}
-			
+
 			if($server_type == 'nginx'){
 				$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
 				$nginx_directive_snippets_txt = '';
 				if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
-						foreach($nginx_directive_snippets as $nginx_directive_snippet){
-							$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
-						}
+					foreach($nginx_directive_snippets as $nginx_directive_snippet){
+						$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($nginx_directive_snippet['snippet']).'</pre></a> ';
+					}
 				}
 				if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
-				$app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
+				$app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt);
 			}
-			
+
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
-					foreach($proxy_directive_snippets as $proxy_directive_snippet){
-						$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
-					}
+				foreach($proxy_directive_snippets as $proxy_directive_snippet){
+					$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.htmlentities($proxy_directive_snippet['snippet']).'</pre></a> ';
+				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
 
 		$ssl_domain_select = '';
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
-		$ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"],'*.'.$tmp["domain"]);
+		$ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"], '*.'.$tmp["domain"]);
 		if(is_array($ssl_domains)) {
 			foreach( $ssl_domains as $ssl_domain) {
 				$selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
 				$ssl_domain_select .= "<option value='$ssl_domain' $selected>$ssl_domain</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("ssl_domain",$ssl_domain_select);
+		$app->tpl->setVar("ssl_domain", $ssl_domain_select);
 		unset($ssl_domain_select);
 		unset($ssl_domains);
 		unset($ssl_domain);
@@ -504,50 +504,50 @@ class page_action extends tform_actions {
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
+			$app->tpl->setVar("domain_option", $domain_select);
 		}
-		
+
 		// check for configuration errors in sys_datalog
 		if($this->id > 0) {
 			$datalog = $app->db->queryOneRecord("SELECT sys_datalog.error, sys_log.tstamp FROM sys_datalog, sys_log WHERE sys_datalog.dbtable = 'web_domain' AND sys_datalog.dbidx = 'domain_id:".$this->id."' AND sys_datalog.datalog_id = sys_log.datalog_id AND sys_log.message = CONCAT('Processed datalog_id ',sys_log.datalog_id) ORDER BY sys_datalog.tstamp DESC");
 			if(is_array($datalog) && !empty($datalog)){
 				if(trim($datalog['error']) != ''){
-					$app->tpl->setVar("config_error_msg",nl2br(htmlentities($datalog['error'])));
-					$app->tpl->setVar("config_error_tstamp",date($app->lng('conf_format_datetime'), $datalog['tstamp']));
+					$app->tpl->setVar("config_error_msg", nl2br(htmlentities($datalog['error'])));
+					$app->tpl->setVar("config_error_tstamp", date($app->lng('conf_format_datetime'), $datalog['tstamp']));
 				}
 			}
 		}
 
 		parent::onShowEnd();
 	}
-    
-    function onShowEdit() {
-        global $app;
-        if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false;
-        parent::onShowEdit();
-    }
+
+	function onShowEdit() {
+		global $app;
+		if($app->tform->checkPerm($this->id, 'riud')) $app->tform->formDef['tabs']['domain']['readonly'] = false;
+		parent::onShowEdit();
+	}
 
 	function onSubmit() {
 		global $app, $conf;
 
-        /* check if the domain module is used - and check if the selected domain can be used! */
+		/* check if the domain module is used - and check if the selected domain can be used! */
 		if($app->tform->getCurrentTab() == 'domain') {
-            $app->uses('ini_parser,getconf');
-            $settings = $app->getconf->get_global_config('domains');
-            if ($settings['use_domain_module'] == 'y') {
-                $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
-                if(!$domain_check) {
-                    // invalid domain selected
-                    $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-                } else {
-                    $this->dataRecord['domain'] = $domain_check;
-                }
-            }
-        }
-		
+			$app->uses('ini_parser,getconf');
+			$settings = $app->getconf->get_global_config('domains');
+			if ($settings['use_domain_module'] == 'y') {
+				$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['domain']);
+				if(!$domain_check) {
+					// invalid domain selected
+					$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+				} else {
+					$this->dataRecord['domain'] = $domain_check;
+				}
+			}
+		}
+
 		// nginx: if redirect type is proxy and redirect path is no URL, display error
 		//if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
-		//	$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
+		// $app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
 		//}
 
 		// Set a few fixed values
@@ -555,31 +555,31 @@ class page_action extends tform_actions {
 		$this->dataRecord["type"] = 'vhost';
 		$this->dataRecord["vhost_type"] = 'name';
 
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
 
 
 		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_traffic_quota, limit_web_domain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-            
-            if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
-            if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
-            if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
-            if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
-            if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
-            if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
-            if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
-            if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
-            if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
-			
+
+			if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
+			if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
+			if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
+			if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
+			if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
+			if($client['force_suexec'] == 'y') $this->dataRecord['suexec'] = 'y';
+			if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
+			if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
+			if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+
 			// only generate quota and traffic warnings if value has changed
 			if($this->id > 0) {
 				$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
 			} else {
 				$old_web_values = $_POST;
 			}
-            
+
 			//* Check the website quota of the client
 			if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) {
 				$tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'));
@@ -611,7 +611,7 @@ class page_action extends tform_actions {
 				unset($tmp);
 				unset($tmp_quota);
 			}
-			
+
 			if($client['parent_client_id'] > 0) {
 				// Get the limits of the reseller
 				$reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
@@ -654,18 +654,18 @@ class page_action extends tform_actions {
 				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
 				$this->dataRecord["server_id"] = $tmp["server_id"];
-                
-                // set the settings to current if not provided (or cleared due to limits)
-                if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
-                if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
-                if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
-                if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
-                if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
-                if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
-                if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
-                if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
-                if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
-                
+
+				// set the settings to current if not provided (or cleared due to limits)
+				if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
+				if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
+				if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
+				if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
+				if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
+				if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
+				if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
+				if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
+				if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
+
 				unset($tmp);
 				// When the record is inserted
 			} else {
@@ -685,10 +685,10 @@ class page_action extends tform_actions {
 			// Clients may not set the client_group_id, so we unset them if user is not a admin and the client is not a reseller
 			if(!$app->auth->has_clients($_SESSION['s']['user']['userid'])) unset($this->dataRecord["client_group_id"]);
 		}
-		
+
 		//* make sure that the email domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		//* get the server config for this server
 		$app->uses("getconf");
 		if($this->id > 0){
@@ -699,26 +699,26 @@ class page_action extends tform_actions {
 			$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');
+		$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;
 			$tmp = $app->db->queryOneRecord($sql);
 			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
 		}
-		
+
 		// Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
 		if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
 			if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
-		
+
 			} else {
 				$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;
@@ -731,7 +731,7 @@ class page_action extends tform_actions {
 			if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
 				foreach($rewrite_rule_lines as $rewrite_rule_line){
 					// ignore comments
-					if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
+					if(substr(ltrim($rewrite_rule_line), 0, 1) == '#') continue;
 					// empty lines
 					if(trim($rewrite_rule_line) == '') continue;
 					// rewrite
@@ -766,7 +766,7 @@ class page_action extends tform_actions {
 					break;
 				}
 			}
-			
+
 			if(!$rewrites_are_valid || $if_level != 0){
 				$app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
 			}
@@ -792,12 +792,12 @@ class page_action extends tform_actions {
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-		$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
-		$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_form->id,1),$document_root);
-		$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_form->id,1),$document_root);
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
+		$document_root = str_replace("[website_id]", $this->id, $web_config["website_path"]);
+		$document_root = str_replace("[website_idhash_1]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_2]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_3]", $this->id_hash($page_form->id, 1), $document_root);
+		$document_root = str_replace("[website_idhash_4]", $this->id_hash($page_form->id, 1), $document_root);
 
 		// get the ID of the client
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -813,14 +813,14 @@ class page_action extends tform_actions {
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote('web'.$this->id);
 		$system_group = $app->db->quote('client'.$client_id);
-		$document_root = str_replace("[client_id]",$client_id,$document_root);
-		$document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
-		$document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
-		$document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
-		$document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
+		$document_root = str_replace("[client_id]", $client_id, $document_root);
+		$document_root = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root);
+		$document_root = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root);
+		$document_root = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root);
+		$document_root = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root);
 		$document_root = $app->db->quote($document_root);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($web_config["htaccess_allow_override"]);
 
 		$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
@@ -846,17 +846,17 @@ class page_action extends tform_actions {
 		} else {
 			//* We do not allow users to change a domain which has been created by the admin
 			$rec = $app->db->queryOneRecord("SELECT sys_perm_group, domain, ip_address, ipv6_address from web_domain WHERE domain_id = ".$this->id);
-			if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id,'u')) {
+			if(isset($this->dataRecord["domain"]) && $rec['domain'] != $this->dataRecord["domain"] && $app->tform->checkPerm($this->id, 'u')) {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Domain can not be changed. Please ask your Administrator if you want to change the domain name.');
 				$this->dataRecord["domain"] = $rec['domain'];
 			}
 			if(isset($this->dataRecord["ip_address"]) && $rec['ip_address'] != $this->dataRecord["ip_address"] && $rec['sys_perm_group'] != 'riud') {
-                $this->dataRecord["ip_address"] = $rec['ip_address'];
-            }
+				$this->dataRecord["ip_address"] = $rec['ip_address'];
+			}
 			if(isset($this->dataRecord["ipv6_address"]) && $rec['ipv6_address'] != $this->dataRecord["ipv6_address"] && $rec['sys_perm_group'] != 'riud') {
-                $this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
-            }
+				$this->dataRecord["ipv6_address"] = $rec['ipv6_address'];
+			}
 			unset($rec);
 		}
 
@@ -868,7 +868,7 @@ class page_action extends tform_actions {
 			if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />';
 			if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />';
 		}
-		
+
 		if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
 			if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'<br />';
 		}
@@ -892,13 +892,13 @@ class page_action extends tform_actions {
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-		$document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]);
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
+		$document_root = str_replace("[website_id]", $this->id, $web_config["website_path"]);
 		$page_formid = isset($page_form->id) ? $page_form->id : '';
-		$document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root);
-		$document_root = str_replace("[website_idhash_2]",$this->id_hash($page_formid,1),$document_root);
-		$document_root = str_replace("[website_idhash_3]",$this->id_hash($page_formid,1),$document_root);
-		$document_root = str_replace("[website_idhash_4]",$this->id_hash($page_formid,1),$document_root);
+		$document_root = str_replace("[website_idhash_1]", $this->id_hash($page_formid, 1), $document_root);
+		$document_root = str_replace("[website_idhash_2]", $this->id_hash($page_formid, 1), $document_root);
+		$document_root = str_replace("[website_idhash_3]", $this->id_hash($page_formid, 1), $document_root);
+		$document_root = str_replace("[website_idhash_4]", $this->id_hash($page_formid, 1), $document_root);
 
 		// get the ID of the client
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
@@ -919,11 +919,11 @@ class page_action extends tform_actions {
 			// Set the values for document_root, system_user and system_group
 			$system_user = $app->db->quote('web'.$this->id);
 			$system_group = $app->db->quote('client'.$client_id);
-			$document_root = str_replace("[client_id]",$client_id,$document_root);
-			$document_root = str_replace("[client_idhash_1]",$this->id_hash($client_id,1),$document_root);
-			$document_root = str_replace("[client_idhash_2]",$this->id_hash($client_id,2),$document_root);
-			$document_root = str_replace("[client_idhash_3]",$this->id_hash($client_id,3),$document_root);
-			$document_root = str_replace("[client_idhash_4]",$this->id_hash($client_id,4),$document_root);
+			$document_root = str_replace("[client_id]", $client_id, $document_root);
+			$document_root = str_replace("[client_idhash_1]", $this->id_hash($client_id, 1), $document_root);
+			$document_root = str_replace("[client_idhash_2]", $this->id_hash($client_id, 2), $document_root);
+			$document_root = str_replace("[client_idhash_3]", $this->id_hash($client_id, 3), $document_root);
+			$document_root = str_replace("[client_idhash_4]", $this->id_hash($client_id, 4), $document_root);
 			$document_root = $app->db->quote($document_root);
 
 			$sql = "UPDATE web_domain SET system_user = '$system_user', system_group = '$system_group', document_root = '$document_root' WHERE domain_id = ".$this->id;
@@ -945,24 +945,24 @@ class page_action extends tform_actions {
 			}
 			unset($records);
 			unset($rec);
-			
+
 			//* Update all subdomains and alias domains
 			$records = $app->db->queryAllRecords("SELECT domain_id, `domain`, `type`, `web_folder` FROM web_domain WHERE parent_domain_id = ".$this->id);
 			foreach($records as $rec) {
-                $update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
-                if($rec['type'] == 'vhostsubdomain') {
-                    $php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$rec['web_folder'],$web_config["php_open_basedir"]);
-                    $php_open_basedir = str_replace("[website_domain]/web",$rec['domain'].'/'.$rec['web_folder'],$php_open_basedir);
-                    $php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-                    $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$rec['domain'],$php_open_basedir));
-
-                    $update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'";
-                }
+				$update_columns = "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."'";
+				if($rec['type'] == 'vhostsubdomain') {
+					$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$rec['web_folder'], $web_config["php_open_basedir"]);
+					$php_open_basedir = str_replace("[website_domain]/web", $rec['domain'].'/'.$rec['web_folder'], $php_open_basedir);
+					$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+					$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $rec['domain'], $php_open_basedir));
+
+					$update_columns .= ", document_root = '".$document_root."', `php_open_basedir` = '".$php_open_basedir."'";
+				}
 				$app->db->datalogUpdate('web_domain', $update_columns, 'domain_id', $rec['domain_id']);
 			}
 			unset($records);
 			unset($rec);
-			
+
 			//* Update all databases
 			$records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE parent_domain_id = ".$this->id);
 			foreach($records as $rec) {
@@ -977,13 +977,13 @@ class page_action extends tform_actions {
 		if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
 			$records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
 			foreach($records as $rec) {
-				$subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"],$this->dataRecord["domain"],$rec['domain']));
+				$subdomain = $app->db->quote(str_replace($this->oldDataRecord["domain"], $this->dataRecord["domain"], $rec['domain']));
 				$app->db->datalogUpdate('web_domain', "domain = '".$subdomain."'", 'domain_id', $rec['domain_id']);
 			}
 			unset($records);
 			unset($rec);
 			unset($subdomain);
-			
+
 			// Update APS instances
 			$records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$this->oldDataRecord["domain"]."'");
 			if(is_array($records) && !empty($records)){
@@ -1002,24 +1002,24 @@ class page_action extends tform_actions {
 			$sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//* Set php_open_basedir if empty or domain or client has been changed
 		if(empty($web_rec['php_open_basedir']) ||
-		(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
+			(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"])) {
 			$php_open_basedir = $web_rec['php_open_basedir'];
-			$php_open_basedir = str_replace($this->oldDataRecord['domain'],$web_rec['domain'],$php_open_basedir);
+			$php_open_basedir = str_replace($this->oldDataRecord['domain'], $web_rec['domain'], $php_open_basedir);
 			$sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
 			$app->db->query($sql);
 		}
 		if(empty($web_rec['php_open_basedir']) ||
-		(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
-			$document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root));
-			$php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]);
-			$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+			(isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) {
+			$document_root = $app->db->quote(str_replace("[client_id]", $client_id, $document_root));
+			$php_open_basedir = str_replace("[website_path]", $document_root, $web_config["php_open_basedir"]);
+			$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 			$sql = "UPDATE web_domain SET php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id;
 			$app->db->query($sql);
 		}
-		
+
 		//* Change database backup options when web backup options have been changed
 		if(isset($this->dataRecord['backup_interval']) && ($this->dataRecord['backup_interval'] != $this->oldDataRecord['backup_interval'] || $this->dataRecord['backup_copies'] != $this->oldDataRecord['backup_copies'])) {
 			//* Update all databases
@@ -1034,16 +1034,16 @@ class page_action extends tform_actions {
 			unset($backup_copies);
 			unset($backup_interval);
 		}
-        
-        //* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
-        if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
+
+		//* Change vhost subdomain ip/ipv6 if domain ip/ipv6 has changed
+		if(isset($this->dataRecord['ip_address']) && ($this->dataRecord['ip_address'] != $this->oldDataRecord['ip_address'] || $this->dataRecord['ipv6_address'] != $this->oldDataRecord['ipv6_address'])) {
 			$records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".$this->id);
 			foreach($records as $rec) {
 				$app->db->datalogUpdate('web_domain', "ip_address = '".$web_rec['ip_address']."', ipv6_address = '".$web_rec['ipv6_address']."'", 'domain_id', $rec['domain_id']);
 			}
 			unset($records);
 			unset($rec);
-        }
+		}
 	}
 
 	function onAfterDelete() {
@@ -1054,7 +1054,7 @@ class page_action extends tform_actions {
 		foreach($child_domains as $d) {
 			// Saving record to datalog when db_history enabled
 			if($app->tform->formDef["db_history"] == 'yes') {
-				$app->tform->datalogSave('DELETE',$d["domain_id"],$d,array());
+				$app->tform->datalogSave('DELETE', $d["domain_id"], $d, array());
 			}
 
 			$app->db->query("DELETE FROM web_domain WHERE domain_id = ".$d["domain_id"]." LIMIT 0,1");
@@ -1069,4 +1069,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_domain_list.php b/interface/web/sites/web_domain_list.php
index d9c50669ad35aeabd257932af58df75b6b13473f..301ec961a4e8332c6fa7d4c56f31aa0d78561b44 100644
--- a/interface/web/sites/web_domain_list.php
+++ b/interface/web/sites/web_domain_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,7 +48,7 @@ $app->load('listform_actions');
 
 
 class list_action extends listform_actions {
-	
+
 }
 
 $list = new list_action;
@@ -56,4 +56,4 @@ $list->SQLExtWhere = "web_domain.type = 'vhost' AND web_domain.parent_domain_id
 $list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_del.php b/interface/web/sites/web_folder_del.php
index 75f56f48bbcbc74766880320e86055d745f3a284..ec13c35a851cd09536687d91499aed635d37bed5 100644
--- a/interface/web/sites/web_folder_del.php
+++ b/interface/web/sites/web_folder_del.php
@@ -40,8 +40,8 @@ $tform_def_file = "form/web_folder.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -52,19 +52,20 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 	function onBeforeDelete() {
 		global $app; $conf;
-		
-		if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
-		
+
+		if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
+
 		// Delete all users that belong to this folder.
 		$records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($this->id)."'");
 		foreach($records as $rec) {
-			$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']);
+			$app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec['web_folder_user_id']);
 		}
 		unset($records);
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_edit.php b/interface/web/sites/web_folder_edit.php
index 2f888a12a2ce9c143e69fbae2228943822a978eb..d3235df7f13578266767c41fe002ff9d4c7d987f 100644
--- a/interface/web/sites/web_folder_edit.php
+++ b/interface/web/sites/web_folder_edit.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/web_folder.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -53,20 +53,20 @@ class page_action extends tform_actions {
 
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-		
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_list.php b/interface/web/sites/web_folder_list.php
index 08322bcac30fe1647ef8b597ae808742f5752602..80159be3b54c1065040c3dd347b3924ec42c1ebc 100644
--- a/interface/web/sites/web_folder_list.php
+++ b/interface/web/sites/web_folder_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_user_del.php b/interface/web/sites/web_folder_user_del.php
index 3ecff3323b263578ded11d5c22639d4e0c0ec1f7..4db302e2c844a6c1ed8cd543d2c8daa008664d24 100644
--- a/interface/web/sites/web_folder_user_del.php
+++ b/interface/web/sites/web_folder_user_del.php
@@ -40,8 +40,8 @@ $tform_def_file = "form/web_folder_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -56,4 +56,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_user_edit.php b/interface/web/sites/web_folder_user_edit.php
index c67e8230cff5a0dc47cc737a7f077877d03be21f..ce4663e71617d30c7d3a744d6dddd1d2ba70f756 100644
--- a/interface/web/sites/web_folder_user_edit.php
+++ b/interface/web/sites/web_folder_user_edit.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/web_folder_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -50,22 +50,23 @@ $app->uses('tpl,tform,tform_actions,validate_cron');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onSubmit() {
 		global $app, $conf;
-		
+
 		// Get the record of the parent domain
 		$folder = $app->db->queryOneRecord("select * FROM web_folder WHERE web_folder_id = ".$app->functions->intval(@$this->dataRecord["web_folder_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$folder || $folder['web_folder_id'] != @$this->dataRecord['web_folder_id']) $app->tform->errorMessage .= $app->tform->lng("no_folder_perm");
-		
+		if(!$folder || $folder['web_folder_id'] != @$this->dataRecord['web_folder_id']) $app->tform->errorMessage .= $app->tform->lng("no_folder_perm");
+
 		// Set a few fixed values
 		$this->dataRecord["server_id"] = $folder["server_id"];
-		
+
 		parent::onSubmit();
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_folder_user_list.php b/interface/web/sites/web_folder_user_list.php
index e5515c27820399aaee89cea4bfa137b8b7472417..7879c708c92a2ba6b19fc917a53c85888d437920 100644
--- a/interface/web/sites/web_folder_user_list.php
+++ b/interface/web/sites/web_folder_user_list.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -20,4 +20,4 @@ $app->uses('listform_actions');
 $app->listform_actions->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 6249b68130c862714be67f9f6c9a714e7eab7fac..cc7d4e61f723bc79af843c93bb00236344e1a2e3 100644
--- a/interface/web/sites/web_sites_stats.php
+++ b/interface/web/sites/web_sites_stats.php
@@ -1,6 +1,6 @@
 <?php
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -18,68 +18,68 @@ $app->auth->check_module_permissions('sites');
 $app->load('listform_actions');
 
 class list_action extends listform_actions {
-	
+
 	private $sum_this_month = 0;
 	private $sum_this_year = 0;
 	private $sum_last_month = 0;
 	private $sum_last_year = 0;
-	
+
 	function prepareDataRow($rec)
-    {
+	{
 		global $app;
-		
+
 		$rec = $app->listform->decode($rec);
 
 		//* Alternating datarow colors
 		$this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF';
 		$rec['bgcolor'] = $this->DataRowColor;
-		
+
 		//* Set the statistics colums
 		//** Traffic of the current month
 		$tmp_year = date('Y');
-        $tmp_month = date('m');
+		$tmp_month = date('m');
 		$tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'");
 		$rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_this_month += ($tmp_rec['t']/1024/1024);
-		
+
 		//** Traffic of the current year
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year'");
 		$rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_this_year += ($tmp_rec['t']/1024/1024);
-		
+
 		//** Traffic of the 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")));
+		$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")));
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'");
 		$rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_last_month += ($tmp_rec['t']/1024/1024);
-		
+
 		//** Traffic of the last year
-		$tmp_year = date('Y',mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
+		$tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1));
 		$tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$rec['domain']."' AND YEAR(traffic_date) = '$tmp_year'");
 		$rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' ');
 		$this->sum_last_year += ($tmp_rec['t']/1024/1024);
-		
+
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];
-		
+
 		return $rec;
 	}
-	
+
 	function onShowEnd()
-    {
+	{
 		global $app;
-		
-		$app->tpl->setVar('sum_this_month',number_format($app->functions->intval($this->sum_this_month), 0, '.', ' '));
-		$app->tpl->setVar('sum_this_year',number_format($app->functions->intval($this->sum_this_year), 0, '.', ' '));
-		$app->tpl->setVar('sum_last_month',number_format($app->functions->intval($this->sum_last_month), 0, '.', ' '));
-		$app->tpl->setVar('sum_last_year',number_format($app->functions->intval($this->sum_last_year), 0, '.', ' '));
-		$app->tpl->setVar('sum_txt',$app->listform->lng('sum_txt'));
-		
+
+		$app->tpl->setVar('sum_this_month', number_format($app->functions->intval($this->sum_this_month), 0, '.', ' '));
+		$app->tpl->setVar('sum_this_year', number_format($app->functions->intval($this->sum_this_year), 0, '.', ' '));
+		$app->tpl->setVar('sum_last_month', number_format($app->functions->intval($this->sum_last_month), 0, '.', ' '));
+		$app->tpl->setVar('sum_last_year', number_format($app->functions->intval($this->sum_last_year), 0, '.', ' '));
+		$app->tpl->setVar('sum_txt', $app->listform->lng('sum_txt'));
+
 		$app->tpl_defaults();
 		$app->tpl->pparse();
 	}
-	
+
 	function getQueryString() {
 		global $app;
 		$sql_where = '';
@@ -89,68 +89,68 @@ class list_action extends listform_actions {
 			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';
+				$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);
+		$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;
-		  }
+			$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; 
+			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']);
@@ -165,6 +165,7 @@ class list_action extends listform_actions {
 		$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;
@@ -173,4 +174,4 @@ $list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_subdomain_del.php b/interface/web/sites/web_subdomain_del.php
index be43b38a6d67a8d73f69604cbd3d9e07d7d7eee4..18e7e52dbce7f180ea6a428904bdf2cffe6fee92 100644
--- a/interface/web/sites/web_subdomain_del.php
+++ b/interface/web/sites/web_subdomain_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/web_subdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -48,4 +48,4 @@ $app->auth->check_module_permissions('sites');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php
index 3475ed5c0ad7698433f5c879c1cf23b2f2f23c4d..1e5bfa7f0e5d572ccbb2d78660c21c5b720f8b63 100644
--- a/interface/web/sites/web_subdomain_edit.php
+++ b/interface/web/sites/web_subdomain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/web_subdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -49,28 +49,28 @@ $app->uses('tpl,tform,tform_actions,tools_sites');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	var $parent_domain_record;
-	
+
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkClientLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkResellerLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
@@ -79,14 +79,14 @@ class page_action extends tform_actions {
 			*/
 			$domains = $app->tools_sites->getDomainModuleDomains();
 			$domain_select = '';
-            $selected_domain = '';
+			$selected_domain = '';
 			if(is_array($domains) && sizeof($domains) > 0) {
 				/* We have domains in the list, so create the drop-down-list */
 				foreach( $domains as $domain) {
 					$domain_select .= "<option value=" . $domain['domain_id'] ;
 					if ('.' . $domain['domain'] == substr($this->dataRecord["domain"], -strlen($domain['domain']) - 1)) {
 						$domain_select .= " selected";
-                        $selected_domain = $domain['domain'];
+						$selected_domain = $domain['domain'];
 					}
 					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
@@ -99,20 +99,20 @@ class page_action extends tform_actions {
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
-            $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
+			$app->tpl->setVar("domain_option", $domain_select);
+			$this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
 		} else {
-        
-            // Get the record of the parent domain
-            $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
-            
-            // remove the parent domain part of the domain name before we show it in the text field.
-            $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
-        }
-        $app->tpl->setVar("domain",$this->dataRecord["domain"]);
-		
+
+			// Get the record of the parent domain
+			$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+
+			// remove the parent domain part of the domain name before we show it in the text field.
+			$this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]);
+		}
+		$app->tpl->setVar("domain", $this->dataRecord["domain"]);
+
 		if($_SESSION["s"]["user"]["typ"] == 'admin') {
-			// Directive Snippets		
+			// Directive Snippets
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
@@ -121,78 +121,78 @@ class page_action extends tform_actions {
 				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
-		
+
 		parent::onShowEnd();
-		
+
 	}
 
 	function onSubmit() {
 		global $app, $conf;
-		
-        // Get the record of the parent domain
-        $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
-        
+
+		// Get the record of the parent domain
+		$parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+
 		$app->uses('ini_parser,getconf');
 		$settings = $app->getconf->get_global_config('domains');
 		if ($settings['use_domain_module'] == 'y') {
-            // get the record of the domain module domain
-            $domain = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
-            if(!$domain) {
-                $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-            } else {
-                $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain;
-            }
-        } else {
-            $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-        }
-		
+			// get the record of the domain module domain
+			$domain = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
+			if(!$domain) {
+				$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+			} else {
+				$this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain;
+			}
+		} else {
+			$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+		}
+
 		// nginx: if redirect type is proxy and redirect path is no URL, display error
-		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'],0,1) == '/'){
+		if($this->dataRecord["redirect_type"] == 'proxy' && substr($this->dataRecord['redirect_path'], 0, 1) == '/'){
 			$app->tform->errorMessage .= $app->tform->lng("error_proxy_requires_url")."<br />";
 		}
-        
+
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'subdomain';
 		$this->dataRecord["server_id"] = $parent_domain["server_id"];
-		
+
 		$this->parent_domain_record = $parent_domain;
-		
+
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		parent::onSubmit();
 	}
-	
+
 	function onAfterInsert() {
 		global $app, $conf;
-		
+
 		$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-		
+
 	}
-	
+
 	function onAfterUpdate() {
 		global $app, $conf;
-		
+
 		//* Check if parent domain has been changed
 		if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) {
-			
+
 			//* Update the domain owner
 			$app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id);
-			
+
 			//* Update the old website, so that the vhost alias gets removed
 			//* We force the update by inserting a transaction record without changes manually.
 			$old_website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = '.$this->oldDataRecord['domain_id']);
-            $app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
+			$app->db->datalogSave('web_domain', 'UPDATE', 'domain_id', $this->oldDataRecord['parent_domain_id'], $old_website, $old_website, true);
 		}
-		
+
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_subdomain_list.php b/interface/web/sites/web_subdomain_list.php
index f14d7b39c938eeafc22b5026f6e6f4554575a264..716511e63e4dd2757a4f4936553ad5381883cb17 100644
--- a/interface/web/sites/web_subdomain_list.php
+++ b/interface/web/sites/web_subdomain_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_vhost_subdomain_del.php b/interface/web/sites/web_vhost_subdomain_del.php
index 9d3609bf890501b8efb879fa8b59264c4ba51ca7..04987e625e599640ded5e8025eb07bbd672a6518 100644
--- a/interface/web/sites/web_vhost_subdomain_del.php
+++ b/interface/web/sites/web_vhost_subdomain_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/web_vhost_subdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -51,22 +51,23 @@ class page_action extends tform_actions {
 
 	function onBeforeDelete() {
 		global $app; $conf;
-		
+
 		//* Delete all web folders
-        $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
-        foreach($records as $rec) {
-            //* Delete all web folder users
+		$records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'");
+		foreach($records as $rec) {
+			//* Delete all web folder users
 			$records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$rec['web_folder_id']."'");
 			foreach($records2 as $rec2) {
-				$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec2['web_folder_user_id']);
-        }
-			$app->db->datalogDelete('web_folder','web_folder_id',$rec['web_folder_id']);
-        }
+				$app->db->datalogDelete('web_folder_user', 'web_folder_user_id', $rec2['web_folder_user_id']);
+			}
+			$app->db->datalogDelete('web_folder', 'web_folder_id', $rec['web_folder_id']);
+		}
 
 	}
+
 }
 
 $page = new page_action;
 $page->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index 27a4d398713b0a1859680356b2100088cbb41a8d..48ac56dc2f6cb5e488760239e3c009380d456d96 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/web_vhost_subdomain.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -51,7 +51,7 @@ $app->load('tform_actions');
 class page_action extends tform_actions {
 
 	//* Returna a "3/2/1" path hash from a numeric id '123'
-	function id_hash($id,$levels) {
+	function id_hash($id, $levels) {
 		$hash = "" . $id % 10 ;
 		$id /= 10 ;
 		$levels -- ;
@@ -62,16 +62,16 @@ class page_action extends tform_actions {
 		}
 		return $hash;
 	}
-	
+
 	function onShowNew() {
 		global $app, $conf;
 
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
-			if(!$app->tform->checkClientLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkClientLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error($app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
-			if(!$app->tform->checkResellerLimit('limit_web_subdomain',"(type = 'subdomain' OR type = 'vhostsubdomain')")) {
+			if(!$app->tform->checkResellerLimit('limit_web_subdomain', "(type = 'subdomain' OR type = 'vhostsubdomain')")) {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_web_subdomain_txt"]);
 			}
 		}
@@ -80,20 +80,20 @@ class page_action extends tform_actions {
 
 	function onShowEnd() {
 		global $app, $conf;
-		
+
 		$app->uses('ini_parser,getconf');
 
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-		
-        $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
-        
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]));
+
 		//* Client: If the logged in user is not admin and has no sub clients (no reseller)
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
 			$client = $app->db->queryOneRecord("SELECT client.limit_web_subdomain, client.default_webserver, 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');
 
@@ -119,23 +119,23 @@ class page_action extends tform_actions {
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
 
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+
 			//* Reseller: If the logged in user is not admin and has sub clients (is a reseller)
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 
 			// 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(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');
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -158,66 +158,66 @@ class page_action extends tform_actions {
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
-            
-            // add limits to template to be able to hide settings
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
-            
-            $sites_config = $app->getconf->get_global_config('sites');
-            if($sites_config['reseller_can_use_options']) {
-                // Directive Snippets
-                $php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
-                $php_directive_snippets_txt = '';
-                if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
-                        foreach($php_directive_snippets as $php_directive_snippet){
-                            $php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
-                        }
-                }
-                if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
-                $app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-                
-                if($server_type == 'apache'){
-                    $apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
-                    $apache_directive_snippets_txt = '';
-                    if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
-                            foreach($apache_directive_snippets as $apache_directive_snippet){
-                                $apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
-                            }
-                    }
-                    if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
-                    $app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
-                }
-                
-                if($server_type == 'nginx'){
-                    $nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
-                    $nginx_directive_snippets_txt = '';
-                    if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
-                            foreach($nginx_directive_snippets as $nginx_directive_snippet){
-                                $nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
-                            }
-                    }
-                    if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
-                    $app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
-                }
-                
-                $proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
-                $proxy_directive_snippets_txt = '';
-                if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
-                        foreach($proxy_directive_snippets as $proxy_directive_snippet){
-                            $proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
-                        }
-                }
-                if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-                $app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
-            }
-            
+
+			// add limits to template to be able to hide settings
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, $client[$limit]);
+
+			$sites_config = $app->getconf->get_global_config('sites');
+			if($sites_config['reseller_can_use_options']) {
+				// Directive Snippets
+				$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
+				$php_directive_snippets_txt = '';
+				if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
+					foreach($php_directive_snippets as $php_directive_snippet){
+						$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
+					}
+				}
+				if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
+				$app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt);
+
+				if($server_type == 'apache'){
+					$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
+					$apache_directive_snippets_txt = '';
+					if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
+						foreach($apache_directive_snippets as $apache_directive_snippet){
+							$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
+						}
+					}
+					if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
+					$app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt);
+				}
+
+				if($server_type == 'nginx'){
+					$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
+					$nginx_directive_snippets_txt = '';
+					if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
+						foreach($nginx_directive_snippets as $nginx_directive_snippet){
+							$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
+						}
+					}
+					if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
+					$app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt);
+				}
+
+				$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
+				$proxy_directive_snippets_txt = '';
+				if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
+					foreach($proxy_directive_snippets as $proxy_directive_snippet){
+						$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
+					}
+				}
+				if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
+				$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
+			}
+
 			//* Admin: If the logged in user is admin
 		} else {
 
 			//* get global web config
 			$web_config = $app->getconf->get_server_config($parent_domain['server_id'], 'web');
-			
+
 			//PHP Version Selection (FastCGI)
 			$server_type = 'apache';
 			if(!empty($web_config['server_type'])) $server_type = $web_config['server_type'];
@@ -240,76 +240,76 @@ class page_action extends tform_actions {
 					$php_select .= "<option value='$php_version' $selected>".$php_record['name']."</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("fastcgi_php_version",$php_select);
+			$app->tpl->setVar("fastcgi_php_version", $php_select);
 			unset($php_records);
 
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
-			
+			foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
+
 			// Directive Snippets
 			$php_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'php' AND active = 'y'");
 			$php_directive_snippets_txt = '';
 			if(is_array($php_directive_snippets) && !empty($php_directive_snippets)){
-					foreach($php_directive_snippets as $php_directive_snippet){
-						$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
-					}
+				foreach($php_directive_snippets as $php_directive_snippet){
+					$php_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$php_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$php_directive_snippet['snippet'].'</pre></a> ';
+				}
 			}
 			if($php_directive_snippets_txt == '') $php_directive_snippets_txt = '------';
-			$app->tpl->setVar("php_directive_snippets_txt",$php_directive_snippets_txt);
-			
+			$app->tpl->setVar("php_directive_snippets_txt", $php_directive_snippets_txt);
+
 			if($server_type == 'apache'){
 				$apache_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'apache' AND active = 'y'");
 				$apache_directive_snippets_txt = '';
 				if(is_array($apache_directive_snippets) && !empty($apache_directive_snippets)){
-						foreach($apache_directive_snippets as $apache_directive_snippet){
-							$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
-						}
+					foreach($apache_directive_snippets as $apache_directive_snippet){
+						$apache_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$apache_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$apache_directive_snippet['snippet'].'</pre></a> ';
+					}
 				}
 				if($apache_directive_snippets_txt == '') $apache_directive_snippets_txt = '------';
-				$app->tpl->setVar("apache_directive_snippets_txt",$apache_directive_snippets_txt);
+				$app->tpl->setVar("apache_directive_snippets_txt", $apache_directive_snippets_txt);
 			}
-			
+
 			if($server_type == 'nginx'){
 				$nginx_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'nginx' AND active = 'y'");
 				$nginx_directive_snippets_txt = '';
 				if(is_array($nginx_directive_snippets) && !empty($nginx_directive_snippets)){
-						foreach($nginx_directive_snippets as $nginx_directive_snippet){
-							$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
-						}
+					foreach($nginx_directive_snippets as $nginx_directive_snippet){
+						$nginx_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$nginx_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$nginx_directive_snippet['snippet'].'</pre></a> ';
+					}
 				}
 				if($nginx_directive_snippets_txt == '') $nginx_directive_snippets_txt = '------';
-				$app->tpl->setVar("nginx_directive_snippets_txt",$nginx_directive_snippets_txt);
+				$app->tpl->setVar("nginx_directive_snippets_txt", $nginx_directive_snippets_txt);
 			}
-			
+
 			$proxy_directive_snippets = $app->db->queryAllRecords("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y'");
 			$proxy_directive_snippets_txt = '';
 			if(is_array($proxy_directive_snippets) && !empty($proxy_directive_snippets)){
-					foreach($proxy_directive_snippets as $proxy_directive_snippet){
-						$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
-					}
+				foreach($proxy_directive_snippets as $proxy_directive_snippet){
+					$proxy_directive_snippets_txt .= '<a href="javascript:void(0);" class="addPlaceholderContent">['.$proxy_directive_snippet['name'].']<pre class="addPlaceholderContent" style="display:none;">'.$proxy_directive_snippet['snippet'].'</pre></a> ';
+				}
 			}
 			if($proxy_directive_snippets_txt == '') $proxy_directive_snippets_txt = '------';
-			$app->tpl->setVar("proxy_directive_snippets_txt",$proxy_directive_snippets_txt);
+			$app->tpl->setVar("proxy_directive_snippets_txt", $proxy_directive_snippets_txt);
 		}
 
 		$ssl_domain_select = '';
 		$tmp = $app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".$this->id);
-		$ssl_domains = array($tmp["domain"],'www.'.$tmp["domain"]);
+		$ssl_domains = array($tmp["domain"], 'www.'.$tmp["domain"]);
 		if(is_array($ssl_domains)) {
 			foreach( $ssl_domains as $ssl_domain) {
 				$selected = ($ssl_domain == $this->dataRecord['ssl_domain'])?'SELECTED':'';
 				$ssl_domain_select .= "<option value='$ssl_domain' $selected>$ssl_domain</option>\r\n";
 			}
 		}
-        
-        if($this->id > 0) {
-            $app->tpl->setVar('fixed_folder', 'y');
-            $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
-        } else {
-            $app->tpl->setVar('fixed_folder', 'n');
-            $app->tpl->setVar('server_id_value', $parent_domain['server_id']);
-        }
-        
-		$app->tpl->setVar("ssl_domain",$ssl_domain_select);
+
+		if($this->id > 0) {
+			$app->tpl->setVar('fixed_folder', 'y');
+			$app->tpl->setVar('server_id_value', $parent_domain['server_id']);
+		} else {
+			$app->tpl->setVar('fixed_folder', 'n');
+			$app->tpl->setVar('server_id_value', $parent_domain['server_id']);
+		}
+
+		$app->tpl->setVar("ssl_domain", $ssl_domain_select);
 		unset($ssl_domain_select);
 		unset($ssl_domains);
 		unset($ssl_domain);
@@ -324,16 +324,16 @@ class page_action extends tform_actions {
 			/*
 			 * The domain-module is in use.
 			*/
-            $domains = $app->tools_sites->getDomainModuleDomains();
+			$domains = $app->tools_sites->getDomainModuleDomains();
 			$domain_select = '';
-            $selected_domain = '';
+			$selected_domain = '';
 			if(is_array($domains) && sizeof($domains) > 0) {
 				/* We have domains in the list, so create the drop-down-list */
 				foreach( $domains as $domain) {
 					$domain_select .= "<option value=" . $domain['domain_id'] ;
 					if ('.' . $domain['domain'] == substr($this->dataRecord["domain"], -strlen($domain['domain']) - 1)) {
 						$domain_select .= " selected";
-                        $selected_domain = $domain['domain'];
+						$selected_domain = $domain['domain'];
 					}
 					$domain_select .= ">" . $app->functions->idn_decode($domain['domain']) . "</option>\r\n";
 				}
@@ -346,30 +346,30 @@ class page_action extends tform_actions {
 				*/
 				$domain_select .= "<option value=''></option>\r\n";
 			}
-			$app->tpl->setVar("domain_option",$domain_select);
-            $this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
+			$app->tpl->setVar("domain_option", $domain_select);
+			$this->dataRecord['domain'] = substr($this->dataRecord["domain"], 0, strlen($this->dataRecord['domain']) - strlen($selected_domain) - 1);
 		} else {
-        
-            // remove the parent domain part of the domain name before we show it in the text field.
-            $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]);
-        }
-        $app->tpl->setVar("domain",$this->dataRecord["domain"]);
+
+			// remove the parent domain part of the domain name before we show it in the text field.
+			$this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"], '', $this->dataRecord["domain"]);
+		}
+		$app->tpl->setVar("domain", $this->dataRecord["domain"]);
 
 		parent::onShowEnd();
 	}
-    
+
 	function onSubmit() {
 		global $app, $conf;
 
 		// Get the record of the parent domain
-        if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
-            $tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
-            if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
-            unset($tmp);
-        }
-        
+		if(!@$this->dataRecord["parent_domain_id"] && $this->id) {
+			$tmp = $app->db->queryOneRecord("SELECT parent_domain_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
+			if($tmp) $this->dataRecord["parent_domain_id"] = $tmp['parent_domain_id'];
+			unset($tmp);
+		}
+
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 
 		// Set a few fixed values
 		$this->dataRecord["type"] = 'vhostsubdomain';
@@ -380,67 +380,67 @@ class page_action extends tform_actions {
 		$this->dataRecord["vhost_type"] = 'name';
 
 		$this->parent_domain_record = $parent_domain;
-        
-        $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-        
-        if($app->tform->getCurrentTab() == 'domain') {
-            
-            /* check if the domain module is used - and check if the selected domain can be used! */
-            $app->uses('ini_parser,getconf');
-            $settings = $app->getconf->get_global_config('domains');
-            if ($settings['use_domain_module'] == 'y') {
-                $domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
-                if(!$domain_check) {
-                    // invalid domain selected
-                    $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
-                } else {
-                    $this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
-                }
-            } else {
-                $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-            }
-            
-            
-            $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
+
+		$read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
+
+		if($app->tform->getCurrentTab() == 'domain') {
+
+			/* check if the domain module is used - and check if the selected domain can be used! */
+			$app->uses('ini_parser,getconf');
+			$settings = $app->getconf->get_global_config('domains');
+			if ($settings['use_domain_module'] == 'y') {
+				$domain_check = $app->tools_sites->checkDomainModuleDomain($this->dataRecord['sel_domain']);
+				if(!$domain_check) {
+					// invalid domain selected
+					$app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."<br />";
+				} else {
+					$this->dataRecord['domain'] = $this->dataRecord['domain'] . '.' . $domain_check;
+				}
+			} else {
+				$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+			}
+
+
+			$this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
 			if(substr($this->dataRecord['web_folder'], 0, 1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 1);
 			if(substr($this->dataRecord['web_folder'], -1) === '/') $this->dataRecord['web_folder'] = substr($this->dataRecord['web_folder'], 0, -1);
-            $forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav');
-            $check_folder = strtolower($this->dataRecord['web_folder']);
-            if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries
-            if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it
-            if(in_array($check_folder, $forbidden_folders)) {
-                $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>";
-            }
-			
+			$forbidden_folders = array('', 'cgi-bin', 'log', 'private', 'ssl', 'tmp', 'webdav');
+			$check_folder = strtolower($this->dataRecord['web_folder']);
+			if(substr($check_folder, 0, 1) === '/') $check_folder = substr($check_folder, 1); // strip / at beginning to check against forbidden entries
+			if(strpos($check_folder, '/') !== false) $check_folder = substr($check_folder, 0, strpos($check_folder, '/')); // get the first part of the path to check it
+			if(in_array($check_folder, $forbidden_folders)) {
+				$app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>";
+			}
+
 			// vhostsubdomains do not have a quota of their own
 			$this->dataRecord["hd_quota"] = 0;
-			
-            // check for duplicate folder usage
+
+			// check for duplicate folder usage
 			/*
             $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . $app->functions->intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . $app->functions->intval($this->id) . "'");
             if($check && $check['cnt'] > 0) {
                 $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."<br>";
             }
 			*/
-        } else {
-            $this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
-        }
-        
+		} else {
+			$this->dataRecord["domain"] = $this->dataRecord["domain"].'.'.$parent_domain["domain"];
+		}
+
 		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_traffic_quota, limit_web_subdomain, default_webserver, parent_client_id, limit_web_quota, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-            
-            if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
-            if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
-            if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
-            if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
-            if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
-            if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
-            if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
-            if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
-            if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
-			
+
+			if($client['limit_cgi'] != 'y') $this->dataRecord['cgi'] = '-';
+			if($client['limit_ssi'] != 'y') $this->dataRecord['ssi'] = '-';
+			if($client['limit_perl'] != 'y') $this->dataRecord['perl'] = '-';
+			if($client['limit_ruby'] != 'y') $this->dataRecord['ruby'] = '-';
+			if($client['limit_python'] != 'y') $this->dataRecord['python'] = '-';
+			if($client['force_suexec'] != 'n') $this->dataRecord['suexec'] = 'y';
+			if($client['limit_hterror'] != 'y') $this->dataRecord['errordocs'] = '-';
+			if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
+			if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
+
 			// only generate quota and traffic warnings if value has changed
 			if($this->id > 0) {
 				$old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
@@ -463,7 +463,7 @@ class page_action extends tform_actions {
 				unset($tmp);
 				unset($tmp_quota);
 			}
-			
+
 			if($client['parent_client_id'] > 0) {
 				// Get the limits of the reseller
 				$reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
@@ -487,21 +487,21 @@ class page_action extends tform_actions {
 
 			// When the record is updated
 			if($this->id > 0) {
-                // restore the server ID if the user is not admin and record is edited
+				// restore the server ID if the user is not admin and record is edited
 				$tmp = $app->db->queryOneRecord("SELECT server_id, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
-                $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
-                
-                // set the settings to current if not provided (or cleared due to limits)
-                if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
-                if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
-                if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
-                if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
-                if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
-                if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
-                if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
-                if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
-                if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
-                
+				$this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed!
+
+				// set the settings to current if not provided (or cleared due to limits)
+				if($this->dataRecord['cgi'] == '-') $this->dataRecord['cgi'] = $tmp['cgi'];
+				if($this->dataRecord['ssi'] == '-') $this->dataRecord['ssi'] = $tmp['ssi'];
+				if($this->dataRecord['perl'] == '-') $this->dataRecord['perl'] = $tmp['perl'];
+				if($this->dataRecord['ruby'] == '-') $this->dataRecord['ruby'] = $tmp['ruby'];
+				if($this->dataRecord['python'] == '-') $this->dataRecord['python'] = $tmp['python'];
+				if($this->dataRecord['suexec'] == '-') $this->dataRecord['suexec'] = $tmp['suexec'];
+				if($this->dataRecord['errordocs'] == '-') $this->dataRecord['errordocs'] = $tmp['errordocs'];
+				if($this->dataRecord['subdomain'] == '-') $this->dataRecord['subdomain'] = $tmp['subdomain'];
+				if($this->dataRecord['ssl'] == '-') $this->dataRecord['ssl'] = $tmp['ssl'];
+
 				unset($tmp);
 				// When the record is inserted
 			} else {
@@ -514,32 +514,32 @@ class page_action extends tform_actions {
 				}
 			}
 		}
-		
+
 		//* make sure that the domain is lowercase
 		if(isset($this->dataRecord["domain"])) $this->dataRecord["domain"] = strtolower($this->dataRecord["domain"]);
-		
+
 		//* 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');
+		$web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0), '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;
 			$tmp = $app->db->queryOneRecord($sql);
 			if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("error_no_sni_txt");
 		}
-		
+
 		// Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0
 		if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') {
 			if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){
-		
+
 			} else {
 				$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;
@@ -552,7 +552,7 @@ class page_action extends tform_actions {
 			if(is_array($rewrite_rule_lines) && !empty($rewrite_rule_lines)){
 				foreach($rewrite_rule_lines as $rewrite_rule_line){
 					// ignore comments
-					if(substr(ltrim($rewrite_rule_line),0,1) == '#') continue;
+					if(substr(ltrim($rewrite_rule_line), 0, 1) == '#') continue;
 					// empty lines
 					if(trim($rewrite_rule_line) == '') continue;
 					// rewrite
@@ -587,7 +587,7 @@ class page_action extends tform_actions {
 					break;
 				}
 			}
-			
+
 			if(!$rewrites_are_valid || $if_level != 0){
 				$app->tform->errorMessage .= $app->tform->lng("invalid_rewrite_rules_txt").'<br>';
 			}
@@ -602,16 +602,16 @@ class page_action extends tform_actions {
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
-        //var_dump($this->parent_domain_record, $web_rec);
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
+		//var_dump($this->parent_domain_record, $web_rec);
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote($this->parent_domain_record['system_user']);
 		$system_group = $app->db->quote($this->parent_domain_record['system_group']);
 		$document_root = $app->db->quote($this->parent_domain_record['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]);
+		$php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir);
+		$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
 
 		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
@@ -629,7 +629,7 @@ class page_action extends tform_actions {
 			if($this->dataRecord['ssl_organisation_unit'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_organisation_unit_empty').'<br />';
 			if($this->dataRecord['ssl_country'] == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_country_empty').'<br />';
 		}
-		
+
 		if(isset($this->dataRecord['ssl_action']) && $this->dataRecord['ssl_action'] == 'save') {
 			if(trim($this->dataRecord['ssl_cert']) == '') $app->tform->errorMessage .= $app->tform->lng('error_ssl_cert_empty').'<br />';
 		}
@@ -642,16 +642,16 @@ class page_action extends tform_actions {
 		// Get configuration for the web system
 		$app->uses("getconf");
 		$web_rec = $app->tform->getDataRecord($this->id);
-		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web');
+		$web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]), 'web');
 
 		// Set the values for document_root, system_user and system_group
 		$system_user = $app->db->quote($this->parent_domain_record['system_user']);
 		$system_group = $app->db->quote($this->parent_domain_record['system_group']);
 		$document_root = $app->db->quote($this->parent_domain_record['document_root']);
-		$php_open_basedir = str_replace("[website_path]/web",$document_root.'/'.$web_rec['web_folder'],$web_config["php_open_basedir"]);
-		$php_open_basedir = str_replace("[website_domain]/web",$web_rec['domain'].'/'.$web_rec['web_folder'],$php_open_basedir);
-		$php_open_basedir = str_replace("[website_path]",$document_root,$php_open_basedir);
-		$php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir));
+		$php_open_basedir = str_replace("[website_path]/web", $document_root.'/'.$web_rec['web_folder'], $web_config["php_open_basedir"]);
+		$php_open_basedir = str_replace("[website_domain]/web", $web_rec['domain'].'/'.$web_rec['web_folder'], $php_open_basedir);
+		$php_open_basedir = str_replace("[website_path]", $document_root, $php_open_basedir);
+		$php_open_basedir = $app->db->quote(str_replace("[website_domain]", $web_rec['domain'], $php_open_basedir));
 		$htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']);
 
 		$sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir'  WHERE domain_id = ".$this->id;
diff --git a/interface/web/sites/web_vhost_subdomain_list.php b/interface/web/sites/web_vhost_subdomain_list.php
index 0677a939fc7cc03113eb7d5414bd34cd8c2afec6..6f68d7bbf4fc14bd530f49d4a58081d37ad00852 100644
--- a/interface/web/sites/web_vhost_subdomain_list.php
+++ b/interface/web/sites/web_vhost_subdomain_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY web_domain.domain';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/webdav_user_del.php b/interface/web/sites/webdav_user_del.php
index ca92412ca8d777fceb1c54b32fbde48329e5a37a..040e7fef50d5fdc34a8b412b4a8af486f2b38677 100644
--- a/interface/web/sites/webdav_user_del.php
+++ b/interface/web/sites/webdav_user_del.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/webdav_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -47,4 +47,4 @@ $app->auth->check_module_permissions('sites');
 $app->uses("tform_actions");
 $app->tform_actions->onDelete();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/webdav_user_edit.php b/interface/web/sites/webdav_user_edit.php
index 377b00eb0abafa48a96100e7957b7f12d438b31f..97b2bcc8522a664abb62d6aebae52efe7e20114f 100644
--- a/interface/web/sites/webdav_user_edit.php
+++ b/interface/web/sites/webdav_user_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/webdav_user.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('sites');
@@ -80,9 +80,9 @@ class page_action extends tform_actions {
 			/* REMOVE the restriction */
 			$app->tpl->setVar("username", $app->tools_sites->removePrefix($this->dataRecord['username'], $this->dataRecord['username_prefix'], $webdavuser_prefix));
 		}
-        
-        $app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $webdavuser_prefix, $global_config['webdavuser_prefix']));
-		
+
+		$app->tpl->setVar("username_prefix", $app->tools_sites->getPrefix($this->dataRecord['username_prefix'], $webdavuser_prefix, $global_config['webdavuser_prefix']));
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -99,7 +99,7 @@ class page_action extends tform_actions {
 
 		/* Get the record of the parent domain */
 		$parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"]) . " AND ".$app->tform->getAuthSQL('r'));
-        if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
+		if(!$parent_domain || $parent_domain['domain_id'] != @$this->dataRecord['parent_domain_id']) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm");
 
 		/*
 		 * Set a few fixed values
@@ -111,9 +111,9 @@ class page_action extends tform_actions {
 		 */
 		if(isset($this->dataRecord['username']) && trim($this->dataRecord['username']) == '') $app->tform->errorMessage .= $app->tform->lng('username_error_empty').'<br />';
 		if(isset($this->dataRecord['username']) && empty($this->dataRecord['parent_domain_id'])) $app->tform->errorMessage .= $app->tform->lng('parent_domain_id_error_empty').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
-		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'],'./')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
-		
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], '..')) $app->tform->errorMessage .= $app->tform->lng('dir_dot_error').'<br />';
+		if(isset($this->dataRecord['dir']) && stristr($this->dataRecord['dir'], './')) $app->tform->errorMessage .= $app->tform->lng('dir_slashdot_error').'<br />';
+
 		parent::onSubmit();
 	}
 
@@ -129,8 +129,8 @@ class page_action extends tform_actions {
 			$global_config = $app->getconf->get_global_config('sites');
 			$webdavuser_prefix = $app->tools_sites->replacePrefix($global_config['webdavuser_prefix'], $this->dataRecord);
 
-            $this->dataRecord['username_prefix'] = $webdavuser_prefix;
-            
+			$this->dataRecord['username_prefix'] = $webdavuser_prefix;
+
 			/* restrict the names */
 			$this->dataRecord['username'] = $webdavuser_prefix . $this->dataRecord['username'];
 
@@ -185,9 +185,10 @@ class page_action extends tform_actions {
 	function onAfterUpdate() {
 		global $app, $conf;
 	}
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/sites/webdav_user_list.php b/interface/web/sites/webdav_user_list.php
index b94157c7c40711411c766a75716f69f7243f91b6..2bd94ab2cb7e358f5cbec1dbed2abedb6336ce7a 100644
--- a/interface/web/sites/webdav_user_list.php
+++ b/interface/web/sites/webdav_user_list.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -48,4 +48,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY webdav_user.username';
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/dns_import_tupa.php b/interface/web/tools/dns_import_tupa.php
index fe931a79428ce2980d9ff2536d08a819ec4f5f3a..940a851fbeac571a4144bdbdcbfc4dce4c1ec893 100644
--- a/interface/web/tools/dns_import_tupa.php
+++ b/interface/web/tools/dns_import_tupa.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,42 +45,42 @@ $error = '';
 
 // Resyncing dns zones
 if(isset($_POST['start']) && $_POST['start'] == 1) {
-	
+
 	//* Set variable sin template
-	$app->tpl->setVar('dbhost',$_POST['dbhost']);
-	$app->tpl->setVar('dbname',$_POST['dbname']);
-	$app->tpl->setVar('dbuser',$_POST['dbuser']);
-	$app->tpl->setVar('dbpassword',$_POST['dbpassword']);
-	
+	$app->tpl->setVar('dbhost', $_POST['dbhost']);
+	$app->tpl->setVar('dbname', $_POST['dbname']);
+	$app->tpl->setVar('dbuser', $_POST['dbuser']);
+	$app->tpl->setVar('dbpassword', $_POST['dbpassword']);
+
 	//* Establish connection to external database
 	$msg .= 'Connecting to external database...<br />';
-	
+
 	//* Backup DB login details
 	/*$conf_bak['db_host'] = $conf['db_host'];
 	$conf_bak['db_database'] = $conf['db_database'];
 	$conf_bak['db_user'] = $conf['db_user'];
 	$conf_bak['db_password'] = $conf['db_password'];*/
-	
+
 	//* Set external Login details
 	$conf['imp_db_host'] = $_POST['dbhost'];
 	$conf['imp_db_database'] = $_POST['dbname'];
 	$conf['imp_db_user'] = $_POST['dbuser'];
 	$conf['imp_db_password'] = $_POST['dbpassword'];
-    $conf['imp_db_charset'] = $conf['db_charset'];
-    $conf['imp_db_new_link'] = $conf['db_new_link'];
-    $conf['imp_db_client_flags'] = $conf['db_client_flags'];
-	
+	$conf['imp_db_charset'] = $conf['db_charset'];
+	$conf['imp_db_new_link'] = $conf['db_new_link'];
+	$conf['imp_db_client_flags'] = $conf['db_client_flags'];
+
 	//* create new db object
 	$exdb = new db('imp');
-	
+
 	$server_id = 1;
 	$sys_userid = 1;
 	$sys_groupid = 1;
-	
+
 	function addot($text) {
 		return trim($text) . '.';
 	}
-	
+
 	//* Connect to DB
 	if($exdb !== false) {
 		$domains = $exdb->queryAllRecords("SELECT * FROM domains WHERE type = 'MASTER'");
@@ -88,7 +88,7 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
 			foreach($domains as $domain) {
 				$soa = $exdb->queryOneRecord("SELECT * FROM records WHERE type = 'SOA' AND domain_id = ".$domain['id']);
 				if(is_array($soa)) {
-					$parts = explode(' ',$soa['content']);
+					$parts = explode(' ', $soa['content']);
 					$origin = addot($soa['name']);
 					$ns = addot($parts[0]);
 					$mbox = addot($parts[1]);
@@ -98,62 +98,62 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
 					$expire = 604800;
 					$minimum = 86400;
 					$ttl = $soa['ttl'];
-					
+
 					$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `origin`, `ns`, `mbox`, `serial`, `refresh`, `retry`, `expire`, `minimum`, `ttl`, `active`, `xfer`) VALUES
 					('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$origin', '$ns', '$mbox', '$serial', '$refresh', '$retry', '$expire', '$minimum', '$ttl', 'Y', '')";
 					$dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id');
 					unset($parts);
 					$msg .= 'Import Zone: '.$soa['name'].'<br />';
-					
+
 					//* Process the other records
 					$records = $exdb->queryAllRecords("SELECT * FROM records WHERE type != 'SOA' AND domain_id = ".$domain['id']);
 					if(is_array($records)) {
 						foreach($records as $rec) {
 							$rr = array();
-							
+
 							$rr['name'] = addot($rec['name']);
 							$rr['type'] = $rec['type'];
 							$rr['aux'] = $rec['prio'];
 							$rr['ttl'] = $rec['ttl'];
-							
+
 							if($rec['type'] == 'NS' || $rec['type'] == 'MX' || $rec['type'] == 'CNAME') {
 								$rr['data'] = addot($rec['content']);
 							} else {
 								$rr['data'] = $rec['content'];
 							}
-							
+
 							$insert_data = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `zone`, `name`, `type`, `data`, `aux`, `ttl`, `active`) VALUES
 							('$sys_userid', '$sys_groupid', 'riud', 'riud', '', '$server_id', '$dns_soa_id', '$rr[name]', '$rr[type]', '$rr[data]', '$rr[aux]', '$rr[ttl]', 'Y')";
 							$dns_rr_id = $app->db->datalogInsert('dns_rr', $insert_data, 'id');
 							//$msg .= $insert_data.'<br />';
-							
+
 						}
 					}
 				}
-				
+
 			}
 		}
-		
-		
-		
+
+
+
 	} else {
 		$error .= $exdb->errorMessage;
 	}
-	
+
 	//* restore db login details
 	/*$conf['db_host'] = $conf_bak['db_host'];
 	$conf['db_database'] = $conf_bak['db_database'];
 	$conf['db_user'] = $conf_bak['db_user'];
 	$conf['db_password'] = $conf_bak['db_password'];*/
-	
+
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/form/interface_settings.tform.php b/interface/web/tools/form/interface_settings.tform.php
index c93da46a52a9819c5a35088b18a34a79ebf2ee26..f81ce2d1572ff259983b4639b81c98c6ab6e22e4 100644
--- a/interface/web/tools/form/interface_settings.tform.php
+++ b/interface/web/tools/form/interface_settings.tform.php
@@ -60,21 +60,21 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form['title'] 		= 'interface_head_txt';
-$form['description'] 	= 'interface_desc_txt';
-$form['name'] 		= 'interface';
-$form['action']		= 'interface_settings.php';
-$form['db_table']	= 'sys_user';
-$form['db_table_idx']	= 'userid';
-$form["db_history"]	= "no";
-$form['tab_default']	= 'main';
-$form['list_default']	= 'index.php';
-$form['auth']		= 'no'; //??
+$form['title']   = 'interface_head_txt';
+$form['description']  = 'interface_desc_txt';
+$form['name']   = 'interface';
+$form['action']  = 'interface_settings.php';
+$form['db_table'] = 'sys_user';
+$form['db_table_idx'] = 'userid';
+$form["db_history"] = "no";
+$form['tab_default'] = 'main';
+$form['list_default'] = 'index.php';
+$form['auth']  = 'no'; //??
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
@@ -85,8 +85,8 @@ $form['auth_preset']['perm_other'] = '';
 //* TODO: limit to activated modules of the user
 $modules_list = array();
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-	$handle = @opendir(ISPC_WEB_PATH); 
-	while ($file = @readdir ($handle)) { 
+	$handle = @opendir(ISPC_WEB_PATH);
+	while ($file = @readdir($handle)) {
 		if ($file != '.' && $file != '..') {
 			if(@is_dir(ISPC_WEB_PATH."/$file")) {
 				if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
@@ -102,7 +102,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') {
 	if($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
 		$modules .= ',client';
 	}
-	$tmp = explode(',',$modules);
+	$tmp = explode(',', $modules);
 	foreach($tmp as $m) {
 		$modules_list[$m] = $m;
 	}
@@ -110,66 +110,66 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
-} 
+}
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if(!file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") || (@file_exists(ISPC_THEMES_PATH."/$file/ispconfig_version") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ispconfig_version")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form['tabs']['main'] = array (
-	'title' 	=> 'Settings',
-	'width' 	=> 80,
-	'template' 	=> 'templates/interface_settings.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
-                'startmodule' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $modules_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+	'title'  => 'Settings',
+	'width'  => 80,
+	'template'  => 'templates/interface_settings.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
+		'startmodule' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $modules_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
-                'app_theme' => array (
-                            'datatype'	=> 'VARCHAR',
-                            'formtype'	=> 'SELECT',
-                            'regex'	=> '',
-                            'errmsg'	=> '',
-                            'default'	=> 'default',
-                            'value'	=> $themes_list,
-                            'separator'	=> '',
-                            'width'	=> '30',
-                            'maxlength'	=> '255',
-                            'rows'	=> '',
-                            'cols'	=> ''
-                    )
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		'app_theme' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex' => '',
+			'errmsg' => '',
+			'default' => 'default',
+			'value' => $themes_list,
+			'separator' => '',
+			'width' => '30',
+			'maxlength' => '255',
+			'rows' => '',
+			'cols' => ''
+		)
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
diff --git a/interface/web/tools/form/tpl_default.tform.php b/interface/web/tools/form/tpl_default.tform.php
index e4d1b6273bd9cd9baded0d69ae05a36fd8327531..0d6cf2f22b50abec26d026461028a3fb905aafd4 100644
--- a/interface/web/tools/form/tpl_default.tform.php
+++ b/interface/web/tools/form/tpl_default.tform.php
@@ -60,21 +60,21 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form['title'] 		= 'tpl_default_head_txt';
-$form['description'] 	= 'tpl_default_desc_txt';
-$form['name'] 		= 'tpl_default';
-$form['action']		= 'tpl_default.php';
-$form['db_table']	= 'sys_user'; // needs to be 'sys_user_theme'
-$form['db_table_idx']	= 'userid'; //??
-$form["db_history"]	= "no";
-$form['tab_default']	= 'main';
-$form['list_default']	= 'index.php';
-$form['auth']		= 'no'; //?
+$form['title']   = 'tpl_default_head_txt';
+$form['description']  = 'tpl_default_desc_txt';
+$form['name']   = 'tpl_default';
+$form['action']  = 'tpl_default.php';
+$form['db_table'] = 'sys_user'; // needs to be 'sys_user_theme'
+$form['db_table_idx'] = 'userid'; //??
+$form["db_history"] = "no";
+$form['tab_default'] = 'main';
+$form['list_default'] = 'index.php';
+$form['auth']  = 'no'; //?
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
@@ -84,98 +84,98 @@ $form['auth_preset']['perm_other'] = '';
 //* Pick out modules
 //* TODO: limit to activated modules of the user
 $modules_list = array();
-$handle = @opendir(ISPC_WEB_PATH); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_dir(ISPC_WEB_PATH."/$file")) {
-            if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
+$handle = @opendir(ISPC_WEB_PATH);
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_dir(ISPC_WEB_PATH."/$file")) {
+			if(is_file(ISPC_WEB_PATH."/$file/lib/module.conf.php") and $file != 'login' && $file != 'designer' && $file != 'mailuser') {
 				$modules_list[$file] = $file;
 			}
-        }
+		}
 	}
 }
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
-} 
+}
 
 //* Load themes
 $themes_list = array();
-$handle = @opendir(ISPC_THEMES_PATH); 
-while ($file = @readdir ($handle)) { 
-    if (substr($file, 0, 1) != '.') {
-        if(@is_dir(ISPC_THEMES_PATH."/$file")) {
+$handle = @opendir(ISPC_THEMES_PATH);
+while ($file = @readdir($handle)) {
+	if (substr($file, 0, 1) != '.') {
+		if(@is_dir(ISPC_THEMES_PATH."/$file")) {
 			if($file == 'default' || (@file_exists(ISPC_THEMES_PATH."/$file/ISPC_VERSION") && trim(@file_get_contents(ISPC_THEMES_PATH."/$file/ISPC_VERSION")) == ISPC_APP_VERSION)) {
-                $themes_list[$file] = $file;
-            }
-        }
+				$themes_list[$file] = $file;
+			}
+		}
 	}
 }
 
 $form['tabs']['main'] = array (
-	'title' 	=> 'Settings',
-	'width' 	=> 80,
-	'template' 	=> 'templates/interface_settings.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
-                'startmodule' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $modules_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
-			'rows'		=> '',
-			'cols'		=> ''
+	'title'  => 'Settings',
+	'width'  => 80,
+	'template'  => 'templates/interface_settings.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
+		'startmodule' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $modules_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '255',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-                        'validators'	=> array ( 0 => array (	'type'	=> 'NOTEMPTY',
-                                                                'errmsg'=> 'language_is_empty'),
-                                                   1 => array (	'type'	=> 'REGEX',
-                                                                'regex' => '/^[a-z]{2}$/i',
-                                                                'errmsg'=> 'language_regex_mismatch'),
-                                                ),
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '2',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'language_is_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-z]{2}$/i',
+					'errmsg'=> 'language_regex_mismatch'),
+			),
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '2',
+			'rows'  => '',
+			'cols'  => ''
 		),
-                'app_theme' => array (
-                            'datatype'	=> 'VARCHAR',
-                            'formtype'	=> 'SELECT',
-                            'regex'	=> '',
-                            'errmsg'	=> '',
-                            'default'	=> 'default',
-                            'value'	=> $themes_list,
-                            'separator'	=> '',
-                            'width'	=> '30',
-                            'maxlength'	=> '255',
-                            'rows'	=> '',
-                            'cols'	=> ''
-                    )
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		'app_theme' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'regex' => '',
+			'errmsg' => '',
+			'default' => 'default',
+			'value' => $themes_list,
+			'separator' => '',
+			'width' => '30',
+			'maxlength' => '255',
+			'rows' => '',
+			'cols' => ''
+		)
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
diff --git a/interface/web/tools/form/user_settings.tform.php b/interface/web/tools/form/user_settings.tform.php
index d3c35bfd2dfdb36481aef3d5bac16c788050392a..4ceda5843499bd05c09cd67957c39a22c234b3a6 100644
--- a/interface/web/tools/form/user_settings.tform.php
+++ b/interface/web/tools/form/user_settings.tform.php
@@ -60,21 +60,21 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 */
 
-$form['title'] 			= 'User Settings';
-$form['description'] 	= 'Form to edit the user password and language.';
-$form['name'] 			= 'usersettings';
-$form['action']			= 'user_settings.php';
-$form['db_table']		= 'sys_user';
-$form['db_table_idx']	= 'userid';
-$form["db_history"]		= "no";
-$form['tab_default']	= 'users';
-$form['list_default']	= 'index.php';
-$form['auth']			= 'no';
+$form['title']    = 'User Settings';
+$form['description']  = 'Form to edit the user password and language.';
+$form['name']    = 'usersettings';
+$form['action']   = 'user_settings.php';
+$form['db_table']  = 'sys_user';
+$form['db_table_idx'] = 'userid';
+$form["db_history"]  = "no";
+$form['tab_default'] = 'users';
+$form['list_default'] = 'index.php';
+$form['auth']   = 'no';
 
 //* 0 = id of the user, > 0 id must match with id of current user
-$form['auth_preset']['userid']  = 0; 
+$form['auth_preset']['userid']  = 0;
 //* 0 = default groupid of the user, > 0 id must match with groupid of current user
-$form['auth_preset']['groupid'] = 0; 
+$form['auth_preset']['groupid'] = 0;
 
 //** Permissions are: r = read, i = insert, u = update, d = delete
 $form['auth_preset']['perm_user']  = 'riud';
@@ -83,60 +83,60 @@ $form['auth_preset']['perm_other'] = '';
 
 //* Languages
 $language_list = array();
-$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang'); 
-while ($file = @readdir ($handle)) { 
-    if ($file != '.' && $file != '..') {
-        if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file,-4,4) == '.lng') {
+$handle = @opendir(ISPC_ROOT_PATH.'/lib/lang');
+while ($file = @readdir($handle)) {
+	if ($file != '.' && $file != '..') {
+		if(@is_file(ISPC_ROOT_PATH.'/lib/lang/'.$file) and substr($file, -4, 4) == '.lng') {
 			$tmp = substr($file, 0, 2);
 			$language_list[$tmp] = $tmp;
-        }
+		}
 	}
-} 
+}
 
 $form['tabs']['users'] = array (
-	'title' 	=> 'Settings',
-	'width' 	=> 80,
-	'template' 	=> 'templates/user_settings.htm',
-	'fields' 	=> array (
-	##################################
-	# Beginn Datenbankfelder
-	##################################
+	'title'  => 'Settings',
+	'width'  => 80,
+	'template'  => 'templates/user_settings.htm',
+	'fields'  => array (
+		//#################################
+		// Beginn Datenbankfelder
+		//#################################
 		'passwort' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'PASSWORD',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'PASSWORD',
 			'encryption'=> 'CRYPT',
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '100',
-			'rows'		=> '',
-			'cols'		=> ''
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '100',
+			'rows'  => '',
+			'cols'  => ''
 		),
 		'language' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'language_is_empty'),
-										1 => array (	'type'	=> 'REGEX',
-														'regex' => '/^[a-z]{2}$/i',
-														'errmsg'=> 'language_regex_mismatch'),
-									),
-			'regex'		=> '',
-			'errmsg'	=> '',
-			'default'	=> '',
-			'value'		=> $language_list,
-			'separator'	=> '',
-			'width'		=> '30',
-			'maxlength'	=> '2',
-			'rows'		=> '',
-			'cols'		=> ''
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'language_is_empty'),
+				1 => array ( 'type' => 'REGEX',
+					'regex' => '/^[a-z]{2}$/i',
+					'errmsg'=> 'language_regex_mismatch'),
+			),
+			'regex'  => '',
+			'errmsg' => '',
+			'default' => '',
+			'value'  => $language_list,
+			'separator' => '',
+			'width'  => '30',
+			'maxlength' => '2',
+			'rows'  => '',
+			'cols'  => ''
 		)
-	##################################
-	# ENDE Datenbankfelder
-	##################################
+		//#################################
+		// ENDE Datenbankfelder
+		//#################################
 	)
 );
 
diff --git a/interface/web/tools/import_ispconfig.php b/interface/web/tools/import_ispconfig.php
index 432bb3191e0411f15111606333dabb424a9b71e1..9a425107ea1b7221c9ab9ec705ef1c2cc4a4d000 100644
--- a/interface/web/tools/import_ispconfig.php
+++ b/interface/web/tools/import_ispconfig.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@ $error = '';
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_import_ispconfig.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 if(isset($_POST['connected'])) {
@@ -60,11 +60,11 @@ if(isset($_POST['connected'])) {
 		if($error == '') {
 			try {
 				$client = new SoapClient(null, array('location' => $_POST['remote_server'],
-                                     'uri'      => $_POST['remote_server'].'/index.php',
-									 'trace' => 1,
-									 'exceptions' => 1));
-				
-				if($remote_session_id = $client->login($_POST['remote_user'],$_POST['remote_password'])) {
+						'uri'      => $_POST['remote_server'].'/index.php',
+						'trace' => 1,
+						'exceptions' => 1));
+
+				if($remote_session_id = $client->login($_POST['remote_user'], $_POST['remote_password'])) {
 					$connected = 1;
 					$msg .= 'Successfully connected to remote server.';
 				}
@@ -75,9 +75,9 @@ if(isset($_POST['connected'])) {
 			}
 		}
 	}
-	
+
 	if($connected == 1) {
-		
+
 		//* Fill the client select field
 		$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
 		$clients = $app->db->queryAllRecords($sql);
@@ -88,59 +88,59 @@ if(isset($_POST['connected'])) {
 				$client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("client_group_id",$client_select);
-		
-		
+		$app->tpl->setVar("client_group_id", $client_select);
+
+
 		try {
 			$client = new SoapClient(null, array('location' => $_POST['remote_server'],
-                                'uri'      => $_POST['remote_server'].'/index.php',
-								'trace' => 1,
-								'exceptions' => 1));
-		
-		if(!isset($remote_session_id)) $remote_session_id = $_POST['remote_session_id'];
-		
-		//* Get all email domains
-		$mail_domains = $client->mail_domain_get($remote_session_id, array('active' => 'y'));
-		$mail_domain_select = '<option value="">-- select domain --</option>';
-		if(is_array($mail_domains)) {
-			foreach( $mail_domains as $mail_domain) {
-				$selected = @($mail_domain['domain'] == $_POST['mail_domain'])?'SELECTED':'';
-				$mail_domain_select .= "<option value='$mail_domain[domain]' $selected>$mail_domain[domain]</option>\r\n";
+					'uri'      => $_POST['remote_server'].'/index.php',
+					'trace' => 1,
+					'exceptions' => 1));
+
+			if(!isset($remote_session_id)) $remote_session_id = $_POST['remote_session_id'];
+
+			//* Get all email domains
+			$mail_domains = $client->mail_domain_get($remote_session_id, array('active' => 'y'));
+			$mail_domain_select = '<option value="">-- select domain --</option>';
+			if(is_array($mail_domains)) {
+				foreach( $mail_domains as $mail_domain) {
+					$selected = @($mail_domain['domain'] == $_POST['mail_domain'])?'SELECTED':'';
+					$mail_domain_select .= "<option value='$mail_domain[domain]' $selected>$mail_domain[domain]</option>\r\n";
+				}
 			}
-		}
-		$app->tpl->setVar("mail_domain",$mail_domain_select);
-		
-		//* Do the import
-		if($_POST['mail_domain'] != '') start_domain_import($_POST['mail_domain']);
-		
-		
-		
+			$app->tpl->setVar("mail_domain", $mail_domain_select);
+
+			//* Do the import
+			if($_POST['mail_domain'] != '') start_domain_import($_POST['mail_domain']);
+
+
+
 		} catch (SoapFault $e) {
 			//echo $client->__getLastResponse();
 			$error .= $e->getMessage();
 			$connected = 0;
 		}
-		
+
 	}
-	
+
 }
 
-$app->tpl->setVar('remote_server',$_POST['remote_server']);
-$app->tpl->setVar('remote_user',$_POST['remote_user']);
-$app->tpl->setVar('remote_password',$_POST['remote_password']);
-$app->tpl->setVar('connected',$connected);
-$app->tpl->setVar('remote_session_id',$remote_session_id);
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('remote_server', $_POST['remote_server']);
+$app->tpl->setVar('remote_user', $_POST['remote_user']);
+$app->tpl->setVar('remote_password', $_POST['remote_password']);
+$app->tpl->setVar('connected', $connected);
+$app->tpl->setVar('remote_session_id', $remote_session_id);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-###########################################################
+//##########################################################
 
 function start_domain_import($mail_domain) {
 	global $app, $conf, $client, $msg, $error, $remote_session_id;
-	
+
 	//* Get the user and groupid for the new records
 	$sys_groupid = $app->functions->intval($_POST['client_group_id']);
 	$tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = $sys_groupid");
@@ -148,13 +148,13 @@ function start_domain_import($mail_domain) {
 	unset($tmp);
 	if($sys_groupid == 0) $error .= 'Inavlid groupid<br />';
 	if($sys_userid == 0) $error .= 'Inavlid Userid<br />';
-	
+
 	//* Get the mail server ID
 	$tmp = $app->db->queryOneRecord("SELECT server_id FROM server WHERE mail_server = 1 LIMIT 0,1");
 	$server_id = intval($tmp['server_id']);
 	unset($tmp);
 	if($server_id == 0) $server_id = 1;
-	
+
 	//* get the mail domain record
 	$mail_domain_rec = $client->mail_domain_get($remote_session_id, array('domain' => $mail_domain));
 	if(is_array($mail_domain_rec)) {
@@ -162,13 +162,13 @@ function start_domain_import($mail_domain) {
 		$tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE domain = '".$app->db->quote($mail_domain)."'");
 		if($tmp['number'] > 0) $error .= 'Domain '.$mail_domain.' exists already in local database.<br />';
 		unset($tmp);
-		
+
 		//* Change the record owner and remove the index field
 		$mail_domain_rec['sys_userid'] = $sys_userid;
 		$mail_domain_rec['sys_groupid'] = $sys_groupid;
 		$mail_domain_rec['server_id'] = $server_id;
 		unset($mail_domain_rec['domain_id']);
-		
+
 		//* Insert domain if no error occurred
 		if($error == '') {
 			$app->db->datalogInsert('mail_domain', $mail_domain_rec, 'domain_id');
@@ -176,7 +176,7 @@ function start_domain_import($mail_domain) {
 		} else {
 			return false;
 		}
-		
+
 		//* Import mailboxes
 		if(isset($_POST['import_mailbox']) && $_POST['import_mailbox'] == 1) {
 			$mail_users = $client->mail_user_get($remote_session_id, array('email' => '%@'.$mail_domain));
@@ -184,7 +184,7 @@ function start_domain_import($mail_domain) {
 				foreach($mail_users as $mail_user) {
 					$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE email = '".$app->db->quote($mail_user['email'])."'");
 					if($tmp['number'] == 0) {
-						
+
 						//* Prepare record
 						$mail_user['sys_userid'] = $sys_userid;
 						$mail_user['sys_groupid'] = $sys_groupid;
@@ -192,16 +192,16 @@ function start_domain_import($mail_domain) {
 						$remote_mailuser_id = $mail_user['mailuser_id'];
 						unset($mail_user['mailuser_id']);
 						if(!isset($_POST['import_user_filter'])) $mail_user['custom_mailfilter'] = '';
-						
+
 						//* Insert record in DB
 						$local_mailuser_id = $app->db->datalogInsert('mail_user', $mail_user, 'mailuser_id');
 						$msg .= "Imported mailbox ".$mail_user['email']."<br />";
-						
+
 						//* Import mail user filters
 						if(isset($_POST['import_user_filter']) && $_POST['import_user_filter'] == 1 && $local_mailuser_id > 0) {
-							
+
 							$mail_user_filters = $client->mail_user_filter_get($remote_session_id, array('mailuser_id' => $remote_mailuser_id));
-							
+
 							if(is_array($mail_user_filters)) {
 								foreach($mail_user_filters as $mail_user_filter) {
 									$mail_user_filter['sys_userid'] = $sys_userid;
@@ -209,7 +209,7 @@ function start_domain_import($mail_domain) {
 									$mail_user_filter['mailuser_id'] = $local_mailuser_id;
 									$mail_user_filter['server_id'] = $server_id;
 									unset($mail_user_filter['filter_id']);
-									
+
 									//* Insert record in DB
 									$app->db->datalogInsert('mail_user_filter', $mail_user_filter, 'filter_id');
 									$msg .= "Imported mailbox filter ".$mail_user['email'].": ".$mail_user_filter['rulename']."<br />";
@@ -219,11 +219,11 @@ function start_domain_import($mail_domain) {
 					} else {
 						$error .= "Mailbox ".$mail_user['email']." exists in local database. Skipped import of mailbox<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import email aliases
 		if(isset($_POST['import_alias']) && $_POST['import_alias'] == 1) {
 			$mail_aliases = $client->mail_alias_get($remote_session_id, array('type' => 'alias', 'destination' => '%@'.$mail_domain));
@@ -240,11 +240,11 @@ function start_domain_import($mail_domain) {
 					} else {
 						$error .= "Email alias ".$mail_alias['source']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import domain aliases
 		if(isset($_POST['import_aliasdomain']) && $_POST['import_aliasdomain'] == 1) {
 			$mail_aliases = $client->mail_alias_get($remote_session_id, array('type' => 'aliasdomain', 'destination' => '@'.$mail_domain));
@@ -261,11 +261,11 @@ function start_domain_import($mail_domain) {
 					} else {
 						$error .= "Email aliasdomain ".$mail_alias['source']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import email forward
 		if(isset($_POST['import_forward']) && $_POST['import_forward'] == 1) {
 			$mail_forwards = $client->mail_forward_get($remote_session_id, array('type' => 'forward', 'source' => '%@'.$mail_domain));
@@ -282,11 +282,11 @@ function start_domain_import($mail_domain) {
 					} else {
 						$error .= "Email forward ".$mail_forward['source']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
-		
+
 		//* Import spamfilter
 		if(isset($_POST['import_spamfilter']) && $_POST['import_spamfilter'] == 1) {
 			$mail_spamfilters = $client->mail_spamfilter_user_get($remote_session_id, array('email' => '%@'.$mail_domain));
@@ -303,14 +303,14 @@ function start_domain_import($mail_domain) {
 					} else {
 						$error .= "Spamfilter user ".$mail_spamfilter['email']." exists in local database. Skipped import.<br />";
 					}
-					
+
 				}
 			}
 		}
 
 	}
-	
+
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/import_plesk.php b/interface/web/tools/import_plesk.php
index de8fe7a0b55cb442f0fb64119b256d22f0e0412e..aea9c230f972d2b5440ee8891eb6baa481983bd6 100644
--- a/interface/web/tools/import_plesk.php
+++ b/interface/web/tools/import_plesk.php
@@ -30,25 +30,27 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 global $app, $conf;
 
-require_once('../../lib/config.inc.php');
+require_once '../../lib/config.inc.php';
 
-require_once('../../lib/app.inc.php');
+require_once '../../lib/app.inc.php';
 
 /**
  *
  * @param db $exdb
- * @return array 
+ * @return array
  */
+
+
 function read_limit_data($exdb) {
-    $limits = array();
-    // Limits
-    $limit_data = $exdb->queryAllRecords("SELECT l.id, l.limit_name, l.value FROM Limits as l");
-    foreach($limit_data as $entry) {
-        if(array_key_exists($entry['id'], $limits) == false) $limits[$entry['id']] = array();
-        $limits[$entry['id']][$entry['limit_name']] = $entry['value'];
-
-        // limits that are there:
-        /*
+	$limits = array();
+	// Limits
+	$limit_data = $exdb->queryAllRecords("SELECT l.id, l.limit_name, l.value FROM Limits as l");
+	foreach($limit_data as $entry) {
+		if(array_key_exists($entry['id'], $limits) == false) $limits[$entry['id']] = array();
+		$limits[$entry['id']][$entry['limit_name']] = $entry['value'];
+
+		// limits that are there:
+		/*
         disk_space
         disk_space_soft
         expiration
@@ -68,58 +70,59 @@ function read_limit_data($exdb) {
         max_wu
         mbox_quota
         */
-    }
-    
-    return $limits;
+	}
+
+	return $limits;
 }
 
+
 /**
  *
  * @param array $limits
  * @param int $id
  * @param string $limit
  * @param mixed $default
- * @return mixed 
+ * @return mixed
  */
 function get_limit($limits, $id, $limit, $default = false) {
-    $ret = $default;
-    if(isset($limits[$id][$limit])) $ret = $limits[$id][$limit];
-    
-    return $ret;
+	$ret = $default;
+	if(isset($limits[$id][$limit])) $ret = $limits[$id][$limit];
+
+	return $ret;
 }
 
 function get_option($options, $option, $default = false) {
-    $ret = $default;
-    if(isset($options[$option])) $ret = $options[$option];
-    
-    return $ret;
+	$ret = $default;
+	if(isset($options[$option])) $ret = $options[$option];
+
+	return $ret;
 }
 
 function add_dot($string) {
-    if(strlen($string) > 0 && substr($string, -1, 1) !== '.') $string .= '.';
-    return $string;
+	if(strlen($string) > 0 && substr($string, -1, 1) !== '.') $string .= '.';
+	return $string;
 }
 
 function byte_to_mbyte($byte) {
-    if($byte <= 0) return $byte; // limit = -1 -> unlimited
-    return round($byte / (1024*1024));
+	if($byte <= 0) return $byte; // limit = -1 -> unlimited
+	return round($byte / (1024*1024));
 }
 
 function yes_no($num, $reverse = false) {
-    return (($num == 1 && !$reverse) || ($num != 1 && $reverse) ? 'y' : 'n');
+	return ($num == 1 && !$reverse) || ($num != 1 && $reverse) ? 'y' : 'n';
 }
 
 // taken from the web_domain_edit.php
-function id_hash($id,$levels) {
-    $hash = "" . $id % 10 ;
-    $id /= 10 ;
-    $levels -- ;
-    while ( $levels > 0 ) {
-        $hash .= "/" . $id % 10 ;
-        $id /= 10 ;
-        $levels-- ;
-    }
-    return $hash;
+function id_hash($id, $levels) {
+	$hash = "" . $id % 10 ;
+	$id /= 10 ;
+	$levels -- ;
+	while ( $levels > 0 ) {
+		$hash .= "/" . $id % 10 ;
+		$id /= 10 ;
+		$levels-- ;
+	}
+	return $hash;
 }
 
 $COMMANDS = 'unset HISTFILE
@@ -131,9 +134,9 @@ MYSQL_IMPORT_PASS=""
 ';
 
 function add_command($cmd) {
-    global $COMMANDS;
-    
-    $COMMANDS .= $cmd . "\n";
+	global $COMMANDS;
+
+	$COMMANDS .= $cmd . "\n";
 }
 
 
@@ -155,245 +158,245 @@ $error = '';
 
 // Start migrating plesk data
 if(isset($_POST['start']) && $_POST['start'] == 1) {
-	
+
 	//* Set variable sin template
-	$app->tpl->setVar('dbhost',$_POST['dbhost']);
-	$app->tpl->setVar('dbname',$_POST['dbname']);
-	$app->tpl->setVar('dbuser',$_POST['dbuser']);
-	$app->tpl->setVar('dbpassword',$_POST['dbpassword']);
-	$app->tpl->setVar('webcontent',$_POST['webcontent']);
-	$app->tpl->setVar('mailcontent',$_POST['mailcontent']);
-	
+	$app->tpl->setVar('dbhost', $_POST['dbhost']);
+	$app->tpl->setVar('dbname', $_POST['dbname']);
+	$app->tpl->setVar('dbuser', $_POST['dbuser']);
+	$app->tpl->setVar('dbpassword', $_POST['dbpassword']);
+	$app->tpl->setVar('webcontent', $_POST['webcontent']);
+	$app->tpl->setVar('mailcontent', $_POST['mailcontent']);
+
 	//* Establish connection to external database
 	$msg .= 'Connecting to external database...<br />';
-	
+
 	//* Backup DB login details
 	/*$conf_bak['db_host'] = $conf['db_host'];
 	$conf_bak['db_database'] = $conf['db_database'];
 	$conf_bak['db_user'] = $conf['db_user'];
 	$conf_bak['db_password'] = $conf['db_password'];*/
-	
+
 	//* Set external Login details
 	$conf['imp_db_host'] = $_POST['dbhost'];
 	$conf['imp_db_database'] = $_POST['dbname'];
 	$conf['imp_db_user'] = $_POST['dbuser'];
 	$conf['imp_db_password'] = $_POST['dbpassword'];
-    $conf['imp_db_charset'] = $conf['db_charset'];
-    $conf['imp_db_new_link'] = $conf['db_new_link'];
-    $conf['imp_db_client_flags'] = $conf['db_client_flags'];
-	
+	$conf['imp_db_charset'] = $conf['db_charset'];
+	$conf['imp_db_new_link'] = $conf['db_new_link'];
+	$conf['imp_db_client_flags'] = $conf['db_client_flags'];
+
 	//* create new db object
 	$exdb = new db('imp');
-    
-    $msg .= 'db object created...<br />';
-    
-    $importer = new importer();
-    $session_id = 'ISPC3'; // set dummy session id for remoting lib
-    $msg .= 'importer object created...<br />';
-	
-    // import on server
+
+	$msg .= 'db object created...<br />';
+
+	$importer = new importer();
+	$session_id = 'ISPC3'; // set dummy session id for remoting lib
+	$msg .= 'importer object created...<br />';
+
+	// import on server
 	$server_id = 1;
-	
+
 	//* Connect to DB
 	if($exdb !== false) {
-        $msg .= 'Connecting to external database done...<br />';
-	
-        $limits = read_limit_data($exdb);
-        
-        $msg .= 'read all limit data...<br />';
-	
-        // param_id -> cl_params table - not needed for import
-        // tpye = admin, reseller, client
-        $admins = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'admin' ORDER BY c.parent_id, c.id");
-        $resellers = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'reseller' ORDER BY c.parent_id, c.id");
-        $clients  = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'client' ORDER BY c.parent_id, c.id");
-        
-        $users = array_merge($admins, $resellers, $clients);
-        $msg .= 'read all users (' . count($users) . ')...<br />';
-	
-        
-        $plesk_ispc_ids = array(); // array with key = plesk id, value = ispc id
-        
-        $phpopts = array('no', 'fast-cgi', 'cgi', 'mod', 'suphp', 'php-fpm');
-        
-        // import admins / resellers
-        for($i = 0; $i < count($users); $i++) {
-            $entry = $users[$i];
-            
-            $old_client = $importer->client_get_by_username($session_id, $entry['login']);
-            if($old_client) {
-                if($old_client['client_id'] == 0) {
-                    $entry['login'] = 'psa_' . $entry['login'];
-                    $old_client = $importer->client_get_by_username($session_id, $entry['login']);
-                    if($old_client) {
-                        $msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';
-                    }
-                } else {
-                    $msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';                    
-                }
-            }
-            $params = array(
-                            'company_name' => $entry['cname'],
-                            'contact_name' => $entry['pname'],
-                            'customer_no' => 'Plesk' . $entry['id'],
-                            'username' => $entry['login'],
-                            'password' => $entry['password'],
-                            'language' => substr($entry['locale'], 0, 2), // plesk stores as de-DE or en-US
-                            //'usertheme' => '',
-                            'street' => $entry['address'],
-                            'zip' => $entry['pcode'],
-                            'city' => $entry['city'],
-                            'state' => $entry['state'],
-                            'country' => $entry['country'],
-                            'telephone' => $entry['phone'],
-                            //'mobile' => $entry[''],
-                            'fax' => $entry['fax'],
-                            'email' => $entry['email'],
-                            //'internet' => $entry[''],
-                            //'icq' => $entry[''],
-                            //'vat_id' => $entry[''],
-                            //'company_id' => $entry[''],
-                            //'bank_account_number' => $entry[''],
-                            //'bank_code' => $entry[''],
-                            //'bank_name' => $entry[''],
-                            //'bank_account_iban' => $entry[''],
-                            //'bank_account_swift' => $entry[''],
-                            'notes' => 'imported from Plesk id ' . $entry['id'],
-                            //'template_master' => $entry[''],
-                            //'template_additional' => $entry[''],
-                            //'default_mailserver' => $entry[''],
-                            'limit_maildomain' => get_limit($limits, $entry['id'], 'max_site', -1),
-                            'limit_mailbox' => get_limit($limits, $entry['id'], 'max_box', -1),
-                            'limit_mailalias' => get_limit($limits, $entry['id'], 'max_mn', -1),
-                            'limit_mailaliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
-                            'limit_mailmailinglist' => get_limit($limits, $entry['id'], 'max_maillists', -1),
-                            'limit_mailforward' => get_limit($limits, $entry['id'], 'max_mn', -1),
-                            'limit_mailcatchall' => 1,
-                            'limit_mailrouting' => 0,
-                            'limit_mailfilter' => 0,
-                            'limit_fetchmail' => 0,
-                            'limit_mailquota' => get_limit($limits, $entry['id'], 'mbox_quota', -1),
-                            'limit_spamfilter_wblist' => 0,
-                            'limit_spamfilter_user' => 0,
-                            'limit_spamfilter_policy' => 0,
-                            //'default_webserver' => '',
-                            'limit_web_domain' => get_limit($limits, $entry['id'], 'max_site', -1),
-                            'limit_web_quota' => intval(get_limit($limits, $entry['id'], 'disk_space', -1)),
-                            'web_php_options' => implode(',', $phpopts),
-                            'limit_web_aliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
-                            'limit_web_subdomain' => get_limit($limits, $entry['id'], 'max_subdom', -1),
-                            'limit_ftp_user' => (string)($app->functions->intval(get_limit($limits, $entry['id'], 'max_subftp_users', -2)) + 1),
-                            'limit_shell_user' => 0,
-                            'ssh_chroot' => 'no,jailkit',
-                            'limit_webdav_user' => get_limit($limits, $entry['id'], 'max_wu', 0),
-                            //'default_dnsserver' => '',
-                            'limit_dns_zone' => -1,
-                            'limit_dns_slave_zone' => -1,
-                            'limit_dns_record' => -1,
-                            'limit_client' => ($entry['type'] == 'client' ? 0 : -1),
-                            //'default_dbserver' => '',
-                            'limit_database' => get_limit($limits, $entry['id'], 'max_db', -1),
-                            'limit_cron' => 0,
-                            'limit_cron_type' => 'url',
-                            'limit_cron_frequency' => '5',
-                            'limit_traffic_quota' => intval(get_limit($limits, $entry['id'], 'max_traffic', -1)),
-                            'limit_openvz_vm' => 0,
-                            'limit_openvz_vm_template_id' => ''
-                            );
-            $reseller_id = 0;
-            if($entry['parent_id'] != 0) {
-                if(array_key_exists($entry['parent_id'], $plesk_ispc_ids)) {
-                    $reseller_id = $plesk_ispc_ids[$entry['parent_id']];
-                }
-            }
-            
-            if($old_client) {
-                $new_id = $old_client['client_id'];
-                $ok = $importer->client_update($session_id, $old_client['client_id'], $reseller_id, array_merge($old_client, $params));
-                if($ok === false) {
-                    
-                }
-            } else {
-                $new_id = $importer->client_add($session_id, $reseller_id, $params);
-            }
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") could not be inserted/updated.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") inserted/updated.<br />";
-            }
-            
-            $plesk_ispc_ids[$entry['id']] = $new_id;
-        }
-        unset($users);
-        unset($clients);
-        unset($resellers);
-        unset($admins);
-        
-        $web_config = $app->getconf->get_server_config($server_id,'web');
-        
-        $domains = $exdb->queryAllRecords("SELECT d.id, d.cr_date, d.name, d.displayName, d.dns_zone_id, d.status, d.htype, d.real_size, d.cl_id, d.limits_id, d.params_id, d.guid, d.overuse, d.gl_filter, d.vendor_id, d.webspace_id, d.webspace_status, d.permissions_id, d.external_id FROM domains as d WHERE d.parentDomainId = 0");
-        $dom_ftp_users = array();
-        $domain_ids = array();
-        $domain_roots = array();
-        $domain_owners = array();
-        $dns_domain_ids = array();
-        $maildomain_ids = array();
-        foreach($domains as $entry) {
-            $res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['id'] . "'");
-            $options = array();
-            while($opt = $exdb->nextRecord()) {
-                $options[$opt['param']] = $opt['val'];
-            }
-            
-            /* TODO: options that might be used later:
+		$msg .= 'Connecting to external database done...<br />';
+
+		$limits = read_limit_data($exdb);
+
+		$msg .= 'read all limit data...<br />';
+
+		// param_id -> cl_params table - not needed for import
+		// tpye = admin, reseller, client
+		$admins = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'admin' ORDER BY c.parent_id, c.id");
+		$resellers = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'reseller' ORDER BY c.parent_id, c.id");
+		$clients  = $exdb->queryAllRecords("SELECT c.id, c.parent_id, c.type, c.cr_date, c.cname, c.pname, c.login, c.account_id, a.password, a.type as `pwtype`, c.status, c.phone, c.fax, c.email, c.address, c.city, c.state, c.pcode, c.country, c.locale, c.limits_id, c.params_id, c.perm_id, c.pool_id, c.logo_id, c.tmpl_id, c.guid, c.overuse, c.vendor_id, c.external_id FROM clients as c LEFT JOIN accounts as a ON (a.id = c.account_id) WHERE c.type = 'client' ORDER BY c.parent_id, c.id");
+
+		$users = array_merge($admins, $resellers, $clients);
+		$msg .= 'read all users (' . count($users) . ')...<br />';
+
+
+		$plesk_ispc_ids = array(); // array with key = plesk id, value = ispc id
+
+		$phpopts = array('no', 'fast-cgi', 'cgi', 'mod', 'suphp', 'php-fpm');
+
+		// import admins / resellers
+		for($i = 0; $i < count($users); $i++) {
+			$entry = $users[$i];
+
+			$old_client = $importer->client_get_by_username($session_id, $entry['login']);
+			if($old_client) {
+				if($old_client['client_id'] == 0) {
+					$entry['login'] = 'psa_' . $entry['login'];
+					$old_client = $importer->client_get_by_username($session_id, $entry['login']);
+					if($old_client) {
+						$msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';
+					}
+				} else {
+					$msg .= $entry['login'] . ' existed, updating id ' . $old_client['client_id'] . '<br />';
+				}
+			}
+			$params = array(
+				'company_name' => $entry['cname'],
+				'contact_name' => $entry['pname'],
+				'customer_no' => 'Plesk' . $entry['id'],
+				'username' => $entry['login'],
+				'password' => $entry['password'],
+				'language' => substr($entry['locale'], 0, 2), // plesk stores as de-DE or en-US
+				//'usertheme' => '',
+				'street' => $entry['address'],
+				'zip' => $entry['pcode'],
+				'city' => $entry['city'],
+				'state' => $entry['state'],
+				'country' => $entry['country'],
+				'telephone' => $entry['phone'],
+				//'mobile' => $entry[''],
+				'fax' => $entry['fax'],
+				'email' => $entry['email'],
+				//'internet' => $entry[''],
+				//'icq' => $entry[''],
+				//'vat_id' => $entry[''],
+				//'company_id' => $entry[''],
+				//'bank_account_number' => $entry[''],
+				//'bank_code' => $entry[''],
+				//'bank_name' => $entry[''],
+				//'bank_account_iban' => $entry[''],
+				//'bank_account_swift' => $entry[''],
+				'notes' => 'imported from Plesk id ' . $entry['id'],
+				//'template_master' => $entry[''],
+				//'template_additional' => $entry[''],
+				//'default_mailserver' => $entry[''],
+				'limit_maildomain' => get_limit($limits, $entry['id'], 'max_site', -1),
+				'limit_mailbox' => get_limit($limits, $entry['id'], 'max_box', -1),
+				'limit_mailalias' => get_limit($limits, $entry['id'], 'max_mn', -1),
+				'limit_mailaliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
+				'limit_mailmailinglist' => get_limit($limits, $entry['id'], 'max_maillists', -1),
+				'limit_mailforward' => get_limit($limits, $entry['id'], 'max_mn', -1),
+				'limit_mailcatchall' => 1,
+				'limit_mailrouting' => 0,
+				'limit_mailfilter' => 0,
+				'limit_fetchmail' => 0,
+				'limit_mailquota' => get_limit($limits, $entry['id'], 'mbox_quota', -1),
+				'limit_spamfilter_wblist' => 0,
+				'limit_spamfilter_user' => 0,
+				'limit_spamfilter_policy' => 0,
+				//'default_webserver' => '',
+				'limit_web_domain' => get_limit($limits, $entry['id'], 'max_site', -1),
+				'limit_web_quota' => intval(get_limit($limits, $entry['id'], 'disk_space', -1)),
+				'web_php_options' => implode(',', $phpopts),
+				'limit_web_aliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1),
+				'limit_web_subdomain' => get_limit($limits, $entry['id'], 'max_subdom', -1),
+				'limit_ftp_user' => (string)($app->functions->intval(get_limit($limits, $entry['id'], 'max_subftp_users', -2)) + 1),
+				'limit_shell_user' => 0,
+				'ssh_chroot' => 'no,jailkit',
+				'limit_webdav_user' => get_limit($limits, $entry['id'], 'max_wu', 0),
+				//'default_dnsserver' => '',
+				'limit_dns_zone' => -1,
+				'limit_dns_slave_zone' => -1,
+				'limit_dns_record' => -1,
+				'limit_client' => ($entry['type'] == 'client' ? 0 : -1),
+				//'default_dbserver' => '',
+				'limit_database' => get_limit($limits, $entry['id'], 'max_db', -1),
+				'limit_cron' => 0,
+				'limit_cron_type' => 'url',
+				'limit_cron_frequency' => '5',
+				'limit_traffic_quota' => intval(get_limit($limits, $entry['id'], 'max_traffic', -1)),
+				'limit_openvz_vm' => 0,
+				'limit_openvz_vm_template_id' => ''
+			);
+			$reseller_id = 0;
+			if($entry['parent_id'] != 0) {
+				if(array_key_exists($entry['parent_id'], $plesk_ispc_ids)) {
+					$reseller_id = $plesk_ispc_ids[$entry['parent_id']];
+				}
+			}
+
+			if($old_client) {
+				$new_id = $old_client['client_id'];
+				$ok = $importer->client_update($session_id, $old_client['client_id'], $reseller_id, array_merge($old_client, $params));
+				if($ok === false) {
+
+				}
+			} else {
+				$new_id = $importer->client_add($session_id, $reseller_id, $params);
+			}
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") could not be inserted/updated.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Client " . $entry['id'] . " (" . $entry['pname'] . ") inserted/updated.<br />";
+			}
+
+			$plesk_ispc_ids[$entry['id']] = $new_id;
+		}
+		unset($users);
+		unset($clients);
+		unset($resellers);
+		unset($admins);
+
+		$web_config = $app->getconf->get_server_config($server_id, 'web');
+
+		$domains = $exdb->queryAllRecords("SELECT d.id, d.cr_date, d.name, d.displayName, d.dns_zone_id, d.status, d.htype, d.real_size, d.cl_id, d.limits_id, d.params_id, d.guid, d.overuse, d.gl_filter, d.vendor_id, d.webspace_id, d.webspace_status, d.permissions_id, d.external_id FROM domains as d WHERE d.parentDomainId = 0");
+		$dom_ftp_users = array();
+		$domain_ids = array();
+		$domain_roots = array();
+		$domain_owners = array();
+		$dns_domain_ids = array();
+		$maildomain_ids = array();
+		foreach($domains as $entry) {
+			$res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['id'] . "'");
+			$options = array();
+			while($opt = $exdb->nextRecord()) {
+				$options[$opt['param']] = $opt['val'];
+			}
+
+			/* TODO: options that might be used later:
              * OveruseBlock true/false
              * OveruseNotify true/false
              * OveruseSuspend true/false
              * wu_script true/false (webusers allowed to use scripts?)
              * webmail string (webmailer used - horde)
              */
-            
-            $redir_type = '';
-            $redir_path = '';
-            
-            if($entry['htype'] === 'std_fwd') {
-                // redirection
-                $redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
-                $redir_type = 'R,L';
-                $redir_path = $redir['redirect'];
-            } elseif($entry['htype'] === 'vrt_hst') {
-                // default virtual hosting (vhost)
-            } else {
-                /* TODO: unknown type */
-            }
-            
-            $hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM hosting as h LEFT JOIN sys_users as s ON (s.id = h.sys_user_id) LEFT JOIN accounts as a ON (s.account_id = a.id) WHERE h.dom_id = '" . $entry['id'] . "'");
-            if($hosting['sys_user_id']) {
-                $dom_ftp_users[] = array('id' => 0,
-                                         'dom_id' => $hosting['dom_id'],
-                                         'sys_user_id' => $hosting['sys_user_id'],
-                                         'login' => $hosting['login'],
-                                         'account_id' => $hosting['account_id'],
-                                         'home' => $hosting['home'],
-                                         'shell' => $hosting['shell'],
-                                         'quota' => $hosting['quota'],
-                                         'mapped_to' => $hosting['mapped_to'],
-                                         'password' => $hosting['password'],
-                                         'pwtype' => $hosting['pwtype']
-                                        );
-            }
-            
-            $phpmode = 'no';
-            if(get_option($hosting, 'php', 'false') === 'true') {
-                $mode = get_option($hosting, 'php_handler_type', 'module');
-                if($mode === 'module') $phpmode = 'mod';
-                else $phpmode = 'fast-cgi';
-                /* TODO: what other options could be in "php_handler_type"? */
-            }
-            
-            /* TODO: plesk offers some more options:
+
+			$redir_type = '';
+			$redir_path = '';
+
+			if($entry['htype'] === 'std_fwd') {
+				// redirection
+				$redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
+				$redir_type = 'R,L';
+				$redir_path = $redir['redirect'];
+			} elseif($entry['htype'] === 'vrt_hst') {
+				// default virtual hosting (vhost)
+			} else {
+				/* TODO: unknown type */
+			}
+
+			$hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM hosting as h LEFT JOIN sys_users as s ON (s.id = h.sys_user_id) LEFT JOIN accounts as a ON (s.account_id = a.id) WHERE h.dom_id = '" . $entry['id'] . "'");
+			if($hosting['sys_user_id']) {
+				$dom_ftp_users[] = array('id' => 0,
+					'dom_id' => $hosting['dom_id'],
+					'sys_user_id' => $hosting['sys_user_id'],
+					'login' => $hosting['login'],
+					'account_id' => $hosting['account_id'],
+					'home' => $hosting['home'],
+					'shell' => $hosting['shell'],
+					'quota' => $hosting['quota'],
+					'mapped_to' => $hosting['mapped_to'],
+					'password' => $hosting['password'],
+					'pwtype' => $hosting['pwtype']
+				);
+			}
+
+			$phpmode = 'no';
+			if(get_option($hosting, 'php', 'false') === 'true') {
+				$mode = get_option($hosting, 'php_handler_type', 'module');
+				if($mode === 'module') $phpmode = 'mod';
+				else $phpmode = 'fast-cgi';
+				/* TODO: what other options could be in "php_handler_type"? */
+			}
+
+			/* TODO: plesk offers some more options:
              * sys_user_id -> owner of files?
              * ip_address_id - needed?
              * fp - frontpage extensions
@@ -404,226 +407,226 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
              * traffic_bandwidth
              * max_connections
              */
-            $params = array(
-                            'server_id' => $server_id,
-                            'ip_address' => '*',
-                            //'ipv6_address' => '',
-                            'domain' => $entry['name'],
-                            'type' => 'vhost', // can be vhost or alias
-                            'parent_domain_id' => '', // only if alias
-                            'vhost_type' => 'name', // or ip (-based)
-                            'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'disk_space', -1)),
-                            'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'max_traffic', -1)),
-                            'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
-                            'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
-                            'suexec' => yes_no(1), // does plesk use this?!
-                            'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
-                            'subdomain' => 'www', // plesk always uses this option
-                            'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
-                            'php' => $phpmode,
-                            'fastcgi_php_version' => '', // plesk has no different php versions
-                            'ruby' => yes_no(0), // plesk has no ruby support
-                            'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
-                            'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
-                            'redirect_type' => $redir_type,
-                            'redirect_path' => $redir_path,
-                            'seo_redirect' => '',
-                            'ssl_state' => $entry[''],
-                            'ssl_locality' => $entry[''],
-                            'ssl_organisation' => $entry[''],
-                            'ssl_organisation_unit' => $entry[''],
-                            'ssl_country' => $entry[''],
-                            'ssl_domain' => $entry[''],
-                            'ssl_request' => $entry[''],
-                            'ssl_cert' => $entry[''],
-                            'ssl_bundle' => $entry[''],
-                            'ssl_action' => $entry[''],
-                            'stats_password' => '',
-                            'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
-                            'backup_interval' => 'none',
-                            'backup_copies' => 1,
-                            'allow_override' => 'All',
-                            'pm_process_idle_timeout' => 10,
-                            'pm_max_requests' => 0
-                            );
-            
-            // find already inserted domain
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
-                $params = array_merge($old_domain, $params);
-                $ok = $importer->sites_web_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params, true); // read only...
-            }
-            
-            $domain_ids[$entry['id']] = $new_id;
-            $domain_roots[$entry['id']] = $entry['www_root'];
-            $domain_owners[$entry['id']] = $entry['cl_id'];
-            $dns_domain_ids[$entry['dns_zone_id']] = $entry['id'];
-            
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") inserted -> " . $new_id . ".<br />";
-                
-                $cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'");
-                $path = $cmd_data['document_root'];
-                add_command('chattr -i ' . escapeshellarg($path));
-                add_command('if [[ -f ' . $path . '/web/index.html ]] ; then rm ' . $path . '/web/index.html ; fi');
-                add_command('rsync -av --modify-window 10 --progress -e ssh root@${MYSERVER}:' . $hosting['www_root'] . '/ ' . $path . '/web/');
-                add_command('chown -R ' . $cmd_data['system_user'] . ':' . $cmd_data['system_group'] . ' ' . escapeshellarg($path));
-                add_command('grep ' . escapeshellarg($hosting['www_root']) . ' ' . $path . '/web -r -l | xargs replace ' . escapeshellarg($hosting['www_root']) . ' ' . escapeshellarg($path . '/web') . ' --');
-                add_command('chown -R root:root ' . escapeshellarg($path . '/log') . ' ' . escapeshellarg($path . '/ssl') . ' ' . escapeshellarg($path . '/web/stats'));
-                add_command('chattr +i ' . escapeshellarg($path));
-            }
-            
-            // add domain to mail domains too
-            $params = array(
-                            'server_id' => $server_id,
-                            'domain' => $entry['name'],
-                            'active' => yes_no(($entry['status'] == 0 ? 1 : 0))
-                            );
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found maildomain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->mail_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Inserting new maildomain " . $entry['name'] . ".<br />";
-                $new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params);
-            }
-            
-            $maildomain_ids[$entry['id']] = $new_id;
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Maildomain (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Maildomain " . $new_id . " (" . $entry['name'] . ") inserted.<br />";
-            }
+			$params = array(
+				'server_id' => $server_id,
+				'ip_address' => '*',
+				//'ipv6_address' => '',
+				'domain' => $entry['name'],
+				'type' => 'vhost', // can be vhost or alias
+				'parent_domain_id' => '', // only if alias
+				'vhost_type' => 'name', // or ip (-based)
+				'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'disk_space', -1)),
+				'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['id'], 'max_traffic', -1)),
+				'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
+				'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
+				'suexec' => yes_no(1), // does plesk use this?!
+				'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
+				'subdomain' => 'www', // plesk always uses this option
+				'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
+				'php' => $phpmode,
+				'fastcgi_php_version' => '', // plesk has no different php versions
+				'ruby' => yes_no(0), // plesk has no ruby support
+				'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
+				'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
+				'redirect_type' => $redir_type,
+				'redirect_path' => $redir_path,
+				'seo_redirect' => '',
+				'ssl_state' => $entry[''],
+				'ssl_locality' => $entry[''],
+				'ssl_organisation' => $entry[''],
+				'ssl_organisation_unit' => $entry[''],
+				'ssl_country' => $entry[''],
+				'ssl_domain' => $entry[''],
+				'ssl_request' => $entry[''],
+				'ssl_cert' => $entry[''],
+				'ssl_bundle' => $entry[''],
+				'ssl_action' => $entry[''],
+				'stats_password' => '',
+				'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
+				'backup_interval' => 'none',
+				'backup_copies' => 1,
+				'allow_override' => 'All',
+				'pm_process_idle_timeout' => 10,
+				'pm_max_requests' => 0
+			);
 
-        }
-        
-        $domain_aliases = $exdb->queryAllRecords("SELECT da.id, da.name, da.displayName, da.dns, da.mail, da.web, da.dom_id, da.status FROM domainaliases as da");
-        foreach($domain_aliases as $entry) {
-            $params = array(
-                            'server_id' => $server_id,
-                            'domain' => $entry['name'],
-                            'type' => 'alias',
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'redirect_type' => '',
-                            'redirect_path' => '',
-                            'subdomain' => 'www',
-                            'active' => yes_no(($entry['status'] == 0 && $entry['web'] === 'true') ? 1 : 0)
-                            );
-            
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->sites_web_aliasdomain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_aliasdomain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
-            }
-            
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-            }
-            
-            // add alias to mail domains, too
-            $params = array(
-                        'server_id' => $server_id,
-                        'domain' => $entry['name'],
-                        'active' => yes_no(($entry['status'] == 0 && $entry['mail'] === 'true') ? 1 : 0)
-                        );
+			// find already inserted domain
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$msg .= "Found domain with id " . $new_id . ", updating it.<br />";
+				$params = array_merge($old_domain, $params);
+				$ok = $importer->sites_web_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params, true); // read only...
+			}
 
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found mail domain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->mail_domain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
-            }
-            
-            $maildomain_ids[$entry['id']] = $new_id;
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-            }
-        }
-        
-        $subdomain_ids = array();
-        $subdomain_roots = array();
-        $subdomain_owners = array();
-        
-        $subdomains = $exdb->queryAllRecords("SELECT d.id, d.cr_date, d.name, d.displayName, d.dns_zone_id, d.status, d.htype, d.real_size, d.cl_id, d.limits_id, d.params_id, d.guid, d.overuse, d.gl_filter, d.vendor_id, d.webspace_id, d.webspace_status, d.permissions_id, d.external_id, d.parentDomainId FROM domains as d WHERE d.parentDomainId != 0");
-        foreach($subdomains as $entry) {
-            $res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['id'] . "'");
-            $options = array();
-            while($opt = $exdb->nextRecord()) {
-                $options[$opt['param']] = $opt['val'];
-            }
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['parentDomainId'] . "'");
-            $redir_type = '';
-            $redir_path = '';
-            
-            if($entry['htype'] === 'std_fwd') {
-                // redirection
-                $redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
-                $redir_type = 'R,L';
-                $redir_path = $redir['redirect'];
-            } elseif($entry['htype'] === 'vrt_hst') {
-                // default virtual hosting (vhost)
-            } else {
-                /* TODO: unknown type */
-            }
-            
-            $hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM hosting as h LEFT JOIN sys_users as s ON (s.id = h.sys_user_id) LEFT JOIN accounts as a ON (s.account_id = a.id) WHERE h.dom_id = '" . $entry['id'] . "'");
-            if($hosting['sys_user_id']) {
-                $dom_ftp_users[] = array('id' => 0,
-                                         'dom_id' => $hosting['dom_id'],
-                                         'sys_user_id' => $hosting['sys_user_id'],
-                                         'login' => $hosting['login'],
-                                         'account_id' => $hosting['account_id'],
-                                         'home' => $hosting['home'],
-                                         'shell' => $hosting['shell'],
-                                         'quota' => $hosting['quota'],
-                                         'mapped_to' => $hosting['mapped_to'],
-                                         'password' => $hosting['password'],
-                                         'pwtype' => $hosting['pwtype']
-                                        );
-            }
-            
-            $phpmode = 'no';
-            if(get_option($hosting, 'php', 'false') === 'true') {
-                $mode = get_option($hosting, 'php_handler_type', 'module');
-                if($mode === 'module') $phpmode = 'mod';
-                else $phpmode = 'fast-cgi';
-                /* TODO: what other options could be in "php_handler_type"? */
-            }
-            /* TODO: plesk offers some more options:
+			$domain_ids[$entry['id']] = $new_id;
+			$domain_roots[$entry['id']] = $entry['www_root'];
+			$domain_owners[$entry['id']] = $entry['cl_id'];
+			$dns_domain_ids[$entry['dns_zone_id']] = $entry['id'];
+
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Domain " . $entry['id'] . " (" . $entry['name'] . ") inserted -> " . $new_id . ".<br />";
+
+				$cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'");
+				$path = $cmd_data['document_root'];
+				add_command('chattr -i ' . escapeshellarg($path));
+				add_command('if [[ -f ' . $path . '/web/index.html ]] ; then rm ' . $path . '/web/index.html ; fi');
+				add_command('rsync -av --modify-window 10 --progress -e ssh root@${MYSERVER}:' . $hosting['www_root'] . '/ ' . $path . '/web/');
+				add_command('chown -R ' . $cmd_data['system_user'] . ':' . $cmd_data['system_group'] . ' ' . escapeshellarg($path));
+				add_command('grep ' . escapeshellarg($hosting['www_root']) . ' ' . $path . '/web -r -l | xargs replace ' . escapeshellarg($hosting['www_root']) . ' ' . escapeshellarg($path . '/web') . ' --');
+				add_command('chown -R root:root ' . escapeshellarg($path . '/log') . ' ' . escapeshellarg($path . '/ssl') . ' ' . escapeshellarg($path . '/web/stats'));
+				add_command('chattr +i ' . escapeshellarg($path));
+			}
+
+			// add domain to mail domains too
+			$params = array(
+				'server_id' => $server_id,
+				'domain' => $entry['name'],
+				'active' => yes_no(($entry['status'] == 0 ? 1 : 0))
+			);
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found maildomain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->mail_domain_update($session_id, $plesk_ispc_ids[$entry['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Inserting new maildomain " . $entry['name'] . ".<br />";
+				$new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$entry['cl_id']], $params);
+			}
+
+			$maildomain_ids[$entry['id']] = $new_id;
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Maildomain (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Maildomain " . $new_id . " (" . $entry['name'] . ") inserted.<br />";
+			}
+
+		}
+
+		$domain_aliases = $exdb->queryAllRecords("SELECT da.id, da.name, da.displayName, da.dns, da.mail, da.web, da.dom_id, da.status FROM domainaliases as da");
+		foreach($domain_aliases as $entry) {
+			$params = array(
+				'server_id' => $server_id,
+				'domain' => $entry['name'],
+				'type' => 'alias',
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'redirect_type' => '',
+				'redirect_path' => '',
+				'subdomain' => 'www',
+				'active' => yes_no(($entry['status'] == 0 && $entry['web'] === 'true') ? 1 : 0)
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found domain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->sites_web_aliasdomain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_aliasdomain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
+			}
+
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Aliasdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+			}
+
+			// add alias to mail domains, too
+			$params = array(
+				'server_id' => $server_id,
+				'domain' => $entry['name'],
+				'active' => yes_no(($entry['status'] == 0 && $entry['mail'] === 'true') ? 1 : 0)
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found mail domain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->mail_domain_update($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->mail_domain_add($session_id, $plesk_ispc_ids[$domain_owners[$entry['dom_id']]], $params);
+			}
+
+			$maildomain_ids[$entry['id']] = $new_id;
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Aliasmaildomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+			}
+		}
+
+		$subdomain_ids = array();
+		$subdomain_roots = array();
+		$subdomain_owners = array();
+
+		$subdomains = $exdb->queryAllRecords("SELECT d.id, d.cr_date, d.name, d.displayName, d.dns_zone_id, d.status, d.htype, d.real_size, d.cl_id, d.limits_id, d.params_id, d.guid, d.overuse, d.gl_filter, d.vendor_id, d.webspace_id, d.webspace_status, d.permissions_id, d.external_id, d.parentDomainId FROM domains as d WHERE d.parentDomainId != 0");
+		foreach($subdomains as $entry) {
+			$res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['id'] . "'");
+			$options = array();
+			while($opt = $exdb->nextRecord()) {
+				$options[$opt['param']] = $opt['val'];
+			}
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['parentDomainId'] . "'");
+			$redir_type = '';
+			$redir_path = '';
+
+			if($entry['htype'] === 'std_fwd') {
+				// redirection
+				$redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
+				$redir_type = 'R,L';
+				$redir_path = $redir['redirect'];
+			} elseif($entry['htype'] === 'vrt_hst') {
+				// default virtual hosting (vhost)
+			} else {
+				/* TODO: unknown type */
+			}
+
+			$hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM hosting as h LEFT JOIN sys_users as s ON (s.id = h.sys_user_id) LEFT JOIN accounts as a ON (s.account_id = a.id) WHERE h.dom_id = '" . $entry['id'] . "'");
+			if($hosting['sys_user_id']) {
+				$dom_ftp_users[] = array('id' => 0,
+					'dom_id' => $hosting['dom_id'],
+					'sys_user_id' => $hosting['sys_user_id'],
+					'login' => $hosting['login'],
+					'account_id' => $hosting['account_id'],
+					'home' => $hosting['home'],
+					'shell' => $hosting['shell'],
+					'quota' => $hosting['quota'],
+					'mapped_to' => $hosting['mapped_to'],
+					'password' => $hosting['password'],
+					'pwtype' => $hosting['pwtype']
+				);
+			}
+
+			$phpmode = 'no';
+			if(get_option($hosting, 'php', 'false') === 'true') {
+				$mode = get_option($hosting, 'php_handler_type', 'module');
+				if($mode === 'module') $phpmode = 'mod';
+				else $phpmode = 'fast-cgi';
+				/* TODO: what other options could be in "php_handler_type"? */
+			}
+			/* TODO: plesk offers some more options:
              * sys_user_id -> owner of files?
              * ip_address_id - needed?
              * fp - frontpage extensions
@@ -634,136 +637,136 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
              * traffic_bandwidth
              * max_connections
              */
-            
-            $web_folder = $hosting['www_root'];
-            $web_folder = preg_replace('/^\/(var|srv)\/www\/(vhosts\/)?[^\/]+\/(.*)\/httpdocs.*/', '$3', $web_folder);
-            
-            //if(substr($web_folder, 0, 1) === '/') $web_folder = substr($web_folder, 1);
-            //if(substr($web_folder, -1, 1) === '/') $web_folder = substr($web_folder, 0, -1);
-            $params = array(
-                            'server_id' => $server_id,
-                            'ip_address' => '*',
-                            //'ipv6_address' => '',
-                            'domain' => $entry['name'],
-                            'web_folder' => $web_folder,
-                            'type' => 'vhostsubdomain', // can be vhost or alias
-                            'parent_domain_id' => $domain_ids[$entry['parentDomainId']],
-                            'vhost_type' => 'name', // or ip (-based)
-                            'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)),
-                            'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)),
-                            'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
-                            'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
-                            'suexec' => yes_no(1), // does plesk use this?!
-                            'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
-                            'subdomain' => '', // plesk always uses this option
-                            'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
-                            'php' => $phpmode,
-                            'fastcgi_php_version' => '', // plesk has no different php versions
-                            'ruby' => yes_no(0), // plesk has no ruby support
-                            'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
-                            'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
-                            'redirect_type' => $redir_type,
-                            'redirect_path' => $redir_path,
-                            'seo_redirect' => '',
-                            'ssl_state' => $entry[''],
-                            'ssl_locality' => $entry[''],
-                            'ssl_organisation' => $entry[''],
-                            'ssl_organisation_unit' => $entry[''],
-                            'ssl_country' => $entry[''],
-                            'ssl_domain' => $entry[''],
-                            'ssl_request' => $entry[''],
-                            'ssl_cert' => $entry[''],
-                            'ssl_bundle' => $entry[''],
-                            'ssl_action' => $entry[''],
-                            'stats_password' => '',
-                            'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
-                            'backup_interval' => 'none',
-                            'backup_copies' => 1,
-                            'allow_override' => 'All',
-                            'pm_process_idle_timeout' => 10,
-                            'pm_max_requests' => 0
-                            );
 
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found domain " . $entry['name'] . " with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true); // read only...
-            }
-            
-            $subdomain_ids[$entry['id']] = $new_id;
-            $subdomain_roots[$entry['id']] = $hosting['www_root'];
-            $subdomain_owners[$entry['id']] = $entry['cl_id'];
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") with folder \"" . $web_folder . "\" could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-                
-                $cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'");
-                $path = $cmd_data['document_root'];
-                add_command('chattr -i ' . escapeshellarg($path));
-                add_command('if [[ -f ' . $path . '/' . $web_folder . '/index.html ]] ; then rm ' . $path . '/' . $web_folder . '/index.html ; fi');
-                add_command('rsync -av --modify-window 10 --progress -e ssh root@${MYSERVER}:' . $hosting['www_root'] . '/ ' . $path . '/' . $web_folder . '/');
-                add_command('chown -R ' . $cmd_data['system_user'] . ':' . $cmd_data['system_group'] . ' ' . escapeshellarg($path));
-                add_command('grep ' . escapeshellarg($hosting['www_root']) . ' ' . $path . '/web -r -l | xargs replace ' . escapeshellarg($hosting['www_root']) . ' ' . escapeshellarg($path . '/web') . ' --');
-                add_command('chown -R root:root ' . escapeshellarg($path . '/log') . ' ' . escapeshellarg($path . '/ssl') . ' ' . escapeshellarg($path . '/web/stats'));
-                add_command('chattr +i ' . escapeshellarg($path));
-                
-            }
-            $domain_ids[$entry['id']] = $new_id;
-        }
-        
-        // subdomains in plesk are real vhosts, so we have to treat them as vhostsubdomains
-        $subdomains = $exdb->queryAllRecords("SELECT d.id, d.dom_id, d.name, d.displayName, d.sys_user_id, d.ssi, d.php, d.cgi, d.perl, d.python, d.fastcgi, d.miva, d.coldfusion, d.asp, d.asp_dot_net, d.ssl, d.same_ssl, d.php_handler_type, d.www_root, d.maintenance_mode, d.certificate_id FROM subdomains as d");
-        foreach($subdomains as $entry) {
-            $res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['dom_id'] . "'");
-            $options = array();
-            while($opt = $exdb->nextRecord()) {
-                $options[$opt['param']] = $opt['val'];
-            }
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            
-            /* TODO: options that might be used later:
+			$web_folder = $hosting['www_root'];
+			$web_folder = preg_replace('/^\/(var|srv)\/www\/(vhosts\/)?[^\/]+\/(.*)\/httpdocs.*/', '$3', $web_folder);
+
+			//if(substr($web_folder, 0, 1) === '/') $web_folder = substr($web_folder, 1);
+			//if(substr($web_folder, -1, 1) === '/') $web_folder = substr($web_folder, 0, -1);
+			$params = array(
+				'server_id' => $server_id,
+				'ip_address' => '*',
+				//'ipv6_address' => '',
+				'domain' => $entry['name'],
+				'web_folder' => $web_folder,
+				'type' => 'vhostsubdomain', // can be vhost or alias
+				'parent_domain_id' => $domain_ids[$entry['parentDomainId']],
+				'vhost_type' => 'name', // or ip (-based)
+				'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)),
+				'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)),
+				'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
+				'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
+				'suexec' => yes_no(1), // does plesk use this?!
+				'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
+				'subdomain' => '', // plesk always uses this option
+				'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
+				'php' => $phpmode,
+				'fastcgi_php_version' => '', // plesk has no different php versions
+				'ruby' => yes_no(0), // plesk has no ruby support
+				'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
+				'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
+				'redirect_type' => $redir_type,
+				'redirect_path' => $redir_path,
+				'seo_redirect' => '',
+				'ssl_state' => $entry[''],
+				'ssl_locality' => $entry[''],
+				'ssl_organisation' => $entry[''],
+				'ssl_organisation_unit' => $entry[''],
+				'ssl_country' => $entry[''],
+				'ssl_domain' => $entry[''],
+				'ssl_request' => $entry[''],
+				'ssl_cert' => $entry[''],
+				'ssl_bundle' => $entry[''],
+				'ssl_action' => $entry[''],
+				'stats_password' => '',
+				'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
+				'backup_interval' => 'none',
+				'backup_copies' => 1,
+				'allow_override' => 'All',
+				'pm_process_idle_timeout' => 10,
+				'pm_max_requests' => 0
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found domain " . $entry['name'] . " with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true); // read only...
+			}
+
+			$subdomain_ids[$entry['id']] = $new_id;
+			$subdomain_roots[$entry['id']] = $hosting['www_root'];
+			$subdomain_owners[$entry['id']] = $entry['cl_id'];
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") with folder \"" . $web_folder . "\" could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+
+				$cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'");
+				$path = $cmd_data['document_root'];
+				add_command('chattr -i ' . escapeshellarg($path));
+				add_command('if [[ -f ' . $path . '/' . $web_folder . '/index.html ]] ; then rm ' . $path . '/' . $web_folder . '/index.html ; fi');
+				add_command('rsync -av --modify-window 10 --progress -e ssh root@${MYSERVER}:' . $hosting['www_root'] . '/ ' . $path . '/' . $web_folder . '/');
+				add_command('chown -R ' . $cmd_data['system_user'] . ':' . $cmd_data['system_group'] . ' ' . escapeshellarg($path));
+				add_command('grep ' . escapeshellarg($hosting['www_root']) . ' ' . $path . '/web -r -l | xargs replace ' . escapeshellarg($hosting['www_root']) . ' ' . escapeshellarg($path . '/web') . ' --');
+				add_command('chown -R root:root ' . escapeshellarg($path . '/log') . ' ' . escapeshellarg($path . '/ssl') . ' ' . escapeshellarg($path . '/web/stats'));
+				add_command('chattr +i ' . escapeshellarg($path));
+
+			}
+			$domain_ids[$entry['id']] = $new_id;
+		}
+
+		// subdomains in plesk are real vhosts, so we have to treat them as vhostsubdomains
+		$subdomains = $exdb->queryAllRecords("SELECT d.id, d.dom_id, d.name, d.displayName, d.sys_user_id, d.ssi, d.php, d.cgi, d.perl, d.python, d.fastcgi, d.miva, d.coldfusion, d.asp, d.asp_dot_net, d.ssl, d.same_ssl, d.php_handler_type, d.www_root, d.maintenance_mode, d.certificate_id FROM subdomains as d");
+		foreach($subdomains as $entry) {
+			$res = $exdb->query("SELECT d.dom_id, d.param, d.val FROM dom_param as d WHERE d.dom_id = '" . $entry['dom_id'] . "'");
+			$options = array();
+			while($opt = $exdb->nextRecord()) {
+				$options[$opt['param']] = $opt['val'];
+			}
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+
+			/* TODO: options that might be used later:
              * OveruseBlock true/false
              * OveruseNotify true/false
              * OveruseSuspend true/false
              * wu_script true/false (webusers allowed to use scripts?)
              * webmail string (webmailer used - horde)
              */
-            
-            $redir_type = '';
-            $redir_path = '';
-            
-            if($entry['htype'] === 'std_fwd') {
-                // redirection
-                $redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
-                $redir_type = 'R,L';
-                $redir_path = $redir['redirect'];
-            } elseif($entry['htype'] === 'vrt_hst') {
-                // default virtual hosting (vhost)
-            } else {
-                /* TODO: unknown type */
-            }
-            
-            $hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id FROM hosting as h WHERE h.dom_id = '" . $entry['dom_id'] . "'");
-            $hosting = array_merge($hosting, $entry); //settings from subdomain override parent settings
-            
-            $phpmode = 'no';
-            if(get_option($hosting, 'php', 'false') === 'true') {
-                $mode = get_option($hosting, 'php_handler_type', 'module');
-                if($mode === 'module') $phpmode = 'mod';
-                else $phpmode = 'fast-cgi';
-                /* TODO: what other options could be in "php_handler_type"? */
-            }
-            /* TODO: plesk offers some more options:
+
+			$redir_type = '';
+			$redir_path = '';
+
+			if($entry['htype'] === 'std_fwd') {
+				// redirection
+				$redir = $exdb->queryOneRecord("SELECT f.dom_id, f.ip_address_id, f.redirect FROM forwarding as f WHERE f.dom_id = '" . $entry['id'] . "'");
+				$redir_type = 'R,L';
+				$redir_path = $redir['redirect'];
+			} elseif($entry['htype'] === 'vrt_hst') {
+				// default virtual hosting (vhost)
+			} else {
+				/* TODO: unknown type */
+			}
+
+			$hosting = $exdb->queryOneRecord("SELECT h.dom_id, h.sys_user_id, h.ip_address_id, h.real_traffic, h.fp, h.fp_ssl, h.fp_enable, h.fp_adm, h.fp_pass, h.ssi, h.php, h.cgi, h.perl, h.python, h.fastcgi, h.miva, h.coldfusion, h.asp, h.asp_dot_net, h.ssl, h.webstat, h.same_ssl, h.traffic_bandwidth, h.max_connection, h.php_handler_type, h.www_root, h.maintenance_mode, h.certificate_id FROM hosting as h WHERE h.dom_id = '" . $entry['dom_id'] . "'");
+			$hosting = array_merge($hosting, $entry); //settings from subdomain override parent settings
+
+			$phpmode = 'no';
+			if(get_option($hosting, 'php', 'false') === 'true') {
+				$mode = get_option($hosting, 'php_handler_type', 'module');
+				if($mode === 'module') $phpmode = 'mod';
+				else $phpmode = 'fast-cgi';
+				/* TODO: what other options could be in "php_handler_type"? */
+			}
+			/* TODO: plesk offers some more options:
              * sys_user_id -> owner of files?
              * ip_address_id - needed?
              * fp - frontpage extensions
@@ -774,100 +777,100 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
              * traffic_bandwidth
              * max_connections
              */
-            
-            $web_folder = $entry['www_root'];
-            $web_folder = preg_replace('/^\/(var|srv)\/www\/(vhosts\/)?[^\/]+\/(.*)\/httpdocs.*/', '$3', $web_folder);
 
-            $params = array(
-                            'server_id' => $server_id,
-                            'ip_address' => '*',
-                            //'ipv6_address' => '',
-                            'domain' => $entry['name'] . '.' . $parent_domain['name'],
-                            'web_folder' => $web_folder,
-                            'type' => 'vhostsubdomain', // can be vhost or alias
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'vhost_type' => 'name', // or ip (-based)
-                            'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)),
-                            'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)),
-                            'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
-                            'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
-                            'suexec' => yes_no(1), // does plesk use this?!
-                            'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
-                            'subdomain' => '', // plesk always uses this option
-                            'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
-                            'php' => $phpmode,
-                            'fastcgi_php_version' => '', // plesk has no different php versions
-                            'ruby' => yes_no(0), // plesk has no ruby support
-                            'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
-                            'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
-                            'redirect_type' => $redir_type,
-                            'redirect_path' => $redir_path,
-                            'seo_redirect' => '',
-                            'ssl_state' => $entry[''],
-                            'ssl_locality' => $entry[''],
-                            'ssl_organisation' => $entry[''],
-                            'ssl_organisation_unit' => $entry[''],
-                            'ssl_country' => $entry[''],
-                            'ssl_domain' => $entry[''],
-                            'ssl_request' => $entry[''],
-                            'ssl_cert' => $entry[''],
-                            'ssl_bundle' => $entry[''],
-                            'ssl_action' => $entry[''],
-                            'stats_password' => '',
-                            'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
-                            'backup_interval' => 'none',
-                            'backup_copies' => 1,
-                            'allow_override' => 'All',
-                            'pm_process_idle_timeout' => 10,
-                            'pm_max_requests' => 0
-                            );
+			$web_folder = $entry['www_root'];
+			$web_folder = preg_replace('/^\/(var|srv)\/www\/(vhosts\/)?[^\/]+\/(.*)\/httpdocs.*/', '$3', $web_folder);
 
-            $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . '.' . $parent_domain['name'] . "'");
-            if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
-            if($old_domain) {
-                $new_id = $old_domain['domain_id'];
-                $params = array_merge($old_domain, $params);
-                $msg .= "Found domain with id " . $new_id . ", updating it.<br />";
-                $ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true); // read only...
-            }
-            
-            $subdomain_ids[$entry['id']] = $new_id;
-            $subdomain_roots[$entry['id']] = $entry['www_root'];
-            $subdomain_owners[$entry['id']] = $entry['cl_id'];
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
-                
-                $cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'");
-                $path = $cmd_data['document_root'];
-                add_command('chattr -i ' . escapeshellarg($path));
-                add_command('if [[ -f ' . $path . '/' . $web_folder . '/index.html ]] ; then rm ' . $path . '/' . $web_folder . '/index.html ; fi');
-                add_command('rsync -av --modify-window 10 --progress -e ssh root@${MYSERVER}:' . $entry['www_root'] . '/ ' . $path . '/' . $web_folder . '/');
-                add_command('chown -R ' . $cmd_data['system_user'] . ':' . $cmd_data['system_group'] . ' ' . escapeshellarg($path));
-                add_command('chown -R root:root ' . escapeshellarg($path . '/log') . ' ' . escapeshellarg($path . '/ssl') . ' ' . escapeshellarg($path . '/web/stats'));
-                add_command('chattr +i ' . escapeshellarg($path));
-            }
-        }
-        
-        // dns have to be done AFTER domains due to missing client info
-        /*
+			$params = array(
+				'server_id' => $server_id,
+				'ip_address' => '*',
+				//'ipv6_address' => '',
+				'domain' => $entry['name'] . '.' . $parent_domain['name'],
+				'web_folder' => $web_folder,
+				'type' => 'vhostsubdomain', // can be vhost or alias
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'vhost_type' => 'name', // or ip (-based)
+				'hd_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'disk_space', -1)),
+				'traffic_quota' => byte_to_mbyte(get_limit($limits, $entry['dom_id'], 'max_traffic', -1)),
+				'cgi' => yes_no(get_option($hosting, 'cgi', 'false') === 'true' ? 1 : 0),
+				'ssi' => yes_no(get_option($hosting, 'ssi', 'false') === 'true' ? 1 : 0),
+				'suexec' => yes_no(1), // does plesk use this?!
+				'errordocs' => get_option($options, 'apacheErrorDocs', 'false') === 'true' ? 1 : 0,
+				'subdomain' => '', // plesk always uses this option
+				'ssl' => yes_no(get_option($hosting, 'ssl', 'false') === 'true' ? 1 : 0),
+				'php' => $phpmode,
+				'fastcgi_php_version' => '', // plesk has no different php versions
+				'ruby' => yes_no(0), // plesk has no ruby support
+				'python' => yes_no(get_option($hosting, 'python', 'false') === 'true' ? 1 : 0),
+				'active' => yes_no(($entry['status'] == 0 && get_option($hosting, 'maintenance_mode', 'false') !== 'true') ? 1 : 0),
+				'redirect_type' => $redir_type,
+				'redirect_path' => $redir_path,
+				'seo_redirect' => '',
+				'ssl_state' => $entry[''],
+				'ssl_locality' => $entry[''],
+				'ssl_organisation' => $entry[''],
+				'ssl_organisation_unit' => $entry[''],
+				'ssl_country' => $entry[''],
+				'ssl_domain' => $entry[''],
+				'ssl_request' => $entry[''],
+				'ssl_cert' => $entry[''],
+				'ssl_bundle' => $entry[''],
+				'ssl_action' => $entry[''],
+				'stats_password' => '',
+				'stats_type' => get_option($hosting, 'webstat', 'webalizer') === 'awstats' ? 'awstats' : 'webalizer',
+				'backup_interval' => 'none',
+				'backup_copies' => 1,
+				'allow_override' => 'All',
+				'pm_process_idle_timeout' => 10,
+				'pm_max_requests' => 0
+			);
+
+			$old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain = '" . $entry['name'] . '.' . $parent_domain['name'] . "'");
+			if(!$old_domain) $old_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE CONCAT(subdomain, '.', domain) = '" . $entry['name'] . "'");
+			if($old_domain) {
+				$new_id = $old_domain['domain_id'];
+				$params = array_merge($old_domain, $params);
+				$msg .= "Found domain with id " . $new_id . ", updating it.<br />";
+				$ok = $importer->sites_web_vhost_subdomain_update($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $new_id, $params);
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->sites_web_vhost_subdomain_add($session_id, $plesk_ispc_ids[$parent_domain['cl_id']], $params, true); // read only...
+			}
+
+			$subdomain_ids[$entry['id']] = $new_id;
+			$subdomain_roots[$entry['id']] = $entry['www_root'];
+			$subdomain_owners[$entry['id']] = $entry['cl_id'];
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Subdomain " . $entry['id'] . " (" . $entry['name'] . ") inserted.<br />";
+
+				$cmd_data = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = '" . $new_id . "'");
+				$path = $cmd_data['document_root'];
+				add_command('chattr -i ' . escapeshellarg($path));
+				add_command('if [[ -f ' . $path . '/' . $web_folder . '/index.html ]] ; then rm ' . $path . '/' . $web_folder . '/index.html ; fi');
+				add_command('rsync -av --modify-window 10 --progress -e ssh root@${MYSERVER}:' . $entry['www_root'] . '/ ' . $path . '/' . $web_folder . '/');
+				add_command('chown -R ' . $cmd_data['system_user'] . ':' . $cmd_data['system_group'] . ' ' . escapeshellarg($path));
+				add_command('chown -R root:root ' . escapeshellarg($path . '/log') . ' ' . escapeshellarg($path . '/ssl') . ' ' . escapeshellarg($path . '/web/stats'));
+				add_command('chattr +i ' . escapeshellarg($path));
+			}
+		}
+
+		// dns have to be done AFTER domains due to missing client info
+		/*
         $dns_zone_ids = array();
         $dns_zone_serials = array();
         $dns_zones = $exdb->queryAllRecords("SELECT d.id, d.name, d.displayName, d.status, d.email, d.type, d.ttl, d.ttl_unit, d.refresh, d.refresh_unit, d.retry, d.retry_unit, d.expire, d.expire_unit, d.minimum, d.minimum_unit, d.serial_format, d.serial FROM dns_zone as d");
         foreach($dns_zones as $entry) {
             $ns = $exdb->queryOneRecord("SELECT d.id, d.val FROM dns_recs as d WHERE d.dns_zone_id = '" . $entry['id'] . "' AND d.type = 'NS'");
             if(!$ns) $ns = array('id' => 0, 'val' => 'ns.' . $entry['name']);
-            
+
             $dom_id = $dns_domain_ids[$entry['id']];
             $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
             if(!$client_id) $client_id = 0;
-            
+
             $params = array(
                             'server_id' => $server_id,
                             'origin' => add_dot($entry['name']), // what to put here?
@@ -884,7 +887,7 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
                             'update_acl' => '',
                             'active' => yes_no(($entry['status'] == 0 ? 1 : 0))
                             );
-            
+
             $old_dns = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin = '" . add_dot($entry['name']) . "'");
             if($old_dns) $old_id = $old_dns['id'];
             if($old_id) {
@@ -911,7 +914,7 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
         }
         unset($dns_zones);
         */
-        /* types:
+		/* types:
          * PTR, NS, A, CNAME, MX, TXT, AAAA
          *//*
         $dns_records = $exdb->queryAllRecords("SELECT d.id, d.dns_zone_id, d.type, d.displayHost, d.host, d.displayVal, d.val, d.opt, d.time_stamp FROM dns_recs as d");
@@ -921,11 +924,11 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
                 // entry for missing dns zone...?
                 continue;
             }
-            
+
             $dom_id = $dns_domain_ids[$entry['dns_zone_id']];
             $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
             if(!$client_id) $client_id = 0;
-            
+
             $params = array(
                         'server_id' => $server_id,
                         'zone' => $dns_id,
@@ -937,14 +940,14 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
                         'stamp' => $entry['time_stamp'],
                         //'serial' => $dns_zone_serials[$entry['id']]
                         );
-            
-            
+
+
             $record = $app->db->queryOneRecord("SELECT id FROM dns_rr WHERE zone = '" . $dns_zone_ids[$entry['dns_zone_id']] . "' AND name = '" . add_dot($entry['host']) . "' AND type = '" . $entry['type'] . "'");
             $old_id = 0;
             if($record) {
                 $old_id = $record['id'];
             }
-            
+
             $new_id = false;
             if($entry['type'] === 'MX') {
                 $params['aux'] = $entry['opt'];
@@ -1004,424 +1007,424 @@ if(isset($_POST['start']) && $_POST['start'] == 1) {
             } else {
                 $msg .= "DNS " . $entry['id'] . " (" . $entry['name'] . ") inserted/updated.<br />";
             }
-            
+
         }
         unset($dns_records);
         */
-        
-        $folder_ids = array();
-        /* web_folder creation*/
-        $protected_dirs = $exdb->queryAllRecords("SELECT `id`, `non_ssl`, `ssl`, `cgi_bin`, `realm`, `path`, `dom_id` FROM protected_dirs");
-        foreach($protected_dirs as $entry) {
-            if($entry['path'] == 'plesk-stat') continue;
-            
-            $params = array('server_id' => $server_id,
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'path' => $entry['path'],
-                            'active' => 'y');
-            
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-            
-            $folder_id = 0;
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_folder` WHERE `parent_domain_id` = \'' . $domain_ids[$entry['dom_id']] . '\' AND `path` = \'' . $app->db->quote($entry['path']) . '\'');
-            if($check) {
-                $ok = $importer->sites_web_folder_update($session_id, $client_id, $check['web_folder_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $folder_id = $check['web_folder_id'];
-                $msg .= 'Updated HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
-            } else {
-                $folder_id = $importer->sites_web_folder_add($session_id, $client_id, $params);
-                $msg .= 'Created HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
-                if(!$folder_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
-            }
-            
-            $folder_ids[$entry['id']] = $folder_id;
-        }
-        
-        $pd_users = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.pd_id, a.password, d.dom_id FROM pd_users as u INNER JOIN protected_dirs as d ON (d.id = u.pd_id) INNER JOIN accounts as a ON (a.id = u.account_id)");
-        foreach($pd_users as $entry) {
-            $params = array('server_id' => $server_id,
-                            'web_folder_id' => $folder_ids[$entry['pd_id']],
-                            'username' => $entry['login'],
-                            'password' => $entry['password'],
-                            'active' => 'y');
-            if($entry['login'] == '' || !isset($folder_ids[$entry['pd_id']])) {
-                $msg .= 'Skipping Folder user because of missing data.<br />';
-                continue;
-            }
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-            
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_folder_user` WHERE `web_folder_id` = ' . intval($folder_ids[$entry['pd_id']]) . ' AND `username` = \'' . $entry['login'] . '\'');
-            if($check) {
-                $ok = $importer->sites_web_folder_user_update($session_id, $client_id, $check['web_folder_user_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $msg .= 'Updated HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
-            } else {
-                $fu_id = $importer->sites_web_folder_user_add($session_id, $client_id, $params);
-                $msg .= 'Created HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
-                if(!$fu_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
-            }
-        }
-        
-        /*$web_users = $exdb->queryAllRecords("SELECT id, dom_id, sys_user_id, ssi, php, cgi, perl, python, fastcgi, asp, asp_dot_net FROM web_users");
+
+		$folder_ids = array();
+		/* web_folder creation*/
+		$protected_dirs = $exdb->queryAllRecords("SELECT `id`, `non_ssl`, `ssl`, `cgi_bin`, `realm`, `path`, `dom_id` FROM protected_dirs");
+		foreach($protected_dirs as $entry) {
+			if($entry['path'] == 'plesk-stat') continue;
+
+			$params = array('server_id' => $server_id,
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'path' => $entry['path'],
+				'active' => 'y');
+
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+
+			$folder_id = 0;
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_folder` WHERE `parent_domain_id` = \'' . $domain_ids[$entry['dom_id']] . '\' AND `path` = \'' . $app->db->quote($entry['path']) . '\'');
+			if($check) {
+				$ok = $importer->sites_web_folder_update($session_id, $client_id, $check['web_folder_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$folder_id = $check['web_folder_id'];
+				$msg .= 'Updated HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
+			} else {
+				$folder_id = $importer->sites_web_folder_add($session_id, $client_id, $params);
+				$msg .= 'Created HTTP AUTH folder (' . $folder_id . '): ' . $entry['path'] . '<br />';
+				if(!$folder_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
+			}
+
+			$folder_ids[$entry['id']] = $folder_id;
+		}
+
+		$pd_users = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.pd_id, a.password, d.dom_id FROM pd_users as u INNER JOIN protected_dirs as d ON (d.id = u.pd_id) INNER JOIN accounts as a ON (a.id = u.account_id)");
+		foreach($pd_users as $entry) {
+			$params = array('server_id' => $server_id,
+				'web_folder_id' => $folder_ids[$entry['pd_id']],
+				'username' => $entry['login'],
+				'password' => $entry['password'],
+				'active' => 'y');
+			if($entry['login'] == '' || !isset($folder_ids[$entry['pd_id']])) {
+				$msg .= 'Skipping Folder user because of missing data.<br />';
+				continue;
+			}
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_folder_user` WHERE `web_folder_id` = ' . intval($folder_ids[$entry['pd_id']]) . ' AND `username` = \'' . $entry['login'] . '\'');
+			if($check) {
+				$ok = $importer->sites_web_folder_user_update($session_id, $client_id, $check['web_folder_user_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$msg .= 'Updated HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
+			} else {
+				$fu_id = $importer->sites_web_folder_user_add($session_id, $client_id, $params);
+				$msg .= 'Created HTTP AUTH folder user  (' . $fu_id . '): ' . $entry['login'] . '<br />';
+				if(!$fu_id) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />" . var_export($params, true) . '<br />';
+			}
+		}
+
+		/*$web_users = $exdb->queryAllRecords("SELECT id, dom_id, sys_user_id, ssi, php, cgi, perl, python, fastcgi, asp, asp_dot_net FROM web_users");
         foreach($web_users as $entry) {
-            $params = 
+            $params =
         }
         */
-        
-        
-        $ftp_users = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.sys_user_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM ftp_users as f INNER JOIN sys_users as s ON (s.id = f.sys_user_id) INNER JOIN accounts as a ON (a.id = s.account_id)");
-        $ftp_users = array_merge($ftp_users, $dom_ftp_users);
-        foreach($ftp_users as $entry) {
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            if(!$entry['id']) continue;
-            $ispc_dom_id = $domain_ids[$entry['dom_id']];
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-            if(!$client_id) $client_id = 0;
-            
-            $document_root = str_replace("[website_id]",$ispc_dom_id,$web_config["website_path"]);
-            $document_root = str_replace("[website_idhash_1]",id_hash($ispc_dom_id,1),$document_root);
-            $document_root = str_replace("[website_idhash_2]",id_hash($ispc_dom_id,1),$document_root);
-            $document_root = str_replace("[website_idhash_3]",id_hash($ispc_dom_id,1),$document_root);
-            $document_root = str_replace("[website_idhash_4]",id_hash($ispc_dom_id,1),$document_root);
-
-            // Set the values for document_root, system_user and system_group
-            $system_user = 'web'.$ispc_dom_id;
-            $system_group = 'client'.$client_id;
-            $document_root = str_replace("[client_id]",$client_id,$document_root);
-            $document_root = str_replace("[client_idhash_1]",id_hash($client_id,1),$document_root);
-            $document_root = str_replace("[client_idhash_2]",id_hash($client_id,2),$document_root);
-            $document_root = str_replace("[client_idhash_3]",id_hash($client_id,3),$document_root);
-            $document_root = str_replace("[client_idhash_4]",id_hash($client_id,4),$document_root);
-            
-            $uid = $system_user;
-            $gid = $system_group;
-            
-            $sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = '" . $client_id . "'");
-            if(!$sys_grp) $sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = 0");
-            
-            if(!$sys_grp) $sys_groupid = 1;
-            else $sys_groupid = $sys_grp['groupid'];
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'parent_domain_id' => $domain_ids[$entry['dom_id']],
-                            'username' => $entry['login'],
-                            'password' => $entry['password'],
-                            'quota_size' => byte_to_mbyte(($entry['quota'] == 0 ? -1 : $entry['quota'])),
-                            'active' => yes_no(1),
-                            'uid' => $uid,
-                            'gid' => $gid,
-                            'dir' => $document_root . (substr($document_root, -1) !== '/' ? '/' : ''),
-                            'sys_groupid' => $sys_groupid
-                            //'quota_files' => $entry[''],
-                            //'ul_ratio' => $entry[''],
-                            //'dl_ratio' => $entry[''],
-                            //'ul_bandwidth' => $entry[''],
-                            //'dl_bandwidth' => $entry['']
-                            );
-            $new_id = false;
-            $old_ftp = $app->db->queryOneRecord("SELECT ftp_user_id, parent_domain_id FROM ftp_user WHERE username = '" . $entry['login'] ."'");
-            if($old_ftp) {
-                if($old_ftp['parent_domain_id'] != $domain_ids[$entry['dom_id']]) {
-                    $msg .= "FTP Account conflicts with other domain!<br />";
-                } else {
-                    $new_id = $old_ftp['ftp_user_id'];
-                    $ok = $importer->sites_ftp_user_update($session_id, $client_id, $new_id, array_merge($old_ftp, $params));
-                    if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                }
-            } else {
-                $new_id = $importer->sites_ftp_user_add($session_id, $client_id, $params);
-            }
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "FTP " . $entry['id'] . " (" . $entry['login'] . ") could not be inserted.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $msg .= "Params: " . var_export($params, true) . "<br />";
-            } else {
-                $msg .= "FTP Account " . $entry['id'] . " (" . $entry['login'] . ") inserted.<br />";
-            }
-        }
-        
-        $mail_config = $app->getconf->get_server_config($server_id, 'mail');
-        
-        $mail_addresses = $exdb->queryAllRecords("SELECT m.id, m.mail_name, m.perm_id, m.postbox, m.account_id, m.redirect, m.redir_addr, m.mail_group, m.autoresponder, m.spamfilter, m.virusfilter, m.mbox_quota, m.dom_id, m.userId, a.password, a.type as `pwtype` FROM mail as m LEFT JOIN accounts as a ON (a.id = m.account_id) ");
-        $mail_ids = array();
-        foreach($mail_addresses as $entry) {
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            if(!$parent_domain) {
-                $msg .= "Could not insert/update mail address " . $entry['mail_name'] . " as domain is missing.<br />";
-                continue;
-            }
-            
-            /* postbox true/false
+
+
+		$ftp_users = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.sys_user_id, s.login, s.account_id, s.home, s.shell, s.quota, s.mapped_to, a.password, a.type as `pwtype` FROM ftp_users as f INNER JOIN sys_users as s ON (s.id = f.sys_user_id) INNER JOIN accounts as a ON (a.id = s.account_id)");
+		$ftp_users = array_merge($ftp_users, $dom_ftp_users);
+		foreach($ftp_users as $entry) {
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+			if(!$entry['id']) continue;
+			$ispc_dom_id = $domain_ids[$entry['dom_id']];
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+			if(!$client_id) $client_id = 0;
+
+			$document_root = str_replace("[website_id]", $ispc_dom_id, $web_config["website_path"]);
+			$document_root = str_replace("[website_idhash_1]", id_hash($ispc_dom_id, 1), $document_root);
+			$document_root = str_replace("[website_idhash_2]", id_hash($ispc_dom_id, 1), $document_root);
+			$document_root = str_replace("[website_idhash_3]", id_hash($ispc_dom_id, 1), $document_root);
+			$document_root = str_replace("[website_idhash_4]", id_hash($ispc_dom_id, 1), $document_root);
+
+			// Set the values for document_root, system_user and system_group
+			$system_user = 'web'.$ispc_dom_id;
+			$system_group = 'client'.$client_id;
+			$document_root = str_replace("[client_id]", $client_id, $document_root);
+			$document_root = str_replace("[client_idhash_1]", id_hash($client_id, 1), $document_root);
+			$document_root = str_replace("[client_idhash_2]", id_hash($client_id, 2), $document_root);
+			$document_root = str_replace("[client_idhash_3]", id_hash($client_id, 3), $document_root);
+			$document_root = str_replace("[client_idhash_4]", id_hash($client_id, 4), $document_root);
+
+			$uid = $system_user;
+			$gid = $system_group;
+
+			$sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = '" . $client_id . "'");
+			if(!$sys_grp) $sys_grp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = 0");
+
+			if(!$sys_grp) $sys_groupid = 1;
+			else $sys_groupid = $sys_grp['groupid'];
+
+			$params = array(
+				'server_id' => $server_id,
+				'parent_domain_id' => $domain_ids[$entry['dom_id']],
+				'username' => $entry['login'],
+				'password' => $entry['password'],
+				'quota_size' => byte_to_mbyte(($entry['quota'] == 0 ? -1 : $entry['quota'])),
+				'active' => yes_no(1),
+				'uid' => $uid,
+				'gid' => $gid,
+				'dir' => $document_root . (substr($document_root, -1) !== '/' ? '/' : ''),
+				'sys_groupid' => $sys_groupid
+				//'quota_files' => $entry[''],
+				//'ul_ratio' => $entry[''],
+				//'dl_ratio' => $entry[''],
+				//'ul_bandwidth' => $entry[''],
+				//'dl_bandwidth' => $entry['']
+			);
+			$new_id = false;
+			$old_ftp = $app->db->queryOneRecord("SELECT ftp_user_id, parent_domain_id FROM ftp_user WHERE username = '" . $entry['login'] ."'");
+			if($old_ftp) {
+				if($old_ftp['parent_domain_id'] != $domain_ids[$entry['dom_id']]) {
+					$msg .= "FTP Account conflicts with other domain!<br />";
+				} else {
+					$new_id = $old_ftp['ftp_user_id'];
+					$ok = $importer->sites_ftp_user_update($session_id, $client_id, $new_id, array_merge($old_ftp, $params));
+					if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				}
+			} else {
+				$new_id = $importer->sites_ftp_user_add($session_id, $client_id, $params);
+			}
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "FTP " . $entry['id'] . " (" . $entry['login'] . ") could not be inserted.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$msg .= "Params: " . var_export($params, true) . "<br />";
+			} else {
+				$msg .= "FTP Account " . $entry['id'] . " (" . $entry['login'] . ") inserted.<br />";
+			}
+		}
+
+		$mail_config = $app->getconf->get_server_config($server_id, 'mail');
+
+		$mail_addresses = $exdb->queryAllRecords("SELECT m.id, m.mail_name, m.perm_id, m.postbox, m.account_id, m.redirect, m.redir_addr, m.mail_group, m.autoresponder, m.spamfilter, m.virusfilter, m.mbox_quota, m.dom_id, m.userId, a.password, a.type as `pwtype` FROM mail as m LEFT JOIN accounts as a ON (a.id = m.account_id) ");
+		$mail_ids = array();
+		foreach($mail_addresses as $entry) {
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+			if(!$parent_domain) {
+				$msg .= "Could not insert/update mail address " . $entry['mail_name'] . " as domain is missing.<br />";
+				continue;
+			}
+
+			/* postbox true/false
              * mail_group true/false
              * spamfilter true/false
              */
-            
-            
-            $has_responder = false;
-            if($entry['autoresponder'] === 'true') {
-                $responder = $exdb->queryOneRecord("SELECT id, mn_id, resp_name, keystr, key_where, subject, reply_to, content_type, charset, text, resp_on, ans_freq, mem_limit FROM mail_resp WHERE mn_id = '" . $entry['id'] . "'");
-                if($responder) $has_responder = true;
-            }
-            
-            $maildir = str_replace("[domain]",$parent_domain["name"],$mail_config["maildir_path"]);
-			$maildir = str_replace("[localpart]",strtolower($entry["mail_name"]),$maildir);
-            
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'email' => $entry['mail_name'] . "@" . $parent_domain['name'],
-                            'login' => strtolower($entry['mail_name'] . "@" . $parent_domain['name']),
-                            'password' => $entry['password'],
-                            'name' => $entry[''],
-                            'quota' => ($entry['mbox_quota'] == -1 ? 0 : $entry['mbox_quota']), // in bytes!
-                            'cc' => $entry['redir_addr'],
-                            'maildir' => $maildir,
-                            'homedir' => $mail_config["homedir_path"],
-                            'uid' => $mail_config["mailuser_uid"],
-                            'gid' => $mail_config["mailuser_gid"],
-                            'postfix' => yes_no(1),
-                            'disableimap' => yes_no(0),
-                            'disablepop3' => yes_no(0),
-                            'autoresponder_subject' => ($has_responder ? $responder['subject'] : ''),
-                            'autoresponder_text' => ($has_responder ? $responder['text'] : ''),
-                            'autoresponder' => yes_no($has_responder ? 1 : 0),
-                            'autoresponder_start_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time()) : strftime('%Y-%m-%d', time() - (3600*24))),
-                            'autoresponder_end_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time() + (3600*24*365)) : strftime('%Y-%m-%d', time())),
-                            'move_junk' => yes_no(0)
-                            );
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-            
-            // if this is no postbox we do not need to create a mailuser
-            if($entry['postbox'] !== 'false') {
-                $old_mail = $app->db->queryOneRecord("SELECT mailuser_id FROM mail_user WHERE email = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
-                if($old_mail) {
-                    $new_id = $old_mail['mailuser_id'];
-                    $ok = $importer->mail_user_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
-                    if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $new_id = $importer->mail_user_add($session_id, $client_id, $params);
-                }
 
-                if($new_id === false) {
-                    //something went wrong here...
-                    $msg .= "Mail" . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
-                    $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $msg .= "Mail " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
-                    
-                    add_command('rsync -av --delete-after --modify-window 10 --progress -e ssh root@${MYSERVER}:/var/qmail/mailnames/' . $parent_domain['name'] . '/' . strtolower($entry['mail_name']) . '/Maildir/ ' . $maildir . '/Maildir/');
-                    add_command('chown -R vmail:vmail ' . $maildir);
-                    add_command('chmod 744 ' . $maildir . '/Maildir/subscriptions');
-                    add_command('chmod 600 ' . $maildir . '/Maildir/dovecot-*');
-                    add_command('chmod 700 ' . $maildir . '/Maildir/cur ' . $maildir . '/Maildir/new ' . $maildir . '/Maildir/tmp');
-                    add_command('chmod 600 ' . $maildir . '/Maildir/cur/* ' . $maildir . '/Maildir/new/* ' . $maildir . '/Maildir/tmp/*');
-                }
-                $mail_ids[$entry['id']] = $new_id;
-            }
-            
-            // select all redirs for this address
-            $mail_redir = $exdb->queryAllRecords("SELECT id, mn_id, address FROM mail_redir WHERE mn_id = '" . $entry['id'] . "'");
-            foreach($mail_redir as $redir) {
-                $params = array(
-                                'server_id' => $server_id,
-                                'source' => $entry['mail_name'] . "@" . $parent_domain['name'],
-                                'destination' => $redir['address'],
-                                'type' => 'forward', // or forward
-                                'active' => yes_no(1)
-                                );
-                
-                $old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "' AND destination = '" . $redir['address'] . "'");
-                if($old_mail) {
-                    $new_id = $old_mail['forwarding_id'];
-                    $ok = $importer->mail_forward_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
-                    if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $new_id = $importer->mail_forward_add($session_id, $client_id, $params);
-                }
 
-                if($new_id === false) {
-                    //something went wrong here...
-                    $msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") could not be inserted/updated.<br />";
-                    $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                } else {
-                    $msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") inserted/updated.<br />";
-                }
-            }
-            unset($mail_redir);
-        }
-        unset($mail_addresses);
-        
-        $mail_aliases = $exdb->queryAllRecords("SELECT a.id, a.mn_id, a.alias, m.dom_id, m.mail_name FROM mail_aliases as a INNER JOIN mail as m ON (m.id = a.mn_id)");
-        foreach($mail_aliases as $entry) {
-            
-            $parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
-            if(!$parent_domain) {
-                $msg .= "Could not insert/update mail alias " . $entry['alias'] . " as domain is missing.<br />";
-                continue;
-            }
-            
-            $params = array(
-                            'server_id' => $server_id,
-                            'source' => $entry['alias'] . "@" . $parent_domain['name'],
-                            'destination' => $entry['mail_name'] . "@" . $parent_domain['name'],
-                            'type' => 'alias', // or forward
-                            'active' => yes_no(1)
-                            );
-            $client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
-        
-            $old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['alias'] . "@" . $parent_domain['name'] . "' AND destination = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
-            if($old_mail) {
-                $new_id = $old_mail['forwarding_id'];
-                $ok = $importer->mail_alias_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $new_id = $importer->mail_alias_add($session_id, $client_id, $params);
-            }
-            
-            if($new_id === false) {
-                //something went wrong here...
-                $msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
-                $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
-            }
-        }
-        unset($mail_aliases);
-        
-        //spamfilter // preferences = true/false, username = email address, can be *@*
-        //id, username, preferences
-        
-        //spamfilter_preferences
-        //prefid, spamfilter_id, preference, value
-        
-        
-        
-        //$client_traffic = $exdb->queryAllRecords("SELECT t.cl_id, t.date, t.http_in, t.http_out, t.ftp_in, t.ftp_out, t.smtp_in, t.smtp_out, t.pop3_imap_in, t.pop3_imap_out FROM ClientsTraffic as t");
-        
-        $db_userids = array();
-        
-        $db_users  = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.db_id, a.password, a.type as `pwtype`, d.dom_id FROM db_users as u INNER JOIN data_bases as d ON (d.id = u.db_id) LEFT JOIN accounts as a ON (a.id = u.account_id)");
-        foreach($db_users as $db_user) {
-            // database user
-            $params = array('server_id' => $server_id,
-                            'database_user' => $db_user['login'],
-                            'database_password' => $db_user['password']);
-            
-            $client_id = $plesk_ispc_ids[$domain_owners[$db_user['dom_id']]];
-
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user` = \'' . $app->db->quote($db_user['login']) . '\'');
-            $db_user_id = 0;
-            if($check) {
-                $ok = $importer->sites_database_user_update($session_id, $client_id, $check['database_user_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-                $db_user_id = $check['database_user_id'];
-            } else {
-                $db_user_id = $importer->sites_database_user_add($session_id, $client_id, $params);
-            }
-            
-            if(!isset($db_userids[$db_user['db_id']])) $db_userids[$db_user['db_id']] = $db_user_id;
-            $msg .= 'Created / updated database user: ' . $db_user['login'] . '<br />';
-        }
-         
-        add_command('# DATABASES');
-            
-        $databases  = $exdb->queryAllRecords("SELECT d.id, d.name, d.type, d.dom_id, d.db_server_id, d.default_user_id FROM `data_bases` as d");
-        foreach($databases as $database) {
-            $params = array('server_id' => $server_id,
-                            'parent_domain_id' => $domain_ids[$database['dom_id']],
-                            'type' => 'mysql',
-                            'database_name' => $database['name'],
-                            'database_user_id' => $db_userids[$database['id']],
-                            'database_ro_user_id' => 0,
-                            'database_charset' => 'utf8',
-                            'remote_access' => 'n',
-                            'active' => 'y',
-                            'remote_ips' => '');
-            
-            $client_id = $plesk_ispc_ids[$domain_owners[$database['dom_id']]];
-            
-            $check = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_name` = \'' . $app->db->quote($database['name']) . '\'');
-            if($check) {
-                $ok = $importer->sites_database_update($session_id, $client_id, $check['database_id'], array_merge($check, $params));
-                if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
-            } else {
-                $importer->sites_database_add($session_id, $client_id, $params);
-            }
-            
-            add_command('for T in `mysql -u ${MYSQL_IMPORT_USER} -p${MYSQL_IMPORT_PASS} ' . $database['name'] . ' -e \'show tables\' | awk \'{ print $1}\' | grep -v \'^Tables\'` ; do echo "DROP TABLE \\`$T\\`" ; mysql -u ${MYSQL_IMPORT_USER} -p${MYSQL_IMPORT_PASS} ' . $database['name'] . ' -e "DROP TABLE \\`$T\\`" ; done');
-            add_command('mysqldump -cCQ --quote-names --hex-blob -h ${MYSERVER} -u ${MYSQL_EXPORT_USER} -p${MYSQL_EXPORT_PASS} ' . $database['name'] . ' | mysql -D ' . $database['name'] . ' -u ${MYSQL_IMPORT_USER} -p${MYSQL_IMPORT_PASS}');
-            
-            $msg .= 'Created / updated database: ' . $database['name'] . '<br />';
-         }
-        
-        // do we need table disk_usage for import? i think we don't
-        
-        // name is domain name, displayName is including "Umlaute"
-        //$anon_ftp = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.max_conn, f.bandwidth, f.incoming, f.incoming_readable, f.incoming_subdirs, f.status, f.quota, f.display_login, f.login_text FROM anon_ftp as f");
-        
-        
-        //DomainServices
-        //id, dom_id, type, status, parameters_id, ipCollectionId
-        
-        //DomainsTraffic
-        //dom_id, date, http_in, http_out, ftp_in, ftp_out, smtp_in, smtp_out, pop3_imap_in, pop3_imap_out
-        
-        
-        //IP_Adresses
-        //id, ip_address, mask, iface, ssl_certificate_id, default_domain_id, ftps, main, status
-        
-        //ip_pool
-        //id, ip_address_id, type
-
-        /* TODO:
+			$has_responder = false;
+			if($entry['autoresponder'] === 'true') {
+				$responder = $exdb->queryOneRecord("SELECT id, mn_id, resp_name, keystr, key_where, subject, reply_to, content_type, charset, text, resp_on, ans_freq, mem_limit FROM mail_resp WHERE mn_id = '" . $entry['id'] . "'");
+				if($responder) $has_responder = true;
+			}
+
+			$maildir = str_replace("[domain]", $parent_domain["name"], $mail_config["maildir_path"]);
+			$maildir = str_replace("[localpart]", strtolower($entry["mail_name"]), $maildir);
+
+
+			$params = array(
+				'server_id' => $server_id,
+				'email' => $entry['mail_name'] . "@" . $parent_domain['name'],
+				'login' => strtolower($entry['mail_name'] . "@" . $parent_domain['name']),
+				'password' => $entry['password'],
+				'name' => $entry[''],
+				'quota' => ($entry['mbox_quota'] == -1 ? 0 : $entry['mbox_quota']), // in bytes!
+				'cc' => $entry['redir_addr'],
+				'maildir' => $maildir,
+				'homedir' => $mail_config["homedir_path"],
+				'uid' => $mail_config["mailuser_uid"],
+				'gid' => $mail_config["mailuser_gid"],
+				'postfix' => yes_no(1),
+				'disableimap' => yes_no(0),
+				'disablepop3' => yes_no(0),
+				'autoresponder_subject' => ($has_responder ? $responder['subject'] : ''),
+				'autoresponder_text' => ($has_responder ? $responder['text'] : ''),
+				'autoresponder' => yes_no($has_responder ? 1 : 0),
+				'autoresponder_start_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time()) : strftime('%Y-%m-%d', time() - (3600*24))),
+				'autoresponder_end_date' => ($has_responder && $responder['resp_on'] === 'true' ? strftime('%Y-%m-%d', time() + (3600*24*365)) : strftime('%Y-%m-%d', time())),
+				'move_junk' => yes_no(0)
+			);
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+
+			// if this is no postbox we do not need to create a mailuser
+			if($entry['postbox'] !== 'false') {
+				$old_mail = $app->db->queryOneRecord("SELECT mailuser_id FROM mail_user WHERE email = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
+				if($old_mail) {
+					$new_id = $old_mail['mailuser_id'];
+					$ok = $importer->mail_user_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
+					if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$new_id = $importer->mail_user_add($session_id, $client_id, $params);
+				}
+
+				if($new_id === false) {
+					//something went wrong here...
+					$msg .= "Mail" . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
+					$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$msg .= "Mail " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
+
+					add_command('rsync -av --delete-after --modify-window 10 --progress -e ssh root@${MYSERVER}:/var/qmail/mailnames/' . $parent_domain['name'] . '/' . strtolower($entry['mail_name']) . '/Maildir/ ' . $maildir . '/Maildir/');
+					add_command('chown -R vmail:vmail ' . $maildir);
+					add_command('chmod 744 ' . $maildir . '/Maildir/subscriptions');
+					add_command('chmod 600 ' . $maildir . '/Maildir/dovecot-*');
+					add_command('chmod 700 ' . $maildir . '/Maildir/cur ' . $maildir . '/Maildir/new ' . $maildir . '/Maildir/tmp');
+					add_command('chmod 600 ' . $maildir . '/Maildir/cur/* ' . $maildir . '/Maildir/new/* ' . $maildir . '/Maildir/tmp/*');
+				}
+				$mail_ids[$entry['id']] = $new_id;
+			}
+
+			// select all redirs for this address
+			$mail_redir = $exdb->queryAllRecords("SELECT id, mn_id, address FROM mail_redir WHERE mn_id = '" . $entry['id'] . "'");
+			foreach($mail_redir as $redir) {
+				$params = array(
+					'server_id' => $server_id,
+					'source' => $entry['mail_name'] . "@" . $parent_domain['name'],
+					'destination' => $redir['address'],
+					'type' => 'forward', // or forward
+					'active' => yes_no(1)
+				);
+
+				$old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "' AND destination = '" . $redir['address'] . "'");
+				if($old_mail) {
+					$new_id = $old_mail['forwarding_id'];
+					$ok = $importer->mail_forward_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
+					if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$new_id = $importer->mail_forward_add($session_id, $client_id, $params);
+				}
+
+				if($new_id === false) {
+					//something went wrong here...
+					$msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") could not be inserted/updated.<br />";
+					$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				} else {
+					$msg .= "Mail redirect " . $entry['id'] . " (" . $entry['mail_name'] . "@" . $parent_domain['name'] . " to " . $redir['address'] . ") inserted/updated.<br />";
+				}
+			}
+			unset($mail_redir);
+		}
+		unset($mail_addresses);
+
+		$mail_aliases = $exdb->queryAllRecords("SELECT a.id, a.mn_id, a.alias, m.dom_id, m.mail_name FROM mail_aliases as a INNER JOIN mail as m ON (m.id = a.mn_id)");
+		foreach($mail_aliases as $entry) {
+
+			$parent_domain = $exdb->queryOneRecord("SELECT d.id, d.cl_id, d.name FROM domains as d WHERE d.id = '" . $entry['dom_id'] . "'");
+			if(!$parent_domain) {
+				$msg .= "Could not insert/update mail alias " . $entry['alias'] . " as domain is missing.<br />";
+				continue;
+			}
+
+			$params = array(
+				'server_id' => $server_id,
+				'source' => $entry['alias'] . "@" . $parent_domain['name'],
+				'destination' => $entry['mail_name'] . "@" . $parent_domain['name'],
+				'type' => 'alias', // or forward
+				'active' => yes_no(1)
+			);
+			$client_id = $plesk_ispc_ids[$domain_owners[$entry['dom_id']]];
+
+			$old_mail = $app->db->queryOneRecord("SELECT forwarding_id FROM mail_forwarding WHERE source = '" . $entry['alias'] . "@" . $parent_domain['name'] . "' AND destination = '" . $entry['mail_name'] . "@" . $parent_domain['name'] . "'");
+			if($old_mail) {
+				$new_id = $old_mail['forwarding_id'];
+				$ok = $importer->mail_alias_update($session_id, $client_id, $new_id, array_merge($old_mail, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$new_id = $importer->mail_alias_add($session_id, $client_id, $params);
+			}
+
+			if($new_id === false) {
+				//something went wrong here...
+				$msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") could not be inserted/updated.<br />";
+				$msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$msg .= "Mail alias " . $entry['id'] . " (" . $entry['alias'] . "@" . $parent_domain['name'] . ") inserted/updated.<br />";
+			}
+		}
+		unset($mail_aliases);
+
+		//spamfilter // preferences = true/false, username = email address, can be *@*
+		//id, username, preferences
+
+		//spamfilter_preferences
+		//prefid, spamfilter_id, preference, value
+
+
+
+		//$client_traffic = $exdb->queryAllRecords("SELECT t.cl_id, t.date, t.http_in, t.http_out, t.ftp_in, t.ftp_out, t.smtp_in, t.smtp_out, t.pop3_imap_in, t.pop3_imap_out FROM ClientsTraffic as t");
+
+		$db_userids = array();
+
+		$db_users  = $exdb->queryAllRecords("SELECT u.id, u.login, u.account_id, u.db_id, a.password, a.type as `pwtype`, d.dom_id FROM db_users as u INNER JOIN data_bases as d ON (d.id = u.db_id) LEFT JOIN accounts as a ON (a.id = u.account_id)");
+		foreach($db_users as $db_user) {
+			// database user
+			$params = array('server_id' => $server_id,
+				'database_user' => $db_user['login'],
+				'database_password' => $db_user['password']);
+
+			$client_id = $plesk_ispc_ids[$domain_owners[$db_user['dom_id']]];
+
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_database_user` WHERE `database_user` = \'' . $app->db->quote($db_user['login']) . '\'');
+			$db_user_id = 0;
+			if($check) {
+				$ok = $importer->sites_database_user_update($session_id, $client_id, $check['database_user_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+				$db_user_id = $check['database_user_id'];
+			} else {
+				$db_user_id = $importer->sites_database_user_add($session_id, $client_id, $params);
+			}
+
+			if(!isset($db_userids[$db_user['db_id']])) $db_userids[$db_user['db_id']] = $db_user_id;
+			$msg .= 'Created / updated database user: ' . $db_user['login'] . '<br />';
+		}
+
+		add_command('# DATABASES');
+
+		$databases  = $exdb->queryAllRecords("SELECT d.id, d.name, d.type, d.dom_id, d.db_server_id, d.default_user_id FROM `data_bases` as d");
+		foreach($databases as $database) {
+			$params = array('server_id' => $server_id,
+				'parent_domain_id' => $domain_ids[$database['dom_id']],
+				'type' => 'mysql',
+				'database_name' => $database['name'],
+				'database_user_id' => $db_userids[$database['id']],
+				'database_ro_user_id' => 0,
+				'database_charset' => 'utf8',
+				'remote_access' => 'n',
+				'active' => 'y',
+				'remote_ips' => '');
+
+			$client_id = $plesk_ispc_ids[$domain_owners[$database['dom_id']]];
+
+			$check = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_name` = \'' . $app->db->quote($database['name']) . '\'');
+			if($check) {
+				$ok = $importer->sites_database_update($session_id, $client_id, $check['database_id'], array_merge($check, $params));
+				if($ok === false) $msg .= "&nbsp; Error: " . $importer->getFault() . "<br />";
+			} else {
+				$importer->sites_database_add($session_id, $client_id, $params);
+			}
+
+			add_command('for T in `mysql -u ${MYSQL_IMPORT_USER} -p${MYSQL_IMPORT_PASS} ' . $database['name'] . ' -e \'show tables\' | awk \'{ print $1}\' | grep -v \'^Tables\'` ; do echo "DROP TABLE \\`$T\\`" ; mysql -u ${MYSQL_IMPORT_USER} -p${MYSQL_IMPORT_PASS} ' . $database['name'] . ' -e "DROP TABLE \\`$T\\`" ; done');
+			add_command('mysqldump -cCQ --quote-names --hex-blob -h ${MYSERVER} -u ${MYSQL_EXPORT_USER} -p${MYSQL_EXPORT_PASS} ' . $database['name'] . ' | mysql -D ' . $database['name'] . ' -u ${MYSQL_IMPORT_USER} -p${MYSQL_IMPORT_PASS}');
+
+			$msg .= 'Created / updated database: ' . $database['name'] . '<br />';
+		}
+
+		// do we need table disk_usage for import? i think we don't
+
+		// name is domain name, displayName is including "Umlaute"
+		//$anon_ftp = $exdb->queryAllRecords("SELECT f.id, f.dom_id, f.max_conn, f.bandwidth, f.incoming, f.incoming_readable, f.incoming_subdirs, f.status, f.quota, f.display_login, f.login_text FROM anon_ftp as f");
+
+
+		//DomainServices
+		//id, dom_id, type, status, parameters_id, ipCollectionId
+
+		//DomainsTraffic
+		//dom_id, date, http_in, http_out, ftp_in, ftp_out, smtp_in, smtp_out, pop3_imap_in, pop3_imap_out
+
+
+		//IP_Adresses
+		//id, ip_address, mask, iface, ssl_certificate_id, default_domain_id, ftps, main, status
+
+		//ip_pool
+		//id, ip_address_id, type
+
+		/* TODO:
                 */
-        //misc // needed? global settings
-        //param, val
-        
-        //Permissions
-        //id, permission, value
-        
-        //smb_users // pass is base64 encoded plaintext
-        //id, login, password, contactName, email, companyName, phone, fax, address, city, state, zip, country, creationDate, isBuiltIn, roleId, uuid, isLocked, authCookie, sessionId, externalId, ownerId, isDomainAdmin, additionalInfo, imNumber, imType, isLegacyUser
-        
-        /* TODO: 
+		//misc // needed? global settings
+		//param, val
+
+		//Permissions
+		//id, permission, value
+
+		//smb_users // pass is base64 encoded plaintext
+		//id, login, password, contactName, email, companyName, phone, fax, address, city, state, zip, country, creationDate, isBuiltIn, roleId, uuid, isLocked, authCookie, sessionId, externalId, ownerId, isDomainAdmin, additionalInfo, imNumber, imType, isLegacyUser
+
+		/* TODO:
         sys_users // mapped_to = parent_id
         id, login, account_id, home, shell, quota, mapped_to
-        
+
          */
-        add_command('unset MYSERVER');
-        add_command('unset MYSQL_EXPORT_USER');
-        add_command('unset MYSQL_EXPORT_PASS');
-        add_command('unset MYSQL_IMPORT_USER');
-        add_command('unset MYSQL_IMPORT_PASS');
-        add_command('# END');
-        file_put_contents('/tmp/plesk_import_commands.sh', $COMMANDS);
+		add_command('unset MYSERVER');
+		add_command('unset MYSQL_EXPORT_USER');
+		add_command('unset MYSQL_EXPORT_PASS');
+		add_command('unset MYSQL_IMPORT_USER');
+		add_command('unset MYSQL_IMPORT_PASS');
+		add_command('# END');
+		file_put_contents('/tmp/plesk_import_commands.sh', $COMMANDS);
 	} else {
-        $msg .= 'Connecting to external database failed!<br />';
-        $msg .= $exdb->connect_error;
-        $msg .= substr($exdb->errorMessage, 0, 25);
-	
+		$msg .= 'Connecting to external database failed!<br />';
+		$msg .= $exdb->connect_error;
+		$msg .= substr($exdb->errorMessage, 0, 25);
+
 		$error .= $exdb->errorMessage;
 	}
-	
+
 	//* restore db login details
 	/*$conf['db_host'] = $conf_bak['db_host'];
 	$conf['db_database'] = $conf_bak['db_database'];
 	$conf['db_user'] = $conf_bak['db_user'];
 	$conf['db_password'] = $conf_bak['db_password'];*/
-	
+
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/import_vpopmail.php b/interface/web/tools/import_vpopmail.php
index cb997941852c6b831c0bc6b9b50214eb9e183701..119bfb87aa4f613b2d1c84dfba57ea98d83bd8a4 100644
--- a/interface/web/tools/import_vpopmail.php
+++ b/interface/web/tools/import_vpopmail.php
@@ -29,8 +29,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 set_time_limit(0);
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -47,61 +47,61 @@ $error = '';
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_import_vpopmail.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 if(isset($_POST['db_hostname']) && $_POST['db_hostname'] != '') {
-	
+
 	//* Set external Login details
 	$conf['imp_db_host'] = $_POST['db_hostname'];
 	$conf['imp_db_database'] = $_POST['db_name'];
 	$conf['imp_db_user'] = $_POST['db_user'];
 	$conf['imp_db_password'] = $_POST['db_password'];
-    $conf['imp_db_charset'] = 'utf8';
-    $conf['imp_db_new_link'] = false;
-    $conf['imp_db_client_flags'] = 0;
-	
+	$conf['imp_db_charset'] = 'utf8';
+	$conf['imp_db_new_link'] = false;
+	$conf['imp_db_client_flags'] = 0;
+
 	//* create new db object
 	$exdb = new db('imp');
-	
+
 	if($exdb !== false) {
 		$msg .= 'Databse connection succeeded<br />';
-		
+
 		$local_server_id = intval($_POST['local_server_id']);
 		$tmp = $app->db->queryOneRecord("SELECT mail_server FROM server WHERE server_id = $local_server_id");
-		
+
 		if($tmp['mail_server'] == 1) {
 			start_import();
 		} else {
 			$msg .= 'The server with the ID $local_server_id is not a mail server.<br />';
 		}
-		
+
 	} else {
 		$msg .= 'Database connection failed<br />';
 	}
-	
+
 } else {
 	$_POST['local_server_id'] = 1;
 }
 
-$app->tpl->setVar('db_hostname',$_POST['db_hostname']);
-$app->tpl->setVar('db_user',$_POST['db_user']);
-$app->tpl->setVar('db_password',$_POST['db_password']);
-$app->tpl->setVar('db_name',$_POST['db_name']);
-$app->tpl->setVar('local_server_id',$_POST['local_server_id']);
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('db_hostname', $_POST['db_hostname']);
+$app->tpl->setVar('db_user', $_POST['db_user']);
+$app->tpl->setVar('db_password', $_POST['db_password']);
+$app->tpl->setVar('db_name', $_POST['db_name']);
+$app->tpl->setVar('local_server_id', $_POST['local_server_id']);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
-###########################################################
+//##########################################################
 
 function start_import() {
 	global $app, $conf, $msg, $error, $exdb, $local_server_id;
-	
+
 	//* Import the clients
-	$records = $exdb->queryAllRecords("SELECT * FROM vpopmail WHERE pw_name = 'postmaster'");	
+	$records = $exdb->queryAllRecords("SELECT * FROM vpopmail WHERE pw_name = 'postmaster'");
 	if(is_array($records)) {
 		foreach($records as $rec) {
 			$pw_domain = $rec['pw_domain'];
@@ -110,17 +110,17 @@ function start_import() {
 			if($tmp['number'] == 0) {
 				$pw_crypt_password = $app->auth->crypt_password($rec['pw_clear_passwd']);
 				$country = 'FI';
-				
+
 				//* add client
-				$sql = "INSERT INTO `client` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `company_name`, `company_id`, `contact_name`, `customer_no`, `vat_id`, `street`, `zip`, `city`, `state`, `country`, `telephone`, `mobile`, `fax`, `email`, `internet`, `icq`, `notes`, `bank_account_owner`, `bank_account_number`, `bank_code`, `bank_name`, `bank_account_iban`, `bank_account_swift`, `default_mailserver`, `limit_maildomain`, `limit_mailbox`, `limit_mailalias`, `limit_mailaliasdomain`, `limit_mailforward`, `limit_mailcatchall`, `limit_mailrouting`, `limit_mailfilter`, `limit_fetchmail`, `limit_mailquota`, `limit_spamfilter_wblist`, `limit_spamfilter_user`, `limit_spamfilter_policy`, `default_webserver`, `limit_web_ip`, `limit_web_domain`, `limit_web_quota`, `web_php_options`, `limit_cgi`, `limit_ssi`, `limit_perl`, `limit_ruby`, `limit_python`, `force_suexec`, `limit_hterror`, `limit_wildcard`, `limit_ssl`, `limit_web_subdomain`, `limit_web_aliasdomain`, `limit_ftp_user`, `limit_shell_user`, `ssh_chroot`, `limit_webdav_user`, `limit_aps`, `default_dnsserver`, `limit_dns_zone`, `limit_dns_slave_zone`, `limit_dns_record`, `default_dbserver`, `limit_database`, `limit_cron`, `limit_cron_type`, `limit_cron_frequency`, `limit_traffic_quota`, `limit_client`, `limit_mailmailinglist`, `limit_openvz_vm`, `limit_openvz_vm_template_id`, `parent_client_id`, `username`, `password`, `language`, `usertheme`, `template_master`, `template_additional`, `created_at`, `id_rsa`, `ssh_rsa`) 
+				$sql = "INSERT INTO `client` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `company_name`, `company_id`, `contact_name`, `customer_no`, `vat_id`, `street`, `zip`, `city`, `state`, `country`, `telephone`, `mobile`, `fax`, `email`, `internet`, `icq`, `notes`, `bank_account_owner`, `bank_account_number`, `bank_code`, `bank_name`, `bank_account_iban`, `bank_account_swift`, `default_mailserver`, `limit_maildomain`, `limit_mailbox`, `limit_mailalias`, `limit_mailaliasdomain`, `limit_mailforward`, `limit_mailcatchall`, `limit_mailrouting`, `limit_mailfilter`, `limit_fetchmail`, `limit_mailquota`, `limit_spamfilter_wblist`, `limit_spamfilter_user`, `limit_spamfilter_policy`, `default_webserver`, `limit_web_ip`, `limit_web_domain`, `limit_web_quota`, `web_php_options`, `limit_cgi`, `limit_ssi`, `limit_perl`, `limit_ruby`, `limit_python`, `force_suexec`, `limit_hterror`, `limit_wildcard`, `limit_ssl`, `limit_web_subdomain`, `limit_web_aliasdomain`, `limit_ftp_user`, `limit_shell_user`, `ssh_chroot`, `limit_webdav_user`, `limit_aps`, `default_dnsserver`, `limit_dns_zone`, `limit_dns_slave_zone`, `limit_dns_record`, `default_dbserver`, `limit_database`, `limit_cron`, `limit_cron_type`, `limit_cron_frequency`, `limit_traffic_quota`, `limit_client`, `limit_mailmailinglist`, `limit_openvz_vm`, `limit_openvz_vm_template_id`, `parent_client_id`, `username`, `password`, `language`, `usertheme`, `template_master`, `template_additional`, `created_at`, `id_rsa`, `ssh_rsa`)
 				VALUES(1, 1, 'riud', 'riud', '', '', '', '$pw_domain', '', '', '', '', '', '', '$country', '', '', '', '', 'http://', '', '', '', '', '', '', '', '', 1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 0, 0, 1, NULL, -1, -1, 'no,fast-cgi,cgi,mod,suphp', 'n', 'n', 'n', 'n', 'n', 'y', 'n', 'n', 'n', -1, -1, -1, 0, 'no,jailkit', 0, 0, 1, -1, -1, -1, 1, -1, 0, 'url', 5, -1, 0, -1, 0, 0, 0, '$pw_domain', '$pw_crypt_password', '".$conf['language']."', 'default', 0, '', NOW(), '', '')";
 				$app->db->query($sql);
 				$client_id = $app->db->insertID();
-				
+
 				//* add sys_group
 				$groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('".$app->db->quote($pw_domain)."','',".$client_id.")", 'groupid');
 				$groups = $groupid;
-				
+
 				$username = $app->db->quote($pw_domain);
 				$password = $pw_crypt_password;
 				$modules = $conf['interface_modules_enabled'];
@@ -130,18 +130,18 @@ function start_import() {
 				$active = 1;
 				$language = $app->db->quote($conf["language"]);
 				//$password = $app->auth->crypt_password($password);
-		
+
 				// Create the controlpaneluser for the client
 				//Generate ssh-rsa-keys
 				exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
 				$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote(@file_get_contents('/tmp/id_rsa.pub'))."' WHERE client_id = ".$client_id);
 				exec('rm -f /tmp/id_rsa /tmp/id_rsa.pub');
-		
+
 				// Create the controlpaneluser for the client
 				$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
 				VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$client_id.")";
 				$app->db->query($sql);
-		
+
 				//* Set the default servers
 				$tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 AND mirror_server_id = 0 LIMIT 0,1');
 				$default_mailserver = $app->functions->intval($tmp['server_id']);
@@ -151,31 +151,31 @@ function start_import() {
 				$default_dnsserver = $app->functions->intval($tmp['server_id']);
 				$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 = ".$client_id;
 				$app->db->query($sql);
-				
+
 				$msg .= "Added Client $username.<br />";
 			} else {
 				$msg .= "Client $username exists, skipped.<br />";
 			}
 		}
 	}
-	
+
 	//* Import the mail domains
-	$records = $exdb->queryAllRecords("SELECT DISTINCT pw_domain FROM `vpopmail`");	
+	$records = $exdb->queryAllRecords("SELECT DISTINCT pw_domain FROM `vpopmail`");
 	if(is_array($records)) {
 		foreach($records as $rec) {
 			$domain = $rec['pw_domain'];
-			
+
 			//* Check if domain exists already
 			$tmp = $app->db->queryOneRecord("SELECT count(domain_id) as number FROM mail_domain WHERE domain = '$domain'");
 			if($tmp['number'] == 0) {
 				$user_rec = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE username = '$domain'");
 				$sys_userid = ($user_rec['userid'] > 0)?$user_rec['userid']:1;
 				$sys_groupid = ($user_rec['default_group'] > 0)?$user_rec['default_group']:1;
-				
-				$sql = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `domain`, `active`) 
+
+				$sql = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `domain`, `active`)
 				VALUES(".$sys_userid.", ".$sys_groupid.", 'riud', 'riud', '', $local_server_id, '$domain', 'y')";
 				$app->db->datalogInsert('mail_domain', $sql, 'domain_id');
 				$msg .= "Imported domain $domain <br />";
@@ -184,28 +184,28 @@ function start_import() {
 			}
 		}
 	}
-	
+
 	//* Import mailboxes
-	$records = $exdb->queryAllRecords("SELECT * FROM `vpopmail`");	
+	$records = $exdb->queryAllRecords("SELECT * FROM `vpopmail`");
 	if(is_array($records)) {
 		foreach($records as $rec) {
 			$domain = $rec['pw_domain'];
 			$email = $rec['pw_name'].'@'.$rec['pw_domain'];
-			
+
 			//* Check for duplicate mailboxes
 			$tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE email = '".$app->db->quote($email)."'");
-			
+
 			if($tmp['number'] == 0) {
-			
+
 				//* get the mail domain for the mailbox
 				$domain_rec = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '$domain'");
-				
+
 				if(is_array($domain_rec)) {
 					$pw_crypt_password = $app->auth->crypt_password($rec['pw_clear_passwd']);
 					$maildir_path = "/var/vmail/".$rec['pw_domain']."/".$rec['pw_name'];
-				
+
 					//* Insert the mailbox
-					$sql = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `email`, `login`, `password`, `name`, `uid`, `gid`, `maildir`, `quota`, `cc`, `homedir`, `autoresponder`, `autoresponder_start_date`, `autoresponder_end_date`, `autoresponder_subject`, `autoresponder_text`, `move_junk`, `custom_mailfilter`, `postfix`, `access`, `disableimap`, `disablepop3`, `disabledeliver`, `disablesmtp`, `disablesieve`, `disablelda`, `disabledoveadm`) 
+					$sql = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `email`, `login`, `password`, `name`, `uid`, `gid`, `maildir`, `quota`, `cc`, `homedir`, `autoresponder`, `autoresponder_start_date`, `autoresponder_end_date`, `autoresponder_subject`, `autoresponder_text`, `move_junk`, `custom_mailfilter`, `postfix`, `access`, `disableimap`, `disablepop3`, `disabledeliver`, `disablesmtp`, `disablesieve`, `disablelda`, `disabledoveadm`)
 					VALUES(".$domain_rec['sys_userid'].", ".$domain_rec['sys_groupid'].", 'riud', 'riud', '', $local_server_id, '$email', '$email', '$pw_crypt_password', '$email', 5000, 5000, '$maildir_path', 0, '', '/var/vmail', 'n', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'Out of office reply', '', 'n', '', 'y', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n')";
 					$app->db->datalogInsert('mail_user', $sql, 'mailuser_id');
 					$msg .= "Imported mailbox $email <br />";
@@ -215,42 +215,42 @@ function start_import() {
 			}
 		}
 	}
-	
+
 	//* Import Aliases
-	$records = $exdb->queryAllRecords("SELECT * FROM `valias`");	
+	$records = $exdb->queryAllRecords("SELECT * FROM `valias`");
 	if(is_array($records)) {
 		foreach($records as $rec) {
-			
+
 			$email = $rec['alias'].'@'.$rec['domain'];
 			$target = '';
-			
-			if(stristr($rec['valias_line'],'|')) {
+
+			if(stristr($rec['valias_line'], '|')) {
 				//* Skipped
 				$msg .= "Skipped $email as target is a script pipe.<br />";
-			} elseif (substr(trim($rec['valias_line']),-9) == '/Maildir/') {
-				$parts = explode('/',$rec['valias_line']);
+			} elseif (substr(trim($rec['valias_line']), -9) == '/Maildir/') {
+				$parts = explode('/', $rec['valias_line']);
 				$target_user = $parts[count($parts)-3];
 				$target_domain = $parts[count($parts)-4];
 				$target = $target_user.'@'.$target_domain;
-			} elseif (substr(trim($rec['valias_line']),0,1) == '&') {
-				$target = substr(trim($rec['valias_line']),1);
-			} elseif (stristr($rec['valias_line'],'@')) {
+			} elseif (substr(trim($rec['valias_line']), 0, 1) == '&') {
+				$target = substr(trim($rec['valias_line']), 1);
+			} elseif (stristr($rec['valias_line'], '@')) {
 				$target = $rec['valias_line'];
 			} else {
 				//* Unknown
 				$msg .= "Skipped $email as format of target ".$rec['valias_line']." is unknown.<br />";
 			}
-			
+
 			//* Check for duplicate forwards
 			$tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE source = '".$app->db->quote($email)."' AND destination = '".$app->db->quote($target)."'");
-			
+
 			if($tmp['number'] == 0 && $target != '') {
-				
+
 				//* get the mail domain
 				$domain_rec = $app->db->queryOneRecord("SELECT * FROM mail_domain WHERE domain = '".$rec['domain']."'");
-				
+
 				if(is_array($domain_rec)) {
-					$sql = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `source`, `destination`, `type`, `active`) 
+					$sql = "(`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `source`, `destination`, `type`, `active`)
 					VALUES(".$domain_rec['sys_userid'].", ".$domain_rec['sys_groupid'].", 'riud', 'riud', '', $local_server_id, '".$app->db->quote($email)."', '".$app->db->quote($target)."', 'forward', 'y')";
 					$app->db->datalogInsert('mail_forwarding', $sql, 'forwarding_id');
 				}
@@ -260,7 +260,7 @@ function start_import() {
 			}
 		}
 	}
-	
+
 }
 
 
diff --git a/interface/web/tools/index.php b/interface/web/tools/index.php
index b13718d957539be5bd48abdf6bc54ac839f43036..05c7f71fbafee1d68e017102693f9738b59b8824 100644
--- a/interface/web/tools/index.php
+++ b/interface/web/tools/index.php
@@ -30,8 +30,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 global $app, $conf;
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -42,10 +42,10 @@ $app->tpl->newTemplate('listpage.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/index.htm');
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_index.lng';
-include($lng_file);
+include $lng_file;
 
 $app->tpl->setVar($wb);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/interface_settings.php b/interface/web/tools/interface_settings.php
index 0c17ac9ef49bef8a3be8a1960f9acefda64a5bdc..bc9c7800abcae671f9025f63466a56553f48e441 100644
--- a/interface/web/tools/interface_settings.php
+++ b/interface/web/tools/interface_settings.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/interface_settings.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -50,85 +50,86 @@ $app->load('tform_actions');
 
 class page_action extends tform_actions {
 	var $_theme_changed = false;
-    
+
 	function onLoad() {
-                global $app, $conf, $tform_def_file;
+		global $app, $conf, $tform_def_file;
+
+		// Loading template classes and initialize template
+		if(!is_object($app->tpl)) $app->uses('tpl');
+		if(!is_object($app->tform)) $app->uses('tform');
 
-                // Loading template classes and initialize template
-                if(!is_object($app->tpl)) $app->uses('tpl');
-                if(!is_object($app->tform)) $app->uses('tform');
+		$app->tpl->newTemplate("tabbed_form.tpl.htm");
 
-                $app->tpl->newTemplate("tabbed_form.tpl.htm");
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
 
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-				
-				// Importing ID
-                $this->id = $_SESSION['s']['user']['userid'];
+		// Importing ID
+		$this->id = $_SESSION['s']['user']['userid'];
 		$_POST['id'] = $_SESSION['s']['user']['userid'];
 
-                if(count($_POST) > 1) {
-                        $this->dataRecord = $_POST;
-                        $this->onSubmit();
-                } else {
-                        $this->onShow();
-                }
-        }
-        
+		if(count($_POST) > 1) {
+			$this->dataRecord = $_POST;
+			$this->onSubmit();
+		} else {
+			$this->onShow();
+		}
+	}
+
 	function onBeforeInsert() {
 		global $app, $conf;
-		
-		if(!in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(!in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
-        $this->updateSessionTheme();
+		$this->updateSessionTheme();
 	}
-        
+
 	function onInsert() {
 		die('No inserts allowed.');
 	}
-		
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true && $this->id <= 3) $app->tform->errorMessage .= 'This function is disabled in demo mode.';
-		               
-                if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'],$this->dataRecord['modules'])) {
+
+		if(@is_array($this->dataRecord['modules']) && !in_array($this->dataRecord['startmodule'], $this->dataRecord['modules'])) {
 			$app->tform->errorMessage .= $app->tform->wordbook['startmodule_err'];
 		}
-        $this->updateSessionTheme();
+		$this->updateSessionTheme();
+	}
+
+	function updateSessionTheme() {
+		global $app, $conf;
+
+		if($this->dataRecord['app_theme'] != 'default') {
+			$tmp_path = ISPC_THEMES_PATH."/".$this->dataRecord['app_theme'];
+			if(!@is_dir($tmp_path) || (@file_exists($tmp_path."/ispconfig_version") && trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION)) {
+				// fall back to default theme if this one is not compatible with current ispc version
+				$this->dataRecord['app_theme'] = 'default';
+			}
+		}
+		if($this->dataRecord['app_theme'] != $_SESSION['s']['user']['theme']) $this->_theme_changed = true;
+		$_SESSION['s']['theme'] = $this->dataRecord['app_theme'];
+		$_SESSION['s']['user']['theme'] = $_SESSION['s']['theme'];
+		$_SESSION['s']['user']['app_theme'] = $_SESSION['s']['theme'];
+	}
+
+	function onAfterInsert() {
+		$this->onAfterUpdate();
 	}
-    
-    function updateSessionTheme() {
-        global $app, $conf;
-        
-        if($this->dataRecord['app_theme'] != 'default') {
-            $tmp_path = ISPC_THEMES_PATH."/".$this->dataRecord['app_theme'];
-            if(!@is_dir($tmp_path) || (@file_exists($tmp_path."/ispconfig_version") && trim(file_get_contents($tmp_path."/ispconfig_version")) != ISPC_APP_VERSION)) {
-                // fall back to default theme if this one is not compatible with current ispc version
-                $this->dataRecord['app_theme'] = 'default';
-            }
-        }
-        if($this->dataRecord['app_theme'] != $_SESSION['s']['user']['theme']) $this->_theme_changed = true;
-        $_SESSION['s']['theme'] = $this->dataRecord['app_theme'];
-        $_SESSION['s']['user']['theme'] = $_SESSION['s']['theme'];
-        $_SESSION['s']['user']['app_theme'] = $_SESSION['s']['theme'];
-    }
-	
-    function onAfterInsert() {
-        $this->onAfterUpdate();
-    }
-    function onAfterUpdate() {
-        if($this->_theme_changed == true) {
-            // not the best way, but it works
-            header('Content-Type: text/html');
-            print '<script type="text/javascript">document.location.reload();</script>';
-            exit;
-        }
-        else parent::onShow();
-    }
-    
-	
+
+	function onAfterUpdate() {
+		if($this->_theme_changed == true) {
+			// not the best way, but it works
+			header('Content-Type: text/html');
+			print '<script type="text/javascript">document.location.reload();</script>';
+			exit;
+		}
+		else parent::onShow();
+	}
+
+
 }
 
 $page = new page_action;
diff --git a/interface/web/tools/lib/interface.d/tpl_default.menu.php b/interface/web/tools/lib/interface.d/tpl_default.menu.php
index f55b480e8c8bc813d4bffc9396e711e651483297..0a4f1d904e03c8c10a06d8053f4bbde043c72442 100644
--- a/interface/web/tools/lib/interface.d/tpl_default.menu.php
+++ b/interface/web/tools/lib/interface.d/tpl_default.menu.php
@@ -2,7 +2,7 @@
 
 // No settings yet
 //$items[] = array(   'title'     => 'Default Theme',
-//                    'target' 	=> 'content',
-//                    'link'	=> 'tools/tpl_default.php',
+//                    'target'  => 'content',
+//                    'link' => 'tools/tpl_default.php',
 //                    'html_id'   => 'tpl_default');
 ?>
diff --git a/interface/web/tools/lib/menu.d/import.menu.php b/interface/web/tools/lib/menu.d/import.menu.php
index 477c075423b1535dbff7cdde70f413eb8fdce621..a41bb0bfeef12467ddeb31575ad521b4a367dd2a 100644
--- a/interface/web/tools/lib/menu.d/import.menu.php
+++ b/interface/web/tools/lib/menu.d/import.menu.php
@@ -5,27 +5,27 @@
 
 if($app->auth->is_admin()) {
 
-$items = array();
+	$items = array();
 
-$items[] = array( 'title' 	=> 'ISPConfig 3 mail',
-				  'target' 	=> 'content',
-				  'link'	=> 'tools/import_ispconfig.php');
+	$items[] = array( 'title'  => 'ISPConfig 3 mail',
+		'target'  => 'content',
+		'link' => 'tools/import_ispconfig.php');
 
-$items[] = array( 'title' 	=> 'PDNS Tupa',
-				  'target' 	=> 'content',
-				  'link'	=> 'tools/dns_import_tupa.php');
+	$items[] = array( 'title'  => 'PDNS Tupa',
+		'target'  => 'content',
+		'link' => 'tools/dns_import_tupa.php');
 
-/* not yet complete
+	/* not yet complete
 $items[] = array( 'title' 	=> 'Plesk',
 				  'target' 	=> 'content',
 				  'link'	=> 'tools/import_plesk.php');
 */
-				  
-$module['nav'][] = array(	'title'	=> 'Import',
-							'open' 	=> 1,
-							'items'	=> $items);
 
-unset($items);
+	$module['nav'][] = array( 'title' => 'Import',
+		'open'  => 1,
+		'items' => $items);
+
+	unset($items);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/lib/menu.d/resync.menu.php b/interface/web/tools/lib/menu.d/resync.menu.php
index 3ef45fb0e7e86c1bebd870c227ca2a0821ba2cde..5de2f773ad7a9d078ff63f77dcd2787f67c3be45 100644
--- a/interface/web/tools/lib/menu.d/resync.menu.php
+++ b/interface/web/tools/lib/menu.d/resync.menu.php
@@ -5,18 +5,18 @@
 
 if($app->auth->is_admin()) {
 
-$items = array();
+	$items = array();
 
-$items[] = array( 'title' 	=> 'Resync',
-				  'target' 	=> 'content',
-				  'link'	=> 'tools/resync.php');
+	$items[] = array( 'title'  => 'Resync',
+		'target'  => 'content',
+		'link' => 'tools/resync.php');
 
 
-$module['nav'][] = array(	'title'	=> 'Sync Tools',
-							'open' 	=> 1,
-							'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'Sync Tools',
+		'open'  => 1,
+		'items' => $items);
 
-unset($items);
+	unset($items);
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/lib/menu.d/statistics.menu.php b/interface/web/tools/lib/menu.d/statistics.menu.php
index f4f9cb3e5a84499ce6642c7ab219afebef1095f8..b84b8f0f0c168c9341bf159022aa22e7bd787b5e 100644
--- a/interface/web/tools/lib/menu.d/statistics.menu.php
+++ b/interface/web/tools/lib/menu.d/statistics.menu.php
@@ -18,4 +18,4 @@ $module['nav'][] = array(	'title'	=> 'System Info',
 
 */
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/lib/module.conf.php b/interface/web/tools/lib/module.conf.php
index 274e6aa3e1d641910aaa37e719318c5e60a50150..853fd649ea8472b2a81523e96ae8958e20ba9e79 100644
--- a/interface/web/tools/lib/module.conf.php
+++ b/interface/web/tools/lib/module.conf.php
@@ -2,25 +2,25 @@
 
 global $conf;
 
-$module['name'] 	= 'tools';
-$module['title'] 	= 'top_menu_tools';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'tools/index.php';
+$module['name']  = 'tools';
+$module['title']  = 'top_menu_tools';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'tools/index.php';
 $module['tab_width']    = '60';
 
 
 //**** Change User password
 $items = array();
 
-$items[] = array(   'title' 	=> 'Password and Language',
-                    'target' 	=> 'content',
-                    'link'	=> 'tools/user_settings.php',
-                    'html_id'   => 'user_settings');
+$items[] = array(   'title'  => 'Password and Language',
+	'target'  => 'content',
+	'link' => 'tools/user_settings.php',
+	'html_id'   => 'user_settings');
 
 
 $module['nav'][] = array(   'title' => 'User Settings',
-                            'open'  => 1,
-                            'items' => $items);
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
@@ -28,18 +28,18 @@ unset($items);
 $items = array();
 
 $items[] = array(   'title'     => 'Interface',
-                    'target' 	=> 'content',
-                    'link'	=> 'tools/interface_settings.php',
-                    'html_id'   => 'interface_settings');
+	'target'  => 'content',
+	'link' => 'tools/interface_settings.php',
+	'html_id'   => 'interface_settings');
 
-if(file_exists(ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php')) include_once(ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php');
-				  
-$module['nav'][] = array(	'title'	=> 'Interface',
-                                'open' 	=> 1,
-                                'items'	=> $items);
+if(file_exists(ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php')) include_once ISPC_WEB_PATH.'/tools/lib/interface.d/tpl_' . $_SESSION['s']['user']['app_theme'] . '.menu.php';
+
+$module['nav'][] = array( 'title' => 'Interface',
+	'open'  => 1,
+	'items' => $items);
 
 unset($items);
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/resync.php b/interface/web/tools/resync.php
index 5f6bd885aa96afd14c8d75187af2e659f482f2cb..a02ac9f11621c2894e8fa85bfe6f980e27d73181 100644
--- a/interface/web/tools/resync.php
+++ b/interface/web/tools/resync.php
@@ -27,8 +27,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('admin');
@@ -45,7 +45,7 @@ $error = '';
 
 //* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_resync.lng';
-include($lng_file);
+include $lng_file;
 $app->tpl->setVar($wb);
 
 //* Resyncing websites
@@ -118,18 +118,18 @@ if(isset($_POST['resync_db']) && $_POST['resync_db'] == 1) {
 	}
 }
 
-//* Resyncing Mailbox Domains 
-if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) { 
-    $db_table = 'mail_domain'; 
-    $index_field = 'domain_id'; 
-    $sql = "SELECT * FROM ".$db_table." WHERE active = 'y'"; 
-    $records = $app->db->queryAllRecords($sql); 
-    if(is_array($records)) { 
-        foreach($records as $rec) { 
-            $app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true); 
-            $msg .= "Resynced Mail Domain: ".$rec['domain'].'<br />'; 
-        } 
-    } 
+//* Resyncing Mailbox Domains
+if(isset($_POST['resync_mailbox']) && $_POST['resync_mailbox'] == 1) {
+	$db_table = 'mail_domain';
+	$index_field = 'domain_id';
+	$sql = "SELECT * FROM ".$db_table." WHERE active = 'y'";
+	$records = $app->db->queryAllRecords($sql);
+	if(is_array($records)) {
+		foreach($records as $rec) {
+			$app->db->datalogUpdate($db_table, $rec, $index_field, $rec[$index_field], true);
+			$msg .= "Resynced Mail Domain: ".$rec['domain'].'<br />';
+		}
+	}
 }
 
 //* Resyncing Mailboxes
@@ -156,7 +156,7 @@ if(isset($_POST['resync_dns']) && $_POST['resync_dns'] == 1) {
 				foreach($records as $rec) {
 					$new_serial = $app->validate_dns->increase_serial($rec["serial"]);
 					$app->db->datalogUpdate('dns_rr', "serial = '".$new_serial."'", 'id', $rec['id']);
-					
+
 				}
 			}
 			$new_serial = $app->validate_dns->increase_serial($zone["serial"]);
@@ -166,14 +166,14 @@ if(isset($_POST['resync_dns']) && $_POST['resync_dns'] == 1) {
 	} else {
 		$error .= "No zones found to sync.<br />";
 	}
-	
+
 }
 
-$app->tpl->setVar('msg',$msg);
-$app->tpl->setVar('error',$error);
+$app->tpl->setVar('msg', $msg);
+$app->tpl->setVar('error', $error);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/tools/tpl_default.php b/interface/web/tools/tpl_default.php
index c5254c695c2d87f05adc239f851c47f614dc0cb5..dacbeae9b271966565af0a4904ac4d59f740ad51 100644
--- a/interface/web/tools/tpl_default.php
+++ b/interface/web/tools/tpl_default.php
@@ -30,8 +30,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 global $app, $conf;
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -42,7 +42,7 @@ $app->tpl->newTemplate('listpage.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/tpl_default.htm');
 
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_tpl_default.lng';
-include($lng_file);
+include $lng_file;
 
 $app->tpl->setVar($wb);
 
diff --git a/interface/web/tools/user_settings.php b/interface/web/tools/user_settings.php
index 70bbc69ff683c998063c4ca75c9f139e5f1f3dc9..42e5559b725fc9a7b873c7a86621245a5de3d523 100644
--- a/interface/web/tools/user_settings.php
+++ b/interface/web/tools/user_settings.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/user_settings.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('tools');
@@ -49,48 +49,48 @@ $app->uses('tpl,tform,tform_actions');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onLoad() {
-                global $app, $conf, $tform_def_file;
-
-                // Loading template classes and initialize template
-                if(!is_object($app->tpl)) $app->uses('tpl');
-                if(!is_object($app->tform)) $app->uses('tform');
-
-                $app->tpl->newTemplate("tabbed_form.tpl.htm");
-
-                // Load table definition from file
-                $app->tform->loadFormDef($tform_def_file);
-				
-				// Importing ID
-                $this->id = $_SESSION['s']['user']['userid'];
-				$_POST['id'] = $_SESSION['s']['user']['userid'];
-
-                if(count($_POST) > 1) {
-                        $this->dataRecord = $_POST;
-                        $this->onSubmit();
-                } else {
-                        $this->onShow();
-                }
-        }
-	
+		global $app, $conf, $tform_def_file;
+
+		// Loading template classes and initialize template
+		if(!is_object($app->tpl)) $app->uses('tpl');
+		if(!is_object($app->tform)) $app->uses('tform');
+
+		$app->tpl->newTemplate("tabbed_form.tpl.htm");
+
+		// Load table definition from file
+		$app->tform->loadFormDef($tform_def_file);
+
+		// Importing ID
+		$this->id = $_SESSION['s']['user']['userid'];
+		$_POST['id'] = $_SESSION['s']['user']['userid'];
+
+		if(count($_POST) > 1) {
+			$this->dataRecord = $_POST;
+			$this->onSubmit();
+		} else {
+			$this->onShow();
+		}
+	}
+
 	function onInsert() {
 		die('No inserts allowed.');
 	}
-		
+
 	function onBeforeUpdate() {
 		global $app, $conf;
-		
+
 		if($conf['demo_mode'] == true && $this->id <= 3) $app->tform->errorMessage .= 'This function is disabled in demo mode.';
-		
+
 		if($_POST['passwort'] != $_POST['repeat_password']) {
 			$app->tform->errorMessage = $app->tform->lng('password_mismatch');
 		}
 		$_SESSION['s']['user']['language'] = $_POST['language'];
 		$_SESSION['s']['language'] = $_POST['language'];
 	}
-	
-	
+
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/ajax_get_ip.php b/interface/web/vm/ajax_get_ip.php
index a7636f5fc9f0169517e2db43a7ca13c214cc88cc..64400775ee5ded8a8d843d63a1139e9201c7a55e 100644
--- a/interface/web/vm/ajax_get_ip.php
+++ b/interface/web/vm/ajax_get_ip.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -40,7 +40,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION
 
 	$sql = "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND server_id = $server_id";
 	$ips = $app->db->queryAllRecords($sql);
-		$ip_select = "";
+	$ip_select = "";
 	if(is_array($ips)) {
 		foreach( $ips as $ip) {
 			//$selected = ($ip["ip_address"] == $this->dataRecord["ip_address"])?'SELECTED':'';
@@ -50,6 +50,6 @@ if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION
 	unset($tmp);
 	unset($ips);
 }
-$ip_select = substr($ip_select,0,-1);
+$ip_select = substr($ip_select, 0, -1);
 echo $ip_select;
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_ip.tform.php b/interface/web/vm/form/openvz_ip.tform.php
index ca958b3f398c0ad7c05f80dc89be3a39462fe77c..181d6415d95e84d44e4868405045955f054cf86a 100644
--- a/interface/web/vm/form/openvz_ip.tform.php
+++ b/interface/web/vm/form/openvz_ip.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz IP address";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_ip";
-$form["action"]			= "openvz_ip_edit.php";
-$form["db_table"]		= "openvz_ip";
-$form["db_table_idx"]	= "ip_address_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_ip_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz IP address";
+$form["description"]  = "";
+$form["name"]    = "openvz_ip";
+$form["action"]   = "openvz_ip_edit.php";
+$form["db_table"]  = "openvz_ip";
+$form["db_table_idx"] = "ip_address_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_ip_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,63 +56,63 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "IP address",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_ip_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "IP address",
+	'width'  => 100,
+	'template'  => "templates/openvz_ip_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'ISIPV4',
-														'errmsg'=> 'ip_error_wrong'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'ip_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '15',
-			'maxlength'	=> '15',
-			'rows'		=> '',
-			'cols'		=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'ISIPV4',
+					'errmsg'=> 'ip_error_wrong'),
+				1 => array ( 'type' => 'UNIQUE',
+					'errmsg'=> 'ip_error_unique'),
+			),
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '15',
+			'maxlength' => '15',
+			'rows'  => '',
+			'cols'  => '',
 			'searchable' => 1
 		),
 		'vm_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
-										'keyfield'=> 'vm_id',
-										'valuefield'=> 'hostname'
-									 ),
-			'value'		=> array(0 => '- Not assigned -')
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
+				'keyfield'=> 'vm_id',
+				'valuefield'=> 'hostname'
+			),
+			'value'  => array(0 => '- Not assigned -')
 		),
 		'reserved' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'n',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_ostemplate.tform.php b/interface/web/vm/form/openvz_ostemplate.tform.php
index 0224ffae8b8bd8dbac07b76606a5bbe4b3252dbd..07eeafef0f8d349e1e951d2efe702963d078f33a 100644
--- a/interface/web/vm/form/openvz_ostemplate.tform.php
+++ b/interface/web/vm/form/openvz_ostemplate.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz OS-Template";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_ostemplate";
-$form["action"]			= "openvz_ostemplate_edit.php";
-$form["db_table"]		= "openvz_ostemplate";
-$form["db_table_idx"]	= "ostemplate_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_ostemplate_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz OS-Template";
+$form["description"]  = "";
+$form["name"]    = "openvz_ostemplate";
+$form["action"]   = "openvz_ostemplate_edit.php";
+$form["db_table"]  = "openvz_ostemplate";
+$form["db_table_idx"] = "ostemplate_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_ostemplate_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,77 +56,77 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "Template",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_ostemplate_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Template",
+	'width'  => 100,
+	'template'  => "templates/openvz_ostemplate_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_name_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_name_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'template_file' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_file_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_file_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'allservers' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30',
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30',
 			'searchable' => 2
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_template.tform.php b/interface/web/vm/form/openvz_template.tform.php
index 39cd3ae7ab6f06232b674130555f23a4d9ba4710..ea49e3a1f770607652f4d87f420e8968420b87d3 100644
--- a/interface/web/vm/form/openvz_template.tform.php
+++ b/interface/web/vm/form/openvz_template.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz Template";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_template";
-$form["action"]			= "openvz_template_edit.php";
-$form["db_table"]		= "openvz_template";
-$form["db_table_idx"]	= "template_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_template_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz Template";
+$form["description"]  = "";
+$form["name"]    = "openvz_template";
+$form["action"]   = "openvz_template_edit.php";
+$form["db_table"]  = "openvz_template";
+$form["db_table_idx"] = "template_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_template_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,414 +56,414 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "Template",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_template_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Template",
+	'width'  => 100,
+	'template'  => "templates/openvz_template_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'template_name' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_name_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_name_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'diskspace' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'diskspace_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'diskspace_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ram' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ram_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'ram_burst' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_burst_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ram_burst_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cpu_units' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_units_error_empty'),
-									),
-			'default'	=> '1000',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'cpu_units_error_empty'),
+			),
+			'default' => '1000',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cpu_num' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_num_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'cpu_num_error_empty'),
+			),
+			'default' => '4',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'cpu_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_limit_error_empty'),
-									),
-			'default'	=> '400',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'cpu_limit_error_empty'),
+			),
+			'default' => '400',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'io_priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'io_priority_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'INTEGER',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'io_priority_error_empty'),
+			),
+			'default' => '4',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'hostname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'create_dns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'nameserver' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_nameserver_error_empty'),
-									),
-			'default'	=> '8.8.8.8 8.8.4.4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'template_nameserver_error_empty'),
+			),
+			'default' => '8.8.8.8 8.8.4.4',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 2
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30'
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 $form["tabs"]['advanced'] = array (
-	'title' 	=> "Advanced",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_template_advanced_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Advanced",
+	'width'  => 100,
+	'template'  => "templates/openvz_template_advanced_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'numproc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numproc_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numproc_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numtcpsock' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numtcpsock_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numtcpsock_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numothersock' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numothersock_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numothersock_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'vmguarpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'vmguarpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'vmguarpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'kmemsize' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'kmemsize_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'kmemsize_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'tcpsndbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'tcpsndbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'tcpsndbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'tcprcvbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'tcprcvbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'tcprcvbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'othersockbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'othersockbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'othersockbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dgramrcvbuf' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'dgramrcvbuf_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'dgramrcvbuf_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'oomguarpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'oomguarpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'oomguarpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'privvmpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'privvmpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'privvmpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'lockedpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'lockedpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'lockedpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'shmpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'shmpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'shmpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'physpages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'physpages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'physpages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numfile' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numfile_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numfile_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'avnumproc' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'avnumproc_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'avnumproc_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numflock' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numflock_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numflock_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numpty' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numpty_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numpty_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numsiginfo' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numsiginfo_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numsiginfo_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'dcachesize' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'dcachesize_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'dcachesize_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'numiptent' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'numiptent_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'numiptent_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'swappages' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'swappages_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'swappages_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'capability' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
+		),
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/form/openvz_vm.tform.php b/interface/web/vm/form/openvz_vm.tform.php
index efd9c842f0328ea03b11ce240671e3ca8bcddd4d..759ba2f00cb4418b5a99a59e7e16eb901474622a 100644
--- a/interface/web/vm/form/openvz_vm.tform.php
+++ b/interface/web/vm/form/openvz_vm.tform.php
@@ -29,7 +29,7 @@
 	Hint:
 	The ID field of the database table is not part of the datafield definition.
 	The ID field must be always auto incement (int or bigint).
-	
+
 	Search:
 	- searchable = 1 or searchable = 2 include the field in the search
 	- searchable = 1: this field will be the title of the search result
@@ -38,16 +38,16 @@
 
 */
 
-$form["title"] 			= "Openvz virtual server";
-$form["description"] 	= "";
-$form["name"] 			= "openvz_vm";
-$form["action"]			= "openvz_vm_edit.php";
-$form["db_table"]		= "openvz_vm";
-$form["db_table_idx"]	= "vm_id";
-$form["db_history"]		= "yes";
-$form["tab_default"]	= "main";
-$form["list_default"]	= "openvz_vm_list.php";
-$form["auth"]			= 'yes'; // yes / no
+$form["title"]    = "Openvz virtual server";
+$form["description"]  = "";
+$form["name"]    = "openvz_vm";
+$form["action"]   = "openvz_vm_edit.php";
+$form["db_table"]  = "openvz_vm";
+$form["db_table_idx"] = "vm_id";
+$form["db_history"]  = "yes";
+$form["tab_default"] = "main";
+$form["list_default"] = "openvz_vm_list.php";
+$form["auth"]   = 'yes'; // yes / no
 
 $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
@@ -56,39 +56,39 @@ $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update,
 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
 
 $form["tabs"]['main'] = array (
-	'title' 	=> "Virtual server",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_vm_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
+	'title'  => "Virtual server",
+	'width'  => 100,
+	'template'  => "templates/openvz_vm_edit.htm",
+	'fields'  => array (
+		//#################################
+		// Begin Datatable fields
+		//#################################
 		'server_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name',
-										'keyfield'=> 'server_id',
-										'valuefield'=> 'server_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT server_id,server_name FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name',
+				'keyfield'=> 'server_id',
+				'valuefield'=> 'server_name'
+			),
+			'value'  => ''
 		),
 		'ostemplate_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
-			'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE 1 ORDER BY template_name',
-										'keyfield'=> 'ostemplate_id',
-										'valuefield'=> 'template_name'
-									 ),
-			'value'		=> ''
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
+			'datasource' => array (  'type' => 'SQL',
+				'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE 1 ORDER BY template_name',
+				'keyfield'=> 'ostemplate_id',
+				'valuefield'=> 'template_name'
+			),
+			'value'  => ''
 		),
 		'template_id' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'SELECT',
-			'default'	=> '',
+			'datatype' => 'INTEGER',
+			'formtype' => 'SELECT',
+			'default' => '',
 			/*
 			'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name',
@@ -96,15 +96,15 @@ $form["tabs"]['main'] = array (
 										'valuefield'=> 'template_name'
 									 ),
 			*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'ip_address' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'SELECT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ip_address_error_empty'),
-									),
-			'default'	=> '',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'SELECT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'ip_address_error_empty'),
+			),
+			'default' => '',
 			/*
 			'datasource'	=> array ( 	'type'	=> 'SQL',
 										'querystring' => "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = '{RECORDID}') ORDER BY ip_address",
@@ -112,206 +112,206 @@ $form["tabs"]['main'] = array (
 										'valuefield'=> 'ip_address'
 									 ),
 			*/
-			'value'		=> ''
+			'value'  => ''
 		),
 		'hostname' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-            'filters'   => array( 0 => array( 'event' => 'SAVE',
-                                              'type' => 'IDNTOASCII'),
-                                  1 => array( 'event' => 'SHOW',
-                                              'type' => 'IDNTOUTF8'),
-                                  2 => array( 'event' => 'SAVE',
-                                              'type' => 'TOLOWER')
-                                ),
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'hostname_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255',
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'filters'   => array( 0 => array( 'event' => 'SAVE',
+					'type' => 'IDNTOASCII'),
+				1 => array( 'event' => 'SHOW',
+					'type' => 'IDNTOUTF8'),
+				2 => array( 'event' => 'SAVE',
+					'type' => 'TOLOWER')
+			),
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'hostname_error_empty'),
+			),
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255',
 			'searchable' => 1
 		),
 		'vm_password' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'vm_password_error_empty'),
-									),
-			'default'	=> $app->auth->get_random_password(10),
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'VARCHAR',
+			'formtype' => 'TEXT',
+			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+					'errmsg'=> 'vm_password_error_empty'),
+			),
+			'default' => $app->auth->get_random_password(10),
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'start_boot' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'y',
+			'value'  => array(0 => 'n', 1 => 'y')
 		),
 		'active_until_date' => array (
-			'datatype'	=> 'DATE',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
+			'datatype' => 'DATE',
+			'formtype' => 'TEXT',
+			'default' => '',
+			'value'  => '',
+			'width'  => '30',
+			'maxlength' => '255'
 		),
 		'description' => array (
-			'datatype'	=> 'TEXT',
-			'formtype'	=> 'TEXTAREA',
-			'default'	=> '',
-			'value'		=> '',
-			'separator'	=> '',
-			'width'		=> '',
-			'maxlength'	=> '',
-			'rows'		=> '10',
-			'cols'		=> '30',
+			'datatype' => 'TEXT',
+			'formtype' => 'TEXTAREA',
+			'default' => '',
+			'value'  => '',
+			'separator' => '',
+			'width'  => '',
+			'maxlength' => '',
+			'rows'  => '10',
+			'cols'  => '30',
 			'searchable' => 2
 		),
-	##################################
-	# ENDE Datatable fields
-	##################################
+		//#################################
+		// ENDE Datatable fields
+		//#################################
 	)
 );
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-$form["tabs"]['advanced'] = array (
-	'title' 	=> "Advanced",
-	'width' 	=> 100,
-	'template' 	=> "templates/openvz_vm_advanced_edit.htm",
-	'fields' 	=> array (
-	##################################
-	# Begin Datatable fields
-	##################################
-		'veid' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'veid_error_empty'),
-										1 => array (	'type'	=> 'UNIQUE',
-														'errmsg'=> 'veid_error_unique'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'create_dns' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'CHECKBOX',
-			'default'	=> 'y',
-			'value'		=> array(0 => 'n',1 => 'y')
-		),
-		'diskspace' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'diskspace_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ram' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'ram_burst' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'ram_burst_error_empty'),
-									),
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'cpu_units' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_units_error_empty'),
-									),
-			'default'	=> '1000',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'cpu_num' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_num_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'cpu_limit' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'cpu_limit_error_empty'),
-									),
-			'default'	=> '400',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'io_priority' => array (
-			'datatype'	=> 'INTEGER',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'io_priority_error_empty'),
-									),
-			'default'	=> '4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'nameserver' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'validators'	=> array ( 	0 => array (	'type'	=> 'NOTEMPTY',
-														'errmsg'=> 'template_nameserver_error_empty'),
-									),
-			'default'	=> '8.8.8.8 8.8.4.4',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-		'capability' => array (
-			'datatype'	=> 'VARCHAR',
-			'formtype'	=> 'TEXT',
-			'default'	=> '',
-			'value'		=> '',
-			'width'		=> '30',
-			'maxlength'	=> '255'
-		),
-	##################################
-	# ENDE Datatable fields
-	##################################
-	)
-);
+	$form["tabs"]['advanced'] = array (
+		'title'  => "Advanced",
+		'width'  => 100,
+		'template'  => "templates/openvz_vm_advanced_edit.htm",
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'veid' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'veid_error_empty'),
+					1 => array ( 'type' => 'UNIQUE',
+						'errmsg'=> 'veid_error_unique'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'create_dns' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default' => 'y',
+				'value'  => array(0 => 'n', 1 => 'y')
+			),
+			'diskspace' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'diskspace_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ram' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'ram_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'ram_burst' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'ram_burst_error_empty'),
+				),
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'cpu_units' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'cpu_units_error_empty'),
+				),
+				'default' => '1000',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'cpu_num' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'cpu_num_error_empty'),
+				),
+				'default' => '4',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'cpu_limit' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'cpu_limit_error_empty'),
+				),
+				'default' => '400',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'io_priority' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'io_priority_error_empty'),
+				),
+				'default' => '4',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'nameserver' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
+						'errmsg'=> 'template_nameserver_error_empty'),
+				),
+				'default' => '8.8.8.8 8.8.4.4',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			'capability' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
+		)
+	);
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/lib/admin.conf.php b/interface/web/vm/lib/admin.conf.php
index 67c94a5742572786e8c7c2ae67750c31231a4b64..acb6c3546c6150b4edbafb782d3ed85c499210b5 100644
--- a/interface/web/vm/lib/admin.conf.php
+++ b/interface/web/vm/lib/admin.conf.php
@@ -1,2 +1,2 @@
 <?php
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/lib/module.conf.php b/interface/web/vm/lib/module.conf.php
index 6d0ffec717ebbe052ceb6fdc80f546f55d558c73..a7e31bb5319bc51bd551e969f995badfc332d607 100644
--- a/interface/web/vm/lib/module.conf.php
+++ b/interface/web/vm/lib/module.conf.php
@@ -1,40 +1,40 @@
 <?php
 
-$module['name'] 		= 'vm';
-$module['title'] 		= 'top_menu_vm';
-$module['template'] 	= 'module.tpl.htm';
-$module['startpage'] 	= 'vm/openvz_vm_list.php';
+$module['name']   = 'vm';
+$module['title']   = 'top_menu_vm';
+$module['template']  = 'module.tpl.htm';
+$module['startpage']  = 'vm/openvz_vm_list.php';
 $module['tab_width']    = '';
 
 //**** Templates menu
 $items = array();
 
-$items[] = array( 'title' 	=> 'Virtual Servers',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_vm_list.php',
-				  'html_id' => 'openvz_vm_list');
+$items[] = array( 'title'  => 'Virtual Servers',
+	'target'  => 'content',
+	'link' => 'vm/openvz_vm_list.php',
+	'html_id' => 'openvz_vm_list');
 
 if($_SESSION["s"]["user"]["typ"] == 'admin') {
-$items[] = array( 'title' 	=> 'OS Templates',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_ostemplate_list.php',
-				  'html_id' => 'openvz_ostemplate_list');
+	$items[] = array( 'title'  => 'OS Templates',
+		'target'  => 'content',
+		'link' => 'vm/openvz_ostemplate_list.php',
+		'html_id' => 'openvz_ostemplate_list');
 
-$items[] = array( 'title' 	=> 'VM Templates',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_template_list.php',
-				  'html_id' => 'openvz_template_list');
-				  
-$items[] = array( 'title' 	=> 'IP addresses',
-				  'target' 	=> 'content',
-				  'link'	=> 'vm/openvz_ip_list.php',
-				  'html_id' => 'openvz_ip_list');
+	$items[] = array( 'title'  => 'VM Templates',
+		'target'  => 'content',
+		'link' => 'vm/openvz_template_list.php',
+		'html_id' => 'openvz_template_list');
+
+	$items[] = array( 'title'  => 'IP addresses',
+		'target'  => 'content',
+		'link' => 'vm/openvz_ip_list.php',
+		'html_id' => 'openvz_ip_list');
 }
 if(count($items))
 {
-	$module['nav'][] = array(	'title'	=> 'OpenVZ',
-								'open' 	=> 1,
-								'items'	=> $items);
+	$module['nav'][] = array( 'title' => 'OpenVZ',
+		'open'  => 1,
+		'items' => $items);
 }
 
 
@@ -51,7 +51,7 @@ $items[] = array( 'title' 	=> 'Vserver monitor',
 				  'target' 	=> 'content',
 				  'link'	=> 'vm/traffic_stats.php',
 				  'html_id' => 'vm_traffic_stats');
-				  
+
 if(count($items))
 {
 	$module['nav'][] = array(	'title'	=> 'Statistics',
@@ -65,4 +65,4 @@ if(count($items))
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/lib/remote.conf.php b/interface/web/vm/lib/remote.conf.php
index f92f80b45fc13d25790dbaf432bec0e78c15d3ec..77222bf90b46b08d3892a0cd1f24cda737b4ed4d 100644
--- a/interface/web/vm/lib/remote.conf.php
+++ b/interface/web/vm/lib/remote.conf.php
@@ -2,4 +2,4 @@
 
 $function_list['vm_openvz'] = 'OpenVZ VM functions';
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/list/openvz_ip.list.php b/interface/web/vm/list/openvz_ip.list.php
index 09a21faec8daecb5ea489371a7d4457e7ffafdf1..313c6f065b144a915853a5ac8b8015c32a8fb7d9 100644
--- a/interface/web/vm/list/openvz_ip.list.php
+++ b/interface/web/vm/list/openvz_ip.list.php
@@ -13,88 +13,88 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_ip";
+$liste["name"]     = "openvz_ip";
 
 // Database table
-$liste["table"] 			= "openvz_ip";
+$liste["table"]    = "openvz_ip";
 
 // Index index field of the database table
-$liste["table_idx"]			= "ip_address_id";
+$liste["table_idx"]   = "ip_address_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_ip_list.php";
+$liste["file"]    = "openvz_ip_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_ip_edit.php";
+$liste["edit_file"]   = "openvz_ip_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_ip_del.php";
+$liste["delete_file"]  = "openvz_ip_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "vm_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
-										'keyfield'=> 'vm_id',
-										'valuefield'=> 'hostname'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "ip_address",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "reserved",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
- 
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "vm_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT vm_id,hostname FROM openvz_vm WHERE {AUTHSQL} ORDER BY hostname',
+		'keyfield'=> 'vm_id',
+		'valuefield'=> 'hostname'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "ip_address",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "reserved",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+
+
+
+?>
diff --git a/interface/web/vm/list/openvz_ostemplate.list.php b/interface/web/vm/list/openvz_ostemplate.list.php
index 3b3dc2ccb2fbbe4f511e5d94b9964bb5b3e5df99..19d2afeb49004d254747b9b59a9676f2005004c8 100644
--- a/interface/web/vm/list/openvz_ostemplate.list.php
+++ b/interface/web/vm/list/openvz_ostemplate.list.php
@@ -13,91 +13,91 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_ostemplate";
+$liste["name"]     = "openvz_ostemplate";
 
 // Database table
-$liste["table"] 			= "openvz_ostemplate";
+$liste["table"]    = "openvz_ostemplate";
 
 // Index index field of the database table
-$liste["table_idx"]			= "ostemplate_id";
+$liste["table_idx"]   = "ostemplate_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_ostemplate_list.php";
+$liste["file"]    = "openvz_ostemplate_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_ostemplate_edit.php";
+$liste["edit_file"]   = "openvz_ostemplate_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_ostemplate_del.php";
+$liste["delete_file"]  = "openvz_ostemplate_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "ostemplate_id",
-							'datatype'	=> "INTEGER",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-
-
-$liste["item"][] = array(	'field'		=> "template_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> ""); 
-
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "allservers",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "ostemplate_id",
+	'datatype' => "INTEGER",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "allservers",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+
+
+?>
diff --git a/interface/web/vm/list/openvz_template.list.php b/interface/web/vm/list/openvz_template.list.php
index 48d13eda2a30bfbc485e6a589ac2084d7f239f15..6ba7faf4004af07c0a8a5f15680e4ce02155b5ba 100644
--- a/interface/web/vm/list/openvz_template.list.php
+++ b/interface/web/vm/list/openvz_template.list.php
@@ -13,58 +13,58 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_template";
+$liste["name"]     = "openvz_template";
 
 // Database table
-$liste["table"] 			= "openvz_template";
+$liste["table"]    = "openvz_template";
 
 // Index index field of the database table
-$liste["table_idx"]			= "template_id";
+$liste["table_idx"]   = "template_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_template_list.php";
+$liste["file"]    = "openvz_template_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_template_edit.php";
+$liste["edit_file"]   = "openvz_template_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_template_del.php";
+$liste["delete_file"]  = "openvz_template_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
 
 
-$liste["item"][] = array(	'field'		=> "template_name",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> ""); 
+$liste["item"][] = array( 'field'  => "template_name",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/list/openvz_vm.list.php b/interface/web/vm/list/openvz_vm.list.php
index 81a7c8e1e565edb227a83d95015f44112be0f808..ce42f93631b082ae4dea553a0f2d96e1fd8978b4 100644
--- a/interface/web/vm/list/openvz_vm.list.php
+++ b/interface/web/vm/list/openvz_vm.list.php
@@ -13,120 +13,120 @@
 
 
 // Name of the list
-$liste["name"] 				= "openvz_vm";
+$liste["name"]     = "openvz_vm";
 
 // Database table
-$liste["table"] 			= "openvz_vm";
+$liste["table"]    = "openvz_vm";
 
 // Index index field of the database table
-$liste["table_idx"]			= "vm_id";
+$liste["table_idx"]   = "vm_id";
 
 // Search Field Prefix
-$liste["search_prefix"] 	= "search_";
+$liste["search_prefix"]  = "search_";
 
 // Records per page
-$liste["records_per_page"] 	= 15;
+$liste["records_per_page"]  = 15;
 
 // Script File of the list
-$liste["file"]				= "openvz_vm_list.php";
+$liste["file"]    = "openvz_vm_list.php";
 
 // Script file of the edit form
-$liste["edit_file"]			= "openvz_vm_edit.php";
+$liste["edit_file"]   = "openvz_vm_edit.php";
 
 // Script File of the delete script
-$liste["delete_file"]		= "openvz_vm_del.php";
+$liste["delete_file"]  = "openvz_vm_del.php";
 
 // Paging Template
-$liste["paging_tpl"]		= "templates/paging.tpl.htm";
+$liste["paging_tpl"]  = "templates/paging.tpl.htm";
 
 // Enable authe
-$liste["auth"]				= "yes";
+$liste["auth"]    = "yes";
 
 
 /*****************************************************
 * Suchfelder
 *****************************************************/
 
-$liste["item"][] = array(	'field'		=> "active",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
-
-$liste["item"][] = array(	'field'		=> "veid",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "=",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "server_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-														'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
-														'keyfield'=> 'server_id',
-														'valuefield'=> 'server_name'
-									 				  ),
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "ostemplate_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name',
-										'keyfield'=> 'ostemplate_id',
-										'valuefield'=> 'template_name'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "template_id",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "SELECT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "",
-							'datasource'	=> array ( 	'type'	=> 'SQL',
-										'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name',
-										'keyfield'=> 'template_id',
-										'valuefield'=> 'template_name'
-									 ),
-							'width'		=> "",
-							'value'		=> "");
-							
-$liste["item"][] = array(	'field'		=> "hostname",
-							'datatype'	=> "VARCHAR",
-                            'filters'   => array( 0 => array( 'event' => 'SHOW',
-                                                              'type' => 'IDNTOUTF8')
-                                                ),
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "%",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-$liste["item"][] = array(	'field'		=> "ip_address",
-							'datatype'	=> "VARCHAR",
-							'formtype'	=> "TEXT",
-							'op'		=> "like",
-							'prefix'	=> "",
-							'suffix'	=> "%",
-							'width'		=> "",
-							'value'		=> "");
-
-
-?>
\ No newline at end of file
+$liste["item"][] = array( 'field'  => "active",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => array('y' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'n' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
+
+$liste["item"][] = array( 'field'  => "veid",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "=",
+	'prefix' => "",
+	'suffix' => "",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "server_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT server_id, server_name FROM server WHERE vserver_server = 1 ORDER BY server_name',
+		'keyfield'=> 'server_id',
+		'valuefield'=> 'server_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "ostemplate_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT ostemplate_id,template_name FROM openvz_ostemplate WHERE {AUTHSQL} ORDER BY template_name',
+		'keyfield'=> 'ostemplate_id',
+		'valuefield'=> 'template_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "template_id",
+	'datatype' => "VARCHAR",
+	'formtype' => "SELECT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "",
+	'datasource' => array (  'type' => 'SQL',
+		'querystring' => 'SELECT template_id,template_name FROM openvz_template WHERE {AUTHSQL} ORDER BY template_name',
+		'keyfield'=> 'template_id',
+		'valuefield'=> 'template_name'
+	),
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "hostname",
+	'datatype' => "VARCHAR",
+	'filters'   => array( 0 => array( 'event' => 'SHOW',
+			'type' => 'IDNTOUTF8')
+	),
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "%",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+$liste["item"][] = array( 'field'  => "ip_address",
+	'datatype' => "VARCHAR",
+	'formtype' => "TEXT",
+	'op'  => "like",
+	'prefix' => "",
+	'suffix' => "%",
+	'width'  => "",
+	'value'  => "");
+
+
+?>
diff --git a/interface/web/vm/openvz_action.php b/interface/web/vm/openvz_action.php
index b62ca336770bf26a58a7d3cfcd38a9df707a836d..31c23acf92ab6d12362b9bb7a707b78f41f3ec9f 100644
--- a/interface/web/vm/openvz_action.php
+++ b/interface/web/vm/openvz_action.php
@@ -4,8 +4,8 @@ Copyright (c) 2010, Till Brehm, projektfarm Gmbh
 All rights reserved.
 */
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -26,110 +26,110 @@ $app->uses('tpl');
 
 $app->tpl->newTemplate('form.tpl.htm');
 $app->tpl->setInclude('content_tpl', 'templates/openvz_action.htm');
-	
-//* load language file 
+
+//* load language file
 $lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_openvz_action.lng';
-include_once($lng_file);
+include_once $lng_file;
 $app->tpl->setVar($wb);
-	
-$app->tpl->setVar('id',$vm_id);
-$app->tpl->setVar('veid',$veid);
 
-$options = array('start_option_enabled'=>'','stop_option_enabled'=>'','restart_option_enabled'=>'','ostemplate_option_enabled'=>'');
+$app->tpl->setVar('id', $vm_id);
+$app->tpl->setVar('veid', $veid);
+
+$options = array('start_option_enabled'=>'', 'stop_option_enabled'=>'', 'restart_option_enabled'=>'', 'ostemplate_option_enabled'=>'');
 
 
 //* Show the action select page
 if($action == 'show') {
 
-$options['start_option_enabled'] = 'checked="checked"';
-	
+	$options['start_option_enabled'] = 'checked="checked"';
+
 } elseif ($action == 'start') {
-	
+
 	//* Start the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_start_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_start_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['start_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['start_exec_txt']);
 	$options['start_option_enabled'] = 'checked="checked"';
-	
+
 } elseif ($action == 'stop') {
-	
+
 	//* Stop the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_stop_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_stop_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['stop_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['stop_exec_txt']);
 	$options['stop_option_enabled'] = 'checked="checked"';
 
 } elseif ($action == 'restart') {
-	
+
 	//* Restart the virtual machine
 	$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-			"VALUES (".
-			(int)$server_id . ", ".
-			time() . ", ".
-			"'openvz_restart_vm', ".
-			$veid.", ".
-			"'pending', ".
-			"''".
-			")";
+		"VALUES (".
+		(int)$server_id . ", ".
+		time() . ", ".
+		"'openvz_restart_vm', ".
+		$veid.", ".
+		"'pending', ".
+		"''".
+		")";
 	$app->db->query($sql);
-	
-	$app->tpl->setVar('msg',$wb['restart_exec_txt']);
+
+	$app->tpl->setVar('msg', $wb['restart_exec_txt']);
 	$options['restart_option_enabled'] = 'checked="checked"';
 
 } elseif ($action == 'ostemplate') {
-	
+
 	$ostemplate_name = $_POST['ostemplate_name'];
-	
+
 	if(!preg_match("/^[a-zA-Z0-9\.\-\_]{1,50}$/i", $ostemplate_name)) {
 		$error_msg .= $wb['ostemplate_name_error'].'<br />';
-		$app->tpl->setVar('ostemplate_name',$ostemplate_name);
+		$app->tpl->setVar('ostemplate_name', $ostemplate_name);
 	}
-	
+
 	//* Quote name
 	$ostemplate_name = $app->db->quote($ostemplate_name);
-	
+
 	//* Check for duplicates
 	$tmp = $app->db->queryOneRecord("SELECT count(ostemplate_id) as number FROM openvz_ostemplate WHERE template_file = '$ostemplate_name'");
 	if($tmp['number'] > 0) $error_msg .= $wb['ostemplate_name_unique_error'].'<br />';
 	unset($tmp);
-	
+
 	if($error_msg == '') {
 		//* Create ostemplate action
 		$sql =  "INSERT INTO sys_remoteaction (server_id, tstamp, action_type, action_param, action_state, response) " .
-				"VALUES (".
-				(int)$server_id . ", ".
-				time() . ", ".
-				"'openvz_create_ostpl', ".
-				"'".$veid.":".$ostemplate_name."', ".
-				"'pending', ".
-				"''".
-				")";
+			"VALUES (".
+			(int)$server_id . ", ".
+			time() . ", ".
+			"'openvz_create_ostpl', ".
+			"'".$veid.":".$ostemplate_name."', ".
+			"'pending', ".
+			"''".
+			")";
 		$app->db->query($sql);
-		
+
 		//* Create a record in the openvz_ostemplate table
-		$sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`) 
+		$sql = "INSERT INTO `openvz_ostemplate` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `template_file`, `server_id`, `allservers`, `active`, `description`)
 		VALUES(1, 1, 'riud', 'riud', '', '$ostemplate_name', '$ostemplate_name', $server_id, 'n', 'y', '')";
 		$app->db->query($sql);
-		
-		$app->tpl->setVar('msg',$wb['ostemplate_exec_txt']);
+
+		$app->tpl->setVar('msg', $wb['ostemplate_exec_txt']);
 		$options['ostemplate_option_enabled'] = 'checked="checked"';
 	}
 
@@ -139,11 +139,11 @@ $options['start_option_enabled'] = 'checked="checked"';
 }
 
 $app->tpl->setVar($options);
-$app->tpl->setVar('error',$error_msg);
+$app->tpl->setVar('error', $error_msg);
 
 $app->tpl_defaults();
 $app->tpl->pparse();
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_ip_del.php b/interface/web/vm/openvz_ip_del.php
index bd97041be1fd6d4cec67f055d364a109458afb8e..47d5d9a03205cbe59646038438066a74d72ae288 100644
--- a/interface/web/vm/openvz_ip_del.php
+++ b/interface/web/vm/openvz_ip_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/openvz_ip.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,7 +50,7 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_ip_edit.php b/interface/web/vm/openvz_ip_edit.php
index 8fbd0f27213f94ba6f2cf65c946a6d9a90fa27ae..20912eec00b462c854fa4e490f862e076704742e 100644
--- a/interface/web/vm/openvz_ip_edit.php
+++ b/interface/web/vm/openvz_ip_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/openvz_ip.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,10 +50,10 @@ $app->uses('tpl,tform');
 $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/vm/openvz_ip_list.php b/interface/web/vm/openvz_ip_list.php
index 804d60fa55b9632f3fd64316633b2db1ee1b6556..229a792227c14032cc091709c19824dd2bc4992e 100644
--- a/interface/web/vm/openvz_ip_list.php
+++ b/interface/web/vm/openvz_ip_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->listform_actions->SQLOrderBy = 'ORDER BY openvz_ip.server_id, openvz_ip.ip
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_ostemplate_del.php b/interface/web/vm/openvz_ostemplate_del.php
index cc54dbd50f1faea82fd6c30dcbcce9cb2d89373d..467465751d6690be3fc120d34b52194e5a185dac 100644
--- a/interface/web/vm/openvz_ostemplate_del.php
+++ b/interface/web/vm/openvz_ostemplate_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/openvz_ostemplate.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,7 +50,7 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_ostemplate_edit.php b/interface/web/vm/openvz_ostemplate_edit.php
index 697ab4cbda6e0cf4178882e6743beb757ae7ac21..e19083e2e824846a18dd1a0de38f9e824d8054fb 100644
--- a/interface/web/vm/openvz_ostemplate_edit.php
+++ b/interface/web/vm/openvz_ostemplate_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/openvz_ostemplate.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,10 +50,10 @@ $app->uses('tpl,tform');
 $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/vm/openvz_ostemplate_list.php b/interface/web/vm/openvz_ostemplate_list.php
index 00d2ee4d94b0c575df81663f81c49b0f68820e4c..fbce99bf99edd002aeb73e5e9569095ae9d0297e 100644
--- a/interface/web/vm/openvz_ostemplate_list.php
+++ b/interface/web/vm/openvz_ostemplate_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_template_del.php b/interface/web/vm/openvz_template_del.php
index 09584e35204f4b8e3d0fc89ec2b9f3aaa4fa5e1a..cc5c1320b1ad1140de368f5bce2b38f27345acf6 100644
--- a/interface/web/vm/openvz_template_del.php
+++ b/interface/web/vm/openvz_template_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/openvz_template.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,7 +50,7 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_template_edit.php b/interface/web/vm/openvz_template_edit.php
index c0740022ccf762c2f875995201f0aaa86b7a498c..73d004eb30898a87a5092ece85f040aa63311ffc 100644
--- a/interface/web/vm/openvz_template_edit.php
+++ b/interface/web/vm/openvz_template_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/openvz_template.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -50,28 +50,28 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 	function onAfterInsert() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$guar_ram = $this->dataRecord['ram']*256;
 		$burst_ram = $this->dataRecord['ram_burst']*256;
 		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
 		$app->db->query($sql);
 	}
-	
+
 	function onAfterUpdate() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$guar_ram = $this->dataRecord['ram']*256;
 		$burst_ram = $this->dataRecord['ram_burst']*256;
 		$sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id";
 		$app->db->query($sql);
 	}
-	
+
 }
 
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_template_list.php b/interface/web/vm/openvz_template_list.php
index 15bd9075e67854a2946e9416815f84f8c4fc5256..49d01fe6355fff8ecef23f5866a00ed0a10c525f 100644
--- a/interface/web/vm/openvz_template_list.php
+++ b/interface/web/vm/openvz_template_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -52,4 +52,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_vm_del.php b/interface/web/vm/openvz_vm_del.php
index c8d8e196af6032dd1150643fba8a07d5e2c36a55..bd9a9d414e28b9b1e24b828a7a8a90a7a25af797 100644
--- a/interface/web/vm/openvz_vm_del.php
+++ b/interface/web/vm/openvz_vm_del.php
@@ -39,8 +39,8 @@ $tform_def_file = "form/openvz_vm.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -49,7 +49,7 @@ $app->uses('tpl,tform');
 $app->load('tform_actions');
 
 class page_action extends tform_actions {
-	
+
 }
 
 $page = new page_action;
diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php
index 83d530df6f38ee7a51355ce3daa05758a7740dce..c9ba892e4c9ff2c748c9a3bf6265a5e3568886c6 100644
--- a/interface/web/vm/openvz_vm_edit.php
+++ b/interface/web/vm/openvz_vm_edit.php
@@ -38,8 +38,8 @@ $tform_def_file = "form/openvz_vm.tform.php";
 * End Form configuration
 ******************************************/
 
-require_once('../../lib/config.inc.php');
-require_once('../../lib/app.inc.php');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 //* Check permissions for module
 $app->auth->check_module_permissions('vm');
@@ -52,7 +52,7 @@ class page_action extends tform_actions {
 
 	function onShowNew() {
 		global $app, $conf;
-		
+
 		// we will check only users, not admins
 		if($_SESSION["s"]["user"]["typ"] == 'user') {
 			if(!$app->tform->checkClientLimit('limit_openvz_vm')) {
@@ -62,20 +62,20 @@ class page_action extends tform_actions {
 				$app->error('Reseller: '.$app->tform->wordbook["limit_openvz_vm_txt"]);
 			}
 		}
-		
+
 		parent::onShowNew();
 	}
-	
+
 	function onShowEnd() {
 		global $app, $conf;
 
 		//* Client: If the logged in user is not admin and has no sub clients (no rseller)
 		if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			
+
 			//* 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 FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
-			
+
 			//* Fill the template_id field
 			if($client['limit_openvz_vm_template_id'] == 0) {
 				$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
@@ -89,16 +89,16 @@ class page_action extends tform_actions {
 					$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("template_id_select",$template_id_select);
-			
+			$app->tpl->setVar("template_id_select", $template_id_select);
+
 			//* Reseller: If the logged in user is not admin and has sub clients (is a rseller)
 		} elseif ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-			
+
 			//* 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(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(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);
@@ -111,8 +111,8 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$rec[groupid]' $selected>$rec[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-			
+			$app->tpl->setVar("client_group_id", $client_select);
+
 			//* Fill the template_id field
 			if($client['limit_openvz_vm_template_id'] == 0) {
 				$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
@@ -126,7 +126,7 @@ class page_action extends tform_actions {
 					$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("template_id_select",$template_id_select);
+			$app->tpl->setVar("template_id_select", $template_id_select);
 
 			//* Admin: If the logged in user is admin
 		} else {
@@ -142,8 +142,8 @@ class page_action extends tform_actions {
 					$client_select .= "<option value='$client[groupid]' $selected>$client[contactname]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("client_group_id",$client_select);
-			
+			$app->tpl->setVar("client_group_id", $client_select);
+
 			//* Fill the template_id field
 			$sql = 'SELECT template_id,template_name FROM openvz_template WHERE 1 ORDER BY template_name';
 			$records = $app->db->queryAllRecords($sql);
@@ -154,10 +154,10 @@ class page_action extends tform_actions {
 					$template_id_select .= "<option value='$rec[template_id]' $selected>$rec[template_name]</option>\r\n";
 				}
 			}
-			$app->tpl->setVar("template_id_select",$template_id_select);
+			$app->tpl->setVar("template_id_select", $template_id_select);
 
 		}
-		
+
 		//* Fill the IPv4 select field with the IP addresses that are allowed for this client
 		//$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".$client['default_webserver']." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")";
 		if(isset($this->dataRecord["server_id"])) {
@@ -175,10 +175,10 @@ class page_action extends tform_actions {
 				$ip_select .= "<option value='$ip[ip_address]' $selected>$ip[ip_address]</option>\r\n";
 			}
 		}
-		$app->tpl->setVar("ip_address",$ip_select);
+		$app->tpl->setVar("ip_address", $ip_select);
 		unset($tmp);
 		unset($ips);
-		
+
 		if($this->id > 0) {
 			//* we are editing a existing record
 			$app->tpl->setVar("edit_disabled", 1);
@@ -192,8 +192,8 @@ class page_action extends tform_actions {
 		$date_format = $app->lng('conf_format_dateshort');
 		$trans = array("d" => "dd", "m" => "mm", "Y" => "yy");
 		$date_format = strtr($date_format, $trans);
-		$app->tpl->setVar("date_format", $date_format);		
-		
+		$app->tpl->setVar("date_format", $date_format);
+
 		$app->tpl->setVar("daynamesmin_su", $app->lng('daynamesmin_su'));
 		$app->tpl->setVar("daynamesmin_mo", $app->lng('daynamesmin_mo'));
 		$app->tpl->setVar("daynamesmin_tu", $app->lng('daynamesmin_tu'));
@@ -201,7 +201,7 @@ class page_action extends tform_actions {
 		$app->tpl->setVar("daynamesmin_th", $app->lng('daynamesmin_th'));
 		$app->tpl->setVar("daynamesmin_fr", $app->lng('daynamesmin_fr'));
 		$app->tpl->setVar("daynamesmin_sa", $app->lng('daynamesmin_sa'));
-		
+
 		$app->tpl->setVar("daynames_sunday", $app->lng('daynames_sunday'));
 		$app->tpl->setVar("daynames_monday", $app->lng('daynames_monday'));
 		$app->tpl->setVar("daynames_tuesday", $app->lng('daynames_tuesday'));
@@ -209,7 +209,7 @@ class page_action extends tform_actions {
 		$app->tpl->setVar("daynames_thursday", $app->lng('daynames_thursday'));
 		$app->tpl->setVar("daynames_friday", $app->lng('daynames_friday'));
 		$app->tpl->setVar("daynames_saturday", $app->lng('daynames_saturday'));
-		
+
 		$app->tpl->setVar("monthnamesshort_jan", $app->lng('monthnamesshort_jan'));
 		$app->tpl->setVar("monthnamesshort_feb", $app->lng('monthnamesshort_feb'));
 		$app->tpl->setVar("monthnamesshort_mar", $app->lng('monthnamesshort_mar'));
@@ -221,11 +221,11 @@ class page_action extends tform_actions {
 		$app->tpl->setVar("monthnamesshort_sep", $app->lng('monthnamesshort_sep'));
 		$app->tpl->setVar("monthnamesshort_oct", $app->lng('monthnamesshort_oct'));
 		$app->tpl->setVar("monthnamesshort_nov", $app->lng('monthnamesshort_nov'));
-		$app->tpl->setVar("monthnamesshort_dec", $app->lng('monthnamesshort_dec'));		
-		
+		$app->tpl->setVar("monthnamesshort_dec", $app->lng('monthnamesshort_dec'));
+
 		$app->tpl->setVar("datepicker_nextText", $app->lng('datepicker_nextText'));
 		$app->tpl->setVar("datepicker_prevText", $app->lng('datepicker_prevText'));
-		
+
 		parent::onShowEnd();
 	}
 
@@ -243,4 +243,4 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onLoad();
 
-?>
\ No newline at end of file
+?>
diff --git a/interface/web/vm/openvz_vm_list.php b/interface/web/vm/openvz_vm_list.php
index 02d165114465261df0d6dc67174fbec285270112..c1ea907c1017f3ed55528ed2619d7246d60dbccb 100644
--- a/interface/web/vm/openvz_vm_list.php
+++ b/interface/web/vm/openvz_vm_list.php
@@ -28,8 +28,8 @@ 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');
+require_once '../../lib/config.inc.php';
+require_once '../../lib/app.inc.php';
 
 /******************************************
 * Begin Form configuration
@@ -51,4 +51,4 @@ $app->uses('listform_actions');
 $app->listform_actions->onLoad();
 
 
-?>
\ No newline at end of file
+?>
diff --git a/remoting_client/examples/client_add.php b/remoting_client/examples/client_add.php
index 95faffda2d633005203395fa47f58a1686e1ee2d..6d5b5934d76cfc827e6c209b708ffe09106061ca 100644
--- a/remoting_client/examples/client_add.php
+++ b/remoting_client/examples/client_add.php
@@ -1,94 +1,94 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$reseller_id = 0; // this id has to be 0 if the client shall not be assigned to admin or if the client is a reseller
 	$params = array(
-			'company_name' => 'awesomecompany',
-			'contact_name' => 'name',
-			'customer_no' => '1',
-			'vat_id' => '1',
-			'street' => 'fleetstreet',
-			'zip' => '21337',
-			'city' => 'london',
-			'state' => 'bavaria',
-			'country' => 'GB',
-			'telephone' => '123456789',
-			'mobile' => '987654321',
-			'fax' => '546718293',
-			'email' => 'e@mail.int',
-			'internet' => '',
-			'icq' => '111111111',
-			'notes' => 'awesome',
-			'default_mailserver' => 1,
-			'limit_maildomain' => -1,
-			'limit_mailbox' => -1,
-			'limit_mailalias' => -1,
-			'limit_mailaliasdomain' => -1,
-			'limit_mailforward' => -1,
-			'limit_mailcatchall' => -1,
-			'limit_mailrouting' => 0,
-			'limit_mailfilter' => -1,
-			'limit_fetchmail' => -1,
-			'limit_mailquota' => -1,
-			'limit_spamfilter_wblist' => 0,
-			'limit_spamfilter_user' => 0,
-			'limit_spamfilter_policy' => 1,
-			'default_webserver' => 1,
-			'limit_web_ip' => '',
-			'limit_web_domain' => -1,
-			'limit_web_quota' => -1,
-			'web_php_options' => 'no,fast-cgi,cgi,mod,suphp',
-			'limit_web_subdomain' => -1,
-			'limit_web_aliasdomain' => -1,
-			'limit_ftp_user' => -1,
-			'limit_shell_user' => 0,
-			'ssh_chroot' => 'no,jailkit,ssh-chroot',
-			'limit_webdav_user' => 0,
-			'default_dnsserver' => 1,
-			'limit_dns_zone' => -1,
-			'limit_dns_slave_zone' => -1,
-			'limit_dns_record' => -1,
-			'default_dbserver' => 1,
-			'limit_database' => -1,
-			'limit_cron' => 0,
-			'limit_cron_type' => 'url',
-			'limit_cron_frequency' => 5,
-			'limit_traffic_quota' => -1,
-			'limit_client' => 0, // If this value is > 0, then the client is a reseller
-			'parent_client_id' => 0,
-			'username' => 'guy3',
-			'password' => 'brush',
-			'language' => 'en',
-			'usertheme' => 'default',
-			'template_master' => 0,
-			'template_additional' => '',
-			'created_at' => 0
-			);
-	
+		'company_name' => 'awesomecompany',
+		'contact_name' => 'name',
+		'customer_no' => '1',
+		'vat_id' => '1',
+		'street' => 'fleetstreet',
+		'zip' => '21337',
+		'city' => 'london',
+		'state' => 'bavaria',
+		'country' => 'GB',
+		'telephone' => '123456789',
+		'mobile' => '987654321',
+		'fax' => '546718293',
+		'email' => 'e@mail.int',
+		'internet' => '',
+		'icq' => '111111111',
+		'notes' => 'awesome',
+		'default_mailserver' => 1,
+		'limit_maildomain' => -1,
+		'limit_mailbox' => -1,
+		'limit_mailalias' => -1,
+		'limit_mailaliasdomain' => -1,
+		'limit_mailforward' => -1,
+		'limit_mailcatchall' => -1,
+		'limit_mailrouting' => 0,
+		'limit_mailfilter' => -1,
+		'limit_fetchmail' => -1,
+		'limit_mailquota' => -1,
+		'limit_spamfilter_wblist' => 0,
+		'limit_spamfilter_user' => 0,
+		'limit_spamfilter_policy' => 1,
+		'default_webserver' => 1,
+		'limit_web_ip' => '',
+		'limit_web_domain' => -1,
+		'limit_web_quota' => -1,
+		'web_php_options' => 'no,fast-cgi,cgi,mod,suphp',
+		'limit_web_subdomain' => -1,
+		'limit_web_aliasdomain' => -1,
+		'limit_ftp_user' => -1,
+		'limit_shell_user' => 0,
+		'ssh_chroot' => 'no,jailkit,ssh-chroot',
+		'limit_webdav_user' => 0,
+		'default_dnsserver' => 1,
+		'limit_dns_zone' => -1,
+		'limit_dns_slave_zone' => -1,
+		'limit_dns_record' => -1,
+		'default_dbserver' => 1,
+		'limit_database' => -1,
+		'limit_cron' => 0,
+		'limit_cron_type' => 'url',
+		'limit_cron_frequency' => 5,
+		'limit_traffic_quota' => -1,
+		'limit_client' => 0, // If this value is > 0, then the client is a reseller
+		'parent_client_id' => 0,
+		'username' => 'guy3',
+		'password' => 'brush',
+		'language' => 'en',
+		'usertheme' => 'default',
+		'template_master' => 0,
+		'template_additional' => '',
+		'created_at' => 0
+	);
+
 	$affected_rows = $client->client_add($session_id, $reseller_id, $params);
-	
+
 	echo "Client: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_change_password.php b/remoting_client/examples/client_change_password.php
index 157423b27c3c23fb1e859f4e1e7b475a164c02c9..5e20b11bc49773daa09ea29d8a27197be0e1f414 100644
--- a/remoting_client/examples/client_change_password.php
+++ b/remoting_client/examples/client_change_password.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain = 'test.int';
-	
+
 	$record_record = $client->mail_domain_get_by_domain($session_id, $domain);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_delete.php b/remoting_client/examples/client_delete.php
index 367c7512f87b08af02c546883e0dc9def1cebdc2..2cf7e36a9c35e5fe749f8882156c5db8ca73d409 100644
--- a/remoting_client/examples/client_delete.php
+++ b/remoting_client/examples/client_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->client_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_delete_everything.php b/remoting_client/examples/client_delete_everything.php
index 4399f5e6ea17e65615e5a1bd1f2ee251510671fa..d723b01f348023f737094dea5a0b5b1767ce0165 100644
--- a/remoting_client/examples/client_delete_everything.php
+++ b/remoting_client/examples/client_delete_everything.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -23,12 +23,12 @@ try {
 
 	//echo "Client ".$client_id." has been deleted.<br>";
 	//print_r($affected_rows);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get.php b/remoting_client/examples/client_get.php
index 095fd95b77b3b13422c83b7d2849acb00c06aee3..9863829df4363facca74af4bfbeb7901349bd38d 100644
--- a/remoting_client/examples/client_get.php
+++ b/remoting_client/examples/client_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$var_client_id = 1;
-	
+
 	$client_record = $client->client_get($session_id, $var_client_id);
 
 	print_r($client_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get_by_username.php b/remoting_client/examples/client_get_by_username.php
index 93c516dce3d57e50ed3a8e949739e9fbb72fb88c..a55902d62fbb17be0d2599ae65c7af6a5ae55479 100644
--- a/remoting_client/examples/client_get_by_username.php
+++ b/remoting_client/examples/client_get_by_username.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$username = 'guy3';
-	
+
 	$record_record = $client->client_get_by_username($session_id, $username);
 
 	print_r($record_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get_id.php b/remoting_client/examples/client_get_id.php
index e19edded71e353f077b7628ae29d4c068b043d39..d0e481e9db60dbdbe3f091e23a1878afddc78c73 100644
--- a/remoting_client/examples/client_get_id.php
+++ b/remoting_client/examples/client_get_id.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$sys_userid = 5;
-	
+
 	$client_record = $client->client_get_id($session_id, $sys_userid);
 
 	print_r($client_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_get_sites_by_user.php b/remoting_client/examples/client_get_sites_by_user.php
index ebebc551c8224903203b96a73e9eccc9f29346aa..673f5309dc699757b975db20db13ecbf2d09d6d8 100644
--- a/remoting_client/examples/client_get_sites_by_user.php
+++ b/remoting_client/examples/client_get_sites_by_user.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$sys_userid = 1;
 	$sys_groupid = 1;
-	
+
 	$record_record = $client->client_get_sites_by_user($session_id, $sys_userid, $sys_groupid);
 
 	print_r($record_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_templates_get_all.php b/remoting_client/examples/client_templates_get_all.php
index 003e1c7d2720d490edda8c7ad2007f64e082395f..c3868520e368009b5ebcfd7c94731bd729dbbc76 100644
--- a/remoting_client/examples/client_templates_get_all.php
+++ b/remoting_client/examples/client_templates_get_all.php
@@ -1,30 +1,30 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
-	
+
 	$record_record = $client->client_templates_get_all($session_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/client_update.php b/remoting_client/examples/client_update.php
index e884378434e0e88bb4fc1e832a8e91ec4ef4d068..15c31fcf996e3f1c6314d117bd0ffb824b329160 100644
--- a/remoting_client/examples/client_update.php
+++ b/remoting_client/examples/client_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -26,19 +26,19 @@ try {
 	$client_record['country'] = 'de';
 	$client_record['username'] = 'mguy';
 	$client_record['contact_name'] = 'brush';
-	
+
 	//* We set the client password to a empty string as we do not want to change it.
 	$client_record['password'] = '';
-	
+
 	$affected_rows = $client->client_update($session_id, $c_id, $reseller_id, $client_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_add.php b/remoting_client/examples/dns_a_add.php
index 9ab12888364a9faefc48aad13fdf9402c401260e..6bcb33c6680ad55f82e38582a501495242f196d5 100644
--- a/remoting_client/examples/dns_a_add.php
+++ b/remoting_client/examples/dns_a_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 5,
-			'name' => 'a',
-			'type' => 'a',
-			'data' => '192.168.1.88',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 5,
+		'name' => 'a',
+		'type' => 'a',
+		'data' => '192.168.1.88',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_a_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_delete.php b/remoting_client/examples/dns_a_delete.php
index c092097f9d4d3d9a4331b1997fb9eb39791c5b2a..3c7092cc3bf04e7d14beb128d6f392d73b64e41d 100644
--- a/remoting_client/examples/dns_a_delete.php
+++ b/remoting_client/examples/dns_a_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_a_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_get.php b/remoting_client/examples/dns_a_get.php
index d3e296ae42e5e484393acaa04a70f2d9f5d787a1..701260263af8de4fa5c61b9602a61838fb9fda0a 100644
--- a/remoting_client/examples/dns_a_get.php
+++ b/remoting_client/examples/dns_a_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 3;
-	
+
 	$dns_record = $client->dns_a_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_a_update.php b/remoting_client/examples/dns_a_update.php
index f543b40192aa1f2fb9eeef415ed9c595140f8660..3a765df86c70fa4e7fcf52109fb4e6e636a73978 100644
--- a/remoting_client/examples/dns_a_update.php
+++ b/remoting_client/examples/dns_a_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_a_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_add.php b/remoting_client/examples/dns_aaaa_add.php
index bcd640b1962067a68d386bc8dc120f9e6f25c49f..4ee460b5be90a5f9a04653d600519e7bf8d53ee9 100644
--- a/remoting_client/examples/dns_aaaa_add.php
+++ b/remoting_client/examples/dns_aaaa_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 1,
-			'name' => 'aaaa',
-			'type' => 'aaaa',
-			'data' => '3ffe:b00:c18:3::a',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 1,
+		'name' => 'aaaa',
+		'type' => 'aaaa',
+		'data' => '3ffe:b00:c18:3::a',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_aaaa_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_delete.php b/remoting_client/examples/dns_aaaa_delete.php
index 0021b2025d3010ca0c0145d03cd47a0240dff47c..bcce0231b2209ec4302d77ce1f4b980c207b2128 100644
--- a/remoting_client/examples/dns_aaaa_delete.php
+++ b/remoting_client/examples/dns_aaaa_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_aaaa_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_get.php b/remoting_client/examples/dns_aaaa_get.php
index d1510542ec5c875df579436156e5f2181d328e30..dc1a473ca91fabd79a906ae943f8f15ac8effca2 100644
--- a/remoting_client/examples/dns_aaaa_get.php
+++ b/remoting_client/examples/dns_aaaa_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$dns_record = $client->dns_aaaa_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_aaaa_update.php b/remoting_client/examples/dns_aaaa_update.php
index e0d719400ae5fa327d9dabcede57e1ff20307d48..85e2235a3a5da3b68d5a3bfa314cbf91c6e28317 100644
--- a/remoting_client/examples/dns_aaaa_update.php
+++ b/remoting_client/examples/dns_aaaa_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_aaaa_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_add.php b/remoting_client/examples/dns_alias_add.php
index 5b81662dcce896f3ee42d6651256f7e204b36d10..5b1c684cef0743704581e52d58c8b370388e3284 100644
--- a/remoting_client/examples/dns_alias_add.php
+++ b/remoting_client/examples/dns_alias_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 4,
-			'name' => 'alias',
-			'type' => 'alias',
-			'data' => 'hostmachine',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 4,
+		'name' => 'alias',
+		'type' => 'alias',
+		'data' => 'hostmachine',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_alias_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_delete.php b/remoting_client/examples/dns_alias_delete.php
index 68c7667b8ba8d2312b7674bd22017f81af44d7be..36bb1dbcf9e17aef62b2f3a8f46eb96de13cc051 100644
--- a/remoting_client/examples/dns_alias_delete.php
+++ b/remoting_client/examples/dns_alias_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_alias_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_get.php b/remoting_client/examples/dns_alias_get.php
index d80a1240c40dcc7b744844d7ede33f662cd8b0a6..8bff518fb1cf07501eb77dc0e4510e06c7383f08 100644
--- a/remoting_client/examples/dns_alias_get.php
+++ b/remoting_client/examples/dns_alias_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 4;
-	
+
 	$dns_record = $client->dns_alias_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_alias_update.php b/remoting_client/examples/dns_alias_update.php
index 8c9873b42aea69cf07019e10b9595ab60ccf7481..179cc1298c6d791a0127964dd96ac8b67f935a9d 100644
--- a/remoting_client/examples/dns_alias_update.php
+++ b/remoting_client/examples/dns_alias_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_alias_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_add.php b/remoting_client/examples/dns_cname_add.php
index 4c6a61fe5f3490d90e4861264224752e15c063c9..2d70ca65b4a40c3dcd732ba585ca7867ea752350 100644
--- a/remoting_client/examples/dns_cname_add.php
+++ b/remoting_client/examples/dns_cname_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 3,
-			'name' => 'cname',
-			'type' => 'cname',
-			'data' => 'hostmachine',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 3,
+		'name' => 'cname',
+		'type' => 'cname',
+		'data' => 'hostmachine',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_cname_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_delete.php b/remoting_client/examples/dns_cname_delete.php
index 493e71ce598c36f43c2122c93223cc2b142b20c0..0234243da08268aaccb8bc19f00eb089796e6fec 100644
--- a/remoting_client/examples/dns_cname_delete.php
+++ b/remoting_client/examples/dns_cname_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_cname_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_get.php b/remoting_client/examples/dns_cname_get.php
index 8ea6af1c63ce30eb89c4dc9b75303fdf7dee31a2..ca0d30002e1499524c1fa50d85b5665610ae13c8 100644
--- a/remoting_client/examples/dns_cname_get.php
+++ b/remoting_client/examples/dns_cname_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 5;
-	
+
 	$dns_record = $client->dns_cname_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_cname_update.php b/remoting_client/examples/dns_cname_update.php
index b689168fba9f35fdf91498062ff9f777730fe011..c7d659baf0bcbcaf91ec0d627529c751dce7b994 100644
--- a/remoting_client/examples/dns_cname_update.php
+++ b/remoting_client/examples/dns_cname_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_cname_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_add.php b/remoting_client/examples/dns_hinfo_add.php
index 2c49d1e22e86344fe582c29a04899ccafdd7c50a..a0a8c47b3c1f90035974ad3c204ac3554a65cc82 100644
--- a/remoting_client/examples/dns_hinfo_add.php
+++ b/remoting_client/examples/dns_hinfo_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 2,
-			'name' => 'info',
-			'type' => 'hinfo',
-			'data' => '"Pentium Pro" Linux',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 2,
+		'name' => 'info',
+		'type' => 'hinfo',
+		'data' => '"Pentium Pro" Linux',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_hinfo_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_delete.php b/remoting_client/examples/dns_hinfo_delete.php
index c2fc7eb1bf4c9cb906172b85b4ad7f19c9a1adee..721db1eae6d2e8cbfa9d56950eb2ea610da759ef 100644
--- a/remoting_client/examples/dns_hinfo_delete.php
+++ b/remoting_client/examples/dns_hinfo_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_hinfo_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_get.php b/remoting_client/examples/dns_hinfo_get.php
index 23c8a4ade73fa957828c4e23301761212fd9d9f7..685893c74aec77f51bac750d06776808ee3fd5cf 100644
--- a/remoting_client/examples/dns_hinfo_get.php
+++ b/remoting_client/examples/dns_hinfo_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 6;
-	
+
 	$dns_record = $client->dns_hinfo_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_hinfo_update.php b/remoting_client/examples/dns_hinfo_update.php
index b35c73216feadf639252e648b3bd668658170306..02867a6a412e1db465742ee463fc2e67389a2a5c 100644
--- a/remoting_client/examples/dns_hinfo_update.php
+++ b/remoting_client/examples/dns_hinfo_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_hinfo_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_add.php b/remoting_client/examples/dns_mx_add.php
index 878be4794ecb03213dea6e7120a052f1f3a4341f..b1e961780973cd069393091c4fd34114262e6de5 100644
--- a/remoting_client/examples/dns_mx_add.php
+++ b/remoting_client/examples/dns_mx_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 6,
-			'name' => 'mailexchanger',
-			'type' => 'mx',
-			'data' => 'mail',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 6,
+		'name' => 'mailexchanger',
+		'type' => 'mx',
+		'data' => 'mail',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_mx_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_delete.php b/remoting_client/examples/dns_mx_delete.php
index 857b90c56cbdfd2771037f276f9bafb39cfaf8f2..0fce7729ed54cdc20d8c06ca4163d902c2bf4180 100644
--- a/remoting_client/examples/dns_mx_delete.php
+++ b/remoting_client/examples/dns_mx_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_mx_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_get.php b/remoting_client/examples/dns_mx_get.php
index 112141e2feca19ce1425471a11e32111e5ee62e7..ddb1304f31eddad44dfd706cf3c9a6e8c148d373 100644
--- a/remoting_client/examples/dns_mx_get.php
+++ b/remoting_client/examples/dns_mx_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 7;
-	
+
 	$dns_record = $client->dns_mx_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_mx_update.php b/remoting_client/examples/dns_mx_update.php
index c51221ab35a45856f6b0abeeab40c6c7eaf7ec3b..e5a5df761451834efb17501ba77404d8dd138fe2 100644
--- a/remoting_client/examples/dns_mx_update.php
+++ b/remoting_client/examples/dns_mx_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_mx_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_add.php b/remoting_client/examples/dns_ns_add.php
index 2dd7efd65bd172ecd1e02fb2f43152c8a480dcbd..d650d2a99990e1b49ce440e7d7c6ec8cf6edd7fe 100644
--- a/remoting_client/examples/dns_ns_add.php
+++ b/remoting_client/examples/dns_ns_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 7,
-			'name' => 'nameserver',
-			'type' => 'ns',
-			'data' => 'ns1',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 7,
+		'name' => 'nameserver',
+		'type' => 'ns',
+		'data' => 'ns1',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_ns_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_delete.php b/remoting_client/examples/dns_ns_delete.php
index e50ff7c1b8041c92035d7ab97c5e086e5066b3d4..add17c8e104a1726a7d2295a1b283d52f1c837e8 100644
--- a/remoting_client/examples/dns_ns_delete.php
+++ b/remoting_client/examples/dns_ns_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_ns_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_get.php b/remoting_client/examples/dns_ns_get.php
index 28fcf383ccfce5c41714f2cb29701bb4f55bc238..e9178a72cbc77e1725eb5b2c73fef9e75c237824 100644
--- a/remoting_client/examples/dns_ns_get.php
+++ b/remoting_client/examples/dns_ns_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 8;
-	
+
 	$dns_record = $client->dns_ns_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ns_update.php b/remoting_client/examples/dns_ns_update.php
index 92fdb93dd6f1f69660c19477ebecdcee5e0d7e3d..418a1a3d7d3c8b158760fee94e1a6de82286e25e 100644
--- a/remoting_client/examples/dns_ns_update.php
+++ b/remoting_client/examples/dns_ns_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_ns_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_add.php b/remoting_client/examples/dns_ptr_add.php
index 55ed112353d0c38d325f57fdc252234904c50f25..6d4ccab9faeaa3b7d26a684cf7a9f97cfa92ba8a 100644
--- a/remoting_client/examples/dns_ptr_add.php
+++ b/remoting_client/examples/dns_ptr_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 8,
-			'name' => 'pointer',
-			'type' => 'ptr',
-			'data' => 'webmaster.test.int.',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 8,
+		'name' => 'pointer',
+		'type' => 'ptr',
+		'data' => 'webmaster.test.int.',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_ptr_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_delete.php b/remoting_client/examples/dns_ptr_delete.php
index ced26845e021ca09a8e680f97db95e3cf09ec713..c2ab3b96b94ecb50b91453fc06756596e67fa23c 100644
--- a/remoting_client/examples/dns_ptr_delete.php
+++ b/remoting_client/examples/dns_ptr_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_ptr_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_get.php b/remoting_client/examples/dns_ptr_get.php
index 1332a30c325340f5337d9b615407527aee1bef64..b3cd58fb205adbb265b8366aea4870644783f6eb 100644
--- a/remoting_client/examples/dns_ptr_get.php
+++ b/remoting_client/examples/dns_ptr_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 9;
-	
+
 	$dns_record = $client->dns_ptr_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_ptr_update.php b/remoting_client/examples/dns_ptr_update.php
index a2b360ae0f1316e7ee9e5e9170a0ab5cb26508b7..8e2ffd7695bf5fdc6865603802db4e2fc903b1b1 100644
--- a/remoting_client/examples/dns_ptr_update.php
+++ b/remoting_client/examples/dns_ptr_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_ptr_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_add.php b/remoting_client/examples/dns_rp_add.php
index ac04cf786132971b7d894e5a25295dd3dac2a877..a30b70370137c66294b2e77d0db123b69cc82850 100644
--- a/remoting_client/examples/dns_rp_add.php
+++ b/remoting_client/examples/dns_rp_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 9,
-			'name' => 'responsibleperson',
-			'type' => 'rp',
-			'data' => 'webmaster.test.int. contactinfo.test.int',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 9,
+		'name' => 'responsibleperson',
+		'type' => 'rp',
+		'data' => 'webmaster.test.int. contactinfo.test.int',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_rp_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_delete.php b/remoting_client/examples/dns_rp_delete.php
index 3edcb7b17a9c3f8f19ec6a02f89b58c54a749184..29bbccf911c4eccb420ef7fca297e24aeda03397 100644
--- a/remoting_client/examples/dns_rp_delete.php
+++ b/remoting_client/examples/dns_rp_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_rp_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_get.php b/remoting_client/examples/dns_rp_get.php
index 3f575937577dc209e6e5757eb8379da14af44a5a..296bd00482addc19cea639d841f6e988b3e91fe0 100644
--- a/remoting_client/examples/dns_rp_get.php
+++ b/remoting_client/examples/dns_rp_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 10;
-	
+
 	$dns_record = $client->dns_rp_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rp_update.php b/remoting_client/examples/dns_rp_update.php
index 7cc587de2b635074abde4919a71ef720780b9770..308831debbe2b7cdd719b9a9a32a4b7acdb67445 100644
--- a/remoting_client/examples/dns_rp_update.php
+++ b/remoting_client/examples/dns_rp_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_rp_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_rr_get_all_by_zone.php b/remoting_client/examples/dns_rr_get_all_by_zone.php
index 284bad4f24e830d89d957cd6229ab3a96b36b220..1e790b70466b6b084bf4c793e3d916abbd3efd6f 100644
--- a/remoting_client/examples/dns_rr_get_all_by_zone.php
+++ b/remoting_client/examples/dns_rr_get_all_by_zone.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$zone_id = 3;
-	
+
 	$record_record = $client->dns_rr_get_all_by_zone($session_id, $zone_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_add.php b/remoting_client/examples/dns_srv_add.php
index 9f021ac88f8afc194c1d74601f8d08a64f2c5d51..75c7df4817f092f56c1a6d2af1bf2522d41190b7 100644
--- a/remoting_client/examples/dns_srv_add.php
+++ b/remoting_client/examples/dns_srv_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 10,
-			'name' => 'server',
-			'type' => 'srv',
-			'data' => '0 9 server.test.int.',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 10,
+		'name' => 'server',
+		'type' => 'srv',
+		'data' => '0 9 server.test.int.',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_srv_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_delete.php b/remoting_client/examples/dns_srv_delete.php
index 6bd7661408ff2d029f0cb303c19982c613c667f1..c380ee8704150dee243ad233afc010af5771f53a 100644
--- a/remoting_client/examples/dns_srv_delete.php
+++ b/remoting_client/examples/dns_srv_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->dns_srv_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_get.php b/remoting_client/examples/dns_srv_get.php
index eb771a3f4496b643a7c30f2e3e9db340c4cda555..2db7281cac549be47a61354af039e4dde84bae56 100644
--- a/remoting_client/examples/dns_srv_get.php
+++ b/remoting_client/examples/dns_srv_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 11;
-	
+
 	$dns_record = $client->dns_srv_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_srv_update.php b/remoting_client/examples/dns_srv_update.php
index 569651c24e80f68cbf663da61f117474504f0dea..74968f3356cdd684376db5be07b82ea6a4804595 100644
--- a/remoting_client/examples/dns_srv_update.php
+++ b/remoting_client/examples/dns_srv_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_srv_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_add.php b/remoting_client/examples/dns_txt_add.php
index d760d57bc810fc172d26cfc19b5fe9145b173614..4ce025e64fcd7247bc60c51af131c366e2231bc7 100644
--- a/remoting_client/examples/dns_txt_add.php
+++ b/remoting_client/examples/dns_txt_add.php
@@ -1,43 +1,43 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'zone' => 11,
-			'name' => 'stringtext',
-			'type' => 'txt',
-			'data' => 'any text can go here',
-			'aux' => '0',
-			'ttl' => '86400',
-			'active' => 'y',
-			'stamp' => 'CURRENT_TIMESTAMP',
-			'serial' => '1',
-			);
-	
+		'server_id' => 1,
+		'zone' => 11,
+		'name' => 'stringtext',
+		'type' => 'txt',
+		'data' => 'any text can go here',
+		'aux' => '0',
+		'ttl' => '86400',
+		'active' => 'y',
+		'stamp' => 'CURRENT_TIMESTAMP',
+		'serial' => '1',
+	);
+
 	$id = $client->dns_txt_add($session_id, $client_id, $params);
 
 	echo "ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_delete.php b/remoting_client/examples/dns_txt_delete.php
index 862c801ea852e1bd48a12ae67f72d4fdee07df77..3724d1c1e71a5ab2fb64f755b62292c842bcb4b1 100644
--- a/remoting_client/examples/dns_txt_delete.php
+++ b/remoting_client/examples/dns_txt_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->dns_txt_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_get.php b/remoting_client/examples/dns_txt_get.php
index 9c515f70a31eeaa788eee51f93a6ccd3685d2fdb..93e11ff6e13da9e9d4b448a9873e72ffdedaafd8 100644
--- a/remoting_client/examples/dns_txt_get.php
+++ b/remoting_client/examples/dns_txt_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 12;
-	
+
 	$dns_record = $client->dns_txt_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_txt_update.php b/remoting_client/examples/dns_txt_update.php
index d6466e98de33bf09cc59739e042c5eff5f61e6d2..34a8d357b3adf745834c0ec212408dc01bf2d50b 100644
--- a/remoting_client/examples/dns_txt_update.php
+++ b/remoting_client/examples/dns_txt_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_txt_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_add.php b/remoting_client/examples/dns_zone_add.php
index 163480816acbce1732e9a4279ec68ca884586afd..677240968266fe66f7869f09204da45f9f20bb4d 100644
--- a/remoting_client/examples/dns_zone_add.php
+++ b/remoting_client/examples/dns_zone_add.php
@@ -1,47 +1,47 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 2;
 	$params = array(
-			'server_id' => 1,
-			'origin' => 'test.intt.',
-			'ns' => 'one',
-			'mbox' => 'zonemaster.test.tld.',
-			'serial' => '1',
-			'refresh' => '28800',
-			'retry' => '7200',
-			'expire' => '604800',
-			'minimum' => '86400',
-			'ttl' => '86400',
-			'active' => 'y',
-			'xfer' => '',
-			'also_notify' => '',
-			'update_acl' => '',
-			);
-	
+		'server_id' => 1,
+		'origin' => 'test.intt.',
+		'ns' => 'one',
+		'mbox' => 'zonemaster.test.tld.',
+		'serial' => '1',
+		'refresh' => '28800',
+		'retry' => '7200',
+		'expire' => '604800',
+		'minimum' => '86400',
+		'ttl' => '86400',
+		'active' => 'y',
+		'xfer' => '',
+		'also_notify' => '',
+		'update_acl' => '',
+	);
+
 	$id = $client->dns_zone_add($session_id, $client_id, $params);
 
 	echo "DNS ID: ".$id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_delete.php b/remoting_client/examples/dns_zone_delete.php
index 2bfc9c4c5842cc42da12e6a698f5ed77733d2a74..c3e0c9aeb231c28e2b54251da1446d3f53d94636 100644
--- a/remoting_client/examples/dns_zone_delete.php
+++ b/remoting_client/examples/dns_zone_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->dns_zone_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_get.php b/remoting_client/examples/dns_zone_get.php
index 4ac8f174a37e578b5b7a1d8bb7715af6dfa9031e..f4f1f46308d9a42789be5927a4f537b56a36d964 100644
--- a/remoting_client/examples/dns_zone_get.php
+++ b/remoting_client/examples/dns_zone_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$dns_record = $client->dns_zone_get($session_id, $id);
 
 	print_r($dns_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_get_by_user.php b/remoting_client/examples/dns_zone_get_by_user.php
index 38d70a27329ac9115d193bc3d30df1cf6931a58f..15db9ee03dc1723684a14a319fa4e9615a1a10f7 100644
--- a/remoting_client/examples/dns_zone_get_by_user.php
+++ b/remoting_client/examples/dns_zone_get_by_user.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 2;
 	$server_id = 1;
-	
+
 	$record_record = $client->dns_zone_get_by_user($session_id, $client_id, $server_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_set_status.php b/remoting_client/examples/dns_zone_set_status.php
index e1b46c7842c6f01a92dfa824b62d2bcd3fb9246c..36a6310c771ae62f5aca91143a914cdabacd9297 100644
--- a/remoting_client/examples/dns_zone_set_status.php
+++ b/remoting_client/examples/dns_zone_set_status.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$primary_id = 3;
 	$status = 'inactive';
-	
+
 	$record_record = $client->dns_zone_set_status($session_id, $primary_id, $status);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/dns_zone_update.php b/remoting_client/examples/dns_zone_update.php
index 4b8e7c2a74c742cf48c93864d8a1ca172300cb34..908c7b1240b05a949884117ab4c1d0c024d2dc97 100644
--- a/remoting_client/examples/dns_zone_update.php
+++ b/remoting_client/examples/dns_zone_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to inactive
 	$dns_record['active'] = 'n';
-	
+
 	$affected_rows = $client->dns_zone_update($session_id, $client_id, $id, $dns_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_domain_add.php b/remoting_client/examples/domains_domain_add.php
index 30f2341f1792edadc1545970f43e97c1c7fcfd95..d6e3ba32fb1c28777b825670657abe4b71cb5db2 100644
--- a/remoting_client/examples/domains_domain_add.php
+++ b/remoting_client/examples/domains_domain_add.php
@@ -1,34 +1,34 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'domain' => 'cellar.door'
-			);
-	
+		'domain' => 'cellar.door'
+	);
+
 	$domain_id = $client->domains_domain_add($session_id, $client_id, $params);
 
 	echo "Domain ID: ".$domain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_domain_delete.php b/remoting_client/examples/domains_domain_delete.php
index 8582783807781fdaaada8287f9a1491ad6aea9e6..7db844d0a2c6fc34ef940d3a997c00f513f249bc 100644
--- a/remoting_client/examples/domains_domain_delete.php
+++ b/remoting_client/examples/domains_domain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->domains_domain_delete($session_id, $domain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_domain_get.php b/remoting_client/examples/domains_domain_get.php
index e8fcd65cd89f0a078592712a636d30a5cc0b7fa9..81020fc70856be3b43559882c7a75e1df66cec4a 100644
--- a/remoting_client/examples/domains_domain_get.php
+++ b/remoting_client/examples/domains_domain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain_id = 1;
-	
+
 	$domain_record = $client->domains_domain_get($session_id, $domain_id);
 
 	print_r($domain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/domains_get_all_by_user.php b/remoting_client/examples/domains_get_all_by_user.php
index 647741b52250bd33f000b535a49758e046e73fde..ae3fdfbe3a9b376781a67a510cd34c2a4b840a3d 100644
--- a/remoting_client/examples/domains_get_all_by_user.php
+++ b/remoting_client/examples/domains_get_all_by_user.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$group_id = 0;
-	
+
 	$record_record = $client->domains_get_all_by_user($session_id, $group_id);
 
 	print_r($record_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/get_function_list.php b/remoting_client/examples/get_function_list.php
index b4b3cbe24b46ebc2a5017e31b0876919ac9222eb..4a08c3c8cf7655669f68411dc5591238b631be59 100644
--- a/remoting_client/examples/get_function_list.php
+++ b/remoting_client/examples/get_function_list.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
-	
+
 	$record_record = $client->get_function_list($session_id);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/login.php b/remoting_client/examples/login.php
index 21b735d1cf0e06d35fbb77da9b2d5807eadc1027..085c8f24293dd0b909909bc57bcb3cff3229642c 100644
--- a/remoting_client/examples/login.php
+++ b/remoting_client/examples/login.php
@@ -1,21 +1,21 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	$session_id = $client->login($username,$password);
-		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
-		echo "Logging out: ";
+	$session_id = $client->login($username, $password);
+	echo 'Logged successfull. Session ID:'.$session_id.'<br />';
+	echo "Logging out: ";
 	$client->logout($session_id);
-		echo "Logged out.";
-		
+	echo "Logged out.";
+
 
 }catch (SoapFault $e) {
 	echo $client->__getLastResponse();
diff --git a/remoting_client/examples/logout.php b/remoting_client/examples/logout.php
index 8c7c5c1b6cb6fb8f753f635a0e1d36faf05cae4a..c19b3f5e77f700898d9bef1adddc896866afc82b 100644
--- a/remoting_client/examples/logout.php
+++ b/remoting_client/examples/logout.php
@@ -1,19 +1,19 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$session = $session_id;
 	echo "Logging out: ";
@@ -21,8 +21,8 @@ try {
 
 	//Logged out
 	echo "Logged out.";
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_add.php b/remoting_client/examples/mail_alias_add.php
index 38dbc6541140f82e648918e5b903763403e17c16..5969e8a96a7646d72fb053fd76f493164b1b9327 100644
--- a/remoting_client/examples/mail_alias_add.php
+++ b/remoting_client/examples/mail_alias_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hallo@test.int',
-			'destination' => 'ciao@test.int',
-			'type' => 'alias',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hallo@test.int',
+		'destination' => 'ciao@test.int',
+		'type' => 'alias',
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_alias_add($session_id, $client_id, $params);
 
 	echo "Alias ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_delete.php b/remoting_client/examples/mail_alias_delete.php
index 61c7ba20618c7ec8b647bef5d0cf3a14b0bb169f..ca883eb32b6b678a2b66fa0630d8c0862d2be225 100644
--- a/remoting_client/examples/mail_alias_delete.php
+++ b/remoting_client/examples/mail_alias_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_alias_delete($session_id, $alias_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_get.php b/remoting_client/examples/mail_alias_get.php
index 778dc90068e216a50022c58c4cdf4fecd4cf7954..5760b21f16793dbacd0c150a4c0f664f7ebeeb7f 100644
--- a/remoting_client/examples/mail_alias_get.php
+++ b/remoting_client/examples/mail_alias_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$alias_id = 1;
-	
+
 	$mail_alias_record = $client->mail_alias_get($session_id, $alias_id);
 
 	print_r($mail_alias_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_alias_update.php b/remoting_client/examples/mail_alias_update.php
index 3d00d949fbb4512830b31a0a8e6ae15cda906260..85165c0b47bed3d23bf729578e4f22491eac9990 100644
--- a/remoting_client/examples/mail_alias_update.php
+++ b/remoting_client/examples/mail_alias_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_alias_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_alias_update($session_id, $client_id, $alias_id, $mail_alias_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_add.php b/remoting_client/examples/mail_blacklist_add.php
index 70dcf78a85c9e93f93ea051625c4f7560cdfe7c3..6ff8992f4ea0187260aa9c58f041e7b8c1f92f4f 100644
--- a/remoting_client/examples/mail_blacklist_add.php
+++ b/remoting_client/examples/mail_blacklist_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hmmnoeoe@test.int',
-			'access' => 'REJECT',
-			'type' => 'sender',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hmmnoeoe@test.int',
+		'access' => 'REJECT',
+		'type' => 'sender',
+		'active' => 'y'
+	);
+
 	$blacklist_id = $client->mail_blacklist_add($session_id, $client_id, $params);
 
 	echo "Blacklist ID: ".$blacklist_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_delete.php b/remoting_client/examples/mail_blacklist_delete.php
index 90e7d4737bc352fe20c9b16d441091390e26e5f2..ce871c65ef25ed1054decca775810b6f147248e7 100644
--- a/remoting_client/examples/mail_blacklist_delete.php
+++ b/remoting_client/examples/mail_blacklist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_blacklist_delete($session_id, $blacklist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_get.php b/remoting_client/examples/mail_blacklist_get.php
index 7e28a20ca1b0f34ea586ed5f0d2bf06b54c95a3c..383fad44d06e2422d082ad5112b9396f719f6c39 100644
--- a/remoting_client/examples/mail_blacklist_get.php
+++ b/remoting_client/examples/mail_blacklist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$blacklist_id = 7;
-	
+
 	$mail_blacklist_record = $client->mail_blacklist_get($session_id, $blacklist_id);
 
 	print_r($mail_blacklist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_blacklist_update.php b/remoting_client/examples/mail_blacklist_update.php
index 27778ed8d9604201cf021bf440ceb62ae5957482..44288579bc4dae8b1188ec9215819bc5a925fd2e 100644
--- a/remoting_client/examples/mail_blacklist_update.php
+++ b/remoting_client/examples/mail_blacklist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_blacklist_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_blacklist_update($session_id, $client_id, $blacklist_id, $mail_blacklist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_add.php b/remoting_client/examples/mail_catchall_add.php
index 8b5d6f32548ee42a14e5693520130ef1219c2148..a3f57d2ef85b29942502ac203d1f7781bd9b4237 100644
--- a/remoting_client/examples/mail_catchall_add.php
+++ b/remoting_client/examples/mail_catchall_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => '@test.int',
-			'destination' => 'ciao@test.int',
-			'type' => 'catchall',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => '@test.int',
+		'destination' => 'ciao@test.int',
+		'type' => 'catchall',
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_catchall_add($session_id, $client_id, $params);
 
 	echo "Catchall ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_delete.php b/remoting_client/examples/mail_catchall_delete.php
index b0a51467181318ab93fea73626dd3fd7b04348e3..84e81722be4fb01f254db8d81eb900ff1938ad65 100644
--- a/remoting_client/examples/mail_catchall_delete.php
+++ b/remoting_client/examples/mail_catchall_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_catchall_delete($session_id, $catchall_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_get.php b/remoting_client/examples/mail_catchall_get.php
index 2bce08880dbc474d4defbc2a50f2091002100a8b..e1007c845c4b60ff3c40adacb8746b09d73d189d 100644
--- a/remoting_client/examples/mail_catchall_get.php
+++ b/remoting_client/examples/mail_catchall_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$catchall_id = 1;
-	
+
 	$mail_catchall_record = $client->mail_catchall_get($session_id, $catchall_id);
 
 	print_r($mail_catchall_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_catchall_update.php b/remoting_client/examples/mail_catchall_update.php
index d2542ddee251c74db87e882c5ecee527e80d390e..fe1752d6a72c81a26d130c1bb4732030e288cb48 100644
--- a/remoting_client/examples/mail_catchall_update.php
+++ b/remoting_client/examples/mail_catchall_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_catchall_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_catchall_update($session_id, $client_id, $catchall_id, $mail_catchall_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_add.php b/remoting_client/examples/mail_domain_add.php
index 304ccb24a6e849052eb226a1d8647a12d3b8bbf3..0dd9ddfafa566cd168ad4f670968504230dba806 100644
--- a/remoting_client/examples/mail_domain_add.php
+++ b/remoting_client/examples/mail_domain_add.php
@@ -1,36 +1,36 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'domain' => 'test.tld',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'domain' => 'test.tld',
+		'active' => 'y'
+	);
+
 	$domain_id = $client->mail_domain_add($session_id, $client_id, $params);
 
 	echo "Domain ID: ".$domain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_delete.php b/remoting_client/examples/mail_domain_delete.php
index e98c527fe15f810ab3af2870d9404343f722c5fb..2fc6018d3cfb78b46ea0115405e7589621c2d8ba 100644
--- a/remoting_client/examples/mail_domain_delete.php
+++ b/remoting_client/examples/mail_domain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_domain_delete($session_id, $domain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_get.php b/remoting_client/examples/mail_domain_get.php
index 5c2e9f17407b2620400c8ca7a6fc805a400bfc93..3d78305584a606216a3ae59c1c1c91429c26c11c 100644
--- a/remoting_client/examples/mail_domain_get.php
+++ b/remoting_client/examples/mail_domain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain_id = 1;
-	
+
 	$mail_domain_record = $client->mail_domain_get($session_id, $domain_id);
 
 	print_r($mail_domain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_get_by_domain.php b/remoting_client/examples/mail_domain_get_by_domain.php
index 157423b27c3c23fb1e859f4e1e7b475a164c02c9..5e20b11bc49773daa09ea29d8a27197be0e1f414 100644
--- a/remoting_client/examples/mail_domain_get_by_domain.php
+++ b/remoting_client/examples/mail_domain_get_by_domain.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain = 'test.int';
-	
+
 	$record_record = $client->mail_domain_get_by_domain($session_id, $domain);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_set_status.php b/remoting_client/examples/mail_domain_set_status.php
index 9508ad7f67716e9bcf6af2d098222ef553303293..ced4f257266da84c585014372e6f3c6e9df5a6ea 100644
--- a/remoting_client/examples/mail_domain_set_status.php
+++ b/remoting_client/examples/mail_domain_set_status.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$primary_id = 2;
 	$status = 'inactive';
-	
+
 	$record_record = $client->mail_domain_set_status($session_id, $primary_id, $status);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_domain_update.php b/remoting_client/examples/mail_domain_update.php
index b65894b22c23033f309857c5056f3f0c36c4a834..9eb04235080cde52e38214005d540c2e92208467 100644
--- a/remoting_client/examples/mail_domain_update.php
+++ b/remoting_client/examples/mail_domain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_domain_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_domain_update($session_id, $client_id, $domain_id, $mail_domain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_add.php b/remoting_client/examples/mail_fetchmail_add.php
index 55e59c11b3935383ee8562b79db2eca3950bcd27..912ffd5d293c2ffff3ef932103a6607d9a39eb01 100644
--- a/remoting_client/examples/mail_fetchmail_add.php
+++ b/remoting_client/examples/mail_fetchmail_add.php
@@ -1,42 +1,42 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'type' => 'pop3',
-			'source_server' => 'webzor.ext',
-			'source_username' => 'someguy',
-			'source_password' => 'somepassword',
-			'source_delete' => 'n',
-			'destination' => 'hmmnoe@test.int',
-			'active' => 'y',
-			'source_read_all' => 'y',
-			);
-	
+		'server_id' => 1,
+		'type' => 'pop3',
+		'source_server' => 'webzor.ext',
+		'source_username' => 'someguy',
+		'source_password' => 'somepassword',
+		'source_delete' => 'n',
+		'destination' => 'hmmnoe@test.int',
+		'active' => 'y',
+		'source_read_all' => 'y',
+	);
+
 	$fetchmail_id = $client->mail_fetchmail_add($session_id, $client_id, $params);
 
 	echo "Fetchmail ID: ".$fetchmail_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_delete.php b/remoting_client/examples/mail_fetchmail_delete.php
index a522bc154753ea18375c36607e990a76e77a9e20..ec21984228e51e01ab267097ef17d5d2c6efca10 100644
--- a/remoting_client/examples/mail_fetchmail_delete.php
+++ b/remoting_client/examples/mail_fetchmail_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_fetchmail_delete($session_id, $fetchmail_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_get.php b/remoting_client/examples/mail_fetchmail_get.php
index d804867e2af89315c068e913f6f355dfaadc6e69..8cdad259ae998cf31f9c9c97d4a3fac25c538e8f 100644
--- a/remoting_client/examples/mail_fetchmail_get.php
+++ b/remoting_client/examples/mail_fetchmail_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$fetchmail_id = 1;
-	
+
 	$mail_fetchmail_record = $client->mail_fetchmail_get($session_id, $fetchmail_id);
 
 	print_r($mail_fetchmail_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_fetchmail_update.php b/remoting_client/examples/mail_fetchmail_update.php
index b9dc0c8a49c8c90a1c95858b82575bddd6388323..3d508cefcb9109808d3c086992f6c463290d1f58 100644
--- a/remoting_client/examples/mail_fetchmail_update.php
+++ b/remoting_client/examples/mail_fetchmail_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_fetchmail_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_fetchmail_update($session_id, $client_id, $fetchmail_id, $mail_fetchmail_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_add.php b/remoting_client/examples/mail_filter_add.php
index 3b7e469596e0d7a02fb9eec0a2eaa1ff3d6400ec..f6fbbcc0c7d81e127e2ce98fff09e0b11c313bd9 100644
--- a/remoting_client/examples/mail_filter_add.php
+++ b/remoting_client/examples/mail_filter_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'type' => 'header',
-			'pattern' => 'hmmnoe@test.int',
-			'data' => 'data',
-			'action' => 'DISCARD',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'type' => 'header',
+		'pattern' => 'hmmnoe@test.int',
+		'data' => 'data',
+		'action' => 'DISCARD',
+		'active' => 'y'
+	);
+
 	$filter_id = $client->mail_filter_add($session_id, $client_id, $params);
 
 	echo "Filter ID: ".$filter_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_delete.php b/remoting_client/examples/mail_filter_delete.php
index 076ac0bd10db6e6d1772eb3acc5dff93bb492d97..c201c7778ec7d31e881d30338383e1811c69590a 100644
--- a/remoting_client/examples/mail_filter_delete.php
+++ b/remoting_client/examples/mail_filter_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_filter_delete($session_id, $filter_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_get.php b/remoting_client/examples/mail_filter_get.php
index 58c5ddc320ab1369f244eae91190a18792d5c7a3..fd4aca77d9895b76f0761343ec1ded8a9ff0c160 100644
--- a/remoting_client/examples/mail_filter_get.php
+++ b/remoting_client/examples/mail_filter_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$filter_id = 1;
-	
+
 	$mail_filter_record = $client->mail_filter_get($session_id, $filter_id);
 
 	print_r($mail_filter_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_filter_update.php b/remoting_client/examples/mail_filter_update.php
index e1c140d27b54aa630575e658e0afde98bd0fa10b..3e1080de435f57d7bfc016dac07d2a174dedd28e 100644
--- a/remoting_client/examples/mail_filter_update.php
+++ b/remoting_client/examples/mail_filter_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_filter_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_filter_update($session_id, $client_id, $filter_id, $mail_filter_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_add.php b/remoting_client/examples/mail_forward_add.php
index 52b514e2d5d3f617a62da1838cd5981aebd217bd..24ae47c7c19807fa9e78a6467597a7e57d320dfb 100644
--- a/remoting_client/examples/mail_forward_add.php
+++ b/remoting_client/examples/mail_forward_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hallo@test.int',
-			'destination' => 'ciao@test.int',
-			'type' => 'forward',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hallo@test.int',
+		'destination' => 'ciao@test.int',
+		'type' => 'forward',
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_forward_add($session_id, $client_id, $params);
 
 	echo "Forwarding ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_delete.php b/remoting_client/examples/mail_forward_delete.php
index eedf45160d3bf0a190493d1fdf2da0434b760207..9132de0b628ce4681d729a113933bfa8ce67da12 100644
--- a/remoting_client/examples/mail_forward_delete.php
+++ b/remoting_client/examples/mail_forward_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_forward_delete($session_id, $forwarding_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_get.php b/remoting_client/examples/mail_forward_get.php
index 31c35ca483b272352f0517aa59d820486d6b867a..533749b12be44cc8b74a8fd022a016b9dd9463e4 100644
--- a/remoting_client/examples/mail_forward_get.php
+++ b/remoting_client/examples/mail_forward_get.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$forwarding_id = 1;
-	
+
 	$mail_forwarding_record = $client->mail_forward_get($session_id, $forwarding_id);
 	// $mail_forwarding_record = $client->mail_forward_get($session_id, array('source' => '%@test.int'));
 
 	print_r($mail_forwarding_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_forward_update.php b/remoting_client/examples/mail_forward_update.php
index 47ef9f1ee0d172b845c6ec3ce23028782c0b47af..f62c6e6fc8ad4d96ed2189cf2a3591cfcc4bda30 100644
--- a/remoting_client/examples/mail_forward_update.php
+++ b/remoting_client/examples/mail_forward_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_forward_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_forward_update($session_id, $client_id, $forwarding_id, $mail_forward_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_add.php b/remoting_client/examples/mail_mailinglist_add.php
index c75eca30cda6b4c3342352435d40048d228b2d60..3d6cd568ab55644fe163f4d88d8d018190327ff3 100644
--- a/remoting_client/examples/mail_mailinglist_add.php
+++ b/remoting_client/examples/mail_mailinglist_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'domain' => 'test.int',
-			'listname' => 'work',
-			'email' => 'hmmnoe@test.int',
-			'password' => 'hmmyea'
-			);
-	
+		'server_id' => 1,
+		'domain' => 'test.int',
+		'listname' => 'work',
+		'email' => 'hmmnoe@test.int',
+		'password' => 'hmmyea'
+	);
+
 	$mailinglist_id = $client->mail_mailinglist_add($session_id, $client_id, $params);
 
 	echo "Mailinglist ID: ".$mailinglist_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_delete.php b/remoting_client/examples/mail_mailinglist_delete.php
index 218e34c2295022e35efc018d76e14f5bb3aac47e..cf76336f28d972efeb1733d8f8bf97e1fcac0f12 100644
--- a/remoting_client/examples/mail_mailinglist_delete.php
+++ b/remoting_client/examples/mail_mailinglist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_mailinglist_delete($session_id, $mailinglist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_get.php b/remoting_client/examples/mail_mailinglist_get.php
index 81ffbfb9aa709b2a8555d56c102496db03ec7412..7affe57a1e0ecaa883e8f890c9cbd402aab2ded7 100644
--- a/remoting_client/examples/mail_mailinglist_get.php
+++ b/remoting_client/examples/mail_mailinglist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$mailinglist_id = 1;
-	
+
 	$mailinglist_record = $client->mail_mailinglist_get($session_id, $mailinglist_id);
 
 	print_r($mailinglist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_mailinglist_update.php b/remoting_client/examples/mail_mailinglist_update.php
index 2940c8bdbae69d9bdca62558880465f216e365f8..c7d6216c11cf1332723a53439f8206491ad70782 100644
--- a/remoting_client/examples/mail_mailinglist_update.php
+++ b/remoting_client/examples/mail_mailinglist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the listname to home
 	$mailinglist_record['listname'] = 'home';
-	
+
 	$affected_rows = $client->mail_mailinglist_update($session_id, $client_id, $mailinglist_id, $mailinglist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_add.php b/remoting_client/examples/mail_policy_add.php
index a020e2372ee20a887694a48d060f2bf5f1841105..248fc1cd1977b6387b14dc301a9d3b5c96ca6355 100644
--- a/remoting_client/examples/mail_policy_add.php
+++ b/remoting_client/examples/mail_policy_add.php
@@ -1,71 +1,71 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'policy_name' => 'numberone',
-			'virus_lover' => 'Y',
-			'spam_lover' => 'Y',
-			'banned_files_lover' => 'Y',
-			'bad_header_lover' => 'Y',
-			'bypass_virus_checks' => 'Y',
-			'bypass_spam_checks' => 'Y',
-			'bypass_banned_checks' => 'Y',
-			'bypass_header_checks' => 'Y',
-			'spam_modifies_subj' => 'Y',
-			'virus_quarantine_to' => '',
-			'spam_quarantine_to' => '',
-			'banned_quarantine_to' => '',
-			'bad_header_quarantine_to' => '',
-			'clean_quarantine_to' => '',
-			'other_quarantine_to' => '',
-			'spam_tag_level' => 1,
-			'spam_tag2_level' => 1,
-			'spam_kill_level' => 1,
-			'spam_dsn_cutoff_level' => 1,
-			'spam_quarantine_cutoff_level' => 1,
-			'addr_extension_virus' => '',
-			'addr_extension_spam' => '',
-			'addr_extension_banned' => '',
-			'addr_extension_bad_header' => '',
-			'warnvirusrecip' => 'Y',
-			'warnbannedrecip' => 'Y',
-			'warnbadhrecip' => 'Y',
-			'newvirus_admin' => '',
-			'virus_admin' => '',
-			'banned_admin' => '',
-			'bad_header_admin' => '',
-			'spam_admin' => '',
-			'spam_subject_tag' => '',
-			'spam_subject_tag2' => '',
-			'message_size_limit' => 10,
-			'banned_rulenames' => 'welt'
-			);
-	
+		'policy_name' => 'numberone',
+		'virus_lover' => 'Y',
+		'spam_lover' => 'Y',
+		'banned_files_lover' => 'Y',
+		'bad_header_lover' => 'Y',
+		'bypass_virus_checks' => 'Y',
+		'bypass_spam_checks' => 'Y',
+		'bypass_banned_checks' => 'Y',
+		'bypass_header_checks' => 'Y',
+		'spam_modifies_subj' => 'Y',
+		'virus_quarantine_to' => '',
+		'spam_quarantine_to' => '',
+		'banned_quarantine_to' => '',
+		'bad_header_quarantine_to' => '',
+		'clean_quarantine_to' => '',
+		'other_quarantine_to' => '',
+		'spam_tag_level' => 1,
+		'spam_tag2_level' => 1,
+		'spam_kill_level' => 1,
+		'spam_dsn_cutoff_level' => 1,
+		'spam_quarantine_cutoff_level' => 1,
+		'addr_extension_virus' => '',
+		'addr_extension_spam' => '',
+		'addr_extension_banned' => '',
+		'addr_extension_bad_header' => '',
+		'warnvirusrecip' => 'Y',
+		'warnbannedrecip' => 'Y',
+		'warnbadhrecip' => 'Y',
+		'newvirus_admin' => '',
+		'virus_admin' => '',
+		'banned_admin' => '',
+		'bad_header_admin' => '',
+		'spam_admin' => '',
+		'spam_subject_tag' => '',
+		'spam_subject_tag2' => '',
+		'message_size_limit' => 10,
+		'banned_rulenames' => 'welt'
+	);
+
 	$affected_rows = $client->mail_policy_add($session_id, $client_id, $params);
-	
+
 	echo "Policy ID: ".$affected_rows."<br>";
-	
-	
+
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_delete.php b/remoting_client/examples/mail_policy_delete.php
index e0c0cebfbc55700eaf9e1095dbfcf0e8832933e2..3bc619ea66cd6f9272bd8c3b0a5750e5965f86fb 100644
--- a/remoting_client/examples/mail_policy_delete.php
+++ b/remoting_client/examples/mail_policy_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_policy_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_get.php b/remoting_client/examples/mail_policy_get.php
index 5e2005a01a8193c5f4a7219c7b39f5004d2ff545..d40deeaa5f50598afc64ba126c094fd8071a79ca 100644
--- a/remoting_client/examples/mail_policy_get.php
+++ b/remoting_client/examples/mail_policy_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$mail_policy_record = $client->mail_policy_get($session_id, $id);
 
 	print_r($mail_policy_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_policy_update.php b/remoting_client/examples/mail_policy_update.php
index abdab81570740eddd35ec71da291d7b75a17f068..d90ac5ce72cec595538a2de28531f4266f9e3402 100644
--- a/remoting_client/examples/mail_policy_update.php
+++ b/remoting_client/examples/mail_policy_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change policy_name to Hans_Werner
 	$mail_policy_record['policy_name'] = 'Hans_Werner';
-	
+
 	$affected_rows = $client->mail_policy_update($session_id, $client_id, $id, $mail_policy_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_add.php b/remoting_client/examples/mail_spamfilter_blacklist_add.php
index 4d5515c39cf60b7256edb268738a9cd02d6abfeb..d5768e25367027a11ee492661f189b8d320d13c5 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_add.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'wb' => 'B',
-			'rid' => '',
-			'email' => 'hmmnoe@test.int',
-			'priority' => 1,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'wb' => 'B',
+		'rid' => '',
+		'email' => 'hmmnoe@test.int',
+		'priority' => 1,
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_spamfilter_blacklist_add($session_id, $client_id, $params);
 
 	echo "Blacklist ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_delete.php b/remoting_client/examples/mail_spamfilter_blacklist_delete.php
index 9c5f701918bb9659fa794b0ddede3494a7880cd7..51f0162e0a0a200ce7fce24b140e0857fa4f8ad1 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_delete.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_spamfilter_blacklist_delete($session_id, $wblist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_get.php b/remoting_client/examples/mail_spamfilter_blacklist_get.php
index 723376acea4c8ac5f34e7785cee34ec3c24cc4ab..359dddb02182568471a0f4334553dfa389d886c4 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_get.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$wblist_id = 2;
-	
+
 	$mail_wblist_record = $client->mail_spamfilter_blacklist_get($session_id, $wblist_id);
 
 	print_r($mail_wblist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_blacklist_update.php b/remoting_client/examples/mail_spamfilter_blacklist_update.php
index 6dcf5f00136140659e59538cc06e3dfb3027353a..674429febcf39ce9cdefb3977b6edbd2a2032a47 100644
--- a/remoting_client/examples/mail_spamfilter_blacklist_update.php
+++ b/remoting_client/examples/mail_spamfilter_blacklist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the priority to 2
 	$mail_wblist_record['priority'] = 2;
-	
+
 	$affected_rows = $client->mail_spamfilter_blacklist_update($session_id, $client_id, $wblist_id, $mail_wblist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_add.php b/remoting_client/examples/mail_spamfilter_user_add.php
index 6ecccc1134f6f5c63507850cb3b9b03e7a0edcf3..5c2c59ce56c5cd8d401a360083b8e8bdb6327bef 100644
--- a/remoting_client/examples/mail_spamfilter_user_add.php
+++ b/remoting_client/examples/mail_spamfilter_user_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'priority' => 3,
-			'policy_id' => 1,
-			'email' => 'hmmnoe@test.int',
-			'fullname' => 'Max Mustermann',
-			'local' => ''
-			);
-	
+		'server_id' => 1,
+		'priority' => 3,
+		'policy_id' => 1,
+		'email' => 'hmmnoe@test.int',
+		'fullname' => 'Max Mustermann',
+		'local' => ''
+	);
+
 	$affected_rows = $client->mail_spamfilter_user_add($session_id, $client_id, $params);
 
 	echo "Spamfilter user ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_delete.php b/remoting_client/examples/mail_spamfilter_user_delete.php
index 7ff719ed03cab2a93caea9cfb4b63ed85f315b3d..e2d419c5a59a5ac39c9c2a0c4bd52ffe6f10ba8e 100644
--- a/remoting_client/examples/mail_spamfilter_user_delete.php
+++ b/remoting_client/examples/mail_spamfilter_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_spamfilter_user_delete($session_id, $id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_get.php b/remoting_client/examples/mail_spamfilter_user_get.php
index 082c59dff4f5a73f8d49a264d3e182757224eca6..9a5f48fc5859ce19413612ad8c68003429022d22 100644
--- a/remoting_client/examples/mail_spamfilter_user_get.php
+++ b/remoting_client/examples/mail_spamfilter_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$id = 1;
-	
+
 	$mail_spamfilter_user_record = $client->mail_spamfilter_user_get($session_id, $id);
 
 	print_r($mail_spamfilter_user_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_user_update.php b/remoting_client/examples/mail_spamfilter_user_update.php
index e40415b24e5af716255f716e81f99d987be2b760..95fe72254ecca967fac8f52c5c38f9b7d677cb26 100644
--- a/remoting_client/examples/mail_spamfilter_user_update.php
+++ b/remoting_client/examples/mail_spamfilter_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change fullname to Hans Werner
 	$mail_spamfilter_user_record['fullname'] = 'Hans Werner';
-	
+
 	$affected_rows = $client->mail_spamfilter_user_update($session_id, $client_id, $id, $mail_spamfilter_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_add.php b/remoting_client/examples/mail_spamfilter_whitelist_add.php
index 8099d937a4ae4f4c46f5ae39de5c20f58951b679..fd974ec003b9ac8166d6489131a660d174998987 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_add.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'wb' => 'W',
-			'rid' => '',
-			'email' => 'hmmnoe@test.int',
-			'priority' => 1,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'wb' => 'W',
+		'rid' => '',
+		'email' => 'hmmnoe@test.int',
+		'priority' => 1,
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_spamfilter_whitelist_add($session_id, $client_id, $params);
 
 	echo "Whitelist ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_delete.php b/remoting_client/examples/mail_spamfilter_whitelist_delete.php
index a6290ce3b64b210a17eef278a237fa63325cca4d..629d183ee65f78453853b54a0f44aae687b1d688 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_delete.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_spamfilter_whitelist_delete($session_id, $wblist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_get.php b/remoting_client/examples/mail_spamfilter_whitelist_get.php
index afef378ce410218b2764cb91970a4bc17e7d803b..02597c05e4af30dd4d9fc1210f960f364fcecd8a 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_get.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$wblist_id = 1;
-	
+
 	$mail_wblist_record = $client->mail_spamfilter_whitelist_get($session_id, $wblist_id);
 
 	print_r($mail_wblist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_spamfilter_whitelist_update.php b/remoting_client/examples/mail_spamfilter_whitelist_update.php
index 910ecc7f58a7af925f609857ca4812617e2a1ab4..f95b6194130dfbab7a8dedf2f3e7b5091e5368b9 100644
--- a/remoting_client/examples/mail_spamfilter_whitelist_update.php
+++ b/remoting_client/examples/mail_spamfilter_whitelist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the priority to 2
 	$mail_wblist_record['priority'] = 2;
-	
+
 	$affected_rows = $client->mail_spamfilter_whitelist_update($session_id, $client_id, $wblist_id, $mail_wblist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_add.php b/remoting_client/examples/mail_transport_add.php
index c0ca2d75f908721091dbf953a3ed78d874904db7..d296f9085c4da9b9fe23cb589f60e1f6631149d5 100644
--- a/remoting_client/examples/mail_transport_add.php
+++ b/remoting_client/examples/mail_transport_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'domain' => 'test.int',
-			'transport' => '',
-			'sort_order' => 5,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'domain' => 'test.int',
+		'transport' => '',
+		'sort_order' => 5,
+		'active' => 'y'
+	);
+
 	$affected_rows = $client->mail_transport_add($session_id, $client_id, $params);
 
 	echo "Transport ID: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_delete.php b/remoting_client/examples/mail_transport_delete.php
index 68e4812b7bfe0b77d4668ebc4829d6927f7ef890..80dd9cc7fed95cea4672a03e7607742526764dbc 100644
--- a/remoting_client/examples/mail_transport_delete.php
+++ b/remoting_client/examples/mail_transport_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_transport_delete($session_id, $transport_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_get.php b/remoting_client/examples/mail_transport_get.php
index 1ecdf6a332602d1c305348befa5c4f1403ab7bb1..00a32687c955a89c250e7a3db322646ab92efc8a 100644
--- a/remoting_client/examples/mail_transport_get.php
+++ b/remoting_client/examples/mail_transport_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$transport_id = 1;
-	
+
 	$mail_transport_record = $client->mail_transport_get($session_id, $transport_id);
 
 	print_r($mail_transport_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_transport_update.php b/remoting_client/examples/mail_transport_update.php
index db4d3ba22141ed527fec569e77848a3f13659f79..da4f57f904145a7d760e4ab94cdc146991a2f3ef 100644
--- a/remoting_client/examples/mail_transport_update.php
+++ b/remoting_client/examples/mail_transport_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_transport_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_transport_update($session_id, $client_id, $transport_id, $mail_transport_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_add.php b/remoting_client/examples/mail_user_add.php
index 1351eef076c65122c87850806ed20ddb5212b95d..25e3590af10bde0a838388ca395b3481925d9836 100644
--- a/remoting_client/examples/mail_user_add.php
+++ b/remoting_client/examples/mail_user_add.php
@@ -1,56 +1,56 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'email' => 'joe@test.int',
-			'login' => 'joe@test.int',
-			'password' => 'howtoforge',
-			'name' => 'joe',
-			'uid' => 5000,
-			'gid' => 5000,
-			'maildir' => '/var/vmail/test.int/joe',
-			'quota' => 5242880,
-			'cc' => '',
-			'homedir' => '/var/vmail',
-			'autoresponder' => 'n',
-			'autoresponder_start_date' => array('day' => 1,'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
-			'autoresponder_end_date' => array('day' => 20,'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
-			'autoresponder_text' => 'hallo',
-			'move_junk' => 'n',
-			'custom_mailfilter' => 'spam',
-			'postfix' => 'n',
-			'access' => 'n',
-			'disableimap' => 'n',
-			'disablepop3' => 'n',
-			'disabledeliver' => 'n',
-			'disablesmtp' => 'n'
-			);
-	
+		'server_id' => 1,
+		'email' => 'joe@test.int',
+		'login' => 'joe@test.int',
+		'password' => 'howtoforge',
+		'name' => 'joe',
+		'uid' => 5000,
+		'gid' => 5000,
+		'maildir' => '/var/vmail/test.int/joe',
+		'quota' => 5242880,
+		'cc' => '',
+		'homedir' => '/var/vmail',
+		'autoresponder' => 'n',
+		'autoresponder_start_date' => array('day' => 1, 'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
+		'autoresponder_end_date' => array('day' => 20, 'month' => 7, 'year' => 2012, 'hour' => 0, 'minute' => 0),
+		'autoresponder_text' => 'hallo',
+		'move_junk' => 'n',
+		'custom_mailfilter' => 'spam',
+		'postfix' => 'n',
+		'access' => 'n',
+		'disableimap' => 'n',
+		'disablepop3' => 'n',
+		'disabledeliver' => 'n',
+		'disablesmtp' => 'n'
+	);
+
 	$affected_rows = $client->mail_user_add($session_id, $client_id, $params);
 
 	echo "New user: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_delete.php b/remoting_client/examples/mail_user_delete.php
index ffc3826ebe19361724dd5aa7b07530b65c9858b9..e9be89429fd84b341704bea572c6d7d7de35477d 100644
--- a/remoting_client/examples/mail_user_delete.php
+++ b/remoting_client/examples/mail_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_user_delete($session_id, $mailuser_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_add.php b/remoting_client/examples/mail_user_filter_add.php
index 4e61695ac491798c28643c03be531941c140cfef..1f07f7341cfddad24bcc958c88a9318547ae4cf6 100644
--- a/remoting_client/examples/mail_user_filter_add.php
+++ b/remoting_client/examples/mail_user_filter_add.php
@@ -1,41 +1,41 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'mailuser_id' => '0',
-			'rulename' => 'NULL',
-			'source' => '',
-			'searchterm' => 'NULL',
-			'op' => '',
-			'action' => '',
-			'target' => '',
-			'active' => 'y'
-			);
-	
+		'mailuser_id' => '0',
+		'rulename' => 'NULL',
+		'source' => '',
+		'searchterm' => 'NULL',
+		'op' => '',
+		'action' => '',
+		'target' => '',
+		'active' => 'y'
+	);
+
 	$filter_id = $client->mail_user_filter_add($session_id, $client_id, $params);
 
 	echo "Filter ID: ".$filter_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_delete.php b/remoting_client/examples/mail_user_filter_delete.php
index d2eb2ed2855ca001888feeca8d5cb46411163a36..3a2a9f82e6f7f248259768c57da35b278452a369 100644
--- a/remoting_client/examples/mail_user_filter_delete.php
+++ b/remoting_client/examples/mail_user_filter_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->mail_user_filter_delete($session_id, $filter_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_get.php b/remoting_client/examples/mail_user_filter_get.php
index aad3ce5eda7d7065079c6e16e64e9e1647c359ea..a3038a14d1c67b145d511c11d4de693ead4a710d 100644
--- a/remoting_client/examples/mail_user_filter_get.php
+++ b/remoting_client/examples/mail_user_filter_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$filter_id = 1;
-	
+
 	$mail_filter_record = $client->mail_user_filter_get($session_id, $filter_id);
 
 	print_r($mail_filter_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_filter_update.php b/remoting_client/examples/mail_user_filter_update.php
index f94862068cc92ce67e7d06fed38a039129b9b4d5..a8b62c43e57dd2c8bc88fee1d4f4ee16b9d39dac 100644
--- a/remoting_client/examples/mail_user_filter_update.php
+++ b/remoting_client/examples/mail_user_filter_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_user_filter_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_user_filter_update($session_id, $client_id, $filter_id, $mail_user_filter_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_get.php b/remoting_client/examples/mail_user_get.php
index fd36d6322aed1e1cbcc6faba25d6e94f5b231fbc..cdec8b7c1eca5a1f52bcf5db13fb325ff84fe705 100644
--- a/remoting_client/examples/mail_user_get.php
+++ b/remoting_client/examples/mail_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$mailuser_id = 1;
-	
+
 	$app = $client->mail_user_get($session_id, $mailuser_id);
 
 	print_r($app);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_user_update.php b/remoting_client/examples/mail_user_update.php
index 28fb90cb2c84ab0f790a1c7c06cbb4ad99ada584..b6b92fdd8a76754865dd993a7e7e15f83f10f70f 100644
--- a/remoting_client/examples/mail_user_update.php
+++ b/remoting_client/examples/mail_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_user_record['name'] = 'hmmyea';
-	
+
 	$affected_rows = $client->mail_user_update($session_id, $client_id, $mailuser_id, $mail_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_add.php b/remoting_client/examples/mail_whitelist_add.php
index 14f32982a2f928d719e4b13dc466a70db27a51a0..e25dbdbcaedd6a54721de2ee8ae248ddaa33cc7c 100644
--- a/remoting_client/examples/mail_whitelist_add.php
+++ b/remoting_client/examples/mail_whitelist_add.php
@@ -1,38 +1,38 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'source' => 'hmmnoeoe@test.int',
-			'access' => 'OK',
-			'type' => 'sender',
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'source' => 'hmmnoeoe@test.int',
+		'access' => 'OK',
+		'type' => 'sender',
+		'active' => 'y'
+	);
+
 	$whitelist_id = $client->mail_whitelist_add($session_id, $client_id, $params);
 
 	echo "Whitelist ID: ".$whitelist_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_delete.php b/remoting_client/examples/mail_whitelist_delete.php
index 555a0b821727f51cd31bb00279d0d20c4e17281b..fc36f6efb16987e7cd9f71c6b302ab321f3efa43 100644
--- a/remoting_client/examples/mail_whitelist_delete.php
+++ b/remoting_client/examples/mail_whitelist_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -20,12 +20,12 @@ try {
 	$affected_rows = $client->mail_whitelist_delete($session_id, $whitelist_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_get.php b/remoting_client/examples/mail_whitelist_get.php
index 5652c71d1d93fb6469de70f5a83bc5398d841af0..69d4befe20939a98725cab44fe5076fc8865ea07 100644
--- a/remoting_client/examples/mail_whitelist_get.php
+++ b/remoting_client/examples/mail_whitelist_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$whitelist_id = 3;
-	
+
 	$mail_whitelist_record = $client->mail_whitelist_get($session_id, $whitelist_id);
 
 	print_r($mail_whitelist_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/mail_whitelist_update.php b/remoting_client/examples/mail_whitelist_update.php
index 301e0035526d7b7d34448d49ec1c7bf2d6884af5..984519cefea8b196171dfd326f4b7ef0c241d1d7 100644
--- a/remoting_client/examples/mail_whitelist_update.php
+++ b/remoting_client/examples/mail_whitelist_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$mail_whitelist_record['active'] = 'n';
-	
+
 	$affected_rows = $client->mail_whitelist_update($session_id, $client_id, $whitelist_id, $mail_whitelist_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_get_free_ip.php b/remoting_client/examples/openvz_get_free_ip.php
index ef04ef5fc87a37cef78d0e81688f541189a76437..d7ccc969742fb8f766c64a81f56f67632868d2fc 100644
--- a/remoting_client/examples/openvz_get_free_ip.php
+++ b/remoting_client/examples/openvz_get_free_ip.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 
 	$record_record = $client->openvz_get_free_ip($session_id, $server_id = 0);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_add.php b/remoting_client/examples/openvz_ip_add.php
index 77ec4c4f8f6802dd091614d95b1984f8c4caba2a..cda9fa4a7fdbe6524e181d4ba2121e3cdd89faa7 100644
--- a/remoting_client/examples/openvz_ip_add.php
+++ b/remoting_client/examples/openvz_ip_add.php
@@ -1,37 +1,37 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '192.168.0.111',
-			'vm_id' => 1,
-			'reserved' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '192.168.0.111',
+		'vm_id' => 1,
+		'reserved' => 'n'
+	);
+
 	$ip_id = $client->openvz_ip_add($session_id, $client_id, $params);
 
 	echo "IP ID: ".$ip_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_delete.php b/remoting_client/examples/openvz_ip_delete.php
index c542645636c47b28c5e5c94c874b50728d266b91..c7b07f8aae812f82c5bfe995117a9b0fbaf52b83 100644
--- a/remoting_client/examples/openvz_ip_delete.php
+++ b/remoting_client/examples/openvz_ip_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->openvz_ip_delete($session_id, $ip_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_get.php b/remoting_client/examples/openvz_ip_get.php
index 78ed06142c749ecb00e775a63dcc242473da9ded..9237ed4e1b848a12ab4d31ad278b75b46d5db606 100644
--- a/remoting_client/examples/openvz_ip_get.php
+++ b/remoting_client/examples/openvz_ip_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ip_id = 2;
-	
+
 	$ip_record = $client->openvz_ip_get($session_id, $ip_id);
 
 	print_r($ip_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ip_update.php b/remoting_client/examples/openvz_ip_update.php
index f5ba0e6be3d8ecdf96f73b268f78f21f60ddcfb8..9867fe0a9cbff197df26bbbc8e61ddf14e0bd049 100644
--- a/remoting_client/examples/openvz_ip_update.php
+++ b/remoting_client/examples/openvz_ip_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the reservation to yes
 	$ip_record['reserved'] = 'y';
-	
+
 	$affected_rows = $client->openvz_ip_update($session_id, $client_id, $ip_id, $ip_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_add.php b/remoting_client/examples/openvz_ostemplate_add.php
index 923b7c1a2f6e7d6f6479706e95ca045ccded0490..3ad0c137286ce394e8a7c707003475fdfda96cba 100644
--- a/remoting_client/examples/openvz_ostemplate_add.php
+++ b/remoting_client/examples/openvz_ostemplate_add.php
@@ -1,39 +1,39 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'template_name' => 'tone',
-			'template_file' => 'custom',
-			'server_id' => 1,
-			'allservers' => 'y',
-			'active' => 'y',
-			'description' => 'howto',
-			);
-	
+		'template_name' => 'tone',
+		'template_file' => 'custom',
+		'server_id' => 1,
+		'allservers' => 'y',
+		'active' => 'y',
+		'description' => 'howto',
+	);
+
 	$ostemplate_id = $client->openvz_ostemplate_add($session_id, $client_id, $params);
 
 	echo "Ostemplate ID: ".$ostemplate_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_delete.php b/remoting_client/examples/openvz_ostemplate_delete.php
index b8bf5f9add9942d51f3f22cec90ab806d4b1244a..659d8afa09be8a1adc5886e2fee81d3426b876ad 100644
--- a/remoting_client/examples/openvz_ostemplate_delete.php
+++ b/remoting_client/examples/openvz_ostemplate_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->openvz_ostemplate_delete($session_id, $ostemplate_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_get.php b/remoting_client/examples/openvz_ostemplate_get.php
index 6d224130e509c842ad6b02cbcdddfb1ad5cc9a70..b2d940b4bb6f2f62c5111e3bef92a912c03e8a5d 100644
--- a/remoting_client/examples/openvz_ostemplate_get.php
+++ b/remoting_client/examples/openvz_ostemplate_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ostemplate_id = 2;
-	
+
 	$ostemplate_record = $client->openvz_ostemplate_get($session_id, $ostemplate_id);
 
 	print_r($ostemplate_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_ostemplate_update.php b/remoting_client/examples/openvz_ostemplate_update.php
index abc076f696590bf4bd1c05a609ce63ff981042f0..a95fc175ff38abc4821501437891c1c332705ae1 100644
--- a/remoting_client/examples/openvz_ostemplate_update.php
+++ b/remoting_client/examples/openvz_ostemplate_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$ostemplate_record['active'] = 'n';
-	
+
 	$affected_rows = $client->openvz_ostemplate_update($session_id, $client_id, $ostemplate_id, $ostemplate_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_add.php b/remoting_client/examples/openvz_template_add.php
index bdfc63a363c5f9cd1fa10294c01cc35c523f8b07..74eb1b976374d212584c8ca524e05518781be5a3 100644
--- a/remoting_client/examples/openvz_template_add.php
+++ b/remoting_client/examples/openvz_template_add.php
@@ -1,71 +1,71 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'template_name' => 'tone',
-			'diskspace' => 10,
-			'traffic' => -1,
-			'bandwidth' => -1,
-			'ram' => 256,
-			'ram_burst' => 512,
-			'cpu_units' => 1000,
-			'cpu_num' => 4,
-			'cpu_limit' => 400,
-			'io_priority' => 4,
-			'active' => 'y',
-			'description' => 'howto',
-			'numproc' => '999999:999999',
-			'numtcpsock' => '7999992:7999992',
-			'numothersock' => '7999992:7999992',
-			'vmguarpages' => '65536:65536',
-			'kmemsize' => '2147483646:2147483646',
-			'tcpsndbuf' => '214748160:396774400',
-			'tcprcvbuf' => '214748160:396774400',
-			'othersockbuf' => '214748160:396774400',
-			'dgramrcvbuf' => '214748160:396774400',
-			'oomguarpages' => '65536:65536',
-			'privvmpages' => '131072:131072',
-			'lockedpages' => '999999:999999',
-			'shmpages' => '65536:65536',
-			'physpages' => '0:2147483647',
-			'numfile' => '23999976:23999976',
-			'avnumproc' => '180:180',
-			'numflock' => '999999:999999',
-			'numpty' => '500000:500000',
-			'numsiginfo' => '999999:999999',
-			'dcachesize' => '2147483646:2147483646',
-			'numiptent' => '999999:999999',
-			'swappages' => '256000:256000',
-			'hostname' => 'host',
-			'nameserver' => 'ns1',
-			'create_dns' => 'n',
-			'capability' => ''
-			);
-	
+		'template_name' => 'tone',
+		'diskspace' => 10,
+		'traffic' => -1,
+		'bandwidth' => -1,
+		'ram' => 256,
+		'ram_burst' => 512,
+		'cpu_units' => 1000,
+		'cpu_num' => 4,
+		'cpu_limit' => 400,
+		'io_priority' => 4,
+		'active' => 'y',
+		'description' => 'howto',
+		'numproc' => '999999:999999',
+		'numtcpsock' => '7999992:7999992',
+		'numothersock' => '7999992:7999992',
+		'vmguarpages' => '65536:65536',
+		'kmemsize' => '2147483646:2147483646',
+		'tcpsndbuf' => '214748160:396774400',
+		'tcprcvbuf' => '214748160:396774400',
+		'othersockbuf' => '214748160:396774400',
+		'dgramrcvbuf' => '214748160:396774400',
+		'oomguarpages' => '65536:65536',
+		'privvmpages' => '131072:131072',
+		'lockedpages' => '999999:999999',
+		'shmpages' => '65536:65536',
+		'physpages' => '0:2147483647',
+		'numfile' => '23999976:23999976',
+		'avnumproc' => '180:180',
+		'numflock' => '999999:999999',
+		'numpty' => '500000:500000',
+		'numsiginfo' => '999999:999999',
+		'dcachesize' => '2147483646:2147483646',
+		'numiptent' => '999999:999999',
+		'swappages' => '256000:256000',
+		'hostname' => 'host',
+		'nameserver' => 'ns1',
+		'create_dns' => 'n',
+		'capability' => ''
+	);
+
 	$template_id = $client->openvz_template_add($session_id, $client_id, $params);
 
 	echo "Template ID: ".$template_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_delete.php b/remoting_client/examples/openvz_template_delete.php
index 69c68f06602cefbc0203e8f18e828a6911026a29..128034e85694a332dad9921947f584d4b0c96354 100644
--- a/remoting_client/examples/openvz_template_delete.php
+++ b/remoting_client/examples/openvz_template_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->openvz_template_delete($session_id, $template_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_get.php b/remoting_client/examples/openvz_template_get.php
index ac8bd5d92e066b7b53f028674aaa213688c93301..dfe9c1113cc8830b13345429cc854e1eafb80d6c 100644
--- a/remoting_client/examples/openvz_template_get.php
+++ b/remoting_client/examples/openvz_template_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$template_id = 2;
-	
+
 	$template_record = $client->openvz_template_get($session_id, $template_id);
 
 	print_r($template_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_template_update.php b/remoting_client/examples/openvz_template_update.php
index be84d1f01ec32a45f5d22e3664acca9181228526..0425d9453035e8764afcc78e5394d25dbdae8068 100644
--- a/remoting_client/examples/openvz_template_update.php
+++ b/remoting_client/examples/openvz_template_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$template_record['active'] = 'n';
-	
+
 	$affected_rows = $client->openvz_template_update($session_id, $client_id, $template_id, $template_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_add.php b/remoting_client/examples/openvz_vm_add.php
index ce89be7fc13ce69d2b6a4985dd3e94cf41808c6a..408c62695eaaeee537cdadda5da120b816b1b1d8 100644
--- a/remoting_client/examples/openvz_vm_add.php
+++ b/remoting_client/examples/openvz_vm_add.php
@@ -1,57 +1,57 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'veid' => 1,
-			'ostemplate_id' => 0,
-			'template_id' => 0,
-			'ip_address' => '192.168.0.111',
-			'hostname' => 'host',
-			'vm_password' => 'password',
-			'start_boot' => 'y',
-			'active' => 'y',
-			'active_until_date' => '',
-			'description' => '',
-			'diskspace' => 10,
-			'traffic' => -1,
-			'bandwidth' => -1,
-			'ram' => 256,
-			'ram_burst' => 512,
-			'cpu_units' => 1000,
-			'cpu_num' => 4,
-			'cpu_limit' => 400,
-			'io_priority' => 4,
-			'nameserver' => '8.8.8.8 8.8.4.4',
-			'create_dns' => 'n',
-			'capability' => '',
-			'config' => ''
-			);
-	
+		'server_id' => 1,
+		'veid' => 1,
+		'ostemplate_id' => 0,
+		'template_id' => 0,
+		'ip_address' => '192.168.0.111',
+		'hostname' => 'host',
+		'vm_password' => 'password',
+		'start_boot' => 'y',
+		'active' => 'y',
+		'active_until_date' => '',
+		'description' => '',
+		'diskspace' => 10,
+		'traffic' => -1,
+		'bandwidth' => -1,
+		'ram' => 256,
+		'ram_burst' => 512,
+		'cpu_units' => 1000,
+		'cpu_num' => 4,
+		'cpu_limit' => 400,
+		'io_priority' => 4,
+		'nameserver' => '8.8.8.8 8.8.4.4',
+		'create_dns' => 'n',
+		'capability' => '',
+		'config' => ''
+	);
+
 	$vm_id = $client->openvz_vm_add($session_id, $client_id, $params);
 
 	echo "VM ID: ".$vm_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_add_from_template.php b/remoting_client/examples/openvz_vm_add_from_template.php
index 2e22b99fc376364c15938595a2eda0b2658183a9..ea7328d166252d50cd05a2a2a4966dd6d931ce94 100644
--- a/remoting_client/examples/openvz_vm_add_from_template.php
+++ b/remoting_client/examples/openvz_vm_add_from_template.php
@@ -8,35 +8,35 @@ $soap_uri = 'http://localhost:8080/remote/';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
-	//* Params are optional for this function. If params are set, 
+
+	//* Params are optional for this function. If params are set,
 	//* then they override the template settings.
 	$params = array();
-	
+
 	//* Set the function parameters.
 	$client_id = 0;
 	$ostemplate_id = 3;
 	$template_id = 3;
-	
+
 	$vm_id = $client->openvz_vm_add_from_template($session_id, $client_id, $ostemplate_id, $template_id, $params);
 
 	print_r($vm_id);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_delete.php b/remoting_client/examples/openvz_vm_delete.php
index 5edc93fb172f37c5c6f58ad415d14dc2f8784018..be0737cd90012bb6b757792e32abe2d8cdec99dc 100644
--- a/remoting_client/examples/openvz_vm_delete.php
+++ b/remoting_client/examples/openvz_vm_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->openvz_vm_delete($session_id, $vm_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_get.php b/remoting_client/examples/openvz_vm_get.php
index d645d34ad5b90d8be556a5e9575fe25c0552f84b..78bd5712f6413bac04f95964e6ec4aa9d6def05b 100644
--- a/remoting_client/examples/openvz_vm_get.php
+++ b/remoting_client/examples/openvz_vm_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$vm_id = 1;
-	
+
 	$vm_record = $client->openvz_vm_get($session_id, $vm_id);
 
 	print_r($vm_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_get_by_client.php b/remoting_client/examples/openvz_vm_get_by_client.php
index 1b696bfb16b4e316f6165381a7534e844121b6d6..8497185971d7021da05696272905f7406ddf442e 100644
--- a/remoting_client/examples/openvz_vm_get_by_client.php
+++ b/remoting_client/examples/openvz_vm_get_by_client.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set function parameters
 	$client_id = 4;
-	
+
 	$vm_record = $client->openvz_vm_get_by_client($session_id, $client_id);
 
 	print_r($vm_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/openvz_vm_update.php b/remoting_client/examples/openvz_vm_update.php
index 5a908b18310741cdca3416358abac17c2c3d5c38..f15386a64b4b763298cdb1839fbe4436907f8df8 100644
--- a/remoting_client/examples/openvz_vm_update.php
+++ b/remoting_client/examples/openvz_vm_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to no
 	$vm_record['active'] = 'n';
-	
+
 	$affected_rows = $client->openvz_vm_update($session_id, $client_id, $vm_id, $vm_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/server_get.php b/remoting_client/examples/server_get.php
index c33f3b984b779929b728e15e7fa5c7648dfc4975..d5f09d6fa9b61185ea6200985b78e8b5b46d21bc 100644
--- a/remoting_client/examples/server_get.php
+++ b/remoting_client/examples/server_get.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$server_id = 1;
-	
+
 	$record_record = $client->server_get($session_id, $server_id, $section ='');
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/server_get_serverid_by_ip.php b/remoting_client/examples/server_get_serverid_by_ip.php
index 11a58b62ba33982b4af4784c3e278eb4f41ab926..f3e1ec412c17152f6f78babe679d46bb5a6a07a3 100644
--- a/remoting_client/examples/server_get_serverid_by_ip.php
+++ b/remoting_client/examples/server_get_serverid_by_ip.php
@@ -1,32 +1,32 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ipaddress = '192.168.0.112';
-	
+
 	$record_record = $client->server_get_serverid_by_ip($session_id, $ipaddress);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_add.php b/remoting_client/examples/sites_cron_add.php
index cc517e9a9ddd5ad082aa9fff07117d29601e0a8b..0294a9f9395dc563e948bb2963b0f1d6a00b652c 100644
--- a/remoting_client/examples/sites_cron_add.php
+++ b/remoting_client/examples/sites_cron_add.php
@@ -1,44 +1,44 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
-	
+
 	$params = array(
-			'server_id' => 1,
-			'parent_domain_id' => 1,
-			'type' => 'url',
-			'command' => 'echo 1',
-			'run_min' => '1',
-			'run_hour' => '1',
-			'run_mday' => '1',
-			'run_month' => '1',
-			'run_wday' => '1',
-			'active' => 'y',
-			);
-	
+		'server_id' => 1,
+		'parent_domain_id' => 1,
+		'type' => 'url',
+		'command' => 'echo 1',
+		'run_min' => '1',
+		'run_hour' => '1',
+		'run_mday' => '1',
+		'run_month' => '1',
+		'run_wday' => '1',
+		'active' => 'y',
+	);
+
 	$affected_rows = $client->sites_cron_add($session_id, $client_id, $params);
-	
+
 	echo "Cron ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_delete.php b/remoting_client/examples/sites_cron_delete.php
index 21aa10aff54ba09c1b9849c2ae09300e35bfabb4..b9dbcdecd86572d501540de4d71f4d30131cd77b 100644
--- a/remoting_client/examples/sites_cron_delete.php
+++ b/remoting_client/examples/sites_cron_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_cron_delete($session_id, $cron_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_get.php b/remoting_client/examples/sites_cron_get.php
index 4b3a71832824752c428e9c723ef39e25541feb82..0b93ca039cf04a941b81a228d0a73d5b9dece5a9 100644
--- a/remoting_client/examples/sites_cron_get.php
+++ b/remoting_client/examples/sites_cron_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$cron_id = 1;
-	
+
 	$cron_record = $client->sites_cron_get($session_id, $cron_id);
 
 	print_r($cron_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_cron_update.php b/remoting_client/examples/sites_cron_update.php
index b888e2a574df5a4385e87c40830a2d21f1234d5a..8411e6548bd43a6a6765ad3b7385ef47ff4a2ab4 100644
--- a/remoting_client/examples/sites_cron_update.php
+++ b/remoting_client/examples/sites_cron_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to no
 	$cron_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_cron_update($session_id, $client_id, $cron_id, $cron_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_add.php b/remoting_client/examples/sites_database_add.php
index f3ddc29fef51a5a691deee9ee33ed827f4a900d2..c3918671438d111eb315c1f2651238e22c39f00f 100644
--- a/remoting_client/examples/sites_database_add.php
+++ b/remoting_client/examples/sites_database_add.php
@@ -1,44 +1,44 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'type' => 'mysql',
-			'database_name' => 'db_name2',
-			'database_user_id' => '1',
-			'database_ro_user_id' => '0',
-			'database_charset' => 'UTF8',
-			'remote_access' => 'y',
-			'remote_ips' => '',
-			'backup_interval' => 'none',
-			'backup_copies' => 1,
-			'active' => 'y'
-			);
-	
+		'server_id' => 1,
+		'type' => 'mysql',
+		'database_name' => 'db_name2',
+		'database_user_id' => '1',
+		'database_ro_user_id' => '0',
+		'database_charset' => 'UTF8',
+		'remote_access' => 'y',
+		'remote_ips' => '',
+		'backup_interval' => 'none',
+		'backup_copies' => 1,
+		'active' => 'y'
+	);
+
 	$database_id = $client->sites_database_add($session_id, $client_id, $params);
 
 	echo "Database ID: ".$database_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_delete.php b/remoting_client/examples/sites_database_delete.php
index 9d225e2ad1b221a52cfb7196894efde779855201..0ce5e5158bb4ca39d779985d7478e97fbbcaa401 100644
--- a/remoting_client/examples/sites_database_delete.php
+++ b/remoting_client/examples/sites_database_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_database_delete($session_id, $database_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_get.php b/remoting_client/examples/sites_database_get.php
index fb26d04d5ad214d2128fcb704536d1b37d0b7d53..711665701ce50645df4b58c570ea8a96bdc9b935 100644
--- a/remoting_client/examples/sites_database_get.php
+++ b/remoting_client/examples/sites_database_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$database_id = 1;
-	
+
 	$database_record = $client->sites_database_get($session_id, $database_id);
 
 	print_r($database_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_get_all_by_user.php b/remoting_client/examples/sites_database_get_all_by_user.php
index 0aea522aa879d4673577414dfe91390776269da4..95baf92ee8de275a428ecf3d41033bfd9aedaa90 100644
--- a/remoting_client/examples/sites_database_get_all_by_user.php
+++ b/remoting_client/examples/sites_database_get_all_by_user.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
-	
+
 	$record_record = $client->sites_database_get_all_by_user($session_id, $client_id);
 
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_update.php b/remoting_client/examples/sites_database_update.php
index c4c8a8023bf20790df48dc0dbcf6821575d27ae9..9945c791f48d9decf755bd71b839e6e6585533f1 100644
--- a/remoting_client/examples/sites_database_update.php
+++ b/remoting_client/examples/sites_database_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$database_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_database_update($session_id, $client_id, $database_id, $database_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_add.php b/remoting_client/examples/sites_database_user_add.php
index 8dd2e7972907717090109ac0719b3376f6b19370..108163340989e2096f2b1574b3d21b9199f98573 100644
--- a/remoting_client/examples/sites_database_user_add.php
+++ b/remoting_client/examples/sites_database_user_add.php
@@ -1,36 +1,36 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'database_user' => 'db_name2',
-			'database_password' => 'db_name2'
-			);
-	
+		'server_id' => 1,
+		'database_user' => 'db_name2',
+		'database_password' => 'db_name2'
+	);
+
 	$database_id = $client->sites_database_user_add($session_id, $client_id, $params);
 
 	echo "Database ID: ".$database_user_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_delete.php b/remoting_client/examples/sites_database_user_delete.php
index 6c8293218b70f4e3fbcf739e0ef0bddaa26b1234..ec25822cb63484fe6884a8fcec1ea58d44c3dadf 100644
--- a/remoting_client/examples/sites_database_user_delete.php
+++ b/remoting_client/examples/sites_database_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_database_user_delete($session_id, $database_user_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_get.php b/remoting_client/examples/sites_database_user_get.php
index 759ed9f8fcc2b7a956a37aff105d9c4ceb96e930..db00f1325cb8542f4d84af8f495f87ef49bc540a 100644
--- a/remoting_client/examples/sites_database_user_get.php
+++ b/remoting_client/examples/sites_database_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$database_user_id = 1;
-	
+
 	$database_record = $client->sites_database_user_get($session_id, $database_user_id);
 
 	print_r($database_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_database_user_update.php b/remoting_client/examples/sites_database_user_update.php
index 527920dad6af4f344b119dac316b9e2808898aea..9ce5f7bcfb844fd72f163d55d0bd17af37ef5d3d 100644
--- a/remoting_client/examples/sites_database_user_update.php
+++ b/remoting_client/examples/sites_database_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change password of the database user
 	$database_user_record['database_password'] = 'abcde';
-	
+
 	$affected_rows = $client->sites_database_user_update($session_id, $client_id, $database_user_id, $database_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_add.php b/remoting_client/examples/sites_ftp_user_add.php
index bea10872f9fc41e2bf53abe9817a8d28c57ab7cd..b8d499b2ff5c5eb99fc8ee5739847e1a1cdbc889 100644
--- a/remoting_client/examples/sites_ftp_user_add.php
+++ b/remoting_client/examples/sites_ftp_user_add.php
@@ -1,49 +1,49 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
-	
+
 	$params = array(
-			'server_id' => 1,
-			'parent_domain_id' => 1,
-			'username' => 'threep',
-			'password' => 'wood',
-			'quota_size' => 10000,
-			'active' => 'y',
-			'uid' => '5000',
-			'gid' => '5000',
-			'dir' => 'maybe',
-			'quota_files' => -1,
-			'ul_ratio' => -1,
-			'dl_ratio' => -1,
-			'ul_bandwidth' => -1,
-			'dl_bandwidth' => -1
-			);
-	
+		'server_id' => 1,
+		'parent_domain_id' => 1,
+		'username' => 'threep',
+		'password' => 'wood',
+		'quota_size' => 10000,
+		'active' => 'y',
+		'uid' => '5000',
+		'gid' => '5000',
+		'dir' => 'maybe',
+		'quota_files' => -1,
+		'ul_ratio' => -1,
+		'dl_ratio' => -1,
+		'ul_bandwidth' => -1,
+		'dl_bandwidth' => -1
+	);
+
 	$affected_rows = $client->sites_ftp_user_add($session_id, $client_id, $params);
-	
+
 	echo "FTP User ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_delete.php b/remoting_client/examples/sites_ftp_user_delete.php
index 13c744934832c36d1ae2c984c65d211d1be44516..5363462f33881b1300b3794051bf33e18d5dd797 100644
--- a/remoting_client/examples/sites_ftp_user_delete.php
+++ b/remoting_client/examples/sites_ftp_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -21,12 +21,12 @@ try {
 	$affected_rows = $client->sites_ftp_user_delete($session_id, $ftp_user_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_get.php b/remoting_client/examples/sites_ftp_user_get.php
index 018c06b6ee06dd5b111e7d5bb7f240b7b728fa85..6b3159051aad05b91569b442e0185d56253dac6c 100644
--- a/remoting_client/examples/sites_ftp_user_get.php
+++ b/remoting_client/examples/sites_ftp_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$ftp_user_id = 1;
-	
+
 	$ftp_user_record = $client->sites_ftp_user_get($session_id, $ftp_user_id);
 
 	print_r($ftp_user_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_ftp_user_update.php b/remoting_client/examples/sites_ftp_user_update.php
index b0a22be7b50e54e8f5ca0df2fe25387b9022604a..d09b4167019771cec631c52deb377f3b3b52f429 100644
--- a/remoting_client/examples/sites_ftp_user_update.php
+++ b/remoting_client/examples/sites_ftp_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to no
 	$ftp_user_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_ftp_user_update($session_id, $client_id, $ftp_user_id, $ftp_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_add.php b/remoting_client/examples/sites_shell_user_add.php
index 1a75727d25014a2a4ef7500ebd5cd3020cdaee9f..84d4012f0efcaad7a54126eb7dc4553ca71e1a46 100644
--- a/remoting_client/examples/sites_shell_user_add.php
+++ b/remoting_client/examples/sites_shell_user_add.php
@@ -1,46 +1,46 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 3;
-	
+
 	$params = array(
-			'server_id' => 1,
-			'parent_domain_id' => 1,
-			'username' => 'threep2',
-			'password' => 'wood',
-			'quota_size' => 10000,
-			'active' => 'y',
-			'puser' => 'null',
-			'pgroup' => 'null',
-			'shell' => '/bin/bash',
-			'dir' => 'maybe',
-			'chroot' => ''
-			);
-	
+		'server_id' => 1,
+		'parent_domain_id' => 1,
+		'username' => 'threep2',
+		'password' => 'wood',
+		'quota_size' => 10000,
+		'active' => 'y',
+		'puser' => 'null',
+		'pgroup' => 'null',
+		'shell' => '/bin/bash',
+		'dir' => 'maybe',
+		'chroot' => ''
+	);
+
 	$affected_rows = $client->sites_shell_user_add($session_id, $client_id, $params);
-	
+
 	echo "Shell User ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_delete.php b/remoting_client/examples/sites_shell_user_delete.php
index b15e3dc026c5dd918b89b09c331293a0a5a3f0a1..fbc86ae8d00b2282339923e9ee95d4b61c9619f9 100644
--- a/remoting_client/examples/sites_shell_user_delete.php
+++ b/remoting_client/examples/sites_shell_user_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_shell_user_delete($session_id, $shell_user_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_get.php b/remoting_client/examples/sites_shell_user_get.php
index ba10cc717fdc3bcd6dbd6827d2a7ccd7749d0421..5e59c1adb0120a0b76aa7f5f10a70d37c875283a 100644
--- a/remoting_client/examples/sites_shell_user_get.php
+++ b/remoting_client/examples/sites_shell_user_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$shell_user_id = 1;
-	
+
 	$shell_user_record = $client->sites_shell_user_get($session_id, $shell_user_id);
 
 	print_r($shell_user_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_shell_user_update.php b/remoting_client/examples/sites_shell_user_update.php
index a8976cca893bbb9789934ebb1b8a1030a0465b0d..73b90138f6fdc932a08e704a7de37fa9096de228 100644
--- a/remoting_client/examples/sites_shell_user_update.php
+++ b/remoting_client/examples/sites_shell_user_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change active to no
 	$shell_user_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_shell_user_update($session_id, $client_id, $shell_user_id, $shell_user_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_add.php b/remoting_client/examples/sites_web_aliasdomain_add.php
index 8ff90df1a87ff53ff5fadfdcaf5f92b543209bee..c459e47b87a8a875d63d0eef831ed89f4c093b37 100644
--- a/remoting_client/examples/sites_web_aliasdomain_add.php
+++ b/remoting_client/examples/sites_web_aliasdomain_add.php
@@ -1,75 +1,75 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '',
-			'domain' => 'tssssst.int',
-			'type' => 'alias',
-			'parent_domain_id' => 1,
-			'vhost_type' => '',
-			'document_root' => '/web/dom',
-			'system_user' => 'benutzer',
-			'system_group' => 'gruppe',
-			'hd_quota' => 100000,
-			'traffic_quota' => -1,
-			'cgi' => 'y',
-			'ssi' => 'y',
-			'suexec' => 'y',
-			'errordocs' => 1,
-			'is_subdomainwww' => 1,
-			'subdomain' => '',
-			'php' => 'y',
-			'ruby' => 'n',
-			'redirect_type' => '',
-			'redirect_path' => '',
-			'ssl' => 'n',
-			'ssl_state' => '',
-			'ssl_locality' => '',
-			'ssl_organisation' => '',
-			'ssl_organisation_unit' => '',
-			'ssl_country' => '',
-			'ssl_domain' => '',
-			'ssl_request' => '',
-			'ssl_cert' => '',
-			'ssl_bundle' => '',
-			'ssl_action' => '',
-			'stats_password' => '',
-			'stats_type' => 'webalizer',
-			'allow_override' => 'All',
-			'apache_directives' => '',
-			'php_open_basedir' => '/php',
-			'custom_php_ini' => '',
-			'backup_interval' => '',
-			'backup_copies' => 1,
-			'active' => 'y',
-			'traffic_quota_lock' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '',
+		'domain' => 'tssssst.int',
+		'type' => 'alias',
+		'parent_domain_id' => 1,
+		'vhost_type' => '',
+		'document_root' => '/web/dom',
+		'system_user' => 'benutzer',
+		'system_group' => 'gruppe',
+		'hd_quota' => 100000,
+		'traffic_quota' => -1,
+		'cgi' => 'y',
+		'ssi' => 'y',
+		'suexec' => 'y',
+		'errordocs' => 1,
+		'is_subdomainwww' => 1,
+		'subdomain' => '',
+		'php' => 'y',
+		'ruby' => 'n',
+		'redirect_type' => '',
+		'redirect_path' => '',
+		'ssl' => 'n',
+		'ssl_state' => '',
+		'ssl_locality' => '',
+		'ssl_organisation' => '',
+		'ssl_organisation_unit' => '',
+		'ssl_country' => '',
+		'ssl_domain' => '',
+		'ssl_request' => '',
+		'ssl_cert' => '',
+		'ssl_bundle' => '',
+		'ssl_action' => '',
+		'stats_password' => '',
+		'stats_type' => 'webalizer',
+		'allow_override' => 'All',
+		'apache_directives' => '',
+		'php_open_basedir' => '/php',
+		'custom_php_ini' => '',
+		'backup_interval' => '',
+		'backup_copies' => 1,
+		'active' => 'y',
+		'traffic_quota_lock' => 'n'
+	);
+
 	$aliasdomain_id = $client->sites_web_aliasdomain_add($session_id, $client_id, $params);
 
 	echo "Aliasdomain ID: ".$aliasdomain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_delete.php b/remoting_client/examples/sites_web_aliasdomain_delete.php
index d60acffebb398051015ec730300483717729c6ba..75c00624e142230c837b8356fcbac5027eb539ee 100644
--- a/remoting_client/examples/sites_web_aliasdomain_delete.php
+++ b/remoting_client/examples/sites_web_aliasdomain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_web_aliasdomain_delete($session_id, $aliasdomain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_get.php b/remoting_client/examples/sites_web_aliasdomain_get.php
index 9278619695e0bc6d2ac6ed0dc7caa8a14a39ede8..e2270b9462fa0f6d675a64cb1ef83439c1494694 100644
--- a/remoting_client/examples/sites_web_aliasdomain_get.php
+++ b/remoting_client/examples/sites_web_aliasdomain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$aliasdomain_id = 8;
-	
+
 	$aliasdomain_record = $client->sites_web_aliasdomain_get($session_id, $aliasdomain_id);
 
 	print_r($aliasdomain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_aliasdomain_update.php b/remoting_client/examples/sites_web_aliasdomain_update.php
index cf114dc193505c35923913a9dc7e9799598357a5..bfd30a46c361ab18ebb3d6cf219706bdf909069f 100644
--- a/remoting_client/examples/sites_web_aliasdomain_update.php
+++ b/remoting_client/examples/sites_web_aliasdomain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$aliasdomain_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_web_aliasdomain_update($session_id, $client_id, $aliasdomain_id, $aliasdomain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_add.php b/remoting_client/examples/sites_web_domain_add.php
index 9481cd3ab6e41f35cd60bd7e36bb2b2429da63e8..fa08aa60efa76583cecb7ad55a722967e8ad7609 100644
--- a/remoting_client/examples/sites_web_domain_add.php
+++ b/remoting_client/examples/sites_web_domain_add.php
@@ -1,74 +1,74 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
-	
+
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '*',
-			'domain' => 'test2.int',
-			'type' => 'vhost',
-			'parent_domain_id' => 0,
-			'vhost_type' => 'name',
-			'hd_quota' => 100000,
-			'traffic_quota' => -1,
-			'cgi' => 'y',
-			'ssi' => 'y',
-			'suexec' => 'y',
-			'errordocs' => 1,
-			'is_subdomainwww' => 1,
-			'subdomain' => '',
-			'php' => 'y',
-			'ruby' => 'n',
-			'redirect_type' => '',
-			'redirect_path' => '',
-			'ssl' => 'n',
-			'ssl_state' => '',
-			'ssl_locality' => '',
-			'ssl_organisation' => '',
-			'ssl_organisation_unit' => '',
-			'ssl_country' => '',
-			'ssl_domain' => '',
-			'ssl_request' => '',
-			'ssl_cert' => '',
-			'ssl_bundle' => '',
-			'ssl_action' => '',
-			'stats_password' => '',
-			'stats_type' => 'webalizer',
-			'allow_override' => 'All',
-			'apache_directives' => '',
-			'php_open_basedir' => '/',
-			'custom_php_ini' => '',
-			'backup_interval' => '',
-			'backup_copies' => 1,
-			'active' => 'y',
-			'traffic_quota_lock' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '*',
+		'domain' => 'test2.int',
+		'type' => 'vhost',
+		'parent_domain_id' => 0,
+		'vhost_type' => 'name',
+		'hd_quota' => 100000,
+		'traffic_quota' => -1,
+		'cgi' => 'y',
+		'ssi' => 'y',
+		'suexec' => 'y',
+		'errordocs' => 1,
+		'is_subdomainwww' => 1,
+		'subdomain' => '',
+		'php' => 'y',
+		'ruby' => 'n',
+		'redirect_type' => '',
+		'redirect_path' => '',
+		'ssl' => 'n',
+		'ssl_state' => '',
+		'ssl_locality' => '',
+		'ssl_organisation' => '',
+		'ssl_organisation_unit' => '',
+		'ssl_country' => '',
+		'ssl_domain' => '',
+		'ssl_request' => '',
+		'ssl_cert' => '',
+		'ssl_bundle' => '',
+		'ssl_action' => '',
+		'stats_password' => '',
+		'stats_type' => 'webalizer',
+		'allow_override' => 'All',
+		'apache_directives' => '',
+		'php_open_basedir' => '/',
+		'custom_php_ini' => '',
+		'backup_interval' => '',
+		'backup_copies' => 1,
+		'active' => 'y',
+		'traffic_quota_lock' => 'n'
+	);
+
 	$affected_rows = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false);
-	
+
 	echo "Web Domain ID: ".$affected_rows."<br>";
 
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_delete.php b/remoting_client/examples/sites_web_domain_delete.php
index 92fa127f9f3c59d9de4f42ca689ec75e08721de1..0f7ac2368d1e1b10ddebbaad0f0cd5e044b65b27 100644
--- a/remoting_client/examples/sites_web_domain_delete.php
+++ b/remoting_client/examples/sites_web_domain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_web_domain_delete($session_id, $domain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_get.php b/remoting_client/examples/sites_web_domain_get.php
index dfef84a69b3bd1f0696764be8de4de4f2c2d9a6d..7f5b22f6ac4fe53a5815a504444c5b6167e4159f 100644
--- a/remoting_client/examples/sites_web_domain_get.php
+++ b/remoting_client/examples/sites_web_domain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$domain_id = 2;
-	
+
 	$domain_record = $client->sites_web_domain_get($session_id, $domain_id);
 
 	print_r($domain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_set_status.php b/remoting_client/examples/sites_web_domain_set_status.php
index 82dddfe0578d856c8c11a4d3f7314beeea9af238..809e1151b40dad35aa45c354b58fa27de6915946 100644
--- a/remoting_client/examples/sites_web_domain_set_status.php
+++ b/remoting_client/examples/sites_web_domain_set_status.php
@@ -1,33 +1,33 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$status = 'active';
 	$primary_id = 1;
-	
+
 	$record_record = $client->sites_web_domain_set_status($session_id, $primary_id, $status);
 
 	print_r($record_record);
 	echo "<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_domain_update.php b/remoting_client/examples/sites_web_domain_update.php
index c26d8a1f09de391cd002d0d8aa05a1f3291f856b..c951764220b1bd337a645eb1da8476221ccdc544 100644
--- a/remoting_client/examples/sites_web_domain_update.php
+++ b/remoting_client/examples/sites_web_domain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -27,16 +27,16 @@ try {
 	$domain_record['document_root'] = '/web/doc';
 	$domain_record['allow_override'] = 'All';
 	$domain_record['php_open_basedir'] = '/php';
-	
+
 	$affected_rows = $client->sites_web_domain_update($session_id, $client_id, $domain_id, $domain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_add.php b/remoting_client/examples/sites_web_subdomain_add.php
index 344db184f869abe5e0937a975f97f988f68c9798..ac319388f0958dad44a14d24a7b3c35ebf83d125 100644
--- a/remoting_client/examples/sites_web_subdomain_add.php
+++ b/remoting_client/examples/sites_web_subdomain_add.php
@@ -1,75 +1,75 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$client_id = 1;
 	$params = array(
-			'server_id' => 1,
-			'ip_address' => '',
-			'domain' => 'tsssssubt.int',
-			'type' => 'subdomain',
-			'parent_domain_id' => 1,
-			'vhost_type' => '',
-			'document_root' => '/web/dom',
-			'system_user' => 'benutzer',
-			'system_group' => 'gruppe',
-			'hd_quota' => 100000,
-			'traffic_quota' => -1,
-			'cgi' => 'y',
-			'ssi' => 'y',
-			'suexec' => 'y',
-			'errordocs' => 1,
-			'is_subdomainwww' => 1,
-			'subdomain' => '',
-			'php' => 'y',
-			'ruby' => 'n',
-			'redirect_type' => '',
-			'redirect_path' => '',
-			'ssl' => 'n',
-			'ssl_state' => '',
-			'ssl_locality' => '',
-			'ssl_organisation' => '',
-			'ssl_organisation_unit' => '',
-			'ssl_country' => '',
-			'ssl_domain' => '',
-			'ssl_request' => '',
-			'ssl_cert' => '',
-			'ssl_bundle' => '',
-			'ssl_action' => '',
-			'stats_password' => '',
-			'stats_type' => 'webalizer',
-			'allow_override' => 'All',
-			'apache_directives' => '',
-			'php_open_basedir' => '/php',
-			'custom_php_ini' => '',
-			'backup_interval' => '',
-			'backup_copies' => 1,
-			'active' => 'y',
-			'traffic_quota_lock' => 'n'
-			);
-	
+		'server_id' => 1,
+		'ip_address' => '',
+		'domain' => 'tsssssubt.int',
+		'type' => 'subdomain',
+		'parent_domain_id' => 1,
+		'vhost_type' => '',
+		'document_root' => '/web/dom',
+		'system_user' => 'benutzer',
+		'system_group' => 'gruppe',
+		'hd_quota' => 100000,
+		'traffic_quota' => -1,
+		'cgi' => 'y',
+		'ssi' => 'y',
+		'suexec' => 'y',
+		'errordocs' => 1,
+		'is_subdomainwww' => 1,
+		'subdomain' => '',
+		'php' => 'y',
+		'ruby' => 'n',
+		'redirect_type' => '',
+		'redirect_path' => '',
+		'ssl' => 'n',
+		'ssl_state' => '',
+		'ssl_locality' => '',
+		'ssl_organisation' => '',
+		'ssl_organisation_unit' => '',
+		'ssl_country' => '',
+		'ssl_domain' => '',
+		'ssl_request' => '',
+		'ssl_cert' => '',
+		'ssl_bundle' => '',
+		'ssl_action' => '',
+		'stats_password' => '',
+		'stats_type' => 'webalizer',
+		'allow_override' => 'All',
+		'apache_directives' => '',
+		'php_open_basedir' => '/php',
+		'custom_php_ini' => '',
+		'backup_interval' => '',
+		'backup_copies' => 1,
+		'active' => 'y',
+		'traffic_quota_lock' => 'n'
+	);
+
 	$subdomain_id = $client->sites_web_subdomain_add($session_id, $client_id, $params);
 
 	echo "Subdomain ID: ".$subdomain_id."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_delete.php b/remoting_client/examples/sites_web_subdomain_delete.php
index be167cc5f46e49395ee24579c6f60be7d52a4788..6a0628693a2fc6e3c4e933d9cf8bea4c31086295 100644
--- a/remoting_client/examples/sites_web_subdomain_delete.php
+++ b/remoting_client/examples/sites_web_subdomain_delete.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -22,12 +22,12 @@ try {
 	$affected_rows = $client->sites_web_subdomain_delete($session_id, $subdomain_id);
 
 	echo "Number of records that have been deleted: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_get.php b/remoting_client/examples/sites_web_subdomain_get.php
index a86ae8de5c045c3641150a2da5afd25c8c1f161d..12120fc9d1f422e8949189b750101b7b57728e4e 100644
--- a/remoting_client/examples/sites_web_subdomain_get.php
+++ b/remoting_client/examples/sites_web_subdomain_get.php
@@ -1,31 +1,31 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
-	
+
 	//* Set the function parameters.
 	$subdomain_id = 10;
-	
+
 	$subdomain_record = $client->sites_web_subdomain_get($session_id, $subdomain_id);
 
 	print_r($subdomain_record);
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/sites_web_subdomain_update.php b/remoting_client/examples/sites_web_subdomain_update.php
index ee5ed3501d8dbd00ec75e5fc180be4217ebb12a8..2a9f91afa4b48e6f54b5c6cbc455e27bfac9f0bf 100644
--- a/remoting_client/examples/sites_web_subdomain_update.php
+++ b/remoting_client/examples/sites_web_subdomain_update.php
@@ -1,16 +1,16 @@
 <?php
 
-require('soap_config.php');
+require 'soap_config.php';
 
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri,
-									 'trace' => 1,
-									 'exceptions' => 1));
+		'uri'      => $soap_uri,
+		'trace' => 1,
+		'exceptions' => 1));
 
 
 try {
-	if($session_id = $client->login($username,$password)) {
+	if($session_id = $client->login($username, $password)) {
 		echo 'Logged successfull. Session ID:'.$session_id.'<br />';
 	}
 
@@ -24,16 +24,16 @@ try {
 
 	//* Change the status to inactive
 	$subdomain_record['active'] = 'n';
-	
+
 	$affected_rows = $client->sites_web_subdomain_update($session_id, $client_id, $subdomain_id, $subdomain_record);
 
 	echo "Number of records that have been changed in the database: ".$affected_rows."<br>";
-	
+
 	if($client->logout($session_id)) {
 		echo 'Logged out.<br />';
 	}
-	
-	
+
+
 } catch (SoapFault $e) {
 	echo $client->__getLastResponse();
 	die('SOAP Error: '.$e->getMessage());
diff --git a/remoting_client/examples/soap-database-add.php b/remoting_client/examples/soap-database-add.php
index 3f636f17ac38338746028bcb609b21e9a4c8386f..5ff7e4b79df4af0c913c40a8956b930694edd1b5 100644
--- a/remoting_client/examples/soap-database-add.php
+++ b/remoting_client/examples/soap-database-add.php
@@ -7,42 +7,41 @@ $soap_location = 'http://localhost:8080/remote/index.php';
 $soap_uri = 'http://localhost:8080/remote/';
 
 $client = new SoapClient(null, array('location' => $soap_location,
-                                     'uri'      => $soap_uri));
+		'uri'      => $soap_uri));
 try {
-    if($session_id = $client->login($username,$password)) {
-                    echo "Logged:".$session_id."<br />\n";
-}
-
-$database_type = 'mysql'; //Only mysql type avaliable more types coming soon.
-$database_name = 'yourdbname';
-$database_username = 'yourusername';
-$database_password = 'yourpassword';
-$database_charset = ''; // blank = db default, latin1 or utf8
-$database_remoteips = ''; //remote ip´s separated by commas
-
-$params = array(
-          'server_id' => 1,
-                'type' => $database_type,
-                'database_name' => $database_name,
-                'database_user' => $database_username,
-                'database_password' => $database_password,
-                'database_charset' =>  $database_charset,
-                'remote_access' => 'n', // n disabled - y enabled
-                'active' => 'y', // n disabled - y enabled
-                'remote_ips' => $database_remoteips
-                );
-
-$client_id = 1;
-$database_id = $client->sites_database_add($session_id, $client_id, $params);
-
-if($client->logout($session_id)) {
-    echo "Logout.<br />\n";
-}
+	if($session_id = $client->login($username, $password)) {
+		echo "Logged:".$session_id."<br />\n";
+	}
+
+	$database_type = 'mysql'; //Only mysql type avaliable more types coming soon.
+	$database_name = 'yourdbname';
+	$database_username = 'yourusername';
+	$database_password = 'yourpassword';
+	$database_charset = ''; // blank = db default, latin1 or utf8
+	$database_remoteips = ''; //remote ip´s separated by commas
+
+	$params = array(
+		'server_id' => 1,
+		'type' => $database_type,
+		'database_name' => $database_name,
+		'database_user' => $database_username,
+		'database_password' => $database_password,
+		'database_charset' =>  $database_charset,
+		'remote_access' => 'n', // n disabled - y enabled
+		'active' => 'y', // n disabled - y enabled
+		'remote_ips' => $database_remoteips
+	);
+
+	$client_id = 1;
+	$database_id = $client->sites_database_add($session_id, $client_id, $params);
+
+	if($client->logout($session_id)) {
+		echo "Logout.<br />\n";
+	}
 
 
 } catch (SoapFault $e) {
-        die('Error: '.$e->getMessage());
+	die('Error: '.$e->getMessage());
 }
 
 ?>
-
diff --git a/server/cron.php b/server/cron.php
index ce7a26fad6ba15da6ef74099eebf7ce11d223c44..7a43d04905846e372e40cab9b3f15bfc823dc12d 100644
--- a/server/cron.php
+++ b/server/cron.php
@@ -29,8 +29,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
-require(SCRIPT_PATH."/lib/config.inc.php");
-require(SCRIPT_PATH."/lib/app.inc.php");
+require SCRIPT_PATH."/lib/config.inc.php";
+require SCRIPT_PATH."/lib/app.inc.php";
 
 set_time_limit(0);
 ini_set('error_reporting', E_ALL & ~E_NOTICE);
@@ -50,38 +50,38 @@ if(!is_dir($path)) die('Cron path missing!');
 $files = array();
 $d = opendir($path);
 while($f = readdir($d)) {
-    $file_path = $path . '/' . $f;
-    if($f === '.' || $f === '..' || !is_file($file_path)) continue;
-    if(substr($f, strrpos($f, '.')) !== '.php') continue;
-    $files[] = $f;
+	$file_path = $path . '/' . $f;
+	if($f === '.' || $f === '..' || !is_file($file_path)) continue;
+	if(substr($f, strrpos($f, '.')) !== '.php') continue;
+	$files[] = $f;
 }
 closedir($d);
 
 // sort in alphabetical order, so we can use prefixes like 000-xxx
 sort($files);
-    
+
 foreach($files as $f) {
-    $name = substr($f, 0, strpos($f, '.'));
-    if(preg_match('/^\d+\-(.*)$/', $name, $match)) $name = $match[1]; // strip numerical prefix from file name
-    
-    include($path . '/' . $f);
-    $class_name = 'cronjob_' . $name;
-    
-    if(class_exists($class_name, false)) {
-        $cronjob = new $class_name();
-        if(get_parent_class($cronjob) !== 'cronjob') {
-            print 'Invalid class ' . $class_name . ' not extending class cronjob (' . get_parent_class($cronjob) . ')!' . "\n";
-            unset($cronjob);
-            continue;
-        }
-        print 'Included ' . $class_name . ' from ' . $file_path . ' -> will now run job.' . "\n";
-        
-        $cronjob->run();
-        
-        print 'run job (' . $class_name . ') done.' . "\n";
-        
-        unset($cronjob);
-    }
+	$name = substr($f, 0, strpos($f, '.'));
+	if(preg_match('/^\d+\-(.*)$/', $name, $match)) $name = $match[1]; // strip numerical prefix from file name
+
+	include $path . '/' . $f;
+	$class_name = 'cronjob_' . $name;
+
+	if(class_exists($class_name, false)) {
+		$cronjob = new $class_name();
+		if(get_parent_class($cronjob) !== 'cronjob') {
+			print 'Invalid class ' . $class_name . ' not extending class cronjob (' . get_parent_class($cronjob) . ')!' . "\n";
+			unset($cronjob);
+			continue;
+		}
+		print 'Included ' . $class_name . ' from ' . $file_path . ' -> will now run job.' . "\n";
+
+		$cronjob->run();
+
+		print 'run job (' . $class_name . ') done.' . "\n";
+
+		unset($cronjob);
+	}
 }
 unset($files);
 
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 19fe2ad5b3b143c482347cc68dd3590fba46c19f..a8702a854f3f74685c45ff3128b619c040c9bcc9 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -1,5 +1,5 @@
 <?php
 
-# the cron daily file is no longer used and was replaced by cron.php
+// the cron daily file is no longer used and was replaced by cron.php
 
 ?>
diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php
index 321e5c6ffb4a647e8349e951a7292847109c364e..a1e75af16a33cf272f1f42d449bfc2b7bde23e7d 100755
--- a/server/lib/app.inc.php
+++ b/server/lib/app.inc.php
@@ -32,155 +32,155 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 if(isset($conf['timezone']) && $conf['timezone'] != '') date_default_timezone_set($conf['timezone']);
 
 class app {
-		
+
 	var $loaded_modules = array();
 	var $loaded_plugins = array();
-        
+
 	function __construct() {
 
-                global $conf;
+		global $conf;
+
+		if($conf['start_db'] == true) {
+			$this->load('db_'.$conf['db_type']);
+			$this->db = new db;
 
-                if($conf['start_db'] == true) {
-                	$this->load('db_'.$conf['db_type']);
-                	$this->db = new db;
-					
-					/*
-					Initialize the connection to the master DB, 
+			/*
+					Initialize the connection to the master DB,
 					if we are in a multiserver setup
 					*/
-					
-					if($conf['dbmaster_host'] != '' && ($conf['dbmaster_host'] != $conf['db_host'] || ($conf['dbmaster_host'] == $conf['db_host'] && $conf['dbmaster_database'] != $conf['db_database']))) {
-						$this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database']);
-					} else {
-						$this->dbmaster = $this->db;
-					}
-					
-					
-                }
 
-        }
+			if($conf['dbmaster_host'] != '' && ($conf['dbmaster_host'] != $conf['db_host'] || ($conf['dbmaster_host'] == $conf['db_host'] && $conf['dbmaster_database'] != $conf['db_database']))) {
+				$this->dbmaster = new db($conf['dbmaster_host'], $conf['dbmaster_user'], $conf['dbmaster_password'], $conf['dbmaster_database']);
+			} else {
+				$this->dbmaster = $this->db;
+			}
 
-        function uses($classes) {
+
+		}
+
+	}
+
+	function uses($classes) {
 
 		global $conf;
 
-		$cl = explode(',',$classes);
+		$cl = explode(',', $classes);
 		if(is_array($cl)) {
 			foreach($cl as $classname) {
 				if(!@is_object($this->$classname)) {
 					if(is_file($conf['classpath'].'/'.$classname.'.inc.php') && (DEVSYSTEM ||  !is_link($conf['classpath'].'/'.$classname.'.inc.php'))) {
-						include_once($conf['classpath'].'/'.$classname.'.inc.php');
+						include_once $conf['classpath'].'/'.$classname.'.inc.php';
 						$this->$classname = new $classname;
 					}
 				}
 			}
 		}
-        }
+	}
 
-        function load($classes) {
+	function load($classes) {
 
 		global $conf;
 
-		$cl = explode(',',$classes);
+		$cl = explode(',', $classes);
 		if(is_array($cl)) {
 			foreach($cl as $classname) {
 				if(is_file($conf['classpath'].'/'.$classname.'.inc.php') && (DEVSYSTEM || !is_link($conf['classpath'].'/'.$classname.'.inc.php'))) {
-					include_once($conf['classpath'].'/'.$classname.'.inc.php');
+					include_once $conf['classpath'].'/'.$classname.'.inc.php';
 				} else {
 					die('Unable to load: '.$conf['classpath'].'/'.$classname.'.inc.php');
 				}
 			}
 		}
-        }
+	}
 
-        /*
+	/*
          0 = DEBUG
          1 = WARNING
          2 = ERROR
         */
 
-        function log($msg, $priority = 0) {
-				
+	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;
+		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.');
-                            }
-							
-                            if (!fwrite($fp, $log_msg."\r\n")) {
-                                die('Unable to write to logfile.');
-                            }
-				
-				echo $log_msg."\n";
-				fclose($fp);
-
-					// Log to database
-					if(isset($this->dbmaster)) {
-						$server_id = $conf['server_id'];
-						$loglevel = $priority;
-						$tstamp = time();
-						$message = $this->dbmaster->quote($msg);
-						$datalog_id = (isset($this->modules->current_datalog_id) && $this->modules->current_datalog_id > 0)?$this->modules->current_datalog_id:0;
-						if($datalog_id > 0) {
-							$tmp_rec = $this->dbmaster->queryOneRecord("SELECT count(syslog_id) as number FROM sys_log WHERE datalog_id = $datalog_id AND loglevel = ".LOGLEVEL_ERROR);
-							//* Do not insert duplicate errors into the web log.
-							if($tmp_rec['number'] == 0) {
-								$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',$datalog_id,'$loglevel','$tstamp','$message')";
-								$this->dbmaster->query($sql);
-							}
-						} else {
-							$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',0,'$loglevel','$tstamp','$message')";
-							$this->dbmaster->query($sql);
-						}
-					}
+			//if (is_writable($conf["log_file"])) {
+			if (!$fp = fopen($conf['log_file'], 'a')) {
+				die('Unable to open logfile.');
+			}
+
+			if (!fwrite($fp, $log_msg."\r\n")) {
+				die('Unable to write to logfile.');
+			}
 
-                        //} else {
-                        //    die("Unable to write to logfile.");
-                        //}
-					
-    
-                } // if
-				
-				if(isset($conf['admin_notify_priority']) && $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);
+			echo $log_msg."\n";
+			fclose($fp);
+
+			// Log to database
+			if(isset($this->dbmaster)) {
+				$server_id = $conf['server_id'];
+				$loglevel = $priority;
+				$tstamp = time();
+				$message = $this->dbmaster->quote($msg);
+				$datalog_id = (isset($this->modules->current_datalog_id) && $this->modules->current_datalog_id > 0)?$this->modules->current_datalog_id:0;
+				if($datalog_id > 0) {
+					$tmp_rec = $this->dbmaster->queryOneRecord("SELECT count(syslog_id) as number FROM sys_log WHERE datalog_id = $datalog_id AND loglevel = ".LOGLEVEL_ERROR);
+					//* Do not insert duplicate errors into the web log.
+					if($tmp_rec['number'] == 0) {
+						$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',$datalog_id,'$loglevel','$tstamp','$message')";
+						$this->dbmaster->query($sql);
+					}
+				} else {
+					$sql = "INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ('$server_id',0,'$loglevel','$tstamp','$message')";
+					$this->dbmaster->query($sql);
 				}
-        } // func
-		
+			}
+
+			//} else {
+			//    die("Unable to write to logfile.");
+			//}
+
+
+		} // if
+
+		if(isset($conf['admin_notify_priority']) && $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
          1 = WARNING
          2 = ERROR
         */
 
-        function error($msg) {
-        	$this->log($msg,3);
+	function error($msg) {
+		$this->log($msg, 3);
 		die($msg);
-        }
+	}
 
 }
 
diff --git a/server/lib/classes/aps_base.inc.php b/server/lib/classes/aps_base.inc.php
index 4c1512ba2a018e45f9aee6ef758be1c65e767b70..c4aaf52fd8074046b3ba24929b4e02f71e48bf83 100644
--- a/server/lib/classes/aps_base.inc.php
+++ b/server/lib/classes/aps_base.inc.php
@@ -43,61 +43,69 @@ define('PACKAGE_ERROR_NOMETA', 4);
 
 class ApsBase
 {
-    protected $log_prefix = '';
-    protected $fetch_url = '';
-    protected $aps_version = '';
-    protected $packages_dir = '';
-    protected $temp_pkg_dir = '';
-    protected $interface_pkg_dir = '';
-    protected $interface_mode = false; // server mode by default
-
-    /**
-     * Constructor
-     *
-     * @param $app the application instance (db handle + log method)
-     * @param $interface_mode act in interface (true) or server mode (false)
-     * @param $log_prefix a prefix to set before all log entries
-     */
-    public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
-    {
-        $this->log_prefix = $log_prefix;
-        $this->interface_mode = $interface_mode;
-        $this->fetch_url = 'apscatalog.com';
-        $this->aps_version = '1';
-        $this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
-        $this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
-    }
-    
-    /**
-     * Converts a given value to it's native representation in 1024 units
-     * 
-     * @param $value the size to convert
-     * @return integer and string 
-     */
-    public function convertSize($value)
-    {
-        $unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
-        return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
-    }
-    
-    /**
-     * Determine a specific xpath from a given SimpleXMLElement handle. If the
-     * element is found, it's string representation is returned. If not,
-     * the return value will stay empty
-     *
-     * @param $xml_handle the SimpleXMLElement handle
-     * @param $query the XPath query
-     * @param $array define whether to return an array or a string
-     * @return $ret the return string
-     */
-    protected function getXPathValue($xml_handle, $query, $array = false)
-    {
-        $ret = '';
-        
-        $xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
-        if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
-        
-        return $ret;
-    }
+	protected $log_prefix = '';
+	protected $fetch_url = '';
+	protected $aps_version = '';
+	protected $packages_dir = '';
+	protected $temp_pkg_dir = '';
+	protected $interface_pkg_dir = '';
+	protected $interface_mode = false; // server mode by default
+
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 * @param $log_prefix a prefix to set before all log entries
+	 */
+
+
+	public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
+	{
+		$this->log_prefix = $log_prefix;
+		$this->interface_mode = $interface_mode;
+		$this->fetch_url = 'apscatalog.com';
+		$this->aps_version = '1';
+		$this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
+		$this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
+	}
+
+
+
+	/**
+	 * Converts a given value to it's native representation in 1024 units
+	 *
+	 * @param $value the size to convert
+	 * @return integer and string
+	 */
+	public function convertSize($value)
+	{
+		$unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
+		return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
+	}
+
+
+
+	/**
+	 * Determine a specific xpath from a given SimpleXMLElement handle. If the
+	 * element is found, it's string representation is returned. If not,
+	 * the return value will stay empty
+	 *
+	 * @param $xml_handle the SimpleXMLElement handle
+	 * @param $query the XPath query
+	 * @param $array define whether to return an array or a string
+	 * @return $ret the return string
+	 */
+	protected function getXPathValue($xml_handle, $query, $array = false)
+	{
+		$ret = '';
+
+		$xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
+		if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
+
+		return $ret;
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/aps_installer.inc.php b/server/lib/classes/aps_installer.inc.php
index baf6e47f94a381baa016a2ec58e87dc6dc32a410..2925c7a5418bc06b22e0f60cdaf697390313ba56 100644
--- a/server/lib/classes/aps_installer.inc.php
+++ b/server/lib/classes/aps_installer.inc.php
@@ -27,303 +27,317 @@ 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('aps_base.inc.php');
+require_once 'aps_base.inc.php';
 
 @set_time_limit(0);
 @ignore_user_abort(1);
 
 class ApsInstaller extends ApsBase
 {
-    private $handle_type = '';
-    private $domain = '';
-    private $document_root = '';
-    private $sublocation = '';
-    private $local_installpath = '';
-    private $dbhost = '';
-    private $newdb_name = '';
-    private $newdb_user = '';
-    private $file_owner_user = '';
-    private $file_owner_group = '';
+	private $handle_type = '';
+	private $domain = '';
+	private $document_root = '';
+	private $sublocation = '';
+	private $local_installpath = '';
+	private $dbhost = '';
+	private $newdb_name = '';
+	private $newdb_user = '';
+	private $file_owner_user = '';
+	private $file_owner_group = '';
 	private $putenv = array();
-    
-   /**
-    * Constructor
-    *
-    * @param $app the application instance (db handle + log method)
-    * @param $interface_mode act in interface (true) or server mode (false)
-    */
-    public function __construct($app, $interface_mode = false)
-    {
-        parent::__construct($app, 'APS installer: ', $interface_mode);
-    }
-    
-    /**
-     * Before the cron is executed, make sure all necessary options are set
-     * and all functions are available
-     */
-    private function checkRequirements()
-    {
-        global $app;
-        try
-        {
-            // Check if exec() is not disabled
-            $disabled_func = explode(',', @ini_get('disable_functions'));
-            if(in_array('exec', $disabled_func)) throw new Exception('the call of exec() is disabled');
-            
-            // Check if safe_mode is disabled (needed for correct putenv, chmod, chown handling)
-            if(@ini_get('safe_mode')) throw new Exception('the safe_mode restriction is on');
-            
-            return true;
-        }
-        catch(Exception $e)
-        {
-            $app->log('Aborting execution because '.$e->getMessage(), 1);
-            return false;
-        }
-    }
-    
-    /**
-     * Get a file from a ZIP archive and either return it's content or
-     * extract it to a given destination
-     * 
-     * @param $zipfile the ZIP file to work with
-     * @param $subfile the file from which to get the content
-     * @param $destfolder the optional extraction destination
-     * @param $destname the optional target file name when extracting
-     * @return string or boolean
-     */
-    private function getContentFromZIP($zipfile, $subfile, $destfolder = '', $destname = '')
-    {
-        try
-        {
-            $zip = new ZipArchive;
-            $res = $zip->open(realpath($zipfile));
-            if(!$res) throw new Exception('Cannot open ZIP file '.$zipfile);
-        
-            // If no destination is given, the content is returned, otherwise
-            // the $subfile is extracted to $destination
-            if($destfolder == '')
-            {
-                $fh = $zip->getStream($subfile);
-                if(!$fh) throw new Exception('Cannot read '.$subfile.' from '.$zipfile);
-                
-                $subfile_content = '';            
-                while(!feof($fh)) $subfile_content .= fread($fh, 8192);
-                
-                fclose($fh);
-                
-                return $subfile_content;
-            }
-            else
-            {
-                // extractTo would be suitable but has no target name parameter
-                //$ind = $zip->locateName($subfile);
-                //$ex = $zip->extractTo($destination, array($zip->getNameIndex($ind)));
-                if($destname == '') $destname = basename($subfile);
-                $ex = @copy('zip://'.$zipfile.'#'.$subfile, $destfolder.$destname);
-                if(!$ex) throw new Exception('Cannot extract '.$subfile.' to '.$destfolder);
-            }
-            
-            $zip->close();
-            
-        }
-        catch(Exception $e)
-        {
-            // The exception message is only interesting for debugging reasons
-            // echo $e->getMessage();
-            return false;
-        }
-    }    
-    
-    /**
-     * Extract the complete directory of a ZIP file
-     * 
-     * @param $filename the file to unzip
-     * @param $directory the ZIP inside directory to unzip
-     * @param $destination the place where to extract the data
-     * @return boolean
-     */
-    private function extractZip($filename, $directory, $destination)
-    {
-        if(!file_exists($filename)) return false;
-        
-        // Fix the paths
-        if(substr($directory, -1) == '/') $directory = substr($directory, 0, strlen($directory) - 1);
-        if(substr($destination, -1) != '/') $destination .= '/';
-        
-        // Read and extract the ZIP file
-        $ziphandle = zip_open(realpath($filename));
-        if(is_resource($ziphandle))
-        {
-            while($entry = zip_read($ziphandle))
-            {
-                if(substr(zip_entry_name($entry), 0, strlen($directory)) == $directory)
-                {
-                    // Modify the relative ZIP file path
-                    $new_path = substr(zip_entry_name($entry), strlen($directory));
-                    
-                    if(substr($new_path, -1) == '/') // Identifier for directories
-                    {
-                        if(!file_exists($destination.$new_path)) mkdir($destination.$new_path, 0777, true);
-                    }
-                    else // Handle files
-                    {
-                        if(zip_entry_open($ziphandle, $entry))
-                        {
-                            $new_dir = dirname($destination.$new_path);
-                            if(!file_exists($new_dir)) mkdir($new_dir, 0777, true);
-                            
-                            $file = fopen($destination.$new_path, 'wb');
-                            if($file)
-                            {
-                                while($line = zip_entry_read($entry)) fwrite($file, $line);
-                                fclose($file);
-                            }
-                            else return false;
-                        }
-                    }
-                }
-            }
-            
-            zip_close($ziphandle);
-            return true;
-        }
-        
-        return false;
-    }
-
-    /**
-     * Setup the path environment variables for the install script
-     * 
-     * @param $parent_mapping the SimpleXML instance with the current mapping position
-     * @param $url the relative path within the mapping tree
-     * @param $path the absolute path within the mapping tree
-     */
-    private function processMappings($parent_mapping, $url, $path)
-    {
-        if($parent_mapping && $parent_mapping != null)
-        {
-            $writable = parent::getXPathValue($parent_mapping, 'php:permissions/@writable');
-            $readable = parent::getXPathValue($parent_mapping, 'php:permissions/@readable');
-
-            // set the write permission            
-            if($writable == 'true')
-            {
-                if(is_dir($path)) chmod($path, 0775);
-                else chmod($path, 0664);
-            }
-            
-            // set non-readable permission
-            if($readable == 'false')
-            {
-                if(is_dir($path)) chmod($path, 0333);
-                else chmod($path, 0222);
-            }
-        }
-        
-        // Set the environment variables
-        $env = str_replace('/', '_', $url);
-        $this->putenv[] = 'WEB_'.$env.'_DIR='.$path;
-        
-        // Step recursively into further mappings
-        if($parent_mapping && $parent_mapping != null)
-        {
-            foreach($parent_mapping->mapping as $mapping)
-            {
-                if($url == '/') $this->processMappings($mapping, $url.$mapping['url'], $path.$mapping['url']);
-                else $this->processMappings($mapping, $url.'/'.$mapping['url'], $path.'/'.$mapping['url']);
-            }
-        }
-    }    
-    
-    /**
-     * Setup the environment with data for the install location
-     * 
-     * @param $task an array containing all install related data
-     */
-    private function prepareLocation($task)
-    {
-        global $app;
-        
-        // Get the domain name to use for the installation
-        // Would be possible in one query too, but we use 2 for easier debugging
-        $main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings  
+
+	/**
+	 * Constructor
+	 *
+	 * @param $app the application instance (db handle + log method)
+	 * @param $interface_mode act in interface (true) or server mode (false)
+	 */
+
+
+	public function __construct($app, $interface_mode = false)
+	{
+		parent::__construct($app, 'APS installer: ', $interface_mode);
+	}
+
+
+
+	/**
+	 * Before the cron is executed, make sure all necessary options are set
+	 * and all functions are available
+	 */
+	private function checkRequirements()
+	{
+		global $app;
+		try
+		{
+			// Check if exec() is not disabled
+			$disabled_func = explode(',', @ini_get('disable_functions'));
+			if(in_array('exec', $disabled_func)) throw new Exception('the call of exec() is disabled');
+
+			// Check if safe_mode is disabled (needed for correct putenv, chmod, chown handling)
+			if(@ini_get('safe_mode')) throw new Exception('the safe_mode restriction is on');
+
+			return true;
+		}
+
+		catch(Exception $e)
+		{
+			$app->log('Aborting execution because '.$e->getMessage(), 1);
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Get a file from a ZIP archive and either return it's content or
+	 * extract it to a given destination
+	 *
+	 * @param $zipfile the ZIP file to work with
+	 * @param $subfile the file from which to get the content
+	 * @param $destfolder the optional extraction destination
+	 * @param $destname the optional target file name when extracting
+	 * @return string or boolean
+	 */
+	private function getContentFromZIP($zipfile, $subfile, $destfolder = '', $destname = '')
+	{
+		try
+		{
+			$zip = new ZipArchive;
+			$res = $zip->open(realpath($zipfile));
+			if(!$res) throw new Exception('Cannot open ZIP file '.$zipfile);
+
+			// If no destination is given, the content is returned, otherwise
+			// the $subfile is extracted to $destination
+			if($destfolder == '')
+			{
+				$fh = $zip->getStream($subfile);
+				if(!$fh) throw new Exception('Cannot read '.$subfile.' from '.$zipfile);
+
+				$subfile_content = '';
+				while(!feof($fh)) $subfile_content .= fread($fh, 8192);
+
+				fclose($fh);
+
+				return $subfile_content;
+			}
+			else
+			{
+				// extractTo would be suitable but has no target name parameter
+				//$ind = $zip->locateName($subfile);
+				//$ex = $zip->extractTo($destination, array($zip->getNameIndex($ind)));
+				if($destname == '') $destname = basename($subfile);
+				$ex = @copy('zip://'.$zipfile.'#'.$subfile, $destfolder.$destname);
+				if(!$ex) throw new Exception('Cannot extract '.$subfile.' to '.$destfolder);
+			}
+
+			$zip->close();
+
+		}
+
+		catch(Exception $e)
+		{
+			// The exception message is only interesting for debugging reasons
+			// echo $e->getMessage();
+			return false;
+		}
+	}
+
+
+
+	/**
+	 * Extract the complete directory of a ZIP file
+	 *
+	 * @param $filename the file to unzip
+	 * @param $directory the ZIP inside directory to unzip
+	 * @param $destination the place where to extract the data
+	 * @return boolean
+	 */
+	private function extractZip($filename, $directory, $destination)
+	{
+		if(!file_exists($filename)) return false;
+
+		// Fix the paths
+		if(substr($directory, -1) == '/') $directory = substr($directory, 0, strlen($directory) - 1);
+		if(substr($destination, -1) != '/') $destination .= '/';
+
+		// Read and extract the ZIP file
+		$ziphandle = zip_open(realpath($filename));
+		if(is_resource($ziphandle))
+		{
+			while($entry = zip_read($ziphandle))
+			{
+				if(substr(zip_entry_name($entry), 0, strlen($directory)) == $directory)
+				{
+					// Modify the relative ZIP file path
+					$new_path = substr(zip_entry_name($entry), strlen($directory));
+
+					if(substr($new_path, -1) == '/') // Identifier for directories
+						{
+						if(!file_exists($destination.$new_path)) mkdir($destination.$new_path, 0777, true);
+					}
+					else // Handle files
+						{
+						if(zip_entry_open($ziphandle, $entry))
+						{
+							$new_dir = dirname($destination.$new_path);
+							if(!file_exists($new_dir)) mkdir($new_dir, 0777, true);
+
+							$file = fopen($destination.$new_path, 'wb');
+							if($file)
+							{
+								while($line = zip_entry_read($entry)) fwrite($file, $line);
+								fclose($file);
+							}
+							else return false;
+						}
+					}
+				}
+			}
+
+			zip_close($ziphandle);
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Setup the path environment variables for the install script
+	 *
+	 * @param $parent_mapping the SimpleXML instance with the current mapping position
+	 * @param $url the relative path within the mapping tree
+	 * @param $path the absolute path within the mapping tree
+	 */
+	private function processMappings($parent_mapping, $url, $path)
+	{
+		if($parent_mapping && $parent_mapping != null)
+		{
+			$writable = parent::getXPathValue($parent_mapping, 'php:permissions/@writable');
+			$readable = parent::getXPathValue($parent_mapping, 'php:permissions/@readable');
+
+			// set the write permission
+			if($writable == 'true')
+			{
+				if(is_dir($path)) chmod($path, 0775);
+				else chmod($path, 0664);
+			}
+
+			// set non-readable permission
+			if($readable == 'false')
+			{
+				if(is_dir($path)) chmod($path, 0333);
+				else chmod($path, 0222);
+			}
+		}
+
+		// Set the environment variables
+		$env = str_replace('/', '_', $url);
+		$this->putenv[] = 'WEB_'.$env.'_DIR='.$path;
+
+		// Step recursively into further mappings
+		if($parent_mapping && $parent_mapping != null)
+		{
+			foreach($parent_mapping->mapping as $mapping)
+			{
+				if($url == '/') $this->processMappings($mapping, $url.$mapping['url'], $path.$mapping['url']);
+				else $this->processMappings($mapping, $url.'/'.$mapping['url'], $path.'/'.$mapping['url']);
+			}
+		}
+	}
+
+
+
+	/**
+	 * Setup the environment with data for the install location
+	 *
+	 * @param $task an array containing all install related data
+	 */
+	private function prepareLocation($task)
+	{
+		global $app;
+
+		// Get the domain name to use for the installation
+		// Would be possible in one query too, but we use 2 for easier debugging
+		$main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings
             WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $this->domain = $main_domain['value'];
-        
-        // Get the document root
-        $domain_res = $app->db->queryOneRecord("SELECT document_root, web_folder, type FROM web_domain 
+		$this->domain = $main_domain['value'];
+
+		// Get the document root
+		$domain_res = $app->db->queryOneRecord("SELECT document_root, web_folder, type FROM web_domain
             WHERE domain = '".$app->db->quote($this->domain)."';");
-        $this->document_root = $domain_res['document_root'];
-        
-        // Get the sub location
-        $location_res = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings 
+		$this->document_root = $domain_res['document_root'];
+
+		// Get the sub location
+		$location_res = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings
             WHERE name = 'main_location' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $this->sublocation = $location_res['value'];
-        
-        // Make sure the document_root ends with /
-        if(substr($this->document_root, -1) != '/') $this->document_root .= '/';
-        
-        // Attention: ISPConfig Special: web files are in subfolder 'web' -> append it:
-        if($domain_res['type'] == 'vhostsubdomain') $this->document_root .= $domain_res['web_folder'] . '/';
-        else $this->document_root .= 'web/';
-
-        // If a subfolder is given, make sure it's path doesn't begin with / i.e. /phpbb
-        if(substr($this->sublocation, 0, 1) == '/') $this->sublocation = substr($this->sublocation, 1);
-                
-        // If the package isn't installed to a subfolder, remove the / at the end of the document root
-        if(empty($this->sublocation)) $this->document_root = substr($this->document_root, 0, strlen($this->document_root) - 1);
-        
-        // Set environment variables, later processed by the package install script
-        $this->putenv[] = 'BASE_URL_SCHEME=http';
-        // putenv('BASE_URL_PORT') -> omitted as it's 80 by default
-        $this->putenv[] = 'BASE_URL_HOST='.$this->domain;
-        $this->putenv[] = 'BASE_URL_PATH='.$this->sublocation.'/';
-    }    
-    
-    /**
-     * Setup a database (if needed) and the appropriate environment variables
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     */
-    private function prepareDatabase($task, $sxe)
-    {
-        global $app;
-        
-        $db_id = parent::getXPathValue($sxe, '//db:id');
-        if(empty($db_id)) return; // No database needed
-        
+		$this->sublocation = $location_res['value'];
+
+		// Make sure the document_root ends with /
+		if(substr($this->document_root, -1) != '/') $this->document_root .= '/';
+
+		// Attention: ISPConfig Special: web files are in subfolder 'web' -> append it:
+		if($domain_res['type'] == 'vhostsubdomain') $this->document_root .= $domain_res['web_folder'] . '/';
+		else $this->document_root .= 'web/';
+
+		// If a subfolder is given, make sure it's path doesn't begin with / i.e. /phpbb
+		if(substr($this->sublocation, 0, 1) == '/') $this->sublocation = substr($this->sublocation, 1);
+
+		// If the package isn't installed to a subfolder, remove the / at the end of the document root
+		if(empty($this->sublocation)) $this->document_root = substr($this->document_root, 0, strlen($this->document_root) - 1);
+
+		// Set environment variables, later processed by the package install script
+		$this->putenv[] = 'BASE_URL_SCHEME=http';
+		// putenv('BASE_URL_PORT') -> omitted as it's 80 by default
+		$this->putenv[] = 'BASE_URL_HOST='.$this->domain;
+		$this->putenv[] = 'BASE_URL_PATH='.$this->sublocation.'/';
+	}
+
+
+
+	/**
+	 * Setup a database (if needed) and the appropriate environment variables
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 */
+	private function prepareDatabase($task, $sxe)
+	{
+		global $app;
+
+		$db_id = parent::getXPathValue($sxe, '//db:id');
+		if(empty($db_id)) return; // No database needed
+
 		/* WARNING: if this will ever be uncommented please check the updated prefix handling for user and db names!!!
-         * 
+         *
         // Set the database owner to the domain owner
         // ISPConfig identifies the owner by the sys_groupid (not sys_userid!)
         // so sys_userid can be set to any value
-        $perm = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM web_domain 
+        $perm = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM web_domain
             WHERE domain = '".$this->domain."';");
         $task['sys_groupid'] = $perm['sys_groupid'];
         $serverid = $perm['server_id'];
-                
-        // Get the database prefix and db user prefix 
+
+        // Get the database prefix and db user prefix
         $app->uses('getconf');
         $global_config = $app->getconf->get_global_config('sites');
         $dbname_prefix = str_replace('[CLIENTID]', '', $global_config['dbname_prefix']);
         $dbuser_prefix = str_replace('[CLIENTID]', '', $global_config['dbuser_prefix']);
         $this->dbhost = DB_HOST; // Taken from config.inc.php
         if(empty($this->dbhost)) $this->dbhost = 'localhost'; // Just to ensure any hostname... ;)
-        
+
         $this->newdb_name = $dbname_prefix.$task['CustomerID'].'aps'.$task['InstanceID'];
         $this->newdb_user = $dbuser_prefix.$task['CustomerID'].'aps'.$task['InstanceID'];
-        $dbpw_res = $app->db->queryOneRecord("SELECT Value FROM aps_instances_settings  
+        $dbpw_res = $app->db->queryOneRecord("SELECT Value FROM aps_instances_settings
             WHERE Name = 'main_database_password' AND InstanceID = '".$app->db->quote($task['InstanceID'])."';");
         $newdb_pw = $dbpw_res['Value'];
- 
+
         // In any case delete an existing database (install and removal procedure)
         $app->db->query('DROP DATABASE IF EXISTS `'.$app->db->quote($this->newdb_name).'`;');
         // Delete an already existing database with this name
         $app->db->query("DELETE FROM web_database WHERE database_name = '".$app->db->quote($this->newdb_name)."';");
-        
-        
+
+
         // Create the new database and assign it to a user
         if($this->handle_type == 'install')
         {
@@ -331,77 +345,79 @@ class ApsInstaller extends ApsBase
             $app->db->query('GRANT ALL PRIVILEGES ON '.$app->db->quote($this->newdb_name).'.* TO '.$app->db->quote($this->newdb_user).'@'.$app->db->quote($this->dbhost).' IDENTIFIED BY \'password\';');
             $app->db->query('SET PASSWORD FOR '.$app->db->quote($this->newdb_user).'@'.$app->db->quote($this->dbhost).' = PASSWORD(\''.$newdb_pw.'\');');
             $app->db->query('FLUSH PRIVILEGES;');
-        
+
             // Add the new database to the customer databases
             // Assumes: charset = utf8
-            $app->db->query('INSERT INTO web_database (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id, 
-                type, database_name, database_user, database_password, database_charset, remote_access, remote_ips, active) 
-                VALUES ('.$task['sys_userid'].', '.$task['sys_groupid'].', "'.$task['sys_perm_user'].'", "'.$task['sys_perm_group'].'", 
-                "'.$task['sys_perm_other'].'", '.$app->db->quote($serverid).', "mysql", "'.$app->db->quote($this->newdb_name).'", 
+            $app->db->query('INSERT INTO web_database (sys_userid, sys_groupid, sys_perm_user, sys_perm_group, sys_perm_other, server_id,
+                type, database_name, database_user, database_password, database_charset, remote_access, remote_ips, active)
+                VALUES ('.$task['sys_userid'].', '.$task['sys_groupid'].', "'.$task['sys_perm_user'].'", "'.$task['sys_perm_group'].'",
+                "'.$task['sys_perm_other'].'", '.$app->db->quote($serverid).', "mysql", "'.$app->db->quote($this->newdb_name).'",
                 "'.$app->db->quote($this->newdb_user).'", "'.$app->db->quote($newdb_pw).'", "utf8", "n", "", "y");');
         }
 		*/
-        
-        $mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver;');
-        $mysqlver = $mysqlver_res['ver'];
-		
+
+		$mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver;');
+		$mysqlver = $mysqlver_res['ver'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_password' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_pw = $tmp['value'];
-		
+		$newdb_pw = $tmp['value'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_host' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_host = $tmp['value'];
-		
+		$newdb_host = $tmp['value'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_name' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_name = $tmp['value'];
-		
+		$newdb_name = $tmp['value'];
+
 		$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_login' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
-        $newdb_login = $tmp['value'];
-        
-        $this->putenv[] = 'DB_'.$db_id.'_TYPE=mysql';
-        $this->putenv[] = 'DB_'.$db_id.'_NAME='.$newdb_name;
-        $this->putenv[] = 'DB_'.$db_id.'_LOGIN='.$newdb_login;
-        $this->putenv[] = 'DB_'.$db_id.'_PASSWORD='.$newdb_pw;
-        $this->putenv[] = 'DB_'.$db_id.'_HOST='.$newdb_host;
-        $this->putenv[] = 'DB_'.$db_id.'_PORT=3306';
-        $this->putenv[] = 'DB_'.$db_id.'_VERSION='.$mysqlver;
-    }    
-    
-    /**
-     * Extract all needed files from the package
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     * @return boolean
-     */
-    private function prepareFiles($task, $sxe)
-    {
-        global $app;
-        
-        // Basically set the mapping for APS version 1.0, if not available -> newer way
-        $mapping = $sxe->mapping;
-        $mapping_path = $sxe->mapping['path'];
-        $mapping_url = $sxe->mapping['url'];
-        if(empty($mapping))
-        {
-            $mapping = $sxe->service->provision->{'url-mapping'}->mapping;
-            $mapping_path = $sxe->service->provision->{'url-mapping'}->mapping['path'];
-            $mapping_url = $sxe->service->provision->{'url-mapping'}->mapping['url'];
-        }
+		$newdb_login = $tmp['value'];
 
-        try
-        {
-            // Make sure we have a valid mapping path (at least /)
-            if(empty($mapping_path)) throw new Exception('Unable to determine a mapping path');
-            
-            $this->local_installpath = $this->document_root.$this->sublocation.'/';
-
-            // Now delete an existing folder (affects install and removal in the same way)
-            @chdir($this->local_installpath);
-            if(file_exists($this->local_installpath)){
+		$this->putenv[] = 'DB_'.$db_id.'_TYPE=mysql';
+		$this->putenv[] = 'DB_'.$db_id.'_NAME='.$newdb_name;
+		$this->putenv[] = 'DB_'.$db_id.'_LOGIN='.$newdb_login;
+		$this->putenv[] = 'DB_'.$db_id.'_PASSWORD='.$newdb_pw;
+		$this->putenv[] = 'DB_'.$db_id.'_HOST='.$newdb_host;
+		$this->putenv[] = 'DB_'.$db_id.'_PORT=3306';
+		$this->putenv[] = 'DB_'.$db_id.'_VERSION='.$mysqlver;
+	}
+
+
+
+	/**
+	 * Extract all needed files from the package
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 * @return boolean
+	 */
+	private function prepareFiles($task, $sxe)
+	{
+		global $app;
+
+		// Basically set the mapping for APS version 1.0, if not available -> newer way
+		$mapping = $sxe->mapping;
+		$mapping_path = $sxe->mapping['path'];
+		$mapping_url = $sxe->mapping['url'];
+		if(empty($mapping))
+		{
+			$mapping = $sxe->service->provision->{'url-mapping'}->mapping;
+			$mapping_path = $sxe->service->provision->{'url-mapping'}->mapping['path'];
+			$mapping_url = $sxe->service->provision->{'url-mapping'}->mapping['url'];
+		}
+
+		try
+		{
+			// Make sure we have a valid mapping path (at least /)
+			if(empty($mapping_path)) throw new Exception('Unable to determine a mapping path');
+
+			$this->local_installpath = $this->document_root.$this->sublocation.'/';
+
+			// Now delete an existing folder (affects install and removal in the same way)
+			@chdir($this->local_installpath);
+			if(file_exists($this->local_installpath)){
 				// make sure we don't delete error and stats folders
 				if($this->local_installpath == $this->document_root.'/'){
 					if(is_dir($this->document_root)){
-						$files = array_diff(scandir($this->document_root), array('.','..','error','stats'));
+						$files = array_diff(scandir($this->document_root), array('.', '..', 'error', 'stats'));
 						foreach($files as $file){
 							if(is_dir($this->document_root.'/'.$file)){
 								$app->file->removeDirectory($this->document_root.'/'.$file);
@@ -420,301 +436,314 @@ class ApsInstaller extends ApsBase
 				mkdir($this->local_installpath, 0777, true);
 			}
 
-            if($this->handle_type == 'install')
-            {            
-                // Now check if the needed folder is there
-                if(!file_exists($this->local_installpath))
-                    throw new Exception('Unable to create a new folder for the package '.$task['path']);
-                
-                // Extract all files and assign them a new owner
-                if( ($this->extractZip($this->packages_dir.'/'.$task['path'], $mapping_path, $this->local_installpath) === false)
-                 || ($this->extractZip($this->packages_dir.'/'.$task['path'], 'scripts', $this->local_installpath.'install_scripts/') === false) )
-                {
-                    // Clean already extracted data
-                    exec("rm -Rf ".escapeshellarg($this->local_installpath).'*');
-                    throw new Exception('Unable to extract the package '.$task['path']);              
-                }
-                
-                $this->processMappings($mapping, $mapping_url, $this->local_installpath);
-            
-                // Set the appropriate file owner
-                $main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings  
-                    WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';");        
-                $owner_res = $app->db->queryOneRecord("SELECT system_user, system_group FROM web_domain  
+			if($this->handle_type == 'install')
+			{
+				// Now check if the needed folder is there
+				if(!file_exists($this->local_installpath))
+					throw new Exception('Unable to create a new folder for the package '.$task['path']);
+
+				// Extract all files and assign them a new owner
+				if( ($this->extractZip($this->packages_dir.'/'.$task['path'], $mapping_path, $this->local_installpath) === false)
+					|| ($this->extractZip($this->packages_dir.'/'.$task['path'], 'scripts', $this->local_installpath.'install_scripts/') === false) )
+				{
+					// Clean already extracted data
+					exec("rm -Rf ".escapeshellarg($this->local_installpath).'*');
+					throw new Exception('Unable to extract the package '.$task['path']);
+				}
+
+				$this->processMappings($mapping, $mapping_url, $this->local_installpath);
+
+				// Set the appropriate file owner
+				$main_domain = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings
+                    WHERE name = 'main_domain' AND instance_id = '".$app->db->quote($task['instance_id'])."';");
+				$owner_res = $app->db->queryOneRecord("SELECT system_user, system_group FROM web_domain
                         WHERE domain = '".$app->db->quote($main_domain['value'])."';");
-                $this->file_owner_user = $owner_res['system_user']; 
-                $this->file_owner_group = $owner_res['system_group'];
-                exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
-				
+				$this->file_owner_user = $owner_res['system_user'];
+				$this->file_owner_group = $owner_res['system_group'];
+				exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
+
 				//* Chown stats directory back
 				if(is_dir($this->local_installpath.'stats')) {
 					exec('chown -R root:root '.escapeshellarg($this->local_installpath.'stats'));
 				}
-            }
-        }
-        catch(Exception $e)
-        {
-            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
+			}
+		}
+		catch(Exception $e)
+		{
+			$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'"
                 WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->log($e->getMessage(), 1);
-            return false;
-        }
-        
-        return true;
-    }
-    
-    /**
-     * Get all user config variables and set them to environment variables
-     * 
-     * @param $task an array containing all install related data
-     */    
-    private function prepareUserInputData($task)
-    {
-        global $app;
-        
-        $userdata = $app->db->queryAllRecords("SELECT name, value FROM aps_instances_settings 
+			$app->log($e->getMessage(), 1);
+			return false;
+		}
+
+		return true;
+	}
+
+
+
+	/**
+	 * Get all user config variables and set them to environment variables
+	 *
+	 * @param $task an array containing all install related data
+	 */
+	private function prepareUserInputData($task)
+	{
+		global $app;
+
+		$userdata = $app->db->queryAllRecords("SELECT name, value FROM aps_instances_settings
             WHERE instance_id = '".$app->db->quote($task['instance_id'])."';");
-        if(empty($userdata)) return false;
-        
-        foreach($userdata as $data)
-        {
-            // Skip unnecessary data
-            if($data['name'] == 'main_location'
-            || $data['name'] == 'main_domain'
-            || $data['name'] == 'main_database_password'
-			|| $data['name'] == 'main_database_name'
-			|| $data['name'] == 'main_database_host'
-			|| $data['name'] == 'main_database_login'
-            || $data['name'] == 'license') continue;
-            
-            $this->putenv[] = 'SETTINGS_'.$data['name'].'='.$data['value'];
-        }
-    }
-	
+		if(empty($userdata)) return false;
+
+		foreach($userdata as $data)
+		{
+			// Skip unnecessary data
+			if($data['name'] == 'main_location'
+				|| $data['name'] == 'main_domain'
+				|| $data['name'] == 'main_database_password'
+				|| $data['name'] == 'main_database_name'
+				|| $data['name'] == 'main_database_host'
+				|| $data['name'] == 'main_database_login'
+				|| $data['name'] == 'license') continue;
+
+			$this->putenv[] = 'SETTINGS_'.$data['name'].'='.$data['value'];
+		}
+	}
+
+
+
 	/**
-     * Fetch binary data from a given array
-     * The data is retrieved in binary mode and 
-     * then directly written to an output file
-     *
-     * @param $input a specially structed array
-     * @see $this->startUpdate()
-     */
-    private function fetchFiles($input)
-    {
-        $fh = array();
-        $url = array();
-        $conn = array();
-
-        // Build the single cURL handles and add them to a multi handle
-        $mh = curl_multi_init();
-        
-        // Process each app 
-        for($i = 0; $i < count($input); $i++)
-        {
-            $conn[$i] = curl_init($input[$i]['url']);
-            $fh[$i] = fopen($input[$i]['localtarget'], 'wb'); 
-            
-            curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
-            curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
-            curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
-            curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
-            curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1); 
-            
-            curl_multi_add_handle($mh, $conn[$i]);
-        }
-        
-        $active = 0;
-        do curl_multi_exec($mh, $active);
-        while($active > 0);
+	 * Fetch binary data from a given array
+	 * The data is retrieved in binary mode and
+	 * then directly written to an output file
+	 *
+	 * @param $input a specially structed array
+	 * @see $this->startUpdate()
+	 */
+	private function fetchFiles($input)
+	{
+		$fh = array();
+		$url = array();
+		$conn = array();
 
-        // Close the handles
-        for($i = 0; $i < count($input); $i++)
-        {
-            fclose($fh[$i]);
-            curl_multi_remove_handle($mh, $conn[$i]);
-            curl_close($conn[$i]);
-        }
-        curl_multi_close($mh);
-    }
-    
-    /**
-     * The installation script should be executed
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     * @return boolean
-     */
-    private function doInstallation($task, $sxe)
-    {
-        global $app;
-        
-        try
-        {
-            // Check if the install directory exists
-            if(!is_dir($this->local_installpath.'install_scripts/'))
-                throw new Exception('The install directory '.$this->local_installpath.' is not existing');
-            
-            // Set the executable bit to the configure script
-            $cfgscript = @(string)$sxe->service->provision->{'configuration-script'}['name'];
-            if(!$cfgscript) $cfgscript = 'configure';
-            chmod($this->local_installpath.'install_scripts/'.$cfgscript, 0755);
-            
-            // Change to the install folder (import for the exec() below!)
+		// Build the single cURL handles and add them to a multi handle
+		$mh = curl_multi_init();
+
+		// Process each app
+		for($i = 0; $i < count($input); $i++)
+		{
+			$conn[$i] = curl_init($input[$i]['url']);
+			$fh[$i] = fopen($input[$i]['localtarget'], 'wb');
+
+			curl_setopt($conn[$i], CURLOPT_BINARYTRANSFER, true);
+			curl_setopt($conn[$i], CURLOPT_FILE, $fh[$i]);
+			curl_setopt($conn[$i], CURLOPT_TIMEOUT, 0);
+			curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
+			curl_setopt($conn[$i], CURLOPT_FOLLOWLOCATION, 1);
+
+			curl_multi_add_handle($mh, $conn[$i]);
+		}
+
+		$active = 0;
+		do curl_multi_exec($mh, $active);
+		while($active > 0);
+
+		// Close the handles
+		for($i = 0; $i < count($input); $i++)
+		{
+			fclose($fh[$i]);
+			curl_multi_remove_handle($mh, $conn[$i]);
+			curl_close($conn[$i]);
+		}
+		curl_multi_close($mh);
+	}
+
+
+
+	/**
+	 * The installation script should be executed
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 * @return boolean
+	 */
+	private function doInstallation($task, $sxe)
+	{
+		global $app;
+
+		try
+		{
+			// Check if the install directory exists
+			if(!is_dir($this->local_installpath.'install_scripts/'))
+				throw new Exception('The install directory '.$this->local_installpath.' is not existing');
+
+			// Set the executable bit to the configure script
+			$cfgscript = @(string)$sxe->service->provision->{'configuration-script'}['name'];
+			if(!$cfgscript) $cfgscript = 'configure';
+			chmod($this->local_installpath.'install_scripts/'.$cfgscript, 0755);
+
+			// Change to the install folder (import for the exec() below!)
 			//exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
-            chdir($this->local_installpath.'install_scripts/');
-			
+			chdir($this->local_installpath.'install_scripts/');
+
 			// Set the enviroment variables
 			foreach($this->putenv as $var) {
 				putenv($var);
 			}
-			
-            $shell_retcode = true;
-            $shell_ret = array();
-			 exec('php '.escapeshellarg($this->local_installpath.'install_scripts/'.$cfgscript).' install 2>&1', $shell_ret, $shell_retcode);
-            $shell_ret = array_filter($shell_ret);
-            $shell_ret_str = implode("\n", $shell_ret);
-            
+
+			$shell_retcode = true;
+			$shell_ret = array();
+			exec('php '.escapeshellarg($this->local_installpath.'install_scripts/'.$cfgscript).' install 2>&1', $shell_ret, $shell_retcode);
+			$shell_ret = array_filter($shell_ret);
+			$shell_ret_str = implode("\n", $shell_ret);
+
 			// Although $shell_retcode might be 0, there can be PHP errors. Filter them:
-            if(substr_count($shell_ret_str, 'Warning: ') > 0) $shell_retcode = 1;
-            
-            // If an error has occurred, the return code is != 0 
-            if($shell_retcode != 0) throw new Exception($shell_ret_str);
-            else
-            {
-                // The install succeeded, chown newly created files too
-                exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
-				
+			if(substr_count($shell_ret_str, 'Warning: ') > 0) $shell_retcode = 1;
+
+			// If an error has occurred, the return code is != 0
+			if($shell_retcode != 0) throw new Exception($shell_ret_str);
+			else
+			{
+				// The install succeeded, chown newly created files too
+				exec('chown -R '.$this->file_owner_user.':'.$this->file_owner_group.' '.escapeshellarg($this->local_installpath));
+
 				//* Chown stats directory back
 				if(is_dir($this->local_installpath.'stats')) {
 					exec('chown -R root:root '.escapeshellarg($this->local_installpath.'stats'));
 				}
-                
-                $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_SUCCESS.'" 
+
+				$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_SUCCESS.'"
                     WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            }
-        }
-        catch(Exception $e)
-        {
-            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
+			}
+		}
+
+		catch(Exception $e)
+		{
+			$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'"
                 WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->log($e->getMessage(), 1);
-            return false;
-        }
-        
-        return true;
-    }
-    
-    /**
-     * Cleanup: Remove install scripts, remove tasks and update the database
-     * 
-     * @param $task an array containing all install related data
-     * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
-     */
-    private function cleanup($task, $sxe)
-    {
-        chdir($this->local_installpath);
-        exec("rm -Rf ".escapeshellarg($this->local_installpath).'install_scripts');
-    }    
-    
-    /**
-     * The main method which performs the actual package installation
-     * 
-     * @param $instanceid the instanceID to install
-     * @param $type the type of task to perform (installation, removal)
-     */
-    public function installHandler($instanceid, $type)
-    {
-        global $app;
-        
-        // Set the given handle type, currently supported: install, delete
-        if($type == 'install' || $type == 'delete') $this->handle_type = $type;
-        else return false;
-        
-        // Get all instance metadata
+			$app->log($e->getMessage(), 1);
+			return false;
+		}
+
+		return true;
+	}
+
+
+
+	/**
+	 * Cleanup: Remove install scripts, remove tasks and update the database
+	 *
+	 * @param $task an array containing all install related data
+	 * @param $sxe a SimpleXMLElement handle, holding APP-META.xml
+	 */
+	private function cleanup($task, $sxe)
+	{
+		chdir($this->local_installpath);
+		exec("rm -Rf ".escapeshellarg($this->local_installpath).'install_scripts');
+	}
+
+
+
+	/**
+	 * The main method which performs the actual package installation
+	 *
+	 * @param $instanceid the instanceID to install
+	 * @param $type the type of task to perform (installation, removal)
+	 */
+	public function installHandler($instanceid, $type)
+	{
+		global $app;
+
+		// Set the given handle type, currently supported: install, delete
+		if($type == 'install' || $type == 'delete') $this->handle_type = $type;
+		else return false;
+
+		// Get all instance metadata
 		/*
-        $task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i 
-            INNER JOIN aps_packages AS p ON i.package_id = p.id 
+        $task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i
+            INNER JOIN aps_packages AS p ON i.package_id = p.id
             INNER JOIN client AS c ON i.customer_id = c.client_id
             WHERE i.id = ".$instanceid.";");
 		*/
-		$task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i 
+		$task = $app->db->queryOneRecord("SELECT * FROM aps_instances AS i
             INNER JOIN aps_packages AS p ON i.package_id = p.id
             WHERE i.id = ".$instanceid.";");
-        if(!$task) return false;  // formerly: throw new Exception('The InstanceID doesn\'t exist.');
-        if(!isset($task['instance_id'])) $task['instance_id'] = $instanceid;
-		
+		if(!$task) return false;  // formerly: throw new Exception('The InstanceID doesn\'t exist.');
+		if(!isset($task['instance_id'])) $task['instance_id'] = $instanceid;
+
 		// Download aps package
 		if(!file_exists($this->packages_dir.'/'.$task['path']) || filesize($this->packages_dir.'/'.$task['path']) == 0) {
 			$ch = curl_init();
 			$fh = fopen($this->packages_dir.'/'.$task['path'], 'wb');
-			curl_setopt($ch, CURLOPT_FILE, $fh); 
-			//curl_setopt($ch, CURLOPT_HEADER, 0); 
+			curl_setopt($ch, CURLOPT_FILE, $fh);
+			//curl_setopt($ch, CURLOPT_HEADER, 0);
 			curl_setopt($ch, CURLOPT_URL, $task['package_url']);
 			curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
 			curl_setopt($ch, CURLOPT_TIMEOUT, 0);
 			curl_setopt($ch, CURLOPT_FAILONERROR, 1);
-			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);     
-			if(curl_exec($ch) === false) $app->log(curl_error ($ch),1);
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
+			if(curl_exec($ch) === false) $app->log(curl_error($ch), 1);
 			fclose($fh);
 			curl_close($ch);
 		}
-		
+
 		/*
-		$app_to_dl[] = array('name' => $task['path'], 
-                            'url' => $task['package_url'], 
-                            'filesize' => 0, 
+		$app_to_dl[] = array('name' => $task['path'],
+                            'url' => $task['package_url'],
+                            'filesize' => 0,
                             'localtarget' => $this->packages_dir.'/'.$task['path']);
 
         $this->fetchFiles($app_to_dl);
 		*/
-		
+
 		// Make sure the requirements are given so that this script can execute
-        $req_ret = $this->checkRequirements();
-        if(!$req_ret) return false;
-        
-        $metafile = $this->getContentFromZIP($this->packages_dir.'/'.$task['path'], 'APP-META.xml');
-        // Check if the meta file is existing
-        if(!$metafile)
-        {
-            $app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'" 
+		$req_ret = $this->checkRequirements();
+		if(!$req_ret) return false;
+
+		$metafile = $this->getContentFromZIP($this->packages_dir.'/'.$task['path'], 'APP-META.xml');
+		// Check if the meta file is existing
+		if(!$metafile)
+		{
+			$app->dbmaster->query('UPDATE aps_instances SET instance_status = "'.INSTANCE_ERROR.'"
                 WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->log('Unable to find the meta data file of package '.$task['path'], 1);
-            return false;
-        }
-        
-        // Rename namespaces and register them 
-        $metadata = str_replace("xmlns=", "ns=", $metafile);
-        $sxe = new SimpleXMLElement($metadata);
-        $namespaces = $sxe->getDocNamespaces(true);
-        foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url); 
-
-        // Setup the environment with data for the install location
-        $this->prepareLocation($task);
-        
-        // Create the database if necessary
-        $this->prepareDatabase($task, $sxe);
-        
-        // Unpack the install scripts from the packages
-        if($this->prepareFiles($task, $sxe) && $this->handle_type == 'install')
-        {
-            // Setup the variables from the install script
-            $this->prepareUserInputData($task);
-        
-            // Do the actual installation
-            $this->doInstallation($task, $sxe);
-            
-            // Remove temporary files
-            $this->cleanup($task, $sxe);
-        }
-        
-        // Finally delete the instance entry + settings
-        if($this->handle_type == 'delete')
-        {
-            $app->db->query('DELETE FROM aps_instances WHERE id = "'.$app->db->quote($task['instance_id']).'";');
-            $app->db->query('DELETE FROM aps_instances_settings WHERE instance_id = "'.$app->db->quote($task['instance_id']).'";');
-        }
-        
-        unset($sxe);
-    }
+			$app->log('Unable to find the meta data file of package '.$task['path'], 1);
+			return false;
+		}
+
+		// Rename namespaces and register them
+		$metadata = str_replace("xmlns=", "ns=", $metafile);
+		$sxe = new SimpleXMLElement($metadata);
+		$namespaces = $sxe->getDocNamespaces(true);
+		foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+		// Setup the environment with data for the install location
+		$this->prepareLocation($task);
+
+		// Create the database if necessary
+		$this->prepareDatabase($task, $sxe);
+
+		// Unpack the install scripts from the packages
+		if($this->prepareFiles($task, $sxe) && $this->handle_type == 'install')
+		{
+			// Setup the variables from the install script
+			$this->prepareUserInputData($task);
+
+			// Do the actual installation
+			$this->doInstallation($task, $sxe);
+
+			// Remove temporary files
+			$this->cleanup($task, $sxe);
+		}
+
+		// Finally delete the instance entry + settings
+		if($this->handle_type == 'delete')
+		{
+			$app->db->query('DELETE FROM aps_instances WHERE id = "'.$app->db->quote($task['instance_id']).'";');
+			$app->db->query('DELETE FROM aps_instances_settings WHERE instance_id = "'.$app->db->quote($task['instance_id']).'";');
+		}
+
+		unset($sxe);
+	}
+
 }
+
 ?>
diff --git a/server/lib/classes/cron.d/100-mailbox_stats.inc.php b/server/lib/classes/cron.d/100-mailbox_stats.inc.php
index ed43e4e5743061abdc35a243a7d522fdd4307714..750849055f6a13cca8e00582b0cff84cceb58bec 100644
--- a/server/lib/classes/cron.d/100-mailbox_stats.inc.php
+++ b/server/lib/classes/cron.d/100-mailbox_stats.inc.php
@@ -29,240 +29,240 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_mailbox_stats extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        // cronjob code here
-        
-        #######################################################################################################
-        // store the mailbox statistics in the database
-        #######################################################################################################
-
-        $parse_mail_log = false;
-        $sql = "SELECT mailuser_id,maildir FROM mail_user WHERE server_id = ".$conf['server_id'];
-        $records = $app->db->queryAllRecords($sql);
-        if(count($records) > 0) $parse_mail_log = true;
-
-        foreach($records as $rec) {
-            if(@is_file($rec['maildir'].'/ispconfig_mailsize')) {
-                $parse_mail_log = false;
-
-                // rename file
-                rename($rec['maildir'].'/ispconfig_mailsize',$rec['maildir'].'/ispconfig_mailsize_save');
-
-                // Read the file
-                $lines = file($rec['maildir'].'/ispconfig_mailsize_save');
-                $mail_traffic = 0;
-                foreach($lines as $line) {
-                    $mail_traffic += intval($line);
-                }
-                unset($lines);
-
-                // Delete backup file
-                if(@is_file($rec['maildir'].'/ispconfig_mailsize_save')) unlink($rec['maildir'].'/ispconfig_mailsize_save');
-
-                // Save the traffic stats in the sql database
-                $tstamp = date('Y-m');
-
-                $sql = "SELECT * FROM mail_traffic WHERE month = '$tstamp' AND mailuser_id = ".$rec['mailuser_id'];
-                $tr = $app->dbmaster->queryOneRecord($sql);
-
-                $mail_traffic += $tr['traffic'];
-                if($tr['traffic_id'] > 0) {
-                    $sql = "UPDATE mail_traffic SET traffic = $mail_traffic WHERE traffic_id = ".$tr['traffic_id'];
-                } else {
-                    $sql = "INSERT INTO mail_traffic (month,mailuser_id,traffic) VALUES ('$tstamp',".$rec['mailuser_id'].",$mail_traffic)";
-                }
-                $app->dbmaster->query($sql);
-                //echo $sql;
-
-            }
-
-        }
-
-        if($parse_mail_log == true) {
-            $mailbox_traffic = array();
-            $mail_boxes = array();
-            $mail_rewrites = array(); // we need to read all mail aliases and forwards because the address in amavis is not always the mailbox address
-
-            function parse_mail_log_line($line) {
-                //Oct 31 17:35:48 mx01 amavis[32014]: (32014-05) Passed CLEAN, [IPv6:xxxxx] [IPv6:xxxxx] <xxx@yyyy> -> <aaaa@bbbb>, Message-ID: <xxxx@yyyyy>, mail_id: xxxxxx, Hits: -1.89, size: 1591, queued_as: xxxxxxx, 946 ms
-
-                if(preg_match('/^(\w+\s+\d+\s+\d+:\d+:\d+)\s+[^ ]+\s+amavis.* <([^>]+)>\s+->\s+((<[^>]+>,)+) .*Message-ID:\s+<([^>]+)>.* size:\s+(\d+),.*$/', $line, $matches) == false) return false;
-
-                $timestamp = strtotime($matches[1]);
-                if(!$timestamp) return false;
-
-                $to = array();
-                $recipients = explode(',', $matches[3]);
-                foreach($recipients as $recipient) {
-                    $recipient = substr($recipient, 1, -1);
-                    if(!$recipient || $recipient == $matches[2]) continue;
-                    $to[] = $recipient;
-                }
-
-                return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[6], 'from' => $matches[2], 'to' => $to, 'message-id' => $matches[5]);
-            }
-
-            function add_mailbox_traffic(&$traffic_array, $address, $traffic) {
-                global $mail_boxes, $mail_rewrites;
-
-                $address = strtolower($address);
-
-                if(in_array($address, $mail_boxes) == true) {
-                    if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
-                    $traffic_array[$address] += $traffic;
-                } elseif(array_key_exists($address, $mail_rewrites)) {
-                    foreach($mail_rewrites[$address] as $address) {
-                        if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
-                        $traffic_array[$address] += $traffic;
-                    }
-                } else {
-                    // this is not a local address - skip it
-                }
-            }
-
-            $sql = "SELECT email FROM mail_user WHERE server_id = ".$conf['server_id'];
-            $records = $app->db->queryAllRecords($sql);
-            foreach($records as $record) {
-                $mail_boxes[] = $record['email'];
-            }
-            $sql = "SELECT source, destination FROM mail_forwarding WHERE server_id = ".$conf['server_id'];
-            $records = $app->db->queryAllRecords($sql);
-            foreach($records as $record) {
-                $targets = preg_split('/[\n,]+/', $record['destination']);
-                foreach($targets as $target) {
-                    if(in_array($target, $mail_boxes)) {
-                        if(isset($mail_rewrites[$record['source']])) $mail_rewrites[$record['source']][] = $target;
-                        else $mail_rewrites[$record['source']] = array($target);
-                    }
-                }
-            }
-
-            $state_file = dirname(__FILE__) . '/mail_log_parser.state';
-            $prev_line = false;
-            $last_line = false;
-            $cur_line = false;
-
-            if(file_exists($state_file)) {
-                $prev_line = parse_mail_log_line(trim(file_get_contents($state_file)));
-                //if($prev_line) echo "continuing from previous run, log position: " . $prev_line['message-id'] . " at " . strftime('%d.%m.%Y %H:%M:%S', $prev_line['timestamp']) . "\n";
-            }
-
-            if(file_exists('/var/log/mail.log')) {
-                $fp = fopen('/var/log/mail.log', 'r');
-                //echo "Parsing mail.log...\n";
-                $l = 0;
-                while($line = fgets($fp, 8192)) {
-                    $l++;
-                    //if($l % 1000 == 0) echo "\rline $l";
-                    $cur_line = parse_mail_log_line($line);
-                    if(!$cur_line) continue;
-
-                    if($prev_line) {
-                        // check if this line has to be processed
-                        if($cur_line['timestamp'] < $prev_line['timestamp']) {
-                            $parse_mail_log = false; // we do not need to parse the second file!
-                            continue; // already processed
-                        } elseif($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
-                            $parse_mail_log = false; // we do not need to parse the second file!
-                            $prev_line = false; // this line has already been processed but the next one has to be!
-                            continue;
-                        }
-                    }
-
-                    add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
-                    foreach($cur_line['to'] as $to) {
-                        add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
-                    }
-                    $last_line = $line; // store for the state file
-                }
-                fclose($fp);
-                //echo "\n";
-            }
-
-            if($parse_mail_log == true && file_exists('/var/log/mail.log.1')) {
-                $fp = fopen('/var/log/mail.log.1', 'r');
-                //echo "Parsing mail.log.1...\n";
-                $l = 0;
-                while($line = fgets($fp, 8192)) {
-                    $l++;
-                    //if($l % 1000 == 0) echo "\rline $l";
-                    $cur_line = parse_mail_log_line($line);
-                    if(!$cur_line) continue;
-
-                    if($prev_line) {
-                        // check if this line has to be processed
-                        if($cur_line['timestamp'] < $prev_line['timestamp']) continue; // already processed
-                        if($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
-                            $prev_line = false; // this line has already been processed but the next one has to be!
-                            continue;
-                        }
-                    }
-
-                    add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
-                    foreach($cur_line['to'] as $to) {
-                        add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
-                    }
-                }
-                fclose($fp);
-                //echo "\n";
-            }
-            unset($mail_rewrites);
-            unset($mail_boxes);
-
-            // Save the traffic stats in the sql database
-            $tstamp = date('Y-m');
-            $sql = "SELECT mailuser_id,email FROM mail_user WHERE server_id = ".$conf['server_id'];
-            $records = $app->db->queryAllRecords($sql);
-            foreach($records as $rec) {
-                if(array_key_exists($rec['email'], $mailbox_traffic)) {
-                    $sql = "SELECT * FROM mail_traffic WHERE month = '$tstamp' AND mailuser_id = ".$rec['mailuser_id'];
-                    $tr = $app->dbmaster->queryOneRecord($sql);
-
-                    $mail_traffic = $tr['traffic'] + $mailbox_traffic[$rec['email']];
-                    if($tr['traffic_id'] > 0) {
-                        $sql = "UPDATE mail_traffic SET traffic = $mail_traffic WHERE traffic_id = ".$tr['traffic_id'];
-                    } else {
-                        $sql = "INSERT INTO mail_traffic (month,mailuser_id,traffic) VALUES ('$tstamp',".$rec['mailuser_id'].",$mail_traffic)";
-                    }
-                    $app->dbmaster->query($sql);
-                    //echo $sql;
-                }
-            }
-
-            unset($mailbox_traffic);
-            if($last_line) file_put_contents($state_file, $last_line);
-        }
-        
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		// cronjob code here
+
+		//######################################################################################################
+		// store the mailbox statistics in the database
+		//######################################################################################################
+
+		$parse_mail_log = false;
+		$sql = "SELECT mailuser_id,maildir FROM mail_user WHERE server_id = ".$conf['server_id'];
+		$records = $app->db->queryAllRecords($sql);
+		if(count($records) > 0) $parse_mail_log = true;
+
+		foreach($records as $rec) {
+			if(@is_file($rec['maildir'].'/ispconfig_mailsize')) {
+				$parse_mail_log = false;
+
+				// rename file
+				rename($rec['maildir'].'/ispconfig_mailsize', $rec['maildir'].'/ispconfig_mailsize_save');
+
+				// Read the file
+				$lines = file($rec['maildir'].'/ispconfig_mailsize_save');
+				$mail_traffic = 0;
+				foreach($lines as $line) {
+					$mail_traffic += intval($line);
+				}
+				unset($lines);
+
+				// Delete backup file
+				if(@is_file($rec['maildir'].'/ispconfig_mailsize_save')) unlink($rec['maildir'].'/ispconfig_mailsize_save');
+
+				// Save the traffic stats in the sql database
+				$tstamp = date('Y-m');
+
+				$sql = "SELECT * FROM mail_traffic WHERE month = '$tstamp' AND mailuser_id = ".$rec['mailuser_id'];
+				$tr = $app->dbmaster->queryOneRecord($sql);
+
+				$mail_traffic += $tr['traffic'];
+				if($tr['traffic_id'] > 0) {
+					$sql = "UPDATE mail_traffic SET traffic = $mail_traffic WHERE traffic_id = ".$tr['traffic_id'];
+				} else {
+					$sql = "INSERT INTO mail_traffic (month,mailuser_id,traffic) VALUES ('$tstamp',".$rec['mailuser_id'].",$mail_traffic)";
+				}
+				$app->dbmaster->query($sql);
+				//echo $sql;
+
+			}
+
+		}
+
+		if($parse_mail_log == true) {
+			$mailbox_traffic = array();
+			$mail_boxes = array();
+			$mail_rewrites = array(); // we need to read all mail aliases and forwards because the address in amavis is not always the mailbox address
+
+			function parse_mail_log_line($line) {
+				//Oct 31 17:35:48 mx01 amavis[32014]: (32014-05) Passed CLEAN, [IPv6:xxxxx] [IPv6:xxxxx] <xxx@yyyy> -> <aaaa@bbbb>, Message-ID: <xxxx@yyyyy>, mail_id: xxxxxx, Hits: -1.89, size: 1591, queued_as: xxxxxxx, 946 ms
+
+				if(preg_match('/^(\w+\s+\d+\s+\d+:\d+:\d+)\s+[^ ]+\s+amavis.* <([^>]+)>\s+->\s+((<[^>]+>,)+) .*Message-ID:\s+<([^>]+)>.* size:\s+(\d+),.*$/', $line, $matches) == false) return false;
+
+				$timestamp = strtotime($matches[1]);
+				if(!$timestamp) return false;
+
+				$to = array();
+				$recipients = explode(',', $matches[3]);
+				foreach($recipients as $recipient) {
+					$recipient = substr($recipient, 1, -1);
+					if(!$recipient || $recipient == $matches[2]) continue;
+					$to[] = $recipient;
+				}
+
+				return array('line' => $line, 'timestamp' => $timestamp, 'size' => $matches[6], 'from' => $matches[2], 'to' => $to, 'message-id' => $matches[5]);
+			}
+
+			function add_mailbox_traffic(&$traffic_array, $address, $traffic) {
+				global $mail_boxes, $mail_rewrites;
+
+				$address = strtolower($address);
+
+				if(in_array($address, $mail_boxes) == true) {
+					if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
+					$traffic_array[$address] += $traffic;
+				} elseif(array_key_exists($address, $mail_rewrites)) {
+					foreach($mail_rewrites[$address] as $address) {
+						if(!isset($traffic_array[$address])) $traffic_array[$address] = 0;
+						$traffic_array[$address] += $traffic;
+					}
+				} else {
+					// this is not a local address - skip it
+				}
+			}
+
+			$sql = "SELECT email FROM mail_user WHERE server_id = ".$conf['server_id'];
+			$records = $app->db->queryAllRecords($sql);
+			foreach($records as $record) {
+				$mail_boxes[] = $record['email'];
+			}
+			$sql = "SELECT source, destination FROM mail_forwarding WHERE server_id = ".$conf['server_id'];
+			$records = $app->db->queryAllRecords($sql);
+			foreach($records as $record) {
+				$targets = preg_split('/[\n,]+/', $record['destination']);
+				foreach($targets as $target) {
+					if(in_array($target, $mail_boxes)) {
+						if(isset($mail_rewrites[$record['source']])) $mail_rewrites[$record['source']][] = $target;
+						else $mail_rewrites[$record['source']] = array($target);
+					}
+				}
+			}
+
+			$state_file = dirname(__FILE__) . '/mail_log_parser.state';
+			$prev_line = false;
+			$last_line = false;
+			$cur_line = false;
+
+			if(file_exists($state_file)) {
+				$prev_line = parse_mail_log_line(trim(file_get_contents($state_file)));
+				//if($prev_line) echo "continuing from previous run, log position: " . $prev_line['message-id'] . " at " . strftime('%d.%m.%Y %H:%M:%S', $prev_line['timestamp']) . "\n";
+			}
+
+			if(file_exists('/var/log/mail.log')) {
+				$fp = fopen('/var/log/mail.log', 'r');
+				//echo "Parsing mail.log...\n";
+				$l = 0;
+				while($line = fgets($fp, 8192)) {
+					$l++;
+					//if($l % 1000 == 0) echo "\rline $l";
+					$cur_line = parse_mail_log_line($line);
+					if(!$cur_line) continue;
+
+					if($prev_line) {
+						// check if this line has to be processed
+						if($cur_line['timestamp'] < $prev_line['timestamp']) {
+							$parse_mail_log = false; // we do not need to parse the second file!
+							continue; // already processed
+						} elseif($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
+							$parse_mail_log = false; // we do not need to parse the second file!
+							$prev_line = false; // this line has already been processed but the next one has to be!
+							continue;
+						}
+					}
+
+					add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
+					foreach($cur_line['to'] as $to) {
+						add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
+					}
+					$last_line = $line; // store for the state file
+				}
+				fclose($fp);
+				//echo "\n";
+			}
+
+			if($parse_mail_log == true && file_exists('/var/log/mail.log.1')) {
+				$fp = fopen('/var/log/mail.log.1', 'r');
+				//echo "Parsing mail.log.1...\n";
+				$l = 0;
+				while($line = fgets($fp, 8192)) {
+					$l++;
+					//if($l % 1000 == 0) echo "\rline $l";
+					$cur_line = parse_mail_log_line($line);
+					if(!$cur_line) continue;
+
+					if($prev_line) {
+						// check if this line has to be processed
+						if($cur_line['timestamp'] < $prev_line['timestamp']) continue; // already processed
+						if($cur_line['timestamp'] == $prev_line['timestamp'] && $cur_line['message-id'] == $prev_line['message-id']) {
+							$prev_line = false; // this line has already been processed but the next one has to be!
+							continue;
+						}
+					}
+
+					add_mailbox_traffic($mailbox_traffic, $cur_line['from'], $cur_line['size']);
+					foreach($cur_line['to'] as $to) {
+						add_mailbox_traffic($mailbox_traffic, $to, $cur_line['size']);
+					}
+				}
+				fclose($fp);
+				//echo "\n";
+			}
+			unset($mail_rewrites);
+			unset($mail_boxes);
+
+			// Save the traffic stats in the sql database
+			$tstamp = date('Y-m');
+			$sql = "SELECT mailuser_id,email FROM mail_user WHERE server_id = ".$conf['server_id'];
+			$records = $app->db->queryAllRecords($sql);
+			foreach($records as $rec) {
+				if(array_key_exists($rec['email'], $mailbox_traffic)) {
+					$sql = "SELECT * FROM mail_traffic WHERE month = '$tstamp' AND mailuser_id = ".$rec['mailuser_id'];
+					$tr = $app->dbmaster->queryOneRecord($sql);
+
+					$mail_traffic = $tr['traffic'] + $mailbox_traffic[$rec['email']];
+					if($tr['traffic_id'] > 0) {
+						$sql = "UPDATE mail_traffic SET traffic = $mail_traffic WHERE traffic_id = ".$tr['traffic_id'];
+					} else {
+						$sql = "INSERT INTO mail_traffic (month,mailuser_id,traffic) VALUES ('$tstamp',".$rec['mailuser_id'].",$mail_traffic)";
+					}
+					$app->dbmaster->query($sql);
+					//echo $sql;
+				}
+			}
+
+			unset($mailbox_traffic);
+			if($last_line) file_put_contents($state_file, $last_line);
+		}
+
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php b/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php
index fc28bfbea12fa778adc9c1353df275f2e906eb02..4bc9a1b3c0f9d2c6cccf2cf918afa518f438882f 100644
--- a/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_clamav_log extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'log_clamav';
 
 		/* Get the data of the log */
@@ -80,13 +82,13 @@ class cronjob_monitor_clamav_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -151,28 +153,28 @@ class cronjob_monitor_clamav_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
 
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_cpu.inc.php b/server/lib/classes/cron.d/100-monitor_cpu.inc.php
index b75239bb22df83325ce15b6d9934a3da2e43d8fc..3cbf5b1f32f92ddcfbba213796be0730d7cc57b3 100644
--- a/server/lib/classes/cron.d/100-monitor_cpu.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_cpu.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_cpu extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'cpu_info';
 
 		/*
@@ -109,27 +111,27 @@ class cronjob_monitor_cpu extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_database_size.inc.php b/server/lib/classes/cron.d/100-monitor_database_size.inc.php
index 25d2cba6954a1a547349af17a7478ba9d06c1348..6ec22d8b246beff97a9d0f0be24dc70d65b7e6fd 100644
--- a/server/lib/classes/cron.d/100-monitor_database_size.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_database_size.inc.php
@@ -1,68 +1,73 @@
 <?php
 
 /**
-Copyright (c) 2013, Marius Cramer, pixcept KG
-Copyright (c) 2013, Florian Schaal, info@schaal-24.de
-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.
-*/
+ Copyright (c) 2013, Marius Cramer, pixcept KG
+ Copyright (c) 2013, Florian Schaal, info@schaal-24.de
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of ISPConfig nor the names of its contributors
+ may be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 class cronjob_monitor_database_size extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /**
-    * this function is optional if it contains no custom code 
-    */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /** 
-    * this function is optional if it contains no custom code 
-    */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+
+
+	/**
+	 * this function is optional if it contains no custom code
+	 */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+
+
+	/**
+	 * this function is optional if it contains no custom code
+	 */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
@@ -93,27 +98,27 @@ class cronjob_monitor_database_size extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php b/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php
index 706be3d7ecf09372d0ee3d9f9e45af5988056bf5..4f7f89089f2d5bf0ad2a931b2ecd003d14353770 100644
--- a/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_disk_usage.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_disk_usage extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'disk_usage';
 
 		/** The state of the disk-usage */
@@ -70,8 +72,8 @@ class cronjob_monitor_disk_usage extends cronjob {
 		/** Fetch the data of ALL devices into a array (needed for monitoring!) */
 		//$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');
+		$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);
@@ -98,9 +100,9 @@ class cronjob_monitor_disk_usage extends cronjob {
 				$usePercent = floatval($data[$i]['percent']);
 
 				//* get the free memsize
-				if(substr($data[$i]['available'],-1) == 'G') {
+				if(substr($data[$i]['available'], -1) == 'G') {
 					$freesize = floatval($data[$i]['available'])*1024;
-				} elseif(substr($data[$i]['available'],-1) == 'T') {
+				} elseif(substr($data[$i]['available'], -1) == 'T') {
 					$freesize = floatval($data[$i]['available'])*1024*1024;
 				} else {
 					$freesize = floatval($data[$i]['available']);
@@ -108,23 +110,23 @@ class cronjob_monitor_disk_usage extends cronjob {
 
 				//* We don't want to check some filesystem which have no sensible filling levels
 				switch ($data[$i]['type']) {
-					case 'iso9660':
-					case 'cramfs':
-					case 'udf':
-					case 'tmpfs':
-					case 'devtmpfs':
-					case 'udev':
-						break;
-					default:
-						if ($usePercent > 75 && $freesize < 2000)
-							$state = $this->_tools->_setState($state, 'info');
-						if ($usePercent > 80 && $freesize < 1000)
-							$state = $this->_tools->_setState($state, 'warning');
-						if ($usePercent > 90 && $freesize < 500)
-							$state = $this->_tools->_setState($state, 'critical');
-						if ($usePercent > 95 && $freesize < 100)
-							$state = $this->_tools->_setState($state, 'error');
-						break;
+				case 'iso9660':
+				case 'cramfs':
+				case 'udf':
+				case 'tmpfs':
+				case 'devtmpfs':
+				case 'udev':
+					break;
+				default:
+					if ($usePercent > 75 && $freesize < 2000)
+						$state = $this->_tools->_setState($state, 'info');
+					if ($usePercent > 80 && $freesize < 1000)
+						$state = $this->_tools->_setState($state, 'warning');
+					if ($usePercent > 90 && $freesize < 500)
+						$state = $this->_tools->_setState($state, 'critical');
+					if ($usePercent > 95 && $freesize < 100)
+						$state = $this->_tools->_setState($state, 'error');
+					break;
 				}
 			}
 		}
@@ -139,27 +141,27 @@ class cronjob_monitor_disk_usage extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_email_quota.inc.php b/server/lib/classes/cron.d/100-monitor_email_quota.inc.php
index 12bd3fed77d6b42c05c71ead39e84a63c54078d1..1939a5916c0cc787a102bdf9eb4fce2745617a5e 100644
--- a/server/lib/classes/cron.d/100-monitor_email_quota.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_email_quota.inc.php
@@ -29,40 +29,40 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_email_quota extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/15 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
+
+	// job schedule
+	protected $_schedule = '*/15 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
 		$app->uses('getconf');
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 		if($mail_config['mailbox_quota_stats'] == 'n') return;
 
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
-        
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
+
 		//* Initialize data array
 		$data = array();
 
@@ -79,15 +79,15 @@ class cronjob_monitor_email_quota extends cronjob {
 		if(is_array($mailboxes)) {
 			foreach($mailboxes as $mb) {
 				$email = $mb['email'];
-				$email_parts = explode('@',$mb['email']);
+				$email_parts = explode('@', $mb['email']);
 				$filename = $mb['maildir'].'/.quotausage';
 				if(file_exists($filename) && !is_link($filename)) {
 					$quotafile = file($filename);
 					$data[$email]['used'] = trim($quotafile['1']);
 					unset($quotafile);
 				} else {
-					exec('du -s '.escapeshellcmd($mb['maildir']),$out);
-					$parts = explode(' ',$out[0]);
+					exec('du -s '.escapeshellcmd($mb['maildir']), $out);
+					$parts = explode(' ', $out[0]);
 					$data[$email]['used'] = intval($parts[0])*1024;
 					unset($out);
 					unset($parts);
@@ -97,7 +97,7 @@ class cronjob_monitor_email_quota extends cronjob {
 
 		unset($mailboxes);
 
-				//* Dovecot quota check Courier in progress lathama@gmail.com
+		//* Dovecot quota check Courier in progress lathama@gmail.com
 		/*
 				if($dir = opendir("/var/vmail")){
 						while (($quotafiles = readdir($dir)) !== false){
@@ -111,38 +111,38 @@ class cronjob_monitor_email_quota extends cronjob {
 						closedir($dir);
 				}
 		*/
-        $res = array();
+		$res = array();
 		$res['server_id'] = $server_id;
 		$res['type'] = $type;
 		$res['data'] = $data;
 		$res['state'] = $state;
 
-        /*
+		/*
          * Insert the data into the database
          */
-        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-                'VALUES (' .
-                $res['server_id'] . ', ' .
-                "'" . $app->dbmaster->quote($res['type']) . "', " .
-                'UNIX_TIMESTAMP(), ' .
-                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-                "'" . $res['state'] . "'" .
-                ')';
-        $app->dbmaster->query($sql);
-
-        /* The new data is written, now we can delete the old one */
-        $this->_tools->delOldRecords($res['type'], $res['server_id']);
-
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
+		$app->dbmaster->query($sql);
+
+		/* The new data is written, now we can delete the old one */
+		$this->_tools->delOldRecords($res['type'], $res['server_id']);
+
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_fail2ban.inc.php b/server/lib/classes/cron.d/100-monitor_fail2ban.inc.php
index 6c77a076260204447288bac2a4d65586bed4f6aa..ffc93a45cde82fe239383713b321c3e6ebb1daeb 100644
--- a/server/lib/classes/cron.d/100-monitor_fail2ban.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_fail2ban.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_fail2ban extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'log_fail2ban';
 
 		/* This monitoring is only available if fail2ban is installed */
@@ -96,31 +98,31 @@ class cronjob_monitor_fail2ban extends cronjob {
 		$res['data'] = $data;
 		$res['state'] = $state;
 
-        /*
+		/*
          * Insert the data into the database
          */
-        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-                'VALUES (' .
-                $res['server_id'] . ', ' .
-                "'" . $app->dbmaster->quote($res['type']) . "', " .
-                'UNIX_TIMESTAMP(), ' .
-                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-                "'" . $res['state'] . "'" .
-                ')';
-        $app->dbmaster->query($sql);
-
-        /* The new data is written, now we can delete the old one */
-        $this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
+		$app->dbmaster->query($sql);
+
+		/* The new data is written, now we can delete the old one */
+		$this->_tools->delOldRecords($res['type'], $res['server_id']);
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_hd_quota.inc.php b/server/lib/classes/cron.d/100-monitor_hd_quota.inc.php
index 14f00d4c750148485a18db59bf0d4277051d5050..888dd153eaf7cd3e5e0c3a68c21dd26683d94a51 100644
--- a/server/lib/classes/cron.d/100-monitor_hd_quota.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_hd_quota.inc.php
@@ -29,35 +29,35 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_hd_quota extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		//* Initialize data array
 		$data = array();
 
@@ -134,28 +134,28 @@ class cronjob_monitor_hd_quota extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
 
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_iptables.inc.php b/server/lib/classes/cron.d/100-monitor_iptables.inc.php
index 3b25e4c7ce200f620b4df9a45ceadd7c33f93d14..a5a1c260293bec83acc20dec0bce561545fb5bf3 100644
--- a/server/lib/classes/cron.d/100-monitor_iptables.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_iptables.inc.php
@@ -29,103 +29,105 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_iptables extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
-        /* the id of the server as int */
-        $server_id = intval($conf['server_id']);
-
-        /** The type of the data */
-        $type = 'iptables_rules';
-
-        /* This monitoring is only available if fail2ban is installed */
-        system('which iptables', $retval); // Debian, Ubuntu, Fedora
-        if ($retval === 0) {
-                /*  Get the data of the log */
-                $data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S 2>/dev/null');
-
-                /*
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
+		/* the id of the server as int */
+		$server_id = intval($conf['server_id']);
+
+		/** The type of the data */
+
+
+		$type = 'iptables_rules';
+
+		/* This monitoring is only available if fail2ban is installed */
+		system('which iptables', $retval); // Debian, Ubuntu, Fedora
+		if ($retval === 0) {
+			/*  Get the data of the log */
+			$data['output'] = '<h2>iptables -S (ipv4)</h2>'.shell_exec('iptables -S 2>/dev/null');
+
+			/*
                  * At this moment, there is no state (maybe later)
                  */
-                $state = 'no_state';
-        } else {
-                $state = 'no_state';
-                $data = '';
-        }
+			$state = 'no_state';
+		} else {
+			$state = 'no_state';
+			$data = '';
+		}
 
 
-        /* This monitoring is only available if fail2ban is installed */
-        system('which ip6tables', $retval); // Debian, Ubuntu, Fedora
-        if ($retval === 0) {
-                /*  Get the data of the log */
-                $data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S 2>/dev/null');
+		/* This monitoring is only available if fail2ban is installed */
+		system('which ip6tables', $retval); // Debian, Ubuntu, Fedora
+		if ($retval === 0) {
+			/*  Get the data of the log */
+			$data['output'] .= '<br><h2>ip6tables -S (ipv6)</h2>'.shell_exec('ip6tables -S 2>/dev/null');
 
-                /*
+			/*
                  * At this moment, there is no state (maybe later)
                  */
-                $state = 'no_state';
-        } else {
-                $state = 'no_state';
-                $data = '';
-        }
-
-        $res = array();
-        $res['server_id'] = $server_id;
-        $res['type'] = $type;
-        $res['data'] = $data;
-        $res['state'] = $state;
+			$state = 'no_state';
+		} else {
+			$state = 'no_state';
+			$data = '';
+		}
+
+		$res = array();
+		$res['server_id'] = $server_id;
+		$res['type'] = $type;
+		$res['data'] = $data;
+		$res['state'] = $state;
 
 		/*
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_ispconfig_log.inc.php b/server/lib/classes/cron.d/100-monitor_ispconfig_log.inc.php
index 50674c4e20207db50ee26f3f619660f2fd99292d..1df3b02e029802657adc7c429f8e9f7b03712540 100644
--- a/server/lib/classes/cron.d/100-monitor_ispconfig_log.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_ispconfig_log.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_ispconfig_log extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'log_ispconfig';
 
 		/* Get the data of the log */
@@ -80,19 +82,22 @@ class cronjob_monitor_ispconfig_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        
+
+
+
+
+
 		/** The type of the data */
 		$type = 'log_ispc_cron';
 
@@ -118,28 +123,28 @@ class cronjob_monitor_ispconfig_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
 
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_ispconfig_version.inc.php b/server/lib/classes/cron.d/100-monitor_ispconfig_version.inc.php
index 7f4688ced5f10ada33aa8c8e8e983b8029580ccb..e24a4cb206a47fcb063867d6119fea488f125ba8 100644
--- a/server/lib/classes/cron.d/100-monitor_ispconfig_version.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_ispconfig_version.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_ispconfig_version extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'ispc_info';
 
 		/*
@@ -83,27 +85,27 @@ class cronjob_monitor_ispconfig_version extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_mail_log.inc.php b/server/lib/classes/cron.d/100-monitor_mail_log.inc.php
index 34194a712fa66926375d0aa50ca52e1b2c702441..d5613a137bb4973d8c512628d824def94bffdfd0 100644
--- a/server/lib/classes/cron.d/100-monitor_mail_log.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_mail_log.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_mail_log extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'log_mail';
 
 		/* Get the data of the log */
@@ -76,7 +78,7 @@ class cronjob_monitor_mail_log extends cronjob {
 		/*
 		 * Return the Result
 		 */
-        $res = array();
+		$res = array();
 		$res['server_id'] = $server_id;
 		$res['type'] = $type;
 		$res['data'] = $data;
@@ -86,13 +88,13 @@ class cronjob_monitor_mail_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -120,13 +122,13 @@ class cronjob_monitor_mail_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -154,27 +156,27 @@ class cronjob_monitor_mail_log extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_mail_queue.inc.php b/server/lib/classes/cron.d/100-monitor_mail_queue.inc.php
index bda9031391afc3766de6b27bfb821de605387425..b1f7089abe5a612e71589f5f966083c02fd096b7 100644
--- a/server/lib/classes/cron.d/100-monitor_mail_queue.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_mail_queue.inc.php
@@ -29,15 +29,17 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_mail_queue extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
 	private function _getIntArray($line) {
 		/** The array of float found */
+
+
 		$res = array();
 		/* First build a array from the line */
 		$data = explode(' ', $line);
@@ -49,29 +51,29 @@ class cronjob_monitor_mail_queue extends cronjob {
 		}
 		return $res;
 	}
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
@@ -111,27 +113,27 @@ class cronjob_monitor_mail_queue extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php b/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php
index 91e3d410a87e1a2b8f9926522e621b8f2f0fd7a3..05b196a39509a4789511aabbe1833d6997919981 100644
--- a/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_mem_usage extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'mem_usage';
 
 		/*
@@ -97,27 +99,27 @@ class cronjob_monitor_mem_usage extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_mongodb.inc.php b/server/lib/classes/cron.d/100-monitor_mongodb.inc.php
index a3d19c9679706461d9cf6eb9ab1512a4e99f8f5d..23f31718c6ac3dba9616fa5eafe2bd281e33a193 100644
--- a/server/lib/classes/cron.d/100-monitor_mongodb.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_mongodb.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_mongodb extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'log_mongodb';
 
 		/* This monitoring is only available if MongoDB is installed */
@@ -96,31 +98,31 @@ class cronjob_monitor_mongodb extends cronjob {
 		$res['data'] = $data;
 		$res['state'] = $state;
 
-        /*
+		/*
          * Insert the data into the database
          */
-        $sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-                'VALUES (' .
-                $res['server_id'] . ', ' .
-                "'" . $app->dbmaster->quote($res['type']) . "', " .
-                'UNIX_TIMESTAMP(), ' .
-                "'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-                "'" . $res['state'] . "'" .
-                ')';
-        $app->dbmaster->query($sql);
-
-        /* The new data is written, now we can delete the old one */
-        $this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
+		$app->dbmaster->query($sql);
+
+		/* The new data is written, now we can delete the old one */
+		$this->_tools->delOldRecords($res['type'], $res['server_id']);
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_openvz.inc.php b/server/lib/classes/cron.d/100-monitor_openvz.inc.php
index 2abe6ccd21ca219a81571f66149553eaa1f4ef7a..08d155fae776e6887b196ab9356cdbdb5e3ab8e5 100644
--- a/server/lib/classes/cron.d/100-monitor_openvz.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_openvz.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_openvz extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'openvz_veinfo';
 
 		/*
@@ -74,7 +76,7 @@ class cronjob_monitor_openvz extends cronjob {
 		/* the VE-Info has no state. It is, what it is */
 		$state = 'no_state';
 
-        $res = array();
+		$res = array();
 		$res['server_id'] = $server_id;
 		$res['type'] = $type;
 		$res['data'] = $data;
@@ -84,13 +86,13 @@ class cronjob_monitor_openvz extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -156,27 +158,27 @@ class cronjob_monitor_openvz extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_os_version.inc.php b/server/lib/classes/cron.d/100-monitor_os_version.inc.php
index a5f213e141218e3a01ea0c3efbadcb452e46bcb8..b9978eaeb27644b21fabe1992c02925233116bdc 100644
--- a/server/lib/classes/cron.d/100-monitor_os_version.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_os_version.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_os_version extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = $app->functions->intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'os_info';
 
 		/*
@@ -80,32 +82,32 @@ class cronjob_monitor_os_version extends cronjob {
 		$res['type'] = $type;
 		$res['data'] = $data;
 		$res['state'] = $state;
-		
+
 		/*
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_raid.inc.php b/server/lib/classes/cron.d/100-monitor_raid.inc.php
index d49540e82fcbdae316eccc9bda6b454e83cfbf4a..9edd061cbe919032e63ef522851688cf52aef62d 100644
--- a/server/lib/classes/cron.d/100-monitor_raid.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_raid.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_raid extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'raid_state';
 
 		/*
@@ -179,50 +181,50 @@ class cronjob_monitor_raid extends cronjob {
 
 			$state = 'ok';
 			if(is_array($data['output'])) {
-			foreach ($data['output'] as $item) {
-				if (strpos($item, 'RAID') !== false) {
-					if (strpos($item, ' VERIFYING ') !== false) {
-						$this->_tools->_setState($state, 'info');
-					}
-					else if (strpos($item, ' MIGRATE-PAUSED ') !== false) {
-						$this->_tools->_setState($state, 'info');
-					}
-					else if (strpos($item, ' MIGRATING ') !== false) {
-						$this->_tools->_setState($state, 'ok');
-					}
-					else if (strpos($item, ' INITIALIZING ') !== false) {
-						$this->_tools->_setState($state, 'info');
-					}
-					else if (strpos($item, ' INIT-PAUSED ') !== false) {
-						$this->_tools->_setState($state, 'info');
-					}
-					else if (strpos($item, ' REBUILDING ') !== false) {
-						$this->_tools->_setState($state, 'info');
-					}
-					else if (strpos($item, ' REBUILD-PAUSED ') !== false) {
-						$this->_tools->_setState($state, 'warning');
-					}
-					else if (strpos($item, ' RECOVERY ') !== false) {
-						$this->_tools->_setState($state, 'warning');
-					}
-					else if (strpos($item, ' DEGRADED ') !== false) {
-						$this->_tools->_setState($state, 'critical');
-					}
-					else if (strpos($item, ' UNKNOWN ') !== false) {
-						$this->_tools->_setState($state, 'critical');
-					}
-					else if (strpos($item, ' OK ') !== false) {
-						$this->_tools->_setState($state, 'ok');
-					}
-					else if (strpos($item, ' OPTIMAL ') !== false) {
-						$this->_tools->_setState($state, 'ok');
-					}
-					else {
-						$this->_tools->_setState($state, 'critical');
+				foreach ($data['output'] as $item) {
+					if (strpos($item, 'RAID') !== false) {
+						if (strpos($item, ' VERIFYING ') !== false) {
+							$this->_tools->_setState($state, 'info');
+						}
+						else if (strpos($item, ' MIGRATE-PAUSED ') !== false) {
+								$this->_tools->_setState($state, 'info');
+							}
+						else if (strpos($item, ' MIGRATING ') !== false) {
+								$this->_tools->_setState($state, 'ok');
+							}
+						else if (strpos($item, ' INITIALIZING ') !== false) {
+								$this->_tools->_setState($state, 'info');
+							}
+						else if (strpos($item, ' INIT-PAUSED ') !== false) {
+								$this->_tools->_setState($state, 'info');
+							}
+						else if (strpos($item, ' REBUILDING ') !== false) {
+								$this->_tools->_setState($state, 'info');
+							}
+						else if (strpos($item, ' REBUILD-PAUSED ') !== false) {
+								$this->_tools->_setState($state, 'warning');
+							}
+						else if (strpos($item, ' RECOVERY ') !== false) {
+								$this->_tools->_setState($state, 'warning');
+							}
+						else if (strpos($item, ' DEGRADED ') !== false) {
+								$this->_tools->_setState($state, 'critical');
+							}
+						else if (strpos($item, ' UNKNOWN ') !== false) {
+								$this->_tools->_setState($state, 'critical');
+							}
+						else if (strpos($item, ' OK ') !== false) {
+								$this->_tools->_setState($state, 'ok');
+							}
+						else if (strpos($item, ' OPTIMAL ') !== false) {
+								$this->_tools->_setState($state, 'ok');
+							}
+						else {
+							$this->_tools->_setState($state, 'critical');
+						}
 					}
 				}
 			}
-			}
 		}
 
 
@@ -236,27 +238,27 @@ class cronjob_monitor_raid extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_rkhunter.inc.php b/server/lib/classes/cron.d/100-monitor_rkhunter.inc.php
index ba992dacfc51d6d79264d14121ee1e90dd49d874..5d99d7f4e470a6288b0fdd549834cbefdc0503f6 100644
--- a/server/lib/classes/cron.d/100-monitor_rkhunter.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_rkhunter.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_rkhunter extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'rkhunter';
 
 		/* This monitoring is only available if rkhunter is installed */
@@ -100,27 +102,27 @@ class cronjob_monitor_rkhunter extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_server.inc.php b/server/lib/classes/cron.d/100-monitor_server.inc.php
index b732578301f79b55704cd75c135bd676f3fc6a82..6ceb584cf5e6d6189343a1997ecebdc13410d7d8 100644
--- a/server/lib/classes/cron.d/100-monitor_server.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_server.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_server extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'server_load';
 
 		/*
@@ -106,27 +108,27 @@ class cronjob_monitor_server extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_services.inc.php b/server/lib/classes/cron.d/100-monitor_services.inc.php
index f3e9e72f2d046384b5805bf1fb25195e2b541e63..3235ee781fb0af71e0553e0d3982a21597cdc051 100644
--- a/server/lib/classes/cron.d/100-monitor_services.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_services.inc.php
@@ -29,35 +29,35 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_services extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/*
 		 * First we get the Monitoring-data from the tools
 		 */
@@ -67,27 +67,27 @@ class cronjob_monitor_services extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_syslog.inc.php b/server/lib/classes/cron.d/100-monitor_syslog.inc.php
index 8aa87451982c925692eef6c7b60689950b1281c3..b62112179c23895f0dd37a2253b5981cb79f4f61 100644
--- a/server/lib/classes/cron.d/100-monitor_syslog.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_syslog.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_syslog extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '*/5 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '*/5 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'sys_log';
 
 		/*
@@ -91,13 +93,13 @@ class cronjob_monitor_syslog extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
@@ -125,28 +127,28 @@ class cronjob_monitor_syslog extends cronjob {
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
 
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/100-monitor_system_update.inc.php b/server/lib/classes/cron.d/100-monitor_system_update.inc.php
index 022d667154ea6e295585f40774da7da745e6189b..e6cf821477a0321d8ab56c358df9663fb74c9016 100644
--- a/server/lib/classes/cron.d/100-monitor_system_update.inc.php
+++ b/server/lib/classes/cron.d/100-monitor_system_update.inc.php
@@ -29,39 +29,41 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_monitor_system_update extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 * * * *';
-    protected $_run_at_new = true;
-	
-    private $_tools = null;
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        /* used for all monitor cronjobs */
-        $app->load('monitor_tools');
-        $this->_tools = new monitor_tools();
-        /* end global section for monitor cronjobs */
-        
+
+	// job schedule
+	protected $_schedule = '0 * * * *';
+	protected $_run_at_new = true;
+
+	private $_tools = null;
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
+
 		/* the id of the server as int */
 		$server_id = intval($conf['server_id']);
 
 		/** The type of the data */
+
+
 		$type = 'system_update';
 
 		/* This monitoring is only available on Debian or Ubuntu */
@@ -175,33 +177,33 @@ class cronjob_monitor_system_update extends cronjob {
 
 		//* 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'],ENT_QUOTES,'UTF-8');
+		$res['data']['output'] = htmlentities($res['data']['output'], ENT_QUOTES, 'UTF-8');
 
 		/*
 		 * Insert the data into the database
 		 */
 		$sql = 'REPLACE INTO monitor_data (server_id, type, created, data, state) ' .
-				'VALUES (' .
-				$res['server_id'] . ', ' .
-				"'" . $app->dbmaster->quote($res['type']) . "', " .
-				'UNIX_TIMESTAMP(), ' .
-				"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
-				"'" . $res['state'] . "'" .
-				')';
+			'VALUES (' .
+			$res['server_id'] . ', ' .
+			"'" . $app->dbmaster->quote($res['type']) . "', " .
+			'UNIX_TIMESTAMP(), ' .
+			"'" . $app->dbmaster->quote(serialize($res['data'])) . "', " .
+			"'" . $res['state'] . "'" .
+			')';
 		$app->dbmaster->query($sql);
 
 		/* The new data is written, now we can delete the old one */
 		$this->_tools->delOldRecords($res['type'], $res['server_id']);
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/150-awstats.inc.php b/server/lib/classes/cron.d/150-awstats.inc.php
index 0638f0973851518921c8f247e5b65593a67e82f6..7c59b57b90c592ea08a5399e7c6c61bda3b2b9e2 100644
--- a/server/lib/classes/cron.d/150-awstats.inc.php
+++ b/server/lib/classes/cron.d/150-awstats.inc.php
@@ -29,154 +29,154 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_awstats extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        #######################################################################################################
-        // Create awstats statistics
-        #######################################################################################################
-
-        $sql = "SELECT domain_id, domain, document_root, web_folder, type, system_user, system_group, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'awstats' AND server_id = ".$conf['server_id'];
-        $records = $app->db->queryAllRecords($sql);
-
-        $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-
-        foreach($records as $rec) {
-            //$yesterday = date('Ymd',time() - 86400);
-            $yesterday = date('Ymd',strtotime("-1 day", time()));
-
-            $log_folder = 'log';
-            if($rec['type'] == 'vhostsubdomain') {
-                $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
-                $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
-                if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
-                $log_folder .= '/' . $subdomain_host;
-                unset($tmp);
-            }
-            $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
-            if(!@is_file($logfile)) {
-                $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
-                if(!@is_file($logfile)) {
-                    continue;
-                }
-            }
-            $web_folder = ($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web');
-            $domain = escapeshellcmd($rec['domain']);
-            $statsdir = escapeshellcmd($rec['document_root'].'/'.$web_folder.'/stats');
-            $awstats_pl = $web_config['awstats_pl'];
-            $awstats_buildstaticpages_pl = $web_config['awstats_buildstaticpages_pl'];
-
-            $awstats_conf_dir = $web_config['awstats_conf_dir'];
-            $awstats_website_conf_file = $web_config['awstats_conf_dir'].'/awstats.'.$domain.'.conf';
-
-            if(is_file($awstats_website_conf_file)) unlink($awstats_website_conf_file);
-
-            $sql = "SELECT domain FROM web_domain WHERE (type = 'alias' OR type = 'subdomain') AND parent_domain_id = ".$rec['domain_id'];
-            $aliases = $app->db->queryAllRecords($sql);
-            $aliasdomain = '';
-
-            if(is_array($aliases)) {
-                foreach ($aliases as $alias) {
-                    $aliasdomain.= ' '.$alias['domain']. ' www.'.$alias['domain'];
-                }
-            }
-
-            if(!is_file($awstats_website_conf_file)) {
-                $awstats_conf_file_content = 'Include "'.$awstats_conf_dir.'/awstats.conf"
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//######################################################################################################
+		// Create awstats statistics
+		//######################################################################################################
+
+		$sql = "SELECT domain_id, domain, document_root, web_folder, type, system_user, system_group, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'awstats' AND server_id = ".$conf['server_id'];
+		$records = $app->db->queryAllRecords($sql);
+
+		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+
+		foreach($records as $rec) {
+			//$yesterday = date('Ymd',time() - 86400);
+			$yesterday = date('Ymd', strtotime("-1 day", time()));
+
+			$log_folder = 'log';
+			if($rec['type'] == 'vhostsubdomain') {
+				$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
+				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
+				if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
+				$log_folder .= '/' . $subdomain_host;
+				unset($tmp);
+			}
+			$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
+			if(!@is_file($logfile)) {
+				$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
+				if(!@is_file($logfile)) {
+					continue;
+				}
+			}
+			$web_folder = ($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web');
+			$domain = escapeshellcmd($rec['domain']);
+			$statsdir = escapeshellcmd($rec['document_root'].'/'.$web_folder.'/stats');
+			$awstats_pl = $web_config['awstats_pl'];
+			$awstats_buildstaticpages_pl = $web_config['awstats_buildstaticpages_pl'];
+
+			$awstats_conf_dir = $web_config['awstats_conf_dir'];
+			$awstats_website_conf_file = $web_config['awstats_conf_dir'].'/awstats.'.$domain.'.conf';
+
+			if(is_file($awstats_website_conf_file)) unlink($awstats_website_conf_file);
+
+			$sql = "SELECT domain FROM web_domain WHERE (type = 'alias' OR type = 'subdomain') AND parent_domain_id = ".$rec['domain_id'];
+			$aliases = $app->db->queryAllRecords($sql);
+			$aliasdomain = '';
+
+			if(is_array($aliases)) {
+				foreach ($aliases as $alias) {
+					$aliasdomain.= ' '.$alias['domain']. ' www.'.$alias['domain'];
+				}
+			}
+
+			if(!is_file($awstats_website_conf_file)) {
+				$awstats_conf_file_content = 'Include "'.$awstats_conf_dir.'/awstats.conf"
         LogFile="/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log"
         SiteDomain="'.$domain.'"
         HostAliases="www.'.$domain.' localhost 127.0.0.1'.$aliasdomain.'"';
-                file_put_contents($awstats_website_conf_file,$awstats_conf_file_content);
-            }
-
-            if(!@is_dir($statsdir)) mkdir($statsdir);
-            if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
-            symlink($logfile,'/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
-
-            $awmonth = date("n");
-            $awyear = date("Y");
-
-            if (date("d") == 1) {
-                $awmonth = date("m")-1;
-                if (date("m") == 1) {
-                    $awyear = date("Y")-1;
-                    $awmonth = "12";
-                }
-            }
-
-            // awstats_buildstaticpages.pl -update -config=mydomain.com -lang=en -dir=/var/www/domain.com/'.$web_folder.'/stats -awstatsprog=/path/to/awstats.pl
-            // $command = "$awstats_buildstaticpages_pl -update -config='$domain' -lang=".$conf['language']." -dir='$statsdir' -awstatsprog='$awstats_pl'";
-
-            $command = "$awstats_buildstaticpages_pl -month='$awmonth' -year='$awyear' -update -config='$domain' -lang=".$conf['language']." -dir='$statsdir' -awstatsprog='$awstats_pl'";
-
-            if (date("d") == 2) {
-                $awmonth = date("m")-1;
-                if (date("m") == 1) {
-                    $awyear = date("Y")-1;
-                    $awmonth = "12";
-                }
-
-                $statsdirold = $statsdir."/".$awyear."-".$awmonth."/";
-                mkdir($statsdirold);
-                $files = scandir($statsdir);
-                foreach ($files as $file) {
-                    if (substr($file,0,1) != "." && !is_dir("$statsdir"."/"."$file") && substr($file,0,1) != "w" && substr($file,0,1) != "i") copy("$statsdir"."/"."$file","$statsdirold"."$file");
-                }
-            }
-
-
-            if($awstats_pl != '' && $awstats_buildstaticpages_pl != '' && fileowner($awstats_pl) == 0 && fileowner($awstats_buildstaticpages_pl) == 0) {
-                exec($command);
-                if(is_file($rec['document_root'].'/'.$web_folder.'/stats/index.html')) unlink($rec['document_root'].'/'.$web_folder.'/stats/index.html');
-                rename($rec['document_root'].'/'.$web_folder.'/stats/awstats.'.$domain.'.html',$rec['document_root'].'/'.$web_folder.'/stats/awsindex.html');
-                if(!is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
-                    if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
-                        copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
-                    } else {
-                        copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$rec['document_root']."/".$web_folder."/stats/index.php");
-                    }
-                }
-
-                $app->log('Created awstats statistics with command: '.$command,LOGLEVEL_DEBUG);
-            } else {
-                $app->log("No awstats statistics created. Either $awstats_pl or $awstats_buildstaticpages_pl is not owned by root user.",LOGLEVEL_WARN);
-            }
-
-            if(is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
-                chown($rec['document_root']."/".$web_folder."/stats/index.php",$rec['system_user']);
-                chgrp($rec['document_root']."/".$web_folder."/stats/index.php",$rec['system_group']);
-            }
-
-        }
-        
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+				file_put_contents($awstats_website_conf_file, $awstats_conf_file_content);
+			}
+
+			if(!@is_dir($statsdir)) mkdir($statsdir);
+			if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
+			symlink($logfile, '/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
+
+			$awmonth = date("n");
+			$awyear = date("Y");
+
+			if (date("d") == 1) {
+				$awmonth = date("m")-1;
+				if (date("m") == 1) {
+					$awyear = date("Y")-1;
+					$awmonth = "12";
+				}
+			}
+
+			// awstats_buildstaticpages.pl -update -config=mydomain.com -lang=en -dir=/var/www/domain.com/'.$web_folder.'/stats -awstatsprog=/path/to/awstats.pl
+			// $command = "$awstats_buildstaticpages_pl -update -config='$domain' -lang=".$conf['language']." -dir='$statsdir' -awstatsprog='$awstats_pl'";
+
+			$command = "$awstats_buildstaticpages_pl -month='$awmonth' -year='$awyear' -update -config='$domain' -lang=".$conf['language']." -dir='$statsdir' -awstatsprog='$awstats_pl'";
+
+			if (date("d") == 2) {
+				$awmonth = date("m")-1;
+				if (date("m") == 1) {
+					$awyear = date("Y")-1;
+					$awmonth = "12";
+				}
+
+				$statsdirold = $statsdir."/".$awyear."-".$awmonth."/";
+				mkdir($statsdirold);
+				$files = scandir($statsdir);
+				foreach ($files as $file) {
+					if (substr($file, 0, 1) != "." && !is_dir("$statsdir"."/"."$file") && substr($file, 0, 1) != "w" && substr($file, 0, 1) != "i") copy("$statsdir"."/"."$file", "$statsdirold"."$file");
+				}
+			}
+
+
+			if($awstats_pl != '' && $awstats_buildstaticpages_pl != '' && fileowner($awstats_pl) == 0 && fileowner($awstats_buildstaticpages_pl) == 0) {
+				exec($command);
+				if(is_file($rec['document_root'].'/'.$web_folder.'/stats/index.html')) unlink($rec['document_root'].'/'.$web_folder.'/stats/index.html');
+				rename($rec['document_root'].'/'.$web_folder.'/stats/awstats.'.$domain.'.html', $rec['document_root'].'/'.$web_folder.'/stats/awsindex.html');
+				if(!is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
+					if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
+						copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $rec['document_root']."/".$web_folder."/stats/index.php");
+					} else {
+						copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $rec['document_root']."/".$web_folder."/stats/index.php");
+					}
+				}
+
+				$app->log('Created awstats statistics with command: '.$command, LOGLEVEL_DEBUG);
+			} else {
+				$app->log("No awstats statistics created. Either $awstats_pl or $awstats_buildstaticpages_pl is not owned by root user.", LOGLEVEL_WARN);
+			}
+
+			if(is_file($rec['document_root']."/".$web_folder."/stats/index.php")) {
+				chown($rec['document_root']."/".$web_folder."/stats/index.php", $rec['system_user']);
+				chgrp($rec['document_root']."/".$web_folder."/stats/index.php", $rec['system_group']);
+			}
+
+		}
+
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/150-webalizer.inc.php b/server/lib/classes/cron.d/150-webalizer.inc.php
index ba75b8b95aa3afc02ff83e0e431d345ab10b13db..fb1d76d4230791c76138ec0530c3ba8e3e3cb4a2 100644
--- a/server/lib/classes/cron.d/150-webalizer.inc.php
+++ b/server/lib/classes/cron.d/150-webalizer.inc.php
@@ -29,113 +29,113 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_webalizer extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        #######################################################################################################
-        // Create webalizer statistics
-        #######################################################################################################
-
-        function setConfigVar( $filename, $varName, $varValue, $append = 0 ) {
-            if($lines = @file($filename)) {
-                $out = '';
-                $found = 0;
-                foreach($lines as $line) {
-                    @list($key, $value) = preg_split('/[\t= ]+/', $line, 2);
-                    if($key == $varName) {
-                        $out .= $varName.' '.$varValue."\n";
-                        $found = 1;
-                    } else {
-                        $out .= $line;
-                    }
-                }
-                if($found == 0) {
-                    //* add \n if the last line does not end with \n or \r
-                    if(substr($out,-1) != "\n" && substr($out,-1) != "\r") $out .= "\n";
-                    //* add the new line at the end of the file
-                    if($append == 1) $out .= $varName.' '.$varValue."\n";
-                }
-
-                file_put_contents($filename,$out);
-            }
-        }
-
-
-        $sql = "SELECT domain_id, domain, document_root, web_folder, type, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'webalizer' AND server_id = ".$conf['server_id'];
-        $records = $app->db->queryAllRecords($sql);
-
-        foreach($records as $rec) {
-            //$yesterday = date('Ymd',time() - 86400);
-            $yesterday = date('Ymd',strtotime("-1 day", time()));
-
-            $log_folder = 'log';
-            if($rec['type'] == 'vhostsubdomain') {
-                $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
-                $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
-                if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
-                $log_folder .= '/' . $subdomain_host;
-                unset($tmp);
-            }
-            $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
-            if(!@is_file($logfile)) {
-                $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
-                if(!@is_file($logfile)) {
-                    continue;
-                }
-            }
-
-            $domain = escapeshellcmd($rec['domain']);
-            $statsdir = escapeshellcmd($rec['document_root'].'/'.($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web').'/stats');
-            $webalizer = '/usr/bin/webalizer';
-            $webalizer_conf_main = '/etc/webalizer/webalizer.conf';
-            $webalizer_conf = escapeshellcmd($rec['document_root'].'/log/webalizer.conf');
-
-            if(is_file($statsdir.'/index.php')) unlink($statsdir.'/index.php');
-
-            if(!@is_file($webalizer_conf)) {
-                copy($webalizer_conf_main,$webalizer_conf);
-            }
-
-            if(@is_file($webalizer_conf)) {
-                setConfigVar($webalizer_conf, 'Incremental', 'yes');
-                setConfigVar($webalizer_conf, 'IncrementalName', $statsdir.'/webalizer.current');
-                setConfigVar($webalizer_conf, 'HistoryName', $statsdir.'/webalizer.hist');
-            }
-
-
-            if(!@is_dir($statsdir)) mkdir($statsdir);
-            exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir $logfile");
-        }
-
-        
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//######################################################################################################
+		// Create webalizer statistics
+		//######################################################################################################
+
+		function setConfigVar( $filename, $varName, $varValue, $append = 0 ) {
+			if($lines = @file($filename)) {
+				$out = '';
+				$found = 0;
+				foreach($lines as $line) {
+					@list($key, $value) = preg_split('/[\t= ]+/', $line, 2);
+					if($key == $varName) {
+						$out .= $varName.' '.$varValue."\n";
+						$found = 1;
+					} else {
+						$out .= $line;
+					}
+				}
+				if($found == 0) {
+					//* add \n if the last line does not end with \n or \r
+					if(substr($out, -1) != "\n" && substr($out, -1) != "\r") $out .= "\n";
+					//* add the new line at the end of the file
+					if($append == 1) $out .= $varName.' '.$varValue."\n";
+				}
+
+				file_put_contents($filename, $out);
+			}
+		}
+
+
+		$sql = "SELECT domain_id, domain, document_root, web_folder, type, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'webalizer' AND server_id = ".$conf['server_id'];
+		$records = $app->db->queryAllRecords($sql);
+
+		foreach($records as $rec) {
+			//$yesterday = date('Ymd',time() - 86400);
+			$yesterday = date('Ymd', strtotime("-1 day", time()));
+
+			$log_folder = 'log';
+			if($rec['type'] == 'vhostsubdomain') {
+				$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
+				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
+				if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
+				$log_folder .= '/' . $subdomain_host;
+				unset($tmp);
+			}
+			$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log');
+			if(!@is_file($logfile)) {
+				$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log.gz');
+				if(!@is_file($logfile)) {
+					continue;
+				}
+			}
+
+			$domain = escapeshellcmd($rec['domain']);
+			$statsdir = escapeshellcmd($rec['document_root'].'/'.($rec['type'] == 'vhostsubdomain' ? $rec['web_folder'] : 'web').'/stats');
+			$webalizer = '/usr/bin/webalizer';
+			$webalizer_conf_main = '/etc/webalizer/webalizer.conf';
+			$webalizer_conf = escapeshellcmd($rec['document_root'].'/log/webalizer.conf');
+
+			if(is_file($statsdir.'/index.php')) unlink($statsdir.'/index.php');
+
+			if(!@is_file($webalizer_conf)) {
+				copy($webalizer_conf_main, $webalizer_conf);
+			}
+
+			if(@is_file($webalizer_conf)) {
+				setConfigVar($webalizer_conf, 'Incremental', 'yes');
+				setConfigVar($webalizer_conf, 'IncrementalName', $statsdir.'/webalizer.current');
+				setConfigVar($webalizer_conf, 'HistoryName', $statsdir.'/webalizer.hist');
+			}
+
+
+			if(!@is_dir($statsdir)) mkdir($statsdir);
+			exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir $logfile");
+		}
+
+
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/200-logfiles.inc.php b/server/lib/classes/cron.d/200-logfiles.inc.php
index 862f0f4ef32c2a4859ff36f60c42ef59c7459129..addbf216386a1e30e242fa53228c4975140729d2 100644
--- a/server/lib/classes/cron.d/200-logfiles.inc.php
+++ b/server/lib/classes/cron.d/200-logfiles.inc.php
@@ -29,194 +29,196 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_logfiles extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        #######################################################################################################
-        // Make the web logfiles directories world readable to enable ftp access
-        #######################################################################################################
-
-        if(is_dir('/var/log/ispconfig/httpd')) exec('chmod +r /var/log/ispconfig/httpd/*');
-
-        #######################################################################################################
-        // Manage and compress web logfiles and create traffic statistics
-        #######################################################################################################
-
-        $sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') AND server_id = ".$conf['server_id'];
-        $records = $app->db->queryAllRecords($sql);
-        foreach($records as $rec) {
-
-            //* create traffic statistics based on yesterdays access log file
-            $yesterday = date('Ymd',time() - 86400);
-
-            $log_folder = 'log';
-            if($rec['type'] == 'vhostsubdomain') {
-                $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
-                $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
-                if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
-                $log_folder .= '/' . $subdomain_host;
-                unset($tmp);
-            }
-
-            $logfile = $rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log';
-            $total_bytes = 0;
-
-            $handle = @fopen($logfile, "r");
-            if ($handle) {
-                while (($line = fgets($handle, 4096)) !== false) {
-                    if (preg_match('/^\S+ \S+ \S+ \[.*?\] "\S+.*?" \d+ (\d+) ".*?" ".*?"/', $line, $m)) {
-                        $total_bytes += intval($m[1]);
-                    }
-                }
-
-                //* Insert / update traffic in master database
-                $traffic_date = date('Y-m-d',time() - 86400);
-                $tmp = $app->dbmaster->queryOneRecord("select hostname from web_traffic where hostname='".$rec['domain']."' and traffic_date='".$traffic_date."'");
-                if(is_array($tmp) && count($tmp) > 0) {
-                    $sql = "update web_traffic set traffic_bytes=traffic_bytes+"
-                          . $total_bytes
-                          . " where hostname='" . $rec['domain']
-                          . "' and traffic_date='" . $traffic_date . "'";
-                } else {
-                    $sql = "insert into web_traffic (hostname, traffic_date, traffic_bytes) values ('".$rec['domain']."', '".$traffic_date."', '".$total_bytes."')";
-                }
-                $app->dbmaster->query($sql);
-
-                fclose($handle);
-            }
-
-            $yesterday2 = date('Ymd',time() - 86400*2);
-            $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday2.'-access.log');
-
-            //* Compress logfile
-            if(@is_file($logfile)) {
-                // Compress yesterdays logfile
-                exec("gzip -c $logfile > $logfile.gz");
-                unlink($logfile);
-            }
-
-            // rotate and compress the error.log when it exceeds a size of 10 MB
-            $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/error.log');
-            if(is_file($logfile) && filesize($logfile) > 10000000) {
-                exec("gzip -c $logfile > $logfile.1.gz");
-                exec("cat /dev/null > $logfile");
-            }
-
-            // delete logfiles after 30 days
-            $month_ago = date('Ymd',time() - 86400 * 30);
-            $logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$month_ago.'-access.log.gz');
-            if(@is_file($logfile)) {
-                unlink($logfile);
-            }
-
-            //* Delete older Log files, in case that we missed them before due to serverdowntimes.
-            $datepart = date('Ym',time() - 86400 * 31 * 2);
-
-            $logfile = escapeshellcmd($rec['document_root']).'/' . $log_folder . '/'.$datepart.'*-access.log.gz';
-            exec('rm -f '.$logfile);
-
-            $logfile = escapeshellcmd($rec['document_root']).'/' . $log_folder . '/'.$datepart.'*-access.log';
-            exec('rm -f '.$logfile);
-        }
-
-        //* Delete old logfiles in /var/log/ispconfig/httpd/ that were created by vlogger for the hostname of the server
-        exec('hostname -f', $tmp_hostname);
-        if($tmp_hostname[0] != '' && is_dir('/var/log/ispconfig/httpd/'.$tmp_hostname[0])) {
-            exec('cd /var/log/ispconfig/httpd/'.$tmp_hostname[0]."; find . -mtime +30 -name '*.log' | xargs rm > /dev/null 2> /dev/null");
-        }
-        unset($tmp_hostname);
-
-        #######################################################################################################
-        // Rotate the ispconfig.log file
-        #######################################################################################################
-
-        // rotate the ispconfig.log when it exceeds a size of 10 MB
-        $logfile = $conf['ispconfig_log_dir'].'/ispconfig.log';
-        if(is_file($logfile) && filesize($logfile) > 10000000) {
-            exec("gzip -c $logfile > $logfile.1.gz");
-            exec("cat /dev/null > $logfile");
-        }
-
-        // rotate the cron.log when it exceeds a size of 10 MB
-        $logfile = $conf['ispconfig_log_dir'].'/cron.log';
-        if(is_file($logfile) && filesize($logfile) > 10000000) {
-            exec("gzip -c $logfile > $logfile.1.gz");
-            exec("cat /dev/null > $logfile");
-        }
-
-        // rotate the auth.log when it exceeds a size of 10 MB
-        $logfile = $conf['ispconfig_log_dir'].'/auth.log';
-        if(is_file($logfile) && filesize($logfile) > 10000000) {
-            exec("gzip -c $logfile > $logfile.1.gz");
-            exec("cat /dev/null > $logfile");
-        }
-
-        #######################################################################################################
-        // Cleanup website tmp directories
-        #######################################################################################################
-
-        $sql = "SELECT domain_id, domain, document_root, system_user FROM web_domain WHERE server_id = ".$conf['server_id'];
-        $records = $app->db->queryAllRecords($sql);
-        $app->uses('system');
-        if(is_array($records)) {
-            foreach($records as $rec){
-                $tmp_path = realpath(escapeshellcmd($rec['document_root'].'/tmp'));
-                if($tmp_path != '' && strlen($tmp_path) > 10 && is_dir($tmp_path) && $app->system->is_user($rec['system_user'])){
-                    exec('cd '.$tmp_path."; find . -mtime +1 -name 'sess_*' | grep -v -w .no_delete | xargs rm > /dev/null 2> /dev/null");
-                }
-            }
-        }
-
-        #######################################################################################################
-        // Cleanup logs in master database (only the "master-server")
-        #######################################################################################################
-
-        if ($app->dbmaster == $app->db) {
-            /** 7 days */
-            $tstamp = time() - (60*60*24*7);
-
-            /*
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//######################################################################################################
+		// Make the web logfiles directories world readable to enable ftp access
+		//######################################################################################################
+
+		if(is_dir('/var/log/ispconfig/httpd')) exec('chmod +r /var/log/ispconfig/httpd/*');
+
+		//######################################################################################################
+		// Manage and compress web logfiles and create traffic statistics
+		//######################################################################################################
+
+		$sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') AND server_id = ".$conf['server_id'];
+		$records = $app->db->queryAllRecords($sql);
+		foreach($records as $rec) {
+
+			//* create traffic statistics based on yesterdays access log file
+			$yesterday = date('Ymd', time() - 86400);
+
+			$log_folder = 'log';
+			if($rec['type'] == 'vhostsubdomain') {
+				$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($rec['parent_domain_id']));
+				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $rec['domain']);
+				if($subdomain_host == '') $subdomain_host = 'web'.$rec['domain_id'];
+				$log_folder .= '/' . $subdomain_host;
+				unset($tmp);
+			}
+
+			$logfile = $rec['document_root'].'/' . $log_folder . '/'.$yesterday.'-access.log';
+			$total_bytes = 0;
+
+			$handle = @fopen($logfile, "r");
+			if ($handle) {
+				while (($line = fgets($handle, 4096)) !== false) {
+					if (preg_match('/^\S+ \S+ \S+ \[.*?\] "\S+.*?" \d+ (\d+) ".*?" ".*?"/', $line, $m)) {
+						$total_bytes += intval($m[1]);
+					}
+				}
+
+				//* Insert / update traffic in master database
+				$traffic_date = date('Y-m-d', time() - 86400);
+				$tmp = $app->dbmaster->queryOneRecord("select hostname from web_traffic where hostname='".$rec['domain']."' and traffic_date='".$traffic_date."'");
+				if(is_array($tmp) && count($tmp) > 0) {
+					$sql = "update web_traffic set traffic_bytes=traffic_bytes+"
+						. $total_bytes
+						. " where hostname='" . $rec['domain']
+						. "' and traffic_date='" . $traffic_date . "'";
+				} else {
+					$sql = "insert into web_traffic (hostname, traffic_date, traffic_bytes) values ('".$rec['domain']."', '".$traffic_date."', '".$total_bytes."')";
+				}
+				$app->dbmaster->query($sql);
+
+				fclose($handle);
+			}
+
+			$yesterday2 = date('Ymd', time() - 86400*2);
+			$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$yesterday2.'-access.log');
+
+			//* Compress logfile
+			if(@is_file($logfile)) {
+				// Compress yesterdays logfile
+				exec("gzip -c $logfile > $logfile.gz");
+				unlink($logfile);
+			}
+
+			// rotate and compress the error.log when it exceeds a size of 10 MB
+			$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/error.log');
+			if(is_file($logfile) && filesize($logfile) > 10000000) {
+				exec("gzip -c $logfile > $logfile.1.gz");
+				exec("cat /dev/null > $logfile");
+			}
+
+			// delete logfiles after 30 days
+			$month_ago = date('Ymd', time() - 86400 * 30);
+			$logfile = escapeshellcmd($rec['document_root'].'/' . $log_folder . '/'.$month_ago.'-access.log.gz');
+			if(@is_file($logfile)) {
+				unlink($logfile);
+			}
+
+			//* Delete older Log files, in case that we missed them before due to serverdowntimes.
+			$datepart = date('Ym', time() - 86400 * 31 * 2);
+
+			$logfile = escapeshellcmd($rec['document_root']).'/' . $log_folder . '/'.$datepart.'*-access.log.gz';
+			exec('rm -f '.$logfile);
+
+			$logfile = escapeshellcmd($rec['document_root']).'/' . $log_folder . '/'.$datepart.'*-access.log';
+			exec('rm -f '.$logfile);
+		}
+
+		//* Delete old logfiles in /var/log/ispconfig/httpd/ that were created by vlogger for the hostname of the server
+		exec('hostname -f', $tmp_hostname);
+		if($tmp_hostname[0] != '' && is_dir('/var/log/ispconfig/httpd/'.$tmp_hostname[0])) {
+			exec('cd /var/log/ispconfig/httpd/'.$tmp_hostname[0]."; find . -mtime +30 -name '*.log' | xargs rm > /dev/null 2> /dev/null");
+		}
+		unset($tmp_hostname);
+
+		//######################################################################################################
+		// Rotate the ispconfig.log file
+		//######################################################################################################
+
+		// rotate the ispconfig.log when it exceeds a size of 10 MB
+		$logfile = $conf['ispconfig_log_dir'].'/ispconfig.log';
+		if(is_file($logfile) && filesize($logfile) > 10000000) {
+			exec("gzip -c $logfile > $logfile.1.gz");
+			exec("cat /dev/null > $logfile");
+		}
+
+		// rotate the cron.log when it exceeds a size of 10 MB
+		$logfile = $conf['ispconfig_log_dir'].'/cron.log';
+		if(is_file($logfile) && filesize($logfile) > 10000000) {
+			exec("gzip -c $logfile > $logfile.1.gz");
+			exec("cat /dev/null > $logfile");
+		}
+
+		// rotate the auth.log when it exceeds a size of 10 MB
+		$logfile = $conf['ispconfig_log_dir'].'/auth.log';
+		if(is_file($logfile) && filesize($logfile) > 10000000) {
+			exec("gzip -c $logfile > $logfile.1.gz");
+			exec("cat /dev/null > $logfile");
+		}
+
+		//######################################################################################################
+		// Cleanup website tmp directories
+		//######################################################################################################
+
+		$sql = "SELECT domain_id, domain, document_root, system_user FROM web_domain WHERE server_id = ".$conf['server_id'];
+		$records = $app->db->queryAllRecords($sql);
+		$app->uses('system');
+		if(is_array($records)) {
+			foreach($records as $rec){
+				$tmp_path = realpath(escapeshellcmd($rec['document_root'].'/tmp'));
+				if($tmp_path != '' && strlen($tmp_path) > 10 && is_dir($tmp_path) && $app->system->is_user($rec['system_user'])){
+					exec('cd '.$tmp_path."; find . -mtime +1 -name 'sess_*' | grep -v -w .no_delete | xargs rm > /dev/null 2> /dev/null");
+				}
+			}
+		}
+
+		//######################################################################################################
+		// Cleanup logs in master database (only the "master-server")
+		//######################################################################################################
+
+		if ($app->dbmaster == $app->db) {
+			/** 7 days */
+
+
+			$tstamp = time() - (60*60*24*7);
+
+			/*
              *  Keep 7 days in sys_log
              * (we can delete the old items, because if they are OK, they don't interrest anymore
              * if they are NOT ok, the server will try to process them in 1 minute and so the
              * error appears again after 1 minute. So it is no problem to delete the old one!
              */
-            $sql = "DELETE FROM sys_log WHERE tstamp < " . $tstamp . " AND server_id != 0";
-            $app->dbmaster->query($sql);
+			$sql = "DELETE FROM sys_log WHERE tstamp < " . $tstamp . " AND server_id != 0";
+			$app->dbmaster->query($sql);
 
-            /*
+			/*
              * Delete all remote-actions "done" and older than 7 days
              * ATTENTION: We have the same problem as described in cleaning the datalog. We must not
              * delete the last entry
              */
-            $sql = "SELECT max(action_id) FROM sys_remoteaction";
-            $res = $app->dbmaster->queryOneRecord($sql);
-            $maxId = $res['max(action_id)'];
-            $sql =  "DELETE FROM sys_remoteaction " .
-                    "WHERE tstamp < " . $tstamp . " " .
-                    " AND action_state = 'ok' " .
-                    " AND action_id <" . intval($maxId);
-            $app->dbmaster->query($sql);
-
-            /*
+			$sql = "SELECT max(action_id) FROM sys_remoteaction";
+			$res = $app->dbmaster->queryOneRecord($sql);
+			$maxId = $res['max(action_id)'];
+			$sql =  "DELETE FROM sys_remoteaction " .
+				"WHERE tstamp < " . $tstamp . " " .
+				" AND action_state = 'ok' " .
+				" AND action_id <" . intval($maxId);
+			$app->dbmaster->query($sql);
+
+			/*
              * The sys_datalog is more difficult.
              * 1) We have to keet ALL entries with
              *    server_id=0, because they depend on ALL servers (even if they are not
@@ -231,40 +233,40 @@ class cronjob_logfiles extends cronjob {
              *    ATTENTION 2) and 3) is in some case NOT the same! so we have to check both!
              */
 
-            /* First we need all servers and the last sys_datalog-id they processed */
-            $sql = "SELECT server_id, updated FROM server ORDER BY server_id";
-            $records = $app->dbmaster->queryAllRecords($sql);
-
-            /* Then we need the highest value ever */
-            $sql = "SELECT max(datalog_id) FROM sys_datalog";
-            $res = $app->dbmaster->queryOneRecord($sql);
-            $maxId = $res['max(datalog_id)'];
-
-            /* Then delete server by server */
-            foreach($records as $server) {
-                $tmp_server_id = intval($server['server_id']);
-                if($tmp_server_id > 0) {
-                    $sql = 	"DELETE FROM sys_datalog " .
-                            "WHERE tstamp < " . $tstamp .
-                            " AND server_id = " . intval($server['server_id']) .
-                            " AND datalog_id < " . intval($server['updated']) .
-                            " AND datalog_id < " . intval($maxId);
-                }
-        //		echo $sql . "\n";
-                $app->dbmaster->query($sql);
-            }
-        }
-        
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+			/* First we need all servers and the last sys_datalog-id they processed */
+			$sql = "SELECT server_id, updated FROM server ORDER BY server_id";
+			$records = $app->dbmaster->queryAllRecords($sql);
+
+			/* Then we need the highest value ever */
+			$sql = "SELECT max(datalog_id) FROM sys_datalog";
+			$res = $app->dbmaster->queryOneRecord($sql);
+			$maxId = $res['max(datalog_id)'];
+
+			/* Then delete server by server */
+			foreach($records as $server) {
+				$tmp_server_id = intval($server['server_id']);
+				if($tmp_server_id > 0) {
+					$sql =  "DELETE FROM sys_datalog " .
+						"WHERE tstamp < " . $tstamp .
+						" AND server_id = " . intval($server['server_id']) .
+						" AND datalog_id < " . intval($server['updated']) .
+						" AND datalog_id < " . intval($maxId);
+				}
+				//  echo $sql . "\n";
+				$app->dbmaster->query($sql);
+			}
+		}
+
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/300-quota_notify.inc.php b/server/lib/classes/cron.d/300-quota_notify.inc.php
index c2ce89527f30407705d7e930fd6cf78bde870c22..57f388f70cd2f74730fa900e96a4984e92f79c77 100644
--- a/server/lib/classes/cron.d/300-quota_notify.inc.php
+++ b/server/lib/classes/cron.d/300-quota_notify.inc.php
@@ -29,106 +29,106 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_quota_notify extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        #########
-        // 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")
-        #######################################################################################################
-
-        if ($app->dbmaster == $app->db) {
-
-            $global_config = $app->getconf->get_global_config('mail');
-
-            $current_month = date('Y-m');
-
-            //* Check website traffic quota
-            $sql = "SELECT sys_groupid,domain_id,domain,traffic_quota,traffic_quota_lock FROM web_domain WHERE (traffic_quota > 0 or traffic_quota_lock = 'y') and (type = 'vhost' OR type = 'vhostsubdomain')";
-            $records = $app->db->queryAllRecords($sql);
-            if(is_array($records)) {
-                foreach($records as $rec) {
-
-                    $web_traffic_quota = $rec['traffic_quota'];
-                    $domain = $rec['domain'];
-
-                    // get the client
-                    /*
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//########
+		// 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")
+		//######################################################################################################
+
+		if ($app->dbmaster == $app->db) {
+
+			$global_config = $app->getconf->get_global_config('mail');
+
+			$current_month = date('Y-m');
+
+			//* Check website traffic quota
+			$sql = "SELECT sys_groupid,domain_id,domain,traffic_quota,traffic_quota_lock FROM web_domain WHERE (traffic_quota > 0 or traffic_quota_lock = 'y') and (type = 'vhost' OR type = 'vhostsubdomain')";
+			$records = $app->db->queryAllRecords($sql);
+			if(is_array($records)) {
+				foreach($records as $rec) {
+
+					$web_traffic_quota = $rec['traffic_quota'];
+					$domain = $rec['domain'];
+
+					// get the client
+					/*
                     $client_group_id = $rec["sys_groupid"];
                     $client = $app->db->queryOneRecord("SELECT limit_traffic_quota,parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
                     $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota FROM client WHERE client_id = ".intval($client['parent_client_id']));
@@ -137,342 +137,342 @@ class cronjob_quota_notify extends cronjob {
                     $reseller_traffic_quota = intval($reseller['limit_traffic_quota']);
                     */
 
-                    //* get the traffic
-                    $tmp = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) As total_traffic_bytes FROM web_traffic WHERE traffic_date like '$current_month%' AND hostname = '$domain'");
-                    $web_traffic = round($tmp['total_traffic_bytes']/1024/1024);
+					//* get the traffic
+					$tmp = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) As total_traffic_bytes FROM web_traffic WHERE traffic_date like '$current_month%' AND hostname = '$domain'");
+					$web_traffic = round($tmp['total_traffic_bytes']/1024/1024);
 
-                    //* Website is over quota, we will disable it
-                    /*if( ($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) ||
+					//* Website is over quota, we will disable it
+					/*if( ($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) ||
                         ($client_traffic_quota > 0 && $web_traffic > $client_traffic_quota) ||
                         ($reseller_traffic_quota > 0 && $web_traffic > $reseller_traffic_quota)) {*/
-                    if($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) {
-                        $app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'y',active = 'n'", 'domain_id', $rec['domain_id']);
-                        $app->log('Traffic quota for '.$rec['domain'].' exceeded. Disabling website.',LOGLEVEL_DEBUG);
-
-                        //* Send traffic notifications
-                        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'] != ''? $global_config['admin_mail'] : 'root'));
-                            
-                            $recipients = array();
-                            //* send email to admin
-                            if($global_config['admin_mail'] != '' && $web_config['overtraffic_notify_admin'] == 'y') {
-                                $recipients[] = $global_config['admin_mail'];
-                            }
-
-                            //* Send email to client
-                            if($web_config['overtraffic_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_traffic_notification', $placeholders, $recipients);
-                        }
-
-                    } else {
-                        //* unlock the website, if traffic is lower then quota
-                        if($rec['traffic_quota_lock'] == 'y') {
-                            $app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'n',active = 'y'", 'domain_id', $rec['domain_id']);
-                            $app->log('Traffic quota for '.$rec['domain'].' ok again. Re-enabling website.',LOGLEVEL_DEBUG);
-                        }
-                    }
-                }
-            }
-
-
-        }
-
-
-        #######################################################################################################
-        // 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'] != ''? $global_config['admin_mail'] : 'root'),
-                                                  '{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'] != ''? $global_config['admin_mail'] : 'root'),
-                                              '{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'] != ''? $global_config['admin_mail'] : 'root'),
-                                      '{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'] != ''? $global_config['admin_mail'] : 'root'),
-                                  '{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);
-                    }
-                }
-            }
-        }
-        
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+					if($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) {
+						$app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'y',active = 'n'", 'domain_id', $rec['domain_id']);
+						$app->log('Traffic quota for '.$rec['domain'].' exceeded. Disabling website.', LOGLEVEL_DEBUG);
+
+						//* Send traffic notifications
+						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'] != ''? $global_config['admin_mail'] : 'root'));
+
+							$recipients = array();
+							//* send email to admin
+							if($global_config['admin_mail'] != '' && $web_config['overtraffic_notify_admin'] == 'y') {
+								$recipients[] = $global_config['admin_mail'];
+							}
+
+							//* Send email to client
+							if($web_config['overtraffic_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_traffic_notification', $placeholders, $recipients);
+						}
+
+					} else {
+						//* unlock the website, if traffic is lower then quota
+						if($rec['traffic_quota_lock'] == 'y') {
+							$app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'n',active = 'y'", 'domain_id', $rec['domain_id']);
+							$app->log('Traffic quota for '.$rec['domain'].' ok again. Re-enabling website.', LOGLEVEL_DEBUG);
+						}
+					}
+				}
+			}
+
+
+		}
+
+
+		//######################################################################################################
+		// 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'] != ''? $global_config['admin_mail'] : 'root'),
+								'{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'] != ''? $global_config['admin_mail'] : 'root'),
+							'{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'] != ''? $global_config['admin_mail'] : 'root'),
+								'{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'] != ''? $global_config['admin_mail'] : 'root'),
+							'{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);
+					}
+				}
+			}
+		}
+
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/400-openvz.inc.php b/server/lib/classes/cron.d/400-openvz.inc.php
index daee5c44aa7ac065da985db1740ed34e0686ad8e..18f4598be2e03dde3fb17cc45673cdaf0c5da5d7 100644
--- a/server/lib/classes/cron.d/400-openvz.inc.php
+++ b/server/lib/classes/cron.d/400-openvz.inc.php
@@ -29,54 +29,54 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_openvz extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        #######################################################################################################
-        // deactivate virtual servers (run only on the "master-server")
-        #######################################################################################################
-
-        if ($app->dbmaster == $app->db) {
-            $current_date = date('Y-m-d');
-
-            //* Check which virtual machines have to be deactivated
-            $sql = "SELECT * FROM openvz_vm WHERE active = 'y' AND active_until_date != '0000-00-00' AND active_until_date < '$current_date'";
-            $records = $app->db->queryAllRecords($sql);
-            if(is_array($records)) {
-                foreach($records as $rec) {
-                    $app->dbmaster->datalogUpdate('openvz_vm', "active = 'n'", 'vm_id', $rec['vm_id']);
-                    $app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'],LOGLEVEL_DEBUG);
-                }
-            }
-        }
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//######################################################################################################
+		// deactivate virtual servers (run only on the "master-server")
+		//######################################################################################################
+
+		if ($app->dbmaster == $app->db) {
+			$current_date = date('Y-m-d');
+
+			//* Check which virtual machines have to be deactivated
+			$sql = "SELECT * FROM openvz_vm WHERE active = 'y' AND active_until_date != '0000-00-00' AND active_until_date < '$current_date'";
+			$records = $app->db->queryAllRecords($sql);
+			if(is_array($records)) {
+				foreach($records as $rec) {
+					$app->dbmaster->datalogUpdate('openvz_vm', "active = 'n'", 'vm_id', $rec['vm_id']);
+					$app->log('Virtual machine active date expired. Disabling VM '.$rec['veid'], LOGLEVEL_DEBUG);
+				}
+			}
+		}
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.d/500-backup.inc.php b/server/lib/classes/cron.d/500-backup.inc.php
index 7231d7f41b9eb0ac920233ed01457972a851dfc3..6010c75ef75397e63837e9d441416f0970bf5f25 100644
--- a/server/lib/classes/cron.d/500-backup.inc.php
+++ b/server/lib/classes/cron.d/500-backup.inc.php
@@ -29,301 +29,301 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob_backup extends cronjob {
-    
-    // job schedule
-    protected $_schedule = '0 0 * * *';
-    
-    /* this function is optional if it contains no custom code */
-    public function onPrepare() {
-        global $app;
-        
-        parent::onPrepare();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onBeforeRun() {
-        global $app;
-        
-        return parent::onBeforeRun();
-    }
-    
-    public function onRunJob() {
-        global $app, $conf;
-        
-        #######################################################################################################
-        // Create website backups
-        #######################################################################################################
-        function formatBytes($size, $precision = 2) {
-            $base=log($size)/log(1024);
-            $suffixes=array('','k','M','G','T');
-                return round(pow(1024,$base-floor($base)),$precision).$suffixes[floor($base)];
-        }
-
-        $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-        $backup_dir = $server_config['backup_dir'];
-        $backup_mode = $server_config['backup_mode'];
-        if($backup_mode == '') $backup_mode = 'userzip';
-
-        $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-        $http_server_user = $web_config['user'];
-
-        if($backup_dir != '') {
-
-            if(isset($server_config['backup_dir_ftpread']) && $server_config['backup_dir_ftpread'] == 'y') {
-                $backup_dir_permissions = 0755;
-            } else {
-                $backup_dir_permissions = 0750;
-            }
-
-            if(!is_dir($backup_dir)) {
-                mkdir(escapeshellcmd($backup_dir), $backup_dir_permissions, true);
-            } else {
-                chmod(escapeshellcmd($backup_dir), $backup_dir_permissions);
-            }
-
-            $sql = "SELECT * FROM web_domain WHERE server_id = '".$conf['server_id']."' AND (type = 'vhost' OR type = 'vhostsubdomain') AND backup_interval != 'none'";
-            $records = $app->db->queryAllRecords($sql);
-            if(is_array($records)) {
-                foreach($records as $rec) {
-
-                    //* Do the website backup
-                    if($rec['backup_interval'] == 'daily' or ($rec['backup_interval'] == 'weekly' && date('w') == 0) or ($rec['backup_interval'] == 'monthly' && date('d') == '01')) {
-
-                        $web_path = $rec['document_root'];
-                        $web_user = $rec['system_user'];
-                        $web_group = $rec['system_group'];
-                        $web_id = $rec['domain_id'];
-                        $web_backup_dir = $backup_dir.'/web'.$web_id;
-                        if(!is_dir($web_backup_dir)) mkdir($web_backup_dir, 0750);
-                        chmod($web_backup_dir, 0750);
-                        //if(isset($server_config['backup_dir_ftpread']) && $server_config['backup_dir_ftpread'] == 'y') {
-                        chown($web_backup_dir, $rec['system_user']);
-                        chgrp($web_backup_dir, $rec['system_group']);
-                        /*} else {
+
+	// job schedule
+	protected $_schedule = '0 0 * * *';
+
+	/* this function is optional if it contains no custom code */
+	public function onPrepare() {
+		global $app;
+
+		parent::onPrepare();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onBeforeRun() {
+		global $app;
+
+		return parent::onBeforeRun();
+	}
+
+	public function onRunJob() {
+		global $app, $conf;
+
+		//######################################################################################################
+		// Create website backups
+		//######################################################################################################
+		function formatBytes($size, $precision = 2) {
+			$base=log($size)/log(1024);
+			$suffixes=array('', 'k', 'M', 'G', 'T');
+			return round(pow(1024, $base-floor($base)), $precision).$suffixes[floor($base)];
+		}
+
+		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
+		$backup_dir = $server_config['backup_dir'];
+		$backup_mode = $server_config['backup_mode'];
+		if($backup_mode == '') $backup_mode = 'userzip';
+
+		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+		$http_server_user = $web_config['user'];
+
+		if($backup_dir != '') {
+
+			if(isset($server_config['backup_dir_ftpread']) && $server_config['backup_dir_ftpread'] == 'y') {
+				$backup_dir_permissions = 0755;
+			} else {
+				$backup_dir_permissions = 0750;
+			}
+
+			if(!is_dir($backup_dir)) {
+				mkdir(escapeshellcmd($backup_dir), $backup_dir_permissions, true);
+			} else {
+				chmod(escapeshellcmd($backup_dir), $backup_dir_permissions);
+			}
+
+			$sql = "SELECT * FROM web_domain WHERE server_id = '".$conf['server_id']."' AND (type = 'vhost' OR type = 'vhostsubdomain') AND backup_interval != 'none'";
+			$records = $app->db->queryAllRecords($sql);
+			if(is_array($records)) {
+				foreach($records as $rec) {
+
+					//* Do the website backup
+					if($rec['backup_interval'] == 'daily' or ($rec['backup_interval'] == 'weekly' && date('w') == 0) or ($rec['backup_interval'] == 'monthly' && date('d') == '01')) {
+
+						$web_path = $rec['document_root'];
+						$web_user = $rec['system_user'];
+						$web_group = $rec['system_group'];
+						$web_id = $rec['domain_id'];
+						$web_backup_dir = $backup_dir.'/web'.$web_id;
+						if(!is_dir($web_backup_dir)) mkdir($web_backup_dir, 0750);
+						chmod($web_backup_dir, 0750);
+						//if(isset($server_config['backup_dir_ftpread']) && $server_config['backup_dir_ftpread'] == 'y') {
+						chown($web_backup_dir, $rec['system_user']);
+						chgrp($web_backup_dir, $rec['system_group']);
+						/*} else {
                             chown($web_backup_dir, 'root');
                             chgrp($web_backup_dir, 'root');
                         }*/
-                        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).' -@', $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).' .', $tmp_output, $retval);
-                        }
-                        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);
-                        } 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']);
-
-                        $dir_handle = dir($web_backup_dir);
-                        $files = array();
-                        while (false !== ($entry = $dir_handle->read())) {
-                            if($entry != '.' && $entry != '..' && substr($entry,0,3) == 'web' && is_file($web_backup_dir.'/'.$entry)) {
-                                $files[] = $entry;
-                            }
-                        }
-                        $dir_handle->close();
-
-                        rsort($files);
-
-                        for ($n = $backup_copies; $n <= 10; $n++) {
-                            if(isset($files[$n]) && is_file($web_backup_dir.'/'.$files[$n])) {
-                                unlink($web_backup_dir.'/'.$files[$n]);
-                                //$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($files[$n])."'";
-                                //$tmp = $app->dbmaster->queryOneRecord($sql);
-                                //$app->dbmaster->datalogDelete('web_backup', 'backup_id', $tmp['backup_id']);
-                                //$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
-                                $sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($files[$n])."'";
-                                $app->db->query($sql);
-                                if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
-                            }
-                        }
-
-                        unset($files);
-                        unset($dir_handle);
-
-                        //* Remove backupdir symlink and create as directory instead
-                        $app->uses('system');
-                        $app->system->web_folder_protection($web_path,false);
-
-                        if(is_link($web_path.'/backup')) {
-                            unlink($web_path.'/backup');
-                        }
-                        if(!is_dir($web_path.'/backup')) {
-                            mkdir($web_path.'/backup');
-                            chown($web_path.'/backup', $rec['system_user']);
-                            chgrp($web_path.'/backup', $rec['system_group']);
-                        }
-
-                        $app->system->web_folder_protection($web_path,true);
-
-                    }
-
-                    /* If backup_interval is set to none and we have a
+						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).' -@', $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).' .', $tmp_output, $retval);
+						}
+						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);
+						} 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']);
+
+						$dir_handle = dir($web_backup_dir);
+						$files = array();
+						while (false !== ($entry = $dir_handle->read())) {
+							if($entry != '.' && $entry != '..' && substr($entry, 0, 3) == 'web' && is_file($web_backup_dir.'/'.$entry)) {
+								$files[] = $entry;
+							}
+						}
+						$dir_handle->close();
+
+						rsort($files);
+
+						for ($n = $backup_copies; $n <= 10; $n++) {
+							if(isset($files[$n]) && is_file($web_backup_dir.'/'.$files[$n])) {
+								unlink($web_backup_dir.'/'.$files[$n]);
+								//$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($files[$n])."'";
+								//$tmp = $app->dbmaster->queryOneRecord($sql);
+								//$app->dbmaster->datalogDelete('web_backup', 'backup_id', $tmp['backup_id']);
+								//$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
+								$sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($files[$n])."'";
+								$app->db->query($sql);
+								if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+							}
+						}
+
+						unset($files);
+						unset($dir_handle);
+
+						//* Remove backupdir symlink and create as directory instead
+						$app->uses('system');
+						$app->system->web_folder_protection($web_path, false);
+
+						if(is_link($web_path.'/backup')) {
+							unlink($web_path.'/backup');
+						}
+						if(!is_dir($web_path.'/backup')) {
+							mkdir($web_path.'/backup');
+							chown($web_path.'/backup', $rec['system_user']);
+							chgrp($web_path.'/backup', $rec['system_group']);
+						}
+
+						$app->system->web_folder_protection($web_path, true);
+
+					}
+
+					/* If backup_interval is set to none and we have a
                     backup directory for the website, then remove the backups */
-                    if($rec['backup_interval'] == 'none') {
-                        $web_id = $rec['domain_id'];
-                        $web_user = $rec['system_user'];
-                        $web_backup_dir = realpath($backup_dir.'/web'.$web_id);
-                        if(is_dir($web_backup_dir)) {
-                            exec('sudo -u '.escapeshellarg($web_user).' rm -f '.escapeshellarg($web_backup_dir.'/*'));
-                        }
-                    }
-                }
-            }
-
-            $sql = "SELECT * FROM web_database WHERE server_id = '".$conf['server_id']."' AND backup_interval != 'none'";
-            $records = $app->db->queryAllRecords($sql);
-            if(is_array($records)) {
-
-                include('lib/mysql_clientdb.conf');
-
-                foreach($records as $rec) {
-
-                    //* Do the database backup
-                    if($rec['backup_interval'] == 'daily' or ($rec['backup_interval'] == 'weekly' && date('w') == 0) or ($rec['backup_interval'] == 'monthly' && date('d') == '01')) {
-
-                        $web_id = $rec['parent_domain_id'];
-                        $db_backup_dir = $backup_dir.'/web'.$web_id;
-                        if(!is_dir($db_backup_dir)) mkdir($db_backup_dir, 0750);
-                        chmod($db_backup_dir, 0750);
-                        chown($db_backup_dir, 'root');
-                        chgrp($db_backup_dir, 'root');
-
-                        //* Do the mysql database backup with mysqldump or mongodump
-                        $db_id = $rec['database_id'];
-                        $db_name = $rec['database_name'];
-
-                        if ($rec['type'] == 'mysql') {
-                            $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."'";
-                            $command = "mysqldump -h ".escapeshellarg($clientdb_host)." -u ".escapeshellarg($clientdb_user)." -p".escapeshellarg($clientdb_password)." -c --add-drop-table --quote-names --routines --events --triggers --hex-blob --create-options --quick --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
-                            exec($command, $tmp_output, $retval);
-
-                            //* Compress the backup with gzip
-                            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,filesize) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz','".formatBytes(filesize($db_backup_dir.'/'.$db_backup_file))."')";
-                                $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
-                            if(is_file($db_backup_dir.'/'.$db_backup_file)) unlink($db_backup_dir.'/'.$db_backup_file);
-                        } else if ($rec['type'] == 'mongo') {
-                            $db_backup_file = 'db_'.$db_name.'_'.date('Y-m-d_H-i');
-
-                            try {
-                                $connection = new MongoClient("mongodb://root:123456@127.0.0.1:27017/admin");
-                                $db = $connection->selectDB($db_name);
-                                // exclude not supported by mongodump, only get user collections
-                                $collections = $db->getCollectionNames(false);
-
-                                foreach ($collections as $collection) {
-                                    // mongodump -h 127.0.0.1 --port 27017 -u root -p 123456 --authenticationDatabase admin -d <db> -c <table> -o /tmp/test
-                                    $command = "mongodump -h 127.0.0.1 --port 27017 -u root -p 123456 --authenticationDatabase admin -d ".escapeshellcmd($db_name)." -c ".escapeshellcmd($collection)." -o ".escapeshellcmd($db_backup_dir.'/'.$db_backup_file);
-                                    exec($command);
-                                }
-
-                                if (is_dir(escapeshellcmd($db_backup_dir.'/'.$db_backup_file))) {
-                                    //* Compress the backup with gzip
-                                    exec("cd ".escapeshellcmd($db_backup_dir)." && tar -pczf ".escapeshellcmd($db_backup_dir.'/'.$db_backup_file).".tar.gz ".escapeshellcmd($db_backup_file));
-                                    chmod($db_backup_dir.'/'.$db_backup_file.'.tar.gz', 0750);
-                                    chown($db_backup_dir.'/'.$db_backup_file.'.tar.gz', fileowner($db_backup_dir));
-                                    chgrp($db_backup_dir.'/'.$db_backup_file.'.tar.gz', filegroup($db_backup_dir));
-
-                                    //* Insert web backup record in database
-                                    $sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",$web_id,'mongodb','rootgz',".time().",'".$app->db->quote($db_backup_file).".tar.gz')";
-                                    $app->db->query($sql);
-
-                                    if ($app->db->dbHost != $app->dbmaster->dbHost) {
-                                        $app->dbmaster->query($sql);
-                                    }
-
-                                    //* Remove the uncompressed file
-                                    exec("rm -rf ".escapeshellcmd($db_backup_dir.'/'.$db_backup_file));
-                                }
-                            } catch (MongoConnnectionException $e) {
-                                // connecting to MongoDB failed - cannot create backup
-                            }
-                        }
-
-                        //* Remove old backups
-                        $backup_copies = intval($rec['backup_copies']);
-
-                        $dir_handle = dir($db_backup_dir);
-                        $files = array();
-                        while (false !== ($entry = $dir_handle->read())) {
-                            if($entry != '.' && $entry != '..' && (preg_match('/^db_(.*?)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.sql.gz$/', $entry, $matches) || preg_match('/^db_(.*?)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.tar.gz$/', $entry, $matches)) && is_file($db_backup_dir.'/'.$entry)) {
-                                if(array_key_exists($matches[1], $files) == false) $files[$matches[1]] = array();
-                                $files[$matches[1]][] = $entry;
-                            }
-                        }
-                        $dir_handle->close();
-
-                        reset($files);
-                        foreach($files as $db_name => $filelist) {
-                            rsort($filelist);
-                            for ($n = $backup_copies; $n <= 10; $n++) {
-                                if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
-                                    unlink($db_backup_dir.'/'.$filelist[$n]);
-                                    //$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
-                                    //$tmp = $app->dbmaster->queryOneRecord($sql);
-                                    //$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
-                                    $sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
-                                    $app->db->query($sql);
-                                    if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
-                                }
-                            }
-                        }
-
-                        unset($files);
-                        unset($dir_handle);
-                    }
-                }
-
-                unset($clientdb_host);
-                unset($clientdb_user);
-                unset($clientdb_password);
-
-            }
-        }
-        
-        parent::onRunJob();
-    }
-    
-    /* this function is optional if it contains no custom code */
-    public function onAfterRun() {
-        global $app;
-        
-        parent::onAfterRun();
-    }
+					if($rec['backup_interval'] == 'none') {
+						$web_id = $rec['domain_id'];
+						$web_user = $rec['system_user'];
+						$web_backup_dir = realpath($backup_dir.'/web'.$web_id);
+						if(is_dir($web_backup_dir)) {
+							exec('sudo -u '.escapeshellarg($web_user).' rm -f '.escapeshellarg($web_backup_dir.'/*'));
+						}
+					}
+				}
+			}
+
+			$sql = "SELECT * FROM web_database WHERE server_id = '".$conf['server_id']."' AND backup_interval != 'none'";
+			$records = $app->db->queryAllRecords($sql);
+			if(is_array($records)) {
+
+				include 'lib/mysql_clientdb.conf';
+
+				foreach($records as $rec) {
+
+					//* Do the database backup
+					if($rec['backup_interval'] == 'daily' or ($rec['backup_interval'] == 'weekly' && date('w') == 0) or ($rec['backup_interval'] == 'monthly' && date('d') == '01')) {
+
+						$web_id = $rec['parent_domain_id'];
+						$db_backup_dir = $backup_dir.'/web'.$web_id;
+						if(!is_dir($db_backup_dir)) mkdir($db_backup_dir, 0750);
+						chmod($db_backup_dir, 0750);
+						chown($db_backup_dir, 'root');
+						chgrp($db_backup_dir, 'root');
+
+						//* Do the mysql database backup with mysqldump or mongodump
+						$db_id = $rec['database_id'];
+						$db_name = $rec['database_name'];
+
+						if ($rec['type'] == 'mysql') {
+							$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."'";
+							$command = "mysqldump -h ".escapeshellarg($clientdb_host)." -u ".escapeshellarg($clientdb_user)." -p".escapeshellarg($clientdb_password)." -c --add-drop-table --quote-names --routines --events --triggers --hex-blob --create-options --quick --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
+							exec($command, $tmp_output, $retval);
+
+							//* Compress the backup with gzip
+							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,filesize) VALUES (".$conf['server_id'].",$web_id,'mysql','sqlgz',".time().",'".$app->db->quote($db_backup_file).".gz','".formatBytes(filesize($db_backup_dir.'/'.$db_backup_file))."')";
+								$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
+							if(is_file($db_backup_dir.'/'.$db_backup_file)) unlink($db_backup_dir.'/'.$db_backup_file);
+						} else if ($rec['type'] == 'mongo') {
+								$db_backup_file = 'db_'.$db_name.'_'.date('Y-m-d_H-i');
+
+								try {
+									$connection = new MongoClient("mongodb://root:123456@127.0.0.1:27017/admin");
+									$db = $connection->selectDB($db_name);
+									// exclude not supported by mongodump, only get user collections
+									$collections = $db->getCollectionNames(false);
+
+									foreach ($collections as $collection) {
+										// mongodump -h 127.0.0.1 --port 27017 -u root -p 123456 --authenticationDatabase admin -d <db> -c <table> -o /tmp/test
+										$command = "mongodump -h 127.0.0.1 --port 27017 -u root -p 123456 --authenticationDatabase admin -d ".escapeshellcmd($db_name)." -c ".escapeshellcmd($collection)." -o ".escapeshellcmd($db_backup_dir.'/'.$db_backup_file);
+										exec($command);
+									}
+
+									if (is_dir(escapeshellcmd($db_backup_dir.'/'.$db_backup_file))) {
+										//* Compress the backup with gzip
+										exec("cd ".escapeshellcmd($db_backup_dir)." && tar -pczf ".escapeshellcmd($db_backup_dir.'/'.$db_backup_file).".tar.gz ".escapeshellcmd($db_backup_file));
+										chmod($db_backup_dir.'/'.$db_backup_file.'.tar.gz', 0750);
+										chown($db_backup_dir.'/'.$db_backup_file.'.tar.gz', fileowner($db_backup_dir));
+										chgrp($db_backup_dir.'/'.$db_backup_file.'.tar.gz', filegroup($db_backup_dir));
+
+										//* Insert web backup record in database
+										$sql = "INSERT INTO web_backup (server_id,parent_domain_id,backup_type,backup_mode,tstamp,filename) VALUES (".$conf['server_id'].",$web_id,'mongodb','rootgz',".time().",'".$app->db->quote($db_backup_file).".tar.gz')";
+										$app->db->query($sql);
+
+										if ($app->db->dbHost != $app->dbmaster->dbHost) {
+											$app->dbmaster->query($sql);
+										}
+
+										//* Remove the uncompressed file
+										exec("rm -rf ".escapeshellcmd($db_backup_dir.'/'.$db_backup_file));
+									}
+								} catch (MongoConnnectionException $e) {
+									// connecting to MongoDB failed - cannot create backup
+								}
+							}
+
+						//* Remove old backups
+						$backup_copies = intval($rec['backup_copies']);
+
+						$dir_handle = dir($db_backup_dir);
+						$files = array();
+						while (false !== ($entry = $dir_handle->read())) {
+							if($entry != '.' && $entry != '..' && (preg_match('/^db_(.*?)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.sql.gz$/', $entry, $matches) || preg_match('/^db_(.*?)_\d{4}-\d{2}-\d{2}_\d{2}-\d{2}\.tar.gz$/', $entry, $matches)) && is_file($db_backup_dir.'/'.$entry)) {
+								if(array_key_exists($matches[1], $files) == false) $files[$matches[1]] = array();
+								$files[$matches[1]][] = $entry;
+							}
+						}
+						$dir_handle->close();
+
+						reset($files);
+						foreach($files as $db_name => $filelist) {
+							rsort($filelist);
+							for ($n = $backup_copies; $n <= 10; $n++) {
+								if(isset($filelist[$n]) && is_file($db_backup_dir.'/'.$filelist[$n])) {
+									unlink($db_backup_dir.'/'.$filelist[$n]);
+									//$sql = "SELECT backup_id FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
+									//$tmp = $app->dbmaster->queryOneRecord($sql);
+									//$sql = "DELETE FROM web_backup WHERE backup_id = ".intval($tmp['backup_id']);
+									$sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = $web_id AND filename = '".$app->db->quote($filelist[$n])."'";
+									$app->db->query($sql);
+									if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+								}
+							}
+						}
+
+						unset($files);
+						unset($dir_handle);
+					}
+				}
+
+				unset($clientdb_host);
+				unset($clientdb_user);
+				unset($clientdb_password);
+
+			}
+		}
+
+		parent::onRunJob();
+	}
+
+	/* this function is optional if it contains no custom code */
+	public function onAfterRun() {
+		global $app;
+
+		parent::onAfterRun();
+	}
 
 }
 
diff --git a/server/lib/classes/cron.inc.php b/server/lib/classes/cron.inc.php
index c7bea321ce89009f56063bef47a9595774248078..48ca09373901eb3c1cfaf977bdfcf1248531db64 100644
--- a/server/lib/classes/cron.inc.php
+++ b/server/lib/classes/cron.inc.php
@@ -29,243 +29,248 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cron {
-    
-    /**#@+
+
+	/**#@+
      * @access private
      */
-    private $_sMinute = '';
-    private $_sHour = '';
-    private $_sDay = '';
-    private $_sMonth = '';
-    private $_sWDay = '';
-    private $_bParsed = false;
-    private $_iNextRun = null;
-    private $_aValidValues;
-    
-    public function __construct() {
-        // empty
-        $this->_sMinute = '';
-        $this->_sHour = '';
-        $this->_sDay = '';
-        $this->_sMonth = '';
-        $this->_sWDay = '';
-        $this->_bParsed = false;
-        $this->_aValidValues = array('minute' => array(),
-                                     'hour' => array(),
-                                     'day' => array(),
-                                     'month' => array(),
-                                     'weekday' => array());
-    }
-    
-    private function _calcValidValues() {
-        // minute field
-        $this->_aValidValues['minute'] = $this->_calcFieldValues('minute', $this->_sMinute);
-        $this->_aValidValues['hour'] = $this->_calcFieldValues('hour', $this->_sHour);
-        $this->_aValidValues['day'] = $this->_calcFieldValues('day', $this->_sDay);
-        $this->_aValidValues['month'] = $this->_calcFieldValues('month', $this->_sMonth);
-        $this->_aValidValues['weekday'] = $this->_calcFieldValues('weekday', $this->_sWDay);
-        $this->_bParsed = true;
-    }
-    
-    private function _calcFieldValues($sField, $sValue) {
-        global $app;
-        
-        $aValidValues = array();
-        
-        // global checks
-        $iFrom = 0;
-        $iTo = 0;
-        switch($sField) {
-            case 'minute':
-                $iTo = 59;
-                break;
-            case 'hour':
-                $iTo = 23;
-                break;
-            case 'day':
-                $iFrom = 1;
-                $iTo = 31;
-                break;
-            case 'month':
-                $sValue = strtr($sValue, array('JAN' => 1,
-                                               'FEB' => 2,
-                                               'MAR' => 3,
-                                               'APR' => 4,
-                                               'MAY' => 5,
-                                               'JUN' => 6,
-                                               'JUL' => 7,
-                                               'AUG' => 8,
-                                               'SEP' => 9,
-                                               'OCT' => 10,
-                                               'NOV' => 11,
-                                               'DEC' => 12)
-                                              );
-                $iFrom = 1;
-                $iTo = 12;
-                break;
-            case 'weekday':
-                $sValue = strtr($sValue, array('SUN' => 0,
-                                               'MON' => 1,
-                                               'TUE' => 2,
-                                               'WED' => 3,
-                                               'THU' => 4,
-                                               'FRI' => 5,
-                                               'SAT' => 6,
-                                               '7' => 0)
-                                              );
-                $iTo = 6;
-                break;
-        }
-        $aParts = explode(',', $sValue);
-        for($a = 0; $a < count($aParts); $a++) {
-            $sValue = $aParts[$a];
-            $iValue = $app->functions->intval($sValue);
-            
-            if($sValue === '*') {
-                // everything is valid
-                for($i = $iFrom; $i <= $iTo; $i++) {
-                    $aValidValues[] = $i;
-                }
-                break; // no need to go any further
-            } elseif((string)$iValue == $sValue) {
-                if($iValue >= $iFrom && $iValue <= $iTo) $aValidValues[] = $iValue;
-            } elseif(preg_match('/^([0-9]+)-([0-9]+)(\/([1-9][0-9]*))?$/', $sValue, $aMatch)) {
-                if($aMatch[1] < $iFrom) $aMatch[1] = $iFrom;
-                if($aMatch[2] > $iTo) $aMatch[2] = $iTo;
-                if(isset($aMatch[3])) {
-                    for($i = $aMatch[1]; $i <= $aMatch[2]; $i++) {
-                        if(($i - $aMatch[1]) % $aMatch[4] == 0) $aValidValues[] = $i;
-                    }
-                } else {
-                    for($i = $aMatch[1]; $i <= $aMatch[2]; $i++) $aValidValues[] = $i;
-                }
-            } elseif(preg_match('/^\*\/([1-9][0-9]*)$/', $sValue, $aMatch)) {
-                for($i = $iFrom; $i <= $iTo; $i++) {
-                    if($i % $aMatch[1] == 0) $aValidValues[] = $i;
-                }
-            }
-        }
-        
-        $aValidValues = array_unique($aValidValues);
-        sort($aValidValues);
-        
-        return $aValidValues;
-    }
-    
-    /**#@-*/
-    
-    /**
-     * Set the cron field values
-     * 
-     * @param string $sMinute the minute field value
-     * @param string $sHour the hour field value
-     * @param string $sDay the day field value
-     * @param string $sWDay the weekday field value
-     * @param string $sMonth the month field value
-     */
-    public function setCronFields($sMinute = '*', $sHour = '*', $sDay = '*', $sMonth = '*', $sWDay = '*') {
-        $this->_sMinute = $sMinute;
-        $this->_sHour = $sHour;
-        $this->_sDay = $sDay;
-        $this->_sMonth = $sMonth;
-        $this->_sWDay = $sWDay;
-        $this->_bParsed = false;
-    }
-    
-    /**
-     * Parse a line of a cron and set the internal field values
-     * 
-     * @param string $sLine cron line
-     */
-    public function parseCronLine($sLine) {
-        $aFields = preg_split('/[ \t]+/', trim($sLine));
-        for($i = 0; $i < 5; $i++) {
-            if(!isset($aFields[$i])) $aFields[$i] = '*';
-        }
-        if($aFields[0] == '@yearly' || $aFields[0] == '@annually') $aFields = array(0, 0, 1, 1, '*');
-        elseif($aFields[0] == '@monthly') $aFields = array(0, 0, 1, '*', '*');
-        elseif($aFields[0] == '@weekly') $aFields = array(0, 0, '*', '*', 0);
-        elseif($aFields[0] == '@daily' || $aFields[0] == '@midnight') $aFields = array(0, 0, '*', '*', '*');
-        elseif($aFields[0] == '@hourly') $aFields = array(0, '*', '*', '*', '*');
-        
-        $this->setCronFields($aFields[0], $aFields[1], $aFields[2], $aFields[3], $aFields[4]);
-    }
-    
-    public function getNextRun($vDate) {
-        global $app;
-        
-        $iTimestamp = ISPConfigDatetime::to_timestamp($vDate);
-        if($iTimestamp === false) return $iTimestamp;
-        
-        if($this->_bParsed == false) $this->_calcValidValues();
-        
-        // get the field values for the given Date.
-        list($iMinute, $iHour, $iDay, $iWDay, $iMonth, $iYear) = explode(':', ISPConfigDateTime::to_string($vDate, 'custom:%M:%H:%d:%w:%m:%Y'));
-        
-        $bValid = false;
-        $iStartYear = $iYear;
-        while($bValid == false) {
-            $iCurMinute = $this->_getNextValue('minute', $iMinute, true);
-            $iCurHour = $this->_getNextValue('hour', $iHour, true);
-            $iCurDay = $this->_getNextValue('day', $iDay, true);
-            $iCurMonth = $this->_getNextValue('month', $iMonth, true);
-            $iCurWDay = $this->_getNextValue('weekday', $iWDay, true);
-            
-            $iNextMinute = $this->_getNextValue('minute', $iMinute);
-            $iNextHour = $this->_getNextValue('hour', $iHour);
-            $iNextDay = $this->_getNextValue('day', $iDay);
-            $iNextMonth = $this->_getNextValue('month', $iMonth);
-            $iNextWDay = $this->_getNextValue('weekday', $iWDay);
-            
-            if($iNextMinute > $iMinute && $iHour == $iCurHour && $iDay == $iCurDay && $iWDay == $iCurWDay && $iMonth == $iCurMonth) {
-                $iMinute = $iNextMinute;
-            } elseif($iNextHour > $iHour && $iDay == $iCurDay && $iWDay == $iCurWDay && $iMonth == $iCurMonth) {
-                $iMinute = reset($this->_aValidValues['minute']);
-                $iHour = $iNextHour;
-            } elseif($iNextDay > $iDay && ISPConfigDateTime::last_day($iMonth) >= $iNextDay && $iMonth == $iCurMonth) {
-                $iMinute = reset($this->_aValidValues['minute']);
-                $iHour = reset($this->_aValidValues['hour']);
-                $iDay = $iNextDay;
-            } elseif($iNextMonth > $iMonth) {
-                $iMinute = reset($this->_aValidValues['minute']);
-                $iHour = reset($this->_aValidValues['hour']);
-                $iDay = reset($this->_aValidValues['day']);
-                $iMonth = $iNextMonth;
-            } else {
-                $iMinute = reset($this->_aValidValues['minute']);
-                $iHour = reset($this->_aValidValues['hour']);
-                $iDay = reset($this->_aValidValues['day']);
-                $iMonth = reset($this->_aValidValues['month']);
-                $iYear++;
-            }
-            
-            $ts = mktime($iHour, $iMinute, 0, $iMonth, $iDay, $iYear);
-            //print strftime('%d.%m.%Y (%A) %H:%M', $ts) . "\n";
-            //var_dump($iCurMinute, $iCurHour, $iCurDay, $iCurMonth, $iCurWDay, '--', $iNextMinute, $iNextHour, $iNextDay, $iNextMonth, $iNextWDay);
-            if(ISPConfigDateTime::last_day($iMonth, $iYear) >= $iDay && in_array($app->functions->intval(strftime('%w', $ts)), $this->_aValidValues['weekday'], true) === true) {
-                $bValid = true;
-            } else {
-                if($iYear - $iStartYear > 5) {
-                    if(LOG_PRIORITY <= PRIO_ERROR) $portal->log('No valid run dates for schedule ' . $this->_sMinute . ' ' . $this->_sHour . ' ' . $this->_sDay . ' ' . $this->_sMonth . ' ' . $this->_sWDay . ' in the next 5 years!', PRIO_ERROR, __FILE__, __LINE__);
-                    return false;
-                }
-            }
-        }
-        
-        //var_dump($vDate, implode('-', array($iYear, $iMonth, $iDay, $iHour, $iNextMinute, 0)), $this->_sMinute, $this->_sHour, $this->_sDay, $this->_sWDay, $this->_sMonth, $this->_aValidValues);
-        return $iYear . '-' . $iMonth . '-' . $iDay . ' ' . $iHour . ':' . $iNextMinute . ':0';
-    }
-    
-    private function _getNextValue($sField, $iValue, $bIncludeCurrent = false) {
-        if(!array_key_exists($sField, $this->_aValidValues)) return false;
-        
-        reset($this->_aValidValues[$sField]);
-        while(($cur = each($this->_aValidValues[$sField])) !== false) {
-            if($bIncludeCurrent == true && $cur['value'] >= $iValue) return $cur['value'];
-            elseif($cur['value'] > $iValue) return $cur['value'];
-        }
-        return reset($this->_aValidValues[$sField]);
-    }
+	private $_sMinute = '';
+	private $_sHour = '';
+	private $_sDay = '';
+	private $_sMonth = '';
+	private $_sWDay = '';
+	private $_bParsed = false;
+	private $_iNextRun = null;
+	private $_aValidValues;
+
+	public function __construct() {
+		// empty
+		$this->_sMinute = '';
+		$this->_sHour = '';
+		$this->_sDay = '';
+		$this->_sMonth = '';
+		$this->_sWDay = '';
+		$this->_bParsed = false;
+		$this->_aValidValues = array('minute' => array(),
+			'hour' => array(),
+			'day' => array(),
+			'month' => array(),
+			'weekday' => array());
+	}
+
+	private function _calcValidValues() {
+		// minute field
+		$this->_aValidValues['minute'] = $this->_calcFieldValues('minute', $this->_sMinute);
+		$this->_aValidValues['hour'] = $this->_calcFieldValues('hour', $this->_sHour);
+		$this->_aValidValues['day'] = $this->_calcFieldValues('day', $this->_sDay);
+		$this->_aValidValues['month'] = $this->_calcFieldValues('month', $this->_sMonth);
+		$this->_aValidValues['weekday'] = $this->_calcFieldValues('weekday', $this->_sWDay);
+		$this->_bParsed = true;
+	}
+
+	private function _calcFieldValues($sField, $sValue) {
+		global $app;
+
+		$aValidValues = array();
+
+		// global checks
+		$iFrom = 0;
+		$iTo = 0;
+		switch($sField) {
+		case 'minute':
+			$iTo = 59;
+			break;
+		case 'hour':
+			$iTo = 23;
+			break;
+		case 'day':
+			$iFrom = 1;
+			$iTo = 31;
+			break;
+		case 'month':
+			$sValue = strtr($sValue, array('JAN' => 1,
+					'FEB' => 2,
+					'MAR' => 3,
+					'APR' => 4,
+					'MAY' => 5,
+					'JUN' => 6,
+					'JUL' => 7,
+					'AUG' => 8,
+					'SEP' => 9,
+					'OCT' => 10,
+					'NOV' => 11,
+					'DEC' => 12)
+			);
+			$iFrom = 1;
+			$iTo = 12;
+			break;
+		case 'weekday':
+			$sValue = strtr($sValue, array('SUN' => 0,
+					'MON' => 1,
+					'TUE' => 2,
+					'WED' => 3,
+					'THU' => 4,
+					'FRI' => 5,
+					'SAT' => 6,
+					'7' => 0)
+			);
+			$iTo = 6;
+			break;
+		}
+		$aParts = explode(',', $sValue);
+		for($a = 0; $a < count($aParts); $a++) {
+			$sValue = $aParts[$a];
+			$iValue = $app->functions->intval($sValue);
+
+			if($sValue === '*') {
+				// everything is valid
+				for($i = $iFrom; $i <= $iTo; $i++) {
+					$aValidValues[] = $i;
+				}
+				break; // no need to go any further
+			} elseif((string)$iValue == $sValue) {
+				if($iValue >= $iFrom && $iValue <= $iTo) $aValidValues[] = $iValue;
+			} elseif(preg_match('/^([0-9]+)-([0-9]+)(\/([1-9][0-9]*))?$/', $sValue, $aMatch)) {
+				if($aMatch[1] < $iFrom) $aMatch[1] = $iFrom;
+				if($aMatch[2] > $iTo) $aMatch[2] = $iTo;
+				if(isset($aMatch[3])) {
+					for($i = $aMatch[1]; $i <= $aMatch[2]; $i++) {
+						if(($i - $aMatch[1]) % $aMatch[4] == 0) $aValidValues[] = $i;
+					}
+				} else {
+					for($i = $aMatch[1]; $i <= $aMatch[2]; $i++) $aValidValues[] = $i;
+				}
+			} elseif(preg_match('/^\*\/([1-9][0-9]*)$/', $sValue, $aMatch)) {
+				for($i = $iFrom; $i <= $iTo; $i++) {
+					if($i % $aMatch[1] == 0) $aValidValues[] = $i;
+				}
+			}
+		}
+
+		$aValidValues = array_unique($aValidValues);
+		sort($aValidValues);
+
+		return $aValidValues;
+	}
+
+	/**#@-*/
+
+	/**
+	 * Set the cron field values
+	 *
+	 * @param string $sMinute the minute field value
+	 * @param string $sHour the hour field value
+	 * @param string $sDay the day field value
+	 * @param string $sWDay the weekday field value
+	 * @param string $sMonth the month field value
+	 */
+
+
+	public function setCronFields($sMinute = '*', $sHour = '*', $sDay = '*', $sMonth = '*', $sWDay = '*') {
+		$this->_sMinute = $sMinute;
+		$this->_sHour = $sHour;
+		$this->_sDay = $sDay;
+		$this->_sMonth = $sMonth;
+		$this->_sWDay = $sWDay;
+		$this->_bParsed = false;
+	}
+
+
+
+	/**
+	 * Parse a line of a cron and set the internal field values
+	 *
+	 * @param string $sLine cron line
+	 */
+	public function parseCronLine($sLine) {
+		$aFields = preg_split('/[ \t]+/', trim($sLine));
+		for($i = 0; $i < 5; $i++) {
+			if(!isset($aFields[$i])) $aFields[$i] = '*';
+		}
+		if($aFields[0] == '@yearly' || $aFields[0] == '@annually') $aFields = array(0, 0, 1, 1, '*');
+		elseif($aFields[0] == '@monthly') $aFields = array(0, 0, 1, '*', '*');
+		elseif($aFields[0] == '@weekly') $aFields = array(0, 0, '*', '*', 0);
+		elseif($aFields[0] == '@daily' || $aFields[0] == '@midnight') $aFields = array(0, 0, '*', '*', '*');
+		elseif($aFields[0] == '@hourly') $aFields = array(0, '*', '*', '*', '*');
+
+		$this->setCronFields($aFields[0], $aFields[1], $aFields[2], $aFields[3], $aFields[4]);
+	}
+
+	public function getNextRun($vDate) {
+		global $app;
+
+		$iTimestamp = ISPConfigDatetime::to_timestamp($vDate);
+		if($iTimestamp === false) return $iTimestamp;
+
+		if($this->_bParsed == false) $this->_calcValidValues();
+
+		// get the field values for the given Date.
+		list($iMinute, $iHour, $iDay, $iWDay, $iMonth, $iYear) = explode(':', ISPConfigDateTime::to_string($vDate, 'custom:%M:%H:%d:%w:%m:%Y'));
+
+		$bValid = false;
+		$iStartYear = $iYear;
+		while($bValid == false) {
+			$iCurMinute = $this->_getNextValue('minute', $iMinute, true);
+			$iCurHour = $this->_getNextValue('hour', $iHour, true);
+			$iCurDay = $this->_getNextValue('day', $iDay, true);
+			$iCurMonth = $this->_getNextValue('month', $iMonth, true);
+			$iCurWDay = $this->_getNextValue('weekday', $iWDay, true);
+
+			$iNextMinute = $this->_getNextValue('minute', $iMinute);
+			$iNextHour = $this->_getNextValue('hour', $iHour);
+			$iNextDay = $this->_getNextValue('day', $iDay);
+			$iNextMonth = $this->_getNextValue('month', $iMonth);
+			$iNextWDay = $this->_getNextValue('weekday', $iWDay);
+
+			if($iNextMinute > $iMinute && $iHour == $iCurHour && $iDay == $iCurDay && $iWDay == $iCurWDay && $iMonth == $iCurMonth) {
+				$iMinute = $iNextMinute;
+			} elseif($iNextHour > $iHour && $iDay == $iCurDay && $iWDay == $iCurWDay && $iMonth == $iCurMonth) {
+				$iMinute = reset($this->_aValidValues['minute']);
+				$iHour = $iNextHour;
+			} elseif($iNextDay > $iDay && ISPConfigDateTime::last_day($iMonth) >= $iNextDay && $iMonth == $iCurMonth) {
+				$iMinute = reset($this->_aValidValues['minute']);
+				$iHour = reset($this->_aValidValues['hour']);
+				$iDay = $iNextDay;
+			} elseif($iNextMonth > $iMonth) {
+				$iMinute = reset($this->_aValidValues['minute']);
+				$iHour = reset($this->_aValidValues['hour']);
+				$iDay = reset($this->_aValidValues['day']);
+				$iMonth = $iNextMonth;
+			} else {
+				$iMinute = reset($this->_aValidValues['minute']);
+				$iHour = reset($this->_aValidValues['hour']);
+				$iDay = reset($this->_aValidValues['day']);
+				$iMonth = reset($this->_aValidValues['month']);
+				$iYear++;
+			}
+
+			$ts = mktime($iHour, $iMinute, 0, $iMonth, $iDay, $iYear);
+			//print strftime('%d.%m.%Y (%A) %H:%M', $ts) . "\n";
+			//var_dump($iCurMinute, $iCurHour, $iCurDay, $iCurMonth, $iCurWDay, '--', $iNextMinute, $iNextHour, $iNextDay, $iNextMonth, $iNextWDay);
+			if(ISPConfigDateTime::last_day($iMonth, $iYear) >= $iDay && in_array($app->functions->intval(strftime('%w', $ts)), $this->_aValidValues['weekday'], true) === true) {
+				$bValid = true;
+			} else {
+				if($iYear - $iStartYear > 5) {
+					if(LOG_PRIORITY <= PRIO_ERROR) $portal->log('No valid run dates for schedule ' . $this->_sMinute . ' ' . $this->_sHour . ' ' . $this->_sDay . ' ' . $this->_sMonth . ' ' . $this->_sWDay . ' in the next 5 years!', PRIO_ERROR, __FILE__, __LINE__);
+					return false;
+				}
+			}
+		}
+
+		//var_dump($vDate, implode('-', array($iYear, $iMonth, $iDay, $iHour, $iNextMinute, 0)), $this->_sMinute, $this->_sHour, $this->_sDay, $this->_sWDay, $this->_sMonth, $this->_aValidValues);
+		return $iYear . '-' . $iMonth . '-' . $iDay . ' ' . $iHour . ':' . $iNextMinute . ':0';
+	}
+
+	private function _getNextValue($sField, $iValue, $bIncludeCurrent = false) {
+		if(!array_key_exists($sField, $this->_aValidValues)) return false;
+
+		reset($this->_aValidValues[$sField]);
+		while(($cur = each($this->_aValidValues[$sField])) !== false) {
+			if($bIncludeCurrent == true && $cur['value'] >= $iValue) return $cur['value'];
+			elseif($cur['value'] > $iValue) return $cur['value'];
+		}
+		return reset($this->_aValidValues[$sField]);
+	}
+
 }
 
 ?>
diff --git a/server/lib/classes/cronjob.inc.php b/server/lib/classes/cronjob.inc.php
index 651365440186c1377401534fa684279f24b0ae12..7fe90c2fd66f664475dda125551ae5751a711ca9 100644
--- a/server/lib/classes/cronjob.inc.php
+++ b/server/lib/classes/cronjob.inc.php
@@ -29,129 +29,133 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cronjob {
-    
-    // default is every 5 minutes
-    protected $_schedule = '*/5 * * * *';
-    
-    // may a run be skipped?
-    protected $_no_skip = false;
-    
-    // if true, this job is run when it is first recognized. If false, the next run is calculated from schedule on first run.
-    protected $_run_at_new = false;
-    
-    protected $_last_run = null;
-    protected $_next_run = null;
-    private $_running = false;
-    
-    /** return schedule */
-    public function getSchedule() {
-        return $this->_schedule;
-    }
-    
-    /** run through cronjob sequence **/
-    public function run() {
-        
-        print "Called run() for class " . get_class($this) . "\n";
-        print "Job has schedule: " . $this->_schedule . "\n";
-        $this->onPrepare();
-        $run_it = $this->onBeforeRun();
-        if($run_it == true) {
-            $this->onRunJob();
-            $this->onAfterRun();
-        }
-        $this->onCompleted();
-        
-        return;
-    }
-    
-    /* this function prepares some data for the job and sets next run time if first executed */
-    protected function onPrepare() {
-        global $app;
-        
-        print "Called onPrepare() for class " . get_class($this) . "\n";
-        // check the run time and values for this job
-
-        // get previous run data
-        $data = $app->db->queryOneRecord("SELECT `last_run`, `next_run`, `running` FROM `sys_cron` WHERE `name` = '" . $app->db->quote(get_class($this)) . "'");
-        if($data) {
-            if($data['last_run']) $this->_last_run = $data['last_run'];
-            if($data['next_run']) $this->_next_run = $data['next_run'];
-            if($data['running'] == 1) $this->_running = true;
-        }
-        if(!$this->_next_run) {
-            if($this->_run_at_new == true) {
-                $this->_next_run = ISPConfigDateTime::dbtime(); // run now.
-            } else {
-                $app->cron->parseCronLine($this->_schedule);
-                $next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
-                $this->_next_run = $next_run;
-                
-                $app->db->query("REPLACE INTO `sys_cron` (`name`, `last_run`, `next_run`, `running`) VALUES ('" . $app->db->quote(get_class($this)) . "', " . ($this->_last_run ? "'" . $app->db->quote($this->_last_run) . "'" : "NULL") . ", " . ($next_run === false ? "NULL" : "'" . $app->db->quote($next_run) . "'") . ", " . ($this->_running == true ? "1" : "0") . ")");
-            }
-        }
-    }
-    
-    /* this function checks if a cron job's next runtime is reached and returns true or false */
-    protected function onBeforeRun() {
-        global $app;
-        
-        print "Called onBeforeRun() for class " . get_class($this) . "\n";
-        
-        if($this->_running == true) return false; // job is still marked as running!
-        
-        print "Jobs next run is " . $this->_next_run . "\n";
-        $reached = ISPConfigDateTime::compare($this->_next_run, ISPConfigDateTime::dbtime());
-        print "Date compare of " . ISPConfigDateTime::to_timestamp($this->_next_run) . " and " . ISPConfigDateTime::dbtime() . " is " . $reached . "\n";
-        if($reached === false) return false; // error!
-        
-        if($reached === -1) {
-            // next_run time not reached
-            return false;
-        }
-        
-        // next_run time reached (reached === 0 or -1)
-        
-        // calculare next run time based on last_run or current time
-        $app->cron->parseCronLine($this->_schedule);
-        if($this->_no_skip == true) {
-            // we need to calculare the next run based on the previous next_run, as we may not skip one.
-            $next_run = $app->cron->getNextRun($this->_next_run);
-            if($next_run === false) {
-                // we could not calculate next run, try it with current time
-                $next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
-            }
-        } else {
-            // calculate next run based on current time
-            $next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
-        }
-        
-        print "Jobs next run is now " . $next_run . "\n";
-        
-        $app->db->query("REPLACE INTO `sys_cron` (`name`, `last_run`, `next_run`, `running`) VALUES ('" . $app->db->quote(get_class($this)) . "', NOW(), " . ($next_run === false ? "NULL" : "'" . $app->db->quote($next_run) . "'") . ", 1)");
-        return true;
-    }
-    
-    // child classes should override this!
-    protected function onRunJob() {
-        global $app;
-        
-        print "Called onRun() for class " . get_class($this) . "\n";
-    }
-    
-    // child classes may override this!
-    protected function onAfterRun() {
-        global $app;
-        
-        print "Called onAfterRun() for class " . get_class($this) . "\n";
-    }
-
-    // child classes may NOT override this!
-    private function onCompleted() {
-        global $app;
-        
-        print "Called onCompleted() for class " . get_class($this) . "\n";
-        $app->db->query("UPDATE `sys_cron` SET `running` = 0 WHERE `name` = '" . $app->db->quote(get_class($this)) . "'");
-    }
+
+	// default is every 5 minutes
+	protected $_schedule = '*/5 * * * *';
+
+	// may a run be skipped?
+	protected $_no_skip = false;
+
+	// if true, this job is run when it is first recognized. If false, the next run is calculated from schedule on first run.
+	protected $_run_at_new = false;
+
+	protected $_last_run = null;
+	protected $_next_run = null;
+	private $_running = false;
+
+	/** return schedule */
+
+
+	public function getSchedule() {
+		return $this->_schedule;
+	}
+
+
+
+	/** run through cronjob sequence **/
+	public function run() {
+
+		print "Called run() for class " . get_class($this) . "\n";
+		print "Job has schedule: " . $this->_schedule . "\n";
+		$this->onPrepare();
+		$run_it = $this->onBeforeRun();
+		if($run_it == true) {
+			$this->onRunJob();
+			$this->onAfterRun();
+		}
+		$this->onCompleted();
+
+		return;
+	}
+
+	/* this function prepares some data for the job and sets next run time if first executed */
+	protected function onPrepare() {
+		global $app;
+
+		print "Called onPrepare() for class " . get_class($this) . "\n";
+		// check the run time and values for this job
+
+		// get previous run data
+		$data = $app->db->queryOneRecord("SELECT `last_run`, `next_run`, `running` FROM `sys_cron` WHERE `name` = '" . $app->db->quote(get_class($this)) . "'");
+		if($data) {
+			if($data['last_run']) $this->_last_run = $data['last_run'];
+			if($data['next_run']) $this->_next_run = $data['next_run'];
+			if($data['running'] == 1) $this->_running = true;
+		}
+		if(!$this->_next_run) {
+			if($this->_run_at_new == true) {
+				$this->_next_run = ISPConfigDateTime::dbtime(); // run now.
+			} else {
+				$app->cron->parseCronLine($this->_schedule);
+				$next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
+				$this->_next_run = $next_run;
+
+				$app->db->query("REPLACE INTO `sys_cron` (`name`, `last_run`, `next_run`, `running`) VALUES ('" . $app->db->quote(get_class($this)) . "', " . ($this->_last_run ? "'" . $app->db->quote($this->_last_run) . "'" : "NULL") . ", " . ($next_run === false ? "NULL" : "'" . $app->db->quote($next_run) . "'") . ", " . ($this->_running == true ? "1" : "0") . ")");
+			}
+		}
+	}
+
+	/* this function checks if a cron job's next runtime is reached and returns true or false */
+	protected function onBeforeRun() {
+		global $app;
+
+		print "Called onBeforeRun() for class " . get_class($this) . "\n";
+
+		if($this->_running == true) return false; // job is still marked as running!
+
+		print "Jobs next run is " . $this->_next_run . "\n";
+		$reached = ISPConfigDateTime::compare($this->_next_run, ISPConfigDateTime::dbtime());
+		print "Date compare of " . ISPConfigDateTime::to_timestamp($this->_next_run) . " and " . ISPConfigDateTime::dbtime() . " is " . $reached . "\n";
+		if($reached === false) return false; // error!
+
+		if($reached === -1) {
+			// next_run time not reached
+			return false;
+		}
+
+		// next_run time reached (reached === 0 or -1)
+
+		// calculare next run time based on last_run or current time
+		$app->cron->parseCronLine($this->_schedule);
+		if($this->_no_skip == true) {
+			// we need to calculare the next run based on the previous next_run, as we may not skip one.
+			$next_run = $app->cron->getNextRun($this->_next_run);
+			if($next_run === false) {
+				// we could not calculate next run, try it with current time
+				$next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
+			}
+		} else {
+			// calculate next run based on current time
+			$next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
+		}
+
+		print "Jobs next run is now " . $next_run . "\n";
+
+		$app->db->query("REPLACE INTO `sys_cron` (`name`, `last_run`, `next_run`, `running`) VALUES ('" . $app->db->quote(get_class($this)) . "', NOW(), " . ($next_run === false ? "NULL" : "'" . $app->db->quote($next_run) . "'") . ", 1)");
+		return true;
+	}
+
+	// child classes should override this!
+	protected function onRunJob() {
+		global $app;
+
+		print "Called onRun() for class " . get_class($this) . "\n";
+	}
+
+	// child classes may override this!
+	protected function onAfterRun() {
+		global $app;
+
+		print "Called onAfterRun() for class " . get_class($this) . "\n";
+	}
+
+	// child classes may NOT override this!
+	private function onCompleted() {
+		global $app;
+
+		print "Called onCompleted() for class " . get_class($this) . "\n";
+		$app->db->query("UPDATE `sys_cron` SET `running` = 0 WHERE `name` = '" . $app->db->quote(get_class($this)) . "'");
+	}
 
 }
 
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index af09fbf91c06ca74a4fedb8dbc8ee880d90b08f9..9d56ac3055e09df3156b4f64681256b172bd16da 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -29,69 +29,69 @@
 
 class db extends mysqli
 {
-  protected $dbHost = '';		// hostname of the MySQL server
-  private $dbName = '';		// logical database name on that server
-  private $dbUser = '';		// database authorized user
-  private $dbPass = '';		// user's password
-  private $dbCharset = 'utf8';// Database charset
-  private $dbNewLink = false; // Return a new linkID when connect is called again
-  private $dbClientFlags = 0; // MySQL Client falgs
-  private $linkId = 0;		// last result of mysqli_connect()
-  private $queryId = 0;		// last result of mysqli_query()
-  private $record	= array();	// last record fetched
-  private $autoCommit = 1;    // Autocommit Transactions
-  private $currentRow;		// current row number
-  public $errorNumber = 0;	// last error number
-  public $errorMessage = '';	// last error message
-  private $errorLocation = '';// last error location
-  public $show_error_messages = false; // false in server, true in interface
-  private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
-
-  // constructor
-  public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL) {
-    global $app, $conf;
-
-    $this->dbHost = $host ? $host  : $conf['db_host'];
-    $this->dbName = $database ? $database : $conf['db_database'];
-    $this->dbUser = $user ? $user : $conf['db_user'];
-    $this->dbPass = $pass ? $pass : $conf['db_password'];
-    $this->dbCharset = $conf['db_charset'];
-    $this->dbNewLink = $conf['db_new_link'];
-    $this->dbClientFlags = $conf['db_client_flags'];
-
-    parent::__construct($this->dbHost, $this->dbUser, $this->dbPass,$this->dbName);
-    $try = 0;
-    //while(!is_null($this->connect_error) && $try < 10) {
-	while(mysqli_connect_error() && $try < 10) {
-      if($try > 8) sleep(5);
-      elseif($try > 0) sleep(1);
-      
-      $try++;
-      $this->updateError('DB::__construct');
-      
-      parent::__construct($this->dbHost, $this->dbUser, $this->dbPass,$this->dbName);
-    }
-    
-    //if(is_null($this->connect_error)) $this->isConnected = true;
-	if(!mysqli_connect_error()) $this->isConnected = true;
-    
-    $this->setCharacterEncoding();
-  }
-
-  public function __destruct() {
-    $this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
-  }
-
-  /* This allows our private variables to be "read" out side of the class */
-   public function __get($var) {
-	   return isset($this->$var) ? $this->$var : NULL;
-   }
-
-  // error handler
-  public function updateError($location) {
-    global $app;
+	protected $dbHost = '';  // hostname of the MySQL server
+	private $dbName = '';  // logical database name on that server
+	private $dbUser = '';  // database authorized user
+	private $dbPass = '';  // user's password
+	private $dbCharset = 'utf8';// Database charset
+	private $dbNewLink = false; // Return a new linkID when connect is called again
+	private $dbClientFlags = 0; // MySQL Client falgs
+	private $linkId = 0;  // last result of mysqli_connect()
+	private $queryId = 0;  // last result of mysqli_query()
+	private $record = array(); // last record fetched
+	private $autoCommit = 1;    // Autocommit Transactions
+	private $currentRow;  // current row number
+	public $errorNumber = 0; // last error number
+	public $errorMessage = ''; // last error message
+	private $errorLocation = '';// last error location
+	public $show_error_messages = false; // false in server, true in interface
+	private $isConnected = false; // needed to know if we have a valid mysqli object from the constructor
+
+	// constructor
+	public function __construct($host = NULL , $user = NULL, $pass = NULL, $database = NULL) {
+		global $app, $conf;
+
+		$this->dbHost = $host ? $host  : $conf['db_host'];
+		$this->dbName = $database ? $database : $conf['db_database'];
+		$this->dbUser = $user ? $user : $conf['db_user'];
+		$this->dbPass = $pass ? $pass : $conf['db_password'];
+		$this->dbCharset = $conf['db_charset'];
+		$this->dbNewLink = $conf['db_new_link'];
+		$this->dbClientFlags = $conf['db_client_flags'];
+
+		parent::__construct($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
+		$try = 0;
+		//while(!is_null($this->connect_error) && $try < 10) {
+		while(mysqli_connect_error() && $try < 10) {
+			if($try > 8) sleep(5);
+			elseif($try > 0) sleep(1);
+
+			$try++;
+			$this->updateError('DB::__construct');
+
+			parent::__construct($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
+		}
 
-	/*
+		//if(is_null($this->connect_error)) $this->isConnected = true;
+		if(!mysqli_connect_error()) $this->isConnected = true;
+
+		$this->setCharacterEncoding();
+	}
+
+	public function __destruct() {
+		$this->close(); // helps avoid memory leaks, and persitent connections that don't go away.
+	}
+
+	/* This allows our private variables to be "read" out side of the class */
+	public function __get($var) {
+		return isset($this->$var) ? $this->$var : NULL;
+	}
+
+	// error handler
+	public function updateError($location) {
+		global $app;
+
+		/*
     if(!is_null($this->connect_error)) {
       $this->errorNumber = $this->connect_errno;
       $this->errorMessage = $this->connect_error;
@@ -100,210 +100,212 @@ class db extends mysqli
       $this->errorMessage = $this->error;
     }
 	*/
-	if(mysqli_connect_error()) {
-      $this->errorNumber = mysqli_connect_errno();
-      $this->errorMessage = mysqli_connect_error();
-    } else {
-      $this->errorNumber = mysqli_errno($this);
-      $this->errorMessage = mysqli_error($this);
-    }
+		if(mysqli_connect_error()) {
+			$this->errorNumber = mysqli_connect_errno();
+			$this->errorMessage = mysqli_connect_error();
+		} else {
+			$this->errorNumber = mysqli_errno($this);
+			$this->errorMessage = mysqli_error($this);
+		}
 
-    $this->errorLocation = $location;
-    if($this->errorNumber) {
-      $error_msg = $this->errorLocation .' '. $this->errorMessage;
-      // This right here will allow us to use the samefile for server & interface
-      if($this->show_error_messages) {
-	echo $error_msg;
-      } else if(is_object($app) && method_exists($app, 'log')) {
-	$app->log($error_msg, LOGLEVEL_WARN);
-      } else {
-	      /* This could be called before $app is ever declared..  In that case we should just spit out to error_log() */
-	   error_log($error_msg);
-      }
-    }
-  }
-  
-  private function setCharacterEncoding() {
-    if($this->isConnected == false) return false;
-    parent::query( 'SET NAMES '.$this->dbCharset); 
-    parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
-  }
-
-  public function query($queryString) {
-    if($this->isConnected == false) return false;
-    $try = 0;
-    do {
-        $try++;
-        $ok = $this->ping();
-        if(!$ok) {
-            if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
-                if($try > 9) {
-                    $this->updateError('DB::query -> reconnect');
-                    return false;
-                } else {
-                    sleep(($try > 7 ? 5 : 1));
-                }
-            } else {
-                $this->setCharacterEncoding();
-                $ok = true;
-            }
-        }
-    } while($ok == false);
-	$this->queryId = parent::query($queryString);
-    $this->updateError('DB::query('.$queryString.') -> mysqli_query');
-    if(!$this->queryId) {
-      return false;
-    }
-    $this->currentRow = 0;
-    return $this->queryId;
-  }
-
-  // returns all records in an array
-  public function queryAllRecords($queryString) {
-    if(!$this->query($queryString))
-    {
-      return false;
-    }
-    $ret = array();
-    while($line = $this->nextRecord())
-    {
-      $ret[] = $line;
-    }
-    return $ret;
-  }
-
-  // returns one record in an array
-  public function queryOneRecord($queryString) {
-    if(!$this->query($queryString) || $this->numRows() == 0)
-    {
-      return false;
-    }
-    return $this->nextRecord();
-  }
-
-  // returns the next record in an array
-  public function nextRecord() {
-    $this->record = $this->queryId->fetch_assoc();
-    $this->updateError('DB::nextRecord()-> mysql_fetch_array');
-    if(!$this->record || !is_array($this->record))
-    {
-      return false;
-    }
-    $this->currentRow++;
-    return $this->record;
-  }
-
-  // returns number of rows returned by the last select query
-  public function numRows() {
-    return $this->queryId->num_rows;
-  }
-  
-  public function affectedRows() {
-	return $this->queryId->affected_rows;
-  }
-
-  // returns mySQL insert id
-  public function insertID() {
-    return $this->insert_id;
-  }
-
-
-  // Check der variablen
-  // Really.. using quote should be phased out in favor of using bind_param's.  Though, for legacy code..
-  // here's the equivalent
-  public function quote($formfield) {
-    return $this->escape_string($formfield);
-  }
-
-  // Check der variablen
-  public function unquote($formfield) {
-    return stripslashes($formfield);
-  }
-
-public function toLower($record) {
-    if(is_array($record)) {
-      foreach($record as $key => $val) {
-	$key = strtolower($key);
-	$out[$key] = $val;
-      }
-    }
-    return $out;
-  }
-
-  public function diffrec($record_old, $record_new) {
-    $diffrec_full = array();
-    $diff_num = 0;
-
-    if(is_array($record_old) && count($record_old) > 0) {
-      foreach($record_old as $key => $val) {
-	// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
-	if(@$record_new[$key] != $val) {
-	  // Record has changed
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = @$record_new[$key];
-	  $diff_num++;
-	} else {
-	  $diffrec_full['old'][$key] = $val;
-	  $diffrec_full['new'][$key] = $val;
+		$this->errorLocation = $location;
+		if($this->errorNumber) {
+			$error_msg = $this->errorLocation .' '. $this->errorMessage;
+			// This right here will allow us to use the samefile for server & interface
+			if($this->show_error_messages) {
+				echo $error_msg;
+			} else if(is_object($app) && method_exists($app, 'log')) {
+					$app->log($error_msg, LOGLEVEL_WARN);
+				} else {
+				/* This could be called before $app is ever declared..  In that case we should just spit out to error_log() */
+				error_log($error_msg);
+			}
+		}
+	}
+
+	private function setCharacterEncoding() {
+		if($this->isConnected == false) return false;
+		parent::query( 'SET NAMES '.$this->dbCharset);
+		parent::query( "SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'");
 	}
-      }
-      } elseif(is_array($record_new)) {
-	foreach($record_new as $key => $val) {
-	  if(isset($record_new[$key]) && @$record_old[$key] != $val) {
-	    // Record has changed
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = @$record_old[$key];
-	    $diff_num++;
-	  } else {
-	    $diffrec_full['new'][$key] = $val;
-	    $diffrec_full['old'][$key] = $val;
-	  }
+
+	public function query($queryString) {
+		if($this->isConnected == false) return false;
+		$try = 0;
+		do {
+			$try++;
+			$ok = $this->ping();
+			if(!$ok) {
+				if(!$this->real_connect($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName)) {
+					if($try > 9) {
+						$this->updateError('DB::query -> reconnect');
+						return false;
+					} else {
+						sleep(($try > 7 ? 5 : 1));
+					}
+				} else {
+					$this->setCharacterEncoding();
+					$ok = true;
+				}
+			}
+		} while($ok == false);
+		$this->queryId = parent::query($queryString);
+		$this->updateError('DB::query('.$queryString.') -> mysqli_query');
+		if(!$this->queryId) {
+			return false;
+		}
+		$this->currentRow = 0;
+		return $this->queryId;
 	}
-      }
 
-      return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+	// returns all records in an array
+	public function queryAllRecords($queryString) {
+		if(!$this->query($queryString))
+		{
+			return false;
+		}
+		$ret = array();
+		while($line = $this->nextRecord())
+		{
+			$ret[] = $line;
+		}
+		return $ret;
+	}
 
-    }
+	// returns one record in an array
+	public function queryOneRecord($queryString) {
+		if(!$this->query($queryString) || $this->numRows() == 0)
+		{
+			return false;
+		}
+		return $this->nextRecord();
+	}
 
-        /**
-        * Function to get the database-size
-        * @param string $database_name
-        * @return int - database-size in bytes
-        */
-        public function getDatabaseSize($database_name) {
-                global $app;
-                include('lib/mysql_clientdb.conf');
-                /* Connect to the database */
-                $link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
-                if (!$link) {
-                        $app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_DEBUG);
-                        return;
-                }
-                /* Get database-size from information_schema */
-		$result=mysql_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysql_real_escape_string($database_name)."';",$link);
-                $this->close;
-                if (!$result) {
-                        $app->log('Unable to get the database-size'.mysql_error($link),LOGLEVEL_DEBUG);
-                        return;
-                }
-                $database_size = mysql_fetch_row($result);
-                return $database_size[0];
-        }
-
-    //** Function to fill the datalog with a full differential record.
-    public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
-      global $app,$conf;
-
-      // Insert backticks only for incomplete table names.
-      if(stristr($db_table,'.')) {
-	$escape = '';
-      } else {
-	$escape = '`';
-      }
+	// returns the next record in an array
+	public function nextRecord() {
+		$this->record = $this->queryId->fetch_assoc();
+		$this->updateError('DB::nextRecord()-> mysql_fetch_array');
+		if(!$this->record || !is_array($this->record))
+		{
+			return false;
+		}
+		$this->currentRow++;
+		return $this->record;
+	}
+
+	// returns number of rows returned by the last select query
+	public function numRows() {
+		return $this->queryId->num_rows;
+	}
+
+	public function affectedRows() {
+		return $this->queryId->affected_rows;
+	}
+
+	// returns mySQL insert id
+	public function insertID() {
+		return $this->insert_id;
+	}
+
+
+	// Check der variablen
+	// Really.. using quote should be phased out in favor of using bind_param's.  Though, for legacy code..
+	// here's the equivalent
+	public function quote($formfield) {
+		return $this->escape_string($formfield);
+	}
+
+	// Check der variablen
+	public function unquote($formfield) {
+		return stripslashes($formfield);
+	}
+
+	public function toLower($record) {
+		if(is_array($record)) {
+			foreach($record as $key => $val) {
+				$key = strtolower($key);
+				$out[$key] = $val;
+			}
+		}
+		return $out;
+	}
+
+	public function diffrec($record_old, $record_new) {
+		$diffrec_full = array();
+		$diff_num = 0;
+
+		if(is_array($record_old) && count($record_old) > 0) {
+			foreach($record_old as $key => $val) {
+				// if(!isset($record_new[$key]) || $record_new[$key] != $val) {
+				if(@$record_new[$key] != $val) {
+					// Record has changed
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = @$record_new[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['old'][$key] = $val;
+					$diffrec_full['new'][$key] = $val;
+				}
+			}
+		} elseif(is_array($record_new)) {
+			foreach($record_new as $key => $val) {
+				if(isset($record_new[$key]) && @$record_old[$key] != $val) {
+					// Record has changed
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = @$record_old[$key];
+					$diff_num++;
+				} else {
+					$diffrec_full['new'][$key] = $val;
+					$diffrec_full['old'][$key] = $val;
+				}
+			}
+		}
+
+		return array('diff_num' => $diff_num, 'diff_rec' => $diffrec_full);
+
+	}
+
+	/**
+	 * Function to get the database-size
+	 * @param string $database_name
+	 * @return int - database-size in bytes
+	 */
+
+
+	public function getDatabaseSize($database_name) {
+		global $app;
+		include 'lib/mysql_clientdb.conf';
+		/* Connect to the database */
+		$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
+		if (!$link) {
+			$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_DEBUG);
+			return;
+		}
+		/* Get database-size from information_schema */
+		$result=mysql_query("SELECT SUM(data_length+index_length) FROM information_schema.TABLES WHERE table_schema='".mysql_real_escape_string($database_name)."';", $link);
+		$this->close;
+		if (!$result) {
+			$app->log('Unable to get the database-size'.mysql_error($link), LOGLEVEL_DEBUG);
+			return;
+		}
+		$database_size = mysql_fetch_row($result);
+		return $database_size[0];
+	}
+
+	//** Function to fill the datalog with a full differential record.
+	public function datalogSave($db_table, $action, $primary_field, $primary_id, $record_old, $record_new, $force_update = false) {
+		global $app, $conf;
+
+		// Insert backticks only for incomplete table names.
+		if(stristr($db_table, '.')) {
+			$escape = '';
+		} else {
+			$escape = '`';
+		}
 
 		if($force_update == true) {
 			//* We force a update even if no record has changed
-			$diffrec_full = array('new' => $record_new,'old' => $record_old);
+			$diffrec_full = array('new' => $record_new, 'old' => $record_old);
 			$diff_num = count($record_new);
 		} else {
 			//* get the difference record between old and new record
@@ -313,124 +315,124 @@ public function toLower($record) {
 			unset($tmp);
 		}
 
-      // Insert the server_id, if the record has a server_id
-      $server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
-      if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
+		// Insert the server_id, if the record has a server_id
+		$server_id = (isset($record_old['server_id']) && $record_old['server_id'] > 0)?$record_old['server_id']:0;
+		if(isset($record_new['server_id'])) $server_id = $record_new['server_id'];
 
 
-	if($diff_num > 0) {
-		$diffstr = $this->quote(serialize($diffrec_full));
-		if(isset($_SESSION)) {
-			$username = $this->quote($_SESSION['s']['user']['username']);
-		} else {
-			$username = 'admin';
+		if($diff_num > 0) {
+			$diffstr = $this->quote(serialize($diffrec_full));
+			if(isset($_SESSION)) {
+				$username = $this->quote($_SESSION['s']['user']['username']);
+			} else {
+				$username = 'admin';
+			}
+			$dbidx = $primary_field.':'.$primary_id;
+
+			if($action == 'INSERT') $action = 'i';
+			if($action == 'UPDATE') $action = 'u';
+			if($action == 'DELETE') $action = 'd';
+			$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
+			$this->query($sql);
 		}
-		$dbidx = $primary_field.':'.$primary_id;
 
-		if($action == 'INSERT') $action = 'i';
-		if($action == 'UPDATE') $action = 'u';
-		if($action == 'DELETE') $action = 'd';
-		$sql = "INSERT INTO sys_datalog (dbtable,dbidx,server_id,action,tstamp,user,data) VALUES ('".$db_table."','$dbidx','$server_id','$action','".time()."','$username','$diffstr')";
-		$this->query($sql);
+		return true;
 	}
 
-      return true;
-    }
+	//** Inserts a record and saves the changes into the datalog
+	public function datalogInsert($tablename, $insert_data, $index_field) {
+		global $app;
 
-    //** Inserts a record and saves the changes into the datalog
-    public function datalogInsert($tablename, $insert_data, $index_field) {
-      global $app;
-	  
-	  if(is_array($insert_data)) {
+		if(is_array($insert_data)) {
 			$key_str = '';
 			$val_str = '';
 			foreach($insert_data as $key => $val) {
 				$key_str .= "`".$key ."`,";
 				$val_str .= "'".$this->quote($val)."',";
 			}
-			$key_str = substr($key_str,0,-1);
-			$val_str = substr($val_str,0,-1);
+			$key_str = substr($key_str, 0, -1);
+			$val_str = substr($val_str, 0, -1);
 			$insert_data_str = '('.$key_str.') VALUES ('.$val_str.')';
 		} else {
 			$insert_data_str = $insert_data;
 		}
 
-      $old_rec = array();
-      $this->query("INSERT INTO $tablename $insert_data_str");
-      $index_value = $this->insertID();
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
+		$old_rec = array();
+		$this->query("INSERT INTO $tablename $insert_data_str");
+		$index_value = $this->insertID();
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'INSERT', $index_field, $index_value, $old_rec, $new_rec);
 
-      return $index_value;
-    }
+		return $index_value;
+	}
 
-    //** Updates a record and saves the changes into the datalog
-    public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
+	//** Updates a record and saves the changes into the datalog
+	public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
 		global $app;
-      
-	  $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-	  
-	  if(is_array($update_data)) {
+
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+
+		if(is_array($update_data)) {
 			$update_data_str = '';
 			foreach($update_data as $key => $val) {
 				$update_data_str .= "`".$key ."` = '".$this->quote($val)."',";
 			}
-			$update_data_str = substr($update_data_str,0,-1);
+			$update_data_str = substr($update_data_str, 0, -1);
 		} else {
 			$update_data_str = $update_data;
 		}
-		
-      $this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
-      $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-      return true;
-    }
+		$this->query("UPDATE $tablename SET $update_data_str WHERE $index_field = '$index_value'");
+		$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec, $force_update);
 
-    //** Deletes a record and saves the changes into the datalog
-    public function datalogDelete($tablename, $index_field, $index_value) {
-      global $app;
+		return true;
+	}
 
-      $old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
-      $this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
-      $new_rec = array();
-      $this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
+	//** Deletes a record and saves the changes into the datalog
+	public function datalogDelete($tablename, $index_field, $index_value) {
+		global $app;
+
+		$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
+		$this->query("DELETE FROM $tablename WHERE $index_field = '$index_value'");
+		$new_rec = array();
+		$this->datalogSave($tablename, 'DELETE', $index_field, $index_value, $old_rec, $new_rec);
+
+		return true;
+	}
 
-      return true;
-    }
-	
 	//** Deletes a record and saves the changes into the datalog
-    public function datalogError($errormsg) {
-      global $app;
-	  
-	  if(isset($app->modules->current_datalog_id) && $app->modules->current_datalog_id > 0) $this->query("UPDATE sys_datalog set error = '".$this->quote($errormsg)."' WHERE datalog_id = ".$app->modules->current_datalog_id);
+	public function datalogError($errormsg) {
+		global $app;
 
-      return true;
-    }
+		if(isset($app->modules->current_datalog_id) && $app->modules->current_datalog_id > 0) $this->query("UPDATE sys_datalog set error = '".$this->quote($errormsg)."' WHERE datalog_id = ".$app->modules->current_datalog_id);
 
+		return true;
+	}
 
-    public function freeResult($query) 
-    {
-      if(is_object($query) && (get_class($query) == "mysqli_result")) {
-	$query->free();
-	return true;
-      } else {
-	return false;
-      }
-    }
 
-    /* TODO: Does anything use this? */
-    public function delete() {
+	public function freeResult($query)
+	{
+		if(is_object($query) && (get_class($query) == "mysqli_result")) {
+			$query->free();
+			return true;
+		} else {
+			return false;
+		}
+	}
 
-    }
+	/* TODO: Does anything use this? */
+	public function delete() {
 
-    /* TODO: Does anything use this? */
-    public function Transaction($action) {
-      //action = begin, commit oder rollback
+	}
 
-    }
+	/* TODO: Does anything use this? */
+	public function Transaction($action) {
+		//action = begin, commit oder rollback
+
+	}
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -444,33 +446,33 @@ public function toLower($record) {
 
      */
 
-    public function createTable($table_name,$columns) {
-      $index = '';
-      $sql = "CREATE TABLE $table_name (";
-      foreach($columns as $col){
-	$sql .= $col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-
-	if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	if($col['notNull'] == true) {
-	  $sql .= 'NOT NULL ';
-	} else {
-	  $sql .= 'NULL ';
+	public function createTable($table_name, $columns) {
+		$index = '';
+		$sql = "CREATE TABLE $table_name (";
+		foreach($columns as $col){
+			$sql .= $col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+
+			if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+			if($col['notNull'] == true) {
+				$sql .= 'NOT NULL ';
+			} else {
+				$sql .= 'NULL ';
+			}
+			if($col['autoInc'] == true) $sql .= 'auto_increment ';
+			$sql.= ',';
+			// key Definitionen
+			if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+			if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+			if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
+		$sql .= ')';
+		$this->query($sql);
+		return true;
 	}
-	if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	$sql.= ',';
-	// key Definitionen
-	if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
-      $sql .= ')';
-      $this->query($sql);
-      return true;
-    }
 
-    /*
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -483,59 +485,59 @@ public function toLower($record) {
 
 
      */
-    public function alterTable($table_name,$columns) {
-      $index = '';
-      $sql = "ALTER TABLE $table_name ";
-      foreach($columns as $col){
-	if($col['action'] == 'add') {
-	  $sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'alter') {
-	  $sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'],$col['typeValue']).' ';
-	} elseif ($col['action'] == 'drop') {
-	  $sql .= 'DROP '.$col['name'].' ';
-	}
-	if($col['action'] != 'drop') {  
-	  if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
-	  if($col['notNull'] == true) {
-	    $sql .= 'NOT NULL ';
-	  } else {
-	    $sql .= 'NULL ';
-	  }
-	  if($col['autoInc'] == true) $sql .= 'auto_increment ';
-	  $sql.= ',';
-	  // Index definitions
-	  if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
-	  if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
-	  if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
-	}
-      }
-      $sql .= $index;
-      $sql = substr($sql,0,-1);
+	public function alterTable($table_name, $columns) {
+		$index = '';
+		$sql = "ALTER TABLE $table_name ";
+		foreach($columns as $col){
+			if($col['action'] == 'add') {
+				$sql .= 'ADD '.$col['name'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'alter') {
+				$sql .= 'CHANGE '.$col['name'].' '.$col['name_new'].' '.$this->mapType($col['type'], $col['typeValue']).' ';
+			} elseif ($col['action'] == 'drop') {
+				$sql .= 'DROP '.$col['name'].' ';
+			}
+			if($col['action'] != 'drop') {
+				if($col['defaultValue'] != '') $sql .= "DEFAULT '".$col['defaultValue']."' ";
+				if($col['notNull'] == true) {
+					$sql .= 'NOT NULL ';
+				} else {
+					$sql .= 'NULL ';
+				}
+				if($col['autoInc'] == true) $sql .= 'auto_increment ';
+				$sql.= ',';
+				// Index definitions
+				if($col['option'] == 'primary') $index .= 'PRIMARY KEY ('.$col['name'].'),';
+				if($col['option'] == 'index') $index .= 'INDEX ('.$col['name'].'),';
+				if($col['option'] == 'unique') $index .= 'UNIQUE ('.$col['name'].'),';
+			}
+		}
+		$sql .= $index;
+		$sql = substr($sql, 0, -1);
 
-      //die($sql);
-      $this->query($sql);
-      return true;
-    }
+		//die($sql);
+		$this->query($sql);
+		return true;
+	}
 
-    public function dropTable($table_name) {
-      $this->check($table_name);
-      $sql = "DROP TABLE '". $table_name."'";
-      return $this->query($sql);
-    }
+	public function dropTable($table_name) {
+		$this->check($table_name);
+		$sql = "DROP TABLE '". $table_name."'";
+		return $this->query($sql);
+	}
 
-    // gibt Array mit Tabellennamen zur�ck
-    public function getTables($database_name = '') {
-      if($this->isConnected == false) return false;
-      if($database_name == '') $database_name = $this->dbName;
-      $result = parent::query("SHOW TABLES FROM $database_name");
-      for ($i = 0; $i < $result->num_rows; $i++) {
-	$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
-      }
-      return $tb_names;       
-    }
+	// gibt Array mit Tabellennamen zur�ck
+	public function getTables($database_name = '') {
+		if($this->isConnected == false) return false;
+		if($database_name == '') $database_name = $this->dbName;
+		$result = parent::query("SHOW TABLES FROM $database_name");
+		for ($i = 0; $i < $result->num_rows; $i++) {
+			$tb_names[$i] = (($result->data_seek( $i) && (($___mysqli_tmp = $result->fetch_row()) !== NULL)) ? array_shift($___mysqli_tmp) : false);
+		}
+		return $tb_names;
+	}
 
-    // gibt Feldinformationen zur Tabelle zur�ck
-    /*
+	// gibt Feldinformationen zur Tabelle zur�ck
+	/*
        $columns = array(action =>   add | alter | drop
        name =>     Spaltenname
        name_new => neuer Spaltenname, nur bei 'alter' belegt
@@ -549,67 +551,67 @@ public function toLower($record) {
 
      */
 
-    function tableInfo($table_name) {
-
-      global $go_api,$go_info;
-      // Tabellenfelder einlesen
-
-      if($rows = $go_api->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
-	foreach($rows as $row) {
-	  $name = $row[0];
-	  $default = $row[4];
-	  $key = $row[3];
-	  $extra = $row[5];
-	  $isnull = $row[2];
-	  $type = $row[1];
-
-
-	  $column = array();
-
-	  $column['name'] = $name;
-	  //$column['type'] = $type;
-	  $column['defaultValue'] = $default;
-	  if(stristr($key,'PRI')) $column['option'] = 'primary';
-	  if(stristr($isnull,'YES')) {
-	    $column['notNull'] = false;
-	  } else {
-	    $column['notNull'] = true; 
-	  }
-	  if($extra == 'auto_increment') $column['autoInc'] = true;
-
-
-	  // Type in Metatype umsetzen
-
-	  if(stristr($type,'int(')) $metaType = 'int32';
-	      if(stristr($type,'bigint')) $metaType = 'int64';
-	      if(stristr($type,'char')) {
-	      $metaType = 'char';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'varchar')) {
-	      $metaType = 'varchar';
-	      $tmp_typeValue = explode('(',$type);
-	      $column['typeValue'] = substr($tmp_typeValue[1],0,-1);  
-	      }
-	      if(stristr($type,'text')) $metaType = 'text';
-	      if(stristr($type,'double')) $metaType = 'double';
-	      if(stristr($type,'blob')) $metaType = 'blob';
-
-
-	      $column['type'] = $metaType;
-
-	      $columns[] = $column;
-	      }
-	return $columns;
-      } else {
-	return false;
-      }
+	function tableInfo($table_name) {
+
+		global $go_api, $go_info;
+		// Tabellenfelder einlesen
+
+		if($rows = $go_api->db->queryAllRecords('SHOW FIELDS FROM '.$table_name)){
+			foreach($rows as $row) {
+				$name = $row[0];
+				$default = $row[4];
+				$key = $row[3];
+				$extra = $row[5];
+				$isnull = $row[2];
+				$type = $row[1];
+
+
+				$column = array();
+
+				$column['name'] = $name;
+				//$column['type'] = $type;
+				$column['defaultValue'] = $default;
+				if(stristr($key, 'PRI')) $column['option'] = 'primary';
+				if(stristr($isnull, 'YES')) {
+					$column['notNull'] = false;
+				} else {
+					$column['notNull'] = true;
+				}
+				if($extra == 'auto_increment') $column['autoInc'] = true;
+
+
+				// Type in Metatype umsetzen
+
+				if(stristr($type, 'int(')) $metaType = 'int32';
+				if(stristr($type, 'bigint')) $metaType = 'int64';
+				if(stristr($type, 'char')) {
+					$metaType = 'char';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'varchar')) {
+					$metaType = 'varchar';
+					$tmp_typeValue = explode('(', $type);
+					$column['typeValue'] = substr($tmp_typeValue[1], 0, -1);
+				}
+				if(stristr($type, 'text')) $metaType = 'text';
+				if(stristr($type, 'double')) $metaType = 'double';
+				if(stristr($type, 'blob')) $metaType = 'blob';
+
+
+				$column['type'] = $metaType;
+
+				$columns[] = $column;
+			}
+			return $columns;
+		} else {
+			return false;
+		}
 
 
-      //$this->createTable('tester',$columns);
+		//$this->createTable('tester',$columns);
 
-      /*
+		/*
 	 $result = mysql_list_fields($go_info["server"]["db_name"],$table_name);
 	 $fields = mysql_num_fields ($result);
 	 $i = 0;
@@ -634,40 +636,40 @@ public function toLower($record) {
 
 
 
-    }
+	}
+
+	public function mapType($metaType, $typeValue) {
+		global $go_api;
+		$metaType = strtolower($metaType);
+		switch ($metaType) {
+		case 'int16':
+			return 'smallint';
+			break;
+		case 'int32':
+			return 'int';
+			break;
+		case 'int64':
+			return 'bigint';
+			break;
+		case 'double':
+			return 'double';
+			break;
+		case 'char':
+			return 'char';
+			break;
+		case 'varchar':
+			if($typeValue < 1) die('Database failure: Lenght required for these data types.');
+			return 'varchar('.$typeValue.')';
+			break;
+		case 'text':
+			return 'text';
+			break;
+		case 'blob':
+			return 'blob';
+			break;
+		}
+	}
+
+}
 
-    public function mapType($metaType,$typeValue) {
-      global $go_api;
-      $metaType = strtolower($metaType);
-      switch ($metaType) {
-	case 'int16':
-	  return 'smallint';
-	  break;
-	case 'int32':
-	  return 'int';
-	  break;
-	case 'int64':
-	  return 'bigint';
-	  break;
-	case 'double':
-	  return 'double';
-	  break;
-	case 'char':
-	  return 'char';
-	  break;
-	case 'varchar':
-	  if($typeValue < 1) die('Database failure: Lenght required for these data types.');
-	  return 'varchar('.$typeValue.')';
-	      break;
-	      case 'text':
-	      return 'text';
-	      break;
-	      case 'blob':
-	      return 'blob';
-	      break;
-	      }
-	      }
-
-	      }
-
-	      ?>
+?>
diff --git a/server/lib/classes/file.inc.php b/server/lib/classes/file.inc.php
index c1f031b7916bb92e37bafd79628f7dde9a19b48a..a5f4c84d56ac1f9b8f0db72186cae3cb455c4298 100644
--- a/server/lib/classes/file.inc.php
+++ b/server/lib/classes/file.inc.php
@@ -29,250 +29,250 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class file{
-    
-    function rf($file){
-      global $app;
-      clearstatcache();
-      if(!$fp = fopen ($file, 'rb')){
-        $app->log('WARNING: Could not open file '.$file, 2);
-        return false;
-      } else {
-        if(filesize($file) > 0){
-          $content = fread($fp, filesize($file));
-        } else {
-          $content = '';
-        }
-        fclose($fp);
-        return $content;
-      }
-    }
-    
-    function wf($file, $content){
-      global $app;
-      $this->mkdirs(dirname($file));
-      if(!$fp = fopen ($file, 'wb')){
-        $app->log('WARNING: Could not open file '.$file, 2);
-        return false;
-      } else {
-        fwrite($fp,$content);
-        fclose($fp);
-        return true;
-      }
-    }
-    
-    function af($file, $content){
-      global $app;
-      $this->mkdirs(dirname($file));
-      if(!$fp = fopen ($file, 'ab')){
-        $app->log('WARNING: Could not open file '.$file, 2);
-        return false;
-      } else {
-        fwrite($fp,$content);
-        fclose($fp);
-        return true;
-      }
-    }
-    
-    function no_comments($file, $comment = '#'){
-      $content = $this->unix_nl($this->rf($file));
-      $lines = explode("\n", $content);
-      if(!empty($lines)){
-        foreach($lines as $line){
-          if(strstr($line, $comment)){
-            $pos = strpos($line, $comment);
-            if($pos != 0){
-              $new_lines[] = substr($line,0,$pos);
-            } else {
-              $new_lines[] = '';
-            }
-          } else {
-            $new_lines[] = $line;
-          }
-        }
-      }
-      if(is_array($new_lines)){
-        $content_without_comments = implode("\n", $new_lines);
-        $new_lines = NULL;
-        return $content_without_comments;
-      } else {
-        return '';
-      }
-    }
-    
-    function manual_entries($file, $separator = '#### MAKE MANUAL ENTRIES BELOW THIS LINE! ####'){
-      if(is_file($file)){
-        $content = $this->rf($file);
-        $parts = explode($separator, $content);
-        $manual = "\n".trim($parts[1]);
-        return $manual;
-      } else {
-        return '';
-      }
-    }
-    
-    function remove_blank_lines($input, $file = 1){
-      //Leerzeilen löschen
-      if($file){
-        $content = $this->unix_nl($this->rf($input));
-      } else {
-        $content = $input;
-      }
-      $lines = explode("\n", $content);
-      if(!empty($lines)){
-        foreach($lines as $line){
-          if(trim($line) != '') $new_lines[] = $line;
-        }
-      }
-      if(is_array($new_lines)){
-        $content = implode("\n", $new_lines);
-      } else {
-        $content = '';
-      }
-      if($file){
-        $this->wf($input, $content);
-      } else {
-        return $content;
-      }
-    }
-    
-    function unix_nl($input){
-      $output = str_replace("\r\n", "\n", $input);
-      $output = str_replace("\r", "\n", $output);
-      return $output;
-    }
-    
-    function fileowner($file){
-      $owner_id = fileowner($file);
-      clearstatcache();
-      return $owner_id;
-    }
-    
-    function mkdirs($strPath, $mode = '0755'){
-      // Verzeichnisse rekursiv erzeugen
-      if(is_dir($strPath)) return true;
-      $pStrPath = dirname($strPath);
-      if(!$this->mkdirs($pStrPath, $mode)) return false;
-      $old_umask = umask(0);
-      $ret_val = mkdir($strPath, octdec($mode));
-      umask($old_umask);
-      return $ret_val;
-    }
-    
-    function edit_dist($var, $val){
-      global $$var;
-      $files = array('/root/ispconfig/dist.inc.php');
-      foreach($files as $file){
-        if(is_file($file)){
-          $file_content = $this->unix_nl($this->rf($file));
-          $lines = explode("\n", $file_content);
-          for($i=0;$i<sizeof($lines);$i++){
-            $parts = explode('=', $lines[$i]);
-            if($parts[0] == $var || $parts[0] == '$'.$var.' '){
-              $parts[1] = str_replace($$var, $val, $parts[1]);
-            }
-            $lines[$i] = implode('=', $parts);
-          }
-          $file_content = implode("\n", $lines);
-          $this->wf($file, $file_content);
-        }
-      }
-    }
-    
-    function getDirectoryListing($dirname, $sortorder = 'a', $show_subdirs = 0, $show_subdirfiles = 0, $exts = '', $ext_save = 1){
-    // This function will return an array with filenames based on the criteria you can set in the variables
-    // @sortorder : a for ascending (the standard) or d for descending (you can use the "r" for reverse as well, works the same)
-    // @show_subdirs : 0 for NO, 1 for YES - meaning it will show the names of subdirectories if there are any
-    // Logically subdirnames will not be checked for the required extentions
-    // @show_subdirfiles : 0 for NO, 1 for YES - meaning it will show files from the subdirs
-    // Files from subdirs will be prefixed with the subdir name and checked for the required extentions.
-    // @exts can be either a string or an array, if not passed to the function, then the default will be a check for common image files
-    // If exts is set to "all" then all extentions are allowed
-    // @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
-    
-       $dirname = realpath($dirname);
-       if (!$exts || empty($exts) || $exts == '') {
-           $exts = array('jpg', 'gif', 'jpeg', 'png');
-       }
-       if ($handle = opendir($dirname)) {
-           $filelist = array();
-           while (false !== ($file = readdir($handle))) {
-    
-               // Filter out higher directory references
-               if ($file != '.' && $file != '..') {
-                   // Only look at directories or files, filter out symbolic links
-                   if ( filetype ($dirname.'/'.$file) != 'link') {
-                       // If it's a file, check against valid extentions and add to the list
-                       if ( filetype ($dirname.'/'.$file) == 'file' ) {
-                           if ($this->checkFileExtension($file, $exts, $ext_save)) {
-                                           $filelist[] = $file;
-                           }
-                       }
-                       // If it's a directory and either subdirs should be listed or files from subdirs add relevant names to the list
-                       else if ( filetype ($dirname.'/'.$file) == 'dir' && ($show_subdirs == 1 || $show_subdirfiles == 1)) {
-                           if ($show_subdirs == 1) {
-                               $filelist[] = $file;
-                           }
-                           if ($show_subdirfiles == 1) {
-                               $subdirname = $file;
-                               $subdirfilelist = $this->getDirectoryListing($dirname.'/'.$subdirname.'/', $sortorder, $show_subdirs, $show_subdirfiles, $exts, $ext_save);
-                               for ($i = 0 ; $i < count($subdirfilelist) ; $i++) {
-                                   $subdirfilelist[$i] = $subdirname.'/'.$subdirfilelist[$i];
-                               }
-                               $filelist = array_merge($filelist, $subdirfilelist);
-                           }
-    
-                       }
-    
-                   }
-               }
-           }
-           closedir($handle);
-    
-           // Sort the results
-           if (count($filelist) > 1) {
-               natcasesort($filelist);
-               if ($sortorder == 'd' || $sortorder == 'r' ) {
-                   $filelist = array_reverse($filelist, TRUE);
-               }
-           }
-           return $filelist;
-       }
-       else {
-           return false;
-       }
-    }
-    
-    function checkFileExtension($filename, $exts, $ext_save = 1){
-       $passed = FALSE;
-       if ($ext_save == 1) {
-           if (preg_match("/^\./", $filename)) {
-               return $passed;
-           }
-       }
-       if ($exts == 'all') {
-                       $passed = TRUE;
-           return $passed;
-       }
-       if (is_string($exts)) {
-           if (preg_match("/\.". $exts ."$/i", $filename)) {
-                           $passed = TRUE;
-               return $passed;
-           }
-       } else if (is_array($exts)) {
-           foreach ($exts as $theExt) {
-               if (preg_match("/\.". $theExt ."$/i", $filename)) {
-                   $passed = TRUE;
-                   return $passed;
-               }
-           }
-       }
-       return $passed;
-    }
-	
+
+	function rf($file){
+		global $app;
+		clearstatcache();
+		if(!$fp = fopen($file, 'rb')){
+			$app->log('WARNING: Could not open file '.$file, 2);
+			return false;
+		} else {
+			if(filesize($file) > 0){
+				$content = fread($fp, filesize($file));
+			} else {
+				$content = '';
+			}
+			fclose($fp);
+			return $content;
+		}
+	}
+
+	function wf($file, $content){
+		global $app;
+		$this->mkdirs(dirname($file));
+		if(!$fp = fopen($file, 'wb')){
+			$app->log('WARNING: Could not open file '.$file, 2);
+			return false;
+		} else {
+			fwrite($fp, $content);
+			fclose($fp);
+			return true;
+		}
+	}
+
+	function af($file, $content){
+		global $app;
+		$this->mkdirs(dirname($file));
+		if(!$fp = fopen($file, 'ab')){
+			$app->log('WARNING: Could not open file '.$file, 2);
+			return false;
+		} else {
+			fwrite($fp, $content);
+			fclose($fp);
+			return true;
+		}
+	}
+
+	function no_comments($file, $comment = '#'){
+		$content = $this->unix_nl($this->rf($file));
+		$lines = explode("\n", $content);
+		if(!empty($lines)){
+			foreach($lines as $line){
+				if(strstr($line, $comment)){
+					$pos = strpos($line, $comment);
+					if($pos != 0){
+						$new_lines[] = substr($line, 0, $pos);
+					} else {
+						$new_lines[] = '';
+					}
+				} else {
+					$new_lines[] = $line;
+				}
+			}
+		}
+		if(is_array($new_lines)){
+			$content_without_comments = implode("\n", $new_lines);
+			$new_lines = NULL;
+			return $content_without_comments;
+		} else {
+			return '';
+		}
+	}
+
+	function manual_entries($file, $separator = '#### MAKE MANUAL ENTRIES BELOW THIS LINE! ####'){
+		if(is_file($file)){
+			$content = $this->rf($file);
+			$parts = explode($separator, $content);
+			$manual = "\n".trim($parts[1]);
+			return $manual;
+		} else {
+			return '';
+		}
+	}
+
+	function remove_blank_lines($input, $file = 1){
+		//Leerzeilen löschen
+		if($file){
+			$content = $this->unix_nl($this->rf($input));
+		} else {
+			$content = $input;
+		}
+		$lines = explode("\n", $content);
+		if(!empty($lines)){
+			foreach($lines as $line){
+				if(trim($line) != '') $new_lines[] = $line;
+			}
+		}
+		if(is_array($new_lines)){
+			$content = implode("\n", $new_lines);
+		} else {
+			$content = '';
+		}
+		if($file){
+			$this->wf($input, $content);
+		} else {
+			return $content;
+		}
+	}
+
+	function unix_nl($input){
+		$output = str_replace("\r\n", "\n", $input);
+		$output = str_replace("\r", "\n", $output);
+		return $output;
+	}
+
+	function fileowner($file){
+		$owner_id = fileowner($file);
+		clearstatcache();
+		return $owner_id;
+	}
+
+	function mkdirs($strPath, $mode = '0755'){
+		// Verzeichnisse rekursiv erzeugen
+		if(is_dir($strPath)) return true;
+		$pStrPath = dirname($strPath);
+		if(!$this->mkdirs($pStrPath, $mode)) return false;
+		$old_umask = umask(0);
+		$ret_val = mkdir($strPath, octdec($mode));
+		umask($old_umask);
+		return $ret_val;
+	}
+
+	function edit_dist($var, $val){
+		global $$var;
+		$files = array('/root/ispconfig/dist.inc.php');
+		foreach($files as $file){
+			if(is_file($file)){
+				$file_content = $this->unix_nl($this->rf($file));
+				$lines = explode("\n", $file_content);
+				for($i=0;$i<sizeof($lines);$i++){
+					$parts = explode('=', $lines[$i]);
+					if($parts[0] == $var || $parts[0] == '$'.$var.' '){
+						$parts[1] = str_replace($$var, $val, $parts[1]);
+					}
+					$lines[$i] = implode('=', $parts);
+				}
+				$file_content = implode("\n", $lines);
+				$this->wf($file, $file_content);
+			}
+		}
+	}
+
+	function getDirectoryListing($dirname, $sortorder = 'a', $show_subdirs = 0, $show_subdirfiles = 0, $exts = '', $ext_save = 1){
+		// This function will return an array with filenames based on the criteria you can set in the variables
+		// @sortorder : a for ascending (the standard) or d for descending (you can use the "r" for reverse as well, works the same)
+		// @show_subdirs : 0 for NO, 1 for YES - meaning it will show the names of subdirectories if there are any
+		// Logically subdirnames will not be checked for the required extentions
+		// @show_subdirfiles : 0 for NO, 1 for YES - meaning it will show files from the subdirs
+		// Files from subdirs will be prefixed with the subdir name and checked for the required extentions.
+		// @exts can be either a string or an array, if not passed to the function, then the default will be a check for common image files
+		// If exts is set to "all" then all extentions are allowed
+		// @ext_save : 1 for YES, 0 for NO - meaning it will filter out system files or not (such as .htaccess)
+
+		$dirname = realpath($dirname);
+		if (!$exts || empty($exts) || $exts == '') {
+			$exts = array('jpg', 'gif', 'jpeg', 'png');
+		}
+		if ($handle = opendir($dirname)) {
+			$filelist = array();
+			while (false !== ($file = readdir($handle))) {
+
+				// Filter out higher directory references
+				if ($file != '.' && $file != '..') {
+					// Only look at directories or files, filter out symbolic links
+					if ( filetype($dirname.'/'.$file) != 'link') {
+						// If it's a file, check against valid extentions and add to the list
+						if ( filetype($dirname.'/'.$file) == 'file' ) {
+							if ($this->checkFileExtension($file, $exts, $ext_save)) {
+								$filelist[] = $file;
+							}
+						}
+						// If it's a directory and either subdirs should be listed or files from subdirs add relevant names to the list
+						else if ( filetype($dirname.'/'.$file) == 'dir' && ($show_subdirs == 1 || $show_subdirfiles == 1)) {
+								if ($show_subdirs == 1) {
+									$filelist[] = $file;
+								}
+								if ($show_subdirfiles == 1) {
+									$subdirname = $file;
+									$subdirfilelist = $this->getDirectoryListing($dirname.'/'.$subdirname.'/', $sortorder, $show_subdirs, $show_subdirfiles, $exts, $ext_save);
+									for ($i = 0 ; $i < count($subdirfilelist) ; $i++) {
+										$subdirfilelist[$i] = $subdirname.'/'.$subdirfilelist[$i];
+									}
+									$filelist = array_merge($filelist, $subdirfilelist);
+								}
+
+							}
+
+					}
+				}
+			}
+			closedir($handle);
+
+			// Sort the results
+			if (count($filelist) > 1) {
+				natcasesort($filelist);
+				if ($sortorder == 'd' || $sortorder == 'r' ) {
+					$filelist = array_reverse($filelist, TRUE);
+				}
+			}
+			return $filelist;
+		}
+		else {
+			return false;
+		}
+	}
+
+	function checkFileExtension($filename, $exts, $ext_save = 1){
+		$passed = FALSE;
+		if ($ext_save == 1) {
+			if (preg_match("/^\./", $filename)) {
+				return $passed;
+			}
+		}
+		if ($exts == 'all') {
+			$passed = TRUE;
+			return $passed;
+		}
+		if (is_string($exts)) {
+			if (preg_match("/\.". $exts ."$/i", $filename)) {
+				$passed = TRUE;
+				return $passed;
+			}
+		} else if (is_array($exts)) {
+				foreach ($exts as $theExt) {
+					if (preg_match("/\.". $theExt ."$/i", $filename)) {
+						$passed = TRUE;
+						return $passed;
+					}
+				}
+			}
+		return $passed;
+	}
+
 	function removeDirectory($dir){
 		//TODO: implement something to delete files/directories recursively that are owned by a certain user or group
 		if(is_dir($dir)){
-			$files = array_diff(scandir($dir), array('.','..'));
+			$files = array_diff(scandir($dir), array('.', '..'));
 			if(is_array($files) && !empty($files)){
 				foreach($files as $file){
 					if(is_dir($dir.'/'.$file)){
@@ -287,4 +287,5 @@ class file{
 	}
 
 }
+
 ?>
diff --git a/server/lib/classes/functions.inc.php b/server/lib/classes/functions.inc.php
index 74f840070682634abf8d4e3c7600d1113fb108db..a4b217ac6a769607096a9302aca58eff32b8b9dc 100644
--- a/server/lib/classes/functions.inc.php
+++ b/server/lib/classes/functions.inc.php
@@ -33,14 +33,14 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 class functions {
 	var $idn_converter = null;
-    var $idn_converter_name = '';
+	var $idn_converter_name = '';
 
 	public function mail($to, $subject, $text, $from, $filepath = '', $filetype = 'application/pdf', $filename = '', $cc = '', $bcc = '', $from_name = '') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		if($conf['demo_mode'] == true) $app->error("Mail sending disabled in demo mode.");
-		
-        $app->uses('getconf,ispcmail');
+
+		$app->uses('getconf,ispcmail');
 		$mail_config = $app->getconf->get_global_config('mail');
 		if($mail_config['smtp_enabled'] == 'y') {
 			$mail_config['use_smtp'] = true;
@@ -49,27 +49,27 @@ class functions {
 		$app->ispcmail->setSender($from, $from_name);
 		$app->ispcmail->setSubject($subject);
 		$app->ispcmail->setMailText($text);
-		
+
 		if($filepath != '') {
 			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
 			$app->ispcmail->readAttachFile($filepath);
 		}
-		
+
 		if($cc != '') $app->ispcmail->setHeader('Cc', $cc);
 		if($bcc != '') $app->ispcmail->setHeader('Bcc', $bcc);
-		
+
 		$app->ispcmail->send($to);
 		$app->ispcmail->finish();
-		
+
 		/* left in here just for the case...
 		if($filepath != '') {
 			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
-			
+
 			$content = file_get_contents($filepath);
 			$content = chunk_split(base64_encode($content));
 			$uid = strtoupper(md5(uniqid(time())));
 			$subject      = "=?utf-8?B?".base64_encode($subject)."?=";
-			
+
 			if($filename == '') {
 				$path_parts = pathinfo($filepath);
 				$filename = $path_parts["basename"];
@@ -109,30 +109,30 @@ class functions {
 		*/
 		return true;
 	}
-	
-	public function array_merge($array1,$array2) {
+
+	public function array_merge($array1, $array2) {
 		$out = $array1;
 		foreach($array2 as $key => $val) {
 			$out[$key] = $val;
 		}
 		return $out;
 	}
-	
+
 	public function currency_format($number, $view = '') {
 		global $app;
 		if($view != '') $number_format_decimals = (int)$app->lng('number_format_decimals_'.$view);
-        if(!$number_format_decimals) $number_format_decimals = (int)$app->lng('number_format_decimals');
-        
+		if(!$number_format_decimals) $number_format_decimals = (int)$app->lng('number_format_decimals');
+
 		$number_format_dec_point = $app->lng('number_format_dec_point');
 		$number_format_thousands_sep = $app->lng('number_format_thousands_sep');
 		if($number_format_thousands_sep == 'number_format_thousands_sep') $number_format_thousands_sep = '';
 		return number_format((double)$number, $number_format_decimals, $number_format_dec_point, $number_format_thousands_sep);
 	}
-	
+
 	public function get_ispconfig_url() {
 		global $app;
-		
-		$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
+
+		$url = (stristr($_SERVER['SERVER_PROTOCOL'], 'HTTPS') || stristr($_SERVER['HTTPS'], 'on'))?'https':'http';
 		if($_SERVER['SERVER_NAME'] != '_') {
 			$url .= '://'.$_SERVER['SERVER_NAME'];
 			if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
@@ -140,7 +140,7 @@ class functions {
 			}
 		} else {
 			$app->uses("getconf");
-			$server_config = $app->getconf->get_server_config(1,'server');
+			$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'];
@@ -148,53 +148,53 @@ class functions {
 		}
 		return $url;
 	}
-	
-    public function json_encode($data) {
+
+	public function json_encode($data) {
 		if(!function_exists('json_encode')){
 			if(is_array($data) || is_object($data)){
-				$islist = is_array($data) && (empty($data) || array_keys($data) === range(0,count($data)-1));
+				$islist = is_array($data) && (empty($data) || array_keys($data) === range(0, count($data)-1));
 
 				if($islist){
 					$json = '[' . implode(',', array_map(array($this, "json_encode"), $data) ) . ']';
 				} else {
-					$items = Array();
+					$items = array();
 					foreach( $data as $key => $value ) {
 						$items[] = $this->json_encode("$key") . ':' . $this->json_encode($value);
 					}
 					$json = '{' . implode(',', $items) . '}';
 				}
 			} elseif(is_string($data)){
-				# Escape non-printable or Non-ASCII characters.
-				# I also put the \\ character first, as suggested in comments on the 'addclashes' page.
+				// Escape non-printable or Non-ASCII characters.
+				// I also put the \\ character first, as suggested in comments on the 'addclashes' page.
 				$string = '"'.addcslashes($data, "\\\"\n\r\t/".chr(8).chr(12)).'"';
 				$json = '';
 				$len = strlen($string);
-				# Convert UTF-8 to Hexadecimal Codepoints.
+				// Convert UTF-8 to Hexadecimal Codepoints.
 				for($i = 0; $i < $len; $i++){
 					$char = $string[$i];
 					$c1 = ord($char);
 
-					# Single byte;
+					// Single byte;
 					if($c1 <128){
 						$json .= ($c1 > 31) ? $char : sprintf("\\u%04x", $c1);
 						continue;
 					}
 
-					# Double byte
+					// Double byte
 					$c2 = ord($string[++$i]);
 					if(($c1 & 32) === 0){
 						$json .= sprintf("\\u%04x", ($c1 - 192) * 64 + $c2 - 128);
 						continue;
 					}
 
-					# Triple
+					// Triple
 					$c3 = ord($string[++$i]);
 					if(($c1 & 16) === 0){
 						$json .= sprintf("\\u%04x", (($c1 - 224) <<12) + (($c2 - 128) << 6) + ($c3 - 128));
 						continue;
 					}
 
-					# Quadruple
+					// Quadruple
 					$c4 = ord($string[++$i]);
 					if(($c1 & 8) === 0){
 						$u = (($c1 & 15) << 2) + (($c2>>4) & 3) - 1;
@@ -205,25 +205,25 @@ class functions {
 					}
 				}
 			} else {
-				# int, floats, bools, null
+				// int, floats, bools, null
 				$json = strtolower(var_export($data, true));
 			}
 			return $json;
 		} else {
 			return json_encode($data);
 		}
-    }
-	
+	}
+
 	public function suggest_ips($type = 'IPv4'){
 		global $app;
-	
+
 		if($type == 'IPv4'){
 			$regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/";
 		} else {
 			// IPv6
 			$regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i";
 		}
-	
+
 		$ips = array();
 		$results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM server_ip WHERE ip_type = '".$type."'");
 		if(!empty($results) && is_array($results)){
@@ -249,7 +249,7 @@ class functions {
 				if(preg_match($regex, $result['ip'])) $ips[] = $result['ip'];
 			}
 		}
-	
+
 		$results = $app->db->queryAllRecords("SELECT xfer FROM dns_slave WHERE xfer != ''");
 		if(!empty($results) && is_array($results)){
 			foreach($results as $result){
@@ -294,105 +294,107 @@ class functions {
 		sort($ips, SORT_NUMERIC);
 
 		$result_array = array('cheader' => array(), 'cdata' => array());
-	
+
 		if(!empty($ips)){
 			$result_array['cheader'] = array('title' => 'IPs',
-											'total' => count($ips),
-											'limit' => count($ips)
-											);
-	
+				'total' => count($ips),
+				'limit' => count($ips)
+			);
+
 			foreach($ips as $ip){
-				$result_array['cdata'][] = array(	'title' => $ip,
-													'description' => $type,
-													'onclick' => '',
-													'fill_text' => $ip
-												);
+				$result_array['cdata'][] = array( 'title' => $ip,
+					'description' => $type,
+					'onclick' => '',
+					'fill_text' => $ip
+				);
 			}
 		}
-	
+
 		return $result_array;
 	}
 
-    public function intval($string, $force_numeric = false) {
-        if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
-            if($force_numeric == true) return floatval($string);
-            elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
-            else return 0;
-        } else {
-            return intval($string);
-        }
-    }
-    
-    /** IDN converter wrapper.
-     * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
-     */
-    private function _idn_encode_decode($domain, $encode = true) {
-        if($domain == '') return '';
-        if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
-        
-        // get domain and user part if it is an email
-        $user_part = false;
-        if(strpos($domain, '@') !== false) {
-            $user_part = substr($domain, 0, strrpos($domain, '@'));
-            $domain = substr($domain, strrpos($domain, '@') + 1);
-        }
-        
-        if($encode == true) {
-            if(function_exists('idn_to_ascii')) {
-                $domain = idn_to_ascii($domain);
-            } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
-                 /* use idna class:
+	public function intval($string, $force_numeric = false) {
+		if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) {
+			if($force_numeric == true) return floatval($string);
+			elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
+			else return 0;
+		} else {
+			return intval($string);
+		}
+	}
+
+	/** IDN converter wrapper.
+	 * all converter classes should be placed in ISPC_CLASS_PATH.'/idn/'
+	 */
+
+
+	private function _idn_encode_decode($domain, $encode = true) {
+		if($domain == '') return '';
+		if(preg_match('/^[0-9\.]+$/', $domain)) return $domain; // may be an ip address - anyway does not need to bee encoded
+
+		// get domain and user part if it is an email
+		$user_part = false;
+		if(strpos($domain, '@') !== false) {
+			$user_part = substr($domain, 0, strrpos($domain, '@'));
+			$domain = substr($domain, strrpos($domain, '@') + 1);
+		}
+
+		if($encode == true) {
+			if(function_exists('idn_to_ascii')) {
+				$domain = idn_to_ascii($domain);
+			} elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+				/* use idna class:
                  * @author  Matthias Sommerfeld <mso@phlylabs.de>
                  * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
                  * @version 0.8.0 2011-03-11
                  */
-                
-                if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
-                    include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
-                    $this->idn_converter = new idna_convert(array('idn_version' => 2008));
-                    $this->idn_converter_name = 'idna_convert.class';
-                }
-                $domain = $this->idn_converter->encode($domain);
-            }
-        } else {
-            if(function_exists('idn_to_utf8')) {
-                $domain = idn_to_utf8($domain);
-            } elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
-                 /* use idna class:
+
+				if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+					include_once ISPC_CLASS_PATH.'/idn/idna_convert.class.php';
+					$this->idn_converter = new idna_convert(array('idn_version' => 2008));
+					$this->idn_converter_name = 'idna_convert.class';
+				}
+				$domain = $this->idn_converter->encode($domain);
+			}
+		} else {
+			if(function_exists('idn_to_utf8')) {
+				$domain = idn_to_utf8($domain);
+			} elseif(file_exists(ISPC_CLASS_PATH.'/idn/idna_convert.class.php')) {
+				/* use idna class:
                  * @author  Matthias Sommerfeld <mso@phlylabs.de>
                  * @copyright 2004-2011 phlyLabs Berlin, http://phlylabs.de
                  * @version 0.8.0 2011-03-11
                  */
-                
-                if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
-                    include_once(ISPC_CLASS_PATH.'/idn/idna_convert.class.php');
-                    $this->idn_converter = new idna_convert(array('idn_version' => 2008));
-                    $this->idn_converter_name = 'idna_convert.class';
-                }
-                $domain = $this->idn_converter->decode($domain);
-            }
-        }
-        
-        if($user_part !== false) return $user_part . '@' . $domain;
-        else return $domain;
-    }
-     
-    public function idn_encode($domain) {
-        $domains = explode("\n", $domain);
-        for($d = 0; $d < count($domains); $d++) {
-            $domains[$d] = $this->_idn_encode_decode($domains[$d], true);
-        }
-        return implode("\n", $domains);
-    }
-    
-    public function idn_decode($domain) {
-        $domains = explode("\n", $domain);
-        for($d = 0; $d < count($domains); $d++) {
-            $domains[$d] = $this->_idn_encode_decode($domains[$d], false);
-        }
-        return implode("\n", $domains);
-    }
-		
+
+				if(!is_object($this->idn_converter) || $this->idn_converter_name != 'idna_convert.class') {
+					include_once ISPC_CLASS_PATH.'/idn/idna_convert.class.php';
+					$this->idn_converter = new idna_convert(array('idn_version' => 2008));
+					$this->idn_converter_name = 'idna_convert.class';
+				}
+				$domain = $this->idn_converter->decode($domain);
+			}
+		}
+
+		if($user_part !== false) return $user_part . '@' . $domain;
+		else return $domain;
+	}
+
+	public function idn_encode($domain) {
+		$domains = explode("\n", $domain);
+		for($d = 0; $d < count($domains); $d++) {
+			$domains[$d] = $this->_idn_encode_decode($domains[$d], true);
+		}
+		return implode("\n", $domains);
+	}
+
+	public function idn_decode($domain) {
+		$domains = explode("\n", $domain);
+		for($d = 0; $d < count($domains); $d++) {
+			$domains[$d] = $this->_idn_encode_decode($domains[$d], false);
+		}
+		return implode("\n", $domains);
+	}
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/getconf.inc.php b/server/lib/classes/getconf.inc.php
index b995a3976027e1bffdafdb4e884adffa1ff4fa42..c5ca6c696a9b3ba993f168f5dd51b0a89cc2af0b 100644
--- a/server/lib/classes/getconf.inc.php
+++ b/server/lib/classes/getconf.inc.php
@@ -31,7 +31,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 class getconf {
 
 	var $config;
-	
+
 	function get_server_config($server_id, $section = '') {
 		global $app;
 
@@ -41,17 +41,17 @@ class getconf {
 			$server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id);
 			$this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server['config']));
 		}
-		
+
 		if($section == '') {
 			return $this->config[$server_id];
 		} else {
 			return $this->config[$server_id][$section];
 		}
 	}
-	
+
 	public function get_global_config($section = '') {
 		global $app;
-		
+
 		if(!@is_array($this->config['global'])) {
 			$app->uses('ini_parser');
 			$tmp = $app->db->queryOneRecord('SELECT config FROM sys_ini WHERE sysini_id = 1');
@@ -59,6 +59,7 @@ class getconf {
 		}
 		return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
 	}
+
 }
 
 ?>
diff --git a/server/lib/classes/ini_parser.inc.php b/server/lib/classes/ini_parser.inc.php
index 003d04caf2becb357f03b4b9e9c03ffb9922b0b9..d4c94543c6acaf75f5c24ffe1e6a0c0c58bda20d 100644
--- a/server/lib/classes/ini_parser.inc.php
+++ b/server/lib/classes/ini_parser.inc.php
@@ -33,9 +33,9 @@ class ini_parser{
 	var $config;
 
 	function parse_ini_string($ini) {
-		$ini = str_replace("\r\n","\n",$ini);
-		$lines = explode("\n",$ini);
-		
+		$ini = str_replace("\r\n", "\n", $ini);
+		$lines = explode("\n", $ini);
+
 		foreach($lines as $line) {
 			$line = trim($line);
 			if($line != '') {
@@ -58,8 +58,8 @@ class ini_parser{
 			$content .= "[$section]\n";
 			foreach($data as $item => $value) {
 				if($value != '') {
-					$value 	= trim($value);
-					$item 	= trim($item);
+					$value  = trim($value);
+					$item  = trim($item);
 					$content .= "$item=$value\n";
 				}
 			}
diff --git a/server/lib/classes/libdatetime.inc.php b/server/lib/classes/libdatetime.inc.php
index 2735768c828dda85469a7069c7b9e88c31144b67..fe2b81553b25849fb956cdfa69d1b48e7b77015e 100644
--- a/server/lib/classes/libdatetime.inc.php
+++ b/server/lib/classes/libdatetime.inc.php
@@ -30,450 +30,460 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /**
  * Date and Time class
- * 
+ *
  * provides functions related to date and time operations
  */
+
+
 abstract class ISPConfigDateTime {
 
-    /**
-     * Get days, hours, minutes and seconds
-     *
-     * Returns an array with days, hours, minutes and seconds from a given amount of seconds
-     *
-     * @access public
-     * @param int $seconds amount of seconds
-     * @param bool $get_days if true get the days, too
-     * @return array data (0 => days, 1 => hours, 2 => minutes, 3 => seconds)
-     */
-    public static function get_parts($seconds, $get_days = false) {
-        $days = 0;
-        if($get_days == true) {
-            $days = floor($seconds / (3600 * 24));
-            $seconds = $seconds % (3600 * 24);
-        }
-        $hours = floor($seconds / 3600);
-        $seconds = $seconds % 3600;
-        $minutes = floor($seconds / 60);
-        $seconds = $seconds % 60;
-        
-        return array($days, $hours, $minutes, $seconds);
-    }
-    
-    public static function dbtime() {
-        global $app;
-        
-        $time = $app->db->queryOneRecord('SELECT UNIX_TIMESTAMP() as `time`');
-        return $time['time'];
-    }
-    
-    /**
-     * Get a unix timestamp for a date
-     * 
-     * @access public
-     * @param mixed $date the date to convert. Can be
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @return int the unix timestamp
-     */
-    public static function to_timestamp($date) {
-        if(!is_string($date) && !is_numeric($date)) return false;
-        $date = trim($date);
-        
-        if(is_numeric($date)) return $date;
-        
-        if(strpos($date, '-') !== false) {
-            $regex = "(\d{2,4})-(\d{1,2})-(\d{1,2})(\s+(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?";
-            $ok = preg_match("'$regex'", $date, $matches);
-            if($ok) {
-                $year = $matches[1];
-                $month = $matches[2];
-                $day = $matches[3];
-                $hour = isset($matches[5]) ? $matches[5] : 0;
-                $minute = isset($matches[6]) ? $matches[6] : 0;
-                $second = isset($matches[8]) ? $matches[8] : 0;
-            }
-        } else {
-            $regex = "(\d{1,2})[/.](\d{1,2})[/.](\d{2,4})(\s+(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?";
-            $ok = preg_match("'$regex'", $date, $matches);
-            if($ok) {
-                $year = $matches[3];
-                $month = $matches[2];
-                $day = $matches[1];
-                $hour = isset($matches[5]) ? $matches[5] : 0;
-                $minute = isset($matches[6]) ? $matches[6] : 0;
-                $second = isset($matches[8]) ? $matches[8] : 0;
-            }
-        }
-        
-        if(!$ok) return false;
-        
-        if(!$day || !$month || !$year) return false;
-        if(!$hour) $hour = 0;
-        if(!$minute) $minute = 0;
-        if(!$second) $second = 0;
-        if($year < 1900) $year += 1900;
-        
-        if(!checkdate($month, $day, $year)) return false;
-        
-        $date = mktime($hour, $minute, $second, $month, $day, $year);
-        
-        return $date;
-    }
-
-    /**
-     * Get a date string
-     *
-     * Returns a formatted date string
-     *
-     * @access public
-     * @param mixed $date the date to convert. Can be
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @param string $format the format to get the date string in.
-     * - short: dd.mm.yy
-     * - veryshort: dd.mm.
-     * - medium: dd.mm.yyyy
-     * - long: dd. Month yyyy
-     * - extra: Day, dd. Month yyyy
-     * - day: dd
-     * - monthnum: mm
-     * - shortmonth: Short month name like Mar for March
-     * - month: Month name
-     * - shortyear: yy
-     * - year: yyyy
-     * - onlydate: dd.mm
-     * - onlydatelong: dd. Month
-     * - onlytime: HH:MM
-     * - rss: Rss time format for XML
-     * - nice: if you prepend a nice: (like nice:long) you will get results like "today" or "yesterday" if applicable
-     * - custom: you can give a strftime format like %d.%m.%Y %H:%M if you prepend custom: to it
-     * @param bool $time if true apped the time to the date string
-     * @param bool $seconds if true append the seconds to the time
-     * @return string date string
-     */
-    public static function to_string($date, $format = 'short', $time = false, $seconds = false) {
-        global $portal;
-        
-        if(!$date) return '';
-        
-        setlocale(LC_TIME, array('de_DE.UTF-8', 'de_DE', 'de_DE.ISO-8859-1', 'de_DE.ISO-8859-15'));
-        
-        if(!is_numeric($date)) {
-            $date = self::to_timestamp($date);
-            if($date === false) return $date;
-        }
-        
-        if($format == 'timestamp') return $date;
-        
-        $fmt = '';
-        $prepend = '';
-        if(substr($format, 0, 5) == 'nice:') {
-            if(strftime('%d.%m.%Y', $date) == strftime('%d.%m.%Y', $portal->getTime())) {
-                if($time == true) $format = 'onlytime';
-                else $format = '';
-                $prepend = 'Heute';
-            } elseif(strftime('%d.%m.%Y', $date) == strftime('%d.%m.%Y', $portal->getTime() - 86400)) {
-                if($time == true) $format = 'onlytime';
-                else $format = '';
-                $prepend = 'Gestern';
-            } elseif(strftime('%d.%m.%Y', $date) == strftime('%d.%m.%Y', $portal->getTime() + 86400)) {
-                if($time == true) $format = 'onlytime';
-                else $format = '';
-                $prepend = 'Morgen';
-            } else {
-                $format = substr($format, 5);
-            }
-        } elseif(substr($format, 0, 7) == 'custom:') {
-            $fmt = substr($format, 7);
-            $format = '';
-            $time = false;
-        }
-        
-        if($format == 'short') $fmt = '%d.%m.%y';
-        elseif($format == 'veryshort') $fmt = '%d.%m.';
-        elseif($format == 'medium') $fmt = '%d.%m.%Y';
-        elseif($format == 'long') $fmt = '%d. %B %Y';
-        elseif($format == 'extra') $fmt = '%A, %d. %B %Y';
-        elseif($format == 'day') $fmt = '%d';
-        elseif($format == 'monthnum') $fmt = '%m';
-        elseif($format == 'shortmonth') $fmt = '%b';
-        elseif($format == 'month') $fmt = '%B';
-        elseif($format == 'shortyear') $fmt = '%y';
-        elseif($format == 'year') $fmt = '%Y';
-        elseif($format == 'onlydate') $fmt = '%d.%m.';
-        elseif($format == 'onlydatelong') $fmt = '%d. %B';
-        elseif($format == 'onlytime') {
-            $fmt = '%H:%M';
-            $time = false;
-        } elseif($format == 'rss') {
-            $ret = date(DATE_RSS, $date);
-            if($prepend != '') $ret = $prepend . ' ' . $ret;
-            return $ret;
-        } elseif($format == 'sitemap') {
-            $ret = date(DATE_ATOM, $date);
-            if($prepend != '') $ret = $prepend . ' ' . $ret;
-            return $ret;
-        }
-        if($time == true) $fmt .= ' %H:%M' . ($seconds == true ? ':%S' : '');
-        
-        if($fmt != '') $ret = strftime($fmt, $date);
-        else $ret = '';
-        
-        if($prepend != '') $ret = trim($prepend . ' ' . $ret);
-        return $ret;
-    }
-
-    /**
-     * Get the month difference of two dates
-     *
-     * Gets the difference in months of two given dates.
-     * The days are ignored, so the difference between 2010-01-21 and 2010-05-01 is 4!
-     *
-     * @access public
-     * @param mixed $date_from the beginning date, either
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @param mixed $date_to the ending date, either
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @param bool $return_years if set to true, the function returns an array of years and months instead of months
-     * @param bool $include_both if set to true, the starting AND ending month is included, so the month count is +1
-     * @return mixed either int (months) or array of int (0 => years, 1 => months) or FALSE on invalid dates
-     */
-    public static function months_between($date_from, $date_to, $return_years = false, $include_both = false) {
-        $date_from = self::to_string($date_from, 'custom:%Y%m');
-        if($date_from === false) return $date_from;
-        
-        $date_to = self::to_string($date_to, 'custom:%Y%m');
-        if($date_to === false) return $date_to;
-        
-        $date_from = intval($date_from);
-        $date_to = intval($date_to);
-        
-        if($date_to < $date_from) return false;
-        
-        $result = $date_to - $date_from;
-        if($include_both == true) $result++;
-        
-        $years = floor($result / 100);
-        $months = $result % 100;
-        if($months > 12) $months -= 88;
-        elseif($months == 12) {
-            $months = 0;
-            $years++;
-        }
-        if($return_years == true) return array($years, $months);
-        
-        $months += ($years * 12);
-        return $months;
-    }
-
-    /**
-     * Get the day difference of two dates
-     *
-     * Gets the difference in days of two given dates.
-     *
-     * @access public
-     * @param mixed $date_from the beginning date, either
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @param mixed $date_to the ending date, either
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @param bool $include_both if set to true, the starting AND ending day is included, so the day count is +1
-     * @return mixed either int (days) or FALSE on invalid dates
-     */
-    public static function days_between($date_from, $date_to, $include_both = false) {
-        $date_from = self::to_string($date_from, 'custom:%Y-%m-%d');
-        if($date_from === false) return $date_from;
-        list($y, $m, $d) = explode('-', $date_from);
-        $ts_from = mktime(0, 0, 0, $m, $d, $y);
-        
-        $date_to = self::to_string($date_to, 'custom:%Y-%m-%d');
-        if($date_to === false) return $date_to;
-        list($y, $m, $d) = explode('-', $date_to);
-        $ts_to = mktime(0, 0, 0, $m, $d, $y);
-        
-        $result = $ts_to - $ts_from;
-        if($include_both == true) $result++;
-        
-        $days = floor($result / (3600 * 24));
-        
-        return $days;
-    }
-
-    /**
-     * Check if one date is before another
-     *
-     * @access public
-     * @param mixed $date_1 the first date, either
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @param mixed $date_2 the second date, either
-     * - int (unix timestamp)
-     * - date string yyyy-mm-dd[ hh:mm:ss]
-     * - date string dd.mm.yyyy[ hh:mm:ss]
-     * @return mixed either int (1 if the first date is earlier, -1 if the second date is earlier, 0 if both are the same) or FALSE on invalid dates
-     */
-    public static function compare($date_1, $date_2) {
-        $ts_1 = self::to_timestamp($date_1);
-        if($ts_1 === false) return false;
-        $ts_2 = self::to_timestamp($date_2);
-        if($ts_2 === false) return false;
-        
-        if($ts_1 < $ts_2) return 1;
-        elseif($ts_1 > $ts_2) return -1;
-        else return 0;
-    }
-    
-    /**
-     * Convert date to sql format
-     *
-     * Converts a date from different formats to the sql format if possible
-     *
-     * @access public
-     * @param string $date date string in forms
-     * - dd.mm.yy
-     * - yyyy-mm-dd
-     * - yy-mm-dd
-     * - yyyy/mm/dd
-     * - dd.mm.yy
-     * - all formats can have time information HH:MM:SS appended
-     * @param bool $no_time if true, the resulting sql date is without time part even if time was part of the input
-     * @return mixed sql date string on success, error object otherwise
-     */
-    public static function sql_date($date = false, $no_time = false) {
-        global $portal;
-        
-        $result = '';
-        $time = '';
-        
-        if($date === false) $date = $portal->getTime(true);
-        
-        if(is_numeric($date)) {
-            return ($no_time ? strftime('%Y-%m-%d', $date) : strftime('%Y-%m-%d %H:%M:%S', $date));
-        }
-        
-        if(preg_match('/^(.*)(\d{1,2}:\d{1,2}(:\d{1,2})?)(\D|$)/', $date, $matches)) {
-            $date = $matches[1];
-            $time = ' ' . $matches[2];
-        }
-        if(preg_match('/(^|\D)(\d{4,4})-(\d{1,2})-(\d{1,2})(\D|$)/', $date, $result)) {
-            $day = $result[4];
-            $month = $result[3];
-            $year = $result[2];
-        } elseif(preg_match('/(^|\D)(\d{4,4})\/(\d{1,2})\/(\d{1,2})(\D|$)/', $date, $result)) {
-            $day = $result[4];
-            $month = $result[3];
-            $year = $result[2];
-        } elseif(preg_match('/(^|\D)(\d{2,2})-(\d{1,2})-(\d{1,2})(\D|$)/', $date, $result)) {
-            $day = $result[4];
-            $month = $result[3];
-            $year = $result[2];
-        } elseif(preg_match('/(^|\D)(\d{1,2})\.(\d{1,2})\.(\d{4,4})(\D|$)/', $date, $result)) {
-            $day = $result[2];
-            $month = $result[3];
-            $year = $result[4];
-        } elseif(preg_match('/(^|\D)(\d{1,2})\.(\d{1,2})\.(\d{2,2})(\D|$)/', $date, $result)) {
-            $day = $result[2];
-            $month = $result[3];
-            $year = $result[4];
-        } else {
-            return false;
-        }
-        if($no_time == true) $time = '';
-        
-        $day = str_pad(intval($day), 2, '0', STR_PAD_LEFT);
-        $month = str_pad(intval($month), 2, '0', STR_PAD_LEFT);
-        $year = intval($year);
-
-        $valid = checkdate($month, $day, $year);
-        if(!$valid) return false;
-        
-        return $year . '-' . $month . '-' . $day . $time;
-    }
-    
-    /**
-     * Get information if given date is leap year
-     * 
-     * @access public
-     * @param mixed $date Date to check
-     * @return bool true if leap year, false otherwise
-     */
-    public static function is_leap_year($date) {
-        // check if only year was given
-        if(is_numeric($date) && $date < 10000) $date .= '-01-01';
-        
-        $ts = self::to_timestamp($date);
-        if($ts === false) return false;
-        
-        if(date('L', $ts) == 1) return true;
-        else return false;
-    }
-    
-    /**
-     * Get the last day of the month
-     * 
-     * @access public
-     * @param int $month the month to get the last day for
-     * @param int $year the corresponding year (for february in leap years)
-     * @return bool true if leap year, false otherwise
-     */
-    public static function last_day($month, $year = false) {
-        switch($month) {
-            case 1:
-            case 3:
-            case 5:
-            case 7:
-            case 8:
-            case 10:
-            case 12:
-                return 31;
-                break;
-            case 2:
-                return ($year !== false && self::is_leap_year($year) ? 29 : 28);
-                break;
-            default:
-                return 30;
-                break;
-        }
-    }
-
-    /**
-     * Get age for given date
-     *
-     * Returns the age for a given date if possible
-     *
-     * @access public
-     * @param string $date see ISPConfigDateTime::sql_date() for possible values
-     * @return mixed int of age if successful, error object otherwise
-     * @see ISPConfigDateTime::sql_date
-     */
-    public static function calc_age($date) {
-        global $portal;
-        
-        $date = self::sql_date($date);
-        if($date === false) return $date;
-        
-        list($year, $month, $day) = explode('-', $date);
-        list($curyear, $curmonth, $curday) = explode('-', strftime('%Y-%m-%d', $portal->getTime()));
-        
-        $year_diff = $curyear - $year;
-        $month_diff = $curmonth - $month;
-        $day_diff = $curday - $day;
-        
-        if($day_diff < 0) $month_diff--;
-        if($month_diff < 0) $year_diff--;
-        if($year_diff < 0) $year_diff = 0;
-        
-        return $year_diff;
-    }
-}
+	/**
+	 * Get days, hours, minutes and seconds
+	 *
+	 * Returns an array with days, hours, minutes and seconds from a given amount of seconds
+	 *
+	 * @access public
+	 * @param int $seconds amount of seconds
+	 * @param bool $get_days if true get the days, too
+	 * @return array data (0 => days, 1 => hours, 2 => minutes, 3 => seconds)
+	 */
+	public static function get_parts($seconds, $get_days = false) {
+		$days = 0;
+		if($get_days == true) {
+			$days = floor($seconds / (3600 * 24));
+			$seconds = $seconds % (3600 * 24);
+		}
+		$hours = floor($seconds / 3600);
+		$seconds = $seconds % 3600;
+		$minutes = floor($seconds / 60);
+		$seconds = $seconds % 60;
+
+		return array($days, $hours, $minutes, $seconds);
+	}
+
+	public static function dbtime() {
+		global $app;
+
+		$time = $app->db->queryOneRecord('SELECT UNIX_TIMESTAMP() as `time`');
+		return $time['time'];
+	}
+
+
+
+	/**
+	 * Get a unix timestamp for a date
+	 *
+	 * @access public
+	 * @param mixed $date the date to convert. Can be
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @return int the unix timestamp
+	 */
+	public static function to_timestamp($date) {
+		if(!is_string($date) && !is_numeric($date)) return false;
+		$date = trim($date);
+
+		if(is_numeric($date)) return $date;
+
+		if(strpos($date, '-') !== false) {
+			$regex = "(\d{2,4})-(\d{1,2})-(\d{1,2})(\s+(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?";
+			$ok = preg_match("'$regex'", $date, $matches);
+			if($ok) {
+				$year = $matches[1];
+				$month = $matches[2];
+				$day = $matches[3];
+				$hour = isset($matches[5]) ? $matches[5] : 0;
+				$minute = isset($matches[6]) ? $matches[6] : 0;
+				$second = isset($matches[8]) ? $matches[8] : 0;
+			}
+		} else {
+			$regex = "(\d{1,2})[/.](\d{1,2})[/.](\d{2,4})(\s+(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?";
+			$ok = preg_match("'$regex'", $date, $matches);
+			if($ok) {
+				$year = $matches[3];
+				$month = $matches[2];
+				$day = $matches[1];
+				$hour = isset($matches[5]) ? $matches[5] : 0;
+				$minute = isset($matches[6]) ? $matches[6] : 0;
+				$second = isset($matches[8]) ? $matches[8] : 0;
+			}
+		}
+
+		if(!$ok) return false;
+
+		if(!$day || !$month || !$year) return false;
+		if(!$hour) $hour = 0;
+		if(!$minute) $minute = 0;
+		if(!$second) $second = 0;
+		if($year < 1900) $year += 1900;
+
+		if(!checkdate($month, $day, $year)) return false;
+
+		$date = mktime($hour, $minute, $second, $month, $day, $year);
+
+		return $date;
+	}
+
+	/**
+	 * Get a date string
+	 *
+	 * Returns a formatted date string
+	 *
+	 * @access public
+	 * @param mixed $date the date to convert. Can be
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @param string $format the format to get the date string in.
+	 * - short: dd.mm.yy
+	 * - veryshort: dd.mm.
+	 * - medium: dd.mm.yyyy
+	 * - long: dd. Month yyyy
+	 * - extra: Day, dd. Month yyyy
+	 * - day: dd
+	 * - monthnum: mm
+	 * - shortmonth: Short month name like Mar for March
+	 * - month: Month name
+	 * - shortyear: yy
+	 * - year: yyyy
+	 * - onlydate: dd.mm
+	 * - onlydatelong: dd. Month
+	 * - onlytime: HH:MM
+	 * - rss: Rss time format for XML
+	 * - nice: if you prepend a nice: (like nice:long) you will get results like "today" or "yesterday" if applicable
+	 * - custom: you can give a strftime format like %d.%m.%Y %H:%M if you prepend custom: to it
+	 * @param bool $time if true apped the time to the date string
+	 * @param bool $seconds if true append the seconds to the time
+	 * @return string date string
+	 */
+	public static function to_string($date, $format = 'short', $time = false, $seconds = false) {
+		global $portal;
+
+		if(!$date) return '';
+
+		setlocale(LC_TIME, array('de_DE.UTF-8', 'de_DE', 'de_DE.ISO-8859-1', 'de_DE.ISO-8859-15'));
+
+		if(!is_numeric($date)) {
+			$date = self::to_timestamp($date);
+			if($date === false) return $date;
+		}
+
+		if($format == 'timestamp') return $date;
+
+		$fmt = '';
+		$prepend = '';
+		if(substr($format, 0, 5) == 'nice:') {
+			if(strftime('%d.%m.%Y', $date) == strftime('%d.%m.%Y', $portal->getTime())) {
+				if($time == true) $format = 'onlytime';
+				else $format = '';
+				$prepend = 'Heute';
+			} elseif(strftime('%d.%m.%Y', $date) == strftime('%d.%m.%Y', $portal->getTime() - 86400)) {
+				if($time == true) $format = 'onlytime';
+				else $format = '';
+				$prepend = 'Gestern';
+			} elseif(strftime('%d.%m.%Y', $date) == strftime('%d.%m.%Y', $portal->getTime() + 86400)) {
+				if($time == true) $format = 'onlytime';
+				else $format = '';
+				$prepend = 'Morgen';
+			} else {
+				$format = substr($format, 5);
+			}
+		} elseif(substr($format, 0, 7) == 'custom:') {
+			$fmt = substr($format, 7);
+			$format = '';
+			$time = false;
+		}
+
+		if($format == 'short') $fmt = '%d.%m.%y';
+		elseif($format == 'veryshort') $fmt = '%d.%m.';
+		elseif($format == 'medium') $fmt = '%d.%m.%Y';
+		elseif($format == 'long') $fmt = '%d. %B %Y';
+		elseif($format == 'extra') $fmt = '%A, %d. %B %Y';
+		elseif($format == 'day') $fmt = '%d';
+		elseif($format == 'monthnum') $fmt = '%m';
+		elseif($format == 'shortmonth') $fmt = '%b';
+		elseif($format == 'month') $fmt = '%B';
+		elseif($format == 'shortyear') $fmt = '%y';
+		elseif($format == 'year') $fmt = '%Y';
+		elseif($format == 'onlydate') $fmt = '%d.%m.';
+		elseif($format == 'onlydatelong') $fmt = '%d. %B';
+		elseif($format == 'onlytime') {
+			$fmt = '%H:%M';
+			$time = false;
+		} elseif($format == 'rss') {
+			$ret = date(DATE_RSS, $date);
+			if($prepend != '') $ret = $prepend . ' ' . $ret;
+			return $ret;
+		} elseif($format == 'sitemap') {
+			$ret = date(DATE_ATOM, $date);
+			if($prepend != '') $ret = $prepend . ' ' . $ret;
+			return $ret;
+		}
+		if($time == true) $fmt .= ' %H:%M' . ($seconds == true ? ':%S' : '');
+
+		if($fmt != '') $ret = strftime($fmt, $date);
+		else $ret = '';
+
+		if($prepend != '') $ret = trim($prepend . ' ' . $ret);
+		return $ret;
+	}
+
+	/**
+	 * Get the month difference of two dates
+	 *
+	 * Gets the difference in months of two given dates.
+	 * The days are ignored, so the difference between 2010-01-21 and 2010-05-01 is 4!
+	 *
+	 * @access public
+	 * @param mixed $date_from the beginning date, either
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @param mixed $date_to the ending date, either
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @param bool $return_years if set to true, the function returns an array of years and months instead of months
+	 * @param bool $include_both if set to true, the starting AND ending month is included, so the month count is +1
+	 * @return mixed either int (months) or array of int (0 => years, 1 => months) or FALSE on invalid dates
+	 */
+	public static function months_between($date_from, $date_to, $return_years = false, $include_both = false) {
+		$date_from = self::to_string($date_from, 'custom:%Y%m');
+		if($date_from === false) return $date_from;
+
+		$date_to = self::to_string($date_to, 'custom:%Y%m');
+		if($date_to === false) return $date_to;
+
+		$date_from = intval($date_from);
+		$date_to = intval($date_to);
+
+		if($date_to < $date_from) return false;
+
+		$result = $date_to - $date_from;
+		if($include_both == true) $result++;
+
+		$years = floor($result / 100);
+		$months = $result % 100;
+		if($months > 12) $months -= 88;
+		elseif($months == 12) {
+			$months = 0;
+			$years++;
+		}
+		if($return_years == true) return array($years, $months);
+
+		$months += ($years * 12);
+		return $months;
+	}
 
+	/**
+	 * Get the day difference of two dates
+	 *
+	 * Gets the difference in days of two given dates.
+	 *
+	 * @access public
+	 * @param mixed $date_from the beginning date, either
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @param mixed $date_to the ending date, either
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @param bool $include_both if set to true, the starting AND ending day is included, so the day count is +1
+	 * @return mixed either int (days) or FALSE on invalid dates
+	 */
+	public static function days_between($date_from, $date_to, $include_both = false) {
+		$date_from = self::to_string($date_from, 'custom:%Y-%m-%d');
+		if($date_from === false) return $date_from;
+		list($y, $m, $d) = explode('-', $date_from);
+		$ts_from = mktime(0, 0, 0, $m, $d, $y);
+
+		$date_to = self::to_string($date_to, 'custom:%Y-%m-%d');
+		if($date_to === false) return $date_to;
+		list($y, $m, $d) = explode('-', $date_to);
+		$ts_to = mktime(0, 0, 0, $m, $d, $y);
+
+		$result = $ts_to - $ts_from;
+		if($include_both == true) $result++;
+
+		$days = floor($result / (3600 * 24));
+
+		return $days;
+	}
+
+	/**
+	 * Check if one date is before another
+	 *
+	 * @access public
+	 * @param mixed $date_1 the first date, either
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @param mixed $date_2 the second date, either
+	 * - int (unix timestamp)
+	 * - date string yyyy-mm-dd[ hh:mm:ss]
+	 * - date string dd.mm.yyyy[ hh:mm:ss]
+	 * @return mixed either int (1 if the first date is earlier, -1 if the second date is earlier, 0 if both are the same) or FALSE on invalid dates
+	 */
+	public static function compare($date_1, $date_2) {
+		$ts_1 = self::to_timestamp($date_1);
+		if($ts_1 === false) return false;
+		$ts_2 = self::to_timestamp($date_2);
+		if($ts_2 === false) return false;
+
+		if($ts_1 < $ts_2) return 1;
+		elseif($ts_1 > $ts_2) return -1;
+		else return 0;
+	}
+
+
+
+	/**
+	 * Convert date to sql format
+	 *
+	 * Converts a date from different formats to the sql format if possible
+	 *
+	 * @access public
+	 * @param string $date date string in forms
+	 * - dd.mm.yy
+	 * - yyyy-mm-dd
+	 * - yy-mm-dd
+	 * - yyyy/mm/dd
+	 * - dd.mm.yy
+	 * - all formats can have time information HH:MM:SS appended
+	 * @param bool $no_time if true, the resulting sql date is without time part even if time was part of the input
+	 * @return mixed sql date string on success, error object otherwise
+	 */
+	public static function sql_date($date = false, $no_time = false) {
+		global $portal;
+
+		$result = '';
+		$time = '';
+
+		if($date === false) $date = $portal->getTime(true);
+
+		if(is_numeric($date)) {
+			return $no_time ? strftime('%Y-%m-%d', $date) : strftime('%Y-%m-%d %H:%M:%S', $date);
+		}
+
+		if(preg_match('/^(.*)(\d{1,2}:\d{1,2}(:\d{1,2})?)(\D|$)/', $date, $matches)) {
+			$date = $matches[1];
+			$time = ' ' . $matches[2];
+		}
+		if(preg_match('/(^|\D)(\d{4,4})-(\d{1,2})-(\d{1,2})(\D|$)/', $date, $result)) {
+			$day = $result[4];
+			$month = $result[3];
+			$year = $result[2];
+		} elseif(preg_match('/(^|\D)(\d{4,4})\/(\d{1,2})\/(\d{1,2})(\D|$)/', $date, $result)) {
+			$day = $result[4];
+			$month = $result[3];
+			$year = $result[2];
+		} elseif(preg_match('/(^|\D)(\d{2,2})-(\d{1,2})-(\d{1,2})(\D|$)/', $date, $result)) {
+			$day = $result[4];
+			$month = $result[3];
+			$year = $result[2];
+		} elseif(preg_match('/(^|\D)(\d{1,2})\.(\d{1,2})\.(\d{4,4})(\D|$)/', $date, $result)) {
+			$day = $result[2];
+			$month = $result[3];
+			$year = $result[4];
+		} elseif(preg_match('/(^|\D)(\d{1,2})\.(\d{1,2})\.(\d{2,2})(\D|$)/', $date, $result)) {
+			$day = $result[2];
+			$month = $result[3];
+			$year = $result[4];
+		} else {
+			return false;
+		}
+		if($no_time == true) $time = '';
+
+		$day = str_pad(intval($day), 2, '0', STR_PAD_LEFT);
+		$month = str_pad(intval($month), 2, '0', STR_PAD_LEFT);
+		$year = intval($year);
+
+		$valid = checkdate($month, $day, $year);
+		if(!$valid) return false;
+
+		return $year . '-' . $month . '-' . $day . $time;
+	}
+
+
+
+	/**
+	 * Get information if given date is leap year
+	 *
+	 * @access public
+	 * @param mixed $date Date to check
+	 * @return bool true if leap year, false otherwise
+	 */
+	public static function is_leap_year($date) {
+		// check if only year was given
+		if(is_numeric($date) && $date < 10000) $date .= '-01-01';
+
+		$ts = self::to_timestamp($date);
+		if($ts === false) return false;
+
+		if(date('L', $ts) == 1) return true;
+		else return false;
+	}
+
+
+
+	/**
+	 * Get the last day of the month
+	 *
+	 * @access public
+	 * @param int $month the month to get the last day for
+	 * @param int $year the corresponding year (for february in leap years)
+	 * @return bool true if leap year, false otherwise
+	 */
+	public static function last_day($month, $year = false) {
+		switch($month) {
+		case 1:
+		case 3:
+		case 5:
+		case 7:
+		case 8:
+		case 10:
+		case 12:
+			return 31;
+			break;
+		case 2:
+			return $year !== false && self::is_leap_year($year) ? 29 : 28;
+			break;
+		default:
+			return 30;
+			break;
+		}
+	}
+
+	/**
+	 * Get age for given date
+	 *
+	 * Returns the age for a given date if possible
+	 *
+	 * @access public
+	 * @param string $date see ISPConfigDateTime::sql_date() for possible values
+	 * @return mixed int of age if successful, error object otherwise
+	 * @see ISPConfigDateTime::sql_date
+	 */
+	public static function calc_age($date) {
+		global $portal;
+
+		$date = self::sql_date($date);
+		if($date === false) return $date;
+
+		list($year, $month, $day) = explode('-', $date);
+		list($curyear, $curmonth, $curday) = explode('-', strftime('%Y-%m-%d', $portal->getTime()));
+
+		$year_diff = $curyear - $year;
+		$month_diff = $curmonth - $month;
+		$day_diff = $curday - $day;
+
+		if($day_diff < 0) $month_diff--;
+		if($month_diff < 0) $year_diff--;
+		if($year_diff < 0) $year_diff = 0;
+
+		return $year_diff;
+	}
+
+}
diff --git a/server/lib/classes/mod_mail_base.inc.php b/server/lib/classes/mod_mail_base.inc.php
index 01ffda57525e018dd6b20cb704c44030e072b035..bb25e5d29e5bc9546b6258c681d5e5c0d9fbae98 100644
--- a/server/lib/classes/mod_mail_base.inc.php
+++ b/server/lib/classes/mod_mail_base.inc.php
@@ -29,48 +29,48 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class mail_base {
-	
+
 	var $current_record = array();
-	
+
 	function write_config() {
-		
-		
-		
+
+
+
 	}
-	
+
 	/*
 		Domain Alias
 	*/
-	
+
 	function domain_add($domain) {
-		
+
 	}
-	
+
 	function domain_update($domain_old, $domain_new) {
-		
+
 	}
-	
+
 	function domain_delete($domain) {
-		
+
 	}
-	
+
 	/*
 		Domain Alias
 	*/
-	
+
 	function domain_alias_add($domain, $destination) {
-		
+
 	}
-	
+
 	function domain_alias_update($domain_old, $domain_new) {
-		
+
 	}
-	
+
 	function domain_alias_delete($domain) {
-		
+
 	}
-	
-	
+
+
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php
index 57ab22cb31a0ecae778f780aa054fb97e033bc22..194bf4f51abc191c5e3072c1e7eddd5dd13f0061 100644
--- a/server/lib/classes/modules.inc.php
+++ b/server/lib/classes/modules.inc.php
@@ -29,17 +29,17 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class modules {
-	
+
 	var $notification_hooks = array();
 	var $current_datalog_id = 0;
 	var $debug = false;
-	
+
 	/*
 	 This function is called to load the modules from the mods-enabled or the mods-core folder
 	*/
 	function loadModules($type) {
 		global $app, $conf;
-		
+
 		$subPath = 'mods-enabled';
 		if ($type == 'core') $subPath = 'mods-core';
 
@@ -47,41 +47,41 @@ class modules {
 		if (is_dir($modules_dir)) {
 			if ($dh = opendir($modules_dir)) {
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						$module_name = substr($file,0,-8);
-						include_once($modules_dir.$file);
-						if($this->debug) $app->log('Loading Module: '.$module_name,LOGLEVEL_DEBUG);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						$module_name = substr($file, 0, -8);
+						include_once $modules_dir.$file;
+						if($this->debug) $app->log('Loading Module: '.$module_name, LOGLEVEL_DEBUG);
 						$app->loaded_modules[$module_name] = new $module_name;
 						$app->loaded_modules[$module_name]->onLoad();
 					}
 				}
 			}
 		} else {
-			$app->log('Modules directory missing: '.$modules_dir,LOGLEVEL_ERROR);
+			$app->log('Modules directory missing: '.$modules_dir, LOGLEVEL_ERROR);
 		}
-		
+
 	}
-	
+
 	/*
 	 This function is called by the modules to register for a specific
 	 table change notification
 	*/
-	
-	function registerTableHook($table_name,$module_name,$function_name) {
+
+	function registerTableHook($table_name, $module_name, $function_name) {
 		global $app;
 		$this->notification_hooks[$table_name][] = array('module' => $module_name, 'function' => $function_name);
-		if($this->debug) $app->log("Registered TableHook '$table_name' in module '$module_name' for processing function '$function_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Registered TableHook '$table_name' in module '$module_name' for processing function '$function_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	/*
 	 This function goes through all new records in the
 	 sys_datalog table and and calls the function in the
 	 modules that hooked on to the table change.
 	*/
-	
+
 	function processDatalog() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		//* If its a multiserver setup
 		if($app->db->dbHost != $app->dbmaster->dbHost || ($app->db->dbHost == $app->dbmaster->dbHost && $app->db->dbName != $app->dbmaster->dbName)) {
 			if($conf['mirror_server_id'] > 0) {
@@ -89,10 +89,10 @@ class modules {
 			} else {
 				$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = 0) ORDER BY datalog_id LIMIT 0,1000";
 			}
-			
+
 			$records = $app->dbmaster->queryAllRecords($sql);
 			foreach($records as $d) {
-				
+
 				//** encode data to utf-8 and unserialize it
 				if(!$data = unserialize(stripslashes($d['data']))) {
 					$data = unserialize($d['data']);
@@ -106,17 +106,17 @@ class modules {
 					$data['new'][$key] = utf8_decode($val);
 				}
 				*/
-				
+
 				$replication_error = false;
 				$data['mirrored'] = false;
-				
+
 				$this->current_datalog_id = $d['datalog_id'];
-				
+
 				/*
-				* If we are in a mirror setup, rewrite the server_id of records that originally 
+				* If we are in a mirror setup, rewrite the server_id of records that originally
 				* belonged to the mirrored server to the local server_id
 				*/
-				
+
 				if($conf['mirror_server_id'] > 0 && $d['dbtable'] != 'server') {
 					if(isset($data['new']['server_id']) && $data['new']['server_id'] == $conf['mirror_server_id']) {
 						$data['new']['server_id'] = $conf['server_id'];
@@ -127,18 +127,18 @@ class modules {
 						$data['mirrored'] = true;
 					}
 				}
-				
+
 				if(count($data['new']) > 0) {
 					if($d['action'] == 'i' || $d['action'] == 'u') {
-						$idx = explode(':',$d['dbidx']);
+						$idx = explode(':', $d['dbidx']);
 						$tmp_sql1 = '';
 						$tmp_sql2 = '';
 						foreach($data['new'] as $fieldname => $val) {
 							$tmp_sql1 .= "`$fieldname`,";
 							$tmp_sql2 .= "'".$app->db->quote($val)."',";
 						}
-						$tmp_sql1 = substr($tmp_sql1,0,-1);
-						$tmp_sql2 = substr($tmp_sql2,0,-1);
+						$tmp_sql1 = substr($tmp_sql1, 0, -1);
+						$tmp_sql2 = substr($tmp_sql2, 0, -1);
 						//$tmp_sql1 .= "$idx[0]";
 						//$tmp_sql2 .= "$idx[1]";
 						$sql = "REPLACE INTO $d[dbtable] ($tmp_sql1) VALUES ($tmp_sql2)";
@@ -147,9 +147,9 @@ class modules {
 						$app->db->query($sql);
 						if($app->db->errorNumber > 0) {
 							$replication_error = true;
-							$app->log("Replication failed. Error: (" . $d['dbtable'] . ") in MySQL server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
+							$app->log("Replication failed. Error: (" . $d['dbtable'] . ") in MySQL server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql, LOGLEVEL_ERROR);
 						}
-						$app->log('Replicated from master: '.$sql,LOGLEVEL_DEBUG);
+						$app->log('Replicated from master: '.$sql, LOGLEVEL_DEBUG);
 					}
 					/*
 					if($d["action"] == 'u') {
@@ -169,29 +169,29 @@ class modules {
 					}
 					*/
 					if($d['action'] == 'd') {
-						$idx = explode(':',$d['dbidx']);
+						$idx = explode(':', $d['dbidx']);
 						$sql = "DELETE FROM $d[dbtable] ";
 						$sql .= " WHERE $idx[0] = $idx[1]";
 						$app->db->query($sql);
 						if($app->db->errorNumber > 0) {
 							$replication_error = true;
-							$app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
+							$app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql, LOGLEVEL_ERROR);
 						}
-						$app->log('Replicated from master: '.$sql,LOGLEVEL_DEBUG);
+						$app->log('Replicated from master: '.$sql, LOGLEVEL_DEBUG);
 					}
-				
-				
+
+
 					if($replication_error == false) {
 						if(is_array($data['old']) || is_array($data['new'])) {
 							$app->db->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']);
-							$this->raiseTableHook($d['dbtable'],$d['action'],$data);
+							$this->raiseTableHook($d['dbtable'], $d['action'], $data);
 						} else {
-							$app->log('Data array was empty for datalog_id '.$d['datalog_id'],LOGLEVEL_WARN);
+							$app->log('Data array was empty for datalog_id '.$d['datalog_id'], LOGLEVEL_WARN);
 						}
 						$app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf['server_id']);
-						$app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG);
+						$app->log('Processed datalog_id '.$d['datalog_id'], LOGLEVEL_DEBUG);
 					} else {
-						$app->log('Error in Replication, changes were not processed.',LOGLEVEL_ERROR);
+						$app->log('Error in Replication, changes were not processed.', LOGLEVEL_ERROR);
 						/*
 						 * If there is any error in processing the datalog we can't continue, because
 						 * we do not know if the newer actions require this (old) one.
@@ -199,16 +199,16 @@ class modules {
 						return;
 					}
 				} else {
-					$app->log('Datalog does not contain any changes for this record '.$d['datalog_id'],LOGLEVEL_DEBUG);
+					$app->log('Datalog does not contain any changes for this record '.$d['datalog_id'], LOGLEVEL_DEBUG);
 				}
 			}
-			
-		//* if we have a single server setup
+
+			//* if we have a single server setup
 		} else {
 			$sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf['server_id']." OR server_id = 0) ORDER BY datalog_id LIMIT 0,1000";
 			$records = $app->db->queryAllRecords($sql);
 			foreach($records as $d) {
-				
+
 				//** encode data to utf-8 to be able to unserialize it and then unserialize it
 				if(!$data = unserialize(stripslashes($d['data']))) {
 					$data = unserialize($d['data']);
@@ -222,51 +222,51 @@ class modules {
 					$data['new'][$key] = utf8_decode($val);
 				}
 				*/
-				
+
 				//* Data on a single server is never mirrored
 				$data['mirrored'] = false;
-				
+
 				$this->current_datalog_id = $d['datalog_id'];
 				if(is_array($data['old']) || is_array($data['new'])) {
-					$this->raiseTableHook($d['dbtable'],$d['action'],$data);
+					$this->raiseTableHook($d['dbtable'], $d['action'], $data);
 				} else {
-					$app->log('Data array was empty for datalog_id '.$d['datalog_id'],LOGLEVEL_WARN);
+					$app->log('Data array was empty for datalog_id '.$d['datalog_id'], LOGLEVEL_WARN);
 				}
 				//$app->db->query("DELETE FROM sys_datalog WHERE datalog_id = ".$rec["datalog_id"]);
 				//$app->log("Deleting sys_datalog ID ".$rec["datalog_id"],LOGLEVEL_DEBUG);
 				$app->db->query("UPDATE server SET updated = ".$d['datalog_id']." WHERE server_id = ".$conf['server_id']);
-				$app->log('Processed datalog_id '.$d['datalog_id'],LOGLEVEL_DEBUG);
+				$app->log('Processed datalog_id '.$d['datalog_id'], LOGLEVEL_DEBUG);
 			}
 		}
 	}
-	
+
 	function processActions() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		//* get the server_id of the local server
 		$server_id = intval($conf["server_id"]);
-		
-		include_once (SCRIPT_PATH."/lib/remote_action.inc.php");
-		
+
+		include_once SCRIPT_PATH."/lib/remote_action.inc.php";
+
 		//* SQL query to get all pending actions
 		$sql = "SELECT action_id, action_type, action_param " .
-				"FROM sys_remoteaction " .
-				"WHERE server_id = " . $server_id . " ".
-				" AND  action_id > " . intval($maxid_remote_action) . " ".
-				"ORDER BY action_id";
-		
+			"FROM sys_remoteaction " .
+			"WHERE server_id = " . $server_id . " ".
+			" AND  action_id > " . intval($maxid_remote_action) . " ".
+			"ORDER BY action_id";
+
 		$actions = $app->dbmaster->queryAllRecords($sql);
-		
+
 		if(is_array($actions)) {
 			foreach($actions as $action) {
-				
+
 				//* Raise the action
-				$state = $app->plugins->raiseAction($action['action_type'],$action['action_param']);
-				
+				$state = $app->plugins->raiseAction($action['action_type'], $action['action_param']);
+
 				//* Update the action state
 				$sql = "UPDATE sys_remoteaction " .
-						"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
-						"WHERE action_id = " . intval($action['action_id']);
+					"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
+					"WHERE action_id = " . intval($action['action_id']);
 				$app->dbmaster->query($sql);
 
 				/*
@@ -278,26 +278,26 @@ class modules {
 				fclose($fp);
 			}
 		}
-		
-		
-		
+
+
+
 	}
-	
-	function raiseTableHook($table_name,$action,$data) {
+
+	function raiseTableHook($table_name, $action, $data) {
 		global $app;
-		
+
 		// Get the hooks for this table
 		$hooks = (isset($this->notification_hooks[$table_name]))?$this->notification_hooks[$table_name]:'';
-		if($this->debug) $app->log("Raised TableHook for table: '$table_name'",LOGLEVEL_DEBUG);
-		
+		if($this->debug) $app->log("Raised TableHook for table: '$table_name'", LOGLEVEL_DEBUG);
+
 		if(is_array($hooks)) {
 			foreach($hooks as $hook) {
 				$module_name = $hook['module'];
 				$function_name = $hook['function'];
 				// Call the processing function of the module
-				if($this->debug) $app->log("Call function '$function_name' in module '$module_name' raised by TableHook '$table_name'.",LOGLEVEL_DEBUG);
+				if($this->debug) $app->log("Call function '$function_name' in module '$module_name' raised by TableHook '$table_name'.", LOGLEVEL_DEBUG);
 				// call_user_method($function_name,$app->loaded_modules[$module_name],$table_name,$action,$data);
-				call_user_func(array($app->loaded_modules[$module_name],$function_name),$table_name,$action,$data);
+				call_user_func(array($app->loaded_modules[$module_name], $function_name), $table_name, $action, $data);
 				unset($module_name);
 				unset($function_name);
 			}
@@ -305,7 +305,7 @@ class modules {
 		unset($hook);
 		unset($hooks);
 	}
-	
+
 }
 
 ?>
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index 42ef73ff8ec7ad435f446cc1baffed7002b5c5d1..99477a6000a83bd69b5a9595fbcfbc1c2f90dca2 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -55,64 +55,64 @@ class monitor_tools {
 				$distname = 'Ubuntu';
 				$distid = 'debian40';
 				$distbaseid = 'debian';
-				$ver = explode(' ',$issue);
+				$ver = explode(' ', $issue);
 				$ver = array_filter($ver);
 				$ver = next($ver);
-				$mainver = explode('.',$ver);
+				$mainver = explode('.', $ver);
 				$mainver = array_filter($mainver);
 				$mainver = current($mainver).'.'.next($mainver);
 				switch ($mainver){
 				case "12.10":
 					$relname = "(Quantal Quetzal)";
-				break;
+					break;
 				case "12.04":
 					$relname = "(Precise Pangolin)";
-				break;
+					break;
 				case "11.10":
 					$relname = "(Oneiric Ocelot)";
-				break;
+					break;
 				case "11.14":
 					$relname = "(Natty Narwhal)";
-				break;
+					break;
 				case "10.10":
 					$relname = "(Maverick Meerkat)";
-				break;
+					break;
 				case "10.04":
 					$relname = "(Lucid Lynx)";
-				break;
+					break;
 				case "9.10":
 					$relname = "(Karmic Koala)";
-				break;
+					break;
 				case "9.04":
 					$relname = "(Jaunty Jackpole)";
-				break;
+					break;
 				case "8.10":
-				$relname = "(Intrepid Ibex)";
-				break;
+					$relname = "(Intrepid Ibex)";
+					break;
 				case "8.04":
 					$relname = "(Hardy Heron)";
-				break;
+					break;
 				case "7.10":
 					$relname = "(Gutsy Gibbon)";
-				break;
+					break;
 				case "7.04":
 					$relname = "(Feisty Fawn)";
-				break;
+					break;
 				case "6.10":
 					$relname = "(Edgy Eft)";
-				break;
+					break;
 				case "6.06":
 					$relname = "(Dapper Drake)";
-				break;
+					break;
 				case "5.10":
 					$relname = "(Breezy Badger)";
-				break;
+					break;
 				case "5.04":
 					$relname = "(Hoary Hedgehog)";
-				break;
+					break;
 				case "4.10":
 					$relname = "(Warty Warthog)";
-				break;
+					break;
 				default:
 					$relname = "UNKNOWN";
 				}
@@ -226,12 +226,14 @@ class monitor_tools {
 		return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
 	}
 
-    // this function remains in the tools class, because it is used by cron AND rescue
+	// this function remains in the tools class, because it is used by cron AND rescue
 	public function monitorServices() {
 		global $app;
 		global $conf;
 
 		/** the id of the server as int */
+
+
 		$server_id = intval($conf['server_id']);
 
 		/**  get the "active" Services of the server from the DB */
@@ -331,14 +333,14 @@ class monitor_tools {
 				$state = 'error'; // because service is down
 			}
 		}
-        $data['mongodbserver'] = -1;
-        if ($this->_checkTcp('localhost', 27017)) {
-            $data['mongodbserver'] = 1;
-        } else {
-            $data['mongodbserver'] = 0;
-            //$state = 'error'; // because service is down 
-            /* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */
-        }
+		$data['mongodbserver'] = -1;
+		if ($this->_checkTcp('localhost', 27017)) {
+			$data['mongodbserver'] = 1;
+		} else {
+			$data['mongodbserver'] = 0;
+			//$state = 'error'; // because service is down
+			/* TODO!!! check if this is a mongodbserver at all, otherwise it will always throw an error state!!! */
+		}
 
 		/*
 		 * Return the Result
@@ -349,7 +351,7 @@ class monitor_tools {
 		$res['state'] = $state;
 		return $res;
 	}
-    
+
 	public function _getLogData($log) {
 		global $conf;
 
@@ -367,111 +369,111 @@ class monitor_tools {
 		}
 
 		switch ($log) {
-			case 'log_mail':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/mail.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/maillog';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/mail.info';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/maillog';
-				}
-				break;
-			case 'log_mail_warn':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/mail.warn';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/maillog';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/mail.warn';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/maillog';
-				}
-				break;
-			case 'log_mail_err':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/mail.err';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/maillog';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/mail.err';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/maillog';
-				}
-				break;
-			case 'log_messages':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/syslog';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/messages';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/messages';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/messages';
-				}
-				break;
-			case 'log_ispc_cron':
-				if ($dist == 'debian') {
-					$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
-				} elseif ($dist == 'suse') {
-					$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/cron';
-				}
-				break;
-			case 'log_freshclam':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/clamav/freshclam.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = (is_file('/var/log/clamav/freshclam.log') ? '/var/log/clamav/freshclam.log' : '/var/log/freshclam.log');
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/freshclam.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/clamav/freshclam.log';
-				}
-				break;
-			case 'log_clamav':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/clamav/clamav.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = (is_file('/var/log/clamav/clamd.log') ? '/var/log/clamav/clamd.log' : '/var/log/maillog');
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/clamd.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/clamav/clamd.log';
-				}
-				break;
-			case 'log_fail2ban':
-				if ($dist == 'debian') {
-					$logfile = '/var/log/fail2ban.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = '/var/log/fail2ban.log';
-				} elseif ($dist == 'suse') {
-					$logfile = '/var/log/fail2ban.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = '/var/log/fail2ban.log';
-				}
-				break;
-			case 'log_mongodb':
-					$logfile = '/var/log/mongodb/mongodb.log';
-				break;
-			case 'log_ispconfig':
-				if ($dist == 'debian') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				} elseif ($dist == 'redhat') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				} elseif ($dist == 'suse') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				} elseif ($dist == 'gentoo') {
-					$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
-				}
-				break;
-			default:
-				$logfile = '';
-				break;
+		case 'log_mail':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/mail.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/maillog';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/mail.info';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/maillog';
+			}
+			break;
+		case 'log_mail_warn':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/mail.warn';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/maillog';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/mail.warn';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/maillog';
+			}
+			break;
+		case 'log_mail_err':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/mail.err';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/maillog';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/mail.err';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/maillog';
+			}
+			break;
+		case 'log_messages':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/syslog';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/messages';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/messages';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/messages';
+			}
+			break;
+		case 'log_ispc_cron':
+			if ($dist == 'debian') {
+				$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
+			} elseif ($dist == 'suse') {
+				$logfile = $conf['ispconfig_log_dir'] . '/cron.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/cron';
+			}
+			break;
+		case 'log_freshclam':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/clamav/freshclam.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = (is_file('/var/log/clamav/freshclam.log') ? '/var/log/clamav/freshclam.log' : '/var/log/freshclam.log');
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/freshclam.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/clamav/freshclam.log';
+			}
+			break;
+		case 'log_clamav':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/clamav/clamav.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = (is_file('/var/log/clamav/clamd.log') ? '/var/log/clamav/clamd.log' : '/var/log/maillog');
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/clamd.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/clamav/clamd.log';
+			}
+			break;
+		case 'log_fail2ban':
+			if ($dist == 'debian') {
+				$logfile = '/var/log/fail2ban.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = '/var/log/fail2ban.log';
+			} elseif ($dist == 'suse') {
+				$logfile = '/var/log/fail2ban.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = '/var/log/fail2ban.log';
+			}
+			break;
+		case 'log_mongodb':
+			$logfile = '/var/log/mongodb/mongodb.log';
+			break;
+		case 'log_ispconfig':
+			if ($dist == 'debian') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			} elseif ($dist == 'redhat') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			} elseif ($dist == 'suse') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			} elseif ($dist == 'gentoo') {
+				$logfile = $conf['ispconfig_log_dir'] . '/ispconfig.log';
+			}
+			break;
+		default:
+			$logfile = '';
+			break;
 		}
 
 		// Getting the logfile content
@@ -578,39 +580,39 @@ class monitor_tools {
 		 * Calculate the weight of the old state
 		 */
 		switch ($oldState) {
-			case 'no_state': $oldInt = 0;
-				break;
-			case 'ok': $oldInt = 1;
-				break;
-			case 'unknown': $oldInt = 2;
-				break;
-			case 'info': $oldInt = 3;
-				break;
-			case 'warning': $oldInt = 4;
-				break;
-			case 'critical': $oldInt = 5;
-				break;
-			case 'error': $oldInt = 6;
-				break;
+		case 'no_state': $oldInt = 0;
+			break;
+		case 'ok': $oldInt = 1;
+			break;
+		case 'unknown': $oldInt = 2;
+			break;
+		case 'info': $oldInt = 3;
+			break;
+		case 'warning': $oldInt = 4;
+			break;
+		case 'critical': $oldInt = 5;
+			break;
+		case 'error': $oldInt = 6;
+			break;
 		}
 		/*
 		 * Calculate the weight of the new state
 		 */
 		switch ($newState) {
-			case 'no_state': $newInt = 0;
-				break;
-			case 'ok': $newInt = 1;
-				break;
-			case 'unknown': $newInt = 2;
-				break;
-			case 'info': $newInt = 3;
-				break;
-			case 'warning': $newInt = 4;
-				break;
-			case 'critical': $newInt = 5;
-				break;
-			case 'error': $newInt = 6;
-				break;
+		case 'no_state': $newInt = 0;
+			break;
+		case 'ok': $newInt = 1;
+			break;
+		case 'unknown': $newInt = 2;
+			break;
+		case 'info': $newInt = 3;
+			break;
+		case 'warning': $newInt = 4;
+			break;
+		case 'critical': $newInt = 5;
+			break;
+		case 'error': $newInt = 6;
+			break;
 		}
 
 		/*
@@ -645,12 +647,12 @@ class monitor_tools {
 		 * the server-id!
 		 */
 		$sql = 'DELETE FROM monitor_data ' .
-				'WHERE ' .
-				'  type =' . "'" . $app->dbmaster->quote($type) . "' " .
-				'AND ' .
-				'  created < ' . $old . ' ' .
-				'AND ' .
-				'  server_id = ' . $serverId;
+			'WHERE ' .
+			'  type =' . "'" . $app->dbmaster->quote($type) . "' " .
+			'AND ' .
+			'  created < ' . $old . ' ' .
+			'AND ' .
+			'  server_id = ' . $serverId;
 		$app->dbmaster->query($sql);
 	}
 
diff --git a/server/lib/classes/openvz_tools.inc.php b/server/lib/classes/openvz_tools.inc.php
index 403613c1801dcdaa4bd138a327f825d5b2055b07..16dc601e252630f2966d69fa49d5721cee9c9e7d 100644
--- a/server/lib/classes/openvz_tools.inc.php
+++ b/server/lib/classes/openvz_tools.inc.php
@@ -31,6 +31,8 @@ class openvz_tools {
 	/**
 	 * Checks, if the server ist a OpenVZ - Host
 	 */
+
+
 	public function isOpenVzHost() {
 		/*
 		 * if there is a "/proc/user_beanconters" we have OpenVz "in use"
@@ -109,7 +111,7 @@ class openvz_tools {
 			$item = trim($item);
 
 			/*
-			 * Now get every token and insert it to the array 
+			 * Now get every token and insert it to the array
 			 */
 			if ($item != '') {
 				$tmp = explode(' ', $item);
@@ -145,5 +147,7 @@ class openvz_tools {
 		/* ready */
 		return $res;
 	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/plugins.inc.php b/server/lib/classes/plugins.inc.php
index d13317edba69ae8310b9365cc4c56b0fabb04381..4808a563d0632e22e6238f0ccd6b352a3b4a4134 100644
--- a/server/lib/classes/plugins.inc.php
+++ b/server/lib/classes/plugins.inc.php
@@ -29,96 +29,96 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class plugins {
-	
+
 	var $available_events = array();
 	var $subscribed_events = array();
 	var $subscribed_actions = array();
 	var $debug = false;
-	
+
 	/*
 	 This function is called to load the plugins from the plugins-enabled or the plugins-core folder
 	*/
-	
+
 	function loadPlugins($type) {
-		global $app,$conf;
+		global $app, $conf;
 
 		$subPath = 'plugins-enabled';
 		//if ($type == 'core') $subPath = 'plugins-core';
-		
+
 		$plugins_dir = $conf['rootpath'].$conf['fs_div'].$subPath.$conf['fs_div'];
 		$tmp_plugins = array();
-		
+
 		if (is_dir($plugins_dir)) {
 			if ($dh = opendir($plugins_dir)) {
 				//** Go trough all files in the plugin dir
 				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file,-8,8) == '.inc.php') {
-						$plugin_name = substr($file,0,-8);
+					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
+						$plugin_name = substr($file, 0, -8);
 						$tmp_plugins[$plugin_name] = $file;
 					}
 				}
 				//** sort the plugins by name
 				ksort($tmp_plugins);
-				
+
 				//** load the plugins
 				foreach($tmp_plugins as $plugin_name => $file) {
-					include_once($plugins_dir.$file);
-					if($this->debug) $app->log('Loading plugin: '.$plugin_name,LOGLEVEL_DEBUG);
+					include_once $plugins_dir.$file;
+					if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
 					$app->loaded_plugins[$plugin_name] = new $plugin_name;
 					$app->loaded_plugins[$plugin_name]->onLoad();
 				}
 			} else {
-				$app->log('Unable to open the plugins directory: '.$plugins_dir,LOGLEVEL_ERROR);
+				$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log('Plugins directory missing: '.$plugins_dir,LOGLEVEL_ERROR);
+			$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
 		}
-		
+
 	}
-	
+
 	/*
 		This function is used by the modules to announce which events they provide
 	*/
-	
-	function announceEvents($module_name,$events) {
+
+	function announceEvents($module_name, $events) {
 		global $app;
 		foreach($events as $event_name) {
 			$this->available_events[$event_name] = $module_name;
-			if($this->debug) $app->log('Announced event: '.$event_name,LOGLEVEL_DEBUG);
+			if($this->debug) $app->log('Announced event: '.$event_name, LOGLEVEL_DEBUG);
 		}
 	}
-	
-	
+
+
 	/*
 	 This function is called by the plugin to register for an event
 	*/
-	
-	function registerEvent($event_name,$plugin_name,$function_name) {
+
+	function registerEvent($event_name, $plugin_name, $function_name) {
 		global $app;
 		if(!isset($this->available_events[$event_name])) {
-			$app->log("Unable to register function '$function_name' from plugin '$plugin_name' for event '$event_name'",LOGLEVEL_DEBUG);
+			$app->log("Unable to register function '$function_name' from plugin '$plugin_name' for event '$event_name'", LOGLEVEL_DEBUG);
 		} else {
 			$this->subscribed_events[$event_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
-			if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for event '$event_name'.",LOGLEVEL_DEBUG);
+			if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for event '$event_name'.", LOGLEVEL_DEBUG);
 		}
 	}
-	
-	
-	function raiseEvent($event_name,$data) {
+
+
+	function raiseEvent($event_name, $data) {
 		global $app;
-		
+
 		// Get the subscriptions for this event
 		$events = (isset($this->subscribed_events[$event_name]))?$this->subscribed_events[$event_name]:'';
-		if($this->debug) $app->log('Raised event: '.$event_name,LOGLEVEL_DEBUG);
-		
+		if($this->debug) $app->log('Raised event: '.$event_name, LOGLEVEL_DEBUG);
+
 		if(is_array($events)) {
 			foreach($events as $event) {
 				$plugin_name = $event['plugin'];
 				$function_name = $event['function'];
 				// Call the processing function of the plugin
-				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by event '$event_name'.",LOGLEVEL_DEBUG);
+				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by event '$event_name'.", LOGLEVEL_DEBUG);
 				// call_user_method($function_name,$app->loaded_plugins[$plugin_name],$event_name,$data);
-				call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$event_name,$data);
+				call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $event_name, $data);
 				unset($plugin_name);
 				unset($function_name);
 			}
@@ -126,33 +126,33 @@ class plugins {
 		unset($event);
 		unset($events);
 	}
-	
+
 	/*
 	 This function is called by the plugin to register for an action
 	*/
-	
-	function registerAction($action_name,$plugin_name,$function_name) {
+
+	function registerAction($action_name, $plugin_name, $function_name) {
 		global $app;
 		$this->subscribed_actions[$action_name][] = array('plugin' => $plugin_name, 'function' => $function_name);
-		if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for action '$event_name'.",LOGLEVEL_DEBUG);
+		if($this->debug)  $app->log("Registered function '$function_name' from plugin '$plugin_name' for action '$event_name'.", LOGLEVEL_DEBUG);
 	}
-	
-	
-	function raiseAction($action_name,$data) {
+
+
+	function raiseAction($action_name, $data) {
 		global $app;
-		
+
 		//* Get the subscriptions for this action
 		$actions = (isset($this->subscribed_actions[$action_name]))?$this->subscribed_actions[$action_name]:'';
-		if($this->debug) $app->log('Raised action: '.$action_name,LOGLEVEL_DEBUG);
-		
+		if($this->debug) $app->log('Raised action: '.$action_name, LOGLEVEL_DEBUG);
+
 		if(is_array($actions)) {
 			foreach($actions as $action) {
 				$plugin_name = $action['plugin'];
 				$function_name = $action['function'];
 				$state_out = 'ok';
 				//* Call the processing function of the plugin
-				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by action '$action_name'.",LOGLEVEL_DEBUG);
-				$state = call_user_func(array($app->loaded_plugins[$plugin_name],$function_name),$action_name,$data);
+				$app->log("Calling function '$function_name' from plugin '$plugin_name' raised by action '$action_name'.", LOGLEVEL_DEBUG);
+				$state = call_user_func(array($app->loaded_plugins[$plugin_name], $function_name), $action_name, $data);
 				//* ensure that we return the highest warning / error level if a error occured in one of the functions
 				if($state == 'warning' && $state_out != 'error') $state_out = 'warning';
 				if($state == 'error') $state_out = 'error';
@@ -162,10 +162,10 @@ class plugins {
 		}
 		unset($action);
 		unset($actions);
-		
+
 		return $state_out;
 	}
-	
+
 }
 
 ?>
diff --git a/server/lib/classes/services.inc.php b/server/lib/classes/services.inc.php
index cd53433e0efc599992780011441180319b81900c..7a8841ece5f9607ea301c698ad472ae924f50607 100644
--- a/server/lib/classes/services.inc.php
+++ b/server/lib/classes/services.inc.php
@@ -33,50 +33,51 @@ class services {
 	var $registered_services = array();
 	var $delayed_restarts = array();
 	var $debug = false;
-	
-	// This function adds a request for restarting 
+
+	// This function adds a request for restarting
 	// a service at the end of the configuration run.
-	function restartServiceDelayed($service_name,$action = 'restart') {
+	function restartServiceDelayed($service_name, $action = 'restart') {
 		global $app;
 		if(is_array($this->registered_services[$service_name])) {
 			$this->delayed_restarts[$service_name] = $action;
 		} else {
-			$app->log("Unable to add a delayed restart for '$service_name'. Service not registered.",LOGLEVEL_WARNING);
+			$app->log("Unable to add a delayed restart for '$service_name'. Service not registered.", LOGLEVEL_WARNING);
 		}
-		
+
 	}
-	
+
 	// This function restarts a service when the function is called
-	function restartService($service_name,$action = 'restart') {
+	function restartService($service_name, $action = 'restart') {
 		global $app;
-		
+
 		if(is_array($this->registered_services[$service_name])) {
 			$module_name = $this->registered_services[$service_name]['module'];
 			$function_name = $this->registered_services[$service_name]['function'];
-			$app->log("Calling function '$function_name' from module '$module_name'.",LOGLEVEL_DEBUG);
+			$app->log("Calling function '$function_name' from module '$module_name'.", LOGLEVEL_DEBUG);
 			// call_user_method($function_name,$app->loaded_modules[$module_name],$action);
-			return 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);
+			$app->log("Unable to restart $service_name. Service not registered.", LOGLEVEL_WARNING);
 			return array('output' => '', 'retval' => 0);
 		}
-		
+
 	}
-	
+
 	// This function is used to register callback functions for services that can be restarted
-	function registerService($service_name,$module_name, $function_name) {
+	function registerService($service_name, $module_name, $function_name) {
 		global $app;
 		$this->registered_services[$service_name] = array('module' => $module_name, 'function' => $function_name);
-		if($this->debug) $app->log("Registered Service '$service_name' in module '$module_name' for processing function '$function_name'",LOGLEVEL_DEBUG);
+		if($this->debug) $app->log("Registered Service '$service_name' in module '$module_name' for processing function '$function_name'", LOGLEVEL_DEBUG);
 	}
-	
+
 	// This function is called at the end of the server script to restart services.
 	function processDelayedActions() {
 		global $app;
 		foreach($this->delayed_restarts as $service_name => $action) {
-			$this->restartService($service_name,$action);
+			$this->restartService($service_name, $action);
 		}
 	}
 
 }
+
 ?>
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index a1e7c000d28ccfe249a982f4bd91e788b6f4131f..a393384c96b7c77bca45360f7643fc85ea414c4e 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -34,21 +34,25 @@ class system{
 	var $server_id;
 	var $server_conf;
 	var $data;
-	
+
 	/**
 	 * Construct for this class
 	 *
 	 * @return system
 	 */
+
+
 	public function system(){
 		//global $go_info;
-	  	//$this->server_id = $go_info['isp']['server_id'];
-	  	//$this->server_conf = $go_info['isp']['server_conf'];
-	  	$this->server_conf['passwd_datei'] = '/etc/passwd';
-	  	$this->server_conf['shadow_datei'] = '/etc/shadow';
-	  	$this->server_conf['group_datei'] = '/etc/group';
+		//$this->server_id = $go_info['isp']['server_id'];
+		//$this->server_conf = $go_info['isp']['server_conf'];
+		$this->server_conf['passwd_datei'] = '/etc/passwd';
+		$this->server_conf['shadow_datei'] = '/etc/shadow';
+		$this->server_conf['group_datei'] = '/etc/group';
 	}
-	
+
+
+
 	/**
 	 * Get the hostname from the server
 	 *
@@ -56,68 +60,74 @@ class system{
 	 */
 	public function hostname(){
 		$dist = $this->server_conf['dist'];
-	
-	 	ob_start();
-	  	passthru('hostname');
-	  	$hostname = ob_get_contents();
-	  	ob_end_clean();
+
+		ob_start();
+		passthru('hostname');
+		$hostname = ob_get_contents();
+		ob_end_clean();
 		$hostname = trim($hostname);
-	  	ob_start();
-	  	if(!strstr($dist, 'freebsd')){
-	    	passthru('dnsdomainname');
-	  	} else {
-	    	passthru('domainname');
-	  	}
-	  	$domainname = ob_get_contents();
-	  	ob_end_clean();
-	  	$domainname = trim($domainname);
-	  	if($domainname != ""){
-		    if(!strstr($hostname, $domainname)) $hostname .= ".".$domainname;
-	  	}
-	  	return $hostname;
+		ob_start();
+		if(!strstr($dist, 'freebsd')){
+			passthru('dnsdomainname');
+		} else {
+			passthru('domainname');
+		}
+		$domainname = ob_get_contents();
+		ob_end_clean();
+		$domainname = trim($domainname);
+		if($domainname != ""){
+			if(!strstr($hostname, $domainname)) $hostname .= ".".$domainname;
+		}
+		return $hostname;
 	}
-	
+
+
+
 	/**
 	 * Add an user to the system
-	 * 
+	 *
 	 */
 	public function adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort = '*'){
 		global $app;
-	  	if($this->is_user($user_username)){
-	    	return false;
-	  	} else {
-	    	if(trim($user_username) != '') {
-	        	$user_datei = $this->server_conf['passwd_datei'];
-	            $shadow_datei = $this->server_conf['shadow_datei'];
-	            $shell = realpath($shell);
-	            if(trim($passwort) == '') $passwort = '*';
-	            $new_user = "\n$user_username:x:$uid:$gid:$username:$homedir:$shell\n";
-	            $app->log->msg('USER: '.$new_user);
-	            $app->file->af($user_datei, $new_user);
-	            if($shadow_datei == '/etc/shadow'){
-	            	$datum = time();
-	                $tage = floor($datum/86400);
-	                $new_passwd = "\n$user_username:$passwort:$tage:0:99999:7:::\n";
-	            } else {
-	                $new_passwd = "\n$user_username:$passwort:$uid:$gid::0:0:$username:$homedir:$shell\n";
-	            }
-	            $app->file->af($shadow_datei, $new_passwd);
+		if($this->is_user($user_username)){
+			return false;
+		} else {
+			if(trim($user_username) != '') {
+				$user_datei = $this->server_conf['passwd_datei'];
+				$shadow_datei = $this->server_conf['shadow_datei'];
+				$shell = realpath($shell);
+				if(trim($passwort) == '') $passwort = '*';
+				$new_user = "\n$user_username:x:$uid:$gid:$username:$homedir:$shell\n";
+				$app->log->msg('USER: '.$new_user);
+				$app->file->af($user_datei, $new_user);
+				if($shadow_datei == '/etc/shadow'){
+					$datum = time();
+					$tage = floor($datum/86400);
+					$new_passwd = "\n$user_username:$passwort:$tage:0:99999:7:::\n";
+				} else {
+					$new_passwd = "\n$user_username:$passwort:$uid:$gid::0:0:$username:$homedir:$shell\n";
+				}
+				$app->file->af($shadow_datei, $new_passwd);
 				// TB: leere Zeilen entfernen
-	            $app->file->remove_blank_lines($shadow_datei);
-	            $app->file->remove_blank_lines($user_datei);
-	            // TB: user Sortierung deaktiviert
-	            //$this->order_users_groups();
-	            if($shadow_datei != '/etc/shadow'){
-	            	$app->file->af($shadow_datei, "\n");
+				$app->file->remove_blank_lines($shadow_datei);
+				$app->file->remove_blank_lines($user_datei);
+				// TB: user Sortierung deaktiviert
+				//$this->order_users_groups();
+				if($shadow_datei != '/etc/shadow'){
+					$app->file->af($shadow_datei, "\n");
 					// TB: leere Zeilen entfernen
-	                $app->file->remove_blank_lines($shadow_datei);
+					$app->file->remove_blank_lines($shadow_datei);
 					$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	            }
-	            return true;
-	        }
-	  }
+				}
+				return true;
+			}
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Update users when someone edit it
 	 *
@@ -126,344 +136,376 @@ class system{
 		//* First delete the users
 		$this->deluser($user_username);
 		//* Add the user again
-	  	$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
+		$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
 	}
-	
+
+
+
+
+
 	/**
 	 * Lock the user
 	 *
 	 */
 	function deactivateuser($user_username){
 		$passwort = str_rot13($this->getpasswd($user_username));
-	  	$user_attr = $this->get_user_attributes($user_username);
-	  	$uid = $user_attr['uid'];
-	  	$gid = $user_attr['gid'];
-	  	$username = $user_attr['name'];
-	  	$homedir = $user_attr['homedir'];
-	  	$shell = '/dev/null';
-	  	$this->deluser($user_username);
-	  	$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
+		$user_attr = $this->get_user_attributes($user_username);
+		$uid = $user_attr['uid'];
+		$gid = $user_attr['gid'];
+		$username = $user_attr['name'];
+		$homedir = $user_attr['homedir'];
+		$shell = '/dev/null';
+		$this->deluser($user_username);
+		$this->adduser($user_username, $uid, $gid, $username, $homedir, $shell, $passwort);
 	}
+
+
 	/**
 	 * Delete a user from the system
 	 *
 	 */
 	function deluser($user_username){
 		global $app;
-	  	if($this->is_user($user_username)){
-	    	$user_datei = $this->server_conf['passwd_datei'];
-	    	$shadow_datei = $this->server_conf['shadow_datei'];
-	    	$users = $app->file->rf($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		$num_lines = sizeof($lines);
-	      		for($i=0;$i<$num_lines;$i++){
-	        		if(trim($lines[$i]) != ''){
-	          			list($f1,) = explode(':', $lines[$i]);
-	          			if($f1 != $user_username) $new_lines[] = $lines[$i];
-	        		}
-	      		}
-	      		$new_users = implode("\n", $new_lines);
-	      		$app->file->wf($user_datei, $new_users);
-	      		unset($new_lines);
-	      		unset($lines);
-	      		unset($new_users);
-	    	}
-	    	$app->file->remove_blank_lines($user_datei);
-	
-	    	$passwds = $app->file->rf($shadow_datei);
-	    	$lines = explode("\n", $passwds);
-	    	if(is_array($lines)){
-	      		$num_lines = sizeof($lines);
-	      		for($i=0;$i<$num_lines;$i++){
-	        		if(trim($lines[$i]) != ''){
-	          			list($f1,) = explode(':', $lines[$i]);
-	          			if($f1 != $user_username) $new_lines[] = $lines[$i];
-	        		}
-	      		}
-	      		$new_passwds = implode("\n", $new_lines);
-	      		$app->file->wf($shadow_datei, $new_passwds);
-	      		unset($new_lines);
-	      		unset($lines);
-	      		unset($new_passwds);
-	    	}
-	    	$app->file->remove_blank_lines($shadow_datei);
-	
-	    	$group_file = $app->file->rf($this->server_conf['group_datei']);
-	    	$group_file_lines = explode("\n", $group_file);
-	    	foreach($group_file_lines as $group_file_line){
-	      		if(trim($group_file_line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $group_file_line);
-	        		$group_users = explode(',', str_replace(' ', '', $f4));
-	        		if(in_array($user_username, $group_users)){
-	          			$g_users = array();
-	          			foreach($group_users as $group_user){
-	            			if($group_user != $user_username) $g_users[] = $group_user;
-	          			}
-	          			$f4 = implode(',', $g_users);
-	        		}
-	        		$new_group_file[] = $f1.':'.$f2.':'.$f3.':'.$f4;
-	      		}
-	    	}
-	    	$new_group_file = implode("\n", $new_group_file);
-	    	$app->file->wf($this->server_conf['group_datei'], $new_group_file);
-	    	// TB: auskommentiert
-	        //$this->order_users_groups();
-	
-	    	if($shadow_datei != '/etc/shadow'){
-	      		$app->file->af($shadow_datei, "\n");
-	      		$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	    	}
-	    	return true;
-	  	} else {
-	    	return false;
-	  	}
+		if($this->is_user($user_username)){
+			$user_datei = $this->server_conf['passwd_datei'];
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$users = $app->file->rf($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				$num_lines = sizeof($lines);
+				for($i=0;$i<$num_lines;$i++){
+					if(trim($lines[$i]) != ''){
+						list($f1, ) = explode(':', $lines[$i]);
+						if($f1 != $user_username) $new_lines[] = $lines[$i];
+					}
+				}
+				$new_users = implode("\n", $new_lines);
+				$app->file->wf($user_datei, $new_users);
+				unset($new_lines);
+				unset($lines);
+				unset($new_users);
+			}
+			$app->file->remove_blank_lines($user_datei);
+
+			$passwds = $app->file->rf($shadow_datei);
+			$lines = explode("\n", $passwds);
+			if(is_array($lines)){
+				$num_lines = sizeof($lines);
+				for($i=0;$i<$num_lines;$i++){
+					if(trim($lines[$i]) != ''){
+						list($f1, ) = explode(':', $lines[$i]);
+						if($f1 != $user_username) $new_lines[] = $lines[$i];
+					}
+				}
+				$new_passwds = implode("\n", $new_lines);
+				$app->file->wf($shadow_datei, $new_passwds);
+				unset($new_lines);
+				unset($lines);
+				unset($new_passwds);
+			}
+			$app->file->remove_blank_lines($shadow_datei);
+
+			$group_file = $app->file->rf($this->server_conf['group_datei']);
+			$group_file_lines = explode("\n", $group_file);
+			foreach($group_file_lines as $group_file_line){
+				if(trim($group_file_line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $group_file_line);
+					$group_users = explode(',', str_replace(' ', '', $f4));
+					if(in_array($user_username, $group_users)){
+						$g_users = array();
+						foreach($group_users as $group_user){
+							if($group_user != $user_username) $g_users[] = $group_user;
+						}
+						$f4 = implode(',', $g_users);
+					}
+					$new_group_file[] = $f1.':'.$f2.':'.$f3.':'.$f4;
+				}
+			}
+			$new_group_file = implode("\n", $new_group_file);
+			$app->file->wf($this->server_conf['group_datei'], $new_group_file);
+			// TB: auskommentiert
+			//$this->order_users_groups();
+
+			if($shadow_datei != '/etc/shadow'){
+				$app->file->af($shadow_datei, "\n");
+				$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
+			}
+			return true;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Add a usergroup to the system
 	 *
 	 */
 	function addgroup($group, $gid, $members = ''){
 		global $app;
-	  	if($this->is_group($group)){
-		    return false;
-	  	} else {
-	    	$group_datei = $this->server_conf['group_datei'];
-	    	$shadow_datei = $this->server_conf['shadow_datei'];
-	    	$new_group = "\n$group:x:$gid:$members\n";
-	    	$app->file->af($group_datei, $new_group);
-	
-	        // TB: auskommentiert
-	        //$this->order_users_groups();
-	    	if($shadow_datei != '/etc/shadow'){
-	      		$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	    	}
-	    	return true;
-	  	}
+		if($this->is_group($group)){
+			return false;
+		} else {
+			$group_datei = $this->server_conf['group_datei'];
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$new_group = "\n$group:x:$gid:$members\n";
+			$app->file->af($group_datei, $new_group);
+
+			// TB: auskommentiert
+			//$this->order_users_groups();
+			if($shadow_datei != '/etc/shadow'){
+				$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
+			}
+			return true;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Update usersgroup in way to delete and add it again
 	 *
 	 */
 	function updategroup($group, $gid, $members = ''){
 		$this->delgroup($group);
-	  	$this->addgroup($group, $gid, $members);
+		$this->addgroup($group, $gid, $members);
 	}
-	
+
+
+
+
+
 	/**
 	 * Delete a usergroup from the system
 	 *
 	 */
 	function delgroup($group){
 		global $app;
-	  	if($this->is_group($group)){
-	    	$group_datei = $this->server_conf['group_datei'];
-	    	$shadow_datei = $this->server_conf['shadow_datei'];
-	    	$groups = $app->file->rf($group_datei);
-	    	$lines = explode("\n", $groups);
-	    	if(is_array($lines)){
-	      		$num_lines = sizeof($lines);
-	      		for($i=0;$i<$num_lines;$i++){
-	        		if(trim($lines[$i]) != ''){
-	          			list($f1,) = explode(':', $lines[$i]);
-	          			if($f1 != $group) $new_lines[] = $lines[$i];
-	        		}
-	      		}
-	      		$new_groups = implode("\n", $new_lines);
-	      		$app->file->wf($group_datei, $new_groups);
-	      		unset($new_lines);
-	      		unset($lines);
-	      		unset($new_groups);
-	    	}
-	        // TB: auskommentiert
-	    	//$this->order_users_groups();
-	    	if($shadow_datei != '/etc/shadow'){
-	      		$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
-	    	}
-	    	return true;
-	  	} else {
-	    	return false;
-	  	}
+		if($this->is_group($group)){
+			$group_datei = $this->server_conf['group_datei'];
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$groups = $app->file->rf($group_datei);
+			$lines = explode("\n", $groups);
+			if(is_array($lines)){
+				$num_lines = sizeof($lines);
+				for($i=0;$i<$num_lines;$i++){
+					if(trim($lines[$i]) != ''){
+						list($f1, ) = explode(':', $lines[$i]);
+						if($f1 != $group) $new_lines[] = $lines[$i];
+					}
+				}
+				$new_groups = implode("\n", $new_lines);
+				$app->file->wf($group_datei, $new_groups);
+				unset($new_lines);
+				unset($lines);
+				unset($new_groups);
+			}
+			// TB: auskommentiert
+			//$this->order_users_groups();
+			if($shadow_datei != '/etc/shadow'){
+				$app->log->caselog("pwd_mkdb $shadow_datei &> /dev/null", $this->FILE, __LINE__);
+			}
+			return true;
+		} else {
+			return false;
+		}
 	}
+
+
 	/**
 	 * Order usergroups
 	 *
 	 */
 	function order_users_groups(){
 		global $app;
-	  	$user_datei = $this->server_conf['passwd_datei'];
-	  	$shadow_datei = $this->server_conf['shadow_datei'];
-	  	$group_datei = $this->server_conf['group_datei'];
-	
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		$arr[$f3] = $line;
-	      		}
-	    	}
-	  	}
-	  	ksort($arr);
-	  	reset($arr);
-	  	if($shadow_datei != '/etc/shadow'){
-	    	$app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0)."\n");
-	  	}else {
-		    $app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
-	  	}
-	  	unset($arr);
-	
-	  	$users = $app->file->no_comments($user_datei);
-	  	$lines = explode("\n", $users);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ""){
-	        		list($f1, $f2, $f3,) = explode(':', $line);
-	        		if($f1 != 'toor'){
-	          			$arr[$f3] = $line;
-	        		} else {
-	          			$arr[70000] = $line;
-	        		}
-	      		}
-	    	}
-	  	}
-	  	ksort($arr);
-	  	reset($arr);
-	  	$app->file->wf($user_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
-	  	unset($arr);
-	
-	  	$passwds = $app->file->no_comments($shadow_datei);
-	  	$lines = explode("\n", $passwds);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	    		if(trim($line) != ''){
-	        		list($f1, $f2, $f3,) = explode(':', $line);
-	        		if($f1 != 'toor'){
-	          			$uid = $this->getuid($f1);
-	          			if(!is_bool($uid)) $arr[$uid] = $line;
-	        		} else {
-	          			$arr[70000] = $line;
-	        		}
-	      		}
-	    	}
-	  	}
-	  	ksort($arr);
-	  	reset($arr);
-	  	$app->file->wf($shadow_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
-	  	unset($arr);
+		$user_datei = $this->server_conf['passwd_datei'];
+		$shadow_datei = $this->server_conf['shadow_datei'];
+		$group_datei = $this->server_conf['group_datei'];
+
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					$arr[$f3] = $line;
+				}
+			}
+		}
+		ksort($arr);
+		reset($arr);
+		if($shadow_datei != '/etc/shadow'){
+			$app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0)."\n");
+		}else {
+			$app->file->wf($group_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
+		}
+		unset($arr);
+
+		$users = $app->file->no_comments($user_datei);
+		$lines = explode("\n", $users);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ""){
+					list($f1, $f2, $f3, ) = explode(':', $line);
+					if($f1 != 'toor'){
+						$arr[$f3] = $line;
+					} else {
+						$arr[70000] = $line;
+					}
+				}
+			}
+		}
+		ksort($arr);
+		reset($arr);
+		$app->file->wf($user_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
+		unset($arr);
+
+		$passwds = $app->file->no_comments($shadow_datei);
+		$lines = explode("\n", $passwds);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, ) = explode(':', $line);
+					if($f1 != 'toor'){
+						$uid = $this->getuid($f1);
+						if(!is_bool($uid)) $arr[$uid] = $line;
+					} else {
+						$arr[70000] = $line;
+					}
+				}
+			}
+		}
+		ksort($arr);
+		reset($arr);
+		$app->file->wf($shadow_datei, $app->file->remove_blank_lines(implode("\n", $arr), 0));
+		unset($arr);
 	}
-	
+
+
+
+
+
 	/**
 	 * Find a user / group id
 	 *
 	 */
 	function find_uid_gid($min, $max){
 		global $app;
-	  	if($min < $max && $min >= 0 && $max >= 0 && $min <= 65536 && $max <= 65536 && is_int($min) && is_int($max)){
-	    	for($i=$min;$i<=$max;$i++){
-	      		$uid_arr[$i] = $gid_arr[$i] = 1;
-	    	}
-	    	$user_datei = $this->server_conf['passwd_datei'];
-	    	$group_datei = $this->server_conf['group_datei'];
-	
-	    	$users = $app->file->no_comments($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
-	          			if($f3 >= $min && $f3 <= $max) unset($uid_arr[$f3]);
-	        		}
-	      		}
-	      		if(!empty($uid_arr)){
-	        		foreach($uid_arr as $key => $val){
-	          			$uids[] = $key;
-	        		}
-	        		$min_uid = min($uids);
-	        		unset($uid_arr);
-	      		} else {
-	        		return false;
-	      		}
-	    	}
-	
-	    	$groups = $app->file->no_comments($group_datei);
-	    	$lines = explode("\n", $groups);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3, $f4) = explode(':', $line);
-	          			if($f3 >= $min && $f3 <= $max) unset($gid_arr[$f3]);
-	        		}
-	      		}
-	      		if(!empty($gid_arr)){
-	        		foreach($gid_arr as $key => $val){
-	          			$gids[] = $key;
-	        		}
-	        		$min_gid = min($gids);
-	        		unset($gid_arr);
-	      		} else {
-	        		return false;
-	      		}
-	    	}
-	
-	    	$result = array_intersect($uids, $gids);
-	    	$new_id = (max($result));
-	    	unset($uids);
-	    	unset($gids);
-	    	unset($result);
-	    	if($new_id <= $max){
-	      		return $new_id;
-	    	} else {
-	      		return false;
-	    	}
-	  	} else {
-	    	return false;
-	  	}
+		if($min < $max && $min >= 0 && $max >= 0 && $min <= 65536 && $max <= 65536 && is_int($min) && is_int($max)){
+			for($i=$min;$i<=$max;$i++){
+				$uid_arr[$i] = $gid_arr[$i] = 1;
+			}
+			$user_datei = $this->server_conf['passwd_datei'];
+			$group_datei = $this->server_conf['group_datei'];
+
+			$users = $app->file->no_comments($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
+						if($f3 >= $min && $f3 <= $max) unset($uid_arr[$f3]);
+					}
+				}
+				if(!empty($uid_arr)){
+					foreach($uid_arr as $key => $val){
+						$uids[] = $key;
+					}
+					$min_uid = min($uids);
+					unset($uid_arr);
+				} else {
+					return false;
+				}
+			}
+
+			$groups = $app->file->no_comments($group_datei);
+			$lines = explode("\n", $groups);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, $f4) = explode(':', $line);
+						if($f3 >= $min && $f3 <= $max) unset($gid_arr[$f3]);
+					}
+				}
+				if(!empty($gid_arr)){
+					foreach($gid_arr as $key => $val){
+						$gids[] = $key;
+					}
+					$min_gid = min($gids);
+					unset($gid_arr);
+				} else {
+					return false;
+				}
+			}
+
+			$result = array_intersect($uids, $gids);
+			$new_id = (max($result));
+			unset($uids);
+			unset($gids);
+			unset($result);
+			if($new_id <= $max){
+				return $new_id;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Check if the users is really a user into the system
 	 *
 	 */
 	function is_user($user){
 		global $app;
-	  	$user_datei = $this->server_conf['passwd_datei'];
-	  	$users = $app->file->no_comments($user_datei);
-	  	$lines = explode("\n", $users);
-	  	if(is_array($lines)){
+		$user_datei = $this->server_conf['passwd_datei'];
+		$users = $app->file->no_comments($user_datei);
+		$lines = explode("\n", $users);
+		if(is_array($lines)){
 			foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
-	        		if($f1 == $user) return true;
-	      		}
-	    	}
-	  	}
-	  	return false;
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
+					if($f1 == $user) return true;
+				}
+			}
+		}
+		return false;
 	}
-	
+
+
+
+
+
 	/**
 	 * Check if the group is on this system
 	 *
 	 */
 	function is_group($group){
 		global $app;
-	  	$group_datei = $this->server_conf['group_datei'];
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ""){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		if($f1 == $group) return true;
-	      		}
-	    	}
-	  	}
-	  	return false;
+		$group_datei = $this->server_conf['group_datei'];
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ""){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					if($f1 == $group) return true;
+				}
+			}
+		}
+		return false;
 	}
-	
+
 	/*
 	// Alternative implementation of the is_group function. Should be faster then the old one To be tested.
 	function is_group($group) {
@@ -485,122 +527,142 @@ class system{
 	return false;
 	}
 	*/
-	
+
 	function root_group(){
 		global $app;
-	  	$group_datei = $this->server_conf['group_datei'];
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-		    foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		if($f3 == 0) return $f1;
-	      		}
-	    	}
-	  	}
-	  	return false;
+		$group_datei = $this->server_conf['group_datei'];
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					if($f3 == 0) return $f1;
+				}
+			}
+		}
+		return false;
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the groups of an user
 	 *
 	 */
 	function get_user_groups($username){
 		global $app;
-	  	$user_groups = array();
-	  	$group_datei = $this->server_conf['group_datei'];
-	  	$groups = $app->file->no_comments($group_datei);
-	  	$lines = explode("\n", $groups);
-	  	if(is_array($lines)){
-	    	foreach($lines as $line){
-	      		if(trim($line) != ''){
-	        		list($f1, $f2, $f3, $f4) = explode(':', $line);
-	        		if(intval($f3) < intval($this->server_conf['groupid_von']) && trim($f1) != 'users'){
-	          			$tmp_group_users = explode(',', str_replace(' ', '', $f4));
-	          			if(in_array($username, $tmp_group_users) && trim($f1) != '') $user_groups[] = $f1;
-	          			unset($tmp_group_users);
-	        		}
-	      		}
-	    	}
-	  	}
-	  	if(!empty($user_groups)) return implode(',', $user_groups);
-	  	return '';
+		$user_groups = array();
+		$group_datei = $this->server_conf['group_datei'];
+		$groups = $app->file->no_comments($group_datei);
+		$lines = explode("\n", $groups);
+		if(is_array($lines)){
+			foreach($lines as $line){
+				if(trim($line) != ''){
+					list($f1, $f2, $f3, $f4) = explode(':', $line);
+					if(intval($f3) < intval($this->server_conf['groupid_von']) && trim($f1) != 'users'){
+						$tmp_group_users = explode(',', str_replace(' ', '', $f4));
+						if(in_array($username, $tmp_group_users) && trim($f1) != '') $user_groups[] = $f1;
+						unset($tmp_group_users);
+					}
+				}
+			}
+		}
+		if(!empty($user_groups)) return implode(',', $user_groups);
+		return '';
 	}
-	
+
+
+
+
+
 	/**
 	 * Get a user password
 	 *
 	 */
 	function getpasswd($user){
 		global $app;
-	  	if($this->is_user($user)){
-		    $shadow_datei = $this->server_conf['shadow_datei'];
-	    	$passwds = $app->file->no_comments($shadow_datei);
-	    	$lines = explode("\n", $passwds);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2,) = explode(':', $line);
-	          			if($f1 == $user) return $f2;
-	        		}
-	      		}
-	    	}
-	  	} else {
-		    return false;
-	  	}
+		if($this->is_user($user)){
+			$shadow_datei = $this->server_conf['shadow_datei'];
+			$passwds = $app->file->no_comments($shadow_datei);
+			$lines = explode("\n", $passwds);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, ) = explode(':', $line);
+						if($f1 == $user) return $f2;
+					}
+				}
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the user id from an user
 	 *
 	 */
 	function getuid($user){
 		global $app;
-	  	if($this->is_user($user)){
-		    $user_datei = $this->server_conf['passwd_datei'];
-	    	$users = $app->file->no_comments($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3,) = explode(':', $line);
-	          			if($f1 == $user) return $f3;
-	        		}
-	      		}
-	    	}
-	  	} else {
-		    return false;
-	  	}
+		if($this->is_user($user)){
+			$user_datei = $this->server_conf['passwd_datei'];
+			$users = $app->file->no_comments($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, ) = explode(':', $line);
+						if($f1 == $user) return $f3;
+					}
+				}
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the group id from an group
 	 *
 	 */
 	function getgid($group){
 		global $app;
-	  	if($this->is_group($group)){
-		    $group_datei = $this->server_conf['group_datei'];
+		if($this->is_group($group)){
+			$group_datei = $this->server_conf['group_datei'];
 			$groups = $app->file->no_comments($group_datei);
 			$lines = explode("\n", $groups);
 			if(is_array($lines)){
-		    foreach($lines as $line){
+				foreach($lines as $line){
 					if(trim($line) != ""){
 						list($f1, $f2, $f3, $f4) = explode(':', $line);
 						if($f1 == $group) return $f3;
 					}
 				}
 			}
-	  	} else {
-		    return false;
-	  	}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
-	* Return info about a group by name
-	*
-	*/
+	 * Return info about a group by name
+	 *
+	 */
 	function posix_getgrnam($group) {
 		if(!function_exists('posix_getgrnam')){
 			$group_datei = $this->server_conf['group_datei'];
@@ -616,213 +678,225 @@ class system{
 			} else {
 				$members = array();
 			}
-			$group_details = array(	'name' => $group,
-									'passwd' => $f2,
-									'members' => $members,
-									'gid' => $f3);
-			return $group_details;	
+			$group_details = array( 'name' => $group,
+				'passwd' => $f2,
+				'members' => $members,
+				'gid' => $f3);
+			return $group_details;
 		} else {
 			return posix_getgrnam($group);
 		}
-    }
-	
+	}
+
+
+
+
+
 	/**
 	 * Get all information from a user
 	 *
 	 */
 	function get_user_attributes($user){
 		global $app;
-	  	if($this->is_user($user)){
-	    	$user_datei = $this->server_conf['passwd_datei'];
-	    	$users = $app->file->no_comments($user_datei);
-	    	$lines = explode("\n", $users);
-	    	if(is_array($lines)){
-	      		foreach($lines as $line){
-	        		if(trim($line) != ''){
-	          			list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
-	          			if($f1 == $user){
-	            			$user_attr['username'] = $f1;
-	            			$user_attr['x'] = $f2;
-	            			$user_attr['uid'] = $f3;
-	            			$user_attr['gid'] = $f4;
-	            			$user_attr['name'] = $f5;
-	            			$user_attr['homedir'] = $f6;
-	            			$user_attr['shell'] = $f7;
-	            			return $user_attr;
-	          			}
-	        		}
-	      		}
-	    	}
-	  	} else {
-	    	return false;
-	  	}
+		if($this->is_user($user)){
+			$user_datei = $this->server_conf['passwd_datei'];
+			$users = $app->file->no_comments($user_datei);
+			$lines = explode("\n", $users);
+			if(is_array($lines)){
+				foreach($lines as $line){
+					if(trim($line) != ''){
+						list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
+						if($f1 == $user){
+							$user_attr['username'] = $f1;
+							$user_attr['x'] = $f2;
+							$user_attr['uid'] = $f3;
+							$user_attr['gid'] = $f4;
+							$user_attr['name'] = $f5;
+							$user_attr['homedir'] = $f6;
+							$user_attr['shell'] = $f7;
+							return $user_attr;
+						}
+					}
+				}
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Edit the owner of a file
 	 *
 	 */
 	function chown($file, $owner, $allow_symlink = false){
-	  global $app;
-	  if($allow_symlink == false && $this->checkpath($file) == false) {
-		$app->log("Action aborted, file is a symlink: $file",LOGLEVEL_WARN);
-		return false;
-	  }
-	  if(file_exists($file)) {
-		if(@chown($file, $owner)) {
-			return true;
-		} else {
-			$app->log("chown failed: $file : $owner",LOGLEVEL_DEBUG);
+		global $app;
+		if($allow_symlink == false && $this->checkpath($file) == false) {
+			$app->log("Action aborted, file is a symlink: $file", LOGLEVEL_WARN);
 			return false;
 		}
-	  }
+		if(file_exists($file)) {
+			if(@chown($file, $owner)) {
+				return true;
+			} else {
+				$app->log("chown failed: $file : $owner", LOGLEVEL_DEBUG);
+				return false;
+			}
+		}
 	}
-	
+
 	function chgrp($file, $group = '', $allow_symlink = false){
-	  global $app;
-	  if($allow_symlink == false && $this->checkpath($file) == false) {
-		$app->log("Action aborted, file is a symlink: $file",LOGLEVEL_WARN);
-		return false;
-	  }
-	  if(file_exists($file)) {
-		if(@chgrp($file, $group)) {
-			return true;
-		} else {
-			$app->log("chgrp failed: $file : $group",LOGLEVEL_DEBUG);
+		global $app;
+		if($allow_symlink == false && $this->checkpath($file) == false) {
+			$app->log("Action aborted, file is a symlink: $file", LOGLEVEL_WARN);
 			return false;
 		}
-	  }
+		if(file_exists($file)) {
+			if(@chgrp($file, $group)) {
+				return true;
+			} else {
+				$app->log("chgrp failed: $file : $group", LOGLEVEL_DEBUG);
+				return false;
+			}
+		}
 	}
-	
+
 	//* Change the mode of a file
 	function chmod($file, $mode, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($file) == false) {
-			$app->log("Action aborted, file is a symlink: $file",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $file", LOGLEVEL_WARN);
 			return false;
 		}
 		if(@chmod($file, $mode)) {
 			return true;
 		} else {
-			$app->log("chmod failed: $file : $mode",LOGLEVEL_DEBUG);
+			$app->log("chmod failed: $file : $mode", LOGLEVEL_DEBUG);
 			return false;
 		}
 	}
-	
+
 	function file_put_contents($filename, $data, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		if(file_exists($filename)) unlink($filename);
 		return file_put_contents($filename, $data);
 	}
-	
+
 	function file_get_contents($filename, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		return file_get_contents($filename, $data);
 	}
-	
+
 	function rename($filename, $new_filename, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		return rename($filename, $new_filename);
 	}
-	
+
 	function mkdir($dirname, $allow_symlink = false) {
 		global $app;
 		if($allow_symlink == false && $this->checkpath($dirname) == false) {
-			$app->log("Action aborted, file is a symlink: $dirname",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $dirname", LOGLEVEL_WARN);
 			return false;
 		}
 		if(@mkdir($dirname)) {
 			return true;
 		} else {
-			$app->log("mkdir failed: $dirname",LOGLEVEL_DEBUG);
+			$app->log("mkdir failed: $dirname", LOGLEVEL_DEBUG);
 			return false;
 		}
 	}
-	
+
 	function unlink($filename) {
 		if(file_exists($filename) || is_link($filename)) {
 			return unlink($filename);
 		}
 	}
-	
-	function copy($file1,$file2) {
-		return copy($file1,$file2);
+
+	function copy($file1, $file2) {
+		return copy($file1, $file2);
 	}
-	
+
 	function touch($file, $allow_symlink = false){
-	  global $app;
-	  if($allow_symlink == false && @file_exists($file) && $this->checkpath($file) == false) {
-		$this->unlink($file);
-	  }
-	  if(@touch($file)) {
+		global $app;
+		if($allow_symlink == false && @file_exists($file) && $this->checkpath($file) == false) {
+			$this->unlink($file);
+		}
+		if(@touch($file)) {
 			return true;
-	  } else {
-			$app->log("touch failed: $file",LOGLEVEL_DEBUG);
+		} else {
+			$app->log("touch failed: $file", LOGLEVEL_DEBUG);
 			return false;
-	  }
+		}
 	}
-	
+
 	function checkpath($path) {
 		$path = trim($path);
 		//* We allow only absolute paths
-		if(substr($path,0,1) != '/') return false;
-		
+		if(substr($path, 0, 1) != '/') return false;
+
 		//* We allow only some characters in the path
 		// * is allowed, for example it is part of wildcard certificates/keys: *.example.com.crt
-		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);
+		$path_parts = explode('/', $path);
 		$testpath = '';
 		foreach($path_parts as $p) {
 			$testpath .= '/'.$p;
 			if(is_link($testpath)) return false;
 		}
-		
+
 		return true;
 	}
-	
+
+
+
+
+
 	/**
 	 * Add an user to a specific group
 	 *
 	 */
 	function add_user_to_group($group, $user = 'admispconfig'){
 		global $app;
-	  	$group_file = $app->file->rf($this->server_conf['group_datei']);
-	  	$group_file_lines = explode("\n", $group_file);
-	  	foreach($group_file_lines as $group_file_line){
-		    list($group_name,$group_x,$group_id,$group_users) = explode(':',$group_file_line);
-	    	if($group_name == $group){
-	      		$group_users = explode(',', str_replace(' ', '', $group_users));
-	      		if(!in_array($user, $group_users)){
-	        		$group_users[] = $user;
-	      		}
-	      		$group_users = implode(',', $group_users);
-	      		if(substr($group_users,0,1) == ',') $group_users = substr($group_users,1);
-	      		$group_file_line = $group_name.':'.$group_x.':'.$group_id.':'.$group_users;
-	    	}
-	    	$new_group_file[] = $group_file_line;
-	  	}
-	  	$new_group_file = implode("\n", $new_group_file);
-	  	$app->file->wf($this->server_conf['group_datei'], $new_group_file);
-	  	$app->file->remove_blank_lines($this->server_conf['group_datei']);
-	  	if($this->server_conf['shadow_datei'] != '/etc/shadow'){
-		    $app->log->caselog('pwd_mkdb '.$this->server_conf['shadow_datei'].' &> /dev/null', $this->FILE, __LINE__);
-	  	}
+		$group_file = $app->file->rf($this->server_conf['group_datei']);
+		$group_file_lines = explode("\n", $group_file);
+		foreach($group_file_lines as $group_file_line){
+			list($group_name, $group_x, $group_id, $group_users) = explode(':', $group_file_line);
+			if($group_name == $group){
+				$group_users = explode(',', str_replace(' ', '', $group_users));
+				if(!in_array($user, $group_users)){
+					$group_users[] = $user;
+				}
+				$group_users = implode(',', $group_users);
+				if(substr($group_users, 0, 1) == ',') $group_users = substr($group_users, 1);
+				$group_file_line = $group_name.':'.$group_x.':'.$group_id.':'.$group_users;
+			}
+			$new_group_file[] = $group_file_line;
+		}
+		$new_group_file = implode("\n", $new_group_file);
+		$app->file->wf($this->server_conf['group_datei'], $new_group_file);
+		$app->file->remove_blank_lines($this->server_conf['group_datei']);
+		if($this->server_conf['shadow_datei'] != '/etc/shadow'){
+			$app->log->caselog('pwd_mkdb '.$this->server_conf['shadow_datei'].' &> /dev/null', $this->FILE, __LINE__);
+		}
 	}
-	
+
 	/*
 	function usermod($user, $groups){
 		global $app;
@@ -860,453 +934,489 @@ class system{
 	    	}
 	    	return true;
 	  	} else {
-		    return false;
-	  	}
-	}
-	*/
-	
-	/**boot autostart etc
-	 *
-	 */
-	function rc_edit($service, $rl, $action){
-		// $action = "on|off";
-	  	global $app;
-	  	$dist_init_scripts = $app->system->server_conf['dist_init_scripts'];
-	  	$dist_runlevel = $app->system->server_conf['dist_runlevel'];
-	  	$dist = $app->system->server_conf['dist'];
-	  	if(trim($dist_runlevel) == ''){ // falls es keine runlevel gibt (FreeBSD)
-		    if($action == 'on'){
-	    		@symlink($dist_init_scripts.'/'.$service, $dist_init_scripts.'/'.$service.'.sh');
-	    	}
-	    	if($action == 'off'){
-	      		if(is_link($dist_init_scripts.'/'.$service.'.sh')){
-	        		unlink($dist_init_scripts.'/'.$service.'.sh');
-	      		} else {
-	        		rename($dist_init_scripts.'/'.$service.'.sh',$dist_init_scripts.'/'.$service);
-	      		}
-	    	}
-	  	} else { // Linux
-	    	if(substr($dist, 0,4) == 'suse'){
-	      		if($action == 'on'){
-	        		exec("chkconfig --add $service &> /dev/null");
-	      		}
-	      		if($action == 'off'){
-	        		exec("chkconfig --del $service &> /dev/null");
-	      		}
-	    	} else {
-	      		$runlevels = explode(',', $rl);
-	      		foreach($runlevels as $runlevel){
-	        		$runlevel = trim($runlevel);
-	        		if($runlevel != '' && is_dir($dist_runlevel.'/rc'.$runlevel.'.d')){
-	          			$handle=opendir($dist_runlevel.'/rc'.$runlevel.'.d');
-	          			while($file = readdir($handle)){
-	            			if($file != '.' && $file != '..'){
-	              				$target = @readlink($dist_runlevel.'/rc'.$runlevel.'.d/'.$file);
-	              				if(strstr($file, $service) && strstr($target, $service) && substr($file,0,1) == 'S') $ln_arr[$runlevel][] = $dist_runlevel.'/rc'.$runlevel.'.d/'.$file;
-	            			}
-	          			}
-	          			closedir($handle);
-	        		}
-	        		if($action == 'on'){
-	          			if(!is_array($ln_arr[$runlevel])) @symlink($dist_init_scripts.'/'.$service, $dist_runlevel.'/rc'.$runlevel.'.d/S99'.$service);
-	        		}
-	        		if($action == 'off'){
-	          			if(is_array($ln_arr[$runlevel])){
-	            			foreach($ln_arr[$runlevel] as $link){
-	              				unlink($link);
-	            			}
-	          			}
-	        		}
-	      		}
-	    	}
+		    return false;
 	  	}
 	}
-	
+	*/
+
+	/**boot autostart etc
+	 *
+	 */
+	function rc_edit($service, $rl, $action){
+		// $action = "on|off";
+		global $app;
+		$dist_init_scripts = $app->system->server_conf['dist_init_scripts'];
+		$dist_runlevel = $app->system->server_conf['dist_runlevel'];
+		$dist = $app->system->server_conf['dist'];
+		if(trim($dist_runlevel) == ''){ // falls es keine runlevel gibt (FreeBSD)
+			if($action == 'on'){
+				@symlink($dist_init_scripts.'/'.$service, $dist_init_scripts.'/'.$service.'.sh');
+			}
+			if($action == 'off'){
+				if(is_link($dist_init_scripts.'/'.$service.'.sh')){
+					unlink($dist_init_scripts.'/'.$service.'.sh');
+				} else {
+					rename($dist_init_scripts.'/'.$service.'.sh', $dist_init_scripts.'/'.$service);
+				}
+			}
+		} else { // Linux
+			if(substr($dist, 0, 4) == 'suse'){
+				if($action == 'on'){
+					exec("chkconfig --add $service &> /dev/null");
+				}
+				if($action == 'off'){
+					exec("chkconfig --del $service &> /dev/null");
+				}
+			} else {
+				$runlevels = explode(',', $rl);
+				foreach($runlevels as $runlevel){
+					$runlevel = trim($runlevel);
+					if($runlevel != '' && is_dir($dist_runlevel.'/rc'.$runlevel.'.d')){
+						$handle=opendir($dist_runlevel.'/rc'.$runlevel.'.d');
+						while($file = readdir($handle)){
+							if($file != '.' && $file != '..'){
+								$target = @readlink($dist_runlevel.'/rc'.$runlevel.'.d/'.$file);
+								if(strstr($file, $service) && strstr($target, $service) && substr($file, 0, 1) == 'S') $ln_arr[$runlevel][] = $dist_runlevel.'/rc'.$runlevel.'.d/'.$file;
+							}
+						}
+						closedir($handle);
+					}
+					if($action == 'on'){
+						if(!is_array($ln_arr[$runlevel])) @symlink($dist_init_scripts.'/'.$service, $dist_runlevel.'/rc'.$runlevel.'.d/S99'.$service);
+					}
+					if($action == 'off'){
+						if(is_array($ln_arr[$runlevel])){
+							foreach($ln_arr[$runlevel] as $link){
+								unlink($link);
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+
+
+
 	/**
 	 * Filter information from the commands
 	 *
 	 */
 	function grep($content, $string, $params = ''){
 		global $app;
-	  	// params: i, v, w
-	  	$content = $app->file->unix_nl($content);
-	  	$lines = explode("\n", $content);
-	  	foreach($lines as $line){
-	    	if(!strstr($params, 'w')){
-	      		if(strstr($params, 'i')){
-	        		if(strstr($params, 'v')){
-	          			if(!stristr($line, $string)) $find[] = $line;
-	        		} else {
-	          			if(stristr($line, $string)) $find[] = $line;
-	        		}
-	      		} else {
-	        		if(strstr($params, 'v')){
-	          			if(!strstr($line, $string)) $find[] = $line;
-	        		} else {
-	          			if(strstr($line, $string)) $find[] = $line;
-	        		}
-	      		}
-	    	} else {
-	      		if(strstr($params, 'i')){
-	        		if(strstr($params, 'v')){
-	          			if(!$app->string->is_word($string, $line, 'i')) $find[] = $line;
-	        		} else {
-	          			if($app->string->is_word($string, $line, 'i')) $find[] = $line;
-	        		}
-	      		} else {
-	        		if(strstr($params, 'v')){
-	          			if(!$app->string->is_word($string, $line)) $find[] = $line;
-	        		} else {
-	          			if($app->string->is_word($string, $line)) $find[] = $line;
-	        		}
-	      		}
-	    	}
-	  	}
-	  	if(is_array($find)){
-		    $ret_val = implode("\n", $find);
-	    	if(substr($ret_val,-1) != "\n") $ret_val .= "\n";
-	    	$find = NULL;
-	    	return $ret_val;
-	  	} else {
-		    return false;
-	  	}
+		// params: i, v, w
+		$content = $app->file->unix_nl($content);
+		$lines = explode("\n", $content);
+		foreach($lines as $line){
+			if(!strstr($params, 'w')){
+				if(strstr($params, 'i')){
+					if(strstr($params, 'v')){
+						if(!stristr($line, $string)) $find[] = $line;
+					} else {
+						if(stristr($line, $string)) $find[] = $line;
+					}
+				} else {
+					if(strstr($params, 'v')){
+						if(!strstr($line, $string)) $find[] = $line;
+					} else {
+						if(strstr($line, $string)) $find[] = $line;
+					}
+				}
+			} else {
+				if(strstr($params, 'i')){
+					if(strstr($params, 'v')){
+						if(!$app->string->is_word($string, $line, 'i')) $find[] = $line;
+					} else {
+						if($app->string->is_word($string, $line, 'i')) $find[] = $line;
+					}
+				} else {
+					if(strstr($params, 'v')){
+						if(!$app->string->is_word($string, $line)) $find[] = $line;
+					} else {
+						if($app->string->is_word($string, $line)) $find[] = $line;
+					}
+				}
+			}
+		}
+		if(is_array($find)){
+			$ret_val = implode("\n", $find);
+			if(substr($ret_val, -1) != "\n") $ret_val .= "\n";
+			$find = NULL;
+			return $ret_val;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Strip content from fields
 	 *
 	 */
 	function cut($content, $field, $delimiter = ':'){
 		global $app;
-	  	$content = $app->file->unix_nl($content);
-	  	$lines = explode("\n", $content);
-	  	foreach($lines as $line){
-	    	$elms = explode($delimiter, $line);
-	    	$find[] = $elms[($field-1)];
-	  	}
-	  	if(is_array($find)){
-		    $ret_val = implode("\n", $find);
-		    if(substr($ret_val,-1) != "\n") $ret_val .= "\n";
-		    $find = NULL;
-	    	return $ret_val;
-	  	} else {
-		    return false;
-	  	}
+		$content = $app->file->unix_nl($content);
+		$lines = explode("\n", $content);
+		foreach($lines as $line){
+			$elms = explode($delimiter, $line);
+			$find[] = $elms[($field-1)];
+		}
+		if(is_array($find)){
+			$ret_val = implode("\n", $find);
+			if(substr($ret_val, -1) != "\n") $ret_val .= "\n";
+			$find = NULL;
+			return $ret_val;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the content off a file
 	 *
 	 */
 	function cat($file){
 		global $app;
-	  	return $app->file->rf($file);
+		return $app->file->rf($file);
 	}
-	
+
+
+
+
+
 	/**
 	 * Control services to restart etc
 	 *
 	 */
 	function daemon_init($daemon, $action){
 		//* $action = start|stop|restart|reload
-	  	global $app;
-	  	$dist = $this->server_conf['dist'];
-	  	$dist_init_scripts = $this->server_conf['dist_init_scripts'];
-	  	if(!strstr($dist, 'freebsd')){
-		    $app->log->caselog("$dist_init_scripts/$daemon $action &> /dev/null", $this->FILE, __LINE__);
-	  	} else {
-		    if(is_file($dist_init_scripts.'/'.$daemon.'.sh') || is_link($dist_init_scripts.'/'.$daemon.'.sh')){
-	      		if($action == 'start' || $action == 'stop'){
-	        		$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh '.$action.' &> /dev/null', $this->FILE, __LINE__);
-	      		} else {
-	        		$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh stop &> /dev/null', $this->FILE, __LINE__);
-	        		sleep(3);
-	        		$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh start &> /dev/null', $this->FILE, __LINE__);
-	      		}
-	    	} else {
-	      		if(is_file($dist_init_scripts.'/'.$daemon) || is_link($dist_init_scripts.'/'.$daemon)){
-	        		if($action == 'start' || $action == 'stop'){
-	          			$app->log->caselog($dist_init_scripts.'/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
-	        		} else {
-	          			$app->log->caselog($dist_init_scripts.'/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
-	          			sleep(3);
-	          			$app->log->caselog($dist_init_scripts.'/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
-	        		}
-	      		} else {
-	        		if(is_file('/etc/rc.d/'.$daemon) || is_link('/etc/rc.d/'.$daemon)){
-	          			if($action == 'start' || $action == 'stop'){
-	            			$app->log->caselog('/etc/rc.d/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
-	          			} else {
-	            			$app->log->caselog('/etc/rc.d/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
-	            			sleep(3);
-	            			$app->log->caselog('/etc/rc.d/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
-	          			}
-	        		}
-		      	}
-	    	}
-	  	}
+		global $app;
+		$dist = $this->server_conf['dist'];
+		$dist_init_scripts = $this->server_conf['dist_init_scripts'];
+		if(!strstr($dist, 'freebsd')){
+			$app->log->caselog("$dist_init_scripts/$daemon $action &> /dev/null", $this->FILE, __LINE__);
+		} else {
+			if(is_file($dist_init_scripts.'/'.$daemon.'.sh') || is_link($dist_init_scripts.'/'.$daemon.'.sh')){
+				if($action == 'start' || $action == 'stop'){
+					$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh '.$action.' &> /dev/null', $this->FILE, __LINE__);
+				} else {
+					$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh stop &> /dev/null', $this->FILE, __LINE__);
+					sleep(3);
+					$app->log->caselog($dist_init_scripts.'/'.$daemon.'.sh start &> /dev/null', $this->FILE, __LINE__);
+				}
+			} else {
+				if(is_file($dist_init_scripts.'/'.$daemon) || is_link($dist_init_scripts.'/'.$daemon)){
+					if($action == 'start' || $action == 'stop'){
+						$app->log->caselog($dist_init_scripts.'/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
+					} else {
+						$app->log->caselog($dist_init_scripts.'/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
+						sleep(3);
+						$app->log->caselog($dist_init_scripts.'/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
+					}
+				} else {
+					if(is_file('/etc/rc.d/'.$daemon) || is_link('/etc/rc.d/'.$daemon)){
+						if($action == 'start' || $action == 'stop'){
+							$app->log->caselog('/etc/rc.d/'.$daemon.' '.$action.' &> /dev/null', $this->FILE, __LINE__);
+						} else {
+							$app->log->caselog('/etc/rc.d/'.$daemon.' stop &> /dev/null', $this->FILE, __LINE__);
+							sleep(3);
+							$app->log->caselog('/etc/rc.d/'.$daemon.' start &> /dev/null', $this->FILE, __LINE__);
+						}
+					}
+				}
+			}
+		}
 	}
-	
+
 	function netmask($netmask){
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-	  $bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  $parts = explode('0', $bin);
-	  $bin = str_pad($parts[0], 32, '0', STR_PAD_RIGHT);
-	  $bin = wordwrap($bin, 8, '.', 1);
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($bin));
-	  return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$parts = explode('0', $bin);
+		$bin = str_pad($parts[0], 32, '0', STR_PAD_RIGHT);
+		$bin = wordwrap($bin, 8, '.', 1);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($bin));
+		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
 	function binary_netmask($netmask){
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-	  $bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  $parts = explode('0', $bin);
-	  return substr_count($parts[0], '1');
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$parts = explode('0', $bin);
+		return substr_count($parts[0], '1');
 	}
-	
+
 	function network($ip, $netmask){
-	  $netmask = $this->netmask($netmask);
-	  list($f1,$f2,$f3,$f4) = explode('.', $netmask);
-	  $netmask_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  list($f1,$f2,$f3,$f4) = explode('.', $ip);
-	  $ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  for($i=0;$i<32;$i++){
-	    $network_bin .= substr($netmask_bin,$i,1) * substr($ip_bin,$i,1);
-	  }
-	  $network_bin = wordwrap($network_bin, 8, '.', 1);
-	  list($f1,$f2,$f3,$f4) = explode('.', trim($network_bin));
-	  return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
+		$netmask = $this->netmask($netmask);
+		list($f1, $f2, $f3, $f4) = explode('.', $netmask);
+		$netmask_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		for($i=0;$i<32;$i++){
+			$network_bin .= substr($netmask_bin, $i, 1) * substr($ip_bin, $i, 1);
+		}
+		$network_bin = wordwrap($network_bin, 8, '.', 1);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($network_bin));
+		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
+
+
+
+
 	/**
 	 * Make a broadcast address from an IP number in combination with netmask
 	 *
 	 */
 	function broadcast($ip, $netmask){
 		$netmask = $this->netmask($netmask);
-	  	$binary_netmask = $this->binary_netmask($netmask);
-	  	list($f1,$f2,$f3,$f4) = explode('.', $ip);
-	  	$ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-	  	$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask),32,'1',STR_PAD_RIGHT);
-	  	$broadcast_bin = wordwrap($broadcast_bin, 8, '.', 1);
-	  	list($f1,$f2,$f3,$f4) = explode('.', trim($broadcast_bin));
-	  	return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
+		$binary_netmask = $this->binary_netmask($netmask);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask), 32, '1', STR_PAD_RIGHT);
+		$broadcast_bin = wordwrap($broadcast_bin, 8, '.', 1);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($broadcast_bin));
+		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the network address information
 	 *
 	 */
 	function network_info(){
 		$dist = $this->server_conf['dist'];
-	  	ob_start();
-	  	passthru('ifconfig');
-	  	$output = ob_get_contents();
-	  	ob_end_clean();
-	  	$lines = explode("\n", $output);
-	  	foreach($lines as $line){
-		    $elms = explode(' ', $line);
-	    	if(trim($elms[0]) != '' && substr($elms[0],0,1) != "\t"){
-	      		$elms[0] = trim($elms[0]);
-	      		if(strstr($dist, 'freebsd')) $elms[0] = substr($elms[0],0,-1);
-	      		$interfaces[] = $elms[0];
-	    	}
-	  	}
-	  	if(!empty($interfaces)){
-		    foreach($interfaces as $interface){
-	    		ob_start();
-	      		if(!strstr($dist, 'freebsd')){
-	        		passthru('ifconfig '.$interface." | grep -iw 'inet' | cut -f2 -d: | cut -f1 -d' '");
-	      		} else {
-	        		passthru('ifconfig '.$interface." | grep -iw 'inet' | grep -iv 'inet6' | cut -f2 -d' '");
-	      		}
-	      		$output = trim(ob_get_contents());
-	      		ob_end_clean();
-	      		if($output != ''){
-	        		$ifconfig['INTERFACE'][$interface] = $output;
-	        		$ifconfig['IP'][$output] = $interface;
-	      		}
-	    	}
-	    	if(!empty($ifconfig)){
-	      		return $ifconfig;
-	    	} else {
-	      		return false;
-	    	}
-	  	} else {
-	    	return false;
-	  	}
+		ob_start();
+		passthru('ifconfig');
+		$output = ob_get_contents();
+		ob_end_clean();
+		$lines = explode("\n", $output);
+		foreach($lines as $line){
+			$elms = explode(' ', $line);
+			if(trim($elms[0]) != '' && substr($elms[0], 0, 1) != "\t"){
+				$elms[0] = trim($elms[0]);
+				if(strstr($dist, 'freebsd')) $elms[0] = substr($elms[0], 0, -1);
+				$interfaces[] = $elms[0];
+			}
+		}
+		if(!empty($interfaces)){
+			foreach($interfaces as $interface){
+				ob_start();
+				if(!strstr($dist, 'freebsd')){
+					passthru('ifconfig '.$interface." | grep -iw 'inet' | cut -f2 -d: | cut -f1 -d' '");
+				} else {
+					passthru('ifconfig '.$interface." | grep -iw 'inet' | grep -iv 'inet6' | cut -f2 -d' '");
+				}
+				$output = trim(ob_get_contents());
+				ob_end_clean();
+				if($output != ''){
+					$ifconfig['INTERFACE'][$interface] = $output;
+					$ifconfig['IP'][$output] = $interface;
+				}
+			}
+			if(!empty($ifconfig)){
+				return $ifconfig;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Configure the network settings from the system
 	 *
 	 */
 	function network_config(){
 		$ifconfig = $this->network_info();
-	  	if($ifconfig){
-	    	$main_interface = $ifconfig['IP'][$this->server_conf['server_ip']];
-	    	if(strstr($main_interface, ':')){
-	      		$parts = explode(':', $main_interface);
-	      		$main_interface = trim($parts[0]);
-	    	}
-	    	if($main_interface != ''){
-	      		$ips = $this->data['isp_server_ip'];
-	      		if(!empty($ips)){
-	        		foreach($ips as $ip){
-	          			if(!isset($ifconfig['IP'][$ip['server_ip']])){
-	            			$to_set[] = $ip['server_ip'];
-	          			} else {
-	            			unset($ifconfig['IP'][$ip['server_ip']]);
-	          			}
-	        		}
-	        		if(!empty($ifconfig['IP'])){
-	          			foreach($ifconfig['IP'] as $key => $val){
-	            			if(!strstr($val, 'lo') && !strstr($val, 'lp') && strstr($val, $main_interface)){
-	              				exec('ifconfig '.$val.' down &> /dev/null');
-	              				unset($ifconfig['INTERFACE'][$val]);
-	            			}
-	          			}
-	        		}
-	        		if(!empty($to_set)){
-	         			foreach($to_set as $to){
-	           				$i = 0;
-	           				while($i >= 0){
-	             				if(isset($ifconfig['INTERFACE'][$main_interface.':'.$i])){
-	               					$i++;
-					             } else {
-	               					$new_interface = $main_interface.':'.$i;
-	               					$i = -1;
-	             				}
-	           				}
-	           				exec('ifconfig '.$new_interface.' '.$to.' netmask '.$this->server_conf['server_netzmaske'].' up &> /dev/null');
-	           				$ifconfig['INTERFACE'][$new_interface] = $to;
-	          			}
-	        		}
-	      		}
-	    	}
-	  	}
+		if($ifconfig){
+			$main_interface = $ifconfig['IP'][$this->server_conf['server_ip']];
+			if(strstr($main_interface, ':')){
+				$parts = explode(':', $main_interface);
+				$main_interface = trim($parts[0]);
+			}
+			if($main_interface != ''){
+				$ips = $this->data['isp_server_ip'];
+				if(!empty($ips)){
+					foreach($ips as $ip){
+						if(!isset($ifconfig['IP'][$ip['server_ip']])){
+							$to_set[] = $ip['server_ip'];
+						} else {
+							unset($ifconfig['IP'][$ip['server_ip']]);
+						}
+					}
+					if(!empty($ifconfig['IP'])){
+						foreach($ifconfig['IP'] as $key => $val){
+							if(!strstr($val, 'lo') && !strstr($val, 'lp') && strstr($val, $main_interface)){
+								exec('ifconfig '.$val.' down &> /dev/null');
+								unset($ifconfig['INTERFACE'][$val]);
+							}
+						}
+					}
+					if(!empty($to_set)){
+						foreach($to_set as $to){
+							$i = 0;
+							while($i >= 0){
+								if(isset($ifconfig['INTERFACE'][$main_interface.':'.$i])){
+									$i++;
+								} else {
+									$new_interface = $main_interface.':'.$i;
+									$i = -1;
+								}
+							}
+							exec('ifconfig '.$new_interface.' '.$to.' netmask '.$this->server_conf['server_netzmaske'].' up &> /dev/null');
+							$ifconfig['INTERFACE'][$new_interface] = $to;
+						}
+					}
+				}
+			}
+		}
 	}
-	
+
 	function quota_dirs(){
-	  global $app;
-	  $content = $app->file->unix_nl($app->file->no_comments('/etc/fstab'));
-	  $lines = explode("\n", $content);
-	  foreach($lines as $line){
-	    $line = trim($line);
-	    if($line != ''){
-	      $elms = explode("\t", $line);
-	      foreach($elms as $elm){
-	        if(trim($elm) != '') $f[] = $elm;
-	      }
-	      if(!empty($f) && stristr($f[3], 'userquota') && stristr($f[3], 'groupquota')){
-	        $q_dirs[] = trim($f[1]);
-	      }
-	      unset($f);
-	    }
-	  }
-	  if(!empty($q_dirs)){
-	    return $q_dirs;
-	  } else {
-	    return false;
-	  }
+		global $app;
+		$content = $app->file->unix_nl($app->file->no_comments('/etc/fstab'));
+		$lines = explode("\n", $content);
+		foreach($lines as $line){
+			$line = trim($line);
+			if($line != ''){
+				$elms = explode("\t", $line);
+				foreach($elms as $elm){
+					if(trim($elm) != '') $f[] = $elm;
+				}
+				if(!empty($f) && stristr($f[3], 'userquota') && stristr($f[3], 'groupquota')){
+					$q_dirs[] = trim($f[1]);
+				}
+				unset($f);
+			}
+		}
+		if(!empty($q_dirs)){
+			return $q_dirs;
+		} else {
+			return false;
+		}
 	}
-	
+
+
+
+
+
 	/**
 	 * Scan the trash for virusses infection
 	 *
 	 */
 	function make_trashscan(){
 		global $app;
-	  	//trashscan erstellen
-	  	// Template Öffnen
-	  	$app->tpl->clear_all();
-	  	$app->tpl->define( array(table    => 'trashscan.master'));
-	
-	  	if(!isset($this->server_conf['virusadmin']) || trim($this->server_conf['virusadmin']) == '') $this->server_conf['virusadmin'] = 'admispconfig@localhost';
-	  	if(substr($this->server_conf['virusadmin'],0,1) == '#'){
-		    $notify = 'no';
-	  	} else {
-		    $notify = 'yes';
-	  	}
-	
-	  	// Variablen zuweisen
-	  	$app->tpl->assign( array(VIRUSADMIN => $this->server_conf['virusadmin'],
-	                           NOTIFICATION => $notify));
-	
-	  	$app->tpl->parse(TABLE, table);
-	
-	  	$trashscan_text = $app->tpl->fetch();
-	
-	  	$datei = '/home/admispconfig/ispconfig/tools/clamav/bin/trashscan';
-	  	$app->file->wf($datei, $trashscan_text);
-	
-	  	chmod($datei, 0755);
-	  	chown($datei,'admispconfig');
-	  	chgrp($datei,'admispconfig');
+		//trashscan erstellen
+		// Template Öffnen
+		$app->tpl->clear_all();
+		$app->tpl->define( array(table    => 'trashscan.master'));
+
+		if(!isset($this->server_conf['virusadmin']) || trim($this->server_conf['virusadmin']) == '') $this->server_conf['virusadmin'] = 'admispconfig@localhost';
+		if(substr($this->server_conf['virusadmin'], 0, 1) == '#'){
+			$notify = 'no';
+		} else {
+			$notify = 'yes';
+		}
+
+		// Variablen zuweisen
+		$app->tpl->assign( array(VIRUSADMIN => $this->server_conf['virusadmin'],
+				NOTIFICATION => $notify));
+
+		$app->tpl->parse(TABLE, table);
+
+		$trashscan_text = $app->tpl->fetch();
+
+		$datei = '/home/admispconfig/ispconfig/tools/clamav/bin/trashscan';
+		$app->file->wf($datei, $trashscan_text);
+
+		chmod($datei, 0755);
+		chown($datei, 'admispconfig');
+		chgrp($datei, 'admispconfig');
 	}
-	
+
+
+
+
+
 	/**
 	 * Get the current time
 	 *
 	 */
 	function get_time(){
-	  $addr = 'http://www.ispconfig.org/';
-	  $timeout = 1;
-	  $url_parts = parse_url($addr);
-	  $path = $url_parts['path'];
-	  $port = 80;
-	  $urlHandle = @fsockopen($url_parts['host'], $port, $errno, $errstr, $timeout);
-	  if ($urlHandle){
-	    socket_set_timeout($urlHandle, $timeout);
-	
-	    $urlString = 'GET '.$path." HTTP/1.0\r\nHost: ".$url_parts['host']."\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
-	    if ($user) $urlString .= 'Authorization: Basic '.base64_encode($user.':'.$pass)."\r\n";
-	    $urlString .= "\r\n";
-	    fputs($urlHandle, $urlString);
-	
-	    $month['Jan'] = '01';
-	    $month['Feb'] = '02';
-	    $month['Mar'] = '03';
-	    $month['Apr'] = '04';
-	    $month['May'] = '05';
-	    $month['Jun'] = '06';
-	    $month['Jul'] = '07';
-	    $month['Aug'] = '08';
-	    $month['Sep'] = '09';
-	    $month['Oct'] = '10';
-	    $month['Nov'] = '11';
-	    $month['Dec'] = '12';
-	    $c = 0;
-	    $l = 0;
-	    $startzeit = time();
-	    while(!feof($urlHandle) && $c < 2 && $l == 0){
-	      $line = trim(fgets($urlHandle,128));
-	      $response .= $line;
-	      $c = time() - $startzeit;
-	      if($line == '' || substr($line, 0, 5) == 'Date:') $l += 1; // nur den Header auslesen
-	      if(substr($line, 0, 5) == 'Date:'){
-	        $parts = explode(' ', $line);
-	        $tag = $parts[2];
-	        $monat = $month[$parts[3]];
-	        $jahr = $parts[4];
-	        list($stunde, $minute, $sekunde) = explode(':', $parts[5]);
-	        $timestamp = mktime($stunde,$minute,$sekunde,$monat,$tag,$jahr);
-	      }
-	    }
-	
-	    @fclose($urlHandle);
-	
-	    return $timestamp;
-	  } else {
-	    @fclose($urlHandle);
-	    return false;
-	  }
+		$addr = 'http://www.ispconfig.org/';
+		$timeout = 1;
+		$url_parts = parse_url($addr);
+		$path = $url_parts['path'];
+		$port = 80;
+		$urlHandle = @fsockopen($url_parts['host'], $port, $errno, $errstr, $timeout);
+		if ($urlHandle){
+			socket_set_timeout($urlHandle, $timeout);
+
+			$urlString = 'GET '.$path." HTTP/1.0\r\nHost: ".$url_parts['host']."\r\nConnection: Keep-Alive\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";
+			if ($user) $urlString .= 'Authorization: Basic '.base64_encode($user.':'.$pass)."\r\n";
+			$urlString .= "\r\n";
+			fputs($urlHandle, $urlString);
+
+			$month['Jan'] = '01';
+			$month['Feb'] = '02';
+			$month['Mar'] = '03';
+			$month['Apr'] = '04';
+			$month['May'] = '05';
+			$month['Jun'] = '06';
+			$month['Jul'] = '07';
+			$month['Aug'] = '08';
+			$month['Sep'] = '09';
+			$month['Oct'] = '10';
+			$month['Nov'] = '11';
+			$month['Dec'] = '12';
+			$c = 0;
+			$l = 0;
+			$startzeit = time();
+			while(!feof($urlHandle) && $c < 2 && $l == 0){
+				$line = trim(fgets($urlHandle, 128));
+				$response .= $line;
+				$c = time() - $startzeit;
+				if($line == '' || substr($line, 0, 5) == 'Date:') $l += 1; // nur den Header auslesen
+				if(substr($line, 0, 5) == 'Date:'){
+					$parts = explode(' ', $line);
+					$tag = $parts[2];
+					$monat = $month[$parts[3]];
+					$jahr = $parts[4];
+					list($stunde, $minute, $sekunde) = explode(':', $parts[5]);
+					$timestamp = mktime($stunde, $minute, $sekunde, $monat, $tag, $jahr);
+				}
+			}
+
+			@fclose($urlHandle);
+
+			return $timestamp;
+		} else {
+			@fclose($urlHandle);
+			return false;
+		}
 	}
-	
-	function replaceLine($filename,$search_pattern,$new_line,$strict = 0,$append = 1) {
+
+	function replaceLine($filename, $search_pattern, $new_line, $strict = 0, $append = 1) {
 		global $app;
 		if($this->checkpath($filename) == false) {
-			$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
 			return false;
 		}
 		$lines = @file($filename);
@@ -1315,7 +1425,7 @@ class system{
 		if(is_array($lines)) {
 			foreach($lines as $line) {
 				if($strict == 0) {
-					if(stristr($line,$search_pattern)) {
+					if(stristr($line, $search_pattern)) {
 						$out .= $new_line."\n";
 						$found = 1;
 					} else {
@@ -1331,64 +1441,64 @@ class system{
 				}
 			}
 		}
-		
+
 		if($found == 0) {
 			//* add \n if the last line does not end with \n or \r
-			if(substr($out,-1) != "\n" && substr($out,-1) != "\r" && filesize($filename) > 0) $out .= "\n";
+			if(substr($out, -1) != "\n" && substr($out, -1) != "\r" && filesize($filename) > 0) $out .= "\n";
 			//* add the new line at the end of the file
 			if($append == 1) {
 				$out .= $new_line."\n";
 			}
 		}
-		file_put_contents($filename,$out);
-	}
-	
-	function removeLine($filename,$search_pattern,$strict = 0) {
-	global $app;
-	if($this->checkpath($filename) == false) {
-		$app->log("Action aborted, file is a symlink: $filename",LOGLEVEL_WARN);
-		return false;
+		file_put_contents($filename, $out);
 	}
-	if($lines = @file($filename)) {
-		$out = '';
-		foreach($lines as $line) {
-			if($strict == 0) {
-				if(!stristr($line,$search_pattern)) {
-					$out .= $line;
-				}
-			} else {
-				if(!trim($line) == $search_pattern) {
-					$out .= $line;
+
+	function removeLine($filename, $search_pattern, $strict = 0) {
+		global $app;
+		if($this->checkpath($filename) == false) {
+			$app->log("Action aborted, file is a symlink: $filename", LOGLEVEL_WARN);
+			return false;
+		}
+		if($lines = @file($filename)) {
+			$out = '';
+			foreach($lines as $line) {
+				if($strict == 0) {
+					if(!stristr($line, $search_pattern)) {
+						$out .= $line;
+					}
+				} else {
+					if(!trim($line) == $search_pattern) {
+						$out .= $line;
+					}
 				}
 			}
+			file_put_contents($filename, $out);
 		}
-		file_put_contents($filename,$out);
 	}
-	}
-	
+
 	function maildirmake($maildir_path, $user = '', $subfolder = '') {
-		
+
 		global $app;
-		
+
 		if($subfolder != '') {
 			$dir = escapeshellcmd($maildir_path.'/.'.$subfolder);
 		} else {
 			$dir = escapeshellcmd($maildir_path);
 		}
-		
+
 		if(!is_dir($dir)) mkdir($dir, 0700, true);
 
 		if($user != '' && $user != 'root' && $this->is_user($user)) {
 			$user = escapeshellcmd($user);
 			// I assume that the name of the (vmail group) is the same as the name of the mail user in ISPConfig 3
 			$group = $user;
-			if(is_dir($dir)) $this->chown($dir,$user);
-			if(is_dir($dir)) $this->chgrp($dir,$group);
+			if(is_dir($dir)) $this->chown($dir, $user);
+			if(is_dir($dir)) $this->chgrp($dir, $group);
 
 			$chown_mdsub = true;
 		}
-		
-		$maildirsubs = array('cur','new','tmp');
+
+		$maildirsubs = array('cur', 'new', 'tmp');
 
 		foreach ($maildirsubs as $mdsub) {
 			if(!is_dir($dir.'/'.$mdsub)) mkdir($dir.'/'.$mdsub, 0700, true);
@@ -1399,7 +1509,7 @@ class system{
 		}
 
 		chmod($dir, 0700);
-		
+
 		/*
 		if($user != '' && $this->is_user($user) && $user != 'root') {
 			$user = escapeshellcmd($user);
@@ -1408,7 +1518,7 @@ class system{
 			exec("chown $user:$group $dir $dir_cur $dir_new $dir_tmp");
 		}
 		*/
-		
+
 		//* Add the subfolder to the subscriptions and courierimapsubscribed files
 		if($subfolder != '') {
 			// Courier
@@ -1416,188 +1526,188 @@ class system{
 				$tmp_file = escapeshellcmd($maildir_path.'/courierimapsubscribed');
 				touch($tmp_file);
 				chmod($tmp_file, 0744);
-				chown($tmp_file,'vmail');
-				chgrp($tmp_file,'vmail');
+				chown($tmp_file, 'vmail');
+				chgrp($tmp_file, 'vmail');
 			}
-			$this->replaceLine($maildir_path.'/courierimapsubscribed','INBOX.'.$subfolder,'INBOX.'.$subfolder,1,1);
-			
+			$this->replaceLine($maildir_path.'/courierimapsubscribed', 'INBOX.'.$subfolder, 'INBOX.'.$subfolder, 1, 1);
+
 			// Dovecot
 			if(!is_file($maildir_path.'/subscriptions')) {
 				$tmp_file = escapeshellcmd($maildir_path.'/subscriptions');
 				touch($tmp_file);
 				chmod($tmp_file, 0744);
-				chown($tmp_file,'vmail');
-				chgrp($tmp_file,'vmail');
+				chown($tmp_file, 'vmail');
+				chgrp($tmp_file, 'vmail');
 			}
-			$this->replaceLine($maildir_path.'/subscriptions',$subfolder,$subfolder,1,1);
+			$this->replaceLine($maildir_path.'/subscriptions', $subfolder, $subfolder, 1, 1);
 		}
-		
-		$app->log('Created Maildir '.$maildir_path.' with subfolder: '.$subfolder,LOGLEVEL_DEBUG);
-		
+
+		$app->log('Created Maildir '.$maildir_path.' with subfolder: '.$subfolder, LOGLEVEL_DEBUG);
+
 	}
-	
+
 	//* Function to create directory paths and chown them to a user and group
 	function mkdirpath($path, $mode = 0755, $user = '', $group = '') {
-		$path_parts = explode('/',$path);
+		$path_parts = explode('/', $path);
 		$new_path = '';
 		if(is_array($path_parts)) {
 			foreach($path_parts as $part) {
 				$new_path .= '/'.$part;
 				if(!@is_dir($new_path)) {
 					$this->mkdir($new_path);
-					$this->chmod($new_path,$mode);
-					if($user != '') $this->chown($new_path,$user);
-					if($group != '') $this->chgrp($new_path,$group);
+					$this->chmod($new_path, $mode);
+					if($user != '') $this->chown($new_path, $user);
+					if($group != '') $this->chgrp($new_path, $group);
 				}
 			}
 		}
-		
+
 	}
-	
+
 	//* Check if a application is installed
 	function is_installed($appname) {
-		exec('which '.escapeshellcmd($appname).' 2> /dev/null',$out,$returncode);
-		if(isset($out[0]) && stristr($out[0],$appname) && $returncode == 0) {
+		exec('which '.escapeshellcmd($appname).' 2> /dev/null', $out, $returncode);
+		if(isset($out[0]) && stristr($out[0], $appname) && $returncode == 0) {
 			return true;
 		} else {
 			return false;
 		}
 	}
-	
-	function web_folder_protection($document_root,$protect) {
-		global $app,$conf;
-		
+
+	function web_folder_protection($document_root, $protect) {
+		global $app, $conf;
+
 		if($this->checkpath($document_root) == false) {
-			$app->log("Action aborted, target is a symlink: $document_root",LOGLEVEL_DEBUG);
+			$app->log("Action aborted, target is a symlink: $document_root", LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* load the server configuration options
 		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		if($protect == true && $web_config['web_folder_protection'] == 'y') {
 			//* Add protection
-			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root,'..')) exec('chattr +i '.escapeshellcmd($document_root));
+			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root, '..')) exec('chattr +i '.escapeshellcmd($document_root));
 		} else {
 			//* Remove protection
-			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root,'..')) exec('chattr -i '.escapeshellcmd($document_root));
+			if($document_root != '' && $document_root != '/' && strlen($document_root) > 6 && !stristr($document_root, '..')) exec('chattr -i '.escapeshellcmd($document_root));
 		}
 	}
-	
+
 	function usermod($username, $uid = 0, $gid = 0, $home = '', $shell = '', $password = '', $login = '') {
 		global $app;
-		
+
 		if($login == '') $login = $username;
-		
+
 		//* Change values in /etc/passwd
 		$passwd_file_array = file('/etc/passwd');
 		if(is_array($passwd_file_array)) {
 			foreach($passwd_file_array as $line) {
 				$line = trim($line);
-				$parts = explode(':',$line);
+				$parts = explode(':', $line);
 				if($parts[0] == $username) {
 					if(trim($login) != '' && trim($login) != trim($username)) $parts[0] = trim($login);
 					if(!empty($uid)) $parts[2] = trim($uid);
 					if(!empty($gid)) $parts[3] = trim($gid);
 					if(trim($home) != '') $parts[5] = trim($home);
 					if(trim($shell) != '') $parts[6] = trim($shell);
-					$new_line = implode(':',$parts);
-					copy('/etc/passwd','/etc/passwd~');
-					chmod('/etc/passwd~',0600);
+					$new_line = implode(':', $parts);
+					copy('/etc/passwd', '/etc/passwd~');
+					chmod('/etc/passwd~', 0600);
 					$app->uses('system');
-					$app->system->replaceLine('/etc/passwd',$line,$new_line,1,0);
+					$app->system->replaceLine('/etc/passwd', $line, $new_line, 1, 0);
 				}
 			}
 			unset($passwd_file_array);
 		}
-		
+
 		//* If username != login, change username in group and gshadow file
 		if($username  != $login) {
 			$group_file_array = file('/etc/group');
 			if(is_array($group_file_array)) {
 				foreach($group_file_array as $line) {
 					$line = trim($line);
-					$parts = explode(':',$line);
-					if(strstr($parts[3],$username)) {
-						$uparts = explode(',',$parts[3]);
+					$parts = explode(':', $line);
+					if(strstr($parts[3], $username)) {
+						$uparts = explode(',', $parts[3]);
 						if(is_array($uparts)) {
 							foreach($uparts as $key => $val) {
 								if($val == $username) $uparts[$key] = $login;
 							}
 						}
-						$parts[3] = implode(',',$uparts);
-						$new_line = implode(':',$parts);
-						copy('/etc/group','/etc/group~');
-						chmod('/etc/group~',0600);
-						$app->system->replaceLine('/etc/group',$line,$new_line,1,0);
+						$parts[3] = implode(',', $uparts);
+						$new_line = implode(':', $parts);
+						copy('/etc/group', '/etc/group~');
+						chmod('/etc/group~', 0600);
+						$app->system->replaceLine('/etc/group', $line, $new_line, 1, 0);
 					}
 				}
 			}
 			unset($group_file_array);
-			
+
 			$gshadow_file_array = file('/etc/gshadow');
 			if(is_array($gshadow_file_array)) {
 				foreach($gshadow_file_array as $line) {
 					$line = trim($line);
-					$parts = explode(':',$line);
-					if(strstr($parts[3],$username)) {
-						$uparts = explode(',',$parts[3]);
+					$parts = explode(':', $line);
+					if(strstr($parts[3], $username)) {
+						$uparts = explode(',', $parts[3]);
 						if(is_array($uparts)) {
 							foreach($uparts as $key => $val) {
 								if($val == $username) $uparts[$key] = $login;
 							}
 						}
-						$parts[3] = implode(',',$uparts);
-						$new_line = implode(':',$parts);
-						copy('/etc/gshadow','/etc/gshadow~');
-						chmod('/etc/gshadow~',0600);
-						$app->system->replaceLine('/etc/gshadow',$line,$new_line,1,0);
+						$parts[3] = implode(',', $uparts);
+						$new_line = implode(':', $parts);
+						copy('/etc/gshadow', '/etc/gshadow~');
+						chmod('/etc/gshadow~', 0600);
+						$app->system->replaceLine('/etc/gshadow', $line, $new_line, 1, 0);
 					}
 				}
 			}
 			unset($group_file_array);
 		}
-		
-		
+
+
 		//* When password or login name has been changed
 		if($password != '' || $username  != $login) {
 			$shadow_file_array = file('/etc/shadow');
 			if(is_array($shadow_file_array)) {
 				foreach($shadow_file_array as $line) {
 					$line = trim($line);
-					$parts = explode(':',$line);
+					$parts = explode(':', $line);
 					if($parts[0] == $username) {
 						if(trim($login) != '' && trim($login) != trim($username)) $parts[0] = trim($login);
 						if(trim($password) != '') $parts[1] = trim($password);
-						$new_line = implode(':',$parts);
-						copy('/etc/shadow','/etc/shadow~');
-						chmod('/etc/shadow~',0600);
-						$app->system->replaceLine('/etc/shadow',$line,$new_line,1,0);
+						$new_line = implode(':', $parts);
+						copy('/etc/shadow', '/etc/shadow~');
+						chmod('/etc/shadow~', 0600);
+						$app->system->replaceLine('/etc/shadow', $line, $new_line, 1, 0);
 					}
 				}
 			}
 			unset($shadow_file_array);
 		}
 	}
-	
+
 	function intval($string, $force_numeric = false) {
-        if(intval($string) == 2147483647) {
-            if($force_numeric == true) return floatval($string);
-            elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
-            else return 0;
-        } else {
-            return intval($string);
-        }
-    }
-	
+		if(intval($string) == 2147483647) {
+			if($force_numeric == true) return floatval($string);
+			elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2];
+			else return 0;
+		} else {
+			return intval($string);
+		}
+	}
+
 	function is_mounted($mountpoint){
 		//$cmd = 'df 2>/dev/null | grep " '.$mountpoint.'$"';
 		$cmd = 'mount 2>/dev/null | grep " on '.$mountpoint.' type "';
 		exec($cmd, $output, $return_var);
-		return $return_var == 0 ? true : false; 
+		return $return_var == 0 ? true : false;
 	}
-	
+
 	function getinitcommand($servicename, $action, $init_script_directory = ''){
 		global $conf;
 		// systemd
@@ -1616,4 +1726,5 @@ class system{
 	}
 
 }
+
 ?>
diff --git a/server/lib/classes/tpl.inc.php b/server/lib/classes/tpl.inc.php
index c3c16c9538452fcafd92e5b3ddc147fe71bfa1b5..deb9ca1c5422deeaca0013517064a37602d3c625 100644
--- a/server/lib/classes/tpl.inc.php
+++ b/server/lib/classes/tpl.inc.php
@@ -12,356 +12,375 @@
 
 // check to avoid multiple including of class
 if (!defined('vlibTemplateClassLoaded')) {
-    define('vlibTemplateClassLoaded', 1);
-
-   	include_once ($conf['classpath'].'/tpl_error.inc.php');
-   	include_once ($conf['classpath'].'/tpl_ini.inc.php');
-
-    /**
-     * vlibTemplate is a class used to seperate PHP and HTML.
-     * For instructions on how to use vlibTemplate, see the
-     * vlibTemplate.html file, located in the 'docs' directory.
-     *
-     * @since 07/03/2002
-     * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-     * @package vLIB
-     * @access public
-     * @see vlibTemplate.html
-     */
-
-    class tpl {
-
-    /*-----------------------------------------------------------------------------\
+	define('vlibTemplateClassLoaded', 1);
+
+	include_once $conf['classpath'].'/tpl_error.inc.php';
+	include_once $conf['classpath'].'/tpl_ini.inc.php';
+
+	/**
+	 * vlibTemplate is a class used to seperate PHP and HTML.
+	 * For instructions on how to use vlibTemplate, see the
+	 * vlibTemplate.html file, located in the 'docs' directory.
+	 *
+	 * @since 07/03/2002
+	 * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+	 * @package vLIB
+	 * @access public
+	 * @see vlibTemplate.html
+	 */
+
+
+	class tpl {
+
+		/*-----------------------------------------------------------------------------\
     |                                 ATTENTION                                    |
     |  Do not touch the following variables. vlibTemplate will not work otherwise. |
     \-----------------------------------------------------------------------------*/
 
-        var $OPTIONS = array(
-                        'MAX_INCLUDES'          =>   10,
-                        'TEMPLATE_DIR'          => null,
-                        'GLOBAL_VARS'           => null,
-                        'GLOBAL_CONTEXT_VARS'   => null,
-                        'LOOP_CONTEXT_VARS'     => null,
-                        'SET_LOOP_VAR'          => null,
-                        'DEFAULT_ESCAPE'        => null,
-                        'STRICT'                => null,
-                        'CASELESS'              => null,
-                        'UNKNOWNS'              => null,
-                        'TIME_PARSE'            => null,
-                        'ENABLE_PHPINCLUDE'     => null,
-                        'INCLUDE_PATHS'         => array(),
-                        'CACHE_DIRECTORY'       => null,
-                        'CACHE_LIFETIME'        => null,
-                        'CACHE_EXTENSION'       => null
-                             );
-
-        /** open and close tags used for escaping */
-        var $ESCAPE_TAGS = array(
-                            'html' => array('open' => 'htmlspecialchars('
-                                            ,'close'=> ', ENT_QUOTES)'),
-                            'url' => array('open' => 'urlencode('
-                                            ,'close'=> ')'),
-                            'rawurl'=>array('open' => 'rawurlencode('
-                                            ,'close'=> ')'),
-                            'sq' => array('open' => 'addcslashes('
-                                            ,'close'=> ", \"'\")"),
-                            'dq' => array('open' => 'addcslashes('
-                                            ,'close'=> ", '\"')"),
-                            '1' => array('open' => 'htmlspecialchars('
-                                            ,'close'=> ', ENT_QUOTES)'),
-                            '0' => array('open' => ''
-                                            ,'close'=> ''),
-                            'none' => array('open' => ''
-                                            ,'close'=> ''),
-                            'hex'        => array('open' => '$this->_escape_hex(',
-                                            'close'=> ', false)'),
-                            'hexentity'  => array('open' => '$this->_escape_hex(',
-                                            'close'=> ', true)')
-                                );
-
-        /** open and close tags used for formatting */
-        var $FORMAT_TAGS = array(
-                            'strtoupper' => array('open' => 'strtoupper(',
-                                            'close'=> ')'),
-                            'uc'         => array('open' => 'strtoupper(',
-                                            'close'=> ')'),
-                            'strtolower' => array('open' => 'strtolower(',
-                                            'close'=> ')'),
-                            'lc'         => array('open' => 'strtolower(',
-                                            'close'=> ')'),
-                            'ucfirst'    => array('open' => 'ucfirst(',
-                                            'close'=> ')'),
-                            'lcucfirst'  => array('open' => 'ucfirst(strtolower(',
-                                            'close'=> '))'),
-                            'ucwords'    => array('open' => 'ucwords(',
-                                            'close'=> ')'),
-                            'lcucwords'  => array('open' => 'ucwords(strtolower(',
-                                            'close'=> '))')
-                                );
-
-        /** operators allowed when using extended TMPL_IF syntax */
-        var $allowed_if_ops = array('==','!=','<>','<','>','<=','>=');
-
-        /** dbs allowed by vlibTemplate::setDbLoop(). */
-        var $allowed_loop_dbs = array('MYSQL','POSTGRESQL','INFORMIX','INTERBASE','INGRES',
-                                      'MSSQL','MSQL','OCI8','ORACLE','OVRIMOS','SYBASE');
-
-        /** root directory of vlibTemplate automagically filled in */
-        var $VLIBTEMPLATE_ROOT = null;
-
-        /** contains current directory used when doing recursive include */
-        var $_currentincludedir = array();
-
-        /** current depth of includes */
-        var $_includedepth = 0;
-
-        /** full path to tmpl file */
-        var $_tmplfilename = null;
-
-        /** file data before it's parsed */
-        var $_tmplfile = null;
-
-        /** parsed version of file, ready for eval()ing */
-        var $_tmplfilep = null;
-
-        /** eval()ed version ready for printing or whatever */
-        var $_tmploutput = null;
-
-        /** array for variables to be kept */
-        var $_vars = array();
-
-        /** array where loop variables are kept */
-        var $_arrvars = array();
-
-        /** array which holds the current namespace during parse */
-        var $_namespace = array();
-
-        /** variable is set to true once the template is parsed, to save re-parsing everything */
-        var $_parsed = false;
-
-        /** array holds all unknowns vars */
-        var $_unknowns = array();
-
-        /** microtime when template parsing began */
-        var $_firstparsetime = null;
-
-        /** total time taken to parse template */
-        var $_totalparsetime = null;
-
-        /** name of current loop being passed in */
-        var $_currloopname = null;
-
-        /** rows with the above loop */
-        var $_currloop = array();
-
-        /** define vars to avoid warnings */
-        var $_debug = null;
-        var $_cache = null;
-        
-        /** array which holds the dynamic Includes */
-        var $_dyninclude = array();
-    /*-----------------------------------------------------------------------------\
+		var $OPTIONS = array(
+			'MAX_INCLUDES'          =>   10,
+			'TEMPLATE_DIR'          => null,
+			'GLOBAL_VARS'           => null,
+			'GLOBAL_CONTEXT_VARS'   => null,
+			'LOOP_CONTEXT_VARS'     => null,
+			'SET_LOOP_VAR'          => null,
+			'DEFAULT_ESCAPE'        => null,
+			'STRICT'                => null,
+			'CASELESS'              => null,
+			'UNKNOWNS'              => null,
+			'TIME_PARSE'            => null,
+			'ENABLE_PHPINCLUDE'     => null,
+			'INCLUDE_PATHS'         => array(),
+			'CACHE_DIRECTORY'       => null,
+			'CACHE_LIFETIME'        => null,
+			'CACHE_EXTENSION'       => null
+		);
+
+		/** open and close tags used for escaping */
+		var $ESCAPE_TAGS = array(
+			'html' => array('open' => 'htmlspecialchars('
+				, 'close'=> ', ENT_QUOTES)'),
+			'url' => array('open' => 'urlencode('
+				, 'close'=> ')'),
+			'rawurl'=>array('open' => 'rawurlencode('
+				, 'close'=> ')'),
+			'sq' => array('open' => 'addcslashes('
+				, 'close'=> ", \"'\")"),
+			'dq' => array('open' => 'addcslashes('
+				, 'close'=> ", '\"')"),
+			'1' => array('open' => 'htmlspecialchars('
+				, 'close'=> ', ENT_QUOTES)'),
+			'0' => array('open' => ''
+				, 'close'=> ''),
+			'none' => array('open' => ''
+				, 'close'=> ''),
+			'hex'        => array('open' => '$this->_escape_hex(',
+				'close'=> ', false)'),
+			'hexentity'  => array('open' => '$this->_escape_hex(',
+				'close'=> ', true)')
+		);
+
+		/** open and close tags used for formatting */
+		var $FORMAT_TAGS = array(
+			'strtoupper' => array('open' => 'strtoupper(',
+				'close'=> ')'),
+			'uc'         => array('open' => 'strtoupper(',
+				'close'=> ')'),
+			'strtolower' => array('open' => 'strtolower(',
+				'close'=> ')'),
+			'lc'         => array('open' => 'strtolower(',
+				'close'=> ')'),
+			'ucfirst'    => array('open' => 'ucfirst(',
+				'close'=> ')'),
+			'lcucfirst'  => array('open' => 'ucfirst(strtolower(',
+				'close'=> '))'),
+			'ucwords'    => array('open' => 'ucwords(',
+				'close'=> ')'),
+			'lcucwords'  => array('open' => 'ucwords(strtolower(',
+				'close'=> '))')
+		);
+
+		/** operators allowed when using extended TMPL_IF syntax */
+		var $allowed_if_ops = array('==', '!=', '<>', '<', '>', '<=', '>=');
+
+		/** dbs allowed by vlibTemplate::setDbLoop(). */
+		var $allowed_loop_dbs = array('MYSQL', 'POSTGRESQL', 'INFORMIX', 'INTERBASE', 'INGRES',
+			'MSSQL', 'MSQL', 'OCI8', 'ORACLE', 'OVRIMOS', 'SYBASE');
+
+		/** root directory of vlibTemplate automagically filled in */
+		var $VLIBTEMPLATE_ROOT = null;
+
+		/** contains current directory used when doing recursive include */
+		var $_currentincludedir = array();
+
+		/** current depth of includes */
+		var $_includedepth = 0;
+
+		/** full path to tmpl file */
+		var $_tmplfilename = null;
+
+		/** file data before it's parsed */
+		var $_tmplfile = null;
+
+		/** parsed version of file, ready for eval()ing */
+		var $_tmplfilep = null;
+
+		/** eval()ed version ready for printing or whatever */
+		var $_tmploutput = null;
+
+		/** array for variables to be kept */
+		var $_vars = array();
+
+		/** array where loop variables are kept */
+		var $_arrvars = array();
+
+		/** array which holds the current namespace during parse */
+		var $_namespace = array();
+
+		/** variable is set to true once the template is parsed, to save re-parsing everything */
+		var $_parsed = false;
+
+		/** array holds all unknowns vars */
+		var $_unknowns = array();
+
+		/** microtime when template parsing began */
+		var $_firstparsetime = null;
+
+		/** total time taken to parse template */
+		var $_totalparsetime = null;
+
+		/** name of current loop being passed in */
+		var $_currloopname = null;
+
+		/** rows with the above loop */
+		var $_currloop = array();
+
+		/** define vars to avoid warnings */
+		var $_debug = null;
+		var $_cache = null;
+
+
+
+		/** array which holds the dynamic Includes */
+		var $_dyninclude = array();
+		/*-----------------------------------------------------------------------------\
     |                           public functions                                   |
     \-----------------------------------------------------------------------------*/
-		
-		
-        /**
-         * FUNCTION: newTemplate
-         *
-         * Usually called by the class constructor.
-         * Stores the filename in $this->_tmplfilename.
-         * Raises an error if the template file is not found.
-         *
-         * @param string $tmplfile full path to template file
-         * @return boolean true
-         * @access public
-         */
-        function newTemplate ($tmplfile) {
-            if (!$tfile = $this->_fileSearch($tmplfile)) vlibTemplateError::raiseError('VT_ERROR_NOFILE',KILL,$tmplfile);
-
-            // make sure that any parsing vars are cleared for the new template
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
-
-            // reset debug module
-            if ($this->_debug) $this->_debugReset();
-
-            $this->_tmplfilename = $tfile;
-            return true;
-        }
-
-        /**
-         * FUNCTION: setVar
-         *
-         * Sets variables to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         *
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        function setVar ($k,$v=null) {
-            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 ) {
-                        $this->_vars[$key] = $value;
-                    }
-                }
-            }
-            else {
-                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 {
-                    return false;
-                }
-            }
-            return true;
-        }
-        
-        /**
-         * FUNCTION: setInclude
-         *
-         * Sets dynamic includes to be used by the template
-         * If $k is an array, then it will treat it as an associative array
-         * using the keys as variable names and the values as variable values.
-         *
-         * @param mixed $k key to define variable name
-         * @param mixed $v variable to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        
-        function setInclude($k, $v = null) {
-        	if(is_array($k)) {
+
+
+
+
+
+
+
+
+		/**
+		 * FUNCTION: newTemplate
+		 *
+		 * Usually called by the class constructor.
+		 * Stores the filename in $this->_tmplfilename.
+		 * Raises an error if the template file is not found.
+		 *
+		 * @param string $tmplfile full path to template file
+		 * @return boolean true
+		 * @access public
+		 */
+		function newTemplate ($tmplfile) {
+			if (!$tfile = $this->_fileSearch($tmplfile)) vlibTemplateError::raiseError('VT_ERROR_NOFILE', KILL, $tmplfile);
+
+			// make sure that any parsing vars are cleared for the new template
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+
+			// reset debug module
+			if ($this->_debug) $this->_debugReset();
+
+			$this->_tmplfilename = $tfile;
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: setVar
+		 *
+		 * Sets variables to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 *
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setVar ($k, $v=null) {
+			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 ) {
+						$this->_vars[$key] = $value;
+					}
+				}
+			}
+			else {
+				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 {
+					return false;
+				}
+			}
+			return true;
+		}
+
+
+
+
+
+		/**
+		 * FUNCTION: setInclude
+		 *
+		 * Sets dynamic includes to be used by the template
+		 * If $k is an array, then it will treat it as an associative array
+		 * using the keys as variable names and the values as variable values.
+		 *
+		 * @param mixed $k key to define variable name
+		 * @param mixed $v variable to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setInclude($k, $v = null) {
+			if(is_array($k)) {
 				foreach($k as $key => $val) {
 					$this->_dyninclude[$key] = $val;
 				}
 			} else {
 				$this->_dyninclude[$k] = $v;
 			}
-			
+
 			return true;
 		}
 
-        /**
-         * FUNCTION: unsetVar
-         *
-         * Unsets a variable which has already been set
-         * Parse in all vars wanted for deletion in seperate parametres
-         *
-         * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        function unsetVar () {
-            $num_args = func_num_args();
-            if ($num_args < 1)  return false;
-
-            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;
-                unset($this->_vars[$var]);
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: getVars
-         *
-         * Gets all vars currently set in global namespace.
-         *
-         * @return array
-         * @access public
-         */
-        function getVars () {
-            if (empty($this->_vars)) return false;
-            return $this->_vars;
-        }
-
-        /**
-         * FUNCTION: getVar
-         *
-         * Gets a single var from the global namespace
-         *
-         * @return var
-         * @access public
-         */
-        function getVar ($var) {
-            if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
-            if (empty($var) || !isset($this->_vars[$var])) return false;
-            return $this->_vars[$var];
-        }
-
-        /**
-         * FUNCTION: setContextVars
-         *
-         * sets the GLOBAL_CONTEXT_VARS
-         *
-         * @return true
-         * @access public
-         */
-        function setContextVars () {
-            $_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
-            $_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
-            $_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
-            $_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
-
-            // the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
-            $_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
-            $_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
-
-            $this->setvar('__SELF__', $_self);
-            $this->setvar('__REQUEST_URI__', $_uri);
-            return true;
-        }
-
-        /**
-         * FUNCTION: setLoop
-         *
-         * Builds the loop construct for use with <TMPL_LOOP>.
-         *
-         * @param string $k string to define loop name
-         * @param array $v array to assign to $k
-         * @return boolean true/false
-         * @access public
-         */
-        function setLoop ($k,$v) {
-            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);
-                }
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: setDbLoop [** EXPERIMENTAL **]
-         *
-         * Function to create a loop from a Db result resource link.
-         *
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @param string $result link to a Db result resource
-         * @param string $db_type, type of db that the result resource belongs to.
-         * @return boolean true/false
-         * @access public
-         */
-        function setDbLoop ($loopname, $result, $db_type='MYSQL') {
-		
-		/*
+
+		/**
+		 * FUNCTION: unsetVar
+		 *
+		 * Unsets a variable which has already been set
+		 * Parse in all vars wanted for deletion in seperate parametres
+		 *
+		 * @param string var name to remove use: vlibTemplate::unsetVar(var[, var..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		function unsetVar () {
+			$num_args = func_num_args();
+			if ($num_args < 1)  return false;
+
+			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;
+				unset($this->_vars[$var]);
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: getVars
+		 *
+		 * Gets all vars currently set in global namespace.
+		 *
+		 * @return array
+		 * @access public
+		 */
+		function getVars () {
+			if (empty($this->_vars)) return false;
+			return $this->_vars;
+		}
+
+
+		/**
+		 * FUNCTION: getVar
+		 *
+		 * Gets a single var from the global namespace
+		 *
+		 * @return var
+		 * @access public
+		 */
+		function getVar ($var) {
+			if ($this->OPTIONS['CASELESS']) $var = strtolower($var);
+			if (empty($var) || !isset($this->_vars[$var])) return false;
+			return $this->_vars[$var];
+		}
+
+
+		/**
+		 * FUNCTION: setContextVars
+		 *
+		 * sets the GLOBAL_CONTEXT_VARS
+		 *
+		 * @return true
+		 * @access public
+		 */
+		function setContextVars () {
+			$_phpself = @$GLOBALS['HTTP_SERVER_VARS']['PHP_SELF'];
+			$_pathinfo = @$GLOBALS['HTTP_SERVER_VARS']['PATH_INFO'];
+			$_request_uri = @$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
+			$_qs   = @$GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
+
+			// the following fixes bug of $PHP_SELF on Win32 CGI and IIS.
+			$_self = (!empty($_pathinfo)) ? $_pathinfo : $_phpself;
+			$_uri  = (!empty($_request_uri)) ? $_request_uri : $_self.'?'.$_qs;
+
+			$this->setvar('__SELF__', $_self);
+			$this->setvar('__REQUEST_URI__', $_uri);
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: setLoop
+		 *
+		 * Builds the loop construct for use with <TMPL_LOOP>.
+		 *
+		 * @param string $k string to define loop name
+		 * @param array $v array to assign to $k
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setLoop ($k, $v) {
+			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);
+				}
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: setDbLoop [** EXPERIMENTAL **]
+		 *
+		 * Function to create a loop from a Db result resource link.
+		 *
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @param string $result link to a Db result resource
+		 * @param string $db_type, type of db that the result resource belongs to.
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function setDbLoop ($loopname, $result, $db_type='MYSQL') {
+
+			/*
             $db_type = strtoupper($db_type);
             if (!in_array($db_type, $this->allowed_loop_dbs)) {
                 vlibTemplateError::raiseError('VT_WARNING_INVALID_LOOP_DB',WARNING, $db_type);
@@ -488,1022 +507,1053 @@ if (!defined('vlibTemplateClassLoaded')) {
             $this->setLoop($loopname, $loop_arr);
             return true;
 			*/
-        }
-
-        /**
-         * FUNCTION: newLoop
-         *
-         * Sets the name for the curent loop in the 3 step loop process.
-         *
-         * @param string $name string to define loop name
-         * @return boolean true/false
-         * @access public
-         */
-        function newLoop ($loopname) {
-            if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
-                $this->_currloopname[$loopname] = $loopname;
-                $this->_currloop[$loopname] = array();
-                return true;
-            }
-            else {
-                return false;
-            }
-        }
-
-        /**
-         * FUNCTION: addRow
-         *
-         * Adds a row to the current loop in the 3 step loop process.
-         *
-         * @param array $row loop row to add to current loop
-         * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
-         * @return boolean true/false
-         * @access public
-         */
-        function addRow ($row, $loopname=null) {
-            if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
-
-            if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
-                vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);
-                return false;
-            }
-            if (is_array($row)) {
-                $this->_currloop[$loopname][] = $row;
-                return true;
-            }
-            else {
-                return false;
-            }
-        }
-
-        /**
-         * FUNCTION: addLoop
-         *
-         * Completes the 3 step loop process. This assigns the rows and resets
-         * the variables used.
-         *
-         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
-         * @return boolean true/false
-         * @access public
-         */
-        function addLoop ($loopname=null) {
-            if ($loopname == null) { // add last loop used
-                if (!empty($this->_currloop)) {
-                    foreach ($this->_currloop as $k => $v) {
-                        $this->setLoop($k, $v);
-                        unset($this->_currloop[$k]);
-                    }
-                    $this->_currloopname = array();
-                    return true;
-                }
-                else {
-                    return false;
-                }
-            }
-            elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
-                    vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);
-                    return false;
-            }
-            else { // add a specific loop
-                $this->setLoop($loopname, $this->_currloop[$loopname]);
-                unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: unsetLoop
-         *
-         * Unsets a loop which has already been set.
-         * Can only unset top level loops.
-         *
-         * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
-         * @return boolean true/false returns true unless called with 0 params
-         * @access public
-         */
-        function unsetLoop () {
-            $num_args = func_num_args();
-            if ($num_args < 1) return false;
-
-            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;
-                unset($this->_arrvars[$var]);
-            }
-            return true;
-        }
-
-
-        /**
-         * FUNCTION: reset
-         *
-         * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
-         * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
-         *
-         * @return boolean true
-         * @access public
-         */
-        function reset () {
-            $this->clearVars();
-            $this->clearLoops();
-            $this->_tmplfilename = null;
-            $this->_tmplfile = null;
-            $this->_tmplfilep = null;
-            $this->_tmploutput = null;
-            $this->_parsed = false;
-            $this->_unknowns = array();
-            $this->_firstparsetime = null;
-            $this->_totalparsetime = null;
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
-
-        /**
-         * FUNCTION: clearVars
-         *
-         * Unsets all variables in the template
-         *
-         * @return boolean true
-         * @access public
-         */
-        function clearVars () {
-            $this->_vars = array();
-            return true;
-        }
-
-        /**
-         * FUNCTION: clearLoops
-         *
-         * Unsets all loops in the template
-         *
-         * @return boolean true
-         * @access public
-         */
-        function clearLoops () {
-            $this->_arrvars = array();
-            $this->_currloopname = null;
-            $this->_currloop = array();
-            return true;
-        }
-
-        /**
-         * FUNCTION: clearAll
-         *
-         * Unsets all variables and loops set using setVar/Loop()
-         *
-         * @return boolean true
-         * @access public
-         */
-        function clearAll () {
-            $this->clearVars();
-            $this->clearLoops();
-            return true;
-        }
-
-        /**
-         * FUNCTION: unknownsExist
-         *
-         * Returns true if unknowns were found after parsing.
-         * Function MUST be called AFTER one of the parsing functions to have any relevance.
-         *
-         * @return boolean true/false
-         * @access public
-         */
-        function unknownsExist () {
-            return (!empty($this->_unknowns));
-        }
-
-        /**
-         * FUNCTION: unknowns
-         *
-         * Alias for unknownsExist.
-         *
-         * @access public
-         */
-        function unknowns () {
-            return $this->unknownsExist();
-        }
-
-        /**
-         * FUNCTION: getUnknowns
-         *
-         * Returns an array of all unknown vars found when parsing.
-         * This function is only relevant after parsing a document.
-         *
-         * @return array
-         * @access public
-         */
-        function getUnknowns () {
-            return $this->_unknowns;
-        }
-
-        /**
-         * FUNCTION: setUnknowns
-         *
-         * Sets how you want to handle variables that were found in the
-         * template but not set in vlibTemplate using vlibTemplate::setVar().
-         *
-         * @param  string $arg ignore, remove, print, leave or comment
-         * @return boolean
-         * @access public
-         */
-        function setUnknowns ($arg) {
-            $arg = strtolower(trim($arg));
-            if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
-                $this->OPTIONS['UNKNOWNS'] = $arg;
-                return true;
-            }
-            return false;
-        }
-
-        /**
-         * FUNCTION: setPath
-         *
-         * function sets the paths to use when including files.
-         * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
-         * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
-         * with as many paths as you like.
-         * if this function is called without any arguments, it will just delete any previously set paths.
-         *
-         * @param string path (mulitple)
-         * @return bool success
-         * @access public
-         */
-        function setPath () {
-            $num_args = func_num_args();
-            if ($num_args < 1) {
-                $this->OPTIONS['INCLUDE_PATHS'] = array();
-                return true;
-            }
-            for ($i = 0; $i < $num_args; $i++) {
-                $thispath = func_get_arg($i);
-                array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: getParseTime
-         *
-         * After using one of the parse functions, this will allow you
-         * access the time taken to parse the template.
-         * see OPTION 'TIME_PARSE'.
-         *
-         * @return float time taken to parse template
-         * @access public
-         */
-        function getParseTime () {
-            if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
-                return $this->_totalparsetime;
-            }
-            return false;
-        }
-
-
-        /**
-         * FUNCTION: fastPrint
-         *
-         * Identical to pparse() except that it uses output buffering w/ gz compression thus
-         * printing the output directly and compressed if poss.
-         * Will possibly if parsing a huge template.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        function fastPrint () {
-            $ret = $this->_parse('ob_gzhandler');
-            print($this->_tmploutput);
-            return $ret;
-        }
-
-
-        /**
-         * FUNCTION: pparse
-         *
-         * Calls parse, and then prints out $this->_tmploutput
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        function pparse () {
-            if (!$this->_parsed) $this->_parse();
-            print($this->_tmploutput);
-            return true;
-        }
-
-        /**
-         * FUNCTION: pprint
-         *
-         * Alias for pparse()
-         *
-         * @access public
-         */
-        function pprint () {
-            return $this->pparse();
-        }
-
-
-        /**
-         * FUNCTION: grab
-         *
-         * Returns the parsed output, ready for printing, passing to mail() ...etc.
-         * Invokes $this->_parse() if template has not yet been parsed.
-         *
-         * @access public
-         * @return boolean true/false
-         */
-        function grab () {
-            if (!$this->_parsed) $this->_parse();
-            return $this->_tmploutput;
-        }
-
-    /*-----------------------------------------------------------------------------\
+		}
+
+
+		/**
+		 * FUNCTION: newLoop
+		 *
+		 * Sets the name for the curent loop in the 3 step loop process.
+		 *
+		 * @param string $name string to define loop name
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function newLoop ($loopname) {
+			if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {
+				$this->_currloopname[$loopname] = $loopname;
+				$this->_currloop[$loopname] = array();
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+
+
+		/**
+		 * FUNCTION: addRow
+		 *
+		 * Adds a row to the current loop in the 3 step loop process.
+		 *
+		 * @param array $row loop row to add to current loop
+		 * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function addRow ($row, $loopname=null) {
+			if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];
+
+			if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			}
+			if (is_array($row)) {
+				$this->_currloop[$loopname][] = $row;
+				return true;
+			}
+			else {
+				return false;
+			}
+		}
+
+
+		/**
+		 * FUNCTION: addLoop
+		 *
+		 * Completes the 3 step loop process. This assigns the rows and resets
+		 * the variables used.
+		 *
+		 * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function addLoop ($loopname=null) {
+			if ($loopname == null) { // add last loop used
+				if (!empty($this->_currloop)) {
+					foreach ($this->_currloop as $k => $v) {
+						$this->setLoop($k, $v);
+						unset($this->_currloop[$k]);
+					}
+					$this->_currloopname = array();
+					return true;
+				}
+				else {
+					return false;
+				}
+			}
+			elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked
+				vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET', WARNING);
+				return false;
+			}
+			else { // add a specific loop
+				$this->setLoop($loopname, $this->_currloop[$loopname]);
+				unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: unsetLoop
+		 *
+		 * Unsets a loop which has already been set.
+		 * Can only unset top level loops.
+		 *
+		 * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])
+		 * @return boolean true/false returns true unless called with 0 params
+		 * @access public
+		 */
+		function unsetLoop () {
+			$num_args = func_num_args();
+			if ($num_args < 1) return false;
+
+			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;
+				unset($this->_arrvars[$var]);
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: reset
+		 *
+		 * Resets the vlibTemplate object. After using vlibTemplate::reset() you must
+		 * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function reset() {
+			$this->clearVars();
+			$this->clearLoops();
+			$this->_tmplfilename = null;
+			$this->_tmplfile = null;
+			$this->_tmplfilep = null;
+			$this->_tmploutput = null;
+			$this->_parsed = false;
+			$this->_unknowns = array();
+			$this->_firstparsetime = null;
+			$this->_totalparsetime = null;
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: clearVars
+		 *
+		 * Unsets all variables in the template
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function clearVars () {
+			$this->_vars = array();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: clearLoops
+		 *
+		 * Unsets all loops in the template
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function clearLoops () {
+			$this->_arrvars = array();
+			$this->_currloopname = null;
+			$this->_currloop = array();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: clearAll
+		 *
+		 * Unsets all variables and loops set using setVar/Loop()
+		 *
+		 * @return boolean true
+		 * @access public
+		 */
+		function clearAll () {
+			$this->clearVars();
+			$this->clearLoops();
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: unknownsExist
+		 *
+		 * Returns true if unknowns were found after parsing.
+		 * Function MUST be called AFTER one of the parsing functions to have any relevance.
+		 *
+		 * @return boolean true/false
+		 * @access public
+		 */
+		function unknownsExist () {
+			return !empty($this->_unknowns);
+		}
+
+
+		/**
+		 * FUNCTION: unknowns
+		 *
+		 * Alias for unknownsExist.
+		 *
+		 * @access public
+		 */
+		function unknowns () {
+			return $this->unknownsExist();
+		}
+
+
+		/**
+		 * FUNCTION: getUnknowns
+		 *
+		 * Returns an array of all unknown vars found when parsing.
+		 * This function is only relevant after parsing a document.
+		 *
+		 * @return array
+		 * @access public
+		 */
+		function getUnknowns () {
+			return $this->_unknowns;
+		}
+
+
+		/**
+		 * FUNCTION: setUnknowns
+		 *
+		 * Sets how you want to handle variables that were found in the
+		 * template but not set in vlibTemplate using vlibTemplate::setVar().
+		 *
+		 * @param  string $arg ignore, remove, print, leave or comment
+		 * @return boolean
+		 * @access public
+		 */
+		function setUnknowns ($arg) {
+			$arg = strtolower(trim($arg));
+			if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {
+				$this->OPTIONS['UNKNOWNS'] = $arg;
+				return true;
+			}
+			return false;
+		}
+
+
+		/**
+		 * FUNCTION: setPath
+		 *
+		 * function sets the paths to use when including files.
+		 * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);
+		 * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');
+		 * with as many paths as you like.
+		 * if this function is called without any arguments, it will just delete any previously set paths.
+		 *
+		 * @param string path (mulitple)
+		 * @return bool success
+		 * @access public
+		 */
+		function setPath () {
+			$num_args = func_num_args();
+			if ($num_args < 1) {
+				$this->OPTIONS['INCLUDE_PATHS'] = array();
+				return true;
+			}
+			for ($i = 0; $i < $num_args; $i++) {
+				$thispath = func_get_arg($i);
+				array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: getParseTime
+		 *
+		 * After using one of the parse functions, this will allow you
+		 * access the time taken to parse the template.
+		 * see OPTION 'TIME_PARSE'.
+		 *
+		 * @return float time taken to parse template
+		 * @access public
+		 */
+		function getParseTime () {
+			if ($this->OPTIONS['TIME_PARSE'] && $this->_parsed) {
+				return $this->_totalparsetime;
+			}
+			return false;
+		}
+
+
+		/**
+		 * FUNCTION: fastPrint
+		 *
+		 * Identical to pparse() except that it uses output buffering w/ gz compression thus
+		 * printing the output directly and compressed if poss.
+		 * Will possibly if parsing a huge template.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		function fastPrint () {
+			$ret = $this->_parse('ob_gzhandler');
+			print($this->_tmploutput);
+			return $ret;
+		}
+
+
+		/**
+		 * FUNCTION: pparse
+		 *
+		 * Calls parse, and then prints out $this->_tmploutput
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		function pparse () {
+			if (!$this->_parsed) $this->_parse();
+			print($this->_tmploutput);
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: pprint
+		 *
+		 * Alias for pparse()
+		 *
+		 * @access public
+		 */
+		function pprint () {
+			return $this->pparse();
+		}
+
+
+		/**
+		 * FUNCTION: grab
+		 *
+		 * Returns the parsed output, ready for printing, passing to mail() ...etc.
+		 * Invokes $this->_parse() if template has not yet been parsed.
+		 *
+		 * @access public
+		 * @return boolean true/false
+		 */
+		function grab () {
+			if (!$this->_parsed) $this->_parse();
+			return $this->_tmploutput;
+		}
+
+		/*-----------------------------------------------------------------------------\
     |                           private functions                                  |
     \-----------------------------------------------------------------------------*/
 
-        /**
-         * FUNCTION: vlibTemplate
-         *
-         * vlibTemplate constructor.
-         * if $tmplfile has been passed to it, it will send to $this->newTemplate()
-         *
-         * @param string $tmplfile full path to template file
-         * @param array $options see above
-         * @return boolean true/false
-         * @access private
-         */
-        function tpl ($tmplfile=null, $options=null) {
-            if (is_array($tmplfile) && $options == null) {
-                $options = $tmplfile;
-                unset($tmplfile);
-            }
 
-            $this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
+		/**
+		 * FUNCTION: vlibTemplate
+		 *
+		 * vlibTemplate constructor.
+		 * if $tmplfile has been passed to it, it will send to $this->newTemplate()
+		 *
+		 * @param string $tmplfile full path to template file
+		 * @param array $options see above
+		 * @return boolean true/false
+		 * @access private
+		 */
+		function tpl ($tmplfile=null, $options=null) {
+			if (is_array($tmplfile) && $options == null) {
+				$options = $tmplfile;
+				unset($tmplfile);
+			}
 
-            if (is_array(vlibIni::vlibTemplate())) {
-                foreach (vlibIni::vlibTemplate() as $name => $val) {
-                    $this->OPTIONS[$name] = $val;
-                }
-            }
+			$this->VLIBTEMPLATE_ROOT = dirname(realpath(__FILE__));
 
-            if (is_array($options)) {
-                foreach($options as $key => $val) {
-                    $key = strtoupper($key);
-                    if ($key == 'PATH') {
-                        $this->setPath($val);
-                    }
-                    else {
-                        $this->_setOption($key, strtolower($val));
-                    }
-                }
-            }
-            if($tmplfile) $this->newTemplate($tmplfile);
-            if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
-            return true;
-        }
-
-        /** FUNCTION: _getData
-         *
-         * function returns the text from the file, or if we're using cache, the text
-         * from the cache file. MUST RETURN DATA.
-         * @param string tmplfile contains path to template file
-         * @param do_eval used for included files. If set then this function must do the eval()'ing.
-         * @access private
-         * @return mixed data/string or boolean
-         */
-        function _getData ($tmplfile, $do_eval=false) {
-            //check the current file depth
-            if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
-                return;
-            }
-            else {
-                if ($this->_debug) array_push ($this->_debugIncludedfiles, $tmplfile);
-                if ($do_eval) {
-                    array_push($this->_currentincludedir, dirname($tmplfile));
-                    $this->_includedepth++;
-                }
-            }
+			if (is_array(vlibIni::vlibTemplate())) {
+				foreach (vlibIni::vlibTemplate() as $name => $val) {
+					$this->OPTIONS[$name] = $val;
+				}
+			}
 
+			if (is_array($options)) {
+				foreach($options as $key => $val) {
+					$key = strtoupper($key);
+					if ($key == 'PATH') {
+						$this->setPath($val);
+					}
+					else {
+						$this->_setOption($key, strtolower($val));
+					}
+				}
+			}
+			if($tmplfile) $this->newTemplate($tmplfile);
+			if ($this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setContextVars();
+			return true;
+		}
 
-            if($this->_cache && $this->_checkCache($tmplfile)) { // cache exists so lets use it
-                $data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
-                fclose($fp);
-            }
-            else { // no cache lets parse the file
-                $data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
-                fclose($fp);
-
-                $regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
-                $regex.= 'tmpl_([\w]+)\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value|file)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')?';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:';
-                $regex.=    '(?:';
-                $regex.=        '(name|format|escape|op|value)';
-                $regex.=        '\s*=\s*';
-                $regex.=    ')';
-                $regex.=    '(?:[\"\'])?';
-                $regex.=    '((?<=[\"\'])';
-                $regex.=    '[^\"\']*|[a-z0-9_\.]*)';
-                $regex.=    '[\"\']?';
-                $regex.= ')?\s*';
-                $regex.= '(?:>|\/>|}|-->){1}';
+
+		/** FUNCTION: _getData
+		 *
+		 * function returns the text from the file, or if we're using cache, the text
+		 * from the cache file. MUST RETURN DATA.
+		 * @param string tmplfile contains path to template file
+		 * @param do_eval used for included files. If set then this function must do the eval()'ing.
+		 * @access private
+		 * @return mixed data/string or boolean
+		 */
+		function _getData ($tmplfile, $do_eval=false) {
+			//check the current file depth
+			if ($this->_includedepth > $this->OPTIONS['MAX_INCLUDES'] || $tmplfile == false) {
+				return;
+			}
+			else {
+				if ($this->_debug) array_push($this->_debugIncludedfiles, $tmplfile);
+				if ($do_eval) {
+					array_push($this->_currentincludedir, dirname($tmplfile));
+					$this->_includedepth++;
+				}
+			}
+
+
+			if($this->_cache && $this->_checkCache($tmplfile)) { // cache exists so lets use it
+				$data = fread($fp = fopen($this->_cachefile, 'r'), filesize($this->_cachefile));
+				fclose($fp);
+			}
+			else { // no cache lets parse the file
+				$data = fread($fp = fopen($tmplfile, 'r'), filesize($tmplfile));
+				fclose($fp);
+
+				$regex = '/(<|<\/|{|{\/|<!--|<!--\/){1}\s*';
+				$regex.= 'tmpl_([\w]+)\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value|file)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')?';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:';
+				$regex.=    '(?:';
+				$regex.=        '(name|format|escape|op|value)';
+				$regex.=        '\s*=\s*';
+				$regex.=    ')';
+				$regex.=    '(?:[\"\'])?';
+				$regex.=    '((?<=[\"\'])';
+				$regex.=    '[^\"\']*|[a-z0-9_\.]*)';
+				$regex.=    '[\"\']?';
+				$regex.= ')?\s*';
+				$regex.= '(?:>|\/>|}|-->){1}';
 				$regex.= '/i';
-                //$regex.= '([\r\n|\n|\r])?/ie';
-                $data = preg_replace_callback($regex, array($this, '_parseTag'), $data);
+				//$regex.= '([\r\n|\n|\r])?/ie';
+				$data = preg_replace_callback($regex, array($this, '_parseTag'), $data);
 
-                if ($this->_cache) { // add cache if need be
-                    $this->_createCache($data);
-                }
-            }
+				if ($this->_cache) { // add cache if need be
+					$this->_createCache($data);
+				}
+			}
 
-            // now we must parse the $data and check for any <tmpl_include>'s
-            if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
+			// now we must parse the $data and check for any <tmpl_include>'s
+			if ($this->_debug) $this->doDebugWarnings(file($tmplfile), $tmplfile);
 
-            if ($do_eval) {
-                $success = @eval('?>'.$data.'<?php return 1;');
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
-                return $success;
-            }
-            else {
-                return $data;
-            }
+			if ($do_eval) {
+				$success = @eval('?>'.$data.'<?php return 1;');
+				$this->_includedepth--;
+				array_pop($this->_currentincludedir);
+				return $success;
+			}
+			else {
+				return $data;
+			}
+
+		}
 
-        }
-
-        /**
-         * FUNCTION: _fileSearch
-         *
-         * Searches for all possible instances of file { $file }
-         *
-         * @param string $file path of file we're looking for
-         * @access private
-         * @return mixed fullpath to file or boolean false
-         */
-        function _fileSearch ($file) {
-            $filename = basename($file);
-            $filepath = dirname($file);
-
-            // check fullpath first..
-            $fullpath = $filepath.'/'.$filename;
-            if (is_file($fullpath)) {
+
+		/**
+		 * FUNCTION: _fileSearch
+		 *
+		 * Searches for all possible instances of file { $file }
+		 *
+		 * @param string $file path of file we're looking for
+		 * @access private
+		 * @return mixed fullpath to file or boolean false
+		 */
+		function _fileSearch ($file) {
+			$filename = basename($file);
+			$filepath = dirname($file);
+
+			// check fullpath first..
+			$fullpath = $filepath.'/'.$filename;
+			if (is_file($fullpath)) {
 				return $fullpath;
 			}
 
-            // ..then check for relative path for current directory..
-            if (!empty($this->_currentincludedir)) {
-                $currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
-                $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                if (is_file($relativepath)) {
-                    array_push ($this->_currentincludedir, dirname($relativepath));
-                    return $relativepath;
-                }
-            }
+			// ..then check for relative path for current directory..
+			if (!empty($this->_currentincludedir)) {
+				$currdir = $this->_currentincludedir[(count($this->_currentincludedir) -1)];
+				$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+				if (is_file($relativepath)) {
+					array_push($this->_currentincludedir, dirname($relativepath));
+					return $relativepath;
+				}
+			}
 
-            // ..then check for relative path for all additional given paths..
-            if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
-                foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
-                    $relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
-                    if (is_file($relativepath)) {
-                        return $relativepath;
-                    }
-                }
-            }
+			// ..then check for relative path for all additional given paths..
+			if (!empty($this->OPTIONS['INCLUDE_PATHS'])) {
+				foreach ($this->OPTIONS['INCLUDE_PATHS'] as $currdir) {
+					$relativepath = realpath($currdir.'/'.$filepath.'/'.$filename);
+					if (is_file($relativepath)) {
+						return $relativepath;
+					}
+				}
+			}
 
-            // ..then check path from TEMPLATE_DIR..
-            if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
-                $fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) {
+			// ..then check path from TEMPLATE_DIR..
+			if (!empty($this->OPTIONS['TEMPLATE_DIR'])) {
+				$fullpath = realpath($this->OPTIONS['TEMPLATE_DIR'].'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) {
 					return $fullpath;
 				}
-            }
+			}
 
-            // ..then check relative path from executing php script..
-            $fullpath = realpath($filepath.'/'.$filename);
-            if (is_file($fullpath)) {
+			// ..then check relative path from executing php script..
+			$fullpath = realpath($filepath.'/'.$filename);
+			if (is_file($fullpath)) {
 				return $fullpath;
 			}
 
-            // ..then check path from template file.
-            if (!empty($this->VLIBTEMPLATE_ROOT)) {
-                $fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
-                if (is_file($fullpath)) {
+			// ..then check path from template file.
+			if (!empty($this->VLIBTEMPLATE_ROOT)) {
+				$fullpath = realpath($this->VLIBTEMPLATE_ROOT.'/'.$filepath.'/'.$filename);
+				if (is_file($fullpath)) {
 					return $fullpath;
 				}
-            }
+			}
 
-            return false; // uh oh, file not found
-        }
-
-        /**
-         * FUNCTION: _arrayBuild
-         *
-         * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
-         * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
-         * Used by $this->setloop().
-         *
-         * @param array $arr
-         * @return array new look array
-         * @access private
-         */
-        function _arrayBuild ($arr) {
-            if (is_array($arr) && !empty($arr)) {
-                $arr = array_values($arr); // to prevent problems w/ non sequential arrays
-                for ($i = 0; $i < count($arr); $i++) {
-                    if(!is_array($arr[$i]))  return false;
-                    foreach ($arr[$i] as $k => $v) {
-                        unset($arr[$i][$k]);
-                        if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
-                        if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
-
-                        if (is_array($v)) {
-                            if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
-                        }
-                        else { // reinsert the var
-                            $arr[$i][$k] = $v;
-                        }
-                    }
-                    if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
-                        if ($i == 0) $arr[$i]['__FIRST__'] = true;
-                        if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
-                        if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
-                        if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
-                        if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
-                        $arr[$i]['__ROWNUM__'] = ($i + 1);
-                    }
-                }
-                return $arr;
-            }
-            elseif (empty($arr)) {
-                return true;
-            }
-        }
-
-        /**
-         * FUNCTION: _parseIf
-         * returns a string used for parsing in tmpl_if statements.
-         *
-         * @param string $varname
-         * @param string $value
-         * @param string $op
-         * @param string $namespace current namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
-            if (isset($namespace)) $namespace = substr($namespace, 0, -1);
-            $comp_str = ''; // used for extended if statements
-
-            // work out what to put on the end id value="whatever" is used
-            if (isset($value)) {
-
-                // add the correct operator depending on whether it's been specified or not
-                if (!empty($op)) {
-                    if (in_array($op, $this->allowed_if_ops)) {
-                        $comp_str .= $op;
-                    }
-                    else {
-                        vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
-                    }
-                }
-                else {
-                    $comp_str .= '==';
-                }
-
-                // now we add the value, if it's numeric, then we leave the quotes off
-                if (is_numeric($value)) {
-                    $comp_str .= $value;
-                }
-                else {
-                    $comp_str .= '\''.$value.'\'';
-                }
-            }
+			return false; // uh oh, file not found
+		}
 
-            if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
-            $retstr = '$this->_arrvars';
-            $numnamespaces = count($this->_namespace);
-            for ($i=0; $i < $numnamespaces; $i++) {
-                if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                    $retstr .= "['".$namespace."'][\$_".$i."]";
-                    break 1;
-                }
-                else {
-                    $retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                }
-            }
-            if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
-            }
-            else {
-                return $retstr."['".$varname."']".$comp_str;
-            }
-        }
-
-
-        /**
-         * FUNCTION: _parseLoop
-         * returns a string used for parsing in tmpl_loop statements.
-         *
-         * @param string $varname
-         * @access private
-         * @return string used for eval'ing
-         */
-        function _parseLoop ($varname) {
-            array_push($this->_namespace, $varname);
-            $tempvar = count($this->_namespace) - 1;
-            $retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
-            for ($i=0; $i < count($this->_namespace); $i++) {
-                $retstr .= "['".$this->_namespace[$i]."']";
-                if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
-            }
-            return $retstr."); \$_".$tempvar."++) {";
-        }
-
-        /**
-         * FUNCTION: _parseVar
-         *
-         * returns a string used for parsing in tmpl_var statements.
-         *
-         * @param string $wholetag
-         * @param string $tag
-         * @param string $varname
-         * @param string $escape
-         * @param string $format
-         * @param string $namespace
-         * @access private
-         * @return string used for eval'ing
-         */
-        function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace) {
-            if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
-            $wholetag = stripslashes($wholetag);
-
-            if (count($this->_namespace) == 0 || $namespace == 'global') {
-                $var1 = '$this->_vars[\''.$varname.'\']';
-            }
-            else {
-                $var1build = "\$this->_arrvars";
-                $numnamespaces = count($this->_namespace);
-                for ($i=0; $i < $numnamespaces; $i++) {
-                    if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
-                        $var1build .= "['".$namespace."'][\$_".$i."]";
-                        break 1;
-                    }
-                    else {
-                        $var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
-                    }
-                }
-                $var1 = $var1build . "['$varname']";
-                if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
-                    $var2 = '$this->_vars[\''.$varname.'\']';
-                }
-            }
 
-            $beforevar = '';
-            $aftervar  = '';
-            if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
-                $beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
-                $aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
-            }
+		/**
+		 * FUNCTION: _arrayBuild
+		 *
+		 * Modifies the array $arr to add Template variables, __FIRST__, __LAST__ ..etc
+		 * if $this->OPTIONS['LOOP_CONTEXT_VARS'] is true.
+		 * Used by $this->setloop().
+		 *
+		 * @param array $arr
+		 * @return array new look array
+		 * @access private
+		 */
+		function _arrayBuild ($arr) {
+			if (is_array($arr) && !empty($arr)) {
+				$arr = array_values($arr); // to prevent problems w/ non sequential arrays
+				for ($i = 0; $i < count($arr); $i++) {
+					if(!is_array($arr[$i]))  return false;
+					foreach ($arr[$i] as $k => $v) {
+						unset($arr[$i][$k]);
+						if ($this->OPTIONS['CASELESS']) $k = strtolower($k);
+						if (preg_match('/^[0-9]+$/', $k)) $k = '_'.$k;
+
+						if (is_array($v)) {
+							if (($arr[$i][$k] = $this->_arrayBuild($v)) == false) return false;
+						}
+						else { // reinsert the var
+							$arr[$i][$k] = $v;
+						}
+					}
+					if ($this->OPTIONS['LOOP_CONTEXT_VARS']) {
+						if ($i == 0) $arr[$i]['__FIRST__'] = true;
+						if (($i + 1) == count($arr)) $arr[$i]['__LAST__'] = true;
+						if ($i != 0 && (($i + 1) < count($arr))) $arr[$i]['__INNER__'] = true;
+						if (is_int(($i+1) / 2))  $arr[$i]['__EVEN__'] = true;
+						if (!is_int(($i+1) / 2))  $arr[$i]['__ODD__'] = true;
+						$arr[$i]['__ROWNUM__'] = ($i + 1);
+					}
+				}
+				return $arr;
+			}
+			elseif (empty($arr)) {
+				return true;
+			}
+		}
 
-            if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
-                $beforevar .= $this->FORMAT_TAGS[$format]['open'];
-                $aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
-            }
 
-            // build return values
-            $retstr  = 'if ('.$var1.' !== null) { ';
-            $retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
-            $retstr .= '}';
+		/**
+		 * FUNCTION: _parseIf
+		 * returns a string used for parsing in tmpl_if statements.
+		 *
+		 * @param string $varname
+		 * @param string $value
+		 * @param string $op
+		 * @param string $namespace current namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		function _parseIf ($varname, $value=null, $op=null, $namespace=null) {
+			if (isset($namespace)) $namespace = substr($namespace, 0, -1);
+			$comp_str = ''; // used for extended if statements
+
+			// work out what to put on the end id value="whatever" is used
+			if (isset($value)) {
+
+				// add the correct operator depending on whether it's been specified or not
+				if (!empty($op)) {
+					if (in_array($op, $this->allowed_if_ops)) {
+						$comp_str .= $op;
+					}
+					else {
+						vlibTemplateError::raiseError('VT_WARNING_INVALID_IF_OP', WARNING, $op);
+					}
+				}
+				else {
+					$comp_str .= '==';
+				}
 
-            if (@$var2) {
-                $retstr .= ' elseif ('.$var2.' !== null) { ';
-                $retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
-                $retstr .= '}';
-            }
+				// now we add the value, if it's numeric, then we leave the quotes off
+				if (is_numeric($value)) {
+					$comp_str .= $value;
+				}
+				else {
+					$comp_str .= '\''.$value.'\'';
+				}
+			}
 
-            switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
-                case 'comment':
-                    $comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
-                    $retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
-                case 'leave':
-                    $retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
-                case 'print':
-                    $retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
+			if (count($this->_namespace) == 0 || $namespace == 'global') return '$this->_vars[\''.$varname.'\']'.$comp_str;
+			$retstr = '$this->_arrvars';
+			$numnamespaces = count($this->_namespace);
+			for ($i=0; $i < $numnamespaces; $i++) {
+				if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+					$retstr .= "['".$namespace."'][\$_".$i."]";
+					break 1;
+				}
+				else {
+					$retstr .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+				}
+			}
+			if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+				return '(('.$retstr.'[\''.$varname.'\'] !== null) ? '.$retstr.'[\''.$varname.'\'] : $this->_vars[\''.$varname.'\'])'.$comp_str;
+			}
+			else {
+				return $retstr."['".$varname."']".$comp_str;
+			}
+		}
 
-                case 'ignore':
-                    return $retstr;
-                break;
-                case 'remove':
-                default:
-                    $retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
-                    return $retstr;
-                break;
-            }
-        }
-
-        /**
-         * FUNCTION: _parseTag
-         * takes values from preg_replace in $this->_intparse() and determines
-         * the replace string.
-         *
-         * @param array $args array of all matches found by preg_replace
-         * @access private
-         * @return string replace values
-         */
-        function _parseTag ($args) {
-            $wholetag = $args[0];
-            $openclose = $args[1];
-            $tag = strtolower($args[2]);
-            $newline = $args[9];
+
+		/**
+		 * FUNCTION: _parseLoop
+		 * returns a string used for parsing in tmpl_loop statements.
+		 *
+		 * @param string $varname
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		function _parseLoop ($varname) {
+			array_push($this->_namespace, $varname);
+			$tempvar = count($this->_namespace) - 1;
+			$retstr = "for (\$_".$tempvar."=0 ; \$_".$tempvar." < count(\$this->_arrvars";
+			for ($i=0; $i < count($this->_namespace); $i++) {
+				$retstr .= "['".$this->_namespace[$i]."']";
+				if ($this->_namespace[$i] != $varname) $retstr .= "[\$_".$i."]";
+			}
+			return $retstr."); \$_".$tempvar."++) {";
+		}
+
+
+		/**
+		 * FUNCTION: _parseVar
+		 *
+		 * returns a string used for parsing in tmpl_var statements.
+		 *
+		 * @param string $wholetag
+		 * @param string $tag
+		 * @param string $varname
+		 * @param string $escape
+		 * @param string $format
+		 * @param string $namespace
+		 * @access private
+		 * @return string used for eval'ing
+		 */
+		function _parseVar ($wholetag, $tag, $varname, $escape, $format, $namespace) {
+			if (!empty($namespace)) $namespace = substr($namespace, 0, -1);
+			$wholetag = stripslashes($wholetag);
+
+			if (count($this->_namespace) == 0 || $namespace == 'global') {
+				$var1 = '$this->_vars[\''.$varname.'\']';
+			}
+			else {
+				$var1build = "\$this->_arrvars";
+				$numnamespaces = count($this->_namespace);
+				for ($i=0; $i < $numnamespaces; $i++) {
+					if ($this->_namespace[$i] == $namespace || (($i + 1) == $numnamespaces && !empty($namespace))) {
+						$var1build .= "['".$namespace."'][\$_".$i."]";
+						break 1;
+					}
+					else {
+						$var1build .= "['".$this->_namespace[$i]."'][\$_".$i."]";
+					}
+				}
+				$var1 = $var1build . "['$varname']";
+				if ($this->OPTIONS['GLOBAL_VARS'] && empty($namespace)) {
+					$var2 = '$this->_vars[\''.$varname.'\']';
+				}
+			}
+
+			$beforevar = '';
+			$aftervar  = '';
+			if (!empty($escape)&& isset($this->ESCAPE_TAGS[$escape])) {
+				$beforevar .= $this->ESCAPE_TAGS[$escape]['open'];
+				$aftervar   = $this->ESCAPE_TAGS[$escape]['close'] . $aftervar;
+			}
+
+			if (!empty($format)&& isset($this->FORMAT_TAGS[$format])) {
+				$beforevar .= $this->FORMAT_TAGS[$format]['open'];
+				$aftervar   = $this->FORMAT_TAGS[$format]['close'] . $aftervar;
+			}
+
+			// build return values
+			$retstr  = 'if ('.$var1.' !== null) { ';
+			$retstr .= 'print('.$beforevar.$var1.$aftervar.'); ';
+			$retstr .= '}';
+
+			if (@$var2) {
+				$retstr .= ' elseif ('.$var2.' !== null) { ';
+				$retstr .= 'print('.$beforevar.$var2.$aftervar.'); ';
+				$retstr .= '}';
+			}
+
+			switch (strtolower($this->OPTIONS['UNKNOWNS'])) {
+			case 'comment':
+				$comment = addcslashes('<!-- unknown variable '.preg_replace('/<!--|-->/', '', $wholetag).'//-->', '"');
+				$retstr .= ' else { print("'.$comment.'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+			case 'leave':
+				$retstr .= ' else { print("'.addcslashes($wholetag, '"').'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+			case 'print':
+				$retstr .= ' else { print("'.htmlspecialchars($wholetag, ENT_QUOTES).'"); $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+
+			case 'ignore':
+				return $retstr;
+				break;
+			case 'remove':
+			default:
+				$retstr .= ' else { $this->_setUnknown("'.$varname.'"); }';
+				return $retstr;
+				break;
+			}
+		}
+
+
+		/**
+		 * FUNCTION: _parseTag
+		 * takes values from preg_replace in $this->_intparse() and determines
+		 * the replace string.
+		 *
+		 * @param array $args array of all matches found by preg_replace
+		 * @access private
+		 * @return string replace values
+		 */
+		function _parseTag ($args) {
+			$wholetag = $args[0];
+			$openclose = $args[1];
+			$tag = strtolower($args[2]);
+			$newline = $args[9];
 			//echo "1#$newline#2";
 
-            if ($tag == 'else') return '<?php } else { ?>'.$newline;
-            if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
-
-            if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
-                if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
-                if ($tag == 'comment' || $tag == 'endcomment') {
-                    return '<?php */ ?>'.$newline;
-                }
-                else {
-                    return '<?php } ?>'.$newline;
-                }
-            }
+			if ($tag == 'else') return '<?php } else { ?>'.$newline;
+			if ($tag == 'tmpl_include') return $wholetag; // ignore tmpl_include tags
 
-            // arrange attributes
-            for ($i=3; $i < 8; $i=($i+2)) {
-                if (empty($args[$i]) && empty($args[($i+1)])) break;
-                $key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
-                if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
-                $$key = $args[($i+1)];
-            }
+			if (preg_match("/^<\/|{\/|<!--\/$/s", $openclose) || preg_match("/^end[if|loop|unless|comment]$/", $tag)) {
+				if ($tag == 'loop' || $tag == 'endloop') array_pop($this->_namespace);
+				if ($tag == 'comment' || $tag == 'endcomment') {
+					return '<?php */ ?>'.$newline;
+				}
+				else {
+					return '<?php } ?>'.$newline;
+				}
+			}
 
-            $var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
+			// arrange attributes
+			for ($i=3; $i < 8; $i=($i+2)) {
+				if (empty($args[$i]) && empty($args[($i+1)])) break;
+				$key = (empty($args[$i])) ? 'name' : strtolower($args[$i]);
+				if ($key == 'name' && preg_match('/^(php)?include$/', $tag)) $key = 'file';
+				$$key = $args[($i+1)];
+			}
 
-            if ($this->_debug && !empty($var)) {
-                if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
-                if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
-                if (!isset($var2)) $var2 = $var;
-                if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
-            }
+			$var = ($this->OPTIONS['CASELESS']) ? strtolower($name) : $name;
 
-            if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
-                $var = $matches[3];
-                $namespace = $matches[1];
-            }
+			if ($this->_debug && !empty($var)) {
+				if (preg_match("/^global\.([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) $var2 = $matches[1];
+				if (empty($this->_debugTemplatevars[$tag])) $this->_debugTemplatevars[$tag] = array();
+				if (!isset($var2)) $var2 = $var;
+				if (!in_array($var2, $this->_debugTemplatevars[$tag])) array_push($this->_debugTemplatevars[$tag], $var2);
+			}
 
+			if (preg_match("/^([A-Za-z_]+[_A-Za-z0-9]*(\.)+)?([A-Za-z_]+[_A-Za-z0-9]*)$/", $var, $matches)) {
+				$var = $matches[3];
+				$namespace = $matches[1];
+			}
 
-            // return correct string (tag dependent)
-            switch ($tag) {
-                case 'var':
-                    if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
-                        $escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
-                    }
-                    return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'.$newline."\n";
-                break;
 
-                case 'if':
-                    return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
-                break;
+			// return correct string (tag dependent)
+			switch ($tag) {
+			case 'var':
+				if (empty($escape) && (!empty($this->OPTIONS['DEFAULT_ESCAPE']) && strtolower($this->OPTIONS['DEFAULT_ESCAPE']) != 'none')) {
+					$escape = strtolower($this->OPTIONS['DEFAULT_ESCAPE']);
+				}
+				return '<?php '.$this->_parseVar ($wholetag, $tag, $var, @$escape, @$format, @$namespace).' ?>'.$newline."\n";
+				break;
 
-                case 'unless':
-                      return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
-                break;
+			case 'if':
+				return '<?php if ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+				break;
 
-                case 'elseif':
-                      return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
-                break;
+			case 'unless':
+				return '<?php if (!'. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+				break;
 
-                case 'loop':
-                      return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
-                break;
+			case 'elseif':
+				return '<?php } elseif ('. $this->_parseIf($var, @$value, @$op, @$namespace) .') { ?>'.$newline;
+				break;
 
-                case 'comment':
-                    if (empty($var)) { // full open/close style comment
-                        return '<?php /* ?>'.$newline;
-                    }
-                    else { // just ignore tag if it was a one line comment
-                        return;
-                    }
-                break;
+			case 'loop':
+				return '<?php '. $this->_parseLoop($var) .'?>'.$newline;
+				break;
 
-                case 'phpinclude':
-                	if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
-                    	return '<?php include(\''.$file.'\'); ?>'.$newline;
-                    }
-                break;
+			case 'comment':
+				if (empty($var)) { // full open/close style comment
+					return '<?php /* ?>'.$newline;
+				}
+				else { // just ignore tag if it was a one line comment
+					return;
+				}
+				break;
 
-                case 'include':
-                    return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
-                break;
-                
-                case 'dyninclude':
-                    return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
-                break;
+			case 'phpinclude':
+				if ($this->OPTIONS['ENABLE_PHPINCLUDE']) {
+					return '<?php include(\''.$file.'\'); ?>'.$newline;
+				}
+				break;
 
-                default:
-                    if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
-                break;
-            }
+			case 'include':
+				return '<?php $this->_getData($this->_fileSearch(\''.$file.'\'), 1); ?>';
+				break;
+
+			case 'dyninclude':
+				return '<?php $this->_getData($this->_fileSearch($this->_dyninclude[\''.$name.'\']), 1); ?>';
+				break;
+
+			default:
+				if ($this->OPTIONS['STRICT']) vlibTemplateError::raiseError('VT_ERROR_INVALID_TAG', KILL, htmlspecialchars($wholetag, ENT_QUOTES));
+				break;
+			}
+
+		}
+
+
+		/**
+		 * FUNCTION: _intParse
+		 *
+		 * Parses $this->_tmplfile into correct format for eval() to work
+		 * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
+		 * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
+		 * Sets final parsed file to $this->_tmplfilep.
+		 *
+		 * @access private
+		 * @return boolean true/false
+		 */
+		function _intParse () {
+			//$mqrt = get_magic_quotes_runtime();
+			//set_magic_quotes_runtime(0);
+			$this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
+			//set_magic_quotes_runtime($mqrt);
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: _parse
+		 *
+		 * Calls _intParse, and eval()s $this->tmplfilep
+		 * and outputs the results to $this->tmploutput
+		 *
+		 * @param bool compress whether to compress contents
+		 * @access private
+		 * @return boolean true/false
+		 */
+		function _parse ($compress='') {
+			if (!$this->_parsed) {
+				if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
+
+				$this->_intParse();
+				$this->_parsed = true;
+
+				if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
+				if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
+			}
 
-        }
-
-        /**
-         * FUNCTION: _intParse
-         *
-         * Parses $this->_tmplfile into correct format for eval() to work
-         * Called by $this->_parse(), or $this->fastPrint, this replaces all <tmpl_*> references
-         * with their correct php representation, i.e. <tmpl_var title> becomes $this->vars['title']
-         * Sets final parsed file to $this->_tmplfilep.
-         *
-         * @access private
-         * @return boolean true/false
-         */
-        function _intParse () {
-            //$mqrt = get_magic_quotes_runtime();
-            //set_magic_quotes_runtime(0);
-            $this->_tmplfilep = '?>'.$this->_getData($this->_tmplfilename).'<?php return true;';
-            //set_magic_quotes_runtime($mqrt);
-            return true;
-        }
-
-        /**
-         * FUNCTION: _parse
-         *
-         * Calls _intParse, and eval()s $this->tmplfilep
-         * and outputs the results to $this->tmploutput
-         *
-         * @param bool compress whether to compress contents
-         * @access private
-         * @return boolean true/false
-         */
-        function _parse ($compress='') {
-            if (!$this->_parsed) {
-                if ($this->OPTIONS['TIME_PARSE']) $this->_firstparsetime = $this->_getMicroTime();
-
-                $this->_intParse();
-                $this->_parsed = true;
-
-                if ($this->OPTIONS['TIME_PARSE']) $this->_totalparsetime = ($this->_getMicroTime() - $this->_firstparsetime);
-                if ($this->OPTIONS['TIME_PARSE'] && $this->OPTIONS['GLOBAL_CONTEXT_VARS']) $this->setVar('__PARSE_TIME__', $this->getParseTime());
-            }
-			
 			// ob_start($compress);
-            ob_start();
-
-                array_push($this->_currentincludedir, dirname($this->_tmplfilename));
-                $this->_includedepth++;
-                $success = @eval($this->_tmplfilep);
-                $this->_includedepth--;
-                array_pop($this->_currentincludedir);
-
-                if ($this->_debug) $this->doDebug();
-                if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
-                $this->_tmploutput .= ob_get_contents();
-            ob_end_clean();
-			
-			
-			
-            return true;
-        }
-
-        /**
-         * FUNCTION: _setOption
-         *
-         * Sets one or more of the boolean options 1/0, that control certain actions in the template.
-         * Use of this function:
-         * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
-         * or      vlibTemplate::_setOptions(array);
-         *          with an associative array where the key is the option_name
-         *          and the value is the option_value.
-         *
-         * @param mixed (mulitple)
-         * @return bool true/false
-         * @access private
-         */
-        function _setOption () {
-            $numargs = func_num_args();
-            if ($numargs < 1) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
+			ob_start();
+
+			array_push($this->_currentincludedir, dirname($this->_tmplfilename));
+			$this->_includedepth++;
+			$success = @eval($this->_tmplfilep);
+			$this->_includedepth--;
+			array_pop($this->_currentincludedir);
+
+			if ($this->_debug) $this->doDebug();
+			if (!$success) vlibTemplateError::raiseError('VT_ERROR_PARSE', FATAL);
+			$this->_tmploutput .= ob_get_contents();
+			ob_end_clean();
 
-            if ($numargs == 1) {
-                $options = func_get_arg(1);
-                if (is_array($options)) {
-                    foreach ($options as $k => $v) {
-                        if ($v != null) {
-                            if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                        }
-                        else {
-                            continue;
-                        }
-                    }
-                }
-                else {
-                    vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                    return false;
-                }
-            }
-            elseif (is_int($numargs / 2)) {
-                for ($i = 0; $i < $numargs; $i=($i+2)) {
-                    $k  = func_get_arg($i);
-                    $v = func_get_arg(($i+1));
-                    if ($v != null) {
-                        if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
-                    }
-                }
-            }
-            else {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
-                return false;
-            }
-            return true;
-        }
-
-        /**
-         * FUNCTION: _setUnknown
-         *
-         * Used during parsing, this function sets an unknown var checking to see if it
-         * has been previously set.
-         *
-         * @param string var
-         * @access private
-         */
-        function _setUnknown ($var) {
-            if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
-        }
-
-        /**
-         * FUNCTION: _getMicrotime
-         * Returns microtime as a float number
-         *
-         * @return float microtime
-         * @access private
-         */
-        function _getMicrotime () {
-            list($msec, $sec) = explode(" ",microtime());
-            return ((float)$msec + (float)$sec);
-        }
-
-        /**
-         * FUNCTION: _escape_hex
-         * Returns str encoded to hex code.
-         *
-         * @param string str to be encoded
-         * @param bool true/false specify whether to use hex_entity
-         * @return string encoded in hex
-         * @access private
-         */
-        function _escape_hex($str="", $entity=false) {
-            $prestr = $entity ? '&#x' : '%';
-            $poststr= $entity ? ';' : '';
-            for ($i=0; $i < strlen($str); $i++) {
-                $return .= $prestr.bin2hex($str[$i]).$poststr;
-            }
-            return $return;
-        }
 
-    /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: _setOption
+		 *
+		 * Sets one or more of the boolean options 1/0, that control certain actions in the template.
+		 * Use of this function:
+		 * either: vlibTemplate::_setOptions(string option_name, bool option_val [, string option_name, bool option_val ..]);
+		 * or      vlibTemplate::_setOptions(array);
+		 *          with an associative array where the key is the option_name
+		 *          and the value is the option_value.
+		 *
+		 * @param mixed (mulitple)
+		 * @return bool true/false
+		 * @access private
+		 */
+		function _setOption () {
+			$numargs = func_num_args();
+			if ($numargs < 1) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
+
+			if ($numargs == 1) {
+				$options = func_get_arg(1);
+				if (is_array($options)) {
+					foreach ($options as $k => $v) {
+						if ($v != null) {
+							if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+						}
+						else {
+							continue;
+						}
+					}
+				}
+				else {
+					vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+					return false;
+				}
+			}
+			elseif (is_int($numargs / 2)) {
+				for ($i = 0; $i < $numargs; $i=($i+2)) {
+					$k  = func_get_arg($i);
+					$v = func_get_arg(($i+1));
+					if ($v != null) {
+						if(in_array($k, array_keys($this->OPTIONS))) $this->OPTIONS[$k] = $v;
+					}
+				}
+			}
+			else {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_NO_PARAMS', null, '_setOption()');
+				return false;
+			}
+			return true;
+		}
+
+
+		/**
+		 * FUNCTION: _setUnknown
+		 *
+		 * Used during parsing, this function sets an unknown var checking to see if it
+		 * has been previously set.
+		 *
+		 * @param string var
+		 * @access private
+		 */
+		function _setUnknown ($var) {
+			if (!in_array($var, $this->_unknowns)) array_push($this->_unknowns, $var);
+		}
+
+
+		/**
+		 * FUNCTION: _getMicrotime
+		 * Returns microtime as a float number
+		 *
+		 * @return float microtime
+		 * @access private
+		 */
+		function _getMicrotime () {
+			list($msec, $sec) = explode(" ", microtime());
+			return (float)$msec + (float)$sec;
+		}
+
+
+		/**
+		 * FUNCTION: _escape_hex
+		 * Returns str encoded to hex code.
+		 *
+		 * @param string str to be encoded
+		 * @param bool true/false specify whether to use hex_entity
+		 * @return string encoded in hex
+		 * @access private
+		 */
+		function _escape_hex($str="", $entity=false) {
+			$prestr = $entity ? '&#x' : '%';
+			$poststr= $entity ? ';' : '';
+			for ($i=0; $i < strlen($str); $i++) {
+				$return .= $prestr.bin2hex($str[$i]).$poststr;
+			}
+			return $return;
+		}
+
+		/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     The following functions have no use and are included just so that if the user
     is making use of vlibTemplateCache functions, this doesn't crash when changed to
     vlibTemplate if the user is quickly bypassing the vlibTemplateCache class.
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
-        function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
-        function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
-        function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
-        function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
-    }
+		function clearCache()        {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'clearCache()');}
+
+		function recache()           {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'recache()');}
+
+		function setCacheLifeTime()  {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheLifeTime()');}
+
+		function setCacheExtension() {vlibTemplateError::raiseError('VT_WARNING_NOT_CACHE_OBJ', WARNING, 'setCacheExtension()');}
+
+	}
 
-    //include_once ($conf['classpath'].'/vlibTemplate/debug.php');
-    include_once ($conf['classpath'].'/tpl_cache.inc.php');
+	//include_once ($conf['classpath'].'/vlibTemplate/debug.php');
+	include_once $conf['classpath'].'/tpl_cache.inc.php';
 
 } // << end if(!defined())..
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/tpl_cache.inc.php b/server/lib/classes/tpl_cache.inc.php
index a3999466a703e1fec5f27930debeb0b3a6a386a2..4bf75faa8c8cda9ccb92a3b8749cf0926fce8f47 100644
--- a/server/lib/classes/tpl_cache.inc.php
+++ b/server/lib/classes/tpl_cache.inc.php
@@ -20,167 +20,174 @@
  * @access public
  */
 
+
 class tplc extends tpl {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS, IT MAY NOT WORK OTHERWISE           |
 \-----------------------------------------------------------------------------*/
 
-    var $_cache = 1;     // tells vlibTemplate that we're caching
-    var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
-    var $_cacheexists;   // has this file been cached before
-    var $_cachefilelocked; // is this file currently locked whilst writing
-    var $_cachefiledir;  // dir of current cache file
-    var $_clearcache = 0;
-
-
-    /**
-     * FUNCTION: clearCache
-     * will unset a file, and set $this->_cacheexists to 0.
-     *
-     * @access public
-     * @return boolean
-     */
-    function clearCache() {
-        $this->_clearcache = 1;
-        return true;
-    }
-
-    /**
-     * FUNCTION: recache
-     * alias for clearCache().
-     *
-     * @access public
-     * @return boolean
-     */
-    function recache() {
-        return $this->clearCache();
-    }
-
-    /**
-     * FUNCTION: setCacheLifeTime
-     * sets the lifetime of the cached file
-     *
-     * @param int $int number of seconds to set lifetime to
-     * @access public
-     * @return boolean
-     */
-    function setCacheLifeTime($int = null) {
-        if ($int == null || !is_int($int)) return false;
-        if ($int == 0) $int = 60;
-        if ($int == -1) $int = 157680000; // set to 5 yrs time
-        $this->OPTIONS['CACHE_LIFETIME'] = $int;
-        return true;
-    }
-
-    /**
-     * FUNCTION: setCacheExtension
-     * sets the extention of the cache file
-     *
-     * @param str $str name of new cache extention
-     * @access public
-     * @return boolean
-     */
-    function setCacheExtension($str = null) {
-        if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
-        $this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
-        return true;
-    }
-
-
-/*----------------------------------------\
+	var $_cache = 1;     // tells vlibTemplate that we're caching
+	var $_cachefile;     // full path to current cache file (even if it doesn't yet exist)
+	var $_cacheexists;   // has this file been cached before
+	var $_cachefilelocked; // is this file currently locked whilst writing
+	var $_cachefiledir;  // dir of current cache file
+	var $_clearcache = 0;
+
+
+	/**
+	 * FUNCTION: clearCache
+	 * will unset a file, and set $this->_cacheexists to 0.
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function clearCache() {
+		$this->_clearcache = 1;
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: recache
+	 * alias for clearCache().
+	 *
+	 * @access public
+	 * @return boolean
+	 */
+	function recache() {
+		return $this->clearCache();
+	}
+
+
+	/**
+	 * FUNCTION: setCacheLifeTime
+	 * sets the lifetime of the cached file
+	 *
+	 * @param int $int number of seconds to set lifetime to
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheLifeTime($int = null) {
+		if ($int == null || !is_int($int)) return false;
+		if ($int == 0) $int = 60;
+		if ($int == -1) $int = 157680000; // set to 5 yrs time
+		$this->OPTIONS['CACHE_LIFETIME'] = $int;
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: setCacheExtension
+	 * sets the extention of the cache file
+	 *
+	 * @param str $str name of new cache extention
+	 * @access public
+	 * @return boolean
+	 */
+	function setCacheExtension($str = null) {
+		if ($str == null || !preg_match('/^[a-z0-9]+$/', strtolower($str))) return false;
+		$this->OPTIONS['CACHE_EXTENSION'] = strtolower($str);
+		return true;
+	}
+
+
+	/*----------------------------------------\
           Private Functions
 -----------------------------------------*/
 
-    /**
-     * FUNCTION: _checkCache
-     * checks if there's a cache, if there is then it will read the cache file as the template.
-     */
-    function _checkCache ($tmplfile) {
-        $this->_cachefile = $this->_getFilename($tmplfile);
-        if ($this->_clearcache) {
-            if (file_exists($this->_cachefile)) unlink($this->_cachefile);
-            return false;
-        }
-
-        if (file_exists($this->_cachefile)) {
-            $this->_cacheexists = 1;
-
-            // if it's expired
-            if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date ('U')
-                  || filectime($this->_cachefile) < filemtime($tmplfile)) {
-                $this->_cacheexists = 0;
-                return false; // so that we know to recache
-            }
-            else {
-                return true;
-            }
-
-        } else {
-            $this->_cacheexists = 0;
-            return false;
-        }
-    }
-
-
-    /**
-     * FUNCTION: _getFilename
-     * gets the full pathname for the cached file
-     *
-     */
-    function _getFilename($tmplfile) {
-        return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
-    }
-
-    /**
-     * FUNCTION: _createCache
-     * creates the cached file
-     *
-     */
-    function _createCache($data) {
-        $cache_file = $this->_cachefile;
-        if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
-
-        $f = fopen ($cache_file, "w");
-        flock($f, 2); // set an EXclusive lock
-        if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE',KILL,$cache_file);
-        fputs ($f, $data); // write the parsed string from vlibTemplate
-        flock($f, 3); // UNlock file
-        fclose ($f);
-        touch ($cache_file);
-        return true;
-    }
-
-    /**
-     * FUNCTION: _prepareDirs
-     * prepares the directory structure
-     *
-     */
-    function _prepareDirs($file) {
-        if (empty($file)) die('no filename'); //do error in future
-        $filepath = dirname($file);
-        if (is_dir($filepath)) return true;
-
-        $dirs = preg_split('/[\\/]/', $filepath);
-        $currpath;
-        foreach ($dirs as $dir) {
-            $currpath .= $dir .'/';
-            $type = @filetype($currpath);
-
-            ($type=='link') and $type = 'dir';
-            if ($type != 'dir' && $type != false && !empty($type)) {
-                vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE',KILL,'directory: '.$currpath.', type: '.$type);
-            }
-            if ($type == 'dir') {
-                continue;
-            }
-            else {
-                $s = @mkdir($currpath, 0775);
-                if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE',KILL,'directory: '.$currpath);
-            }
-        }
-        return true;
-    }
+
+	/**
+	 * FUNCTION: _checkCache
+	 * checks if there's a cache, if there is then it will read the cache file as the template.
+	 */
+	function _checkCache ($tmplfile) {
+		$this->_cachefile = $this->_getFilename($tmplfile);
+		if ($this->_clearcache) {
+			if (file_exists($this->_cachefile)) unlink($this->_cachefile);
+			return false;
+		}
+
+		if (file_exists($this->_cachefile)) {
+			$this->_cacheexists = 1;
+
+			// if it's expired
+			if ((filemtime($this->_cachefile) + $this->OPTIONS['CACHE_LIFETIME']) < date('U')
+				|| filectime($this->_cachefile) < filemtime($tmplfile)) {
+				$this->_cacheexists = 0;
+				return false; // so that we know to recache
+			}
+			else {
+				return true;
+			}
+
+		} else {
+			$this->_cacheexists = 0;
+			return false;
+		}
+	}
+
+
+	/**
+	 * FUNCTION: _getFilename
+	 * gets the full pathname for the cached file
+	 *
+	 */
+	function _getFilename($tmplfile) {
+		return $this->OPTIONS['CACHE_DIRECTORY'].'/'.md5('vlibCachestaR'.realpath($tmplfile)).'.'.$this->OPTIONS['CACHE_EXTENSION'];
+	}
+
+
+	/**
+	 * FUNCTION: _createCache
+	 * creates the cached file
+	 *
+	 */
+	function _createCache($data) {
+		$cache_file = $this->_cachefile;
+		if(!$this->_prepareDirs($cache_file)) return false; // prepare all of the directories
+
+		$f = fopen($cache_file, "w");
+		flock($f, 2); // set an EXclusive lock
+		if (!$f) vlibTemplateError::raiseError('VT_ERROR_NO_CACHE_WRITE', KILL, $cache_file);
+		fputs($f, $data); // write the parsed string from vlibTemplate
+		flock($f, 3); // UNlock file
+		fclose($f);
+		touch($cache_file);
+		return true;
+	}
+
+
+	/**
+	 * FUNCTION: _prepareDirs
+	 * prepares the directory structure
+	 *
+	 */
+	function _prepareDirs($file) {
+		if (empty($file)) die('no filename'); //do error in future
+		$filepath = dirname($file);
+		if (is_dir($filepath)) return true;
+
+		$dirs = preg_split('/[\\/]/', $filepath);
+		$currpath;
+		foreach ($dirs as $dir) {
+			$currpath .= $dir .'/';
+			$type = @filetype($currpath);
+
+			($type=='link') and $type = 'dir';
+			if ($type != 'dir' && $type != false && !empty($type)) {
+				vlibTemplateError::raiseError('VT_ERROR_WRONG_CACHE_TYPE', KILL, 'directory: '.$currpath.', type: '.$type);
+			}
+			if ($type == 'dir') {
+				continue;
+			}
+			else {
+				$s = @mkdir($currpath, 0775);
+				if (!$s) vlibTemplateError::raiseError('VT_ERROR_CACHE_MKDIR_FAILURE', KILL, 'directory: '.$currpath);
+			}
+		}
+		return true;
+	}
 
 } // -- end vlibTemplateCache class
-?>
\ No newline at end of file
+?>
diff --git a/server/lib/classes/tpl_error.inc.php b/server/lib/classes/tpl_error.inc.php
index 171a04f8bfd04591577da5be4b01a7df456e765c..c2badaa5552ec1989fc95668af5ca53cb9efbde6 100644
--- a/server/lib/classes/tpl_error.inc.php
+++ b/server/lib/classes/tpl_error.inc.php
@@ -25,68 +25,71 @@ define('KILL',   -1); // used for killing inside parsing.
  * @access private
  */
 
+
 class vlibTemplateError {
 
-/*-----------------------------------------------------------------------------\
+	/*-----------------------------------------------------------------------------\
 |     DO NOT TOUCH ANYTHING IN THIS CLASS IT MAY NOT WORK OTHERWISE            |
 \-----------------------------------------------------------------------------*/
 
-    public static function raiseError ($code, $level = null, $extra=null) {
-        if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
+	public static function raiseError ($code, $level = null, $extra=null) {
+		if (!($level & error_reporting())&& $level != KILL) return; // binary AND checks for reporting level
+
+		$error_codes = array(
+			'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
+			'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br>To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
+			'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
+			'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
+			'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
+			'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
+			'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
+			'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
+			'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
+			'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
+			'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
+			'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
+			'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
+			'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
+			'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
+			'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
+		);
 
-        $error_codes = array(
-                        'VT_ERROR_NOFILE'               => 'vlibTemplate Error: Template ('.$extra.') file not found.',
-                        'VT_ERROR_PARSE'                => 'vlibTemplate Error: Parse error!<br>To debug this file, use vlibTemplateDebug instead of vlibTemplate in the class instantiation(i.e. new vlibTemplateDebug).',
-                        'VT_NOTICE_INVALID_TAG'         => 'vlibTemplate Notice: Invalid tag ('.$extra.').',
-                        'VT_ERROR_INVALID_TAG'          => 'vlibTemplate Error: Invalid tag ('.$extra.'). To disable this you must turn of the STRICT option.',
-                        'VT_NOTICE_INVALID_ATT'         => 'vlibTemplate Notice: Invalid attribute ('.$extra.').',
-                        'VT_WARNING_INVALID_ARR'        => 'vlibTemplate Warning: Invalid loop structure passed to vlibTemplate::setLoop() (loop name: '.$extra.').',
-                        'VT_ERROR_INVALID_ERROR_CODE'   => 'vlibTemplate Error: Invalid error raised.',
-                        'VT_ERROR_WRONG_NO_PARAMS'      => 'vlibTemplate Warning: Wrond parameter count passed to '.$extra.'.',
-                        'VT_ERROR_UNKNOWN_VAR'          => 'vlibTemplate Error: template var not found.',
-                        'VT_ERROR_NO_CACHE_WRITE'       => 'vlibTemplate Error: unable to write to cache file ('.$extra.').',
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => 'vlibTemplate Error: non-directory file found in cache root with same name as directory ('.$extra.').',
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => 'vlibTemplate Error: failed to create directory in cache root ('.$extra.').',
-                        'VT_WARNING_NOT_CACHE_OBJ'      => 'vlibTemplate Warning: called a vlibTemplateCache function ('.$extra.') without instantiating the vlibTemplateCache class.',
-                        'VT_WARNING_LOOP_NOT_SET'       => 'vlibTemplate Warning: called vlibTemplate::addRow() or vlibTemplate::addLoop() with an invalid loop name.',
-                        'VT_WARNING_INVALID_RESOURCE'   => 'vlibTemplate Warning: Invalid resource type passed to vlibTemplate::setDbLoop() for Db "'.$extra.'".',
-                        'VT_WARNING_INVALID_LOOP_DB'    => 'vlibTemplate Warning: Invalid Db type passed to vlibTemplate::setDbLoop(), "'.$extra.'" not currently available.',
-                        'VT_WARNING_INVALID_IF_OP'      => 'vlibTemplate Warning: The Operator "'.$extra.'" is not supported by vlibTemplate.'
-                            );
+		$error_levels = array(
+			'VT_ERROR_NOFILE'               => FATAL,
+			'VT_ERROR_PARSE'                => FATAL,
+			'VT_NOTICE_INVALID_TAG'         => NOTICE,
+			'VT_ERROR_INVALID_TAG'          => FATAL,
+			'VT_NOTICE_INVALID_ATT'         => NOTICE,
+			'VT_WARNING_INVALID_ARR'        => WARNING,
+			'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
+			'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
+			'VT_ERROR_UNKNOWN_VAR'          => WARNING,
+			'VT_ERROR_NO_CACHE_WRITE'       => KILL,
+			'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
+			'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
+			'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
+			'VT_WARNING_LOOP_NOT_SET'       => WARNING,
+			'VT_WARNING_INVALID_RESOURCE'   => WARNING,
+			'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
+			'VT_WARNING_INVALID_IF_OP'      => WARNING
+		);
 
-        $error_levels = array(
-                        'VT_ERROR_NOFILE'               => FATAL,
-                        'VT_ERROR_PARSE'                => FATAL,
-                        'VT_NOTICE_INVALID_TAG'         => NOTICE,
-                        'VT_ERROR_INVALID_TAG'          => FATAL,
-                        'VT_NOTICE_INVALID_ATT'         => NOTICE,
-                        'VT_WARNING_INVALID_ARR'        => WARNING,
-                        'VT_ERROR_INVALID_ERROR_CODE'   => FATAL,
-                        'VT_ERROR_WRONG_NO_PARAMS'      => WARNING,
-                        'VT_ERROR_UNKNOWN_VAR'          => WARNING,
-                        'VT_ERROR_NO_CACHE_WRITE'       => KILL,
-                        'VT_ERROR_WRONG_CACHE_TYPE'     => KILL,
-                        'VT_ERROR_CACHE_MKDIR_FAILURE'  => KILL,
-                        'VT_WARNING_NOT_CACHE_OBJ'      => WARNING,
-                        'VT_WARNING_LOOP_NOT_SET'       => WARNING,
-                        'VT_WARNING_INVALID_RESOURCE'   => WARNING,
-                        'VT_WARNING_INVALID_LOOP_DB'    => WARNING,
-                        'VT_WARNING_INVALID_IF_OP'      => WARNING
-                            );
+		($level === null) and $level = $error_levels[$code];
+		if ($level == KILL) {
+			die ($error_codes[$code]);
+		}
 
-        ($level === null) and $level = $error_levels[$code];
-        if ($level == KILL) {
-            die ($error_codes[$code]);
-        }
+		if ($msg = $error_codes[$code]) {
+			trigger_error($msg, $level);
+		} else {
+			$level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
+			$msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
+			trigger_error($msg, $level);
+		}
+		return;
+	}
 
-        if ($msg = $error_codes[$code]) {
-            trigger_error($msg, $level);
-        } else {
-            $level = $error_levels['VT_ERROR_INVALID_ERROR_CODE'];
-            $msg = $error_codes['VT_ERROR_INVALID_ERROR_CODE'];
-            trigger_error($msg, $level);
-        }
-        return;
-    }
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/lib/classes/tpl_ini.inc.php b/server/lib/classes/tpl_ini.inc.php
index 7302daa7e8ce6835c1248e0d034a0b88b8a73279..792dacbece793e095541caca39451de0733d57d9 100644
--- a/server/lib/classes/tpl_ini.inc.php
+++ b/server/lib/classes/tpl_ini.inc.php
@@ -28,91 +28,92 @@
 */
 
 if (!defined('vlibIniClassLoaded')) {
-    define('vlibIniClassLoaded', 1);
-
-    /**
-     * vlibIni is a class used to store configuration parameters
-     * for the vLIB library.
-     *
-     * @since 21/07/2002
-     * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
-     * @package vLIB
-     * @access private
-     */
-
-    class vlibIni {
-
-        /** config vars for vlibTemplate */
-        public static function vlibTemplate () {
-        	
-        	global $conf;
-			
+	define('vlibIniClassLoaded', 1);
+
+	/**
+	 * vlibIni is a class used to store configuration parameters
+	 * for the vLIB library.
+	 *
+	 * @since 21/07/2002
+	 * @author Kelvin Jones <kelvin@kelvinjones.co.uk>
+	 * @package vLIB
+	 * @access private
+	 */
+
+
+	class vlibIni {
+
+		/** config vars for vlibTemplate */
+		public static function vlibTemplate () {
+
+			global $conf;
+
 			$tpl_dir = $conf["rootpath"]."/conf";
 			$include_paths = array($conf["rootpath"].'/conf-custom');
-			
-            return array(
 
-                        'TEMPLATE_DIR' => $tpl_dir,   // Default directory for your template files (full path)
-                                                                   // leave the '/' or '\' off the end of the directory.
-						'INCLUDE_PATHS' => $include_paths, // The include path is always searched first for a template file before the template_dir is checked
-						
-                        'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
+			return array(
+
+				'TEMPLATE_DIR' => $tpl_dir,   // Default directory for your template files (full path)
+				// leave the '/' or '\' off the end of the directory.
+				'INCLUDE_PATHS' => $include_paths, // The include path is always searched first for a template file before the template_dir is checked
+
+				'MAX_INCLUDES' => 10,                      // Drill depth for tmpl_include's
 
-                        'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
-                                                                   // loop will search for a global var as well
+				'GLOBAL_VARS' => 1,                        // if set to 1, any variables not found in a
+				// loop will search for a global var as well
 
-                        'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
-                                                                   // reflecting the environment.
+				'GLOBAL_CONTEXT_VARS' => 1,                // if set to 1, vlibTemplate will add global vars
+				// reflecting the environment.
 
-                        'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
-                                                                   // on each row of the loop.
+				'LOOP_CONTEXT_VARS' => 1,                  // if set to 1, vlibTemplate will add loop specific vars
+				// on each row of the loop.
 
-                        'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
+				'SET_LOOP_VAR' => 1,                       // Sets a global variable for each top level loops
 
-                        'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
+				'DEFAULT_ESCAPE' => 'none',                // 1 of the following: html, url, sq, dq, none
 
-                        'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
-                                                                   // style tags i.e. tmpl_vae
+				'STRICT' => 0,                             // Dies when encountering an incorrect tmpl_*
+				// style tags i.e. tmpl_vae
 
-                        'CASELESS' => 0,                           // Removes case sensitivity on all variables
+				'CASELESS' => 0,                           // Removes case sensitivity on all variables
 
-                        'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
-                                                                   // 1 of the following: ignore, remove, leave,print, comment
-                                                                   // 1 of the following: ignore, remove, leave, print, comment
+				'UNKNOWNS' => 'ignore',                    // How to handle unknown variables.
+				// 1 of the following: ignore, remove, leave,print, comment
+				// 1 of the following: ignore, remove, leave, print, comment
 
-                        'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
-                                                                   // your template. You then use the function: getParseTime().
+				'TIME_PARSE' => '0',                       // Will enable you to time how long vlibTemplate takes to parse
+				// your template. You then use the function: getParseTime().
 
-                        'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
+				'ENABLE_PHPINCLUDE' => '1',                // Will allow template to include a php file using <TMPL_PHPINCLUDE>
 
 
-                        /* the following are only used by the vlibTemplateCache class. */
+				/* the following are only used by the vlibTemplateCache class. */
 
-                        'CACHE_DIRECTORY' => $conf["template"]["cache_dir"],
-                                                                   // Directory where the cached filesystem
-                                                                   // will be set up (full path, and must be writable)
-                                                                   // '/' or '\' off the end of the directory.
+				'CACHE_DIRECTORY' => $conf["template"]["cache_dir"],
+				// Directory where the cached filesystem
+				// will be set up (full path, and must be writable)
+				// '/' or '\' off the end of the directory.
 
-                        'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
+				'CACHE_LIFETIME' => 604800,                // Duration until file is re-cached in seconds (604800 = 1 week)
 
-                        'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
-                                                                   // index.vtc (vlibTemplate Compiled)
-                    );
+				'CACHE_EXTENSION' => 'vtc'                  // extention to be used by the cached file i.e. index.php will become
+				// index.vtc (vlibTemplate Compiled)
+			);
 
-        } // << end function vlibTemplate
+		} // << end function vlibTemplate
 
 
 
-        /** config vars for vlibDate */
-        public function vlibDate () {
+		/** config vars for vlibDate */
+		public function vlibDate () {
 
-            return array(
-                        'DEFAULT_LANG' => 'de'                     // default language for the date displays
-                    );
+			return array(
+				'DEFAULT_LANG' => 'de'                     // default language for the date displays
+			);
 
-        }// << end function vlibDate
+		}// << end function vlibDate
 
 
-    }// << end class vlibIni
+	}// << end class vlibIni
 }
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/client_module.inc.php b/server/mods-available/client_module.inc.php
index 4aaccf962fdcf3688ba8ac9c4ee90e16613823bf..7882d7429039cb1bed15f6b59084f76a706b74fd 100644
--- a/server/mods-available/client_module.inc.php
+++ b/server/mods-available/client_module.inc.php
@@ -29,68 +29,68 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class client_module {
-	
+
 	var $module_name = 'client_module';
 	var $class_name = 'client_module';
-	var $actions_available = array(	'client_insert',
-									'client_update',
-									'client_delete');
-	
+	var $actions_available = array( 'client_insert',
+		'client_update',
+		'client_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('client',$this->module_name,'process');
-		
+
+		$app->modules->registerTableHook('client', $this->module_name, 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'client':
-				if($action == 'i') $app->plugins->raiseEvent('client_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('client_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('client_delete',$data);
+		case 'client':
+			if($action == 'i') $app->plugins->raiseEvent('client_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('client_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('client_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/cron_module.inc.php b/server/mods-available/cron_module.inc.php
index 778585cb49197cd3e8ef728e67be092ba3ddc0c6..a8c14cc7b371a5188c27b51b41f974c7cec6664a 100644
--- a/server/mods-available/cron_module.inc.php
+++ b/server/mods-available/cron_module.inc.php
@@ -30,68 +30,68 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cron_module {
-	
+
 	var $module_name = 'cron_module';
 	var $class_name = 'cron_module';
-	var $actions_available = array(	'cron_insert',
-									'cron_update',
-									'cron_delete');
-	
+	var $actions_available = array( 'cron_insert',
+		'cron_update',
+		'cron_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('cron',$this->module_name,'process');
-		
+
+		$app->modules->registerTableHook('cron', $this->module_name, 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'cron':
-				if($action == 'i') $app->plugins->raiseEvent('cron_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('cron_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('cron_delete',$data);
+		case 'cron':
+			if($action == 'i') $app->plugins->raiseEvent('cron_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('cron_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('cron_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/database_module.inc.php b/server/mods-available/database_module.inc.php
index c3a99b63f18c60b51cc9d1a526af0c09b2242782..a427677a20600b40d897752f4e7ba061ef476237 100644
--- a/server/mods-available/database_module.inc.php
+++ b/server/mods-available/database_module.inc.php
@@ -29,86 +29,86 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class database_module {
-	
+
 	var $module_name = 'database_module';
 	var $class_name = 'database_module';
-	var $actions_available = array(	'database_insert',
-									'database_update',
-									'database_delete',
-									'database_user_insert',
-									'database_user_update',
-									'database_user_delete'
-									);
-	
+	var $actions_available = array( 'database_insert',
+		'database_update',
+		'database_delete',
+		'database_user_insert',
+		'database_user_update',
+		'database_user_delete'
+	);
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['db'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('web_database','database_module','process');
-		$app->modules->registerTableHook('web_database_user','database_module','process');
-		
+
+		$app->modules->registerTableHook('web_database', 'database_module', 'process');
+		$app->modules->registerTableHook('web_database_user', 'database_module', 'process');
+
 		// Register service
 		//$app->services->registerService('httpd','web_module','restartHttpd');
-		
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'web_database':
-				if($action == 'i') $app->plugins->raiseEvent('database_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('database_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('database_delete',$data);
+		case 'web_database':
+			if($action == 'i') $app->plugins->raiseEvent('database_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('database_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('database_delete', $data);
 			break;
-			
-			case 'web_database_user':
-				if($action == 'i') $app->plugins->raiseEvent('database_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('database_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('database_user_delete',$data);
+
+		case 'web_database_user':
+			if($action == 'i') $app->plugins->raiseEvent('database_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('database_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('database_user_delete', $data);
 			break;
-			
+
 		} // end switch
 	} // end function
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/dns_module.inc.php b/server/mods-available/dns_module.inc.php
index 9bab96e15e5b518c2b6646cce3c4392cfcb054be..d3c13031c0829e3899fc4cf3f7c973483a4af263 100644
--- a/server/mods-available/dns_module.inc.php
+++ b/server/mods-available/dns_module.inc.php
@@ -29,107 +29,107 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class dns_module {
-	
+
 	var $module_name = 'dns_module';
 	var $class_name = 'dns_module';
-	var $actions_available = array(	'dns_soa_insert',
-									'dns_soa_update',
-									'dns_soa_delete',
-									'dns_slave_insert',
-									'dns_slave_update',
-									'dns_slave_delete',
-									'dns_rr_insert',
-									'dns_rr_update',
-									'dns_rr_delete');
-	
+	var $actions_available = array( 'dns_soa_insert',
+		'dns_soa_update',
+		'dns_soa_delete',
+		'dns_slave_insert',
+		'dns_slave_update',
+		'dns_slave_delete',
+		'dns_rr_insert',
+		'dns_rr_update',
+		'dns_rr_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['dns'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('dns_soa',$this->module_name,'process');
-		$app->modules->registerTableHook('dns_slave',$this->module_name,'process');
-		$app->modules->registerTableHook('dns_rr',$this->module_name,'process');
-		
-		
+
+		$app->modules->registerTableHook('dns_soa', $this->module_name, 'process');
+		$app->modules->registerTableHook('dns_slave', $this->module_name, 'process');
+		$app->modules->registerTableHook('dns_rr', $this->module_name, 'process');
+
+
 		// Register service
-		$app->services->registerService('bind','dns_module','restartBind');
-		$app->services->registerService('powerdns','dns_module','restartPowerDNS');
-		
+		$app->services->registerService('bind', 'dns_module', 'restartBind');
+		$app->services->registerService('powerdns', 'dns_module', 'restartPowerDNS');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'dns_soa':
-				if($action == 'i') $app->plugins->raiseEvent('dns_soa_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('dns_soa_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('dns_soa_delete',$data);
+		case 'dns_soa':
+			if($action == 'i') $app->plugins->raiseEvent('dns_soa_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('dns_soa_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('dns_soa_delete', $data);
 			break;
-			case 'dns_slave':
-				if($action == 'i') $app->plugins->raiseEvent('dns_slave_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('dns_slave_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('dns_slave_delete',$data);
+		case 'dns_slave':
+			if($action == 'i') $app->plugins->raiseEvent('dns_slave_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('dns_slave_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('dns_slave_delete', $data);
 			break;
-			case 'dns_rr':
-				if($action == 'i') $app->plugins->raiseEvent('dns_rr_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('dns_rr_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('dns_rr_delete',$data);
+		case 'dns_rr':
+			if($action == 'i') $app->plugins->raiseEvent('dns_rr_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('dns_rr_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('dns_rr_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
-	
+
+
 	function restartBind($action = 'restart') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		$app->uses('system');
-		
+
 		$daemon = '';
 		if(is_file($conf['init_scripts'] . '/' . 'bind9')) {
 			$daemon = 'bind9';
 		} else {
 			$daemon = 'named';
 		}
-		
+
 		$retval = array('output' => '', 'retval' => 0);
 		if($action == 'restart') {
 			exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']);
@@ -140,39 +140,43 @@ class dns_module {
 	}
 
 	function restartPowerDNS($action = 'restart') {
-		global $app,$conf;
-	
+		global $app, $conf;
+
 		$app->uses('system');
-		$app->log("restartPDNS called.",LOGLEVEL_DEBUG);
+		$app->log("restartPDNS called.", LOGLEVEL_DEBUG);
+
+		/**     Since PowerDNS does not currently allow to limit AXFR for specific zones to specific
+		 *  IP addresses, we create a list of IPs allowed of AXFR transfers from our PowerDNS,
+		 *  however any of these IPs is allowed to AXFR transfer any of the zones we are masters
+		 *  for.
+		 */
 
-/**     Since PowerDNS does not currently allow to limit AXFR for specific zones to specific
-*		IP addresses, we create a list of IPs allowed of AXFR transfers from our PowerDNS,
-*		however any of these IPs is allowed to AXFR transfer any of the zones we are masters
-*		for.
-*/
-        $tmps = $app->db->queryAllRecords("SELECT DISTINCT xfer FROM dns_soa WHERE active = 'Y' UNION SELECT DISTINCT xfer FROM dns_slave WHERE active = 'Y' ");
+
+		$tmps = $app->db->queryAllRecords("SELECT DISTINCT xfer FROM dns_soa WHERE active = 'Y' UNION SELECT DISTINCT xfer FROM dns_slave WHERE active = 'Y' ");
 
 		//* Make sure the list is never empty
-        $options='127.0.0.1';
-        foreach($tmps as $tmp) {
-        	if (trim($tmp['xfer'])!='') {
-	        	if ($options=='') {
+		$options='127.0.0.1';
+		foreach($tmps as $tmp) {
+			if (trim($tmp['xfer'])!='') {
+				if ($options=='') {
 					$options.=$tmp['xfer'];
-	        	} else {
-    	    		$options=$options.",".$tmp['xfer'];
-        		}
-        	}
-        }
+				} else {
+					$options=$options.",".$tmp['xfer'];
+				}
+			}
+		}
 
 		//* Remove duplicate IPs from the array
-		$options = "allow-axfr-ips=".implode(",",array_unique(explode(",",$options)));
-        $app->log("".$options,LOGLEVEL_DEBUG);
-	
-/**		Not an ideal way to use a hardcoded path like that, but currently
-*		we have no way to find out where powerdns' configuration files are 
-*		located, so we have to work on assumption. 
-*/
-		file_put_contents('/etc/powerdns/pdns.d/pdns.ispconfig-axfr',$options."\n");
+		$options = "allow-axfr-ips=".implode(",", array_unique(explode(",", $options)));
+		$app->log("".$options, LOGLEVEL_DEBUG);
+
+
+
+		/**  Not an ideal way to use a hardcoded path like that, but currently
+		 *  we have no way to find out where powerdns' configuration files are
+		 *  located, so we have to work on assumption.
+		 */
+		file_put_contents('/etc/powerdns/pdns.d/pdns.ispconfig-axfr', $options."\n");
 
 		$daemon= '';
 		if (is_file($conf['init_scripts'] . '/' . 'powerdns')) {
@@ -184,11 +188,11 @@ class dns_module {
 		$retval = array('output' => '', 'retval' => 0);
 		exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']);
 
-//     unset $tmps;
+		//     unset $tmps;
 		return $retval;
 
 	}
-	
+
 
 } // end class
 
diff --git a/server/mods-available/mail_module.inc.php b/server/mods-available/mail_module.inc.php
index 23e0b8d7df713e01fdb9aec2de0f26e7145198b2..bc6d2901457169db191ef871c8acbabff74c03a1 100644
--- a/server/mods-available/mail_module.inc.php
+++ b/server/mods-available/mail_module.inc.php
@@ -29,134 +29,134 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class mail_module {
-	
+
 	var $module_name = 'mail_module';
 	var $class_name = 'mail_module';
-	var $actions_available = array(	'mail_domain_insert',
-									'mail_domain_update',
-									'mail_domain_delete',
-									'mail_user_insert',
-									'mail_user_update',
-									'mail_user_delete',
-									'mail_access_insert',
-									'mail_access_update',
-									'mail_access_delete',
-									'mail_forwarding_insert',
-									'mail_forwarding_update',
-									'mail_forwarding_delete',
-									'mail_transport_insert',
-									'mail_transport_update',
-									'mail_transport_delete',
-									'mail_get_insert',
-									'mail_get_update',
-									'mail_get_delete',
-									'mail_content_filter_insert',
-									'mail_content_filter_update',
-									'mail_content_filter_delete',
-									'mail_mailinglist_insert',
-									'mail_mailinglist_update',
-									'mail_mailinglist_delete');
-	
+	var $actions_available = array( 'mail_domain_insert',
+		'mail_domain_update',
+		'mail_domain_delete',
+		'mail_user_insert',
+		'mail_user_update',
+		'mail_user_delete',
+		'mail_access_insert',
+		'mail_access_update',
+		'mail_access_delete',
+		'mail_forwarding_insert',
+		'mail_forwarding_update',
+		'mail_forwarding_delete',
+		'mail_transport_insert',
+		'mail_transport_update',
+		'mail_transport_delete',
+		'mail_get_insert',
+		'mail_get_update',
+		'mail_get_delete',
+		'mail_content_filter_insert',
+		'mail_content_filter_update',
+		'mail_content_filter_delete',
+		'mail_mailinglist_insert',
+		'mail_mailinglist_update',
+		'mail_mailinglist_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('mail_access','mail_module','process');
-		$app->modules->registerTableHook('mail_domain','mail_module','process');
-		$app->modules->registerTableHook('mail_forwarding','mail_module','process');
-		$app->modules->registerTableHook('mail_transport','mail_module','process');
-		$app->modules->registerTableHook('mail_user','mail_module','process');
-		$app->modules->registerTableHook('mail_get','mail_module','process');
-		$app->modules->registerTableHook('mail_content_filter','mail_module','process');
-		$app->modules->registerTableHook('mail_mailinglist','mail_module','process');
-		
+
+		$app->modules->registerTableHook('mail_access', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_domain', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_forwarding', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_transport', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_user', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_get', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_content_filter', 'mail_module', 'process');
+		$app->modules->registerTableHook('mail_mailinglist', 'mail_module', 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'mail_access':
-				if($action == 'i') $app->plugins->raiseEvent('mail_access_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_access_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_access_delete',$data);
+		case 'mail_access':
+			if($action == 'i') $app->plugins->raiseEvent('mail_access_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_access_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_access_delete', $data);
 			break;
-			case 'mail_domain':
-				if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_domain_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete',$data);
+		case 'mail_domain':
+			if($action == 'i') $app->plugins->raiseEvent('mail_domain_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_domain_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_domain_delete', $data);
 			break;
-			case 'mail_forwarding':
-				if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete',$data);
+		case 'mail_forwarding':
+			if($action == 'i') $app->plugins->raiseEvent('mail_forwarding_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_forwarding_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_forwarding_delete', $data);
 			break;
-			case 'mail_transport':
-				if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_transport_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete',$data);
+		case 'mail_transport':
+			if($action == 'i') $app->plugins->raiseEvent('mail_transport_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_transport_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_transport_delete', $data);
 			break;
-			case 'mail_user':
-				if($action == 'i') $app->plugins->raiseEvent('mail_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_user_delete',$data);
+		case 'mail_user':
+			if($action == 'i') $app->plugins->raiseEvent('mail_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_user_delete', $data);
 			break;
-			case 'mail_get':
-				if($action == 'i') $app->plugins->raiseEvent('mail_get_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_get_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_get_delete',$data);
+		case 'mail_get':
+			if($action == 'i') $app->plugins->raiseEvent('mail_get_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_get_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_get_delete', $data);
 			break;
-			case 'mail_content_filter':
-				if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete',$data);
+		case 'mail_content_filter':
+			if($action == 'i') $app->plugins->raiseEvent('mail_content_filter_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_content_filter_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_content_filter_delete', $data);
 			break;
-			case 'mail_mailinglist':
-				if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete',$data);
+		case 'mail_mailinglist':
+			if($action == 'i') $app->plugins->raiseEvent('mail_mailinglist_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('mail_mailinglist_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('mail_mailinglist_delete', $data);
 			break;
 		} // end switch
 	} // end function
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php
index ac2eb369ae43ab58369db9d4d0dc1b566c62bc8f..04a8626a3f5bbd25bf597d7f97f0d0f3be2a2459 100644
--- a/server/mods-available/monitor_core_module.inc.php
+++ b/server/mods-available/monitor_core_module.inc.php
@@ -37,9 +37,11 @@ class monitor_core_module {
 	}
 
 	function onLoad() {
-    }
-    
-    function process() {
-    }
+	}
+
+	function process() {
+	}
+
 }
+
 ?>
diff --git a/server/mods-available/remoteaction_core_module.inc.php b/server/mods-available/remoteaction_core_module.inc.php
index 5ee3fc6dbd046ca08b80e85c33b56b91351b1ac6..08649531b579fbc079a5614b7c6c165e2034c27f 100644
--- a/server/mods-available/remoteaction_core_module.inc.php
+++ b/server/mods-available/remoteaction_core_module.inc.php
@@ -63,8 +63,8 @@ class remoteaction_core_module {
 		 */
 		global $app;
 		$sql = "UPDATE sys_remoteaction " .
-				"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
-				"WHERE action_id = " . intval($id);
+			"SET action_state = '" . $app->dbmaster->quote($state) . "' " .
+			"WHERE action_id = " . intval($id);
 		$app->dbmaster->query($sql);
 
 		/*
@@ -80,6 +80,8 @@ class remoteaction_core_module {
 	/**
 	 * This method searches for scheduled actions and exec then
 	 */
+
+
 	private function _execActions() {
 		global $app;
 		global $conf;
@@ -96,16 +98,16 @@ class remoteaction_core_module {
 		 * stop a service, a admin stopped some days before! To avoid this, we ignore
 		 * the status (it is only for the interface to show) and use our own maxid
 		*/
-		include_once (SCRIPT_PATH."/lib/remote_action.inc.php");
+		include_once SCRIPT_PATH."/lib/remote_action.inc.php";
 
 		/*
 		 * Get all actions this server should execute
 		*/
 		$sql = "SELECT action_id, action_type, action_param " .
-				"FROM sys_remoteaction " .
-				"WHERE server_id = " . $server_id . " ".
-				" AND  action_id > " . intval($maxid_remote_action) . " ".
-				"ORDER BY action_id";
+			"FROM sys_remoteaction " .
+			"WHERE server_id = " . $server_id . " ".
+			" AND  action_id > " . intval($maxid_remote_action) . " ".
+			"ORDER BY action_id";
 		$actions = $app->dbmaster->queryAllRecords($sql);
 
 		/*
@@ -120,7 +122,7 @@ class remoteaction_core_module {
 					* we stop executing the actions not to waste more time */
 					return;
 				}
-				
+
 				if ($action['action_type'] == 'ispc_update') {
 					/* do the update */
 					// Update function has been removed
@@ -151,7 +153,7 @@ class remoteaction_core_module {
 					$this->_actionDone($action['action_id'], 'ok');
 				}
 				if ($action['action_type'] == 'openvz_create_ostpl') {
-					$parts = explode(':',$action['action_param']);
+					$parts = explode(':', $action['action_param']);
 					$veid = intval($parts[0]);
 					$template_cache_dir = '/vz/template/cache/';
 					$template_name = escapeshellcmd($parts[1]);
@@ -166,8 +168,8 @@ class remoteaction_core_module {
 					* we stop executing the actions not to waste more time */
 					return;
 				}
-				
-				
+
+
 			}
 		}
 	}
@@ -187,7 +189,7 @@ class remoteaction_core_module {
 			exec("aptitude update");
 			exec("aptitude safe-upgrade -y");
 		}
-		
+
 		/*
 		 * All well done!
 		 */
@@ -195,12 +197,12 @@ class remoteaction_core_module {
 	}
 
 	private function _doIspCUpdate($action) {
-		
+
 		// Ensure that this code is not executed twice as this would cause a loop in case of a failure
 		$this->_actionDone($action['action_id'], 'ok');
-		
+
 		/*
-		 * Get the version-number of the newest version 
+		 * Get the version-number of the newest version
 		 */
 		$new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt');
 		$new_version = trim($new_version);
@@ -216,10 +218,10 @@ class remoteaction_core_module {
 		/* delete the old files (if there are any...) */
 		exec("rm /tmp/ISPConfig-" . $new_version . ".tar.gz");
 		exec("rm /tmp/ispconfig3_install -R");
-		
+
 		/* get the newest version */
 		exec("wget http://www.ispconfig.org/downloads/ISPConfig-" . $new_version . ".tar.gz");
-		
+
 		/* extract the files */
 		exec("tar xvfz ISPConfig-" . $new_version . ".tar.gz");
 
@@ -229,7 +231,7 @@ class remoteaction_core_module {
 		 */
 		chdir("/tmp/ispconfig3_install/install");
 		exec("touch autoupdate");
-		
+
 		/*
 		 * do some clean-up
 		 */
@@ -245,5 +247,7 @@ class remoteaction_core_module {
 		 */
 		//$this->_actionDone($action['action_id'], 'ok');
 	}
+
 }
+
 ?>
diff --git a/server/mods-available/rescue_core_module.inc.php b/server/mods-available/rescue_core_module.inc.php
index f1b25bda4bdb71be79d14c3b6821ef0ba8fbd40e..9674691f02e330eeba2358314e0a2015f593c733 100644
--- a/server/mods-available/rescue_core_module.inc.php
+++ b/server/mods-available/rescue_core_module.inc.php
@@ -38,10 +38,14 @@ class rescue_core_module {
 	 * The monitoring-Data of this module.
 	 * [0] are the actual data, [1] are the data 1 minnute ago [2] are teh data 2 minuntes...
 	 */
+
+
 	private $_monitoringData = array();
+
 	/** The rescue-Data of this module. */
 	private $_rescueData = array();
 
+
 	/**
 	 *  This function is called during ispconfig installation to determine
 	 *  if a symlink shall be created for this plugin.
@@ -50,6 +54,7 @@ class rescue_core_module {
 		return true;
 	}
 
+
 	/**
 	 * This function is called when the module is loaded
 	 */
@@ -57,6 +62,7 @@ class rescue_core_module {
 		$this->_doRescue();
 	}
 
+
 	/**
 	 * This function is called when a change in one of the registered tables is detected.
 	 * The function then raises the events for the plugins.
@@ -74,7 +80,7 @@ class rescue_core_module {
 		 */
 		global $conf;
 		if ((!isset($conf['serverconfig']['rescue']['try_rescue'])) ||
-				((isset($conf['serverconfig']['rescue']['try_rescue'])) && ($conf['serverconfig']['rescue']['try_rescue'] !='y'))){
+			((isset($conf['serverconfig']['rescue']['try_rescue'])) && ($conf['serverconfig']['rescue']['try_rescue'] !='y'))){
 			return;
 		}
 
@@ -250,7 +256,7 @@ class rescue_core_module {
 		 * This means, we check the data 1 minute ago
 		 */
 		if ((!isset($this->_monitoringData[1][0]['data']['webserver'])) ||
-				((isset($this->_monitoringData[1][0]['data']['webserver'])) && ($this->_monitoringData[1][0]['data']['webserver'] != 0))){
+			((isset($this->_monitoringData[1][0]['data']['webserver'])) && ($this->_monitoringData[1][0]['data']['webserver'] != 0))){
 			/*
 			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
 			 * This means, it could be, that the admin is restarting the server.
@@ -322,7 +328,7 @@ class rescue_core_module {
 		 * This means, we check the data 1 minute ago
 		 */
 		if ((!isset($this->_monitoringData[1][0]['data']['mongodbserver'])) ||
-				((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
+			((isset($this->_monitoringData[1][0]['data']['mongodbserver'])) && ($this->_monitoringData[1][0]['data']['mongodbserver'] != 0))){
 			/*
 			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
 			 * This means, it could be, that the admin is restarting the server.
@@ -388,7 +394,7 @@ class rescue_core_module {
 		 * This means, we check the data 1 minute ago
 		 */
 		if ((!isset($this->_monitoringData[1][0]['data']['mysqlserver'])) ||
-				((isset($this->_monitoringData[1][0]['data']['mysqlserver'])) && ($this->_monitoringData[1][0]['data']['mysqlserver'] != 0))){
+			((isset($this->_monitoringData[1][0]['data']['mysqlserver'])) && ($this->_monitoringData[1][0]['data']['mysqlserver'] != 0))){
 			/*
 			 * We do NOT have this data or we have this data, but the webserver was not down 1 minute ago.
 			 * This means, it could be, that the admin is restarting the server.
@@ -433,7 +439,7 @@ class rescue_core_module {
 	 */
 	private function _rescueDaemon($daemon){
 		global $conf;
-		
+
 		$app->uses('system');
 		// if you need to find all restarts search for "['init_scripts']"
 		/*
@@ -447,7 +453,7 @@ class rescue_core_module {
 		 * of the service
 		 */
 		exec($app->system->getinitcommand($daemon, 'stop').' && (sleep 3; kill $!; sleep 2; kill -9 $!) &> /dev/null');
-		
+
 		/*
 		 * OK, we tryed to stop it normally, maybe this worked maybe not. So we have to look
 		 * if the service is already running or not. If so, we have to kill them hard
@@ -459,5 +465,7 @@ class rescue_core_module {
 		 */
 		exec($app->system->getinitcommand($daemon, 'start'));
 	}
+
 }
+
 ?>
diff --git a/server/mods-available/server_module.inc.php b/server/mods-available/server_module.inc.php
index fb7042fecf49efd90159fc59e237defe4a9bf43e..bc846cf53062b0cec4fc653095a00ecace34f6a1 100644
--- a/server/mods-available/server_module.inc.php
+++ b/server/mods-available/server_module.inc.php
@@ -29,97 +29,97 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class server_module {
-	
+
 	var $module_name = 'server_module';
 	var $class_name = 'server_module';
-	var $actions_available = array(	'server_insert',
-									'server_update',
-									'server_delete',
-									'server_ip_insert',
-									'server_ip_update',
-									'server_ip_delete',
-									'firewall_insert',
-									'firewall_update',
-									'firewall_delete',
-									'software_update_inst_insert',
-									'software_update_inst_update',
-									'software_update_inst_delete');
-	
+	var $actions_available = array( 'server_insert',
+		'server_update',
+		'server_delete',
+		'server_ip_insert',
+		'server_ip_update',
+		'server_ip_delete',
+		'firewall_insert',
+		'firewall_update',
+		'firewall_delete',
+		'software_update_inst_insert',
+		'software_update_inst_update',
+		'software_update_inst_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('server','server_module','process');
-		$app->modules->registerTableHook('server_ip','server_module','process');
-		$app->modules->registerTableHook('firewall','server_module','process');
-		$app->modules->registerTableHook('software_update_inst','server_module','process');
-		
+
+		$app->modules->registerTableHook('server', 'server_module', 'process');
+		$app->modules->registerTableHook('server_ip', 'server_module', 'process');
+		$app->modules->registerTableHook('firewall', 'server_module', 'process');
+		$app->modules->registerTableHook('software_update_inst', 'server_module', 'process');
+
 		// Register service
 		//$app->services->registerService('httpd','web_module','restartHttpd');
-		
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'server':
-				if($action == 'i') $app->plugins->raiseEvent('server_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('server_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('server_delete',$data);
+		case 'server':
+			if($action == 'i') $app->plugins->raiseEvent('server_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('server_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('server_delete', $data);
 			break;
-			case 'server_ip':
-				if($action == 'i') $app->plugins->raiseEvent('server_ip_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('server_ip_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('server_ip_delete',$data);
+		case 'server_ip':
+			if($action == 'i') $app->plugins->raiseEvent('server_ip_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('server_ip_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('server_ip_delete', $data);
 			break;
-			case 'firewall':
-				if($action == 'i') $app->plugins->raiseEvent('firewall_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('firewall_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('firewall_delete',$data);
+		case 'firewall':
+			if($action == 'i') $app->plugins->raiseEvent('firewall_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('firewall_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('firewall_delete', $data);
 			break;
-			case 'software_update_inst':
-				if($action == 'i') $app->plugins->raiseEvent('software_update_inst_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('software_update_inst_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('software_update_inst_delete',$data);
+		case 'software_update_inst':
+			if($action == 'i') $app->plugins->raiseEvent('software_update_inst_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('software_update_inst_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('software_update_inst_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 	/*
 	// This function is used
 	function restartHttpd($action = 'restart') {
@@ -134,4 +134,4 @@ class server_module {
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/mods-available/vm_module.inc.php b/server/mods-available/vm_module.inc.php
index 9a7fc371d1209858a67ef4dadcb71ab26beed664..b3c636d6526c65ab212fd02c5a58525863c9fba5 100644
--- a/server/mods-available/vm_module.inc.php
+++ b/server/mods-available/vm_module.inc.php
@@ -29,89 +29,89 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class vm_module {
-	
+
 	var $module_name = 'vm_module';
 	var $class_name = 'vm_module';
-	var $actions_available = array(	'openvz_vm_insert',
-									'openvz_vm_update',
-									'openvz_vm_delete',
-									'openvz_ip_insert',
-									'openvz_ip_update',
-									'openvz_ip_delete',
-									'openvz_ostemplate_insert',
-									'openvz_ostemplate_update',
-									'openvz_ostemplate_delete');
-	
+	var $actions_available = array( 'openvz_vm_insert',
+		'openvz_vm_update',
+		'openvz_vm_delete',
+		'openvz_ip_insert',
+		'openvz_ip_update',
+		'openvz_ip_delete',
+		'openvz_ostemplate_insert',
+		'openvz_ostemplate_update',
+		'openvz_ostemplate_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['vserver'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('openvz_vm',$this->module_name,'process');
-		$app->modules->registerTableHook('openvz_ip',$this->module_name,'process');
-		$app->modules->registerTableHook('openvz_ostemplate',$this->module_name,'process');
-		
+
+		$app->modules->registerTableHook('openvz_vm', $this->module_name, 'process');
+		$app->modules->registerTableHook('openvz_ip', $this->module_name, 'process');
+		$app->modules->registerTableHook('openvz_ostemplate', $this->module_name, 'process');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'openvz_vm':
-				if($action == 'i') $app->plugins->raiseEvent('openvz_vm_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('openvz_vm_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('openvz_vm_delete',$data);
+		case 'openvz_vm':
+			if($action == 'i') $app->plugins->raiseEvent('openvz_vm_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('openvz_vm_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('openvz_vm_delete', $data);
 			break;
-			case 'openvz_ip':
-				if($action == 'i') $app->plugins->raiseEvent('openvz_ip_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('openvz_ip_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('openvz_ip_delete',$data);
+		case 'openvz_ip':
+			if($action == 'i') $app->plugins->raiseEvent('openvz_ip_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('openvz_ip_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('openvz_ip_delete', $data);
 			break;
-			case 'openvz_ostemplate':
-				if($action == 'i') $app->plugins->raiseEvent('openvz_ostemplate_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('openvz_ostemplate_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('openvz_ostemplate_delete',$data);
+		case 'openvz_ostemplate':
+			if($action == 'i') $app->plugins->raiseEvent('openvz_ostemplate_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('openvz_ostemplate_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('openvz_ostemplate_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
+
 
 } // end class
 
diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index 5d7fe66a09c31714d5b8d4f759f07192575ab1e9..680b592857156dabdbbe25d1e79cef8554a3eddf 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -29,206 +29,206 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class web_module {
-	
+
 	var $module_name = 'web_module';
 	var $class_name = 'web_module';
-	var $actions_available = array(	'web_domain_insert',
-									'web_domain_update',
-									'web_domain_delete',
-									'ftp_user_insert',
-									'ftp_user_update',
-									'ftp_user_delete',
-									'shell_user_insert',
-									'shell_user_update',
-									'shell_user_delete',
-									'webdav_user_insert',
-									'webdav_user_update',
-									'webdav_user_delete',
-									'web_folder_insert',
-									'web_folder_update',
-									'web_folder_delete',
-									'web_folder_user_insert',
-									'web_folder_user_update',
-									'web_folder_user_delete',
-									'web_backup_insert',
-									'web_backup_update',
-									'web_backup_delete',
-									'aps_instance_insert',
-									'aps_instance_update',
-									'aps_instance_delete',
-									'aps_instance_setting_insert',
-									'aps_instance_setting_update',
-									'aps_instance_setting_delete',
-									'aps_package_insert',
-									'aps_package_update',
-									'aps_package_delete',
-									'aps_setting_insert',
-									'aps_setting_update',
-									'aps_setting_delete');
-	
+	var $actions_available = array( 'web_domain_insert',
+		'web_domain_update',
+		'web_domain_delete',
+		'ftp_user_insert',
+		'ftp_user_update',
+		'ftp_user_delete',
+		'shell_user_insert',
+		'shell_user_update',
+		'shell_user_delete',
+		'webdav_user_insert',
+		'webdav_user_update',
+		'webdav_user_delete',
+		'web_folder_insert',
+		'web_folder_update',
+		'web_folder_delete',
+		'web_folder_user_insert',
+		'web_folder_user_update',
+		'web_folder_user_delete',
+		'web_backup_insert',
+		'web_backup_update',
+		'web_backup_delete',
+		'aps_instance_insert',
+		'aps_instance_update',
+		'aps_instance_delete',
+		'aps_instance_setting_insert',
+		'aps_instance_setting_update',
+		'aps_instance_setting_delete',
+		'aps_package_insert',
+		'aps_package_update',
+		'aps_package_delete',
+		'aps_setting_insert',
+		'aps_setting_update',
+		'aps_setting_delete');
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the module is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
-		Annonce the actions that where provided by this module, so plugins 
+		Annonce the actions that where provided by this module, so plugins
 		can register on them.
 		*/
-		
-		$app->plugins->announceEvents($this->module_name,$this->actions_available);
-		
+
+		$app->plugins->announceEvents($this->module_name, $this->actions_available);
+
 		/*
 		As we want to get notified of any changes on several database tables,
 		we register for them.
-		
+
 		The following function registers the function "functionname"
- 		to be executed when a record for the table "dbtable" is 
+ 		to be executed when a record for the table "dbtable" is
  		processed in the sys_datalog. "classname" is the name of the
  		class that contains the function functionname.
 		*/
-		
-		$app->modules->registerTableHook('web_domain','web_module','process');
-		$app->modules->registerTableHook('ftp_user','web_module','process');
-		$app->modules->registerTableHook('shell_user','web_module','process');
-		$app->modules->registerTableHook('webdav_user','web_module','process');
-		$app->modules->registerTableHook('web_folder','web_module','process');
-		$app->modules->registerTableHook('web_folder_user','web_module','process');
-		$app->modules->registerTableHook('web_backup','web_module','process');
-		$app->modules->registerTableHook('aps_instances','web_module','process');
-		$app->modules->registerTableHook('aps_instances_settings','web_module','process');
-		$app->modules->registerTableHook('aps_packages','web_module','process');
-		$app->modules->registerTableHook('aps_settings','web_module','process');
-		
+
+		$app->modules->registerTableHook('web_domain', 'web_module', 'process');
+		$app->modules->registerTableHook('ftp_user', 'web_module', 'process');
+		$app->modules->registerTableHook('shell_user', 'web_module', 'process');
+		$app->modules->registerTableHook('webdav_user', 'web_module', 'process');
+		$app->modules->registerTableHook('web_folder', 'web_module', 'process');
+		$app->modules->registerTableHook('web_folder_user', 'web_module', 'process');
+		$app->modules->registerTableHook('web_backup', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_instances', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_instances_settings', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_packages', 'web_module', 'process');
+		$app->modules->registerTableHook('aps_settings', 'web_module', 'process');
+
 		// Register service
-		$app->services->registerService('httpd','web_module','restartHttpd');
-		$app->services->registerService('php-fpm','web_module','restartPHP_FPM');
-		
+		$app->services->registerService('httpd', 'web_module', 'restartHttpd');
+		$app->services->registerService('php-fpm', 'web_module', 'restartPHP_FPM');
+
 	}
-	
+
 	/*
 	 This function is called when a change in one of the registered tables is detected.
 	 The function then raises the events for the plugins.
 	*/
 
-	function process($tablename,$action,$data) {
+	function process($tablename, $action, $data) {
 		global $app;
-		
+
 		switch ($tablename) {
-			case 'web_domain':
-				if($action == 'i') $app->plugins->raiseEvent('web_domain_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_domain_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_domain_delete',$data);
+		case 'web_domain':
+			if($action == 'i') $app->plugins->raiseEvent('web_domain_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_domain_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_domain_delete', $data);
 			break;
-			case 'ftp_user':
-				if($action == 'i') $app->plugins->raiseEvent('ftp_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('ftp_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('ftp_user_delete',$data);
+		case 'ftp_user':
+			if($action == 'i') $app->plugins->raiseEvent('ftp_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('ftp_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('ftp_user_delete', $data);
 			break;
-			case 'shell_user':
-				if($action == 'i') $app->plugins->raiseEvent('shell_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('shell_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('shell_user_delete',$data);
+		case 'shell_user':
+			if($action == 'i') $app->plugins->raiseEvent('shell_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('shell_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('shell_user_delete', $data);
 			break;
-			case 'webdav_user':
-				if($action == 'i') $app->plugins->raiseEvent('webdav_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('webdav_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('webdav_user_delete',$data);
+		case 'webdav_user':
+			if($action == 'i') $app->plugins->raiseEvent('webdav_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('webdav_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('webdav_user_delete', $data);
 			break;
-			case 'web_folder':
-				if($action == 'i') $app->plugins->raiseEvent('web_folder_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_folder_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_folder_delete',$data);
+		case 'web_folder':
+			if($action == 'i') $app->plugins->raiseEvent('web_folder_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_folder_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_folder_delete', $data);
 			break;
-			case 'web_folder_user':
-				if($action == 'i') $app->plugins->raiseEvent('web_folder_user_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_folder_user_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_folder_user_delete',$data);
+		case 'web_folder_user':
+			if($action == 'i') $app->plugins->raiseEvent('web_folder_user_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_folder_user_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_folder_user_delete', $data);
 			break;
-			case 'web_backup':
-				if($action == 'i') $app->plugins->raiseEvent('web_backup_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('web_backup_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('web_backup_delete',$data);
+		case 'web_backup':
+			if($action == 'i') $app->plugins->raiseEvent('web_backup_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('web_backup_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('web_backup_delete', $data);
 			break;
-			case 'aps_instances':
-				if($action == 'i') $app->plugins->raiseEvent('aps_instance_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_instance_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_instance_delete',$data);
+		case 'aps_instances':
+			if($action == 'i') $app->plugins->raiseEvent('aps_instance_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_instance_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_instance_delete', $data);
 			break;
-			case 'aps_instances_settings':
-				if($action == 'i') $app->plugins->raiseEvent('aps_instance_setting_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_instance_setting_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_instance_setting_delete',$data);
+		case 'aps_instances_settings':
+			if($action == 'i') $app->plugins->raiseEvent('aps_instance_setting_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_instance_setting_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_instance_setting_delete', $data);
 			break;
-			case 'aps_packages':
-				if($action == 'i') $app->plugins->raiseEvent('aps_package_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_package_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_package_delete',$data);
+		case 'aps_packages':
+			if($action == 'i') $app->plugins->raiseEvent('aps_package_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_package_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_package_delete', $data);
 			break;
-			case 'aps_settings':
-				if($action == 'i') $app->plugins->raiseEvent('aps_setting_insert',$data);
-				if($action == 'u') $app->plugins->raiseEvent('aps_setting_update',$data);
-				if($action == 'd') $app->plugins->raiseEvent('aps_setting_delete',$data);
+		case 'aps_settings':
+			if($action == 'i') $app->plugins->raiseEvent('aps_setting_insert', $data);
+			if($action == 'u') $app->plugins->raiseEvent('aps_setting_update', $data);
+			if($action == 'd') $app->plugins->raiseEvent('aps_setting_delete', $data);
 			break;
 		} // end switch
 	} // end function
-	
-	
+
+
 	// This function is used
 	function restartHttpd($action = 'restart') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses('getconf,system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		$daemon = '';
 		switch ($web_config['server_type']) {
-			case 'nginx':
-				$daemon = $web_config['server_type'];
-				break;
-			default:
-				if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
-					$daemon = 'httpd';
-				} else {
-					$daemon = 'apache2';
-				}
+		case 'nginx':
+			$daemon = $web_config['server_type'];
+			break;
+		default:
+			if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
+				$daemon = 'httpd';
+			} else {
+				$daemon = 'apache2';
+			}
 		}
 
 		$retval = array('output' => '', 'retval' => 0);
 		if($action == 'restart') {
 			exec($app->system->getinitcommand($daemon, 'restart').' 2>&1', $retval['output'], $retval['retval']);
-			
+
 		} else {
 			exec($app->system->getinitcommand($daemon, 'reload').' 2>&1', $retval['output'], $retval['retval']);
 		}
 		return $retval;
 	}
-	
+
 	function restartPHP_FPM($action = 'restart') {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses('getconf,system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		list($action, $init_script) = explode(':', $action);
-		
+
 		if(!$init_script){
 			//$init_script = $conf['init_scripts'].'/'.$web_config['php_fpm_init_script'];
 			$initcommand = $app->system->getinitcommand($web_config['php_fpm_init_script'], $action);
@@ -236,7 +236,7 @@ class web_module {
 			$path_parts = pathinfo($init_script);
 			$initcommand = $app->system->getinitcommand($path_parts['basename'], $action, $path_parts['dirname']);
 		}
-		
+
 		$retval = array('output' => '', 'retval' => 0);
 		exec($initcommand.' 2>&1', $retval['output'], $retval['retval']);
 		return $retval;
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index fb741dc48efa677a768e6f39de09b623cc97b423..17d30d89ede36c11db77c72d5451c285513dece9 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -61,142 +61,142 @@ class apache2_plugin {
 		/*
 		Register for the events
 		*/
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'ssl');
-
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
-
-		$app->plugins->registerEvent('server_ip_insert',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_update',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_delete',$this->plugin_name,'server_ip');
-
-		$app->plugins->registerEvent('webdav_user_insert',$this->plugin_name,'webdav');
-		$app->plugins->registerEvent('webdav_user_update',$this->plugin_name,'webdav');
-		$app->plugins->registerEvent('webdav_user_delete',$this->plugin_name,'webdav');
-		
-		$app->plugins->registerEvent('client_delete',$this->plugin_name,'client_delete');
-		
-		$app->plugins->registerEvent('web_folder_user_insert',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_update',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_delete',$this->plugin_name,'web_folder_user');
-		
-		$app->plugins->registerEvent('web_folder_update',$this->plugin_name,'web_folder_update');
-		$app->plugins->registerEvent('web_folder_delete',$this->plugin_name,'web_folder_delete');
-		
-		$app->plugins->registerEvent('ftp_user_delete',$this->plugin_name,'ftp_user_delete');
-		
-        $app->plugins->registerAction('php_ini_changed', $this->plugin_name, 'php_ini_changed');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+		$app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
+
+		$app->plugins->registerEvent('webdav_user_insert', $this->plugin_name, 'webdav');
+		$app->plugins->registerEvent('webdav_user_update', $this->plugin_name, 'webdav');
+		$app->plugins->registerEvent('webdav_user_delete', $this->plugin_name, 'webdav');
+
+		$app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete');
+
+		$app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user');
+
+		$app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
+		$app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
+
+		$app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'ftp_user_delete');
+
+		$app->plugins->registerAction('php_ini_changed', $this->plugin_name, 'php_ini_changed');
 	}
-    
-    // check for php.ini changes
-    
-    
-    // Handle php.ini changes
-    function php_ini_changed($event_name, $data) {
-        global $app, $conf;
-        
-        $app->uses('getconf');
+
+	// check for php.ini changes
+
+
+	// Handle php.ini changes
+	function php_ini_changed($event_name, $data) {
+		global $app, $conf;
+
+		$app->uses('getconf');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
-        
-        /* $data contains an array with these keys:
+
+		/* $data contains an array with these keys:
          * file -> full path of changed php_ini
          * mode -> web_domain php modes to change (mod, fast-cgi, php-fpm or '' for all except 'mod')
          * php_version -> php ini path that changed (additional php versions)
          */
-        
-        $qrystr = "SELECT * FROM web_domain WHERE custom_php_ini != ''";
-        if($data['mode'] == 'mod') {
-            $qrystr .= " AND php = 'mod'";
-        } elseif($data['mode'] == 'fast-cgi') {
-            $qrystr .= " AND php = 'fast-cgi'";
-            if($data['php_version']) {
-                $qrystr .= " AND fastcgi_php_version LIKE '%:" . $app->db->quote($data['php_version']) . "'";
-            }
-        } elseif($data['mode'] == 'php-fpm') {
-            $qrystr .= " AND php = 'php-fpm'";
-            if($data['php_version']) {
-                $qrystr .= " AND fastcgi_php_version LIKE '%:" . $app->db->quote($data['php_version']) . ":%'";
-            }
-        } else {
-            $qrystr .= " AND php != 'mod' AND php != 'fast-cgi'";
-        }
-        
-        
-        //** Get all the webs
-        $web_domains = $app->db->queryAllRecords($qrystr);
-        foreach($web_domains as $web_data) {
-            $custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$web_data['system_user'];
-            $web_folder = 'web';
-            if($web_data['type'] == 'vhostsubdomain') {
-                $web_folder = $web_data['web_folder'];
-                $custom_php_ini_dir .= '_' . $web_folder;
-            }
-            if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
-
-
-            if(!is_dir($custom_php_ini_dir)) $app->system->mkdir($custom_php_ini_dir);
-            $php_ini_content = '';
-            if($web_data['php'] == 'mod') {
-                $master_php_ini_path = $web_config['php_ini_path_apache'];
-            } else {
-                if($web_data['php'] == 'fast-cgi' && file_exists($fastcgi_config["fastcgi_phpini_path"])) {
-                    $master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"];
-                } else {
-                    $master_php_ini_path = $web_config['php_ini_path_cgi'];
-                }
-            }
-            if($master_php_ini_path != '' && substr($master_php_ini_path,-7) == 'php.ini' && is_file($master_php_ini_path)) {
-                $php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
-            }
-            $php_ini_content .= str_replace("\r",'',trim($web_data['custom_php_ini']));
-            $app->system->file_put_contents($custom_php_ini_dir.'/php.ini',$php_ini_content);
-            $app->log('Info: rewrote custom php.ini for web ' . $web_data['domain_id'] . ' (' . $web_data['domain'] . ').',LOGLEVEL_DEBUG);
-        }
-        
-        if(count($web_domains) > 0) {
-            //* We do not check the apache config here - we only changed the php.ini
-            //* Check if this is a chrooted setup
-            if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
-                $apache_chrooted = true;
-                $app->log('Info: Apache is chrooted.',LOGLEVEL_DEBUG);
-            } else {
-                $apache_chrooted = false;
-            }
-            
-            $app->log('Info: rewrote all php.ini and reloading apache now.',LOGLEVEL_DEBUG);
-            if($apache_chrooted) {
-                $app->services->restartServiceDelayed('httpd','restart');
-            } else {
-                // request a httpd reload when all records have been processed
-                $app->services->restartServiceDelayed('httpd','reload');
-            }
-        } else {
-            $app->log('Info: No webs affected by php.ini change.',LOGLEVEL_DEBUG);
-        }
-    }
-    
+
+		$qrystr = "SELECT * FROM web_domain WHERE custom_php_ini != ''";
+		if($data['mode'] == 'mod') {
+			$qrystr .= " AND php = 'mod'";
+		} elseif($data['mode'] == 'fast-cgi') {
+			$qrystr .= " AND php = 'fast-cgi'";
+			if($data['php_version']) {
+				$qrystr .= " AND fastcgi_php_version LIKE '%:" . $app->db->quote($data['php_version']) . "'";
+			}
+		} elseif($data['mode'] == 'php-fpm') {
+			$qrystr .= " AND php = 'php-fpm'";
+			if($data['php_version']) {
+				$qrystr .= " AND fastcgi_php_version LIKE '%:" . $app->db->quote($data['php_version']) . ":%'";
+			}
+		} else {
+			$qrystr .= " AND php != 'mod' AND php != 'fast-cgi'";
+		}
+
+
+		//** Get all the webs
+		$web_domains = $app->db->queryAllRecords($qrystr);
+		foreach($web_domains as $web_data) {
+			$custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$web_data['system_user'];
+			$web_folder = 'web';
+			if($web_data['type'] == 'vhostsubdomain') {
+				$web_folder = $web_data['web_folder'];
+				$custom_php_ini_dir .= '_' . $web_folder;
+			}
+			if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
+
+
+			if(!is_dir($custom_php_ini_dir)) $app->system->mkdir($custom_php_ini_dir);
+			$php_ini_content = '';
+			if($web_data['php'] == 'mod') {
+				$master_php_ini_path = $web_config['php_ini_path_apache'];
+			} else {
+				if($web_data['php'] == 'fast-cgi' && file_exists($fastcgi_config["fastcgi_phpini_path"])) {
+					$master_php_ini_path = $fastcgi_config["fastcgi_phpini_path"];
+				} else {
+					$master_php_ini_path = $web_config['php_ini_path_cgi'];
+				}
+			}
+			if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) {
+				$php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
+			}
+			$php_ini_content .= str_replace("\r", '', trim($web_data['custom_php_ini']));
+			$app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content);
+			$app->log('Info: rewrote custom php.ini for web ' . $web_data['domain_id'] . ' (' . $web_data['domain'] . ').', LOGLEVEL_DEBUG);
+		}
+
+		if(count($web_domains) > 0) {
+			//* We do not check the apache config here - we only changed the php.ini
+			//* Check if this is a chrooted setup
+			if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
+				$apache_chrooted = true;
+				$app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
+			} else {
+				$apache_chrooted = false;
+			}
+
+			$app->log('Info: rewrote all php.ini and reloading apache now.', LOGLEVEL_DEBUG);
+			if($apache_chrooted) {
+				$app->services->restartServiceDelayed('httpd', 'restart');
+			} else {
+				// request a httpd reload when all records have been processed
+				$app->services->restartServiceDelayed('httpd', 'reload');
+			}
+		} else {
+			$app->log('Info: No webs affected by php.ini change.', LOGLEVEL_DEBUG);
+		}
+	}
+
 	// Handle the creation of SSL certificates
-	function ssl($event_name,$data) {
+	function ssl($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 
 		// load the server configuration options
 		$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.cnf',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;
 
 		// if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl');
 		if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -206,32 +206,32 @@ class apache2_plugin {
 
 		//* Create a SSL Certificate, but only if this is not a mirror server.
 		if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) {
-			
+
 			$this->ssl_certificate_changed = true;
-			
+
 			//* Rename files if they exist
 			if(file_exists($key_file)){
-				$app->system->rename($key_file,$key_file.'.bak');
-				$app->system->chmod($key_file.'.bak',0400);
+				$app->system->rename($key_file, $key_file.'.bak');
+				$app->system->chmod($key_file.'.bak', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->rename($key_file2,$key_file2.'.bak');
-				$app->system->chmod($key_file2.'.bak',0400);
+				$app->system->rename($key_file2, $key_file2.'.bak');
+				$app->system->chmod($key_file2.'.bak', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->rename($csr_file,$csr_file.'.bak');
-			if(file_exists($crt_file)) $app->system->rename($crt_file,$crt_file.'.bak');
-			
+			if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak');
+			if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak');
+
 			$rand_file = $ssl_dir.'/random_file';
-			$rand_data = md5(uniqid(microtime(),1));
+			$rand_data = md5(uniqid(microtime(), 1));
 			for($i=0; $i<1000; $i++) {
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
 			}
 			$app->system->file_put_contents($rand_file, $rand_data);
 
-			$ssl_password = substr(md5(uniqid(microtime(),1)), 0, 15);
+			$ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15);
 
 			$ssl_cnf = "        RANDFILE               = $rand_file
 
@@ -256,7 +256,7 @@ class apache2_plugin {
         challengePassword              = A challenge password";
 
 			$ssl_cnf_file = $ssl_dir.'/openssl.conf';
-			$app->system->file_put_contents($ssl_cnf_file,$ssl_cnf);
+			$app->system->file_put_contents($ssl_cnf_file, $ssl_cnf);
 
 			$rand_file = escapeshellcmd($rand_file);
 			$key_file = escapeshellcmd($key_file);
@@ -271,7 +271,7 @@ class apache2_plugin {
 			if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate
 
 			if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) {
-				
+
 				exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $key_file 2048");
 				exec("openssl req -new -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -out $csr_file -days $ssl_days -config $config_file");
 				exec("openssl rsa -passin pass:$ssl_password -in $key_file -out $key_file2");
@@ -279,18 +279,18 @@ class apache2_plugin {
 				if(file_exists($web_config['CA_path'].'/openssl.cnf'))
 				{
 					exec("openssl ca -batch -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file");
-					$app->log("Creating CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file",LOGLEVEL_ERROR);
+					$app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file", LOGLEVEL_ERROR);
 				};
 				if (@filesize($crt_file)==0 || !file_exists($crt_file)){
 					exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -in $csr_file -out $crt_file -days $ssl_days -config $config_file ");
-					$app->log("Creating self-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
+					$app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				};
-			
+
 			}
 
-			$app->system->chmod($key_file,0400);
-			$app->system->chmod($key_file2,0400);
+			$app->system->chmod($key_file, 0400);
+			$app->system->chmod($key_file2, 0400);
 			@$app->system->unlink($config_file);
 			@$app->system->unlink($rand_file);
 			$ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
@@ -314,29 +314,29 @@ class apache2_plugin {
 			$csr_file = $ssl_dir.'/'.$domain.".csr";
 			$crt_file = $ssl_dir.'/'.$domain.".crt";
 			$bundle_file = $ssl_dir.'/'.$domain.".bundle";
-			
+
 			//* Backup files
 			if(file_exists($key_file)){
-				$app->system->copy($key_file,$key_file.'~');
-				$app->system->chmod($key_file.'~',0400);
+				$app->system->copy($key_file, $key_file.'~');
+				$app->system->chmod($key_file.'~', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->copy($key_file2,$key_file2.'~');
-				$app->system->chmod($key_file2.'~',0400);
+				$app->system->copy($key_file2, $key_file2.'~');
+				$app->system->chmod($key_file2.'~', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->copy($csr_file,$csr_file.'~');
-			if(file_exists($crt_file)) $app->system->copy($crt_file,$crt_file.'~');
-			if(file_exists($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'~');
-			
+			if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~');
+			if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~');
+			if(file_exists($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'~');
+
 			//* Write new ssl files
-			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]);
-			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_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]);
+			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"]);
+
 			//* 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);
+				$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 */
@@ -344,13 +344,13 @@ class apache2_plugin {
 				/* Update also the master-DB of the Server-Farm */
 				$app->dbmaster->query("UPDATE web_domain SET ssl_key = '$ssl_key2' WHERE domain = '".$data['new']['domain']."'");
 			}
-			
+
 			/* Update the DB of the (local) Server */
 			$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			
+
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Saving SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		//* Delete a SSL certificate
@@ -361,10 +361,10 @@ class apache2_plugin {
 			$crt_file = $ssl_dir.'/'.$domain.'.crt';
 			$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
 			if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf'))
-				{
-					exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
-					$app->log("Revoking CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-				};
+			{
+				exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
+				$app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+			};
 			$app->system->unlink($csr_file);
 			$app->system->unlink($crt_file);
 			$app->system->unlink($bundle_file);
@@ -374,24 +374,24 @@ class apache2_plugin {
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Deleting SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 	}
 
 
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
 
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 
 
 	}
 
 
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
 
 		if($this->action != 'insert') $this->action = 'update';
@@ -407,7 +407,7 @@ class apache2_plugin {
 				$data['new'] = $tmp;
 				$data['old'] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
 
 			// This is not a vhost, so we need to update the parent record instead.
@@ -424,45 +424,45 @@ class apache2_plugin {
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
 			$apache_chrooted = true;
-			$app->log('Info: Apache is chrooted.',LOGLEVEL_DEBUG);
+			$app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
 		} else {
 			$apache_chrooted = false;
 		}
 
 		if($data['new']['document_root'] == '') {
-			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set',LOGLEVEL_WARN);
+			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN);
 			return 0;
 		}
 		if($data['new']['system_user'] == 'root' or $data['new']['system_group'] == 'root') {
-			$app->log('Websites cannot be owned by the root user or group.',LOGLEVEL_WARN);
+			$app->log('Websites cannot be owned by the root user or group.', LOGLEVEL_WARN);
 			return 0;
 		}
 		if(trim($data['new']['domain']) == '') {
-			$app->log('domain is empty',LOGLEVEL_WARN);
+			$app->log('domain is empty', LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $web_folder = 'web';
-        $log_folder = 'log';
-        if($data['new']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
-            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
-            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
-            $web_folder = $data['new']['web_folder'];
-            $log_folder .= '/' . $subdomain_host;
-            unset($tmp);
-        }
+
+		$web_folder = 'web';
+		$log_folder = 'log';
+		if($data['new']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+			$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+			if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
+			$web_folder = $data['new']['web_folder'];
+			$log_folder .= '/' . $subdomain_host;
+			unset($tmp);
+		}
 
 		// Create group and user, if not exist
 		$app->uses('system');
-		
+
 		if($web_config['connect_userid_to_webid'] == 'y') {
 			//* Calculate the uid and gid
 			$connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']);
 			$fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']);
 			$fixed_uid_param = '--uid '.$fixed_uid_gid;
 			$fixed_gid_param = '--gid '.$fixed_uid_gid;
-			
+
 			//* Check if a ispconfigend user and group exists and create them
 			if(!$app->system->is_group('ispconfigend')) {
 				exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
@@ -479,7 +479,7 @@ class apache2_plugin {
 		if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
 			exec('groupadd '.$fixed_gid_param.' '.$groupname);
 			if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
-			$app->log('Adding the group: '.$groupname,LOGLEVEL_DEBUG);
+			$app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG);
 		}
 
 		$username = escapeshellcmd($data['new']['system_user']);
@@ -491,7 +491,7 @@ class apache2_plugin {
 				exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 				if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 			}
-			$app->log('Adding the user: '.$username,LOGLEVEL_DEBUG);
+			$app->log('Adding the user: '.$username, LOGLEVEL_DEBUG);
 		}
 
 		//* If the client of the site has been changed, we have a change of the document root
@@ -503,77 +503,77 @@ class apache2_plugin {
 			unset($old_client);
 
 			//* Remove the old symlinks
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$old_client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// create the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
-			
+
 			//* Remove protection of old folders
-			$app->system->web_folder_protection($data['old']['document_root'],false);
-            
-            if($data["new"]["type"] != "vhostsubdomain") {
-                //* Move the site data
-                $tmp_docroot = explode('/',$data['new']['document_root']);
-                unset($tmp_docroot[count($tmp_docroot)-1]);
-                $new_dir = implode('/',$tmp_docroot);
-
-                $tmp_docroot = explode('/',$data['old']['document_root']);
-                unset($tmp_docroot[count($tmp_docroot)-1]);
-                $old_dir = implode('/',$tmp_docroot);
-
-                //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
-                if(@is_dir($data['new']['document_root'])) {
-                    $app->system->web_folder_protection($data['new']['document_root'],false);
-                    $app->system->rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
-                    $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'),LOGLEVEL_DEBUG);
-                }
-                
-                //* Create new base directory, if it does not exist yet
-                if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
-                $app->system->web_folder_protection($data['old']['document_root'],false);
-                exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
-                //$app->system->rename($data['old']['document_root'],$new_dir);
-                $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG);
-
-                // Handle the change in php_open_basedir
-                $data['new']['php_open_basedir'] = str_replace($data['old']['document_root'],$data['new']['document_root'],$data['old']['php_open_basedir']);
-
-                //* Change the owner of the website files to the new website owner
-                exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
-
-                //* Change the home directory and group of the website user
-                $command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod';
-                $command .= ' --home '.escapeshellcmd($data['new']['document_root']);
-                $command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
-                $command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
-                exec($command);
-            }
-            
+			$app->system->web_folder_protection($data['old']['document_root'], false);
+
+			if($data["new"]["type"] != "vhostsubdomain") {
+				//* Move the site data
+				$tmp_docroot = explode('/', $data['new']['document_root']);
+				unset($tmp_docroot[count($tmp_docroot)-1]);
+				$new_dir = implode('/', $tmp_docroot);
+
+				$tmp_docroot = explode('/', $data['old']['document_root']);
+				unset($tmp_docroot[count($tmp_docroot)-1]);
+				$old_dir = implode('/', $tmp_docroot);
+
+				//* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
+				if(@is_dir($data['new']['document_root'])) {
+					$app->system->web_folder_protection($data['new']['document_root'], false);
+					$app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
+					$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
+				}
+
+				//* Create new base directory, if it does not exist yet
+				if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
+				$app->system->web_folder_protection($data['old']['document_root'], false);
+				exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
+				//$app->system->rename($data['old']['document_root'],$new_dir);
+				$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG);
+
+				// Handle the change in php_open_basedir
+				$data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']);
+
+				//* Change the owner of the website files to the new website owner
+				exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
+
+				//* Change the home directory and group of the website user
+				$command = 'killall -u '.escapeshellcmd($data['new']['system_user']).' ; usermod';
+				$command .= ' --home '.escapeshellcmd($data['new']['document_root']);
+				$command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
+				$command .= ' '.escapeshellcmd($data['new']['system_user']).' 2>/dev/null';
+				exec($command);
+			}
+
 			if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-			
+
 			//* Change the log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 
 		}
 
 		//print_r($data);
 
 		// Check if the directories are there and create them if necessary.
-		$app->system->web_folder_protection($data['new']['document_root'],false);
-		
+		$app->system->web_folder_protection($data['new']['document_root'], false);
+
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
 		//if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
@@ -581,44 +581,44 @@ class apache2_plugin {
 		if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
 		if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
 		if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
-		
+
 		//* Create the new private directory
 		if(!is_dir($data['new']['document_root'].'/private')) {
 			$app->system->mkdirpath($data['new']['document_root'].'/private');
-			$app->system->chmod($data['new']['document_root'].'/private',0710);
-			$app->system->chown($data['new']['document_root'].'/private',$username);
-			$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+			$app->system->chmod($data['new']['document_root'].'/private', 0710);
+			$app->system->chown($data['new']['document_root'].'/private', $username);
+			$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 		}
-		
-		
+
+
 		// Remove the symlink for the site, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
 			if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']);
 			if(is_link($data['old']['document_root'].'/'.$log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$log_folder);
-			
+
 			//* remove old log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
-			
+			$app->system->removeLine('/etc/fstab', $fstab_line);
+
 			//* Unmount log directory
 			exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
 		}
-		
+
 		//* Create the log dir if nescessary and mount it
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
 			if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
-			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+			$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
-		
-		$app->system->web_folder_protection($data['new']['document_root'],true);
+
+		$app->system->web_folder_protection($data['new']['document_root'], true);
 
 		// Get the client ID
 		$client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['new']['sys_groupid']));
@@ -627,28 +627,28 @@ class apache2_plugin {
 
 		// Remove old symlinks, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// remove the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
 		}
 
 		// Create the symlinks for the sites
-		$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+		$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 		if(is_array($tmp_symlinks_array)) {
 			foreach($tmp_symlinks_array as $tmp_symlink) {
-				$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-				$tmp_symlink = str_replace('[website_domain]',$data['new']['domain'],$tmp_symlink);
+				$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+				$tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink);
 				// Remove trailing slash
 				if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 				//* Remove symlink if target folder has been changed.
@@ -657,64 +657,64 @@ class apache2_plugin {
 				}
 				// create the symlinks, if not exist
 				if(!is_link($tmp_symlink)) {
-//					exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+					//     exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					if ($web_config["website_symlinks_rel"] == 'y') {
 						$this->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink));
 					} else {
 						exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					}
 
-					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink,LOGLEVEL_DEBUG);
+					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG);
 				}
 			}
 		}
 
 
 
-        // Install the Standard or Custom Error, Index and other related files
-        // /usr/local/ispconfig/server/conf is for the standard files
-        // /usr/local/ispconfig/server/conf-custom is for the custom files
-        // setting a local var here
-           
-        // normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
+		// Install the Standard or Custom Error, Index and other related files
+		// /usr/local/ispconfig/server/conf is for the standard files
+		// /usr/local/ispconfig/server/conf-custom is for the custom files
+		// setting a local var here
+
+		// normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
 		if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-            
-            // Copy the error pages
+
+			// Copy the error pages
 			if($data['new']['errordocs']) {
 				$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 				else {
 					if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 						exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 					}
 					else {
-						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 					}
 				}
 				exec('chmod -R a+r '.$error_page_path);
 			}
 
-			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
-            
-			if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-            }
-			if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-                if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
-                    exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-            }
+			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+
+				if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 					if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
@@ -724,17 +724,17 @@ class apache2_plugin {
 
 			//** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
 		} elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
-            
+
 			$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 			}
 			exec('chmod -R a+r '.$error_page_path);
@@ -763,34 +763,34 @@ class apache2_plugin {
 				$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')) {
-			
-			$app->system->web_folder_protection($data['new']['document_root'],false);
-			
+
+			$app->system->web_folder_protection($data['new']['document_root'], false);
+
 			//* Check if we have the new private folder and create it if nescessary
 			if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private');
-			
+
 			if($web_config['security_level'] == 20) {
-				
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0710);
-				$app->system->chmod($data['new']['document_root'].'/webdav',0710);
-				$app->system->chmod($data['new']['document_root'].'/private',0710);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
+
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0710);
+				$app->system->chmod($data['new']['document_root'].'/webdav', 0710);
+				$app->system->chmod($data['new']['document_root'].'/private', 0710);
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
 
 				// make tmp directory writable for Apache and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-			
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-				
+
 				if($web_config['add_web_users_to_sshusers_group'] == 'y') {
 					$command = 'usermod';
 					$command .= ' --groups sshusers';
@@ -809,116 +809,116 @@ class apache2_plugin {
 					$app->system->server_conf['group_datei'] = $tmp_groupfile;
 					unset($tmp_groupfile);
 				}
-				
+
 				//* Chown all default directories
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				$app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
-				$app->system->chown($data['new']['document_root'].'/webdav',$username);
-				$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
-				$app->system->chown($data['new']['document_root'].'/private',$username);
-				$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+				$app->system->chown($data['new']['document_root'].'/webdav', $username);
+				$app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
+				$app->system->chown($data['new']['document_root'].'/private', $username);
+				$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 
 				// If the security Level is set to medium
 			} else {
 
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0755);
-				$app->system->chmod($data['new']['document_root'].'/webdav',0755);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
-				$app->system->chmod($data['new']['document_root'].'/cgi-bin',0755);
-				
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0755);
+				$app->system->chmod($data['new']['document_root'].'/webdav', 0755);
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+				$app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755);
+
 				// make temp directory writable for Apache and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-				
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-                
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				
-                $app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
-				$app->system->chown($data['new']['document_root'].'/webdav',$username);
-				$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
+
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
+				$app->system->chown($data['new']['document_root'].'/webdav', $username);
+				$app->system->chgrp($data['new']['document_root'].'/webdav', $groupname);
 			}
 		} elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) {
 			if($web_config['security_level'] == 20) {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0710);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            } else {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0755);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            }
-        }
-		
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			} else {
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			}
+		}
+
 		//* Protect web folders
-		$app->system->web_folder_protection($data['new']['document_root'],true);
+		$app->system->web_folder_protection($data['new']['document_root'], true);
 
 		if($data['new']['type'] == 'vhost') {
-            // Change the ownership of the error log to the root user
-            if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
-            $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-            $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-        }
+			// Change the ownership of the error log to the root user
+			if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
+			$app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+			$app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+		}
 
 		//* Write the custom php.ini file, if custom_php_ini fieled is not empty
 		$custom_php_ini_dir = $web_config['website_basedir'].'/conf/'.$data['new']['system_user'];
-        if($data['new']['type'] == 'vhostsubdomain') $custom_php_ini_dir .= '_' . $web_folder;
+		if($data['new']['type'] == 'vhostsubdomain') $custom_php_ini_dir .= '_' . $web_folder;
 		if(!is_dir($web_config['website_basedir'].'/conf')) $app->system->mkdir($web_config['website_basedir'].'/conf');
-		
+
 		//* add open_basedir restriction to custom php.ini content, required for suphp only
-		if(!stristr($data['new']['custom_php_ini'],'open_basedir') && $data['new']['php'] == 'suphp') {
+		if(!stristr($data['new']['custom_php_ini'], 'open_basedir') && $data['new']['php'] == 'suphp') {
 			$data['new']['custom_php_ini'] .= "\nopen_basedir = '".$data['new']['php_open_basedir']."'\n";
 		}
-		
+
 		$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
-		
+
 		if(trim($data['new']['fastcgi_php_version']) != ''){
 			list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
 			if(is_file($custom_fastcgi_php_ini_dir)) $custom_fastcgi_php_ini_dir = dirname($custom_fastcgi_php_ini_dir);
-			if(substr($custom_fastcgi_php_ini_dir,-1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir,0,-1);
+			if(substr($custom_fastcgi_php_ini_dir, -1) == '/') $custom_fastcgi_php_ini_dir = substr($custom_fastcgi_php_ini_dir, 0, -1);
 		}
 
 		//* Create custom php.ini
@@ -941,18 +941,18 @@ class apache2_plugin {
 					$master_php_ini_path = $web_config['php_ini_path_cgi'];
 				}
 			}
-			
+
 			//* Add php.ini to the path in case that the master_php_ini_path is a directory
 			if($master_php_ini_path != '' && is_dir($master_php_ini_path) && is_file($master_php_ini_path.'/php.ini')) {
-				if(substr($master_php_ini_path,-1) == '/') $master_php_ini_path = substr($master_php_ini_path,0,-1);
+				if(substr($master_php_ini_path, -1) == '/') $master_php_ini_path = substr($master_php_ini_path, 0, -1);
 				$master_php_ini_path .= '/php.ini';
 			}
-			
-			if($master_php_ini_path != '' && substr($master_php_ini_path,-7) == 'php.ini' && is_file($master_php_ini_path)) {
+
+			if($master_php_ini_path != '' && substr($master_php_ini_path, -7) == 'php.ini' && is_file($master_php_ini_path)) {
 				$php_ini_content .= $app->system->file_get_contents($master_php_ini_path)."\n";
 			}
-			$php_ini_content .= str_replace("\r",'',trim($data['new']['custom_php_ini']));
-			$app->system->file_put_contents($custom_php_ini_dir.'/php.ini',$php_ini_content);
+			$php_ini_content .= str_replace("\r", '', trim($data['new']['custom_php_ini']));
+			$app->system->file_put_contents($custom_php_ini_dir.'/php.ini', $php_ini_content);
 		} else {
 			$has_custom_php_ini = false;
 			if(is_file($custom_php_ini_dir.'/php.ini')) $app->system->unlink($custom_php_ini_dir.'/php.ini');
@@ -976,7 +976,7 @@ class apache2_plugin {
 		$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
 		$vhost_data['has_custom_php_ini'] = $has_custom_php_ini;
 		$vhost_data['custom_php_ini_dir'] = escapeshellcmd($custom_php_ini_dir);
-		
+
 		// Custom Apache directives
 		// Make sure we only have Unix linebreaks
 		$vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']);
@@ -1002,7 +1002,7 @@ class apache2_plugin {
 		if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
 
 		//$vhost_data['document_root'] = $data['new']['document_root'].'/' . $web_folder;
-		
+
 		// Set SEO Redirect
 		if($data['new']['seo_redirect'] != ''){
 			$vhost_data['seo_redirect_enabled'] = 1;
@@ -1017,16 +1017,16 @@ class apache2_plugin {
 		} else {
 			$vhost_data['seo_redirect_enabled'] = 0;
 		}
-		
+
 		$tpl->setVar($vhost_data);
 
 		// Rewrite rules
 		$rewrite_rules = array();
 		if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') {
-			if(substr($data['new']['redirect_path'],-1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/';
-			if(substr($data['new']['redirect_path'],0,8) == '[scheme]'){
-				$rewrite_target = 'http'.substr($data['new']['redirect_path'],8);
-				$rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'],8);
+			if(substr($data['new']['redirect_path'], -1) != '/' && !preg_match('/^(https?|\[scheme\]):\/\//', $data['new']['redirect_path'])) $data['new']['redirect_path'] .= '/';
+			if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){
+				$rewrite_target = 'http'.substr($data['new']['redirect_path'], 8);
+				$rewrite_target_ssl = 'https'.substr($data['new']['redirect_path'], 8);
 			} else {
 				$rewrite_target = $data['new']['redirect_path'];
 				$rewrite_target_ssl = $data['new']['redirect_path'];
@@ -1038,40 +1038,40 @@ class apache2_plugin {
 			*/
 
 			switch($data['new']['subdomain']) {
-				case 'www':
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-						'rewrite_target' 	=> $rewrite_target,
-						'rewrite_target_ssl' => $rewrite_target_ssl,
-                        'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                        'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '^' . $this->_rewrite_quote('www.'.$data['new']['domain']),
-							'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-							'rewrite_target' 	=> $rewrite_target,
-							'rewrite_target_ssl' => $rewrite_target_ssl,
-                            'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                            'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-					break;
-				case '*':
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-						'rewrite_target' 	=> $rewrite_target,
-						'rewrite_target_ssl' => $rewrite_target_ssl,
-                        'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                        'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-					break;
-				default:
-					$rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
-						'rewrite_target' 	=> $rewrite_target,
-						'rewrite_target_ssl' => $rewrite_target_ssl,
-                        'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                        'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+			case 'www':
+				$rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+				$rewrite_rules[] = array( 'rewrite_domain'  => '^' . $this->_rewrite_quote('www.'.$data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+				break;
+			case '*':
+				$rewrite_rules[] = array( 'rewrite_domain'  => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+				break;
+			default:
+				$rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':'['.$data['new']['redirect_type'].']',
+					'rewrite_target'  => $rewrite_target,
+					'rewrite_target_ssl' => $rewrite_target_ssl,
+					'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+					'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
 			}
 		}
-		
+
 		$server_alias = array();
-		
+
 		// get autoalias
 		$auto_alias = $web_config['website_autoalias'];
 		if($auto_alias != '') {
@@ -1085,33 +1085,33 @@ class apache2_plugin {
 			unset($aa_replace);
 			$server_alias[] .= $auto_alias.' ';
 		}
-		
+
 		// get alias domains (co-domains and subdomains)
 		$aliases = $app->db->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND active = 'y' AND type != 'vhostsubdomain'");
 		$alias_seo_redirects = array();
 		switch($data['new']['subdomain']) {
-			case 'www':
-				$server_alias[] .= 'www.'.$data['new']['domain'].' ';
-				break;
-			case '*':
-				$server_alias[] .= '*.'.$data['new']['domain'].' ';
-				break;
+		case 'www':
+			$server_alias[] .= 'www.'.$data['new']['domain'].' ';
+			break;
+		case '*':
+			$server_alias[] .= '*.'.$data['new']['domain'].' ';
+			break;
 		}
 		if(is_array($aliases)) {
 			foreach($aliases as $alias) {
 				switch($alias['subdomain']) {
-					case 'www':
-						$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					case '*':
-						$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					default:
-						$server_alias[] .= $alias['domain'].' ';
-						break;
+				case 'www':
+					$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				case '*':
+					$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				default:
+					$server_alias[] .= $alias['domain'].' ';
+					break;
 				}
-				$app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG);
-				
+				$app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
 				// Add SEO redirects for alias domains
 				if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){
 					$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
@@ -1119,13 +1119,13 @@ class apache2_plugin {
 						$alias_seo_redirects[] = $tmp_seo_redirects;
 					}
 				}
-					
+
 				// Rewriting
 				if($alias['redirect_type'] != '' && $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);
+					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);
 					} else {
 						$rewrite_target = $alias['redirect_path'];
 						$rewrite_target_ssl = $alias['redirect_path'];
@@ -1135,39 +1135,39 @@ class apache2_plugin {
 						$data['new']['redirect_path'] = $data['new']['document_root'].'/web'.realpath($data['new']['redirect_path']).'/';
 					}
 					*/
-					
+
 					switch($alias['subdomain']) {
-						case 'www':
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($alias['domain']),
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-								'rewrite_target' 	=> $rewrite_target,
-								'rewrite_target_ssl' => $rewrite_target_ssl,
-                                'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> '^' . $this->_rewrite_quote('www.'.$alias['domain']),
-									'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-									'rewrite_target' 	=> $rewrite_target,
-									'rewrite_target_ssl' => $rewrite_target_ssl,
-                                    'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                    'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-							break;
-						case '*':
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> '(^|\.)'.$this->_rewrite_quote($alias['domain']),
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-								'rewrite_target' 	=> $rewrite_target,
-								'rewrite_target_ssl' => $rewrite_target_ssl,
-                                'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
-							break;
-						default:
-                            if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2));
-                            else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']);
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $domain_rule,
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
-								'rewrite_target' 	=> $rewrite_target,
-								'rewrite_target_ssl' => $rewrite_target_ssl,
-                                'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
-                                'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+					case 'www':
+						$rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($alias['domain']),
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+						$rewrite_rules[] = array( 'rewrite_domain'  => '^' . $this->_rewrite_quote('www.'.$alias['domain']),
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+						break;
+					case '*':
+						$rewrite_rules[] = array( 'rewrite_domain'  => '(^|\.)'.$this->_rewrite_quote($alias['domain']),
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
+						break;
+					default:
+						if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '(^|\.)'.$this->_rewrite_quote(substr($alias['domain'], 2));
+						else $domain_rule = '^'.$this->_rewrite_quote($alias['domain']);
+						$rewrite_rules[] = array( 'rewrite_domain'  => $domain_rule,
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':'['.$alias['redirect_type'].']',
+							'rewrite_target'  => $rewrite_target,
+							'rewrite_target_ssl' => $rewrite_target_ssl,
+							'rewrite_is_url'    => ($this->_is_url($rewrite_target) ? 'y' : 'n'),
+							'rewrite_add_path' => (substr($rewrite_target, -1) == '/' ? 'y' : 'n'));
 					}
 				}
 			}
@@ -1185,15 +1185,15 @@ class apache2_plugin {
 			}
 			unset($tmp_alias);
 
-			$tpl->setVar('alias',trim($server_alias_str));
+			$tpl->setVar('alias', trim($server_alias_str));
 		} else {
-			$tpl->setVar('alias','');
+			$tpl->setVar('alias', '');
 		}
 
 		if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0 || count($alias_seo_redirects) > 0) {
-			$tpl->setVar('rewrite_enabled',1);
+			$tpl->setVar('rewrite_enabled', 1);
 		} else {
-			$tpl->setVar('rewrite_enabled',0);
+			$tpl->setVar('rewrite_enabled', 0);
 		}
 
 		//$tpl->setLoop('redirects',$rewrite_rules);
@@ -1205,99 +1205,102 @@ class apache2_plugin {
 		 * TODO: Create form for fastcgi configs per site.
 		 */
 
+
 		if ($data['new']['php'] == 'fast-cgi') {
 
-			$fastcgi_starter_path = str_replace('[system_user]',$data['new']['system_user'],$fastcgi_config['fastcgi_starter_path']);
-			$fastcgi_starter_path = str_replace('[client_id]',$client_id,$fastcgi_starter_path);
+			$fastcgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+			$fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path);
 
 			if (!is_dir($fastcgi_starter_path)) {
 				$app->system->mkdirpath($fastcgi_starter_path);
 				//exec('chown '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path));
 
 
-				$app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path,LOGLEVEL_DEBUG);
+				$app->log('Creating fastcgi starter script directory: '.$fastcgi_starter_path, LOGLEVEL_DEBUG);
 			}
 
 			//exec('chown -R '.$data['new']['system_user'].':'.$data['new']['system_group'].' '.escapeshellcmd($fastcgi_starter_path));
-			$app->system->chown($fastcgi_starter_path,$data['new']['system_user']);
-			$app->system->chgrp($fastcgi_starter_path,$data['new']['system_group']);
-			
+			$app->system->chown($fastcgi_starter_path, $data['new']['system_user']);
+			$app->system->chgrp($fastcgi_starter_path, $data['new']['system_group']);
+
 			$fcgi_tpl = new tpl();
 			$fcgi_tpl->newTemplate('php-fcgi-starter.master');
-			
+
 			// Support for multiple PHP versions (FastCGI)
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_fastcgi_php = false;
-				if(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/';
+				if(substr($custom_fastcgi_php_ini_dir, -1) != '/') $custom_fastcgi_php_ini_dir .= '/';
 			} else {
 				$default_fastcgi_php = true;
 			}
-			
+
 			if($has_custom_php_ini) {
-				$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
+				$fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
 			} else {
 				if($default_fastcgi_php){
-					$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+					$fcgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
 				} else {
-					$fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_fastcgi_php_ini_dir));
+					$fcgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_fastcgi_php_ini_dir));
 				}
 			}
-			$fcgi_tpl->setVar('document_root',escapeshellcmd($data['new']['document_root']));
-			$fcgi_tpl->setVar('php_fcgi_children',escapeshellcmd($fastcgi_config['fastcgi_children']));
-			$fcgi_tpl->setVar('php_fcgi_max_requests',escapeshellcmd($fastcgi_config['fastcgi_max_requests']));
+			$fcgi_tpl->setVar('document_root', escapeshellcmd($data['new']['document_root']));
+			$fcgi_tpl->setVar('php_fcgi_children', escapeshellcmd($fastcgi_config['fastcgi_children']));
+			$fcgi_tpl->setVar('php_fcgi_max_requests', escapeshellcmd($fastcgi_config['fastcgi_max_requests']));
 			if($default_fastcgi_php){
-				$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin']));
+				$fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($fastcgi_config['fastcgi_bin']));
 			} else {
-				$fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($custom_fastcgi_php_executable));
+				$fcgi_tpl->setVar('php_fcgi_bin', escapeshellcmd($custom_fastcgi_php_executable));
 			}
-			$fcgi_tpl->setVar('security_level',intval($web_config['security_level']));
+			$fcgi_tpl->setVar('security_level', intval($web_config['security_level']));
 
 			$php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
 			$fcgi_tpl->setVar('open_basedir', escapeshellcmd($php_open_basedir));
 
 			$fcgi_starter_script = escapeshellcmd($fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
-			$app->system->file_put_contents($fcgi_starter_script,$fcgi_tpl->grab());
+			$app->system->file_put_contents($fcgi_starter_script, $fcgi_tpl->grab());
 			unset($fcgi_tpl);
 
-			$app->log('Creating fastcgi starter script: '.$fcgi_starter_script,LOGLEVEL_DEBUG);
+			$app->log('Creating fastcgi starter script: '.$fcgi_starter_script, LOGLEVEL_DEBUG);
+
+			$app->system->chmod($fcgi_starter_script, 0755);
+			$app->system->chown($fcgi_starter_script, $data['new']['system_user']);
+			$app->system->chgrp($fcgi_starter_script, $data['new']['system_group']);
 
-			$app->system->chmod($fcgi_starter_script,0755);
-			$app->system->chown($fcgi_starter_script,$data['new']['system_user']);
-			$app->system->chgrp($fcgi_starter_script,$data['new']['system_group']);
-						
-			$tpl->setVar('fastcgi_alias',$fastcgi_config['fastcgi_alias']);
-			$tpl->setVar('fastcgi_starter_path',$fastcgi_starter_path);
-			$tpl->setVar('fastcgi_starter_script',$fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
-			$tpl->setVar('fastcgi_config_syntax',$fastcgi_config['fastcgi_config_syntax']);
-			$tpl->setVar('fastcgi_max_requests',$fastcgi_config['fastcgi_max_requests']);
+			$tpl->setVar('fastcgi_alias', $fastcgi_config['fastcgi_alias']);
+			$tpl->setVar('fastcgi_starter_path', $fastcgi_starter_path);
+			$tpl->setVar('fastcgi_starter_script', $fastcgi_config['fastcgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+			$tpl->setVar('fastcgi_config_syntax', $fastcgi_config['fastcgi_config_syntax']);
+			$tpl->setVar('fastcgi_max_requests', $fastcgi_config['fastcgi_max_requests']);
 
 		} else {
 			//remove the php fastgi starter script if available
 			if ($data['old']['php'] == 'fast-cgi') {
-                $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$fastcgi_config['fastcgi_starter_path']);
-                $fastcgi_starter_path = str_replace('[client_id]',$client_id,$fastcgi_starter_path);
-                if($data['old']['type'] == 'vhost') {
-                    if (is_dir($fastcgi_starter_path)) {
-                        exec('rm -rf '.$fastcgi_starter_path);
-                    }
-                } else {
-                    $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web' . $data['old']['domain_id'];
-                    if (file_exists($fcgi_starter_script)) {
-                        exec('rm -f '.$fcgi_starter_script);
-                    }
-                }
-			}
-		}
-		
+				$fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+				$fastcgi_starter_path = str_replace('[client_id]', $client_id, $fastcgi_starter_path);
+				if($data['old']['type'] == 'vhost') {
+					if (is_dir($fastcgi_starter_path)) {
+						exec('rm -rf '.$fastcgi_starter_path);
+					}
+				} else {
+					$fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web' . $data['old']['domain_id'];
+					if (file_exists($fcgi_starter_script)) {
+						exec('rm -f '.$fcgi_starter_script);
+					}
+				}
+			}
+		}
+
+
+
 		/**
-		* PHP-FPM
-		*/
+		 * PHP-FPM
+		 */
 		// Support for multiple PHP versions
 		if($data['new']['php'] == 'php-fpm'){
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -1305,22 +1308,22 @@ class apache2_plugin {
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['new']['domain_id'];
 		$socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
-		if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
-		
+		if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
+
 		if($data['new']['php_fpm_use_socket'] == 'y'){
 			$use_tcp = 0;
 			$use_socket = 1;
@@ -1340,7 +1343,6 @@ class apache2_plugin {
 		 * first we create the script directory if not already created, then copy over the starter script.
 		 * TODO: we have to fetch the data from the server-settings.
 		 */
-
 		if ($data['new']['php'] == 'cgi') {
 			//$cgi_config = $app->getconf->get_server_config($conf['server_id'], 'cgi');
 
@@ -1348,16 +1350,16 @@ class apache2_plugin {
 			$cgi_config['cgi_starter_script'] = 'php-cgi-starter'.($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : '');
 			$cgi_config['cgi_bin'] = '/usr/bin/php-cgi';
 
-			$cgi_starter_path = str_replace('[system_user]',$data['new']['system_user'],$cgi_config['cgi_starter_path']);
-			$cgi_starter_path = str_replace('[client_id]',$client_id,$cgi_starter_path);
+			$cgi_starter_path = str_replace('[system_user]', $data['new']['system_user'], $cgi_config['cgi_starter_path']);
+			$cgi_starter_path = str_replace('[client_id]', $client_id, $cgi_starter_path);
 
 			if (!is_dir($cgi_starter_path)) {
 				$app->system->mkdirpath($cgi_starter_path);
-				$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->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);
+				$app->log('Creating cgi starter script directory: '.$cgi_starter_path, LOGLEVEL_DEBUG);
 			}
 
 			$cgi_tpl = new tpl();
@@ -1370,52 +1372,52 @@ class apache2_plugin {
 
 			// This will NOT work!
 			//$cgi_tpl->setVar('open_basedir', '/var/www/' . $data['new']['domain']);
-			$cgi_tpl->setVar('php_cgi_bin',$cgi_config['cgi_bin']);
-			$cgi_tpl->setVar('security_level',$web_config['security_level']);
-			
-			$cgi_tpl->setVar('has_custom_php_ini',$has_custom_php_ini);
+			$cgi_tpl->setVar('php_cgi_bin', $cgi_config['cgi_bin']);
+			$cgi_tpl->setVar('security_level', $web_config['security_level']);
+
+			$cgi_tpl->setVar('has_custom_php_ini', $has_custom_php_ini);
 			if($has_custom_php_ini) {
-				$cgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir));
+				$cgi_tpl->setVar('php_ini_path', escapeshellcmd($custom_php_ini_dir));
 			} else {
-				$cgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
+				$cgi_tpl->setVar('php_ini_path', escapeshellcmd($fastcgi_config['fastcgi_phpini_path']));
 			}
 
 			$cgi_starter_script = escapeshellcmd($cgi_starter_path.$cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
-			$app->system->file_put_contents($cgi_starter_script,$cgi_tpl->grab());
+			$app->system->file_put_contents($cgi_starter_script, $cgi_tpl->grab());
 			unset($cgi_tpl);
 
-			$app->log('Creating cgi starter script: '.$cgi_starter_script,LOGLEVEL_DEBUG);
+			$app->log('Creating cgi starter script: '.$cgi_starter_script, LOGLEVEL_DEBUG);
 
 
-			$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->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']);
 
-			$tpl->setVar('cgi_starter_path',$cgi_starter_path);
-			$tpl->setVar('cgi_starter_script',$cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
+			$tpl->setVar('cgi_starter_path', $cgi_starter_path);
+			$tpl->setVar('cgi_starter_script', $cgi_config['cgi_starter_script'].($data['new']['type'] == 'vhostsubdomain' ? '_web' . $data['new']['domain_id'] : ''));
 
 		}
 
 		$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
 		//* Make a backup copy of vhost file
-		if(file_exists($vhost_file)) $app->system->copy($vhost_file,$vhost_file.'~');
-		
+		if(file_exists($vhost_file)) $app->system->copy($vhost_file, $vhost_file.'~');
+
 		//* create empty vhost array
 		$vhosts = array();
-		
+
 		//* Add vhost for ipv4 IP
 		$tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80);
 		if(count($rewrite_rules) > 0)  $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
 		if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects);
 		$vhosts[] = $tmp_vhost_arr;
 		unset($tmp_vhost_arr);
-		
+
 		//* Add vhost for ipv4 IP with SSL
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
-		
+
 		if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
 			$tmp_vhost_arr = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443');
 			if(count($rewrite_rules) > 0)  $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
@@ -1428,29 +1430,29 @@ class apache2_plugin {
 			if(count($ipv4_ssl_alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv4_ssl_alias_seo_redirects);
 			$vhosts[] = $tmp_vhost_arr;
 			unset($tmp_vhost_arr, $ipv4_ssl_alias_seo_redirects);
-			$app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		}
-		
-	//* Add vhost for IPv6 IP
-	if($data['new']['ipv6_address'] != '') {
-		if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
-			if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
-				$explode_v6prefix=explode(':',$conf['serverconfig']['server']['v6_prefix']);
-				$explode_v6=explode(':',$data['new']['ipv6_address']);
 
-				for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
-				        $explode_v6[$i] = $explode_v6prefix[$i];
+		//* Add vhost for IPv6 IP
+		if($data['new']['ipv6_address'] != '') {
+			if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
+				if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
+					$explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']);
+					$explode_v6=explode(':', $data['new']['ipv6_address']);
+
+					for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
+						$explode_v6[$i] = $explode_v6prefix[$i];
+					}
+					$data['new']['ipv6_address'] = implode(':', $explode_v6);
 				}
-				$data['new']['ipv6_address'] = implode(':',$explode_v6);
 			}
-		}
-			
+
 			$tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80);
 			if(count($rewrite_rules) > 0)  $tmp_vhost_arr = $tmp_vhost_arr + array('redirects' => $rewrite_rules);
 			if(count($alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $alias_seo_redirects);
 			$vhosts[] = $tmp_vhost_arr;
 			unset($tmp_vhost_arr);
-		
+
 			//* Add vhost for ipv6 IP with SSL
 			if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
 				$tmp_vhost_arr = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443');
@@ -1464,16 +1466,16 @@ class apache2_plugin {
 				if(count($ipv6_ssl_alias_seo_redirects) > 0) $tmp_vhost_arr = $tmp_vhost_arr + array('alias_seo_redirects' => $ipv6_ssl_alias_seo_redirects);
 				$vhosts[] = $tmp_vhost_arr;
 				unset($tmp_vhost_arr, $ipv6_ssl_alias_seo_redirects);
-				$app->log('Enable SSL for IPv6: '.$domain,LOGLEVEL_DEBUG);
+				$app->log('Enable SSL for IPv6: '.$domain, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* Set the vhost loop
-		$tpl->setLoop('vhosts',$vhosts);
-		
+		$tpl->setLoop('vhosts', $vhosts);
+
 		//* Write vhost file
-		$app->system->file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
+		$app->system->file_put_contents($vhost_file, $tpl->grab());
+		$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 		/*
@@ -1485,21 +1487,21 @@ class apache2_plugin {
 		//* First we check if there is a old type of symlink and remove it
 		$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
 		if(is_link($vhost_symlink)) $app->system->unlink($vhost_symlink);
-		
+
 		//* Remove old or changed symlinks
 		if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') {
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* New symlink
 		if($data['new']['subdomain'] == '*') {
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
@@ -1507,8 +1509,8 @@ class apache2_plugin {
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 		}
 		if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
-			symlink($vhost_file,$vhost_symlink);
-			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			symlink($vhost_file, $vhost_symlink);
+			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		// remove old symlink and vhost file, if domain name of the site has changed
@@ -1516,72 +1518,72 @@ class apache2_plugin {
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			$app->system->unlink($vhost_file);
-			$app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		//* Create .htaccess and .htpasswd file for website statistics
 		//if(!is_file($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess') or $data['old']['document_root'] != $data['new']['document_root']) {
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/stats')) $app->system->mkdir($data['new']['document_root'].'/' . $web_folder . '/stats');
 		$ht_file = "AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$data['new']['document_root']."/web/stats/.htpasswd_stats\nrequire valid-user";
-		$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess',$ht_file);
-		$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess',0755);
+		$app->system->file_put_contents($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', $ht_file);
+		$app->system->chmod($data['new']['document_root'].'/' . $web_folder . '/stats/.htaccess', 0755);
 		unset($ht_file);
 		//}
 
 		if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
 			if(trim($data['new']['stats_password']) != '') {
 				$htp_file = 'admin:'.trim($data['new']['stats_password']);
-				$app->system->web_folder_protection($data['new']['document_root'],false);
-				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats',$htp_file);
-				$app->system->web_folder_protection($data['new']['document_root'],true);
-				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats',0755);
+				$app->system->web_folder_protection($data['new']['document_root'], false);
+				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
+				$app->system->web_folder_protection($data['new']['document_root'], true);
+				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
 				unset($htp_file);
 			}
 		}
-		
+
 		//* Create awstats configuration
 		if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-			$this->awstats_update($data,$web_config);
+			$this->awstats_update($data, $web_config);
 		}
-		
-		$this->php_fpm_pool_update($data,$web_config,$pool_dir,$pool_name,$socket_dir);
-		
+
+		$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
+
 		if($web_config['check_apache_config'] == 'y') {
 			//* Test if apache starts with the new configuration file
-			$apache_online_status_before_restart = $this->_checkTcp('localhost',80);
-			$app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
+			$apache_online_status_before_restart = $this->_checkTcp('localhost', 80);
+			$app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+
+			$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);
 
-			$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;
 			sleep(2);
 			for($i = 0; $i < 5; $i++) {
-				$apache_online_status_after_restart = $this->_checkTcp('localhost',80);
+				$apache_online_status_after_restart = $this->_checkTcp('localhost', 80);
 				if($apache_online_status_after_restart) break;
 				sleep(1);
 			}
 			//* Check if apache restarted successfully if it was online before
-			$app->log('Apache online status after restart is: '.($apache_online_status_after_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
+			$app->log('Apache online status after restart is: '.($apache_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
 			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);
+				$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);
+					$app->log('Reason for Apache restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN);
 					$app->dbmaster->datalogError(implode("\n", $retval['output']));
 				} else {
 					// if no output is given, check again
@@ -1617,19 +1619,19 @@ class apache2_plugin {
 					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);
+							$app->log('Reason for Apache restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN);
 							$app->dbmaster->datalogError(implode("\n", $tmp_output));
 						}
 						unset($tmp_output, $tmp_retval);
 					}
 				}
-				$app->system->copy($vhost_file,$vhost_file.'.err');
+				$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);
+					$app->system->copy($vhost_file.'~', $vhost_file);
 				} else {
 					//* There is no backup file, so we create a empty vhost file with a warning message inside
-					$app->system->file_put_contents($vhost_file,"# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
+					$app->system->file_put_contents($vhost_file, "# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
 				}
 				if($this->ssl_certificate_changed === true) {
 
@@ -1640,46 +1642,46 @@ class apache2_plugin {
 					$csr_file = $ssl_dir.'/'.$domain.'.csr';
 					$crt_file = $ssl_dir.'/'.$domain.'.crt';
 					$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-					
+
 					//* Backup the files that might have caused the error
 					if(is_file($key_file)){
-						$app->system->copy($key_file,$key_file.'.err');
-						$app->system->chmod($key_file.'.err',0400);
+						$app->system->copy($key_file, $key_file.'.err');
+						$app->system->chmod($key_file.'.err', 0400);
 					}
 					if(is_file($key_file2)){
-						$app->system->copy($key_file2,$key_file2.'.err');
-						$app->system->chmod($key_file2.'.err',0400);
+						$app->system->copy($key_file2, $key_file2.'.err');
+						$app->system->chmod($key_file2.'.err', 0400);
 					}
-					if(is_file($csr_file)) $app->system->copy($csr_file,$csr_file.'.err');
-					if(is_file($crt_file)) $app->system->copy($crt_file,$crt_file.'.err');
-					if(is_file($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'.err');
-					
+					if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err');
+					if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err');
+					if(is_file($bundle_file)) $app->system->copy($bundle_file, $bundle_file.'.err');
+
 					//* Restore the ~ backup files
-					if(is_file($key_file.'~')) $app->system->copy($key_file.'~',$key_file);
-					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~',$key_file2);
-					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~',$crt_file);
-					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~',$csr_file);
-					if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~',$bundle_file);
-					
-					$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.',LOGLEVEL_WARN);
+					if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file);
+					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2);
+					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file);
+					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file);
+					if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~', $bundle_file);
+
+					$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN);
 				}
-				
-				$app->services->restartService('httpd','restart');
+
+				$app->services->restartService('httpd', 'restart');
 			}
 		} else {
 			//* We do not check the apache config after changes (is faster)
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} 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 
+
+		//* The vhost is written and apache has been restarted, so we
 		// can reset the ssl changed var to false and cleanup some files
 		$this->ssl_certificate_changed = false;
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -1687,13 +1689,13 @@ class apache2_plugin {
 		$csr_file = $ssl_dir.'/'.$domain.'.csr';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 		$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-		
+
 		if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~');
 		if(@is_file($key2_file.'~')) $app->system->unlink($key2_file.'~');
 		if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~');
 		if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~');
 		if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~');
-		
+
 		// Remove the backup copy of the config file.
 		if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~');
 
@@ -1702,7 +1704,7 @@ class apache2_plugin {
 
 	}
 
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
@@ -1710,8 +1712,8 @@ class apache2_plugin {
 		$app->uses('system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
 		$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
-		
-		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'],false);
+
+		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false);
 
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
@@ -1719,12 +1721,12 @@ class apache2_plugin {
 		} else {
 			$apache_chrooted = false;
 		}
-		
+
 		//* Remove the mounts
 		$log_folder = 'log';
-        $web_folder = '';
-        if($data['old']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+		$web_folder = '';
+		if($data['old']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
 			if($tmp['domain'] != ''){
 				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
 			} else {
@@ -1746,7 +1748,7 @@ class apache2_plugin {
 				*/
 				// we are deleting the parent domain, so we can delete everything in the log directory
 				$subdomain_hosts = array();
-				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.','..'));
+				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){
@@ -1755,7 +1757,7 @@ class apache2_plugin {
 					}
 				}
 			}
-            if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
+			if(is_array($subdomain_hosts) && !empty($subdomain_hosts)){
 				$log_folders = array();
 				foreach($subdomain_hosts as $subdomain_host){
 					$log_folders[] = $log_folder.'/'.$subdomain_host;
@@ -1765,10 +1767,10 @@ class apache2_plugin {
 				$log_folder .= '/' . $subdomain_host;
 			}
 			$web_folder = $data['old']['web_folder'];
-            unset($tmp);
+			unset($tmp);
 			unset($subdomain_hosts);
 		}
-        
+
 		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){
 			if(is_array($log_folders) && !empty($log_folders)){
 				foreach($log_folders as $log_folder){
@@ -1780,16 +1782,16 @@ class apache2_plugin {
 				exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 			}
 		}
-		
+
 		//* remove mountpoint from fstab
 		if(is_array($log_folders) && !empty($log_folders)){
 			foreach($log_folders as $log_folder){
 				$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-				$app->system->removeLine('/etc/fstab',$fstab_line);
+				$app->system->removeLine('/etc/fstab', $fstab_line);
 			}
 		} else {
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 		}
 		unset($log_folders);
 
@@ -1801,191 +1803,191 @@ class apache2_plugin {
 			$data['old'] = $tmp;
 			$this->action = 'update';
 			// just run the update function
-			$this->update($event_name,$data);
+			$this->update($event_name, $data);
 
 		} else {
 			//* This is a website
 			// Deleting the vhost file, symlink and the data directory
 			$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
-			
+
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
-			
+
 			$app->system->unlink($vhost_file);
-			$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
-            
-            if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
-                $docroot = escapeshellcmd($data['old']['document_root']);
-                if($docroot != '' && !stristr($docroot,'..')) {
-                    if($data['old']['type'] == 'vhost') {
-                        // this is a vhost - we delete everything in here.
-                        exec('rm -rf '.$docroot);
-                    } elseif(!stristr($data['old']['web_folder'], '..')) {
-                        // this is a vhost subdomain
-                        // IMPORTANT: do some folder checks before we delete this!
-                        $do_delete = true;
-                        $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
-                        if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
-                        if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
-                        
-                        $path_elements = explode('/', $delete_folder);
-                        
-                        if($path_elements[0] == 'web' || $path_elements[0] === '') {
-                            // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
-                            // we use strict check as otherwise directories named '0' may not be deleted
-                            $do_delete = false;
-                        } else {
-                            // read all vhost subdomains with same parent domain
-                            $used_paths = array();
-                            $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
-                            foreach($tmp as $tmprec) {
-                                // we normalize the folder entries because we need to compare them
-                                $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
-                                if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
-                                if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
-                                
-                                // add this path and it's parent paths to used_paths array
-                                while(strpos($tmp_folder, '/') !== false) {
-                                    if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                                    $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
-                                }
-                                if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                            }
-                            unset($tmp);
-                            
-                            // loop and check if the path is still used and stop at first used one
-                            // set do_delete to false so nothing gets deleted if the web_folder itself is still used
-                            $do_delete = false;
-                            while(count($path_elements) > 0) {
-                                $tmp_folder = implode('/', $path_elements);
-                                if(in_array($tmp_folder, $used_paths) == true) break;
-                                
-                                // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
-                                $delete_folder = $tmp_folder;
-                                $do_delete = true;
-                                array_pop($path_elements);
-                            }
-                            unset($tmp_folder);
-                            unset($used_paths);
-                        }
-                        
-                        if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
-                        
-                        unset($delete_folder);
-                        unset($path_elements);
-                    }
-                }
-			
-                //remove the php fastgi starter script if available
-                if ($data['old']['php'] == 'fast-cgi') {
-                    $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$fastcgi_config['fastcgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($fastcgi_starter_path)) {
-                            exec('rm -rf '.$fastcgi_starter_path);
-                        }
-                    } else {
-                        $fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
-                        if (file_exists($fcgi_starter_script)) {
-                            exec('rm -f '.$fcgi_starter_script);
-                        }
-                    }
-                }
-                
-                // remove PHP-FPM pool
-                if ($data['old']['php'] == 'php-fpm') {
-                    $this->php_fpm_pool_delete($data,$web_config);
-                }
-
-                //remove the php cgi starter script if available
-                if ($data['old']['php'] == 'cgi') {
-                    // TODO: fetch the date from the server-settings
-                    $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
-
-                    $cgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$web_config['cgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($cgi_starter_path)) {
-                            exec('rm -rf '.$cgi_starter_path);
-                        }
-                    } else {
-                        $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
-                        if (file_exists($cgi_starter_script)) {
-                            exec('rm -f '.$cgi_starter_script);
-                        }
-                    }
-                }
-            
-                $app->log('Removing website: '.$docroot,LOGLEVEL_DEBUG);
-
-                // Delete the symlinks for the sites
-                $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
-                $client_id = intval($client['client_id']);
-                unset($client);
-                $tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
-                if(is_array($tmp_symlinks_array)) {
-                    foreach($tmp_symlinks_array as $tmp_symlink) {
-                        $tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-                        $tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
-                        // Remove trailing slash
-                        if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
-                        // delete the symlink
-                        if(is_link($tmp_symlink)) {
-                            $app->system->unlink($tmp_symlink);
-                            $app->log('Removing symlink: '.$tmp_symlink,LOGLEVEL_DEBUG);
-                        }
-                    }
-                }
-                // end removing symlinks
-            }
-
-            // Delete the log file directory
-            $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
-            if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir,'..')) exec('rm -rf '.$vhost_logfile_dir);
-            $app->log('Removing website logfile directory: '.$vhost_logfile_dir,LOGLEVEL_DEBUG);
-            
-            if($data['old']['type'] == 'vhost') {
-                //delete the web user
-                $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
-                $command .= ' '.escapeshellcmd($data['old']['system_user']);
-                exec($command);
-                if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-                
-            }
-            
-            //* Remove the awstats configuration file
-            if($data['old']['stats_type'] == 'awstats') {
-                $this->awstats_delete($data,$web_config);
-            }
-			
+			$app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+
+			if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
+				$docroot = escapeshellcmd($data['old']['document_root']);
+				if($docroot != '' && !stristr($docroot, '..')) {
+					if($data['old']['type'] == 'vhost') {
+						// this is a vhost - we delete everything in here.
+						exec('rm -rf '.$docroot);
+					} elseif(!stristr($data['old']['web_folder'], '..')) {
+						// this is a vhost subdomain
+						// IMPORTANT: do some folder checks before we delete this!
+						$do_delete = true;
+						$delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
+						if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
+						if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
+
+						$path_elements = explode('/', $delete_folder);
+
+						if($path_elements[0] == 'web' || $path_elements[0] === '') {
+							// paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
+							// we use strict check as otherwise directories named '0' may not be deleted
+							$do_delete = false;
+						} else {
+							// read all vhost subdomains with same parent domain
+							$used_paths = array();
+							$tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
+							foreach($tmp as $tmprec) {
+								// we normalize the folder entries because we need to compare them
+								$tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
+								if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
+								if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
+
+								// add this path and it's parent paths to used_paths array
+								while(strpos($tmp_folder, '/') !== false) {
+									if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+									$tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
+								}
+								if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+							}
+							unset($tmp);
+
+							// loop and check if the path is still used and stop at first used one
+							// set do_delete to false so nothing gets deleted if the web_folder itself is still used
+							$do_delete = false;
+							while(count($path_elements) > 0) {
+								$tmp_folder = implode('/', $path_elements);
+								if(in_array($tmp_folder, $used_paths) == true) break;
+
+								// this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
+								$delete_folder = $tmp_folder;
+								$do_delete = true;
+								array_pop($path_elements);
+							}
+							unset($tmp_folder);
+							unset($used_paths);
+						}
+
+						if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
+
+						unset($delete_folder);
+						unset($path_elements);
+					}
+				}
+
+				//remove the php fastgi starter script if available
+				if ($data['old']['php'] == 'fast-cgi') {
+					$fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $fastcgi_config['fastcgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($fastcgi_starter_path)) {
+							exec('rm -rf '.$fastcgi_starter_path);
+						}
+					} else {
+						$fcgi_starter_script = $fastcgi_starter_path.$fastcgi_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
+						if (file_exists($fcgi_starter_script)) {
+							exec('rm -f '.$fcgi_starter_script);
+						}
+					}
+				}
+
+				// remove PHP-FPM pool
+				if ($data['old']['php'] == 'php-fpm') {
+					$this->php_fpm_pool_delete($data, $web_config);
+				}
+
+				//remove the php cgi starter script if available
+				if ($data['old']['php'] == 'cgi') {
+					// TODO: fetch the date from the server-settings
+					$web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+
+					$cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($cgi_starter_path)) {
+							exec('rm -rf '.$cgi_starter_path);
+						}
+					} else {
+						$cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
+						if (file_exists($cgi_starter_script)) {
+							exec('rm -f '.$cgi_starter_script);
+						}
+					}
+				}
+
+				$app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG);
+
+				// Delete the symlinks for the sites
+				$client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+				$client_id = intval($client['client_id']);
+				unset($client);
+				$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+				if(is_array($tmp_symlinks_array)) {
+					foreach($tmp_symlinks_array as $tmp_symlink) {
+						$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+						$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+						// Remove trailing slash
+						if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+						// delete the symlink
+						if(is_link($tmp_symlink)) {
+							$app->system->unlink($tmp_symlink);
+							$app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG);
+						}
+					}
+				}
+				// end removing symlinks
+			}
+
+			// Delete the log file directory
+			$vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
+			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+			$app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
+
+			if($data['old']['type'] == 'vhost') {
+				//delete the web user
+				$command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
+				$command .= ' '.escapeshellcmd($data['old']['system_user']);
+				exec($command);
+				if($apache_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+			}
+
+			//* Remove the awstats configuration file
+			if($data['old']['stats_type'] == 'awstats') {
+				$this->awstats_delete($data, $web_config);
+			}
+
 			if($data['old']['type'] == 'vhostsubdomain') {
-				$app->system->web_folder_protection($parent_web_document_root,true);
+				$app->system->web_folder_protection($parent_web_document_root, true);
 			}
-			
+
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 
 		}
-        if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'],true);
+		if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
 	}
 
 	//* This function is called when a IP on the server is inserted, updated or deleted
-	function server_ip($event_name,$data) {
+	function server_ip($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
@@ -1997,7 +1999,7 @@ class apache2_plugin {
 		$tpl = new tpl();
 		$tpl->newTemplate('apache_ispconfig.conf.master');
 		$records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
-		
+
 		$records_out= array();
 		if(is_array($records)) {
 			foreach($records as $rec) {
@@ -2006,7 +2008,7 @@ class apache2_plugin {
 				} else {
 					$ip_address = $rec['ip_address'];
 				}
-				$ports = explode(',',$rec['virtualhost_port']);
+				$ports = explode(',', $rec['virtualhost_port']);
 				if(is_array($ports)) {
 					foreach($ports as $port) {
 						$port = intval($port);
@@ -2017,70 +2019,70 @@ class apache2_plugin {
 				}
 			}
 		}
-		
-		
+
+
 		if(count($records_out) > 0) {
-			$tpl->setLoop('ip_adresses',$records_out);
+			$tpl->setLoop('ip_adresses', $records_out);
 		}
 
 		$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'].'/ispconfig.conf');
-		$app->system->file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the conf file: '.$vhost_file,LOGLEVEL_DEBUG);
+		$app->system->file_put_contents($vhost_file, $tpl->grab());
+		$app->log('Writing the conf file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 	}
-	
+
 	//* Create or update the .htaccess folder protection
-	function web_folder_user($event_name,$data) {
+	function web_folder_user($event_name, $data) {
 		global $app, $conf;
 
 		$app->uses('system');
-		
+
 		if($event_name == 'web_folder_user_delete') {
 			$folder_id = $data['old']['web_folder_id'];
 		} else {
 			$folder_id = $data['new']['web_folder_id'];
 		}
-		
+
 		$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".intval($folder_id));
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($folder_path,'..') || stristr($folder_path,'./') || stristr($folder_path,'\\')) {
-			$app->log('Folder path "'.$folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) {
+			$app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($folder_path)) {
 			$app->system->mkdirpath($folder_path);
-			$app->system->chown($folder_path,$website['system_user']);
-			$app->system->chgrp($folder_path,$website['system_group']);
+			$app->system->chown($folder_path, $website['system_user']);
+			$app->system->chgrp($folder_path, $website['system_group']);
 		}
-		
+
 		//* Create empty .htpasswd file, if it does not exist
 		if(!is_file($folder_path.'.htpasswd')) {
 			$app->system->touch($folder_path.'.htpasswd');
-			$app->system->chmod($folder_path.'.htpasswd',0750);
-			$app->system->chown($folder_path.'.htpasswd',$website['system_user']);
-			$app->system->chgrp($folder_path.'.htpasswd',$website['system_group']);
-			$app->log('Created file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->system->chmod($folder_path.'.htpasswd', 0750);
+			$app->system->chown($folder_path.'.htpasswd', $website['system_user']);
+			$app->system->chgrp($folder_path.'.htpasswd', $website['system_group']);
+			$app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		/*
 		$auth_users = $app->db->queryAllRecords("SELECT * FROM web_folder_user WHERE active = 'y' AND web_folder_id = ".intval($folder_id));
 		$htpasswd_content = '';
@@ -2093,241 +2095,241 @@ class apache2_plugin {
 		@file_put_contents($folder_path.'.htpasswd', $htpasswd_content);
 		$app->log('Changed .htpasswd file: '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
 		*/
-		
+
 		if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Add or remove the user from .htpasswd file
 		if($event_name == 'web_folder_user_delete') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		} else {
 			if($data['new']['active'] == 'y') {
-				$app->system->replaceLine($folder_path.'.htpasswd',$data['new']['username'].':',$data['new']['username'].':'.$data['new']['password'],0,1);
-				$app->log('Added or updated user: '.$data['new']['username'],LOGLEVEL_DEBUG);
+				$app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1);
+				$app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG);
 			}
 		}
-		
-		
+
+
 		//* Create the .htaccess file
 		//if(!is_file($folder_path.'.htaccess')) {
-			$begin_marker = '### ISPConfig folder protection begin ###';
-            $end_marker = "### ISPConfig folder protection end ###\n\n";
-            $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
-			
-            if(file_exists($folder_path.'.htaccess')) {
-                $old_content = $app->system->file_get_contents($folder_path.'.htaccess');
-                
-                if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
-                    $ht_file = str_replace($matches[0], $ht_file, $old_content);
-                } else {
-                    $ht_file .= $old_content;
-                }
-            }
-            unset($old_content);
-            
-            $app->system->file_put_contents($folder_path.'.htaccess',$ht_file);
-			$app->system->chmod($folder_path.'.htaccess',0750);
-			$app->system->chown($folder_path.'.htaccess',$website['system_user']);
-			$app->system->chgrp($folder_path.'.htaccess',$website['system_group']);
-			$app->log('Created/modified file '.$folder_path.'.htaccess',LOGLEVEL_DEBUG);
+		$begin_marker = '### ISPConfig folder protection begin ###';
+		$end_marker = "### ISPConfig folder protection end ###\n\n";
+		$ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
+
+		if(file_exists($folder_path.'.htaccess')) {
+			$old_content = $app->system->file_get_contents($folder_path.'.htaccess');
+
+			if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
+				$ht_file = str_replace($matches[0], $ht_file, $old_content);
+			} else {
+				$ht_file .= $old_content;
+			}
+		}
+		unset($old_content);
+
+		$app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
+		$app->system->chmod($folder_path.'.htaccess', 0750);
+		$app->system->chown($folder_path.'.htaccess', $website['system_user']);
+		$app->system->chgrp($folder_path.'.htaccess', $website['system_group']);
+		$app->log('Created/modified file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
 		//}
-		
+
 	}
-	
+
 	//* Remove .htaccess and .htpasswd file, when folder protection is removed
-	function web_folder_delete($event_name,$data) {
+	function web_folder_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$folder_id = $data['old']['web_folder_id'];
-		
+
 		$folder = $data['old'];
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Folder path is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Remove .htpasswd file
 		if(is_file($folder_path.'.htpasswd')) {
 			$app->system->unlink($folder_path.'.htpasswd');
-			$app->log('Removed file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Remove .htaccess file
 		if(is_file($folder_path.'.htaccess')) {
-            $begin_marker = '### ISPConfig folder protection begin ###';
-            $end_marker = "### ISPConfig folder protection end ###\n\n";
-            
-            $ht_file = $app->system->file_get_contents($folder_path.'.htaccess');
-            
-            if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
-                $ht_file = str_replace($matches[0], '', $ht_file);
-            } else {
-                $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
-            }
-            
-            if(trim($ht_file) == '') {
-                $app->system->unlink($folder_path.'.htaccess');
-                $app->log('Removed file '.$folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            } else {
-                $app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
-                $app->log('Removed protection content from file '.$folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            }
+			$begin_marker = '### ISPConfig folder protection begin ###';
+			$end_marker = "### ISPConfig folder protection end ###\n\n";
+
+			$ht_file = $app->system->file_get_contents($folder_path.'.htaccess');
+
+			if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+				$ht_file = str_replace($matches[0], '', $ht_file);
+			} else {
+				$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+			}
+
+			if(trim($ht_file) == '') {
+				$app->system->unlink($folder_path.'.htaccess');
+				$app->log('Removed file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			} else {
+				$app->system->file_put_contents($folder_path.'.htaccess', $ht_file);
+				$app->log('Removed protection content from file '.$folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			}
 		}
 	}
-	
+
 	//* Update folder protection, when path has been changed
-	function web_folder_update($event_name,$data) {
+	function web_folder_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-	
+
 		if(!is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($data['old']['path'],0,1) == '/') $data['old']['path'] = substr($data['old']['path'],1);
-		if(substr($data['old']['path'],-1) == '/') $data['old']['path'] = substr($data['old']['path'],0,-1);
+		if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1);
+		if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1);
 		$old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']);
-		if(substr($old_folder_path,-1) != '/') $old_folder_path .= '/';
-			
-		if(substr($data['new']['path'],0,1) == '/') $data['new']['path'] = substr($data['new']['path'],1);
-		if(substr($data['new']['path'],-1) == '/') $data['new']['path'] = substr($data['new']['path'],0,-1);
+		if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/';
+
+		if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1);
+		if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1);
 		$new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']);
-		if(substr($new_folder_path,-1) != '/') $new_folder_path .= '/';
-		
+		if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($new_folder_path,'..') || stristr($new_folder_path,'./') || stristr($new_folder_path,'\\')) {
-			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) {
+			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(stristr($old_folder_path,'..') || stristr($old_folder_path,'./') || stristr($old_folder_path,'\\')) {
-			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) {
+			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($old_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(substr($new_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('New folder path '.$new_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-			
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path);
-		
-        $begin_marker = '### ISPConfig folder protection begin ###';
-        $end_marker = "### ISPConfig folder protection end ###\n\n";
-        
+
+		$begin_marker = '### ISPConfig folder protection begin ###';
+		$end_marker = "### ISPConfig folder protection end ###\n\n";
+
 		if($data['old']['path'] != $data['new']['path']) {
 
-		
+
 			//* move .htpasswd file
 			if(is_file($old_folder_path.'.htpasswd')) {
-				$app->system->rename($old_folder_path.'.htpasswd',$new_folder_path.'.htpasswd');
-				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+				$app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd');
+				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 			}
-			
+
 			//* delete old .htaccess file
 			if(is_file($old_folder_path.'.htaccess')) {
-                $ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess');
-                
-                if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
-                    $ht_file = str_replace($matches[0], '', $ht_file);
-                } else {
-                    $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
-                }
-                
-                if(trim($ht_file) == '') {
-                    $app->system->unlink($old_folder_path.'.htaccess');
-                    $app->log('Removed file '.$old_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-                } else {
-                    $app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file);
-                    $app->log('Removed protection content from file '.$old_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-                }
-			}
-		
-		}
-		
+				$ht_file = $app->system->file_get_contents($old_folder_path.'.htaccess');
+
+				if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+					$ht_file = str_replace($matches[0], '', $ht_file);
+				} else {
+					$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$old_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+				}
+
+				if(trim($ht_file) == '') {
+					$app->system->unlink($old_folder_path.'.htaccess');
+					$app->log('Removed file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+				} else {
+					$app->system->file_put_contents($old_folder_path.'.htaccess', $ht_file);
+					$app->log('Removed protection content from file '.$old_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+				}
+			}
+
+		}
+
 		//* Create the .htaccess file
 		if($data['new']['active'] == 'y') {
-            $ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
-			
-            if(file_exists($new_folder_path.'.htaccess')) {
-                $old_content = $app->system->file_get_contents($new_folder_path.'.htaccess');
-                
-                if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
-                    $ht_file = str_replace($matches[0], $ht_file, $old_content);
-                } else {
-                    $ht_file .= $old_content;
-                }
-            }
-            
-            $app->system->file_put_contents($new_folder_path.'.htaccess',$ht_file);
-			$app->system->chmod($new_folder_path.'.htaccess',0750);
-			$app->system->chown($new_folder_path.'.htaccess',$website['system_user']);
-			$app->system->chgrp($new_folder_path.'.htaccess',$website['system_group']);
-			$app->log('Created/modified file '.$new_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-		}
-		
+			$ht_file = $begin_marker."\nAuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user\n".$end_marker;
+
+			if(file_exists($new_folder_path.'.htaccess')) {
+				$old_content = $app->system->file_get_contents($new_folder_path.'.htaccess');
+
+				if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $old_content, $matches)) {
+					$ht_file = str_replace($matches[0], $ht_file, $old_content);
+				} else {
+					$ht_file .= $old_content;
+				}
+			}
+
+			$app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
+			$app->system->chmod($new_folder_path.'.htaccess', 0750);
+			$app->system->chown($new_folder_path.'.htaccess', $website['system_user']);
+			$app->system->chgrp($new_folder_path.'.htaccess', $website['system_group']);
+			$app->log('Created/modified file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+		}
+
 		//* Remove .htaccess file
 		if($data['new']['active'] == 'n' && is_file($new_folder_path.'.htaccess')) {
-            $ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess');
-            
-            if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
-                $ht_file = str_replace($matches[0], '', $ht_file);
-            } else {
-                $ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
-            }
-            
-            if(trim($ht_file) == '') {
-                $app->system->unlink($new_folder_path.'.htaccess');
-                $app->log('Removed file '.$new_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            } else {
-                $app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
-                $app->log('Removed protection content from file '.$new_folder_path.'.htaccess',LOGLEVEL_DEBUG);
-            }
-		}
-		
-		
+			$ht_file = $app->system->file_get_contents($new_folder_path.'.htaccess');
+
+			if(preg_match('/' . preg_quote($begin_marker, '/') . '(.*?)' . preg_quote($end_marker, '/') . '/s', $ht_file, $matches)) {
+				$ht_file = str_replace($matches[0], '', $ht_file);
+			} else {
+				$ht_file = str_replace("AuthType Basic\nAuthName \"Members Only\"\nAuthUserFile ".$new_folder_path.".htpasswd\nrequire valid-user", '', $ht_file);
+			}
+
+			if(trim($ht_file) == '') {
+				$app->system->unlink($new_folder_path.'.htaccess');
+				$app->log('Removed file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			} else {
+				$app->system->file_put_contents($new_folder_path.'.htaccess', $ht_file);
+				$app->log('Removed protection content from file '.$new_folder_path.'.htaccess', LOGLEVEL_DEBUG);
+			}
+		}
+
+
 	}
-	
-	public function ftp_user_delete($event_name,$data) {
+
+	public function ftp_user_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$ftpquota_file = $data['old']['dir'].'/.ftpquota';
 		if(file_exists($ftpquota_file)) $app->system->unlink($ftpquota_file);
-		
+
 	}
-	
-	
+
+
 
 	/**
 	 * This function is called when a Webdav-User is inserted, updated or deleted.
@@ -2336,9 +2338,9 @@ class apache2_plugin {
 	 * @param string $event_name
 	 * @param array $data
 	 */
-	public function webdav($event_name,$data) {
+	public function webdav($event_name, $data) {
 		global $app, $conf;
-		
+
 		/*
 		 * load the server configuration options
 		*/
@@ -2360,20 +2362,20 @@ class apache2_plugin {
 			/* Check if this is a chrooted setup */
 			if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
 				$apache_chrooted = true;
-				$app->log('Info: Apache is chrooted.',LOGLEVEL_DEBUG);
+				$app->log('Info: Apache is chrooted.', LOGLEVEL_DEBUG);
 			} else {
 				$apache_chrooted = false;
 			}
-			
+
 			//* We dont want to have relative paths here
-			if(stristr($webdav_user_dir,'..')  || stristr($webdav_user_dir,'./')) {
-				$app->log('Folder path '.$webdav_user_dir.' contains ./ or .. '.$documentRoot,LOGLEVEL_WARN);
+			if(stristr($webdav_user_dir, '..')  || stristr($webdav_user_dir, './')) {
+				$app->log('Folder path '.$webdav_user_dir.' contains ./ or .. '.$documentRoot, LOGLEVEL_WARN);
 				return false;
 			}
-			
+
 			//* Check if the resulting path exists if yes, if it is inside the docroot
-			if(is_dir($webdav_user_dir) && substr(realpath($webdav_user_dir),0,strlen($documentRoot)) != $documentRoot) {
-				$app->log('Folder path '.$webdav_user_dir.' is outside of docroot '.$documentRoot,LOGLEVEL_WARN);
+			if(is_dir($webdav_user_dir) && substr(realpath($webdav_user_dir), 0, strlen($documentRoot)) != $documentRoot) {
+				$app->log('Folder path '.$webdav_user_dir.' is outside of docroot '.$documentRoot, LOGLEVEL_WARN);
 				return false;
 			}
 
@@ -2381,7 +2383,7 @@ class apache2_plugin {
 			 * First the webdav-root - folder has to exist
 			*/
 			if(!is_dir($webdav_user_dir)) {
-				$app->log('Webdav User directory '.$webdav_user_dir.' does not exist. Creating it now.',LOGLEVEL_DEBUG);
+				$app->log('Webdav User directory '.$webdav_user_dir.' does not exist. Creating it now.', LOGLEVEL_DEBUG);
 				$app->system->mkdirpath($webdav_user_dir);
 			}
 
@@ -2390,9 +2392,9 @@ class apache2_plugin {
 			*/
 			//$this->_exec('chown ' . $user . ':' . $group . ' ' . escapeshellcmd($documentRoot . '/webdav/'));
 			//$this->_exec('chmod 770 ' . escapeshellcmd($documentRoot . '/webdav/'));
-			$app->system->chown($documentRoot . '/webdav',$user);
-			$app->system->chgrp($documentRoot . '/webdav',$group);
-			$app->system->chmod($documentRoot . '/webdav',0770);
+			$app->system->chown($documentRoot . '/webdav', $user);
+			$app->system->chgrp($documentRoot . '/webdav', $group);
+			$app->system->chmod($documentRoot . '/webdav', 0770);
 
 			/*
 			 * The webdav folder (not the webdav-root!) needs the same (not in ONE step, because the
@@ -2400,9 +2402,9 @@ class apache2_plugin {
 			*/
 			//$this->_exec('chown ' . $user . ':' . $group . ' ' . escapeshellcmd($webdav_user_dir.' -R'));
 			//$this->_exec('chmod 770 ' . escapeshellcmd($webdav_user_dir.' -R'));
-			$app->system->chown($webdav_user_dir,$user);
-			$app->system->chgrp($webdav_user_dir,$group);
-			$app->system->chmod($webdav_user_dir,0770);
+			$app->system->chown($webdav_user_dir, $user);
+			$app->system->chgrp($webdav_user_dir, $group);
+			$app->system->chmod($webdav_user_dir, 0770);
 
 			/*
 			 * if the user is active, we have to write/update the password - file
@@ -2426,10 +2428,10 @@ class apache2_plugin {
 			 * Last, restart apache
 			*/
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 
 		}
@@ -2447,21 +2449,21 @@ class apache2_plugin {
 			 * So the only thing, we have to do, is to delete the user from the password-file
 			*/
 			$this->_writeHtDigestFile( $documentRoot . '/webdav/' . $data['old']['dir'] . '.htdigest', $data['old']['username'], $data['old']['dir'], '');
-			
+
 			/*
 			 * Next step, patch the vhost - file
 			*/
 			$vhost_file = escapeshellcmd($web_config['vhost_conf_dir'] . '/' . $domain . '.vhost');
 			$this->_patchVhostWebdav($vhost_file, $documentRoot . '/webdav');
-			
+
 			/*
 			 * Last, restart apache
 			*/
 			if($apache_chrooted) {
-				$app->services->restartServiceDelayed('httpd','restart');
+				$app->services->restartServiceDelayed('httpd', 'restart');
 			} else {
 				// request a httpd reload when all records have been processed
-				$app->services->restartServiceDelayed('httpd','reload');
+				$app->services->restartServiceDelayed('httpd', 'reload');
 			}
 		}
 	}
@@ -2478,7 +2480,7 @@ class apache2_plugin {
 	 */
 	private function _writeHtDigestFile($filename, $username, $authname, $pwdhash ) {
 		global $app;
-		
+
 		$changed = false;
 		if(is_file($filename) && !is_link($filename)) {
 			$in = fopen($filename, 'r');
@@ -2495,7 +2497,7 @@ class apache2_plugin {
 					*/
 					if ($pwdhash != '') {
 						$output .= $tmp[0] . ':' . $tmp[1] . ':' . $pwdhash . "\n";
-						}
+					}
 					$changed = true;
 				}
 				else {
@@ -2510,7 +2512,7 @@ class apache2_plugin {
 		if (!$changed) {
 			$output .= $username . ':' . $authname . ':' . $pwdhash . "\n";
 		}
-		
+
 
 		/*
 		 * Now lets write the new file
@@ -2556,30 +2558,30 @@ class apache2_plugin {
 				*/
 				$files = @scandir($webdavRoot);
 				if(is_array($files)) {
-				foreach($files as $file) {
-					if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/",$file)) {
-						/*
+					foreach($files as $file) {
+						if (substr($file, strlen($file) - strlen('.htdigest')) == '.htdigest' && preg_match("/^[a-zA-Z0-9\-_\.]*$/", $file)) {
+							/*
 						 * found a htdigest - file, so add it to webdav
 						*/
-						$fn = substr($file, 0, strlen($file) - strlen('.htdigest'));
-						$output .= "\n";
-						// $output .= "      Alias /" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
-						// $output .= "      <Location /" . $fn . ">\n";
-						$output .= "      Alias /webdav/" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
-						$output .= "      <Location /webdav/" . $fn . ">\n";
-						$output .= "        DAV On\n";
-						$output .= '        BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On'."\n";
-						$output .= "        AuthType Digest\n";
-						$output .= "        AuthName \"" . $fn . "\"\n";
-						$output .= "        AuthUserFile " . $webdavRoot . '/' . $file . "\n";
-						$output .= "        Require valid-user \n";
-						$output .= "        Options +Indexes \n";
-						$output .= "        Order allow,deny \n";
-						$output .= "        Allow from all \n";
-						$output .= "      </Location> \n";
+							$fn = substr($file, 0, strlen($file) - strlen('.htdigest'));
+							$output .= "\n";
+							// $output .= "      Alias /" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
+							// $output .= "      <Location /" . $fn . ">\n";
+							$output .= "      Alias /webdav/" . $fn . ' ' . $webdavRoot . '/' . $fn . "\n";
+							$output .= "      <Location /webdav/" . $fn . ">\n";
+							$output .= "        DAV On\n";
+							$output .= '        BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On'."\n";
+							$output .= "        AuthType Digest\n";
+							$output .= "        AuthName \"" . $fn . "\"\n";
+							$output .= "        AuthUserFile " . $webdavRoot . '/' . $file . "\n";
+							$output .= "        Require valid-user \n";
+							$output .= "        Options +Indexes \n";
+							$output .= "        Order allow,deny \n";
+							$output .= "        Allow from all \n";
+							$output .= "      </Location> \n";
+						}
 					}
 				}
-				}
 			}
 			/*
 			 *  is the "replace-comment-end" found...
@@ -2606,61 +2608,61 @@ class apache2_plugin {
 		$app->system->file_put_contents($fileName, $output);
 
 	}
-	
+
 	//* Update the awstats configuration file
-	private function awstats_update ($data,$web_config) {
+	private function awstats_update ($data, $web_config) {
 		global $app;
-		
-        $web_folder = $data['new']['web_folder'];
-        if($data['new']['type'] == 'vhost') $web_folder = 'web';
+
+		$web_folder = $data['new']['web_folder'];
+		if($data['new']['type'] == 'vhost') $web_folder = 'web';
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats");
 		if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
 			if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 				$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
 			}
-			
+
 			$content = '';
 			$content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
 			$content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
 			$content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
 			$content .= "HostAliases=\"www.".$data['new']['domain']."  localhost 127.0.0.1\"\n";
-			
-			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',$content);
-			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
+
+			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content);
+			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
-		
+
 		if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
 		if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
-			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		} else {
-			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		}
 	}
-	
+
 	//* Delete the awstats configuration file
-	private function awstats_delete ($data,$web_config) {
+	private function awstats_delete ($data, $web_config) {
 		global $app;
-		
+
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 			$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
-			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG);
+			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
 	}
-	
+
 	//* Update the PHP-FPM pool configuration file
-	private function php_fpm_pool_update ($data,$web_config,$pool_dir,$pool_name,$socket_dir) {
+	private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) {
 		global $app, $conf;
 		//$reload = false;
-		
+
 		if($data['new']['php'] == 'php-fpm'){
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -2668,15 +2670,15 @@ class apache2_plugin {
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		if($data['new']['php'] != 'php-fpm'){
 			if(@is_file($pool_dir.$pool_name.'.conf')){
 				$app->system->unlink($pool_dir.$pool_name.'.conf');
@@ -2684,15 +2686,15 @@ class apache2_plugin {
 			}
 			if($data['old']['php'] == 'php-fpm'){
 				if(!$default_php_fpm){
-					$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+					$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 				} else {
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+					$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 				}
 			}
 			//if($reload == true) $app->services->restartService('php-fpm','reload');
 			return;
 		}
-				
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('php_fpm_pool.conf.master');
@@ -2707,10 +2709,10 @@ class apache2_plugin {
 		}
 		$tpl->setVar('use_tcp', $use_tcp);
 		$tpl->setVar('use_socket', $use_socket);
-			
+
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
-			
+
 		$tpl->setVar('fpm_pool', $pool_name);
 		$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
 		$tpl->setVar('fpm_user', $data['new']['system_user']);
@@ -2723,7 +2725,7 @@ class apache2_plugin {
 		$tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']);
 		$tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']);
 		$tpl->setVar('document_root', $data['new']['document_root']);
-		$tpl->setVar('security_level',$web_config['security_level']);
+		$tpl->setVar('security_level', $web_config['security_level']);
 		$php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
 		$tpl->setVar('php_open_basedir', $php_open_basedir);
 		if($php_open_basedir != ''){
@@ -2731,7 +2733,7 @@ class apache2_plugin {
 		} else {
 			$tpl->setVar('enable_php_open_basedir', ';');
 		}
-			
+
 		// Custom php.ini settings
 		$final_php_ini_settings = array();
 		$custom_php_ini_settings = trim($data['new']['custom_php_ini']);
@@ -2743,59 +2745,59 @@ class apache2_plugin {
 			if(is_array($ini_settings) && !empty($ini_settings)){
 				foreach($ini_settings as $ini_setting){
 					$ini_setting = trim($ini_setting);
-					if(substr($ini_setting,0,1) == ';') continue;
-					if(substr($ini_setting,0,1) == '#') continue;
-					if(substr($ini_setting,0,2) == '//') continue;
+					if(substr($ini_setting, 0, 1) == ';') continue;
+					if(substr($ini_setting, 0, 1) == '#') continue;
+					if(substr($ini_setting, 0, 2) == '//') continue;
 					list($key, $value) = explode('=', $ini_setting);
 					if($value){
 						$value = trim($value);
 						$key = trim($key);
 						switch (strtolower($value)) {
-							case '0':
-								// PHP-FPM might complain about invalid boolean value if you use 0
-								$value = 'off';
-							case '1':
-							case 'on':
-							case 'off':
-							case 'true':
-							case 'false':
-							case 'yes':
-							case 'no':
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
-								break;
-							default:
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
+						case '0':
+							// PHP-FPM might complain about invalid boolean value if you use 0
+							$value = 'off';
+						case '1':
+						case 'on':
+						case 'off':
+						case 'true':
+						case 'false':
+						case 'yes':
+						case 'no':
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
+							break;
+						default:
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
 						}
 					}
 				}
 			}
 		}
-			
+
 		$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
-			
-		$app->system->file_put_contents($pool_dir.$pool_name.'.conf',$tpl->grab());
-		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
+
+		$app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());
+		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
 		unset($tpl);
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
 		}
 		$php_versions = $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 = ".$conf["server_id"]);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
@@ -2803,121 +2805,121 @@ class apache2_plugin {
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
-		
+
 		//$reload = true;
 
 		//if($reload == true) $app->services->restartService('php-fpm','reload');
 	}
-	
+
 	//* Delete the PHP-FPM pool configuration file
-	private function php_fpm_pool_delete ($data,$web_config) {
+	private function php_fpm_pool_delete ($data, $web_config) {
 		global $app, $conf;
-		
+
 		if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] == 'php-fpm'){
 			$default_php_fpm = false;
 			list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-			if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+			if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 		} else {
 			$default_php_fpm = true;
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['old']['domain_id'];
-		
+
 		if ( @is_file($pool_dir.$pool_name.'.conf') ) {
 			$app->system->unlink($pool_dir.$pool_name.'.conf');
-			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-			
+			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+
 			//$app->services->restartService('php-fpm','reload');
 		}
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
-		}	
+		}
 		$php_versions = $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 = ".$data['old']['server_id']);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
 		}
-		
+
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
 	}
-	
-	function client_delete($event_name,$data) {
+
+	function client_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		$client_id = intval($data['old']['client_id']);
 		if($client_id > 0) {
-			
+
 			$client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
-			if(is_dir($client_dir) && !stristr($client_dir,'..')) {
+			if(is_dir($client_dir) && !stristr($client_dir, '..')) {
 				// remove symlinks from $client_dir
-				$files = array_diff(scandir($client_dir), array('.','..'));
+				$files = array_diff(scandir($client_dir), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_link($client_dir.'/'.$file)){
 							unlink($client_dir.'/'.$file);
-							$app->log('Removed symlink: '.$client_dir.'/'.$file,LOGLEVEL_DEBUG);
+							$app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG);
 						}
 					}
 				}
-				
+
 				@rmdir($client_dir);
-				$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
+				$app->log('Removed client directory: '.$client_dir, 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);
+				$app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 	}
 
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-	
-	private function _checkTcp ($host,$port) {
 
-		$fp = @fsockopen ($host, $port, $errno, $errstr, 2);
+	private function _checkTcp ($host, $port) {
+
+		$fp = @fsockopen($host, $port, $errno, $errstr, 2);
 
 		if ($fp) {
 			fclose($fp);
@@ -2929,7 +2931,7 @@ class apache2_plugin {
 
 	public function create_relative_link($f, $t) {
 		global $app;
-		
+
 		// $from already exists
 		$from = realpath($f);
 
@@ -2955,19 +2957,19 @@ class apache2_plugin {
 		return symlink($cfrom, $to);
 	}
 
-    private function _rewrite_quote($string) {
-        return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
-    }
-    
-    private function _is_url($string) {
-        return preg_match('/^(f|ht)tp(s)?:\/\//i', $string);
-    }
-	
+	private function _rewrite_quote($string) {
+		return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
+	}
+
+	private function _is_url($string) {
+		return preg_match('/^(f|ht)tp(s)?:\/\//i', $string);
+	}
+
 	private function get_seo_redirects($web, $prefix = ''){
 		$seo_redirects = array();
-		
+
 		if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*';
-		
+
 		if($web['subdomain'] == 'www' || $web['subdomain'] == '*'){
 			if($web['seo_redirect'] == 'non_www_to_www'){
 				$seo_redirects[$prefix.'seo_redirect_origin_domain'] = str_replace('.', '\.', $web['domain']);
@@ -3005,7 +3007,7 @@ class apache2_plugin {
 		}
 		return $seo_redirects;
 	}
-    
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php
index 3cec452c17bd6ef554cadbf74364222e43c57ff7..82518639978e0ef359a26572f5fe89bc6fd04f7c 100644
--- a/server/plugins-available/apps_vhost_plugin.inc.php
+++ b/server/plugins-available/apps_vhost_plugin.inc.php
@@ -29,56 +29,56 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class apps_vhost_plugin {
-	
+
 	var $plugin_name = 'apps_vhost_plugin';
 	var $class_name = 'apps_vhost_plugin';
-	
-	
+
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('server_insert','apps_vhost_plugin','insert');
-		$app->plugins->registerEvent('server_update','apps_vhost_plugin','update');		
-		
-		
+
+		$app->plugins->registerEvent('server_insert', 'apps_vhost_plugin', 'insert');
+		$app->plugins->registerEvent('server_update', 'apps_vhost_plugin', 'update');
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-				
+
 		// get the config
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-				
+
 		if($web_config['server_type'] == 'apache'){
 			// Dont just copy over the virtualhost template but add some custom settings
 			if(file_exists($conf["rootpath"]."/conf-custom/apache_apps.vhost.master")) {
@@ -86,33 +86,33 @@ class apps_vhost_plugin {
 			} else {
 				$content = file_get_contents($conf["rootpath"]."/conf/apache_apps.vhost.master");
 			}
-			
-		
+
+
 			$vhost_conf_dir = $web_config['vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $web_config['vhost_conf_enabled_dir'];
 			$apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'':'ServerName '.$web_config['apps_vhost_servername'];
-		
+
 			$web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port'];
 			$web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip'];
-		
+
 			$content = str_replace('{apps_vhost_ip}', $web_config['apps_vhost_ip'], $content);
 			$content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content);
 			$content = str_replace('{apps_vhost_servername}', $apps_vhost_servername, $content);
 			$content = str_replace('{apps_vhost_basedir}', $web_config['website_basedir'], $content);
-		
-		
+
+
 			// comment out the listen directive if port is 80 or 443
 			if($web_config['apps_vhost_port'] == 80 or $web_config['apps_vhost_port'] == 443) {
 				$content = str_replace('{vhost_port_listen}', '#', $content);
 			} else {
 				$content = str_replace('{vhost_port_listen}', '', $content);
 			}
-			
+
 			file_put_contents("$vhost_conf_dir/apps.vhost", $content);
-			$app->services->restartServiceDelayed('httpd','restart');
+			$app->services->restartServiceDelayed('httpd', 'restart');
 		}
-		
+
 		if($web_config['server_type'] == 'nginx'){
 			// Dont just copy over the virtualhost template but add some custom settings
 			if(file_exists($conf["rootpath"]."/conf-custom/nginx_apps.vhost.master")) {
@@ -120,29 +120,29 @@ class apps_vhost_plugin {
 			} else {
 				$content = file_get_contents($conf["rootpath"]."/conf/nginx_apps.vhost.master");
 			}
-		
+
 			$vhost_conf_dir = $web_config['nginx_vhost_conf_dir'];
 			$vhost_conf_enabled_dir = $web_config['nginx_vhost_conf_enabled_dir'];
 			$apps_vhost_servername = ($web_config['apps_vhost_servername'] == '')?'_':$web_config['apps_vhost_servername'];
-			
+
 			$apps_vhost_user = 'ispapps';
 			$apps_vhost_group = 'ispapps';
-		
+
 			$web_config['apps_vhost_port'] = (empty($web_config['apps_vhost_port']))?8081:$web_config['apps_vhost_port'];
 			$web_config['apps_vhost_ip'] = (empty($web_config['apps_vhost_ip']))?'_default_':$web_config['apps_vhost_ip'];
-			
+
 			if($web_config['apps_vhost_ip'] == '_default_'){
 				$apps_vhost_ip = '';
 			} else {
 				$apps_vhost_ip = $web_config['apps_vhost_ip'].':';
 			}
-			
+
 			$socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
-			if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
+			if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
 			if(!is_dir($socket_dir)) exec('mkdir -p '.$socket_dir);
 			$fpm_socket = $socket_dir.'apps.sock';
 			$cgi_socket = escapeshellcmd($web_config['nginx_cgi_socket']);
-		
+
 			$content = str_replace('{apps_vhost_ip}', $apps_vhost_ip, $content);
 			$content = str_replace('{apps_vhost_port}', $web_config['apps_vhost_port'], $content);
 			$content = str_replace('{apps_vhost_dir}', $web_config['website_basedir'].'/apps', $content);
@@ -159,7 +159,7 @@ class apps_vhost_plugin {
 			}
 			$content = str_replace('{use_tcp}', $use_tcp, $content);
 			$content = str_replace('{use_socket}', $use_socket, $content);
-			
+
 			// PHP-FPM
 			// Dont just copy over the php-fpm pool template but add some custom settings
 			if(file_exists($conf["rootpath"]."/conf-custom/apps_php_fpm_pool.conf.master")) {
@@ -167,22 +167,22 @@ class apps_vhost_plugin {
 			} else {
 				$fpm_content = file_get_contents($conf["rootpath"]."/conf/apps_php_fpm_pool.conf.master");
 			}
-			
+
 			$fpm_content = str_replace('{fpm_pool}', 'apps', $fpm_content);
 			//$fpm_content = str_replace('{fpm_port}', $web_config['php_fpm_start_port']+1, $fpm_content);
 			$fpm_content = str_replace('{fpm_socket}', $fpm_socket, $fpm_content);
 			$fpm_content = str_replace('{fpm_user}', $apps_vhost_user, $fpm_content);
 			$fpm_content = str_replace('{fpm_group}', $apps_vhost_group, $fpm_content);
 			file_put_contents($web_config['php_fpm_pool_dir'].'/apps.conf', $fpm_content);
-			
+
 			file_put_contents("$vhost_conf_dir/apps.vhost", $content);
-			$app->services->restartServiceDelayed('httpd','reload');
+			$app->services->restartServiceDelayed('httpd', 'reload');
 		}
 	}
-	
+
 
 } // end class
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/aps_plugin.inc.php b/server/plugins-available/aps_plugin.inc.php
index e529b12b207aab48fd9ddc8100133cf1f2c21206..00eb6b794b194cf333a54324a4bc00eac2baf02f 100644
--- a/server/plugins-available/aps_plugin.inc.php
+++ b/server/plugins-available/aps_plugin.inc.php
@@ -28,14 +28,14 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-if(defined('ISPC_ROOT_PATH')) include_once(ISPC_ROOT_PATH.'/lib/classes/aps_installer.inc.php');
+if(defined('ISPC_ROOT_PATH')) include_once ISPC_ROOT_PATH.'/lib/classes/aps_installer.inc.php';
 //require_once(ISPC_ROOT_PATH.'/lib/classes/class.installer.php');
 
 class aps_plugin
 {
-    public $plugin_name = 'aps_plugin';
-    public $class_name = 'aps_plugin';
-	
+	public $plugin_name = 'aps_plugin';
+	public $class_name = 'aps_plugin';
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
@@ -48,71 +48,81 @@ class aps_plugin
 		}
 
 	}
-    
-    /**
-     * This method gets called when the plugin is loaded
-     */
-    public function onLoad()
-    {
-        global $app;
-        
-        // Register the available events
-        $app->plugins->registerEvent('aps_instance_insert', $this->plugin_name, 'install');
-        $app->plugins->registerEvent('aps_instance_update', $this->plugin_name, 'install');
-        $app->plugins->registerEvent('aps_instance_delete', $this->plugin_name, 'delete');
-    }
-    
-    /**
-     * (Re-)install a package
-     */
-    public function install($event_name, $data)
-    {
-        global $app, $conf;
-        
+
+	/**
+	 * This method gets called when the plugin is loaded
+	 */
+
+
+	public function onLoad()
+	{
+		global $app;
+
+		// Register the available events
+		$app->plugins->registerEvent('aps_instance_insert', $this->plugin_name, 'install');
+		$app->plugins->registerEvent('aps_instance_update', $this->plugin_name, 'install');
+		$app->plugins->registerEvent('aps_instance_delete', $this->plugin_name, 'delete');
+	}
+
+
+
+	/**
+	 * (Re-)install a package
+	 */
+	public function install($event_name, $data)
+	{
+		global $app, $conf;
+
 		//* dont run the installer on a mirror server to prevent
 		//  that the pplication gets installed twice.
 		if($conf['mirror_server_id'] > 0) return true;
-		
-		$app->log("Starting APS install",LOGLEVEL_DEBUG);
-        if(!isset($data['new']['id'])) return false;
-        $instanceid = $data['new']['id'];
-		
+
+		$app->log("Starting APS install", LOGLEVEL_DEBUG);
+		if(!isset($data['new']['id'])) return false;
+		$instanceid = $data['new']['id'];
+
 		if($data['new']['instance_status'] == INSTANCE_INSTALL) {
 			$aps = new ApsInstaller($app);
-			$app->log("Running installHandler",LOGLEVEL_DEBUG);
+			$app->log("Running installHandler", LOGLEVEL_DEBUG);
 			$aps->installHandler($instanceid, 'install');
 		}
-		
+
 		if($data['new']['instance_status'] == INSTANCE_REMOVE) {
 			$aps = new ApsInstaller($app);
-			$app->log("Running installHandler",LOGLEVEL_DEBUG);
+			$app->log("Running installHandler", LOGLEVEL_DEBUG);
 			$aps->installHandler($instanceid, 'delete');
 		}
-    }
-    
-    /**
-     * Update an existing instance (currently unused)
-     */
-	 /*
+	}
+
+
+
+	/**
+	 * Update an existing instance (currently unused)
+	 */
+	/*
     public function update($event_name, $data)
     {
     }
 	*/
-    
-    /**
-     * Uninstall an instance
-     */
-    public function delete($event_name, $data)
-    {
-        global $app, $conf;
-        
-        if(!isset($data['new']['id'])) return false;
-        $instanceid = $data['new']['id'];
-		
+
+
+
+	/**
+	 * Uninstall an instance
+	 */
+	public function delete($event_name, $data)
+	{
+		global $app, $conf;
+
+		if(!isset($data['new']['id'])) return false;
+		$instanceid = $data['new']['id'];
+
 		if($data['new']['instance_status'] == INSTANCE_REMOVE) {
 			$aps = new ApsInstaller($app);
 			$aps->installHandler($instanceid, 'install');
-		}        
-    }
+		}
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/plugins-available/backup_plugin.inc.php b/server/plugins-available/backup_plugin.inc.php
index 5da8fc072ac510c1c4839593be2225a319295e35..6c6ef1452003fc8d37476eb1c64f887d04da69f3 100644
--- a/server/plugins-available/backup_plugin.inc.php
+++ b/server/plugins-available/backup_plugin.inc.php
@@ -29,55 +29,55 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class backup_plugin {
-	
+
 	var $plugin_name = 'backup_plugin';
 	var $class_name  = 'backup_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	public function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	public function onLoad() {
 		global $app;
-		
+
 		//* Register for actions
-		$app->plugins->registerAction('backup_download',$this->plugin_name,'backup_action');
-		$app->plugins->registerAction('backup_restore',$this->plugin_name,'backup_action');
-		
+		$app->plugins->registerAction('backup_download', $this->plugin_name, 'backup_action');
+		$app->plugins->registerAction('backup_restore', $this->plugin_name, 'backup_action');
+
 	}
-	
+
 	//* Do a backup action
-	public function backup_action($action_name,$data) {
-		global $app,$conf;
-		
+	public function backup_action($action_name, $data) {
+		global $app, $conf;
+
 		$backup_id = intval($data);
 		$backup = $app->dbmaster->queryOneRecord("SELECT * FROM web_backup WHERE backup_id = $backup_id");
-		
+
 		if(is_array($backup)) {
-		
+
 			$app->uses('ini_parser,file,getconf');
-			
+
 			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$backup['parent_domain_id']);
 			$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
 			$backup_dir = $server_config['backup_dir'].'/web'.$web['domain_id'];
-			
+
 			//* Make backup available for download
 			if($action_name == 'backup_download') {
 				//* Copy the backup file to the backup folder of the website
-				if(file_exists($backup_dir.'/'.$backup['filename']) && !stristr($backup_dir.'/'.$backup['filename'],'..') && !stristr($backup_dir.'/'.$backup['filename'],'etc')) {
-					copy($backup_dir.'/'.$backup['filename'],$web['document_root'].'/backup/'.$backup['filename']);
-					chgrp($web['document_root'].'/backup/'.$backup['filename'],$web['system_group']);
-					$app->log('cp '.$backup_dir.'/'.$backup['filename'].' '.$web['document_root'].'/backup/'.$backup['filename'],LOGLEVEL_DEBUG);
+				if(file_exists($backup_dir.'/'.$backup['filename']) && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
+					copy($backup_dir.'/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename']);
+					chgrp($web['document_root'].'/backup/'.$backup['filename'], $web['system_group']);
+					$app->log('cp '.$backup_dir.'/'.$backup['filename'].' '.$web['document_root'].'/backup/'.$backup['filename'], LOGLEVEL_DEBUG);
 				}
 			}
 
@@ -104,14 +104,14 @@ class backup_plugin {
 				unset($clientdb_host);
 				unset($clientdb_user);
 				unset($clientdb_password);
-				$app->log('Restored MongoDB backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+				$app->log('Restored MongoDB backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 			}
 
 			//* Restore a mysql backup
 			if($action_name == 'backup_restore' && $backup['backup_type'] == 'mysql') {
 				//* Load sql dump into db
-				include('lib/mysql_clientdb.conf');
-				
+				include 'lib/mysql_clientdb.conf';
+
 				if(file_exists($backup_dir.'/'.$backup['filename'])) {
 					//$parts = explode('_',$backup['filename']);
 					//$db_name = $parts[1];
@@ -123,37 +123,37 @@ class backup_plugin {
 				unset($clientdb_host);
 				unset($clientdb_user);
 				unset($clientdb_password);
-				$app->log('Restored MySQL backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+				$app->log('Restored MySQL backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 			}
-			
+
 			//* Restore a web backup
 			if($action_name == 'backup_restore' && $backup['backup_type'] == 'web') {
 				if($backup['backup_mode'] == 'userzip') {
-					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'],'..') && !stristr($backup_dir.'/'.$backup['filename'],'etc')) {
-						if(file_exists($web['document_root'].'/backup/'.$backup['filename'])) rename($web['document_root'].'/backup/'.$backup['filename'],$web['document_root'].'/backup/'.$backup['filename'].'.bak');
-						copy($backup_dir.'/'.$backup['filename'],$web['document_root'].'/backup/'.$backup['filename']);
-						chgrp($web['document_root'].'/backup/'.$backup['filename'],$web['system_group']);
+					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
+						if(file_exists($web['document_root'].'/backup/'.$backup['filename'])) rename($web['document_root'].'/backup/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename'].'.bak');
+						copy($backup_dir.'/'.$backup['filename'], $web['document_root'].'/backup/'.$backup['filename']);
+						chgrp($web['document_root'].'/backup/'.$backup['filename'], $web['system_group']);
 						//chown($web['document_root'].'/backup/'.$backup['filename'],$web['system_user']);
 						$command = 'sudo -u '.escapeshellarg($web['system_user']).' unzip -qq -o  '.escapeshellarg($web['document_root'].'/backup/'.$backup['filename']).' -d '.escapeshellarg($web['document_root']).' 2> /dev/null';
 						exec($command);
 						unlink($web['document_root'].'/backup/'.$backup['filename']);
-						if(file_exists($web['document_root'].'/backup/'.$backup['filename'].'.bak')) rename($web['document_root'].'/backup/'.$backup['filename'].'.bak',$web['document_root'].'/backup/'.$backup['filename']);
-						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+						if(file_exists($web['document_root'].'/backup/'.$backup['filename'].'.bak')) rename($web['document_root'].'/backup/'.$backup['filename'].'.bak', $web['document_root'].'/backup/'.$backup['filename']);
+						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 					}
 				}
 				if($backup['backup_mode'] == 'rootgz') {
-					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'],'..') && !stristr($backup_dir.'/'.$backup['filename'],'etc')) {
+					if(file_exists($backup_dir.'/'.$backup['filename']) && $web['document_root'] != '' && $web['document_root'] != '/' && !stristr($backup_dir.'/'.$backup['filename'], '..') && !stristr($backup_dir.'/'.$backup['filename'], 'etc')) {
 						$command = 'tar xzf '.escapeshellarg($backup_dir.'/'.$backup['filename']).' --directory '.escapeshellarg($web['document_root']);
 						exec($command);
-						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'],LOGLEVEL_DEBUG);
+						$app->log('Restored Web backup '.$backup_dir.'/'.$backup['filename'], LOGLEVEL_DEBUG);
 					}
 				}
 			}
-			
+
 		} else {
-			$app->log('No backup with ID '.$backup_id.' found.',LOGLEVEL_DEBUG);
+			$app->log('No backup with ID '.$backup_id.' found.', LOGLEVEL_DEBUG);
 		}
-		
+
 		return 'ok';
 	}
 
diff --git a/server/plugins-available/bind_dlz_plugin.inc.php b/server/plugins-available/bind_dlz_plugin.inc.php
index 28aff946c90d604f318fa03570a51a4d6ef43428..f6d367f27393057795ce7151b969b5d405a3c292 100644
--- a/server/plugins-available/bind_dlz_plugin.inc.php
+++ b/server/plugins-available/bind_dlz_plugin.inc.php
@@ -66,19 +66,19 @@ CREATE TABLE IF NOT EXISTS `xfr` (
 */
 
 class bind_dlz_plugin {
-	
+
 	var $plugin_name = 'bind_dlz_plugin';
 	var $class_name  = 'bind_dlz_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall()
 	{
 		global $conf;
-		
+
 		if(isset($conf['bind']['installed']) && $conf['bind']['installed'] == true) {
-			// Temporarily disabled until the installer supports the automatic creation of the necessary 
-			// database or at least to select between filebased nd db based bind, as not all bind versions 
+			// Temporarily disabled until the installer supports the automatic creation of the necessary
+			// database or at least to select between filebased nd db based bind, as not all bind versions
 			// support dlz out of the box. To enable this plugin manually, create a symlink from the plugins-enabled
 			// directory to this file in the plugins-available directory.
 			return false;
@@ -86,64 +86,64 @@ class bind_dlz_plugin {
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
-	function onLoad() 
+
+	function onLoad()
 	{
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* SOA
-		$app->plugins->registerEvent('dns_soa_insert',$this->plugin_name,'soa_insert');
-		$app->plugins->registerEvent('dns_soa_update',$this->plugin_name,'soa_update');
-		$app->plugins->registerEvent('dns_soa_delete',$this->plugin_name,'soa_delete');
-		
+		$app->plugins->registerEvent('dns_soa_insert', $this->plugin_name, 'soa_insert');
+		$app->plugins->registerEvent('dns_soa_update', $this->plugin_name, 'soa_update');
+		$app->plugins->registerEvent('dns_soa_delete', $this->plugin_name, 'soa_delete');
+
 		//* RR
-		$app->plugins->registerEvent('dns_rr_insert',$this->plugin_name,'rr_insert');
-		$app->plugins->registerEvent('dns_rr_update',$this->plugin_name,'rr_update');
-		$app->plugins->registerEvent('dns_rr_delete',$this->plugin_name,'rr_delete');
+		$app->plugins->registerEvent('dns_rr_insert', $this->plugin_name, 'rr_insert');
+		$app->plugins->registerEvent('dns_rr_update', $this->plugin_name, 'rr_update');
+		$app->plugins->registerEvent('dns_rr_delete', $this->plugin_name, 'rr_delete');
 	}
-	
-	
-	function soa_insert($event_name,$data) 
+
+
+	function soa_insert($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$origin = substr($data["new"]["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
 		$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
 
 		$ttl = $data["new"]["ttl"];
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-		
+
 		$app->db->query("INSERT INTO named.records (zone, ttl, type, primary_ns, resp_contact, serial, refresh, retry, expire, minimum, ispconfig_id) VALUES ".
-						"('$origin', $ttl, 'SOA', '{$data["new"]["ns"]}', '{$data["new"]["mbox"]}', '{$serial["serial"]}', '{$serial["refresh"]}'," . 
-						"'{$serial["retry"]}', '{$serial["expire"]}', '{$serial["minimum"]}', $ispconfig_id)");
-		//unset($_db);	
+			"('$origin', $ttl, 'SOA', '{$data["new"]["ns"]}', '{$data["new"]["mbox"]}', '{$serial["serial"]}', '{$serial["refresh"]}'," .
+			"'{$serial["retry"]}', '{$serial["expire"]}', '{$serial["minimum"]}', $ispconfig_id)");
+		//unset($_db);
 	}
-	
-	function soa_update($event_name,$data)
+
+	function soa_update($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y')
 		{
 			if($data["old"]["active"] != 'Y') return;
-			$this->soa_delete($event_name,$data);
-		} 
-		else 
+			$this->soa_delete($event_name, $data);
+		}
+		else
 		{
 			if($data["old"]["active"] == 'Y')
 			{
@@ -152,23 +152,23 @@ class bind_dlz_plugin {
 				$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
 
 				$ttl = $data["new"]["ttl"];
-				
+
 				//$_db = clone $app->db;
 				//$_db->dbName = 'named';
-		
+
 				$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, primary_ns = '{$data["new"]["ns"]}', resp_contact = '{$data["new"]["mbox"]}', ".
-								"serial = '{$serial["serial"]}', refresh = '{$serial["refresh"]}', retry = '{$serial["retry"]}', expire = '{$serial["expire"]}', ".
-								"minimum = '{$serial["minimum"]}' WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
+					"serial = '{$serial["serial"]}', refresh = '{$serial["refresh"]}', retry = '{$serial["retry"]}', expire = '{$serial["expire"]}', ".
+					"minimum = '{$serial["minimum"]}' WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
 				//unset($_db);
-			} 
-			else 
+			}
+			else
 			{
-				$this->soa_insert($event_name,$data);
+				$this->soa_insert($event_name, $data);
 				$ispconfig_id = $data["new"]["id"];
-				
+
 				if ($records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = $ispconfig_id AND active = 'Y'"))
 				{
-					foreach($records as $record) 
+					foreach($records as $record)
 					{
 						foreach ($record as $key => $val) {
 							$data["new"][$key] = $val;
@@ -178,96 +178,96 @@ class bind_dlz_plugin {
 				}
 			}
 		}
-			
+
 	}
-	
-	function soa_delete($event_name,$data)
+
+	function soa_delete($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-		
+
 		$app->db->query("DELETE FROM named.records WHERE ispconfig_id = {$data["old"]["id"]}");
-		//unset($_db);	
+		//unset($_db);
 	}
-	
-	function rr_insert($event_name,$data)
+
+	function rr_insert($event_name, $data)
 	{
 		global $app, $conf;
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 		$origin = substr($zone["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
-		
+
 		$type = $data["new"]["type"];
-		
+
 		if (substr($data["new"]["name"], -1) == '.') {
 			$name = substr($data["new"]["name"], 0, -1);
 		} else {
 			$name = ($data["new"]["name"] == "") ? $name = '@' : $data["new"]["name"];
 		}
-		
+
 		if ($name == $origin || $name == '') {
 			$name = '@';
 		}
-		
-		switch ($type) 
+
+		switch ($type)
 		{
-			case "CNAME":
-			case "MX":
-			case "NS":
-			case "ALIAS":
-			case "PTR":
-			case "SRV":
-				if(substr($data["new"]["data"], -1) != '.'){
-					$content = $data["new"]["data"] . '.';
-				} else {
-					$content = $data["new"]["data"];
-				}
-				break;
-			case "HINFO":
-			    $content = $data["new"]["data"];
-				$quote1 = strpos($content, '"');
-				
-				if($quote1 !== FALSE) {
-					$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-				}
-				
-				if ($quote1 !== FALSE && $quote2 !== FALSE) {
-					$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-					$content = $text_between_quotes.substr($content, ($quote2 + 2));
-				}
-				break;
-    		default:
+		case "CNAME":
+		case "MX":
+		case "NS":
+		case "ALIAS":
+		case "PTR":
+		case "SRV":
+			if(substr($data["new"]["data"], -1) != '.'){
+				$content = $data["new"]["data"] . '.';
+			} else {
 				$content = $data["new"]["data"];
+			}
+			break;
+		case "HINFO":
+			$content = $data["new"]["data"];
+			$quote1 = strpos($content, '"');
+
+			if($quote1 !== FALSE) {
+				$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+			}
+
+			if ($quote1 !== FALSE && $quote2 !== FALSE) {
+				$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+				$content = $text_between_quotes.substr($content, ($quote2 + 2));
+			}
+			break;
+		default:
+			$content = $data["new"]["data"];
 		}
-		
+
 		$ttl = $data["new"]["ttl"];
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-		
+
 		if ($type == 'MX') {
 			$app->db->query("INSERT INTO named.records (zone, ttl, type, host, mx_priority, data, ispconfig_id)".
-			" VALUES ('$origin', $ttl, '$type', '$name', {$data["new"]["aux"]}, '$content', $ispconfig_id)");
+				" VALUES ('$origin', $ttl, '$type', '$name', {$data["new"]["aux"]}, '$content', $ispconfig_id)");
 		} else {
 			$app->db->query("INSERT INTO named.records (zone, ttl, type, host, data, ispconfig_id)".
-			" VALUES ('$origin', $ttl, '$type', '$name', '$content', $ispconfig_id)");
+				" VALUES ('$origin', $ttl, '$type', '$name', '$content', $ispconfig_id)");
 		}
 
 		//unset($_db);
 	}
-	
-	function rr_update($event_name,$data)
+
+	function rr_update($event_name, $data)
 	{
 		global $app, $conf;
-		
+
 		if ($data["new"]["active"] != 'Y')
 		{
 			if($data["old"]["active"] != 'Y') return;
-			$this->rr_delete($event_name,$data);
+			$this->rr_delete($event_name, $data);
 		}
 		else
 		{
@@ -276,77 +276,78 @@ class bind_dlz_plugin {
 				$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 				$origin = substr($zone["origin"], 0, -1);
 				$ispconfig_id = $data["new"]["id"];
-				
-				$type = $data["new"]["type"];	
-		
+
+				$type = $data["new"]["type"];
+
 				if (substr($data["new"]["name"], -1) == '.') {
 					$name = substr($data["new"]["name"], 0, -1);
 				} else {
 					$name = ($data["new"]["name"] == "") ? $name = '@' : $data["new"]["name"];
 				}
-				
+
 				if ($name == $origin || $name == '') {
 					$name = '@';
 				}
 
-				switch ($type) 
+				switch ($type)
 				{
-					case "CNAME":
-					case "MX":
-					case "NS":
-					case "ALIAS":
-					case "PTR":
-					case "SRV":
-						if(substr($data["new"]["data"], -1) != '.'){
-							$content = $data["new"]["data"] . '.';
-						} else {
-							$content = $data["new"]["data"];
-						}
-						break;
-					case "HINFO":
-			    		$content = $data["new"]["data"];
-						$quote1 = strpos($content, '"');
-						if($quote1 !== FALSE){
-							$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-						}
-						if($quote1 !== FALSE && $quote2 !== FALSE){
-							$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-							$content = $text_between_quotes.substr($content, ($quote2 + 2));
-						}
-						break;
-    				default:
+				case "CNAME":
+				case "MX":
+				case "NS":
+				case "ALIAS":
+				case "PTR":
+				case "SRV":
+					if(substr($data["new"]["data"], -1) != '.'){
+						$content = $data["new"]["data"] . '.';
+					} else {
 						$content = $data["new"]["data"];
+					}
+					break;
+				case "HINFO":
+					$content = $data["new"]["data"];
+					$quote1 = strpos($content, '"');
+					if($quote1 !== FALSE){
+						$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+					}
+					if($quote1 !== FALSE && $quote2 !== FALSE){
+						$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+						$content = $text_between_quotes.substr($content, ($quote2 + 2));
+					}
+					break;
+				default:
+					$content = $data["new"]["data"];
 				}
-		
+
 				$ttl = $data["new"]["ttl"];
 				$prio = (int)$data["new"]["aux"];
-				
+
 				//$_db = clone $app->db;
 				//$_db->dbName = 'named';
-				
+
 				if ($type == 'MX') {
 					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', host = '$name', mx_priority = $prio, ".
-					"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
+						"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
 				} else {
 					$app->db->query("UPDATE named.records SET zone = '$origin', ttl = $ttl, type = '$type', host = '$name', ".
-					"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
+						"data = '$content' WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
 				}
-				
+
 				//unset($_db);
 			} else {
-				$this->rr_insert($event_name,$data);
+				$this->rr_insert($event_name, $data);
 			}
 		}
 	}
-	
-	function rr_delete($event_name,$data) {
+
+	function rr_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//$_db = clone $app->db;
 		//$_db->dbName = 'named';
-				
+
 		$app->db->query("DELETE FROM named.records WHERE ispconfig_id = {$data["old"]["id"]} AND type != 'SOA'");
 		//unset($_db);
 	}
+
 } // end class
 ?>
diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php
index fd7f516b37a7035f94acb905dc069fe9ada36416..4823cf3c2624c944044a0acfe0bed831c597c56d 100644
--- a/server/plugins-available/bind_plugin.inc.php
+++ b/server/plugins-available/bind_plugin.inc.php
@@ -29,290 +29,290 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class bind_plugin {
-	
+
 	var $plugin_name = 'bind_plugin';
 	var $class_name  = 'bind_plugin';
 	var $action = 'update';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if(isset($conf['bind']['installed']) && $conf['bind']['installed'] == true && @is_link('/usr/local/ispconfig/server/mods-enabled/dns_module.inc.php')) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* SOA
-		$app->plugins->registerEvent('dns_soa_insert',$this->plugin_name,'soa_insert');
-		$app->plugins->registerEvent('dns_soa_update',$this->plugin_name,'soa_update');
-		$app->plugins->registerEvent('dns_soa_delete',$this->plugin_name,'soa_delete');
-
-    //* SLAVE
-		$app->plugins->registerEvent('dns_slave_insert',$this->plugin_name,'slave_insert');
-		$app->plugins->registerEvent('dns_slave_update',$this->plugin_name,'slave_update');
-		$app->plugins->registerEvent('dns_slave_delete',$this->plugin_name,'slave_delete');
-		
+		$app->plugins->registerEvent('dns_soa_insert', $this->plugin_name, 'soa_insert');
+		$app->plugins->registerEvent('dns_soa_update', $this->plugin_name, 'soa_update');
+		$app->plugins->registerEvent('dns_soa_delete', $this->plugin_name, 'soa_delete');
+
+		//* SLAVE
+		$app->plugins->registerEvent('dns_slave_insert', $this->plugin_name, 'slave_insert');
+		$app->plugins->registerEvent('dns_slave_update', $this->plugin_name, 'slave_update');
+		$app->plugins->registerEvent('dns_slave_delete', $this->plugin_name, 'slave_delete');
+
 		//* RR
-		$app->plugins->registerEvent('dns_rr_insert',$this->plugin_name,'rr_insert');
-		$app->plugins->registerEvent('dns_rr_update',$this->plugin_name,'rr_update');
-		$app->plugins->registerEvent('dns_rr_delete',$this->plugin_name,'rr_delete');
-		
+		$app->plugins->registerEvent('dns_rr_insert', $this->plugin_name, 'rr_insert');
+		$app->plugins->registerEvent('dns_rr_update', $this->plugin_name, 'rr_update');
+		$app->plugins->registerEvent('dns_rr_delete', $this->plugin_name, 'rr_delete');
+
 	}
-	
-	
-	function soa_insert($event_name,$data) {
+
+
+	function soa_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
-		$this->soa_update($event_name,$data);
-		
+		$this->soa_update($event_name, $data);
+
 	}
-	
-	function soa_update($event_name,$data) {
+
+	function soa_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Load libraries
 		$app->uses("getconf,tpl");
-		
+
 		//* load the server configuration options
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* Write the domain file
 		if(!empty($data['new']['id'])) {
 			$tpl = new tpl();
 			$tpl->newTemplate("bind_pri.domain.master");
-		
+
 			$zone = $data['new'];
 			$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);
-			
+			$tpl->setLoop('zones', $records);
+
 			//TODO : change this when distribution information has been integrated into server record
-        	if (file_exists('/etc/gentoo-release')) {
-				$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1)));
-        	}
-        	else {
-        		$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'],0,-1)));
-        	}
-        	
-			file_put_contents($filename,$tpl->grab());
+			if (file_exists('/etc/gentoo-release')) {
+				$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
+			}
+			else {
+				$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($zone['origin'], 0, -1)));
+			}
+
+			file_put_contents($filename, $tpl->grab());
 			chown($filename, escapeshellcmd($dns_config['bind_user']));
 			chgrp($filename, escapeshellcmd($dns_config['bind_group']));
-			
+
 			//* Check the zonefile
 			if(is_file($filename.'.err')) unlink($filename.'.err');
-			exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename),$out,$return_status);
+			exec('named-checkzone '.escapeshellarg($zone['origin']).' '.escapeshellarg($filename), $out, $return_status);
 			if($return_status === 0) {
-				$app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG);
+				$app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG);
 			} else {
-				$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ',$out),LOGLEVEL_WARN);
-				rename($filename,$filename.'.err');
+				$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), LOGLEVEL_WARN);
+				rename($filename, $filename.'.err');
 			}
 			unset($tpl);
 			unset($records);
 			unset($records_out);
 			unset($zone);
 		}
-		
+
 		//* rebuild the named.conf file if the origin has changed or when the origin is inserted.
 		//if($this->action == 'insert' || $data['old']['origin'] != $data['new']['origin']) {
-		$this->write_named_conf($data,$dns_config);
+		$this->write_named_conf($data, $dns_config);
 		//}
-		
+
 		//* Delete old domain file, if domain name has been changed
 		if($data['old']['origin'] != $data['new']['origin']) {
 			//TODO : change this when distribution information has been integrated into server record
-        	if (file_exists('/etc/gentoo-release')) {
-        		$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'],0,-1));
-        	}
-        	else {
-        		$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'],0,-1));
-        	}
-			
+			if (file_exists('/etc/gentoo-release')) {
+				$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+			else {
+				$filename = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+
 			if(is_file($filename)) unlink($filename);
 			if(is_file($filename.'.err')) unlink($filename.'.err');
 		}
-		
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-		
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 	}
-	
-	function soa_delete($event_name,$data) {
+
+	function soa_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* load the server configuration options
 		$app->uses("getconf,tpl");
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* rebuild the named.conf file
-		$this->write_named_conf($data,$dns_config);
-		
+		$this->write_named_conf($data, $dns_config);
+
 		//* Delete the domain file
 		//TODO : change this when distribution information has been integrated into server record
-        if (file_exists('/etc/gentoo-release')) {
-        	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-        }
-        else {
-        	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-        }
-		
+		if (file_exists('/etc/gentoo-release')) {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+		else {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+
 		if(is_file($zone_file_name)) unlink($zone_file_name);
 		if(is_file($zone_file_name.'.err')) unlink($zone_file_name.'.err');
-		$app->log("Deleting BIND domain file: ".$zone_file_name,LOGLEVEL_DEBUG);
-		
+		$app->log("Deleting BIND domain file: ".$zone_file_name, LOGLEVEL_DEBUG);
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-			
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 	}
 
-	function slave_insert($event_name,$data) {
+	function slave_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
-		$this->slave_update($event_name,$data);
-		
+		$this->slave_update($event_name, $data);
+
 	}
-	
-	function slave_update($event_name,$data) {
+
+	function slave_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Load libraries
 		$app->uses("getconf,tpl");
-		
+
 		//* load the server configuration options
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* rebuild the named.conf file if the origin has changed or when the origin is inserted.
 		//if($this->action == 'insert' || $data['old']['origin'] != $data['new']['origin']) {
-		$this->write_named_conf($data,$dns_config);
+		$this->write_named_conf($data, $dns_config);
 		//}
-		
+
 		//* Delete old domain file, if domain name has been changed
 		if($data['old']['origin'] != $data['new']['origin']) {
 			//TODO : change this when distribution information has been integrated into server record
-	        if (file_exists('/etc/gentoo-release')) {
-	        	$filename = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	        }
-	        else {
-	        	$filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	        }
-			
+			if (file_exists('/etc/gentoo-release')) {
+				$filename = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+			else {
+				$filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+			}
+
 			if(is_file($filename)) unset($filename);
 		}
-		
+
 		//* Ensure that the named slave directory is writable by the named user
 		if (file_exists('/etc/gentoo-release')) {
 			$slave_record_dir = $dns_config['bind_zonefiles_dir'].'/sec';
 		} else {
 			$slave_record_dir = $dns_config['bind_zonefiles_dir'].'/slave';
 		}
-		if(!@is_dir($slave_record_dir)) mkdir($slave_record_dir,0770);
-		chown($slave_record_dir,$dns_config['bind_user']);
-		chgrp($slave_record_dir,$dns_config['bind_group']);
-		
+		if(!@is_dir($slave_record_dir)) mkdir($slave_record_dir, 0770);
+		chown($slave_record_dir, $dns_config['bind_user']);
+		chgrp($slave_record_dir, $dns_config['bind_group']);
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-     		
+		$app->services->restartServiceDelayed('bind', 'reload');
+
 	}
-	
-	function slave_delete($event_name,$data) {
+
+	function slave_delete($event_name, $data) {
 		global $app, $conf;
-		
-		
+
+
 		//* load the server configuration options
 		$app->uses("getconf,tpl");
 		$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
-		
+
 		//* rebuild the named.conf file
-		$this->write_named_conf($data,$dns_config);
-		
+		$this->write_named_conf($data, $dns_config);
+
 		//* Delete the domain file
 		//TODO : change this when distribution information has been integrated into server record
-	    if (file_exists('/etc/gentoo-release')) {
-	    	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	    }
-	    else {
-	    	$zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_",substr($data['old']['origin'],0,-1));
-	    }
-		
+		if (file_exists('/etc/gentoo-release')) {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+		else {
+			$zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.str_replace("/", "_", substr($data['old']['origin'], 0, -1));
+		}
+
 		if(is_file($zone_file_name)) unlink($zone_file_name);
-		$app->log("Deleting BIND domain file for secondary zone: ".$zone_file_name,LOGLEVEL_DEBUG);
-		
+		$app->log("Deleting BIND domain file for secondary zone: ".$zone_file_name, LOGLEVEL_DEBUG);
+
 		//* Reload bind nameserver
-		$app->services->restartServiceDelayed('bind','reload');
-			
-		
+		$app->services->restartServiceDelayed('bind', 'reload');
+
+
 	}
-	
-	function rr_insert($event_name,$data) {
+
+	function rr_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Get the data of the soa and call soa_update
 		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data['new']['zone']);
 		$data["new"] = $tmp;
 		$data["old"] = $tmp;
 		$this->action = 'update';
-		$this->soa_update($event_name,$data);
+		$this->soa_update($event_name, $data);
 
 	}
-	
-	function rr_update($event_name,$data) {
+
+	function rr_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Get the data of the soa and call soa_update
 		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data['new']['zone']);
 		$data["new"] = $tmp;
 		$data["old"] = $tmp;
 		$this->action = 'update';
-		$this->soa_update($event_name,$data);
-		
+		$this->soa_update($event_name, $data);
+
 	}
-	
-	function rr_delete($event_name,$data) {
+
+	function rr_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Get the data of the soa and call soa_update
 		$tmp = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".intval($data['old']['zone']));
 		$data["new"] = $tmp;
 		$data["old"] = $tmp;
 		$this->action = 'update';
-		$this->soa_update($event_name,$data);
-		
+		$this->soa_update($event_name, $data);
+
 	}
-	
-	###################################################################
-	
+
+	//##################################################################
+
 	function write_named_conf($data, $dns_config) {
 		global $app, $conf;
-	
-		//* Only write the master file for the current server	
+
+		//* Only write the master file for the current server
 		$tmps = $app->db->queryAllRecords("SELECT origin, xfer, also_notify, update_acl FROM dns_soa WHERE active = 'Y' AND server_id=".$conf["server_id"]);
 		$zones = array();
-		
+
 		//* Check if the current zone that triggered this function has at least one NS record
 		/* Has been replaced by a better zone check
 		$rec_num = $app->db->queryOneRecord("SELECT count(id) as ns FROM dns_rr WHERE type = 'NS' AND zone = ".intval($data['new']['id'])." AND active = 'Y'");
@@ -322,87 +322,87 @@ class bind_plugin {
 			$exclude_zone = '';
 		}
 		*/
-		
+
 		//TODO : change this when distribution information has been integrated into server record
-	    if (file_exists('/etc/gentoo-release')) {
-	    	$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri/';
-	    	$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/sec/';
-	    	
-	    }
-	    else {
-	    	$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri.';
-	    	$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/slave/sec.';
-	    }
+		if (file_exists('/etc/gentoo-release')) {
+			$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri/';
+			$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/sec/';
+
+		}
+		else {
+			$pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri.';
+			$sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/slave/sec.';
+		}
 
 		//* Loop trough zones
 		foreach($tmps as $tmp) {
-			
-			$zone_file = $pri_zonefiles_path.str_replace("/", "_",substr($tmp['origin'],0,-1));
-			
+
+			$zone_file = $pri_zonefiles_path.str_replace("/", "_", substr($tmp['origin'], 0, -1));
+
 			$options = '';
 			if(trim($tmp['xfer']) != '') {
-				$options .= "        allow-transfer {".str_replace(',',';',$tmp['xfer']).";};\n";
+				$options .= "        allow-transfer {".str_replace(',', ';', $tmp['xfer']).";};\n";
 			} else {
 				$options .= "        allow-transfer {none;};\n";
 			}
-			if(trim($tmp['also_notify']) != '') $options .= '        also-notify {'.str_replace(',',';',$tmp['also_notify']).";};\n";
-			if(trim($tmp['update_acl']) != '') $options .= "        allow-update {".str_replace(',',';',$tmp['update_acl']).";};\n";
-			
+			if(trim($tmp['also_notify']) != '') $options .= '        also-notify {'.str_replace(',', ';', $tmp['also_notify']).";};\n";
+			if(trim($tmp['update_acl']) != '') $options .= "        allow-update {".str_replace(',', ';', $tmp['update_acl']).";};\n";
+
 			if(file_exists($zone_file)) {
-				$zones[] = array(	'zone' => substr($tmp['origin'],0,-1),
-									'zonefile_path' => $zone_file,
-									'options' => $options
-								);
+				$zones[] = array( 'zone' => substr($tmp['origin'], 0, -1),
+					'zonefile_path' => $zone_file,
+					'options' => $options
+				);
 			}
 		}
 
 		$tpl = new tpl();
 		$tpl->newTemplate("bind_named.conf.local.master");
-		$tpl->setLoop('zones',$zones);
-		
+		$tpl->setLoop('zones', $zones);
+
 		//* And loop through the secondary zones, but only for the current server
 		$tmps_sec = $app->db->queryAllRecords("SELECT origin, xfer, ns FROM dns_slave WHERE active = 'Y' AND server_id=".$conf["server_id"]);
 		$zones_sec = array();
 
 		foreach($tmps_sec as $tmp) {
-			
+
 			$options = "        masters {".$tmp['ns'].";};\n";
-            if(trim($tmp['xfer']) != '') {
-                $options .= "        allow-transfer {".str_replace(',',';',$tmp['xfer']).";};\n";
-            } else {
-                $options .= "        allow-transfer {none;};\n";
-            }
-
-			
-			$zones_sec[] = array(	'zone' => substr($tmp['origin'],0,-1),
-									'zonefile_path' => $sec_zonefiles_path.str_replace("/", "_",substr($tmp['origin'],0,-1)),
-									'options' => $options
-								);
-
-//			$filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($tmp['origin'],0,-1));
-//			$app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG);
-
-					
+			if(trim($tmp['xfer']) != '') {
+				$options .= "        allow-transfer {".str_replace(',', ';', $tmp['xfer']).";};\n";
+			} else {
+				$options .= "        allow-transfer {none;};\n";
+			}
+
+
+			$zones_sec[] = array( 'zone' => substr($tmp['origin'], 0, -1),
+				'zonefile_path' => $sec_zonefiles_path.str_replace("/", "_", substr($tmp['origin'], 0, -1)),
+				'options' => $options
+			);
+
+			//   $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($tmp['origin'],0,-1));
+			//   $app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG);
+
+
 		}
-		
+
 		$tpl_sec = new tpl();
 		$tpl_sec->newTemplate("bind_named.conf.local.slave");
-		$tpl_sec->setLoop('zones',$zones_sec); 
-    		
-		file_put_contents($dns_config['named_conf_local_path'],$tpl->grab()."\n".$tpl_sec->grab()); 
-		$app->log("Writing BIND named.conf.local file: ".$dns_config['named_conf_local_path'],LOGLEVEL_DEBUG);
-
- 		unset($tpl_sec); 
-		unset($zones_sec); 
-		unset($tmps_sec);  
+		$tpl_sec->setLoop('zones', $zones_sec);
+
+		file_put_contents($dns_config['named_conf_local_path'], $tpl->grab()."\n".$tpl_sec->grab());
+		$app->log("Writing BIND named.conf.local file: ".$dns_config['named_conf_local_path'], LOGLEVEL_DEBUG);
+
+		unset($tpl_sec);
+		unset($zones_sec);
+		unset($tmps_sec);
 		unset($tpl);
 		unset($zones);
 		unset($tmps);
-		
+
 	}
-	
-	
-	
+
+
+
 
 } // end class
 
diff --git a/server/plugins-available/cron_jailkit_plugin.inc.php b/server/plugins-available/cron_jailkit_plugin.inc.php
index 963d71efe90597b16117b833096ff9e901ff33c6..c3bd5b749bfad1a1c2847a735473131bdaa2f71a 100644
--- a/server/plugins-available/cron_jailkit_plugin.inc.php
+++ b/server/plugins-available/cron_jailkit_plugin.inc.php
@@ -30,70 +30,72 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cron_jailkit_plugin {
-	
+
 	//* $plugin_name and $class_name have to be the same then the name of this class
 	var $plugin_name = 'cron_jailkit_plugin';
 	var $class_name = 'cron_jailkit_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-        $app->plugins->registerEvent('cron_insert', $this->plugin_name, 'insert');
-        $app->plugins->registerEvent('cron_update', $this->plugin_name, 'update');
-        $app->plugins->registerEvent('cron_delete', $this->plugin_name, 'delete');
-		
+
+		$app->plugins->registerEvent('cron_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('cron_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('cron_delete', $this->plugin_name, 'delete');
+
 	}
-	
+
 	//* This function is called, when a cron job is inserted in the database
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-        if($data["new"]["parent_domain_id"] == '') {
-            $app->log("Parent domain not set",LOGLEVEL_WARN);
-            return 0;
-        }
-        
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        } elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
-            $app->log("Websites (and Crons) cannot be owned by the root user or group.",LOGLEVEL_WARN);
-            return 0;
-        }
-		
+
+		if($data["new"]["parent_domain_id"] == '') {
+			$app->log("Parent domain not set", LOGLEVEL_WARN);
+			return 0;
+		}
+
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		} elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
+			$app->log("Websites (and Crons) cannot be owned by the root user or group.", LOGLEVEL_WARN);
+			return 0;
+		}
+
 		$this->parent_domain = $parent_domain;
-		
-        $app->uses('system');
-		
+
+		$app->uses('system');
+
 		if($app->system->is_user($parent_domain['system_user'])) {
-		
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
+
+
 			if ($data['new']['type'] == "chrooted")
 			{
 				// load the server configuration options
@@ -103,73 +105,75 @@ class cron_jailkit_plugin {
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
                 $this->parent_domain = $parent_domain;
-			
+
 				$this->_setup_jailkit_chroot();
-				
+
 				//$command .= 'usermod -U '.escapeshellcmd($parent_domain['system_user']);
 				//exec($command);
-				
+
 				$this->_add_jailkit_user();
 				*/
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($parent_domain['document_root'],false);
-			
+
+				$app->system->web_folder_protection($parent_domain['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
-				
+
 				$this->_add_jailkit_user();
-				
+
 				$command .= 'usermod -U '.escapeshellcmd($parent_domain["system_user"]).' 2>/dev/null';
 				exec($command);
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($parent_domain['document_root'],true);
+
+				$app->system->web_folder_protection($parent_domain['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin (Cron) -> insert username:".$parent_domain['system_user']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a cron job is updated in the database
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
-        if($data["new"]["parent_domain_id"] == '') {
-            $app->log("Parent domain not set",LOGLEVEL_WARN);
-            return 0;
-        }
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        } elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
-            $app->log("Websites (and Crons) cannot be owned by the root user or group.",LOGLEVEL_WARN);
-            return 0;
-        }
-		
-        $app->uses('system');
-		
+
+		if($data["new"]["parent_domain_id"] == '') {
+			$app->log("Parent domain not set", LOGLEVEL_WARN);
+			return 0;
+		}
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `domain` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		} elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
+			$app->log("Websites (and Crons) cannot be owned by the root user or group.", LOGLEVEL_WARN);
+			return 0;
+		}
+
+		$app->uses('system');
+
 		$this->parent_domain = $parent_domain;
-		
+
 		if($app->system->is_user($parent_domain['system_user'])) {
-        
+
+
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
 			if ($data['new']['type'] == "chrooted")
 			{
-                $app->log("Jailkit Plugin (Cron) -> setting up jail", LOGLEVEL_DEBUG);
+				$app->log("Jailkit Plugin (Cron) -> setting up jail", LOGLEVEL_DEBUG);
 				// load the server configuration options
 				/*
 				$app->uses("getconf");
@@ -177,7 +181,7 @@ class cron_jailkit_plugin {
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
                 $this->parent_domain = $parent_domain;
-			
+
 				$this->_setup_jailkit_chroot();
 				$this->_add_jailkit_user();
 				*/
@@ -187,162 +191,162 @@ class cron_jailkit_plugin {
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
 
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($parent_domain['document_root'],false);
-			
+
+				$app->system->web_folder_protection($parent_domain['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
 				$this->_add_jailkit_user();
-				
+
 				$this->_update_website_security_level();
-				$app->system->web_folder_protection($parent_domain['document_root'],true);
+				$app->system->web_folder_protection($parent_domain['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin (Cron) -> update username:".$parent_domain['system_user']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a cron job is deleted in the database
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* nothing to do here!
-		
+
 	}
-	
+
 	function _setup_jailkit_chroot()
 	{
-		global $app;	
-			
-			//check if the chroot environment is created yet if not create it with a list of program sections from the config
-			if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
-			{
-				$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
-				$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
-				$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
-				exec($command.' 2>/dev/null');
-				
-				$this->app->log("Added jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
-				
-				//$this->_add_jailkit_programs(); // done later on
-				
-				$this->app->load('tpl');
-		
-				$tpl = new tpl();
-				$tpl->newTemplate("bash.bashrc.master");
-				
-				$tpl->setVar('jailkit_chroot',true);
-				$tpl->setVar('domain',$this->parent_domain['domain']);
-                $tpl->setVar('home_dir',$this->_get_home_dir(""));
-				
-				$bashrc = escapeshellcmd($this->parent_domain['document_root']).'/etc/bash.bashrc';
-				if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
-				
-				$app->system->file_put_contents($bashrc,$tpl->grab());
-				unset($tpl);
-				
-				$this->app->log('Added bashrc script: '.$bashrc,LOGLEVEL_DEBUG);
-				
-				$tpl = new tpl();
-				$tpl->newTemplate('motd.master');
-				
-				$tpl->setVar('domain',$this->parent_domain['domain']);
-				
-				$motd = escapeshellcmd($this->parent_domain['document_root']).'/var/run/motd';
-				if(@is_file($motd) || @is_link($motd)) unlink($motd);
-				
-				$app->system->file_put_contents($motd,$tpl->grab());
-				
-			}
-            $this->_add_jailkit_programs();
+		global $app;
+
+		//check if the chroot environment is created yet if not create it with a list of program sections from the config
+		if (!is_dir($this->parent_domain['document_root'].'/etc/jailkit'))
+		{
+			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
+			$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
+			$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
+			exec($command.' 2>/dev/null');
+
+			$this->app->log("Added jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+			//$this->_add_jailkit_programs(); // done later on
+
+			$this->app->load('tpl');
+
+			$tpl = new tpl();
+			$tpl->newTemplate("bash.bashrc.master");
+
+			$tpl->setVar('jailkit_chroot', true);
+			$tpl->setVar('domain', $this->parent_domain['domain']);
+			$tpl->setVar('home_dir', $this->_get_home_dir(""));
+
+			$bashrc = escapeshellcmd($this->parent_domain['document_root']).'/etc/bash.bashrc';
+			if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
+
+			$app->system->file_put_contents($bashrc, $tpl->grab());
+			unset($tpl);
+
+			$this->app->log('Added bashrc script: '.$bashrc, LOGLEVEL_DEBUG);
+
+			$tpl = new tpl();
+			$tpl->newTemplate('motd.master');
+
+			$tpl->setVar('domain', $this->parent_domain['domain']);
+
+			$motd = escapeshellcmd($this->parent_domain['document_root']).'/var/run/motd';
+			if(@is_file($motd) || @is_link($motd)) unlink($motd);
+
+			$app->system->file_put_contents($motd, $tpl->grab());
+
+		}
+		$this->_add_jailkit_programs();
 	}
-	
+
 	function _add_jailkit_programs()
 	{
 		global $app;
-		
+
 		//copy over further programs and its libraries
 		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
 		$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
 		$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\'';
 		exec($command.' 2>/dev/null');
-		
-		$this->app->log("Added programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
-        
-        $command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
-        $command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
-        $command .= ' \''.$this->jailkit_config['jailkit_chroot_cron_programs'].'\'';
-        exec($command.' 2>/dev/null');
-        
-        $this->app->log("Added cron programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
+
+		$this->app->log("Added programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_programs.sh';
+		$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
+		$command .= ' \''.$this->jailkit_config['jailkit_chroot_cron_programs'].'\'';
+		exec($command.' 2>/dev/null');
+
+		$this->app->log("Added cron programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
 	}
-	
+
 	function _add_jailkit_user()
 	{
-			global $app;
-			
-			//add the user to the chroot
-            $jailkit_chroot_userhome = $this->_get_home_dir($this->parent_domain['system_user']);
-			
-			if(!is_dir($this->parent_domain['document_root'].'/etc')) mkdir($this->parent_domain['document_root'].'/etc');
-			if(!is_file($this->parent_domain['document_root'].'/etc/passwd')) exec('touch '.$this->parent_domain['document_root'].'/etc/passwd');
-			
-			// IMPORTANT!
-			// ALWAYS create the user. Even if the user was created before
-			// if we check if the user exists, then a update (no shell -> jailkit) will not work
-			// and the user has FULL ACCESS to the root of the server!
-			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
-			$command .= ' '.escapeshellcmd($this->parent_domain['system_user']);
-			$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
-			$command .= ' '.$jailkit_chroot_userhome;
-			$command .= ' '.escapeshellcmd("/bin/bash");
-			exec($command.' 2>/dev/null');
-				
-			$this->app->log("Added jailkit user to chroot with command: ".$command,LOGLEVEL_DEBUG);
-				
-			$app->system->mkdir(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), 0755, true);
-			$app->system->chown(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_user']));
-			$app->system->chgrp(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_group']));
-			
+		global $app;
+
+		//add the user to the chroot
+		$jailkit_chroot_userhome = $this->_get_home_dir($this->parent_domain['system_user']);
+
+		if(!is_dir($this->parent_domain['document_root'].'/etc')) mkdir($this->parent_domain['document_root'].'/etc');
+		if(!is_file($this->parent_domain['document_root'].'/etc/passwd')) exec('touch '.$this->parent_domain['document_root'].'/etc/passwd');
+
+		// IMPORTANT!
+		// ALWAYS create the user. Even if the user was created before
+		// if we check if the user exists, then a update (no shell -> jailkit) will not work
+		// and the user has FULL ACCESS to the root of the server!
+		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
+		$command .= ' '.escapeshellcmd($this->parent_domain['system_user']);
+		$command .= ' '.escapeshellcmd($this->parent_domain['document_root']);
+		$command .= ' '.$jailkit_chroot_userhome;
+		$command .= ' '.escapeshellcmd("/bin/bash");
+		exec($command.' 2>/dev/null');
+
+		$this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+		$app->system->mkdir(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), 0755, true);
+		$app->system->chown(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_user']));
+		$app->system->chgrp(escapeshellcmd($this->parent_domain['document_root'].$jailkit_chroot_userhome), escapeshellcmd($this->parent_domain['system_group']));
+
 	}
-	
-    function _get_home_dir($username)
-    {
-        return str_replace("[username]",escapeshellcmd($username),$this->jailkit_config["jailkit_chroot_home"]);
-    }
-	
+
+	function _get_home_dir($username)
+	{
+		return str_replace("[username]", escapeshellcmd($username), $this->jailkit_config["jailkit_chroot_home"]);
+	}
+
 	//* Update the website root directory permissions depending on the security level
 	function _update_website_security_level() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		// Get the parent website of this shell user
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
-		
+
 		//* If the security level is set to high
 		if($web_config['security_level'] == 20 && is_array($web)) {
-			$app->system->web_folder_protection($web["document_root"],false);
-			$app->system->chmod($web["document_root"],0755);
-			$app->system->chown($web["document_root"],'root');
-			$app->system->chgrp($web["document_root"],'root');
-			$app->system->web_folder_protection($web["document_root"],true);
+			$app->system->web_folder_protection($web["document_root"], false);
+			$app->system->chmod($web["document_root"], 0755);
+			$app->system->chown($web["document_root"], 'root');
+			$app->system->chgrp($web["document_root"], 'root');
+			$app->system->web_folder_protection($web["document_root"], true);
 		}
 	}
-	
+
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-    
-	
+
+
 
 } // end class
 
diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php
index cf9baa8be0ef2213e4ff735a11dcaf57d297bc68..21d72e6431e346f8ee46bc89421407c02a70d171 100644
--- a/server/plugins-available/cron_plugin.inc.php
+++ b/server/plugins-available/cron_plugin.inc.php
@@ -30,228 +30,229 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class cron_plugin {
-	
+
 	var $plugin_name = 'cron_plugin';
 	var $class_name = 'cron_plugin';
-	
+
 	// private variables
 	var $action = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('cron_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('cron_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('cron_delete',$this->plugin_name,'delete');
-		
+
+		$app->plugins->registerEvent('cron_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('cron_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('cron_delete', $this->plugin_name, 'delete');
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
-		
+		$this->update($event_name, $data);
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($this->action != 'insert') $this->action = 'update';
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
-		
+
 		if($data["new"]["parent_domain_id"] == '') {
-			$app->log("Parent domain not set",LOGLEVEL_WARN);
+			$app->log("Parent domain not set", LOGLEVEL_WARN);
 			return 0;
 		}
-        
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        } elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
-			$app->log("Websites (and Crons) cannot be owned by the root user or group.",LOGLEVEL_WARN);
+
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["new"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		} elseif($parent_domain["system_user"] == 'root' or $parent_domain["system_group"] == 'root') {
+			$app->log("Websites (and Crons) cannot be owned by the root user or group.", LOGLEVEL_WARN);
 			return 0;
 		}
-		
+
 		// Get the client ID
 		$client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["new"]["sys_groupid"]));
 		$client_id = intval($client["client_id"]);
 		unset($client);
-		
+
 		// Create group and user, if not exist
 		$app->uses("system");
-		
+
 		$groupname = escapeshellcmd($parent_domain["system_group"]);
 		if($parent_domain["system_group"] != '' && !$app->system->is_group($parent_domain["system_group"])) {
 			exec("groupadd $groupname");
-			$app->log("Adding the group: $groupname",LOGLEVEL_DEBUG);
+			$app->log("Adding the group: $groupname", LOGLEVEL_DEBUG);
 		}
-		
+
 		$username = escapeshellcmd($parent_domain["system_user"]);
 		if($parent_domain["system_user"] != '' && !$app->system->is_user($parent_domain["system_user"])) {
 			exec("useradd -d ".escapeshellcmd($parent_domain["document_root"])." -g $groupname $username -s /bin/false");
-			$app->log("Adding the user: $username",LOGLEVEL_DEBUG);
+			$app->log("Adding the user: $username", LOGLEVEL_DEBUG);
 		}
-		
+
 		// Set the quota for the user
 		if($username != '' && $app->system->is_user($username)) {
 			if($parent_domain["hd_quota"] > 0){
-    			$blocks_soft = $parent_domain["hd_quota"] * 1024;
-    			$blocks_hard = $blocks_soft + 1024;
-  			} else {
-    			$blocks_soft = $blocks_hard = 0;
-  			}
+				$blocks_soft = $parent_domain["hd_quota"] * 1024;
+				$blocks_hard = $blocks_soft + 1024;
+			} else {
+				$blocks_soft = $blocks_hard = 0;
+			}
 			exec("setquota -u $username $blocks_soft $blocks_hard 0 0 -a &> /dev/null");
 			exec("setquota -T -u $username 604800 604800 -a &> /dev/null");
 		}
-		
+
 		//TODO : change this when distribution information has been integrated into server record
-        //* Gentoo requires a user to be part of the crontab group.
-        if (file_exists('/etc/gentoo-release')) {
-        	if (strpos($app->system->get_user_groups($username), 'crontab') === false) {
-        		$app->system->add_user_to_group('crontab', $username);
-        	}
-        }
-		
+		//* Gentoo requires a user to be part of the crontab group.
+		if (file_exists('/etc/gentoo-release')) {
+			if (strpos($app->system->get_user_groups($username), 'crontab') === false) {
+				$app->system->add_user_to_group('crontab', $username);
+			}
+		}
+
 		// make temp directory writable for the apache and website users
 		$app->system->chmod(escapeshellcmd($parent_domain["document_root"].'/tmp'), 0777);
-		
-        /** TODO READ CRON MASTER **/
-        
-        $this->parent_domain = $parent_domain;
+
+		/** TODO READ CRON MASTER **/
+
+
+		$this->parent_domain = $parent_domain;
 		$this->_write_crontab();
-		
+
 		$this->action = '';
-        
+
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
-        //* get data from web
-        $parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["old"]["parent_domain_id"]));
-        if(!$parent_domain["domain_id"]) {
-            $app->log("Parent domain not found",LOGLEVEL_WARN);
-            return 0;
-        }
-        
-        // Get the client ID
-        $client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["old"]["sys_groupid"]));
-        $client_id = intval($client["client_id"]);
-        unset($client);
-        
-        $this->parent_domain = $parent_domain;
-        $this->_write_crontab();
+
+		//* get data from web
+		$parent_domain = $app->db->queryOneRecord("SELECT `domain_id`, `system_user`, `system_group`, `document_root`, `hd_quota` FROM `web_domain` WHERE `domain_id` = ".intval($data["old"]["parent_domain_id"]));
+		if(!$parent_domain["domain_id"]) {
+			$app->log("Parent domain not found", LOGLEVEL_WARN);
+			return 0;
+		}
+
+		// Get the client ID
+		$client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["old"]["sys_groupid"]));
+		$client_id = intval($client["client_id"]);
+		unset($client);
+
+		$this->parent_domain = $parent_domain;
+		$this->_write_crontab();
 	}
-    
-    function _write_crontab() {
-        global $app, $conf;
-        
-        //* load the server configuration options
-        $app->uses("getconf");
-        
-        $cron_config = $app->getconf->get_server_config($conf["server_id"], 'cron');
-        
-        //* try to find customer's mail address
-        
-        /** TODO: add possibility for client to choose mail notification! **/
-        $cron_content = "MAILTO=''\n";
+
+	function _write_crontab() {
+		global $app, $conf;
+
+		//* load the server configuration options
+		$app->uses("getconf");
+
+		$cron_config = $app->getconf->get_server_config($conf["server_id"], 'cron');
+
+		//* try to find customer's mail address
+
+		/** TODO: add possibility for client to choose mail notification! **/
+		$cron_content = "MAILTO=''\n";
 		$cron_content .= "SHELL='/bin/sh'\n\n";
-        $chr_cron_content = "MAILTO=''\n";
-        $chr_cron_content .= "SHELL='/usr/sbin/jk_chrootsh'\n\n";
-        
-        $cmd_count = 0;
-        $chr_cmd_count = 0;
-        
-        //* read all active cron jobs from database and write them to file
-        $cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ".intval($this->parent_domain["domain_id"]) . " AND c.`active` = 'y'");
-        if($cron_jobs && count($cron_jobs) > 0) {
-            foreach($cron_jobs as $job) {
+		$chr_cron_content = "MAILTO=''\n";
+		$chr_cron_content .= "SHELL='/usr/sbin/jk_chrootsh'\n\n";
+
+		$cmd_count = 0;
+		$chr_cmd_count = 0;
+
+		//* read all active cron jobs from database and write them to file
+		$cron_jobs = $app->db->queryAllRecords("SELECT c.`run_min`, c.`run_hour`, c.`run_mday`, c.`run_month`, c.`run_wday`, c.`command`, c.`type`, `web_domain`.`domain` as `domain` FROM `cron` as c INNER JOIN `web_domain` ON `web_domain`.`domain_id` = c.`parent_domain_id` WHERE c.`parent_domain_id` = ".intval($this->parent_domain["domain_id"]) . " AND c.`active` = 'y'");
+		if($cron_jobs && count($cron_jobs) > 0) {
+			foreach($cron_jobs as $job) {
 				if($job['run_month'] == '@reboot') {
 					$command = "@reboot";
 				} else {
 					$command = str_replace(" ", "", $job['run_min']) . "\t" . str_replace(" ", "", $job['run_hour']) . "\t" . str_replace(" ", "", $job['run_mday']) . "\t" . str_replace(" ", "", $job['run_month']) . "\t" . str_replace(" ", "", $job['run_wday']);
-                }
+				}
 				$command .= "\t{$this->parent_domain['system_user']}"; //* running as user
-                if($job['type'] == 'url') {
-                    $command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " >/dev/null 2>&1";
-                } else {
-                    if($job['type'] == 'chrooted') {
-                        if(substr($job['command'], 0, strlen($this->parent_domain['document_root'])) == $this->parent_domain['document_root']) {
-                            //* delete the unneeded path part
-                            $job['command'] = substr($job['command'], strlen($this->parent_domain['document_root']));
-                        }
-                    }
-                    
-                    $command .= "\t";
-                    if($job['type'] == 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
-                    $command .= $job['command'];
-                }
-                
-                if($job['type'] == 'chrooted') {
-                    $chr_cron_content .= $command . " #{$job['domain']}\n";
-                    $chr_cmd_count++;
-                } else {
-                    $cron_content .= $command . " #{$job['domain']}\n";
-                    $cmd_count++;
-                }
-            }
-        }
-        
-        $cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_'.$this->parent_domain["system_user"]);
-        //TODO : change this when distribution information has been integrated into server record
-        //* Gentoo vixie-cron requires files to end with .cron in the cron.d directory
-        if (file_exists('/etc/gentoo-release')) {
-        	$cron_file .= '.cron';
-        }
-        
-        if($cmd_count > 0) {
-            $app->system->file_put_contents($cron_file, $cron_content);
-            $app->log("Wrote Cron file $cron_file with content:\n$cron_content",LOGLEVEL_DEBUG);
-        } else {
-            $app->system->unlink($cron_file);
-            $app->log("Deleted Cron file $cron_file",LOGLEVEL_DEBUG);
-        }
-        
-        $cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_chrooted_'.$this->parent_domain["system_user"]);
-        if($chr_cmd_count > 0) {
-            $app->system->file_put_contents($cron_file, $chr_cron_content);
-            $app->log("Wrote Cron file $cron_file with content:\n$chr_cron_content",LOGLEVEL_DEBUG);
-        } else {
-            $app->system->unlink($cron_file);
-            $app->log("Deleted Cron file $cron_file",LOGLEVEL_DEBUG);
-        }
-        
-        return 0;
-    }
+				if($job['type'] == 'url') {
+					$command .= "\t{$cron_config['wget']} -q -t 1 -T 7200 -O /dev/null " . escapeshellarg($job['command']) . " >/dev/null 2>&1";
+				} else {
+					if($job['type'] == 'chrooted') {
+						if(substr($job['command'], 0, strlen($this->parent_domain['document_root'])) == $this->parent_domain['document_root']) {
+							//* delete the unneeded path part
+							$job['command'] = substr($job['command'], strlen($this->parent_domain['document_root']));
+						}
+					}
+
+					$command .= "\t";
+					if($job['type'] == 'chrooted' && substr($job['command'], 0, 1) != "/") $command .= $this->parent_domain['document_root'].'/';
+					$command .= $job['command'];
+				}
+
+				if($job['type'] == 'chrooted') {
+					$chr_cron_content .= $command . " #{$job['domain']}\n";
+					$chr_cmd_count++;
+				} else {
+					$cron_content .= $command . " #{$job['domain']}\n";
+					$cmd_count++;
+				}
+			}
+		}
+
+		$cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_'.$this->parent_domain["system_user"]);
+		//TODO : change this when distribution information has been integrated into server record
+		//* Gentoo vixie-cron requires files to end with .cron in the cron.d directory
+		if (file_exists('/etc/gentoo-release')) {
+			$cron_file .= '.cron';
+		}
+
+		if($cmd_count > 0) {
+			$app->system->file_put_contents($cron_file, $cron_content);
+			$app->log("Wrote Cron file $cron_file with content:\n$cron_content", LOGLEVEL_DEBUG);
+		} else {
+			$app->system->unlink($cron_file);
+			$app->log("Deleted Cron file $cron_file", LOGLEVEL_DEBUG);
+		}
+
+		$cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_chrooted_'.$this->parent_domain["system_user"]);
+		if($chr_cmd_count > 0) {
+			$app->system->file_put_contents($cron_file, $chr_cron_content);
+			$app->log("Wrote Cron file $cron_file with content:\n$chr_cron_content", LOGLEVEL_DEBUG);
+		} else {
+			$app->system->unlink($cron_file);
+			$app->log("Deleted Cron file $cron_file", LOGLEVEL_DEBUG);
+		}
+
+		return 0;
+	}
 
 } // end class
 
diff --git a/server/plugins-available/firewall_plugin.inc.php b/server/plugins-available/firewall_plugin.inc.php
index 7197ccc6a9ed726564e7ea853b4313536eb88892..498c9c61843d017b8a4a5a70f8ae0893536283a7 100644
--- a/server/plugins-available/firewall_plugin.inc.php
+++ b/server/plugins-available/firewall_plugin.inc.php
@@ -29,99 +29,99 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class firewall_plugin {
-	
+
 	private $plugin_name = 'firewall_plugin';
 	private $class_name  = 'firewall_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	public function onInstall() {
 		global $conf;
-		
+
 		if($conf['bastille']['installed'] = true && $conf['services']['firewall'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	public function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Mailboxes
-		$app->plugins->registerEvent('firewall_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('firewall_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('firewall_delete',$this->plugin_name,'delete');
+		$app->plugins->registerEvent('firewall_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('firewall_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('firewall_delete', $this->plugin_name, 'delete');
 	}
-	
-	
-	public function insert($event_name,$data) {
+
+
+	public function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
-	public function update($event_name,$data) {
+
+	public function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* load the server configuration options
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
 		if($server_config['firewall'] == 'ufw') {
-			$this->ufw_update($event_name,$data);
+			$this->ufw_update($event_name, $data);
 		} else {
-			$this->bastille_update($event_name,$data);
+			$this->bastille_update($event_name, $data);
 		}
-		
+
 	}
-	
-	public function delete($event_name,$data) {
+
+	public function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* load the server configuration options
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		
+
 		if($server_config['firewall'] == 'ufw') {
-			$this->ufw_delete($event_name,$data);
+			$this->ufw_delete($event_name, $data);
 		} else {
-			$this->bastille_delete($event_name,$data);
+			$this->bastille_delete($event_name, $data);
 		}
-		
+
 	}
-	
-	private function ufw_update($event_name,$data) {
+
+	private function ufw_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		if(!$app->system->is_installed('ufw')) {
-			$app->log('UFW Firewall is not installed',LOGLEVEL_WARN);
+			$app->log('UFW Firewall is not installed', LOGLEVEL_WARN);
 			return false;
 		}
-		
-		exec('ufw --version',$out);
-		$parts = explode(' ',$out[0]);
+
+		exec('ufw --version', $out);
+		$parts = explode(' ', $out[0]);
 		$ufwversion = $parts[1];
 		unset($parts);
 		unset($out);
 
-		if(version_compare ( $ufwversion , '0.30') < 0) {
-			$app->log('The installed UFW Firewall version is too old. Minimum required version 0.30',LOGLEVEL_WARN);
+		if(version_compare( $ufwversion , '0.30') < 0) {
+			$app->log('The installed UFW Firewall version is too old. Minimum required version 0.30', LOGLEVEL_WARN);
 			return false;
 		}
-		
+
 		//* Basic firewall setup when the firewall is added the first time
 		if($event_name == 'firewall_insert') {
 			exec('ufw --force disable');
@@ -129,53 +129,53 @@ class firewall_plugin {
 			exec('ufw default deny incoming');
 			exec('ufw default allow outgoing');
 		}
-		
-		$tcp_ports_new = $this->clean_ports($data['new']['tcp_port'],',');
-		$tcp_ports_old = $this->clean_ports($data['old']['tcp_port'],',');
-		$udp_ports_new = $this->clean_ports($data['new']['udp_port'],',');
-		$udp_ports_old = $this->clean_ports($data['old']['udp_port'],',');
-		
-		$tcp_ports_new_array = explode(',',$tcp_ports_new);
-		$tcp_ports_old_array = explode(',',$tcp_ports_old);
-		$udp_ports_new_array = explode(',',$udp_ports_new);
-		$udp_ports_old_array = explode(',',$udp_ports_old);
-		
+
+		$tcp_ports_new = $this->clean_ports($data['new']['tcp_port'], ',');
+		$tcp_ports_old = $this->clean_ports($data['old']['tcp_port'], ',');
+		$udp_ports_new = $this->clean_ports($data['new']['udp_port'], ',');
+		$udp_ports_old = $this->clean_ports($data['old']['udp_port'], ',');
+
+		$tcp_ports_new_array = explode(',', $tcp_ports_new);
+		$tcp_ports_old_array = explode(',', $tcp_ports_old);
+		$udp_ports_new_array = explode(',', $udp_ports_new);
+		$udp_ports_old_array = explode(',', $udp_ports_old);
+
 		//* add tcp ports
 		foreach($tcp_ports_new_array as $port) {
-			if(!in_array($port,$tcp_ports_old_array) && $port > 0) {
+			if(!in_array($port, $tcp_ports_old_array) && $port > 0) {
 				exec('ufw allow '.$port.'/tcp');
-				$app->log('ufw allow '.$port.'/tcp',LOGLEVEL_DEBUG);
+				$app->log('ufw allow '.$port.'/tcp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		//* remove tcp ports
 		foreach($tcp_ports_old_array as $port) {
-			if(!in_array($port,$tcp_ports_new_array) && $port > 0) {
+			if(!in_array($port, $tcp_ports_new_array) && $port > 0) {
 				exec('ufw delete allow '.$port.'/tcp');
-				$app->log('ufw delete allow '.$port.'/tcp',LOGLEVEL_DEBUG);
+				$app->log('ufw delete allow '.$port.'/tcp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		//* add udp ports
 		foreach($udp_ports_new_array as $port) {
-			if(!in_array($port,$udp_ports_old_array) && $port > 0) {
+			if(!in_array($port, $udp_ports_old_array) && $port > 0) {
 				exec('ufw allow '.$port.'/udp');
-				$app->log('ufw allow '.$port.'/udp',LOGLEVEL_DEBUG);
+				$app->log('ufw allow '.$port.'/udp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		//* remove udp ports
 		foreach($udp_ports_old_array as $port) {
-			if(!in_array($port,$udp_ports_new_array) && $port > 0) {
+			if(!in_array($port, $udp_ports_new_array) && $port > 0) {
 				exec('ufw delete allow '.$port.'/udp');
-				$app->log('ufw delete allow '.$port.'/udp',LOGLEVEL_DEBUG);
+				$app->log('ufw delete allow '.$port.'/udp', LOGLEVEL_DEBUG);
 				sleep(1);
 			}
 		}
-		
+
 		/*
 		if($tcp_ports_new != $tcp_ports_old) {
 			exec('ufw allow to any proto tcp port '.$tcp_ports_new);
@@ -185,7 +185,7 @@ class firewall_plugin {
 				$app->log('ufw delete allow to any proto tcp port '.$tcp_ports_old,LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		if($udp_ports_new != $udp_ports_old) {
 			exec('ufw allow to any proto udp port '.$udp_ports_new);
 			$app->log('ufw allow to any proto udp port '.$udp_ports_new,LOGLEVEL_DEBUG);
@@ -195,61 +195,61 @@ class firewall_plugin {
 			}
 		}
 		*/
-		
+
 		if($data['new']['active'] == 'y') {
 			if($data['new']['active'] == $data['old']['active']) {
 				exec('ufw reload');
-				$app->log('Reloading the firewall',LOGLEVEL_DEBUG);
+				$app->log('Reloading the firewall', LOGLEVEL_DEBUG);
 			} else {
 				//* Ensure that bastille firewall is stopped
 				exec($conf['init_scripts'] . '/' . 'bastille-firewall stop 2>/dev/null');
 				if(@is_file('/etc/debian_version')) exec('update-rc.d -f bastille-firewall remove');
-			
+
 				//* Start ufw firewall
 				exec('ufw --force enable');
-				$app->log('Starting the firewall',LOGLEVEL_DEBUG);
+				$app->log('Starting the firewall', LOGLEVEL_DEBUG);
 			}
 		} else {
 			exec('ufw disable');
-			$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
+			$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
 		}
 	}
-	
-	private function ufw_delete($event_name,$data) {
+
+	private function ufw_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		if(!$app->system->is_installed('ufw')) {
-			$app->log('UFW Firewall is not installed',LOGLEVEL_DEBUG);
+			$app->log('UFW Firewall is not installed', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		exec('ufw --force reset');
 		exec('ufw disable');
-		$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
-		
+		$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
+
 	}
-	
-	private function bastille_update($event_name,$data) {
+
+	private function bastille_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
-		$tcp_ports = $this->clean_ports($data['new']['tcp_port'],' ');
-		$udp_ports = $this->clean_ports($data['new']['udp_port'],' ');
-		
+
+		$tcp_ports = $this->clean_ports($data['new']['tcp_port'], ' ');
+		$udp_ports = $this->clean_ports($data['new']['udp_port'], ' ');
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('bastille-firewall.cfg.master');
-		
-		$tpl->setVar('TCP_PUBLIC_SERVICES',$tcp_ports);
-		$tpl->setVar('UDP_PUBLIC_SERVICES',$udp_ports);
-		
-		file_put_contents('/etc/Bastille/bastille-firewall.cfg',$tpl->grab());
-		$app->log('Writing firewall configuration /etc/Bastille/bastille-firewall.cfg',LOGLEVEL_DEBUG);
+
+		$tpl->setVar('TCP_PUBLIC_SERVICES', $tcp_ports);
+		$tpl->setVar('UDP_PUBLIC_SERVICES', $udp_ports);
+
+		file_put_contents('/etc/Bastille/bastille-firewall.cfg', $tpl->grab());
+		$app->log('Writing firewall configuration /etc/Bastille/bastille-firewall.cfg', LOGLEVEL_DEBUG);
 		unset($tpl);
-		
+
 		if($data['new']['active'] == 'y') {
 			//* ensure that ufw firewall is disabled in case both firewalls are installed
 			if($app->system->is_installed('ufw')) {
@@ -257,36 +257,36 @@ class firewall_plugin {
 			}
 			exec($conf['init_scripts'] . '/' . 'bastille-firewall restart 2>/dev/null');
 			if(@is_file('/etc/debian_version')) exec('update-rc.d bastille-firewall defaults');
-			$app->log('Restarting the firewall',LOGLEVEL_DEBUG);
+			$app->log('Restarting the firewall', LOGLEVEL_DEBUG);
 		} else {
 			exec($conf['init_scripts'] . '/' . 'bastille-firewall stop 2>/dev/null');
 			if(@is_file('/etc/debian_version')) exec('update-rc.d -f bastille-firewall remove');
-			$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
+			$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
 		}
-		
-		
+
+
 	}
-	
-	private function bastille_delete($event_name,$data) {
+
+	private function bastille_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		exec($conf['init_scripts'] . '/' . 'bastille-firewall stop 2>/dev/null');
 		if(@is_file('/etc/debian_version')) exec('update-rc.d -f bastille-firewall remove');
-		$app->log('Stopping the firewall',LOGLEVEL_DEBUG);
-		
+		$app->log('Stopping the firewall', LOGLEVEL_DEBUG);
+
 	}
-	
-	
-	private function clean_ports($portlist,$spacer) {
-		
-		$ports = explode(',',$portlist);
+
+
+	private function clean_ports($portlist, $spacer) {
+
+		$ports = explode(',', $portlist);
 		$ports_out = '';
-		
+
 		if(is_array($ports)) {
 			foreach($ports as $p) {
 				$p_clean = '';
-				if(strstr($p,':')) {
-					$p_parts = explode(':',$p);
+				if(strstr($p, ':')) {
+					$p_parts = explode(':', $p);
 					$tmp_lower = intval($p_parts[0]);
 					$tmp_higher = intval($p_parts[1]);
 					if($tmp_lower > 0 && $tmp_lower <= 65535 && $tmp_higher > 0 && $tmp_higher <= 65535 && $tmp_lower < $tmp_higher) {
@@ -299,13 +299,13 @@ class firewall_plugin {
 					}
 				}
 				if($p_clean != '') $ports_out .= $p_clean . $spacer;
-				
+
 			}
 		}
-		return substr($ports_out,0,strlen($spacer)*-1);
+		return substr($ports_out, 0, strlen($spacer)*-1);
 	}
-	
-	
+
+
 
 } // end class
 
diff --git a/server/plugins-available/ftpuser_base_plugin.inc.php b/server/plugins-available/ftpuser_base_plugin.inc.php
index 66723d24dc9751e6795c3a5838d98049efa03d2f..af33e93b752fb113387bac641b2e3360ebcb3a98 100644
--- a/server/plugins-available/ftpuser_base_plugin.inc.php
+++ b/server/plugins-available/ftpuser_base_plugin.inc.php
@@ -29,104 +29,104 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class ftpuser_base_plugin {
-	
+
 	var $plugin_name = 'ftpuser_base_plugin';
 	var $class_name = 'ftpuser_base_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('ftp_user_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('ftp_user_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('ftp_user_delete',$this->plugin_name,'delete');
 
-		
+		$app->plugins->registerEvent('ftp_user_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('ftp_user_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'delete');
+
+
 	}
-	
-	
-	function insert($event_name,$data) {
+
+
+	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);
-      
-      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-      
-	  //* Check if the resulting path is inside the docroot
-	  if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) {
-		$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);
-    }
-    
+
+		$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);
+
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
+
+			//* Check if the resulting path is inside the docroot
+			if(substr($data['new']['dir'], 0, strlen($web['document_root'])) != $web['document_root']) {
+				$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);
+		}
+
 	}
-	
-	function update($event_name,$data) {
+
+	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);
-      
-      $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-      
-	  //* Check if the resulting path is inside the docroot
-	  if(substr($data['new']['dir'],0,strlen($web['document_root'])) != $web['document_root']) {
-		$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);
-    }
+
+		$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);
+
+			$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
+
+			//* Check if the resulting path is inside the docroot
+			if(substr($data['new']['dir'], 0, strlen($web['document_root'])) != $web['document_root']) {
+				$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);
+		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
-    $app->log("Ftpuser:".$data['new']['username']." deleted.",LOGLEVEL_DEBUG);
-		
+
+		$app->log("Ftpuser:".$data['new']['username']." deleted.", LOGLEVEL_DEBUG);
+
 	}
-	
-	
-	
+
+
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/getmail_plugin.inc.php b/server/plugins-available/getmail_plugin.inc.php
index eb2da0e5c50e457bb9effad7cdda5ac07aed924c..80424ad001eca7a4d286da49ca5f1e3bc924ad4d 100644
--- a/server/plugins-available/getmail_plugin.inc.php
+++ b/server/plugins-available/getmail_plugin.inc.php
@@ -29,84 +29,84 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class getmail_plugin {
-	
+
 	var $plugin_name = 'getmail_plugin';
 	var $class_name = 'getmail_plugin';
-	
+
 	var $getmail_config_dir = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_get_insert','getmail_plugin','insert');
-		$app->plugins->registerEvent('mail_get_update','getmail_plugin','update');
-		$app->plugins->registerEvent('mail_get_delete','getmail_plugin','delete');
-		
-		
-		
+
+		$app->plugins->registerEvent('mail_get_insert', 'getmail_plugin', 'insert');
+		$app->plugins->registerEvent('mail_get_update', 'getmail_plugin', 'update');
+		$app->plugins->registerEvent('mail_get_delete', 'getmail_plugin', 'delete');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server specific configuration options for getmail
 		$app->uses("getconf");
 		$getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
 		$this->getmail_config_dir = $getmail_config["getmail_config_dir"];
-		
+
 		// Check if the config directory exists.
 		if(!is_dir($this->getmail_config_dir)) {
-			$app->log("Getmail config directory '".$this->getmail_config_dir."' does not exist.",LOGLEVEL_ERROR);
+			$app->log("Getmail config directory '".$this->getmail_config_dir."' does not exist.", LOGLEVEL_ERROR);
 		} else {
-			
+
 			// Delete the config file first, if it exists
-			$this->delete($event_name,$data);
-			
+			$this->delete($event_name, $data);
+
 			// Get the new config file path
 			$config_file_path = escapeshellcmd($this->getmail_config_dir.'/'.$this->_clean_path($data["new"]["source_server"]).'_'.$this->_clean_path($data["new"]["source_username"]).'.conf');
-			if(stristr($config_file_path, "..") or stristr($config_file_path, "|") or stristr($config_file_path,";") or stristr($config_file_path,'$')) {
-				$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.",LOGLEVEL_ERROR);
+			if(stristr($config_file_path, "..") or stristr($config_file_path, "|") or stristr($config_file_path, ";") or stristr($config_file_path, '$')) {
+				$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.", LOGLEVEL_ERROR);
 				return false;
 			}
 
-			
+
 			if($data["new"]["active"] == 'y') {
 				// Open master template
 				$tpl = file_get_contents($conf["rootpath"].'/conf/getmail.conf.master');
-			
+
 				// Shall emails be deleted after retrieval
 				if($data["new"]["source_delete"] == 'y') {
-					$tpl = str_replace('{DELETE}','true',$tpl);
+					$tpl = str_replace('{DELETE}', 'true', $tpl);
 				} else {
-					$tpl = str_replace('{DELETE}','false',$tpl);
+					$tpl = str_replace('{DELETE}', 'false', $tpl);
 				}
 
 				if($data["new"]["read_all"] == 'y') {
@@ -114,59 +114,59 @@ class getmail_plugin {
 				} else {
 					$tpl = str_replace('{READ_ALL}', 'false', $tpl);
 				}
-				
+
 				// Set the data retriever
 				if($data["new"]["type"] == 'pop3') {
-					$tpl = str_replace('{TYPE}','SimplePOP3Retriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimplePOP3Retriever', $tpl);
 				} elseif ($data["new"]["type"] == 'imap') {
-					$tpl = str_replace('{TYPE}','SimpleIMAPRetriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimpleIMAPRetriever', $tpl);
 				} elseif ($data["new"]["type"] == 'pop3ssl') {
-					$tpl = str_replace('{TYPE}','SimplePOP3SSLRetriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimplePOP3SSLRetriever', $tpl);
 				} elseif ($data["new"]["type"] == 'imapssl') {
-					$tpl = str_replace('{TYPE}','SimpleIMAPSSLRetriever',$tpl);
+					$tpl = str_replace('{TYPE}', 'SimpleIMAPSSLRetriever', $tpl);
 				}
-			
+
 				// Set server, username, password and destination.
-				$tpl = str_replace('{SERVER}',$data["new"]["source_server"],$tpl);
-				$tpl = str_replace('{USERNAME}',$data["new"]["source_username"],$tpl);
-				$tpl = str_replace('{PASSWORD}',$data["new"]["source_password"],$tpl);
-				$tpl = str_replace('{DESTINATION}',$data["new"]["destination"],$tpl);
-				
+				$tpl = str_replace('{SERVER}', $data["new"]["source_server"], $tpl);
+				$tpl = str_replace('{USERNAME}', $data["new"]["source_username"], $tpl);
+				$tpl = str_replace('{PASSWORD}', $data["new"]["source_password"], $tpl);
+				$tpl = str_replace('{DESTINATION}', $data["new"]["destination"], $tpl);
+
 				// Write the config file.
-				file_put_contents($config_file_path,$tpl);
-				$app->log("Writing Getmail config file: $config_file_path",LOGLEVEL_DEBUG);
+				file_put_contents($config_file_path, $tpl);
+				$app->log("Writing Getmail config file: $config_file_path", LOGLEVEL_DEBUG);
 				chmod($config_file_path, 0400);
 				chown($config_file_path, 'getmail');
 				unset($tpl);
 				unset($config_file_path);
-				
+
 			} else {
 				// If record is set to inactive, we will delete the file
 				if(is_file($config_file_path)) unlink($config_file_path);
 			}
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server specific configuration options for getmail
 		$app->uses("getconf");
 		$getmail_config = $app->getconf->get_server_config($conf["server_id"], 'getmail');
 		$this->getmail_config_dir = $getmail_config["getmail_config_dir"];
-		
+
 		$config_file_path = escapeshellcmd($this->getmail_config_dir.'/'.$this->_clean_path($data["old"]["source_server"]).'_'.$this->_clean_path($data["old"]["source_username"]).'.conf');
-		if(stristr($config_file_path,"..") || stristr($config_file_path,"|") || stristr($config_file_path,";") || stristr($config_file_path,'$')) {
-			$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.",LOGLEVEL_ERROR);
+		if(stristr($config_file_path, "..") || stristr($config_file_path, "|") || stristr($config_file_path, ";") || stristr($config_file_path, '$')) {
+			$app->log("Possibly faked path for getmail config file: '$config_file_path'. File is not written.", LOGLEVEL_ERROR);
 			return false;
 		}
 		if(is_file($config_file_path)) unlink($config_file_path);
 	}
-	
+
 	function _clean_path($input) {
 		return preg_replace('/[^A-Za-z0-9\-_]/', '_', $input);
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/iptables_plugin.inc.php b/server/plugins-available/iptables_plugin.inc.php
index 247eb7bedc590e2f2028a8dbfdc7edd8c77affca..92083bbcdc24fcd14cfb31df4e473ce007c90ccc 100644
--- a/server/plugins-available/iptables_plugin.inc.php
+++ b/server/plugins-available/iptables_plugin.inc.php
@@ -2,43 +2,43 @@
 
 class iptables_plugin
 {
- var $plugin_name = 'iptables_plugin';
- var $class_name  = 'iptables_plugin';
+	var $plugin_name = 'iptables_plugin';
+	var $class_name  = 'iptables_plugin';
 
- function onInstall()
- {
-  global $conf;
-  /*
+	function onInstall()
+	{
+		global $conf;
+		/*
   if($conf['iptables']['installed'] = true) return true;
   else return false;
   */
-  return false;
- }
-
- function onLoad()
- {
-  global $app;
-  $app->plugins->registerEvent('iptables_insert',$this->plugin_name,'insert');
-  $app->plugins->registerEvent('iptables_update',$this->plugin_name,'update');
-  $app->plugins->registerEvent('iptables_delete',$this->plugin_name,'delete');
- }
-
- function insert($event_name,$data)
- {
-  global $app, $conf;
-  $this->update($event_name,$data);
- }
-
- function update($event_name,$data)
- {
-  global $app, $conf;
-/*
+		return false;
+	}
+
+	function onLoad()
+	{
+		global $app;
+		$app->plugins->registerEvent('iptables_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('iptables_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('iptables_delete', $this->plugin_name, 'delete');
+	}
+
+	function insert($event_name, $data)
+	{
+		global $app, $conf;
+		$this->update($event_name, $data);
+	}
+
+	function update($event_name, $data)
+	{
+		global $app, $conf;
+		/*
 ok, here is where we do some fun stuff.  First off we need to see the currently
 running iptables (sans the fail2ban) and compare with the database.  This is
 the method that is good for multi servers and keeping the firewall read only so
 a comromised box will not corrupt the master server.
 
-If the running iptables and the new iptables don't match, lets send a note to 
+If the running iptables and the new iptables don't match, lets send a note to
 the monitoring data to say that there is a difference.  Maybe we can have the
 iptables gui inteface check the data field for changes and post a warning and
 or the changes as disabled rules.  If an admin adds a rule on the comand line
@@ -70,12 +70,14 @@ exec('iptables -S FORWARD');
 $data['new'] should have lots of fun stuff
 exec('iptables -I XYZ');
 */
- }
-	
- function delete($event_name,$data)
- {
-  global $app, $conf;
-  exec('iptables -D xyz');
- }
+	}
+
+	function delete($event_name, $data)
+	{
+		global $app, $conf;
+		exec('iptables -D xyz');
+	}
+
 }
-?>
\ No newline at end of file
+
+?>
diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index 5d4fd988ff5c4be9995b4a9ba2119efec74c3ac3..5bf37d14e46c6b76e9d7b55ca98949fe230e3499 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -29,135 +29,135 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class mail_plugin {
-	
+
 	var $plugin_name = 'mail_plugin';
 	var $class_name  = 'mail_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Mailboxes
-		$app->plugins->registerEvent('mail_user_insert',$this->plugin_name,'user_insert');
-		$app->plugins->registerEvent('mail_user_update',$this->plugin_name,'user_update');
-		$app->plugins->registerEvent('mail_user_delete',$this->plugin_name,'user_delete');
-		
+		$app->plugins->registerEvent('mail_user_insert', $this->plugin_name, 'user_insert');
+		$app->plugins->registerEvent('mail_user_update', $this->plugin_name, 'user_update');
+		$app->plugins->registerEvent('mail_user_delete', $this->plugin_name, 'user_delete');
+
 		//* Mail Domains
 		//$app->plugins->registerEvent('mail_domain_insert',$this->plugin_name,'domain_insert');
 		//$app->plugins->registerEvent('mail_domain_update',$this->plugin_name,'domain_update');
-		$app->plugins->registerEvent('mail_domain_delete',$this->plugin_name,'domain_delete');
-		
+		$app->plugins->registerEvent('mail_domain_delete', $this->plugin_name, 'domain_delete');
+
 		//* Mail transports
-		$app->plugins->registerEvent('mail_transport_insert',$this->plugin_name,'transport_update');
-		$app->plugins->registerEvent('mail_transport_update',$this->plugin_name,'transport_update');
-		$app->plugins->registerEvent('mail_transport_delete',$this->plugin_name,'transport_update');
-		
+		$app->plugins->registerEvent('mail_transport_insert', $this->plugin_name, 'transport_update');
+		$app->plugins->registerEvent('mail_transport_update', $this->plugin_name, 'transport_update');
+		$app->plugins->registerEvent('mail_transport_delete', $this->plugin_name, 'transport_update');
+
 	}
-	
-	
-	function user_insert($event_name,$data) {
+
+
+	function user_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* get the config
 		$app->uses('getconf,system');
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 
 		// convert to lower case - it could cause problems if some directory above has upper case name
-//		$data['new']['maildir'] = strtolower($data['new']['maildir']);
-		
+		//  $data['new']['maildir'] = strtolower($data['new']['maildir']);
+
 		$maildomain_path = $data['new']['maildir'];
 		$tmp_basepath = $data['new']['maildir'];
-		$tmp_basepath_parts = explode('/',$tmp_basepath);
+		$tmp_basepath_parts = explode('/', $tmp_basepath);
 		unset($tmp_basepath_parts[count($tmp_basepath_parts)-1]);
-		$base_path = implode('/',$tmp_basepath_parts);
+		$base_path = implode('/', $tmp_basepath_parts);
 
 		//* Create the mail domain directory, if it does not exist
 		if(!empty($base_path) && !is_dir($base_path)) {
 			//exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
 			$app->system->mkdirpath($base_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG);
 		}
-		
+
 		// Dovecot uses a different mail layout with a separate 'Maildir' subdirectory.
 		if($mail_config['pop3_imap_daemon'] == 'dovecot') {
 			//exec("su -c 'mkdir -p ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			$app->system->mkdirpath($maildomain_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$maildomain_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$maildomain_path, LOGLEVEL_DEBUG);
 			$maildomain_path .= '/Maildir';
 		}
-	
+
 		//* When the mail user dir exists but it is not a valid maildir, remove it
 		if(!empty($maildomain_path) && is_dir($maildomain_path) && !is_dir($maildomain_path.'/new') && !is_dir($maildomain_path.'/cur')) {
 			exec("su -c 'rm -rf ".escapeshellcmd($data['new']['maildir'])."' vmail");
-			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_WARN);
+			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_WARN);
 		}
 
 		//* Create the maildir, if it doesn not exist, set permissions, set quota.
 		if(!empty($maildomain_path) && !is_dir($maildomain_path)) {
 
 			//exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name']);
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name']);
 
 			exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
-			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
+			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_DEBUG);
 
 			//* This is to fix the maildrop quota not being rebuilt after the quota is changed.
 			if($mail_config['pop3_imap_daemon'] != 'dovecot') {
 				if(is_dir($maildomain_path)) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
-				$app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+				$app->log('Created Maildir: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		if(!is_dir($data['new']['maildir'].'/.Sent')) {
 			//exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Sent');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Drafts')) {
 			//exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Drafts');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Trash')) {
 			//exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Trash');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Junk')) {
 			//exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Junk');
 		}
-		
+
 		//* Set the maildir quota
 		if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') {
 			if($data['new']['quota'] > 0) {
 				if(is_dir($data['new']['maildir'])) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
-				$app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+				$app->log('Set Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* Send the welcome email message
 		if(file_exists($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt')) {
 			$lines = file($conf['rootpath'].'/conf-custom/mail/welcome_email_'.$conf['language'].'.txt');
@@ -168,23 +168,23 @@ class mail_plugin {
 		} else {
 			$lines = file($conf['rootpath'].'/conf/mail/welcome_email_en.txt');
 		}
-		
+
 		//* Get from address
-		$parts = explode(':',trim($lines[0]));
+		$parts = explode(':', trim($lines[0]));
 		unset($parts[0]);
-		$welcome_mail_from  = implode(':',$parts);
+		$welcome_mail_from  = implode(':', $parts);
 		unset($lines[0]);
-		
+
 		//* Get subject
-		$parts = explode(':',trim($lines[1]));
+		$parts = explode(':', trim($lines[1]));
 		unset($parts[0]);
-		$welcome_mail_subject  = implode(':',$parts);
+		$welcome_mail_subject  = implode(':', $parts);
 		unset($lines[1]);
-		
+
 		//* Get message
 		$welcome_mail_message = trim(implode($lines));
 		unset($tmp);
-		
+
 		$mailHeaders      = "MIME-Version: 1.0" . "\n";
 		$mailHeaders     .= "Content-type: text/plain; charset=utf-8" . "\n";
 		$mailHeaders     .= "Content-Transfer-Encoding: 8bit" . "\n";
@@ -195,19 +195,19 @@ class mail_plugin {
 
 		//* Send the welcome email only on the "master" mail server to avoid duplicate emails
 		if($conf['mirror_server_id'] == 0) mail($mailTarget, $mailSubject, $welcome_mail_message, $mailHeaders);
-		
+
 	}
-	
-	function user_update($event_name,$data) {
+
+	function user_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses('getconf,system');
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 
 		// convert to lower case - it could cause problems if some directory above has upper case name
 		// $data['new']['maildir'] = strtolower($data['new']['maildir']);
-		
+
 		// Create the maildir, if it does not exist
 		/*
 		if(!is_dir($data['new']['maildir'])) {
@@ -217,74 +217,74 @@ class mail_plugin {
 			$app->log('Created Maildir: '.$data['new']['maildir'],LOGLEVEL_DEBUG);
 		}
 		*/
-		
+
 		$maildomain_path = $data['new']['maildir'];
 		$tmp_basepath = $data['new']['maildir'];
-		$tmp_basepath_parts = explode('/',$tmp_basepath);
+		$tmp_basepath_parts = explode('/', $tmp_basepath);
 		unset($tmp_basepath_parts[count($tmp_basepath_parts)-1]);
-		$base_path = implode('/',$tmp_basepath_parts);
+		$base_path = implode('/', $tmp_basepath_parts);
 
 		//* Create the mail domain directory, if it does not exist
 		if(!empty($base_path) && !is_dir($base_path)) {
 			//exec("su -c 'mkdir -p ".escapeshellcmd($base_path)."' ".$mail_config['mailuser_name']);
 			$app->system->mkdirpath($base_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG);
 		}
-		
+
 		// Dovecot uses a different mail layout with a separate 'Maildir' subdirectory.
 		if($mail_config['pop3_imap_daemon'] == 'dovecot') {
 			$app->system->mkdirpath($maildomain_path, 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
-			$app->log('Created Directory: '.$base_path,LOGLEVEL_DEBUG);
+			$app->log('Created Directory: '.$base_path, LOGLEVEL_DEBUG);
 			$maildomain_path .= '/Maildir';
 		}
-		
+
 		//* When the mail user dir exists but it is not a valid maildir, remove it
 		if(!empty($maildomain_path) && is_dir($maildomain_path) && !is_dir($maildomain_path.'/new') && !is_dir($maildomain_path.'/cur')) {
 			exec("su -c 'rm -rf ".escapeshellcmd($data['new']['maildir'])."' vmail");
-			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_WARN);
+			$app->log('Removed invalid maildir and rebuild it: '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_WARN);
 		}
 
 		//* Create the maildir, if it doesn not exist, set permissions, set quota.
 		if(!empty($maildomain_path) && !is_dir($maildomain_path.'/new')) {
 			//exec("su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log("Created Maildir "."su -c 'maildirmake ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name']);
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name']);
 
 			exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
-			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']),LOGLEVEL_DEBUG);
+			$app->log('Set ownership on '.escapeshellcmd($data['new']['maildir']), LOGLEVEL_DEBUG);
 			//* This is to fix the maildrop quota not being rebuilt after the quota is changed.
 			if($mail_config['pop3_imap_daemon'] != 'dovecot') {
 				if($data['new']['quota'] > 0) {
 					if(is_dir($maildomain_path)) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']); // Avoid maildirmake quota bug, see debian bug #214911
-					$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+					$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 				} else {
 					if(file_exists($data['new']['maildir'].'/maildirsize')) unlink($data['new']['maildir'].'/maildirsize');
-					$app->log('Set Maildir quota to unlimited.',LOGLEVEL_DEBUG);
+					$app->log('Set Maildir quota to unlimited.', LOGLEVEL_DEBUG);
 				}
 			}
 		}
-		
+
 		if(!is_dir($data['new']['maildir'].'/.Sent')) {
 			//exec("su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Sent: '."su -c 'maildirmake -f Sent ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Sent');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Sent');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Drafts')) {
 			//exec("su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Drafts: '."su -c 'maildirmake -f Drafts ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Drafts');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Drafts');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Trash')) {
 			//exec("su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Trash: '."su -c 'maildirmake -f Trash ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Trash');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Trash');
 		}
 		if(!is_dir($data['new']['maildir'].'/.Junk')) {
 			//exec("su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name']);
 			//$app->log('Created submaildir Junk: '."su -c 'maildirmake -f Junk ".escapeshellcmd($maildomain_path)."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
-			$app->system->maildirmake($maildomain_path,$mail_config['mailuser_name'],'Junk');
+			$app->system->maildirmake($maildomain_path, $mail_config['mailuser_name'], 'Junk');
 		}
-		
+
 		// Move mailbox, if domain has changed and delete old mailbox
 		if($data['new']['maildir'] != $data['old']['maildir'] && is_dir($data['old']['maildir'])) {
 			if(is_dir($data['new']['maildir'])) {
@@ -295,73 +295,73 @@ class mail_plugin {
 			// exec('mv -f '.escapeshellcmd($data['old']['maildir']).'/* '.escapeshellcmd($data['new']['maildir']));
 			// if(is_file($data['old']['maildir'].'.ispconfig_mailsize'))exec('mv -f '.escapeshellcmd($data['old']['maildir']).'.ispconfig_mailsize '.escapeshellcmd($data['new']['maildir']));
 			// rmdir($data['old']['maildir']);
-			$app->log('Moved Maildir from: '.$data['old']['maildir'].' to '.$data['new']['maildir'],LOGLEVEL_DEBUG);
+			$app->log('Moved Maildir from: '.$data['old']['maildir'].' to '.$data['new']['maildir'], LOGLEVEL_DEBUG);
 		}
 		//This is to fix the maildrop quota not being rebuilt after the quota is changed.
 		// Courier Layout
 		if(is_dir($data['new']['maildir'].'/new') && $mail_config['pop3_imap_daemon'] != 'dovecot') {
 			if($data['new']['quota'] > 0) {
 				if(is_dir($data['new']['maildir'])) exec("su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
-				$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'],LOGLEVEL_DEBUG);
+				$app->log('Updated Maildir quota: '."su -c 'maildirmake -q ".$data['new']['quota']."S ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name'], LOGLEVEL_DEBUG);
 			} else {
 				if(file_exists($data['new']['maildir'].'/maildirsize')) unlink($data['new']['maildir'].'/maildirsize');
-				$app->log('Set Maildir quota to unlimited.',LOGLEVEL_DEBUG);
+				$app->log('Set Maildir quota to unlimited.', LOGLEVEL_DEBUG);
 			}
 		}
 	}
-	
-	function user_delete($event_name,$data) {
+
+	function user_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		
+
 		$old_maildir_path = escapeshellcmd($data['old']['maildir']);
-		if($old_maildir_path != $mail_config['homedir_path'] && strlen($old_maildir_path) > strlen($mail_config['homedir_path']) && !stristr($old_maildir_path,'//') && !stristr($old_maildir_path,'..') && !stristr($old_maildir_path,'*') && strlen($old_maildir_path) >= 10) {
+		if($old_maildir_path != $mail_config['homedir_path'] && strlen($old_maildir_path) > strlen($mail_config['homedir_path']) && !stristr($old_maildir_path, '//') && !stristr($old_maildir_path, '..') && !stristr($old_maildir_path, '*') && strlen($old_maildir_path) >= 10) {
 			exec('rm -rf '.escapeshellcmd($old_maildir_path));
-			$app->log('Deleted the Maildir: '.$data['old']['maildir'],LOGLEVEL_DEBUG);
+			$app->log('Deleted the Maildir: '.$data['old']['maildir'], LOGLEVEL_DEBUG);
 		} else {
-			$app->log('Possible security violation when deleting the maildir: '.$data['old']['maildir'],LOGLEVEL_ERROR);
+			$app->log('Possible security violation when deleting the maildir: '.$data['old']['maildir'], LOGLEVEL_ERROR);
 		}
 	}
-	
-	function domain_delete($event_name,$data) {
+
+	function domain_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		
+
 		//* Delete maildomain path
 		$old_maildomain_path = escapeshellcmd($mail_config['homedir_path'].'/'.$data['old']['domain']);
-		if($old_maildomain_path != $mail_config['homedir_path'] && !stristr($old_maildomain_path,'//') && !stristr($old_maildomain_path,'..') && !stristr($old_maildomain_path,'*') && !stristr($old_maildomain_path,'&') && strlen($old_maildomain_path) >= 10  && !empty($data['old']['domain'])) {
+		if($old_maildomain_path != $mail_config['homedir_path'] && !stristr($old_maildomain_path, '//') && !stristr($old_maildomain_path, '..') && !stristr($old_maildomain_path, '*') && !stristr($old_maildomain_path, '&') && strlen($old_maildomain_path) >= 10  && !empty($data['old']['domain'])) {
 			exec('rm -rf '.escapeshellcmd($old_maildomain_path));
-			$app->log('Deleted the mail domain directory: '.$old_maildomain_path,LOGLEVEL_DEBUG);
+			$app->log('Deleted the mail domain directory: '.$old_maildomain_path, LOGLEVEL_DEBUG);
 		} else {
-			$app->log('Possible security violation when deleting the mail domain directory: '.$old_maildomain_path,LOGLEVEL_ERROR);
+			$app->log('Possible security violation when deleting the mail domain directory: '.$old_maildomain_path, LOGLEVEL_ERROR);
 		}
-		
+
 		//* Delete mailfilter path
 		$old_maildomain_path = escapeshellcmd($mail_config['homedir_path'].'/mailfilters/'.$data['old']['domain']);
-		if($old_maildomain_path != $mail_config['homedir_path'].'/mailfilters/' && !stristr($old_maildomain_path,'//') && !stristr($old_maildomain_path,'..') && !stristr($old_maildomain_path,'*') && !stristr($old_maildomain_path,'&') && strlen($old_maildomain_path) >= 10 && !empty($data['old']['domain'])) {
+		if($old_maildomain_path != $mail_config['homedir_path'].'/mailfilters/' && !stristr($old_maildomain_path, '//') && !stristr($old_maildomain_path, '..') && !stristr($old_maildomain_path, '*') && !stristr($old_maildomain_path, '&') && strlen($old_maildomain_path) >= 10 && !empty($data['old']['domain'])) {
 			exec('rm -rf '.escapeshellcmd($old_maildomain_path));
-			$app->log('Deleted the mail domain mailfilter directory: '.$old_maildomain_path,LOGLEVEL_DEBUG);
+			$app->log('Deleted the mail domain mailfilter directory: '.$old_maildomain_path, LOGLEVEL_DEBUG);
 		} else {
-			$app->log('Possible security violation when deleting the mail domain mailfilter directory: '.$old_maildomain_path,LOGLEVEL_ERROR);
+			$app->log('Possible security violation when deleting the mail domain mailfilter directory: '.$old_maildomain_path, LOGLEVEL_ERROR);
 		}
 	}
-	
-	function transport_update($event_name,$data) {
+
+	function transport_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		exec($conf['init_scripts'] . '/' . 'postfix reload &> /dev/null');
-		$app->log('Postfix config reloaded ',LOGLEVEL_DEBUG);
-		
+		$app->log('Postfix config reloaded ', LOGLEVEL_DEBUG);
+
 	}
-	
-	
-	
+
+
+
 
 } // end class
 
diff --git a/server/plugins-available/mail_plugin_dkim.inc.php b/server/plugins-available/mail_plugin_dkim.inc.php
index 72a1d03ee5980596eeda2bc194acbc2681263246..322ccd84677be6c62bdb24fb83d6a912f42fabbd 100644
--- a/server/plugins-available/mail_plugin_dkim.inc.php
+++ b/server/plugins-available/mail_plugin_dkim.inc.php
@@ -1,36 +1,37 @@
 <?php
 
 /**
-Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
-Copyright (c) 2013, Florian Schaal, info@schaal-24.de
-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.
-
-@author Florian Schaal, info@schaal-24.de
-@copyrighth Florian Schaal, info@schaal-24.de
-*/
+ Copyright (c) 2007 - 2013, Till Brehm, projektfarm Gmbh
+ Copyright (c) 2013, Florian Schaal, info@schaal-24.de
+ 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.
+
+ @author Florian Schaal, info@schaal-24.de
+ @copyrighth Florian Schaal, info@schaal-24.de
+ */
+
 
 class mail_plugin_dkim {
 
@@ -40,10 +41,11 @@ class mail_plugin_dkim {
 	// private variables
 	var $action = '';
 
-	/** 
-	* This function is called during ispconfig installation to determine
-	* if a symlink shall be created for this plugin.
-	*/
+
+	/**
+	 * This function is called during ispconfig installation to determine
+	 * if a symlink shall be created for this plugin.
+	 */
 	function onInstall() {
 		global $conf;
 
@@ -55,23 +57,25 @@ class mail_plugin_dkim {
 
 	}
 
+
 	/**
-	* This function is called when the plugin is loaded
-	*/
+	 * This function is called when the plugin is loaded
+	 */
 	function onLoad() {
-		global $app,$conf;
+		global $app, $conf;
 		/*
 		Register for the events
 		*/
-		$app->plugins->registerEvent('mail_domain_delete',$this->plugin_name,'domain_dkim_delete');
-		$app->plugins->registerEvent('mail_domain_insert',$this->plugin_name,'domain_dkim_insert');
-		$app->plugins->registerEvent('mail_domain_update',$this->plugin_name,'domain_dkim_update');
+		$app->plugins->registerEvent('mail_domain_delete', $this->plugin_name, 'domain_dkim_delete');
+		$app->plugins->registerEvent('mail_domain_insert', $this->plugin_name, 'domain_dkim_insert');
+		$app->plugins->registerEvent('mail_domain_update', $this->plugin_name, 'domain_dkim_update');
 	}
 
-        /**
-        * This function gets the amavisd-config file
-	* @return string path to the amavisd-config for dkim-keys
-        */
+
+	/**
+	 * This function gets the amavisd-config file
+	 * @return string path to the amavisd-config for dkim-keys
+	 */
 	function get_amavis_config() {
 		$pos_config=array(
 			'/etc/amavisd.conf',
@@ -79,122 +83,131 @@ class mail_plugin_dkim {
 			'/etc/amavis/conf.d/50-user'
 		);
 		$amavis_configfile='';
-                foreach($pos_config as $conf) {
+		foreach($pos_config as $conf) {
 			if (is_file($conf)) {
 				$amavis_configfile=$conf;
 				break;
 			}
-                }
+		}
 		return $amavis_configfile;
 	}
 
+
 	/**
-	* This function checks the relevant configs and disables dkim for the domain 
-	* if the directory for dkim is not writeable or does not exist
-	* @param array $data mail-settings
-	* @return boolean - true when the amavis-config and the dkim-dir are writeable
-	*/
+	 * This function checks the relevant configs and disables dkim for the domain
+	 * if the directory for dkim is not writeable or does not exist
+	 * @param array $data mail-settings
+	 * @return boolean - true when the amavis-config and the dkim-dir are writeable
+	 */
 	function check_system($data) {
-		global $app,$mail_config;
-                $app->uses('getconf');
+		global $app, $mail_config;
+		$app->uses('getconf');
 		$check=true;
 		/* check for amavis-config */
 		if ( $this->get_amavis_config() == '' || !is_writeable($this->get_amavis_config()) ) {
-			$app->log('Amavis-config not found or not writeable.',LOGLEVEL_ERROR);
+			$app->log('Amavis-config not found or not writeable.', LOGLEVEL_ERROR);
 			$check=false;
 		}
 		/* dir for dkim-keys writeable? */
-                $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
+		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
 		if (isset($mail_config['dkim_path']) && isset($data['new']['dkim_private']) && !empty($data['new']['dkim_private'])) {
 			if (!is_writeable($mail_config['dkim_path'])) {
-				$app->log('DKIM Path '.$mail_config['dkim_path'].' not found or not writeable.',LOGLEVEL_ERROR);
+				$app->log('DKIM Path '.$mail_config['dkim_path'].' not found or not writeable.', LOGLEVEL_ERROR);
 				$check=false;
-               		}
+			}
 		} else {
-			$app->log('Unable to write DKIM settings; Check your config!',LOGLEVEL_ERROR);
+			$app->log('Unable to write DKIM settings; Check your config!', LOGLEVEL_ERROR);
 			$check=false;
 		}
 		return $check;
 	}
-        
+
+
+
+
+
 	/**
-	* This function restarts amavis
-	*/
+	 * This function restarts amavis
+	 */
 	function restart_amavis() {
-		global $app,$conf;
+		global $app, $conf;
 		$initfile=$conf['init_scripts'].'/amavis';
-		$app->log('Restarting amavis.',LOGLEVEL_DEBUG);
-		exec(escapeshellarg($conf['init_scripts']).escapeshellarg('/amavis').' restart',$output);
-		foreach($output as $logline) $app->log($logline,LOGLEVEL_DEBUG);
+		$app->log('Restarting amavis.', LOGLEVEL_DEBUG);
+		exec(escapeshellarg($conf['init_scripts']).escapeshellarg('/amavis').' restart', $output);
+		foreach($output as $logline) $app->log($logline, LOGLEVEL_DEBUG);
 	}
 
+
 	/**
-        * This function writes the keyfiles (public and private)
-	* @param string $key_file full path to the key-file
-	* @param string $key_value private-key
-	* @param string $key_domain mail-domain
-	* @return bool - true when the key is written to disk
-        */
-	function write_dkim_key($key_file,$key_value,$key_domain) {
-                global $app,$mailconfig;
+	 * This function writes the keyfiles (public and private)
+	 * @param string $key_file full path to the key-file
+	 * @param string $key_value private-key
+	 * @param string $key_domain mail-domain
+	 * @return bool - true when the key is written to disk
+	 */
+	function write_dkim_key($key_file, $key_value, $key_domain) {
+		global $app, $mailconfig;
 		$success=false;
-		if (!file_put_contents($key_file.'.private',$key_value) === false) { 
-			$app->log('Saved DKIM Private-key to '.$key_file.'.private',LOGLEVEL_DEBUG);
+		if (!file_put_contents($key_file.'.private', $key_value) === false) {
+			$app->log('Saved DKIM Private-key to '.$key_file.'.private', LOGLEVEL_DEBUG);
 			$success=true;
 			/* now we get the DKIM Public-key */
-			exec('cat '.escapeshellarg($key_file.'.private').'|openssl rsa -pubout',$pubkey,$result);
+			exec('cat '.escapeshellarg($key_file.'.private').'|openssl rsa -pubout', $pubkey, $result);
 			$public_key='';
 			foreach($pubkey as $values) $public_key=$public_key.$values."\n";
 			/* save the DKIM Public-key in dkim-dir */
-			if (!file_put_contents($key_file.'.public',$public_key) === false) 
-				$app->log('Saved DKIM Public to '.$key_domain.'.',LOGLEVEL_DEBUG);
-			else $app->log('Unable to save DKIM Public to '.$key_domain.'.',LOGLEVEL_WARNING);
-		} 
+			if (!file_put_contents($key_file.'.public', $public_key) === false)
+				$app->log('Saved DKIM Public to '.$key_domain.'.', LOGLEVEL_DEBUG);
+			else $app->log('Unable to save DKIM Public to '.$key_domain.'.', LOGLEVEL_WARNING);
+		}
 		return $success;
 	}
 
+
 	/**
-	* This function removes the keyfiles
-	* @param string $key_file full path to the key-file
-	* @param string $key_domain mail-domain
-	*/
-	function remove_dkim_key($key_file,$key_domain) {
+	 * This function removes the keyfiles
+	 * @param string $key_file full path to the key-file
+	 * @param string $key_domain mail-domain
+	 */
+	function remove_dkim_key($key_file, $key_domain) {
 		global $app;
 		if (file_exists($key_file.'.private')) {
 			exec('rm -f '.escapeshellarg($key_file.'.private'));
-			$app->log('Deleted the DKIM Private-key for '.$key_domain.'.',LOGLEVEL_DEBUG);
-		} else $app->log('Unable to delete the DKIM Private-key for '.$key_domain.' (not found).',LOGLEVEL_DEBUG);
+			$app->log('Deleted the DKIM Private-key for '.$key_domain.'.', LOGLEVEL_DEBUG);
+		} else $app->log('Unable to delete the DKIM Private-key for '.$key_domain.' (not found).', LOGLEVEL_DEBUG);
 		if (file_exists($key_file.'.public')) {
 			exec('rm -f '.escapeshellarg($key_file.'.public'));
-			$app->log('Deleted the DKIM Public-key for '.$key_domain.'.',LOGLEVEL_DEBUG);
-		} else $app->log('Unable to delete the DKIM Public-key for '.$key_domain.' (not found).',LOGLEVEL_DEBUG);
+			$app->log('Deleted the DKIM Public-key for '.$key_domain.'.', LOGLEVEL_DEBUG);
+		} else $app->log('Unable to delete the DKIM Public-key for '.$key_domain.' (not found).', LOGLEVEL_DEBUG);
 	}
 
+
 	/**
-	* This function adds the entry to the amavisd-config
-	* @param string $key_domain mail-domain
-	*/
+	 * This function adds the entry to the amavisd-config
+	 * @param string $key_domain mail-domain
+	 */
 	function add_to_amavis($key_domain) {
-		global $app,$mail_config;
+		global $app, $mail_config;
 		$amavis_config = file_get_contents($this->get_amavis_config());
-	       	$key_value="dkim_key('".$key_domain."', 'default', '".$mail_config['dkim_path']."/".$key_domain.".private');\n";
-       	        if(strpos($amavis_config, $key_value) !== false) $amavis_config = str_replace($key_value, '', $amavis_config);
-		if (!file_put_contents($this->get_amavis_config(),$key_value,FILE_APPEND) === false) {
-			$app->log('Adding DKIM Private-key to amavis-config.',LOGLEVEL_DEBUG);
+		$key_value="dkim_key('".$key_domain."', 'default', '".$mail_config['dkim_path']."/".$key_domain.".private');\n";
+		if(strpos($amavis_config, $key_value) !== false) $amavis_config = str_replace($key_value, '', $amavis_config);
+		if (!file_put_contents($this->get_amavis_config(), $key_value, FILE_APPEND) === false) {
+			$app->log('Adding DKIM Private-key to amavis-config.', LOGLEVEL_DEBUG);
 			$this->restart_amavis();
 		}
 	}
 
+
 	/**
-	* This function removes the entry from the amavisd-config
-	* @param string $key_domain mail-domain
-	*/
+	 * This function removes the entry from the amavisd-config
+	 * @param string $key_domain mail-domain
+	 */
 	function remove_from_amavis($key_domain) {
 		global $app;
 		$amavis_config = file($this->get_amavis_config());
 		$i=0;$found=false;
 		foreach($amavis_config as $line) {
-			if (preg_match("/^\bdkim_key\b.*\b".$key_domain."\b/",$line)) {
+			if (preg_match("/^\bdkim_key\b.*\b".$key_domain."\b/", $line)) {
 				unset($amavis_config[$i]);
 				$found=true;
 			}
@@ -202,95 +215,102 @@ class mail_plugin_dkim {
 		}
 		if ($found) {
 			file_put_contents($this->get_amavis_config(), $amavis_config);
-			$app->log('Deleted the DKIM settings from amavis-config for '.$key_domain.'.',LOGLEVEL_DEBUG);
+			$app->log('Deleted the DKIM settings from amavis-config for '.$key_domain.'.', LOGLEVEL_DEBUG);
 			$this->restart_amavis();
-		} else $app->log('Unable to delete the DKIM settings from amavis-config for '.$key_domain.'.',LOGLEVEL_ERROR);
+		} else $app->log('Unable to delete the DKIM settings from amavis-config for '.$key_domain.'.', LOGLEVEL_ERROR);
 	}
 
+
 	/**
-	* This function controlls new key-files and amavisd-entries
-	* @param array $data mail-settings
-	*/
+	 * This function controlls new key-files and amavisd-entries
+	 * @param array $data mail-settings
+	 */
 	function add_dkim($data) {
 		global $app;
 		if ($data['new']['active'] == 'y') {
-	                $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-			if ( substr($mail_config['dkim_path'],strlen($mail_config['dkim_path'])-1) == '/' )
-				$mail_config['dkim_path'] = substr($mail_config['dkim_path'],0,strlen($mail_config['dkim_path'])-1);
-			if ($this->write_dkim_key($mail_config['dkim_path']."/".$data['new']['domain'],$data['new']['dkim_private'],$data['new']['domain'])) {
-	       		        $this->add_to_amavis($data['new']['domain']);
+			$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
+			if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' )
+				$mail_config['dkim_path'] = substr($mail_config['dkim_path'], 0, strlen($mail_config['dkim_path'])-1);
+			if ($this->write_dkim_key($mail_config['dkim_path']."/".$data['new']['domain'], $data['new']['dkim_private'], $data['new']['domain'])) {
+				$this->add_to_amavis($data['new']['domain']);
 			} else {
-				$app->log('Error saving the DKIM Private-key for '.$data['new']['domain'].' - DKIM is not enabled for the domain.',LOGLEVEL_ERROR);
+				$app->log('Error saving the DKIM Private-key for '.$data['new']['domain'].' - DKIM is not enabled for the domain.', LOGLEVEL_ERROR);
 			}
 		}
 		else {
-			$app->log('DKIM for '.$data['new']['domain'].' not written to disk - domain is inactive',LOGLEVEL_DEBUG);
+			$app->log('DKIM for '.$data['new']['domain'].' not written to disk - domain is inactive', LOGLEVEL_DEBUG);
 		}
 	}
 
+
 	/**
-	* This function controlls the removement of keyfiles (public and private)
-	* and the entry in the amavisd-config
-	* @param array $data mail-settings
-	*/
+	 * This function controlls the removement of keyfiles (public and private)
+	 * and the entry in the amavisd-config
+	 * @param array $data mail-settings
+	 */
 	function remove_dkim($_data) {
 		global $app;
-                $mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		if ( substr($mail_config['dkim_path'],strlen($mail_config['dkim_path'])-1) == '/' )
-			$mail_config['dkim_path'] = substr($mail_config['dkim_path'],0,strlen($mail_config['dkim_path'])-1);
-		$this->remove_dkim_key($mail_config['dkim_path']."/".$_data['domain'],$_data['domain']);
-               	$this->remove_from_amavis($_data['domain']);
+		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
+		if ( substr($mail_config['dkim_path'], strlen($mail_config['dkim_path'])-1) == '/' )
+			$mail_config['dkim_path'] = substr($mail_config['dkim_path'], 0, strlen($mail_config['dkim_path'])-1);
+		$this->remove_dkim_key($mail_config['dkim_path']."/".$_data['domain'], $_data['domain']);
+		$this->remove_from_amavis($_data['domain']);
 	}
 
+
 	/**
-	* Function called by onLoad
-	* deletes dkim-keys
-	*/
-	function domain_dkim_delete($event_name,$data) {
+	 * Function called by onLoad
+	 * deletes dkim-keys
+	 */
+	function domain_dkim_delete($event_name, $data) {
 		if (isset($data['old']['dkim']) && $data['old']['dkim'] == 'y') $this->remove_dkim($data['old']);
 	}
 
+
 	/**
-	* Function called by onLoad
-	* insert dkim-keys
-	*/
-	function domain_dkim_insert($event_name,$data) {
+	 * Function called by onLoad
+	 * insert dkim-keys
+	 */
+	function domain_dkim_insert($event_name, $data) {
 		if (isset($data['new']['dkim']) && $data['new']['dkim']=='y' && $this->check_system($data)) {
 			$this->add_dkim($data);
 		}
 	}
 
+
 	/**
-	* Function called by onLoad
-	* chang dkim-settings
-	*/
-	function domain_dkim_update($event_name,$data) {
+	 * Function called by onLoad
+	 * chang dkim-settings
+	 */
+	function domain_dkim_update($event_name, $data) {
 		global $app;
-                /* get the config */
+		/* get the config */
 		if (isset($data['new']['dkim']) && $data['new']['dkim']=='y') { /* DKIM enabled */
 			if ($this->check_system($data)) {
 				/* new domain-name */
-        		        if ($data['old']['domain'] != $data['new']['domain']) {
+				if ($data['old']['domain'] != $data['new']['domain']) {
 					$this->remove_dkim($data['old']);
 					$this->add_dkim($data);
 				}
 				/* new key */
-        		        if (($data['old']['dkim_private'] != $data['new']['dkim_private']) || ($data['old']['dkim'] != $data['new']['dkim'])) {
-				if ($data['new']['dkim_private'] != $data['old']['dkim_private']) $this->remove_dkim($data['new']);
+				if (($data['old']['dkim_private'] != $data['new']['dkim_private']) || ($data['old']['dkim'] != $data['new']['dkim'])) {
+					if ($data['new']['dkim_private'] != $data['old']['dkim_private']) $this->remove_dkim($data['new']);
 					$this->add_dkim($data);
 				}
 				/* change active (on / off) */
-                		if ($data['old']['active'] != $data['new']['active']) {
-                        		if ($data['new']['active'] == 'y') {
-	                        		$this->add_dkim($data);
+				if ($data['old']['active'] != $data['new']['active']) {
+					if ($data['new']['active'] == 'y') {
+						$this->add_dkim($data);
 					} else {
-        	                		$this->remove_dkim($data['new']);
-	        	                }
-        	        	}
-			}	
+						$this->remove_dkim($data['new']);
+					}
+				}
+			}
 		}
 		if (isset($data['new']['dkim']) && $data['old']['dkim'] != $data['new']['dkim'])
 			if ($this->check_system($data) && $data['new']['dkim'] == 'n') $this->remove_dkim($data['new']);
 	}
+
 }
+
 ?>
diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php
index 6d55dd32bf3f50b8e5ccd73505c43ccf21589b5e..08a4998a9fef4a86846e3b1c7464c16b62ae6e96 100644
--- a/server/plugins-available/maildeliver_plugin.inc.php
+++ b/server/plugins-available/maildeliver_plugin.inc.php
@@ -29,136 +29,136 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class maildeliver_plugin {
-	
+
 	var $plugin_name = 'maildeliver_plugin';
 	var $class_name = 'maildeliver_plugin';
-	
-	
+
+
 	var $mailfilter_config_dir = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true && isset($conf['dovecot']['installed']) && $conf['dovecot']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_user_insert','maildeliver_plugin','update');
-		$app->plugins->registerEvent('mail_user_update','maildeliver_plugin','update');
-		$app->plugins->registerEvent('mail_user_delete','maildeliver_plugin','delete');
-		
+
+		$app->plugins->registerEvent('mail_user_insert', 'maildeliver_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_update', 'maildeliver_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_delete', 'maildeliver_plugin', 'delete');
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
-		if(substr($mail_config["homedir_path"],-1) == '/') {
-			$mail_config["homedir_path"] = substr($mail_config["homedir_path"],0,-1);
+		if(substr($mail_config["homedir_path"], -1) == '/') {
+			$mail_config["homedir_path"] = substr($mail_config["homedir_path"], 0, -1);
 		}
-		
+
 		if(isset($data["new"]["email"])) {
-			$email_parts = explode("@",$data["new"]["email"]);
+			$email_parts = explode("@", $data["new"]["email"]);
 		} else {
-			$email_parts = explode("@",$data["old"]["email"]);
+			$email_parts = explode("@", $data["old"]["email"]);
 		}
-			
+
 		// Write the custom mailfilter script, if mailfilter recipe has changed
 		if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
-			   or $data["old"]["move_junk"] != $data["new"]["move_junk"]
-			   or $data["old"]["autoresponder_subject"] != $data["new"]["autoresponder_subject"] 
-			   or $data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] 
-			   or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
-			   or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
-			   or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
-			   or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]
-			   or $data["old"]["cc"] != $data["new"]["cc"]
-			   ) {
-				
-			$app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG);
-				
+			or $data["old"]["move_junk"] != $data["new"]["move_junk"]
+			or $data["old"]["autoresponder_subject"] != $data["new"]["autoresponder_subject"]
+			or $data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"]
+			or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
+			or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
+			or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
+			or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]
+			or $data["old"]["cc"] != $data["new"]["cc"]
+		) {
+
+			$app->log("Mailfilter config has been changed", LOGLEVEL_DEBUG);
+
 			$sieve_file = $data["new"]["maildir"].'/.sieve';
-			if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file",LOGLEVEL_WARN);
-				
+			if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file", LOGLEVEL_WARN);
+
 			$app->load('tpl');
-			
+
 			//* Select sieve filter file for dovecot version
-			exec('dovecot --version',$tmp);
-			if(substr($tmp[0],0,3) == '1.0') {
+			exec('dovecot --version', $tmp);
+			if(substr($tmp[0], 0, 3) == '1.0') {
 				$filter_file_template = "sieve_filter.master";
-			} elseif(substr($tmp[0],0,3) == '1.2') {
+			} elseif(substr($tmp[0], 0, 3) == '1.2') {
 				$filter_file_template = "sieve_filter_1.2.master";
-			} elseif(substr($tmp[0],0,1) == '2') {
+			} elseif(substr($tmp[0], 0, 1) == '2') {
 				$filter_file_template = "sieve_filter_1.2.master";
 			} else {
 				$filter_file_template = "sieve_filter.master";
 			}
 			unset($tmp);
-			
+
 			//* Create new filter file based on template
 			$tpl = new tpl();
 			$tpl->newTemplate($filter_file_template);
-			
+
 			// cc Field
-			$tpl->setVar('cc',$data["new"]["cc"]);
-				
+			$tpl->setVar('cc', $data["new"]["cc"]);
+
 			// Custom filters
-			$tpl->setVar('custom_mailfilter',$data["new"]["custom_mailfilter"]);
-				
+			$tpl->setVar('custom_mailfilter', $data["new"]["custom_mailfilter"]);
+
 			// Move junk
-			$tpl->setVar('move_junk',$data["new"]["move_junk"]);
-			
+			$tpl->setVar('move_junk', $data["new"]["move_junk"]);
+
 			// Check autoresponder dates
 			if($data["new"]["autoresponder_start_date"] == '0000-00-00 00:00:00' && $data["new"]["autoresponder_end_date"] == '0000-00-00 00:00:00') {
-				$tpl->setVar('autoresponder_date_limit',0);
+				$tpl->setVar('autoresponder_date_limit', 0);
 			} else {
-				$tpl->setVar('autoresponder_date_limit',1);
+				$tpl->setVar('autoresponder_date_limit', 1);
 			}
-			
+
 
 			// Set autoresponder start date
-			$data["new"]["autoresponder_start_date"] = str_replace (" ", "T", $data["new"]["autoresponder_start_date"]);
-			$tpl->setVar('start_date',$data["new"]["autoresponder_start_date"]);
+			$data["new"]["autoresponder_start_date"] = str_replace(" ", "T", $data["new"]["autoresponder_start_date"]);
+			$tpl->setVar('start_date', $data["new"]["autoresponder_start_date"]);
 
 			// Set autoresponder end date
-			$data["new"]["autoresponder_end_date"] = str_replace (" ", "T", $data["new"]["autoresponder_end_date"]);
-			$tpl->setVar('end_date',$data["new"]["autoresponder_end_date"]);
+			$data["new"]["autoresponder_end_date"] = str_replace(" ", "T", $data["new"]["autoresponder_end_date"]);
+			$tpl->setVar('end_date', $data["new"]["autoresponder_end_date"]);
 
 			// Autoresponder
-			$tpl->setVar('autoresponder',$data["new"]["autoresponder"]);
+			$tpl->setVar('autoresponder', $data["new"]["autoresponder"]);
 
-			// Autoresponder Subject			
-			$data["new"]["autoresponder_subject"] = str_replace("\"","'",$data["new"]["autoresponder_subject"]); 
-			$tpl->setVar('autoresponder_subject',$data["new"]["autoresponder_subject"]);
+			// Autoresponder Subject
+			$data["new"]["autoresponder_subject"] = str_replace("\"", "'", $data["new"]["autoresponder_subject"]);
+			$tpl->setVar('autoresponder_subject', $data["new"]["autoresponder_subject"]);
 
 			// Autoresponder Text
-			$data["new"]["autoresponder_text"] = str_replace("\"","'",$data["new"]["autoresponder_text"]); 
-			$tpl->setVar('autoresponder_text',$data["new"]["autoresponder_text"]);
-			
+			$data["new"]["autoresponder_text"] = str_replace("\"", "'", $data["new"]["autoresponder_text"]);
+			$tpl->setVar('autoresponder_text', $data["new"]["autoresponder_text"]);
+
 			//* Set alias addresses for autoresponder
 			$sql = "SELECT * FROM mail_forwarding WHERE type = 'alias' AND destination = '".$app->db->quote($data["new"]["email"])."'";
 			$records = $app->db->queryAllRecords($sql);
-			
+
 			$addresses = array();
 			$addresses[] = $data["new"]["email"];
 			if(is_array($records) && count($records) > 0) {
@@ -166,59 +166,59 @@ class maildeliver_plugin {
 					$addresses[] = $rec['source'];
 				}
 			}
-			
-            $app->log("Found " . count($addresses) . " addresses.",LOGLEVEL_DEBUG);
-            
-            $alias_addresses = array();
-            
-			$email_parts = explode('@',$data["new"]["email"]);
+
+			$app->log("Found " . count($addresses) . " addresses.", LOGLEVEL_DEBUG);
+
+			$alias_addresses = array();
+
+			$email_parts = explode('@', $data["new"]["email"]);
 			$sql = "SELECT * FROM mail_forwarding WHERE type = 'aliasdomain' AND destination = '@".$app->db->quote($email_parts[1])."'";
 			$records = $app->db->queryAllRecords($sql);
 			if(is_array($records) && count($records) > 0) {
-                $app->log("Found " . count($records) . " records (aliasdomains).",LOGLEVEL_DEBUG);
+				$app->log("Found " . count($records) . " records (aliasdomains).", LOGLEVEL_DEBUG);
 				foreach($records as $rec) {
-					$aliasdomain = substr($rec['source'],1);
+					$aliasdomain = substr($rec['source'], 1);
 					foreach($addresses as $email) {
-						$email_parts = explode('@',$email);
+						$email_parts = explode('@', $email);
 						$alias_addresses[] = $email_parts[0].'@'.$aliasdomain;
 					}
 				}
 			}
-			
-            $app->log("Found " . count($addresses) . " addresses at all.",LOGLEVEL_DEBUG);
-            
-            $addresses = array_unique(array_merge($addresses, $alias_addresses));
-            
-            $app->log("Found " . count($addresses) . " unique addresses at all.",LOGLEVEL_DEBUG);
-            
+
+			$app->log("Found " . count($addresses) . " addresses at all.", LOGLEVEL_DEBUG);
+
+			$addresses = array_unique(array_merge($addresses, $alias_addresses));
+
+			$app->log("Found " . count($addresses) . " unique addresses at all.", LOGLEVEL_DEBUG);
+
 			$address_str = '';
 			if(is_array($addresses) && count($addresses) > 0) {
 				$address_str .= ':addresses [';
 				foreach($addresses as $rec) {
 					$address_str .= '"'.$rec.'",';
 				}
-				$address_str = substr($address_str,0,-1);
+				$address_str = substr($address_str, 0, -1);
 				$address_str .= ']';
 			}
-			
-			
-			$tpl->setVar('addresses',$address_str);
-			
-			file_put_contents($sieve_file,$tpl->grab());
-			
+
+
+			$tpl->setVar('addresses', $address_str);
+
+			file_put_contents($sieve_file, $tpl->grab());
+
 			unset($tpl);
-				
+
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$sieve_file = $data["old"]["maildir"].'/.sieve';
-		if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file",LOGLEVEL_WARN);
+		if(is_file($sieve_file)) unlink($sieve_file)  or $app->log("Unable to delete file: $sieve_file", LOGLEVEL_WARN);
 	}
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php
index 085a99283abff8fa7b792620656942d65b7f4dd0..73bace85fe340267b097b2f1147c485857dcdc3c 100644
--- a/server/plugins-available/maildrop_plugin.inc.php
+++ b/server/plugins-available/maildrop_plugin.inc.php
@@ -29,70 +29,70 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class maildrop_plugin {
-	
+
 	var $plugin_name = 'maildrop_plugin';
 	var $class_name = 'maildrop_plugin';
-	
-	
+
+
 	var $mailfilter_config_dir = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true && isset($conf['courier']['installed']) && $conf['courier']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_user_insert','maildrop_plugin','update');
-		$app->plugins->registerEvent('mail_user_update','maildrop_plugin','update');
-		$app->plugins->registerEvent('mail_user_delete','maildrop_plugin','delete');
-		
+
+		$app->plugins->registerEvent('mail_user_insert', 'maildrop_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_update', 'maildrop_plugin', 'update');
+		$app->plugins->registerEvent('mail_user_delete', 'maildrop_plugin', 'delete');
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
-		if(substr($mail_config["homedir_path"],-1) == '/') {
-			$mail_config["homedir_path"] = substr($mail_config["homedir_path"],0,-1);
+		if(substr($mail_config["homedir_path"], -1) == '/') {
+			$mail_config["homedir_path"] = substr($mail_config["homedir_path"], 0, -1);
 		}
 		$this->mailfilter_config_dir = $mail_config["homedir_path"].'/mailfilters';
-		
-		
+
+
 		// Check if the config directory exists.
 		if(!is_dir($this->mailfilter_config_dir)) {
-			$app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist. Creating it now.",LOGLEVEL_WARN);
+			$app->log("Mailfilter config directory '".$this->mailfilter_config_dir."' does not exist. Creating it now.", LOGLEVEL_WARN);
 			mkdir($this->mailfilter_config_dir);
 			chown($this->mailfilter_config_dir, 'vmail');
 			chmod($this->mailfilter_config_dir, 0770);
 		}
-		
+
 		if(isset($data["new"]["email"])) {
-			$email_parts = explode("@",$data["new"]["email"]);
+			$email_parts = explode("@", $data["new"]["email"]);
 		} else {
-			$email_parts = explode("@",$data["old"]["email"]);
+			$email_parts = explode("@", $data["old"]["email"]);
 		}
-		
+
 		// make sure that the config directories exist
 		if(!is_dir($this->mailfilter_config_dir.'/'.$email_parts[1])) {
 			mkdir($this->mailfilter_config_dir.'/'.$email_parts[1]);
@@ -104,154 +104,154 @@ class maildrop_plugin {
 			chown($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0], 'vmail');
 			chmod($this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0], 0770);
 		}
-		
+
 		// Check if something has been changed regarding the autoresponders
-		if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"] 
-			    or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
-			    or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
-			    or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
-			    or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]) {
-			   		
+		if($data["old"]["autoresponder_text"] != $data["new"]["autoresponder_text"]
+			or $data["old"]["autoresponder"] != $data["new"]["autoresponder"]
+			or (isset($data["new"]["email"]) and $data["old"]["email"] != $data["new"]["email"])
+			or $data["old"]["autoresponder_start_date"] != $data["new"]["autoresponder_start_date"]
+			or $data["old"]["autoresponder_end_date"] != $data["new"]["autoresponder_end_date"]) {
+
 			// We delete the old autoresponder, if it exists
-			$email_parts = explode("@",$data["old"]["email"]);
+			$email_parts = explode("@", $data["old"]["email"]);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.gdbm';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.lock';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder';
-			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-			
-			
+			if(is_file($file)) unlink($file) or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+
+
 			//Now we create the new autoresponder, if it is enabled
 			if($data["new"]["autoresponder"] == 'y') {
 				if(isset($data["new"]["email"])) {
-					$email_parts = explode("@",$data["new"]["email"]);
+					$email_parts = explode("@", $data["new"]["email"]);
 				} else {
-					$email_parts = explode("@",$data["old"]["email"]);
+					$email_parts = explode("@", $data["old"]["email"]);
 				}
-						
+
 				// Load the master template
 				$tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master');
-				$tpl = str_replace('{vmail_mailbox_base}',$mail_config["homedir_path"],$tpl);
-				
+				$tpl = str_replace('{vmail_mailbox_base}', $mail_config["homedir_path"], $tpl);
+
 				if ($data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set
-					$tpl = str_replace('{start_date}',strtotime($data["new"]["autoresponder_start_date"]),$tpl);
-					$tpl = str_replace('{end_date}',strtotime($data["new"]["autoresponder_end_date"]),$tpl);
+					$tpl = str_replace('{start_date}', strtotime($data["new"]["autoresponder_start_date"]), $tpl);
+					$tpl = str_replace('{end_date}', strtotime($data["new"]["autoresponder_end_date"]), $tpl);
 				} else {
-					$tpl = str_replace('{start_date}',-7200,$tpl);
-					$tpl = str_replace('{end_date}',2147464800,$tpl);
+					$tpl = str_replace('{start_date}', -7200, $tpl);
+					$tpl = str_replace('{end_date}', 2147464800, $tpl);
 				}
-				
+
 				// Write the config file.
 				$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder';
-				file_put_contents($config_file_path,$tpl);
-				$app->log("Writing Autoresponder mailfilter file: $config_file_path",LOGLEVEL_DEBUG);
+				file_put_contents($config_file_path, $tpl);
+				$app->log("Writing Autoresponder mailfilter file: $config_file_path", LOGLEVEL_DEBUG);
 				chmod($config_file_path, 0770);
 				chown($config_file_path, 'vmail');
 				unset($tpl);
 				unset($config_file_path);
-						
+
 				// Write the autoresponder message file
 				$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg';
-				file_put_contents($config_file_path,$data["new"]["autoresponder_text"]);
+				file_put_contents($config_file_path, $data["new"]["autoresponder_text"]);
 				chmod($config_file_path, 0770);
 				chown($config_file_path, 'vmail');
-				$app->log("Writing Autoresponder message file: $config_file_path",LOGLEVEL_DEBUG);
+				$app->log("Writing Autoresponder message file: $config_file_path", LOGLEVEL_DEBUG);
 			}
 		}
-			
+
 		// Write the custom mailfilter script, if mailfilter recipe has changed
 		if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]
 			or $data["old"]["move_junk"] != $data["new"]["move_junk"]
 			or $data["old"]["cc"] != $data["new"]["cc"]) {
-			   
-				$app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG);
-				if(trim($data["new"]["custom_mailfilter"]) != '' 
-					or $data["new"]["move_junk"] != 'n' 
-					or $data["new"]["cc"] != '') {
-					
-					// Delete the old filter recipe
-					$email_parts = explode("@",$data["old"]["email"]);
-					$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-					if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-					
-					// write the new recipe
-					if(isset($data["new"]["email"])) {
-						$email_parts = explode("@",$data["new"]["email"]);
-					} else {
-						$email_parts = explode("@",$data["old"]["email"]);
-					}
-					$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-					
-					$mailfilter_content = '';
-					
-					if($data["new"]["cc"] != '') {
-						$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
-						$app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.',LOGLEVEL_DEBUG);
-					}
-					
-					if($data["new"]["move_junk"] == 'y') {
-						$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
-					}
-					$mailfilter_content .= $data["new"]["custom_mailfilter"];
-					
-					// Replace windows linebreaks in mailfilter file
-					$mailfilter_content = str_replace("\r\n","\n",$mailfilter_content);
-					
-					file_put_contents($config_file_path,$mailfilter_content);
-					$app->log("Writing new custom Mailfiter".$config_file_path,LOGLEVEL_DEBUG);
-					chmod($config_file_path, 0770);
-					chown($config_file_path, 'vmail');
-					unset($config_file_path);
+
+			$app->log("Mailfilter config has been changed", LOGLEVEL_DEBUG);
+			if(trim($data["new"]["custom_mailfilter"]) != ''
+				or $data["new"]["move_junk"] != 'n'
+				or $data["new"]["cc"] != '') {
+
+				// Delete the old filter recipe
+				$email_parts = explode("@", $data["old"]["email"]);
+				$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
+				if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+
+				// write the new recipe
+				if(isset($data["new"]["email"])) {
+					$email_parts = explode("@", $data["new"]["email"]);
 				} else {
-					// Delete the mailfilter recipe
-					if(isset($data["old"]["email"])) {
-						$email_parts = explode("@",$data["old"]["email"]);
-						$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-						if(is_file($file)) {
-							unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-							$app->log("Deleting custom Mailfiter".$file,LOGLEVEL_DEBUG);
-						}
+					$email_parts = explode("@", $data["old"]["email"]);
+				}
+				$config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
+
+				$mailfilter_content = '';
+
+				if($data["new"]["cc"] != '') {
+					$mailfilter_content .= "cc \"!".$data["new"]["cc"]."\"\n";
+					$app->log("Added CC address ".$data["new"]["cc"].' to mailfilter file.', LOGLEVEL_DEBUG);
+				}
+
+				if($data["new"]["move_junk"] == 'y') {
+					$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
+				}
+				$mailfilter_content .= $data["new"]["custom_mailfilter"];
+
+				// Replace windows linebreaks in mailfilter file
+				$mailfilter_content = str_replace("\r\n", "\n", $mailfilter_content);
+
+				file_put_contents($config_file_path, $mailfilter_content);
+				$app->log("Writing new custom Mailfiter".$config_file_path, LOGLEVEL_DEBUG);
+				chmod($config_file_path, 0770);
+				chown($config_file_path, 'vmail');
+				unset($config_file_path);
+			} else {
+				// Delete the mailfilter recipe
+				if(isset($data["old"]["email"])) {
+					$email_parts = explode("@", $data["old"]["email"]);
+					$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
+					if(is_file($file)) {
+						unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+						$app->log("Deleting custom Mailfiter".$file, LOGLEVEL_DEBUG);
 					}
 				}
+			}
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
 		$this->mailfilter_config_dir = $mail_config["homedir_path"].'/mailfilters';
-		
-		$email_parts = explode("@",$data["old"]["email"]);
+
+		$email_parts = explode("@", $data["old"]["email"]);
 		$dir = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0];
 		if(is_dir($dir)) {
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lock';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.msg';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.autoresponder';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.gdbm';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
 			$file = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.vacation.lst.lock';
-			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file",LOGLEVEL_WARN);
-			rmdir($dir) or $app->log("Unable to delete directory: $dir",LOGLEVEL_WARN);
+			if(is_file($file)) unlink($file)  or $app->log("Unable to delete file: $file", LOGLEVEL_WARN);
+			rmdir($dir) or $app->log("Unable to delete directory: $dir", LOGLEVEL_WARN);
 		}
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/mailman_plugin.inc.php b/server/plugins-available/mailman_plugin.inc.php
index c302806b90ae0db048322e4c19b3871484d1a2bb..e2bd36a8d6a5f27c8db02a31176663002c2f43ca 100644
--- a/server/plugins-available/mailman_plugin.inc.php
+++ b/server/plugins-available/mailman_plugin.inc.php
@@ -29,89 +29,89 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class mailman_plugin {
-	
+
 	var $plugin_name = 'mailman_plugin';
 	var $class_name = 'mailman_plugin';
-	
-	
+
+
 	var $mailman_config_dir = '/etc/mailman/';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_mailinglist_insert','mailman_plugin','insert');
-		$app->plugins->registerEvent('mail_mailinglist_update','mailman_plugin','update');
-		$app->plugins->registerEvent('mail_mailinglist_delete','mailman_plugin','delete');
-		
-		
-		
+
+		$app->plugins->registerEvent('mail_mailinglist_insert', 'mailman_plugin', 'insert');
+		$app->plugins->registerEvent('mail_mailinglist_update', 'mailman_plugin', 'update');
+		$app->plugins->registerEvent('mail_mailinglist_delete', 'mailman_plugin', 'delete');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->update_config();
-		
+
 		exec("nohup /usr/lib/mailman/bin/newlist -u ".escapeshellcmd($data["new"]["domain"])." -e ".escapeshellcmd($data["new"]["domain"])." ".escapeshellcmd($data["new"]["listname"])." ".escapeshellcmd($data["new"]["email"])." ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 &");
 		if(is_file('/var/lib/mailman/data/virtual-mailman')) exec('postmap /var/lib/mailman/data/virtual-mailman');
 		exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
-		
+
 		$app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$app->db->quote($data["new"]['mailinglist_id']));
-		
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["password"] != $data["old"]["password"] && $data["new"]["password"] != '') {
 			exec("nohup /usr/lib/mailman/bin/change_pw -l ".escapeshellcmd($data["new"]["listname"])." -p ".escapeshellcmd($data["new"]["password"])." >/dev/null 2>&1 &");
 			exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
 			$app->db->query("UPDATE mail_mailinglist SET password = '' WHERE mailinglist_id = ".$app->db->quote($data["new"]['mailinglist_id']));
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->update_config();
-		
+
 		exec("nohup /usr/lib/mailman/bin/rmlist -a ".escapeshellcmd($data["old"]["listname"])." >/dev/null 2>&1 &");
-		
+
 		exec('nohup '.$conf['init_scripts'] . '/' . 'mailman reload >/dev/null 2>&1 &');
-		
+
 	}
-	
+
 	function update_config() {
 		global $app, $conf;
-		
-		copy($this->mailman_config_dir.'mm_cfg.py',$this->mailman_config_dir.'mm_cfg.py');
-		
+
+		copy($this->mailman_config_dir.'mm_cfg.py', $this->mailman_config_dir.'mm_cfg.py');
+
 		// load the server configuration options
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		
+
 		// load files
 		if(file_exists($conf["rootpath"]."/conf-custom/mm_cfg.py.master")) {
 			$content = file_get_contents($conf["rootpath"]."/conf-custom/mm_cfg.py.master");
@@ -119,9 +119,9 @@ class mailman_plugin {
 			$content = file_get_contents($conf["rootpath"]."/conf/mm_cfg.py.master");
 		}
 		$old_file = file_get_contents($this->mailman_config_dir."/mm_cfg.py");
-		
+
 		$old_options = array();
-		$lines = explode("\n", $old_file); 
+		$lines = explode("\n", $old_file);
 		foreach ($lines as $line)
 		{
 			if (strlen($line) && substr($line, 0, 1) != '#')
@@ -134,7 +134,7 @@ class mailman_plugin {
 				}
 			}
 		}
-		
+
 		// create virtual_domains list
 		$domainAll = $app->db->queryAllRecords("SELECT domain FROM mail_mailinglist GROUP BY domain");
 		$virtual_domains = '';
@@ -145,11 +145,11 @@ class mailman_plugin {
 			else
 				$virtual_domains .= ", '".$domain['domain']."'";
 		}
-		
+
 		$content = str_replace('{hostname}', $server_config['hostname'], $content);
 		$content = str_replace('{default_language}', $old_options['DEFAULT_SERVER_LANGUAGE'], $content);
 		$content = str_replace('{virtual_domains}', $virtual_domains, $content);
-		
+
 		file_put_contents($this->mailman_config_dir."/mm_cfg.py", $content);
 	}
 
diff --git a/server/plugins-available/mongo_clientdb_plugin.inc.php b/server/plugins-available/mongo_clientdb_plugin.inc.php
index 545fe9e4bd4875e14ba408ddfddc2b8551d39461..cfec931f7c3080c8f328cdc6c3fad92a07d602f2 100644
--- a/server/plugins-available/mongo_clientdb_plugin.inc.php
+++ b/server/plugins-available/mongo_clientdb_plugin.inc.php
@@ -32,6 +32,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * The MongoDB client plugin is used by ISPConfig to control the management of MongoDB.
  * If handles everything from creating DBs/Users, update them or delete them.
  */
+
+
 class mongo_clientdb_plugin {
 
 	/**
@@ -53,6 +55,7 @@ class mongo_clientdb_plugin {
 		return (bool) $conf['services']['db'];
 	}
 
+
 	/**
 	 * This function is called when the plugin is loaded.
 	 * Each plugin/module needs to register itself to ISPConfig events from which
@@ -65,14 +68,14 @@ class mongo_clientdb_plugin {
 		global $app;
 
 		//* Databases
-		$app->plugins->registerEvent('database_insert',$this->plugin_name,'db_insert');
-		$app->plugins->registerEvent('database_update',$this->plugin_name,'db_update');
-		$app->plugins->registerEvent('database_delete',$this->plugin_name,'db_delete');
+		$app->plugins->registerEvent('database_insert', $this->plugin_name, 'db_insert');
+		$app->plugins->registerEvent('database_update', $this->plugin_name, 'db_update');
+		$app->plugins->registerEvent('database_delete', $this->plugin_name, 'db_delete');
 
 		//* Database users
-		$app->plugins->registerEvent('database_user_insert',$this->plugin_name,'db_user_insert');
-		$app->plugins->registerEvent('database_user_update',$this->plugin_name,'db_user_update');
-		$app->plugins->registerEvent('database_user_delete',$this->plugin_name,'db_user_delete');
+		$app->plugins->registerEvent('database_user_insert', $this->plugin_name, 'db_user_insert');
+		$app->plugins->registerEvent('database_user_update', $this->plugin_name, 'db_user_update');
+		$app->plugins->registerEvent('database_user_delete', $this->plugin_name, 'db_user_delete');
 	}
 
 
@@ -166,10 +169,10 @@ class mongo_clientdb_plugin {
 
 			if ($this->dropUser($user, $db)) {
 				return $this->addUser($db, array(
-					'username' => $user,
-					'password' => $password,
-					'roles' => $old_user['roles']
-				));
+						'username' => $user,
+						'password' => $password,
+						'roles' => $old_user['roles']
+					));
 			}
 
 			return false;
@@ -505,42 +508,43 @@ class mongo_clientdb_plugin {
 			$db = $data['new']['database_name'];
 
 			if ((bool) $db_user) {
-			    if ($user == 'root') {
-				$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
-			    } else {
-				if (!$this->addUser($db, array(
-					'username' => $user,
-					'password' => $password,
-					'roles' => array(
-						"readWrite",
-						"dbAdmin"
-					)
-				))) {
-					$app->log("Error while adding user: ".$user." to DB: ".$db, LOGLEVEL_WARNING);
+				if ($user == 'root') {
+					$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
+				} else {
+					if (!$this->addUser($db, array(
+								'username' => $user,
+								'password' => $password,
+								'roles' => array(
+									"readWrite",
+									"dbAdmin"
+								)
+							))) {
+						$app->log("Error while adding user: ".$user." to DB: ".$db, LOGLEVEL_WARNING);
+					}
 				}
-			    }
 			}
 
 			if ($db_ro_user && $data['new']['database_user_id'] != $data['new']['database_ro_user_id']) {
-			    if ($user == 'root') {
-				$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
-			    } else {
-				if (!$this->addUser($db, array(
-					'username' => $ro_user,
-					'password' => $ro_password,
-					'roles' => array(
-						"read"
-					)
-				))) {
-					$app->log("Error while adding read-only user: ".$user." to DB: ".$db, LOGLEVEL_WARNING);
+				if ($user == 'root') {
+					$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
+				} else {
+					if (!$this->addUser($db, array(
+								'username' => $ro_user,
+								'password' => $ro_password,
+								'roles' => array(
+									"read"
+								)
+							))) {
+						$app->log("Error while adding read-only user: ".$user." to DB: ".$db, LOGLEVEL_WARNING);
+					}
 				}
-			    }
 			}
 
 			$this->disconnect();
 		}
 	}
 
+
 	/**
 	 * This function is called when a DB is updated from within the ISPConfig interface.
 	 * Updating the DB needs a lot of changes. First, we need to recheck all users that
@@ -551,7 +555,7 @@ class mongo_clientdb_plugin {
 	 * @param array $data the event data (old and new)
 	 * @return only if something is wrong
 	 */
-	function db_update($event_name,$data) {
+	function db_update($event_name, $data) {
 		global $app, $conf;
 
 		if ($data['old']['active'] == 'n' && $data['new']['active'] == 'n') {
@@ -582,14 +586,14 @@ class mongo_clientdb_plugin {
 				// users to a given DB
 				$this->db_insert($event_name, $data);
 			} else if ($data['new']['active'] == 'n' && $data['old']['active'] == 'y') {
-				$users = $this->getUsers($db);
+					$users = $this->getUsers($db);
 
-				if ((bool) $users) {
-					foreach ($users as $user) {
-						$this->dropUser($user, $db);
+					if ((bool) $users) {
+						foreach ($users as $user) {
+							$this->dropUser($user, $db);
+						}
 					}
-				}
-			} else {
+				} else {
 				// selected user has changed -> drop old one
 				if ($data['new']['database_user_id'] != $data['old']['database_user_id']) {
 					$old_db_user = $app->db->queryOneRecord("SELECT `database_user`, `database_password_mongo` FROM `web_database_user` WHERE `database_user_id` = '" . intval($data['old']['database_user_id']) . "'");
@@ -609,7 +613,7 @@ class mongo_clientdb_plugin {
 
 					if ((bool) $old_db_user) {
 						if ($old_db_user['database_user'] == 'root') {
-							$app->log("User root not allowed for client databases",LOGLEVEL_WARNING);
+							$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
 						} else {
 							$this->dropUser($old_db_user['database_user'], $db);
 						}
@@ -623,13 +627,13 @@ class mongo_clientdb_plugin {
 							$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
 						} else {
 							$this->addUser($db, array(
-								'username' => $user,
-								'password' => $password,
-								'roles' => array(
-									"readWrite",
-									"dbAdmin"
-								)
-							));
+									'username' => $user,
+									'password' => $password,
+									'roles' => array(
+										"readWrite",
+										"dbAdmin"
+									)
+								));
 						}
 					}
 				}
@@ -641,12 +645,12 @@ class mongo_clientdb_plugin {
 							$app->log("User root not allowed for client databases", LOGLEVEL_WARNING);
 						} else {
 							$this->addUser($db, array(
-								'username' => $ro_user,
-								'password' => $ro_password,
-								'roles' => array(
-									"read"
-								)
-							));
+									'username' => $ro_user,
+									'password' => $ro_password,
+									'roles' => array(
+										"read"
+									)
+								));
 						}
 					}
 				}
@@ -676,6 +680,7 @@ class mongo_clientdb_plugin {
 		$this->disconnect();
 	}
 
+
 	/**
 	 * This function is called when a DB is deleted from within the ISPConfig interface.
 	 * All we need to do is to delete the database.
@@ -684,7 +689,7 @@ class mongo_clientdb_plugin {
 	 * @param array $data the event data (old and new)
 	 * @return only if something is wrong
 	 */
-	function db_delete($event_name,$data) {
+	function db_delete($event_name, $data) {
 		global $app, $conf;
 
 		if ($data['old']['type'] == 'mongo') {
@@ -714,7 +719,8 @@ class mongo_clientdb_plugin {
 	 * @param string $event_name the name of the event (insert, update, delete)
 	 * @param array $data the event data (old and new)
 	 */
-	function db_user_insert($event_name,$data) {}
+	function db_user_insert($event_name, $data) {}
+
 
 	/**
 	 * This function is called when a user is updated from within the ISPConfig interface.
@@ -725,13 +731,13 @@ class mongo_clientdb_plugin {
 	 * @param array $data the event data (old and new)
 	 * @return only if something is wrong
 	 */
-	function db_user_update($event_name,$data) {
+	function db_user_update($event_name, $data) {
 		global $app, $conf;
 
 		if ($data['old']['database_user'] == $data['new']['database_user']
-		    && ($data['old']['database_password'] == $data['new']['database_password']
-		    || $data['new']['database_password'] == '')) {
-		    return;
+			&& ($data['old']['database_password'] == $data['new']['database_password']
+				|| $data['new']['database_password'] == '')) {
+			return;
 		}
 
 		if ($this->connect() === false) {
@@ -751,10 +757,10 @@ class mongo_clientdb_plugin {
 
 							if ($this->dropUser($data['old']['database_user'], $db)) {
 								if ($this->addUser($db, array(
-									'username' => $data['new']['database_user'],
-									'password' => md5($data['new']['database_password_mongo']),
-									'roles' => $user['roles']
-								))) {
+											'username' => $data['new']['database_user'],
+											'password' => md5($data['new']['database_password_mongo']),
+											'roles' => $user['roles']
+										))) {
 									$app->log("Created user: ".$data['new']['database_user']." in DB: ".$db, LOGLEVEL_DEBUG);
 								} else {
 									$app->log("Couldn't create user: ".$data['new']['database_user']." in DB: ".$db, LOGLEVEL_WARNING);
@@ -791,6 +797,7 @@ class mongo_clientdb_plugin {
 		$this->disconnect();
 	}
 
+
 	/**
 	 * This function is called when a user is deleted from within the ISPConfig interface.
 	 * Since MongoDB uses per-DB user management, we have to find every database where the user is
diff --git a/server/plugins-available/mysql_clientdb_plugin.inc.php b/server/plugins-available/mysql_clientdb_plugin.inc.php
index b4fa6d3f56148dabfcf6b0322f9fdb1500b4e32c..cba977cc0558d92bafaa1ed9a7de471b578e16e6 100644
--- a/server/plugins-available/mysql_clientdb_plugin.inc.php
+++ b/server/plugins-available/mysql_clientdb_plugin.inc.php
@@ -29,106 +29,106 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class mysql_clientdb_plugin {
-	
+
 	var $plugin_name = 'mysql_clientdb_plugin';
 	var $class_name  = 'mysql_clientdb_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['db'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Databases
-		$app->plugins->registerEvent('database_insert',$this->plugin_name,'db_insert');
-		$app->plugins->registerEvent('database_update',$this->plugin_name,'db_update');
-		$app->plugins->registerEvent('database_delete',$this->plugin_name,'db_delete');
-		
+		$app->plugins->registerEvent('database_insert', $this->plugin_name, 'db_insert');
+		$app->plugins->registerEvent('database_update', $this->plugin_name, 'db_update');
+		$app->plugins->registerEvent('database_delete', $this->plugin_name, 'db_delete');
+
 		//* Database users
-		$app->plugins->registerEvent('database_user_insert',$this->plugin_name,'db_user_insert');
-		$app->plugins->registerEvent('database_user_update',$this->plugin_name,'db_user_update');
-		$app->plugins->registerEvent('database_user_delete',$this->plugin_name,'db_user_delete');
-		
-		
+		$app->plugins->registerEvent('database_user_insert', $this->plugin_name, 'db_user_insert');
+		$app->plugins->registerEvent('database_user_update', $this->plugin_name, 'db_user_update');
+		$app->plugins->registerEvent('database_user_delete', $this->plugin_name, 'db_user_delete');
+
+
+	}
+
+	function process_host_list($action, $database_name, $database_user, $database_password, $host_list, $link, $database_rename_user = '', $user_read_only = false) {
+		global $app;
+
+		$action = strtoupper($action);
+
+		// set to all hosts if none given
+		if(trim($host_list) == '') $host_list = '%';
+
+		// process arrays and comma separated strings
+		if(!is_array($host_list)) $host_list = explode(',', $host_list);
+
+		$success = true;
+
+		// loop through hostlist
+		foreach($host_list as $db_host) {
+			$db_host = trim($db_host);
+
+			$app->log($action . ' for user ' . $database_user . ' at host ' . $db_host, LOGLEVEL_DEBUG);
+
+			// check if entry is valid ip address
+			$valid = true;
+			if($db_host == '%' || $db_host == 'localhost') {
+				$valid = true;
+			} elseif(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $db_host)) {
+				$groups = explode('.', $db_host);
+				foreach($groups as $group){
+					if($group<0 or $group>255)
+						$valid=false;
+				}
+			} else {
+				$valid = false;
+			}
+
+			if($valid == false) continue;
+
+			if($action == 'GRANT') {
+				if(!$link->query("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
+				$app->log("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."'; success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
+			} elseif($action == 'REVOKE') {
+				if(!$link->query("REVOKE ALL PRIVILEGES ON ".$link->escape_string($database_name).".* FROM '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
+			} elseif($action == 'DROP') {
+				if(!$link->query("DROP USER '".$link->escape_string($database_user)."'@'$db_host';")) $success = false;
+			} elseif($action == 'RENAME') {
+				if(!$link->query("RENAME USER '".$link->escape_string($database_user)."'@'$db_host' TO '".$link->escape_string($database_rename_user)."'@'$db_host'")) $success = false;
+			} elseif($action == 'PASSWORD') {
+				if(!$link->query("SET PASSWORD FOR '".$link->escape_string($database_user)."'@'$db_host' = '".$link->escape_string($database_password)."';")) $success = false;
+			}
+		}
+
+		return $success;
 	}
-	
-  function process_host_list($action, $database_name, $database_user, $database_password, $host_list, $link, $database_rename_user = '', $user_read_only = false) {
-      global $app;
-      
-      $action = strtoupper($action);
-      
-      // set to all hosts if none given
-      if(trim($host_list) == '') $host_list = '%';
-      
-      // process arrays and comma separated strings
-      if(!is_array($host_list)) $host_list = explode(',', $host_list);
-      
-      $success = true;
-      
-      // loop through hostlist
-      foreach($host_list as $db_host) {
-          $db_host = trim($db_host);
-          
-          $app->log($action . ' for user ' . $database_user . ' at host ' . $db_host, LOGLEVEL_DEBUG);
-          
-          // check if entry is valid ip address
-          $valid = true;
-		  if($db_host == '%' || $db_host == 'localhost') {
-		  	$valid = true;
-		  } elseif(preg_match("/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/", $db_host)) {
-              $groups = explode('.', $db_host);
-              foreach($groups as $group){
-                if($group<0 OR $group>255)
-                $valid=false;
-              }
-          } else {
-              $valid = false;
-          }
-          
-          if($valid == false) continue;
-          
-          if($action == 'GRANT') {
-              if(!$link->query("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
-              $app->log("GRANT " . ($user_read_only ? "SELECT" : "ALL") . " ON ".$link->escape_string($database_name).".* TO '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."'; success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
-          } elseif($action == 'REVOKE') {
-              if(!$link->query("REVOKE ALL PRIVILEGES ON ".$link->escape_string($database_name).".* FROM '".$link->escape_string($database_user)."'@'$db_host' IDENTIFIED BY PASSWORD '".$link->escape_string($database_password)."';")) $success = false;
-          } elseif($action == 'DROP') {
-              if(!$link->query("DROP USER '".$link->escape_string($database_user)."'@'$db_host';")) $success = false;
-          } elseif($action == 'RENAME') {
-              if(!$link->query("RENAME USER '".$link->escape_string($database_user)."'@'$db_host' TO '".$link->escape_string($database_rename_user)."'@'$db_host'")) $success = false;
-          } elseif($action == 'PASSWORD') {
-              if(!$link->query("SET PASSWORD FOR '".$link->escape_string($database_user)."'@'$db_host' = '".$link->escape_string($database_password)."';")) $success = false;
-          }
-      }
-      
-      return $success;
-  }
-  
+
 	function drop_or_revoke_user($database_id, $user_id, $host_list){
 		global $app;
-		
+
 		// set to all hosts if none given
 		if(trim($host_list) == '') $host_list = '%';
-		
+
 		$db_user_databases = $app->db->queryAllRecords("SELECT * FROM web_database WHERE (database_user_id = ".$user_id." OR database_ro_user_id = ".$user_id.") AND active = 'y' AND database_id != ".$database_id);
 		$db_user_host_list = array();
 		if(is_array($db_user_databases) && !empty($db_user_databases)){
@@ -156,448 +156,449 @@ class mysql_clientdb_plugin {
 		//print_r($drop_hosts);
 		$revoke_hosts = array_diff($host_list_arr, $drop_hosts);
 		//print_r($revoke_hosts);
-						
+
 		$drop_host_list = implode(',', $drop_hosts);
 		$revoke_host_list = implode(',', $revoke_hosts);
 		//echo $drop_host_list."\n";
 		//echo $revoke_host_list."\n";
 		return array('revoke_hosts' => $revoke_host_list, 'drop_hosts' => $drop_host_list);
 	}
-	
-	function db_insert($event_name,$data) {
+
+	function db_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data['new']['type'] == 'mysql') {
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			//* Connect to the database
 			$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
 			if ($link->connect_error) {
-				$app->log('Unable to connect to mysql'.$link->connect_error,LOGLEVEL_ERROR);
+				$app->log('Unable to connect to mysql'.$link->connect_error, LOGLEVEL_ERROR);
 				return;
 			}
 
 			// Charset for the new table
 			if($data['new']['database_charset'] != '') {
-        $query_charset_table = ' DEFAULT CHARACTER SET '.$data['new']['database_charset'];
+				$query_charset_table = ' DEFAULT CHARACTER SET '.$data['new']['database_charset'];
 			} else {
-        $query_charset_table = '';
+				$query_charset_table = '';
 			}
 
 			//* Create the new database
 			if ($link->query('CREATE DATABASE '.$link->escape_string($data['new']['database_name']).$query_charset_table)) {
-				$app->log('Created MySQL database: '.$data['new']['database_name'],LOGLEVEL_DEBUG);
+				$app->log('Created MySQL database: '.$data['new']['database_name'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to create the database: '.$link->error,LOGLEVEL_WARNING);
+				$app->log('Unable to create the database: '.$link->error, LOGLEVEL_WARNING);
 			}
-			
+
 			// Create the database user if database is active
 			if($data['new']['active'] == 'y') {
-				
-                // 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']) . "'");
-                
-                $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']) . "'");
-                
-                $host_list = '';
-                if($data['new']['remote_access'] == 'y') {
-                    $host_list = $data['new']['remote_ips'];
-                    if($host_list == '') $host_list = '%';
-                }
-                if($host_list != '') $host_list .= ',';
-                $host_list .= 'localhost';
-                
-                if($db_user) {
-                    if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $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') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
-                }
-				
+
+				// 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']) . "'");
+
+				$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']) . "'");
+
+				$host_list = '';
+				if($data['new']['remote_access'] == 'y') {
+					$host_list = $data['new']['remote_ips'];
+					if($host_list == '') $host_list = '%';
+				}
+				if($host_list != '') $host_list .= ',';
+				$host_list .= 'localhost';
+
+				if($db_user) {
+					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $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') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
+				}
+
 			}
-			
+
 			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
 	}
-	
-	function db_update($event_name,$data) {
+
+	function db_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// skip processing if database was and is inactive
 		if($data['new']['active'] == 'n' && $data['old']['active'] == 'n') return;
-		
+
 		if($data['new']['type'] == 'mysql') {
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			//* Connect to the database
 			$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
 			if ($link->connect_error) {
-				$app->log('Unable to connect to the database: '.$link->connect_error,LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database: '.$link->connect_error, LOGLEVEL_ERROR);
 				return;
 			}
-			
-            // 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') {
-                $host_list = $data['new']['remote_ips'];
-                if($host_list == '') $host_list = '%';
-            }
-            if($host_list != '') $host_list .= ',';
-            $host_list .= 'localhost';
-			
+
+			// 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') {
+				$host_list = $data['new']['remote_ips'];
+				if($host_list == '') $host_list = '%';
+			}
+			if($host_list != '') $host_list .= ',';
+			$host_list .= 'localhost';
+
 			// REVOKES and DROPS have to be done on old host list, not new host list
 			$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';
-            
-            // Create the database user if database was disabled before
+			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';
+
+			// Create the database user if database was disabled before
 			if($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
-                if($db_user) {
-                    if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $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') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
-                }
+				if($db_user) {
+					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $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') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					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($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'], $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($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'], $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($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_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);
+					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_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);
+						}
 					}
-                }
-				// Database is not active, so stop processing here
-				$link->query('FLUSH PRIVILEGES;');
-				$link->close();
-				return;
-			}
-            
-            //* 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']) {
-                    if($old_db_user) {
-                        if($old_db_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+					// Database is not active, so stop processing here
+					$link->query('FLUSH PRIVILEGES;');
+					$link->close();
+					return;
+				}
+
+			//* 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']) {
+					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'], $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);
 						}
-                    }
-                }
-                if($db_user) {
-                    if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                    else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
-                }
-            }
-            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']) {
-                    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 {
+					}
+				}
+				if($db_user) {
+					if($db_user['database_user'] == 'root') $app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					else $this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $host_list, $link);
+				}
+			}
+			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']) {
+					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['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);
 						}
-                    }
-                }
-                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 $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
-                }
-            }
-			
+					}
+				}
+				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 $this->process_host_list('GRANT', $data['new']['database_name'], $db_ro_user['database_user'], $db_ro_user['database_password'], $host_list, $link, '', true);
+				}
+			}
+
 			//* Remote access option has changed.
 			if($data['new']['remote_access'] != $data['old']['remote_access']) {
-				
+
 				//* revoke old priveliges
 				//mysql_query("REVOKE ALL PRIVILEGES ON ".mysql_real_escape_string($data["new"]["database_name"],$link).".* FROM '".mysql_real_escape_string($data["new"]["database_user"],$link)."';",$link);
-				
+
 				//* set new priveliges
-				if($data['new']['remote_access'] == 'y') { 		
-                    if($db_user) {
-                        if($db_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+				if($data['new']['remote_access'] == 'y') {
+					if($db_user) {
+						if($db_user['database_user'] == 'root'){
+							$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+						} else {
 							$this->process_host_list('GRANT', $data['new']['database_name'], $db_user['database_user'], $db_user['database_password'], $data['new']['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') $app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        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);
-                    }
+					}
+					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 $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($old_db_user) {
-                        if($old_db_user['database_user'] == 'root'){
-							$app->log('User root not allowed for Client databases',LOGLEVEL_WARNING);
-                        } else {
+					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);
-							
+
 							//$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($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 {
+					}
+					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_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);
 						}
-                    }
+					}
 				}
-				$app->log('Changing MySQL remote access privileges for database: '.$data['new']['database_name'],LOGLEVEL_DEBUG);
+				$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 {
+				//* 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 {
-                        $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 {
+					}
+				}
+				if($db_user) {
+					if($db_user['database_user'] == 'root'){
+						$app->log('User root not allowed for Client databases', LOGLEVEL_WARNING);
+					} else {
+						$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 {
-                        $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);
-                    }
-                }
+					}
+				}
+
+				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 {
+						$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);
+					}
+				}
 			}
-      
-			
+
+
 			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
-		
+
 	}
-	
-	function db_delete($event_name,$data) {
+
+	function db_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data['old']['type'] == 'mysql') {
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-		
+
 			//* Connect to the database
 			$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
 			if ($link->connect_error) {
-				$app->log('Unable to connect to mysql: '.$link->connect_error,LOGLEVEL_ERROR);
+				$app->log('Unable to connect to mysql: '.$link->connect_error, LOGLEVEL_ERROR);
 				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($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);
+				$app->log('Dropping MySQL database: '.$data['old']['database_name'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error,LOGLEVEL_WARNING);
+				$app->log('Error while dropping MySQL database: '.$data['old']['database_name'].' '.$link->error, LOGLEVEL_WARNING);
 			}
-			
+
 			$link->query('FLUSH PRIVILEGES;');
 			$link->close();
 		}
-		
-		
+
+
 	}
-	
-	 
-	function db_user_insert($event_name,$data) {
+
+
+	function db_user_insert($event_name, $data) {
 		global $app, $conf;
 		// we have nothing to do here, stale user accounts are useless ;)
 	}
-	
-	function db_user_update($event_name,$data) {
+
+	function db_user_update($event_name, $data) {
 		global $app, $conf;
-		
-        if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-            $app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
-            return;
-        }
-        
-        //* Connect to the database
-        $link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
-        if ($link->connect_error) {
-            $app->log('Unable to connect to mysql'.$link->connect_error,LOGLEVEL_ERROR);
-            return;
-        }
-        
-        
-        if($data['old']['database_user'] == $data['new']['database_user'] && ($data['old']['database_password'] == $data['new']['database_password'] || $data['new']['database_password'] == '')) {
-            return;
-        }
-        
-        
-        $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;
-            
-            if($database['remote_ips'] != '') $ips = explode(',', $database['remote_ips']);
-            else $ips = array('%');
-            
-            foreach($ips as $ip) {
-                $ip = trim($ip);
-                if(!in_array($ip, $host_list)) $host_list[] = $ip;
-            }
-        }
-        
-        foreach($host_list as $db_host) {
-            if($data['new']['database_user'] != $data['old']['database_user']) {
+
+		if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+			$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
+			return;
+		}
+
+		//* Connect to the database
+		$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
+		if ($link->connect_error) {
+			$app->log('Unable to connect to mysql'.$link->connect_error, LOGLEVEL_ERROR);
+			return;
+		}
+
+
+		if($data['old']['database_user'] == $data['new']['database_user'] && ($data['old']['database_password'] == $data['new']['database_password'] || $data['new']['database_password'] == '')) {
+			return;
+		}
+
+
+		$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;
+
+			if($database['remote_ips'] != '') $ips = explode(',', $database['remote_ips']);
+			else $ips = array('%');
+
+			foreach($ips as $ip) {
+				$ip = trim($ip);
+				if(!in_array($ip, $host_list)) $host_list[] = $ip;
+			}
+		}
+
+		foreach($host_list as $db_host) {
+			if($data['new']['database_user'] != $data['old']['database_user']) {
 				$link->query("RENAME USER '".$link->escape_string($data['old']['database_user'])."'@'$db_host' TO '".$link->escape_string($data['new']['database_user'])."'@'$db_host'");
-				$app->log('Renaming MySQL user: '.$data['old']['database_user'].' to '.$data['new']['database_user'],LOGLEVEL_DEBUG);
+				$app->log('Renaming MySQL user: '.$data['old']['database_user'].' to '.$data['new']['database_user'], LOGLEVEL_DEBUG);
 			}
 
 			if($data['new']['database_password'] != $data['old']['database_password'] && $data['new']['database_password'] != '') {
 				$link->query("SET PASSWORD FOR '".$link->escape_string($data['new']['database_user'])."'@'$db_host' = '".$link->escape_string($data['new']['database_password'])."';");
-				$app->log('Changing MySQL user password for: '.$data['new']['database_user'].'@'.$db_host,LOGLEVEL_DEBUG);
+				$app->log('Changing MySQL user password for: '.$data['new']['database_user'].'@'.$db_host, LOGLEVEL_DEBUG);
 			}
-        }
-        
-        $link->query('FLUSH PRIVILEGES;');
-        $link->close();
-        
+		}
+
+		$link->query('FLUSH PRIVILEGES;');
+		$link->close();
+
 	}
-	
-	function db_user_delete($event_name,$data) {
+
+	function db_user_delete($event_name, $data) {
 		global $app, $conf;
-		
-        if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-            $app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
-            return;
-        }
-        
-        //* Connect to the database
-        $link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
-        if ($link->connect_error) {
-            $app->log('Unable to connect to mysql'.$link->connect_error,LOGLEVEL_ERROR);
-            return;
-        }
-        
-        $host_list = array();
-        // read all mysql users with this username
-        $result = $link->query("SELECT `User`, `Host` FROM `mysql`.`user` WHERE `User` = '" . $link->escape_string($data['old']['database_user']) . "' AND `Create_user_priv` = 'N'"); // basic protection against accidently deleting system users like debian-sys-maint
-        if($result) {
-            while($row = $result->fetch_assoc()) {
-                $host_list[] = $row['Host'];
-            }
-            $result->free();
-        }
-        
-        foreach($host_list as $db_host) {
-            if($link->query("DROP USER '".$link->escape_string($data['old']['database_user'])."'@'$db_host';")) {
-				$app->log('Dropping MySQL user: '.$data['old']['database_user'],LOGLEVEL_DEBUG);
-            }
-        }
-        
-        $link->query('FLUSH PRIVILEGES;');
-        $link->close();
+
+		if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+			$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
+			return;
+		}
+
+		//* Connect to the database
+		$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
+		if ($link->connect_error) {
+			$app->log('Unable to connect to mysql'.$link->connect_error, LOGLEVEL_ERROR);
+			return;
+		}
+
+		$host_list = array();
+		// read all mysql users with this username
+		$result = $link->query("SELECT `User`, `Host` FROM `mysql`.`user` WHERE `User` = '" . $link->escape_string($data['old']['database_user']) . "' AND `Create_user_priv` = 'N'"); // basic protection against accidently deleting system users like debian-sys-maint
+		if($result) {
+			while($row = $result->fetch_assoc()) {
+				$host_list[] = $row['Host'];
+			}
+			$result->free();
+		}
+
+		foreach($host_list as $db_host) {
+			if($link->query("DROP USER '".$link->escape_string($data['old']['database_user'])."'@'$db_host';")) {
+				$app->log('Dropping MySQL user: '.$data['old']['database_user'], LOGLEVEL_DEBUG);
+			}
+		}
+
+		$link->query('FLUSH PRIVILEGES;');
+		$link->close();
 	}
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/network_settings_plugin.inc.php b/server/plugins-available/network_settings_plugin.inc.php
index 8355d9e6d348699f40c99c14a63f542c6bf02172..56e4980fe323512e41d5b3c8c7f265335563a955 100644
--- a/server/plugins-available/network_settings_plugin.inc.php
+++ b/server/plugins-available/network_settings_plugin.inc.php
@@ -29,78 +29,78 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class network_settings_plugin {
-	
+
 	var $plugin_name = 'network_settings_plugin';
 	var $class_name = 'network_settings_plugin';
-	
-	
+
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('server_insert','network_settings_plugin','insert');
-		$app->plugins->registerEvent('server_update','network_settings_plugin','update');
-		
-		$app->plugins->registerEvent('server_ip_insert','network_settings_plugin','insert');
-		$app->plugins->registerEvent('server_ip_update','network_settings_plugin','update');
-		
-		
-		
+
+		$app->plugins->registerEvent('server_insert', 'network_settings_plugin', 'insert');
+		$app->plugins->registerEvent('server_update', 'network_settings_plugin', 'update');
+
+		$app->plugins->registerEvent('server_ip_insert', 'network_settings_plugin', 'insert');
+		$app->plugins->registerEvent('server_ip_update', 'network_settings_plugin', 'update');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses('getconf');
 		$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
-		
+
 		//* Configure the debian network card settings.
 		//* Dont configure
-		if($server_config['auto_network_configuration'] == 'y' && 
-		   $data['mirrored'] == false &&
-		   $server_config['ip_address'] != '0.0.0.0' && 
-		   $server_config['gateway'] != '0.0.0.0') {
-			
-			if (is_file('/etc/debian_version')) 
+		if($server_config['auto_network_configuration'] == 'y' &&
+			$data['mirrored'] == false &&
+			$server_config['ip_address'] != '0.0.0.0' &&
+			$server_config['gateway'] != '0.0.0.0') {
+
+			if (is_file('/etc/debian_version'))
 			{
-				copy('/etc/network/interfaces','/etc/network/interfaces~');
-			
+				copy('/etc/network/interfaces', '/etc/network/interfaces~');
+
 				$app->load('tpl');
-				
+
 				$network_tpl = new tpl();
 				$network_tpl->newTemplate('debian_network_interfaces.master');
-					
-				$network_tpl->setVar('ip_address',$server_config['ip_address']);
-				$network_tpl->setVar('netmask',$server_config['netmask']);
-				$network_tpl->setVar('gateway',$server_config['gateway']);
-				$network_tpl->setVar('broadcast',$this->broadcast($server_config['ip_address'],$server_config['netmask']));
-				$network_tpl->setVar('network',$this->network($server_config['ip_address'],$server_config['netmask']));
-				
+
+				$network_tpl->setVar('ip_address', $server_config['ip_address']);
+				$network_tpl->setVar('netmask', $server_config['netmask']);
+				$network_tpl->setVar('gateway', $server_config['gateway']);
+				$network_tpl->setVar('broadcast', $this->broadcast($server_config['ip_address'], $server_config['netmask']));
+				$network_tpl->setVar('network', $this->network($server_config['ip_address'], $server_config['netmask']));
+
 				$records = $app->db->queryAllRecords("SELECT ip_address FROM server_ip WHERE server_id = ".intval($conf['server_id']) . ' ORDER BY server_ip_id ASC');
 				$ip_records = array();
 				$additionl_ip_records = 0;
@@ -117,15 +117,15 @@ class network_settings_plugin {
 								'ip_address' => $rec['ip_address'],
 								'netmask' => $server_config['netmask'],
 								'gateway' => $server_config['gateway'],
-								'broadcast' => $this->broadcast($rec['ip_address'],$server_config['netmask']),
-								'network' => $this->network($rec['ip_address'],$server_config['netmask'])
+								'broadcast' => $this->broadcast($rec['ip_address'], $server_config['netmask']),
+								'network' => $this->network($rec['ip_address'], $server_config['netmask'])
 							);
 							$additionl_ip_records = 1;
 							$n++;
 						}
 					}
 				}
-				
+
 				/*
 				 * If we have more than 1 IP we have to add the main-ip at the end
 				 * of the network-ip-list. If we don't do so, there may be problems
@@ -140,7 +140,7 @@ class network_settings_plugin {
 					$swap['ip_address'] = $ip_records[$n-1]['ip_address'];
 					$swap['netmask'] = $ip_records[$n-1]['netmask'];
 					$swap['gateway'] = $ip_records[$n-1]['gateway'];
-					
+
 					$ip_records[$n-1] = array(
 						'id' => $n-1,
 						'ip_address' => $server_config['ip_address'],
@@ -156,29 +156,29 @@ class network_settings_plugin {
 					$network_tpl->setVar('network',$this->network($swap['ip_address'],$swap['netmask']));
 				}
 				*/
-				
-				$network_tpl->setVar('additionl_ip_records',$additionl_ip_records);
-				$network_tpl->setLoop('interfaces',$ip_records);
-				file_put_contents('/etc/network/interfaces',$network_tpl->grab());
+
+				$network_tpl->setVar('additionl_ip_records', $additionl_ip_records);
+				$network_tpl->setLoop('interfaces', $ip_records);
+				file_put_contents('/etc/network/interfaces', $network_tpl->grab());
 				unset($network_tpl);
-				
-				$app->log('Changed Network settings',LOGLEVEL_DEBUG);
+
+				$app->log('Changed Network settings', LOGLEVEL_DEBUG);
 				exec($conf['init_scripts'] . '/' . 'networking force-reload');
-			} 
-			elseif (is_file('/etc/gentoo-release')) 
+			}
+			elseif (is_file('/etc/gentoo-release'))
 			{
-				copy('/etc/conf.d/net','/etc/conf.d/net~');
-				
+				copy('/etc/conf.d/net', '/etc/conf.d/net~');
+
 				$app->load('tpl');
-				
+
 				$network_tpl = new tpl();
 				$network_tpl->newTemplate('gentoo_network_interfaces.master');
-				
-				$network_tpl->setVar('ip_address',$server_config['ip_address']);
-				$network_tpl->setVar('netmask',$server_config['netmask']);
-				$network_tpl->setVar('gateway',$server_config['gateway']);
-				$network_tpl->setVar('broadcast',$this->broadcast($server_config['ip_address'],$server_config['netmask']));
-				
+
+				$network_tpl->setVar('ip_address', $server_config['ip_address']);
+				$network_tpl->setVar('netmask', $server_config['netmask']);
+				$network_tpl->setVar('gateway', $server_config['gateway']);
+				$network_tpl->setVar('broadcast', $this->broadcast($server_config['ip_address'], $server_config['netmask']));
+
 				$records = $app->db->queryAllRecords("SELECT ip_address FROM server_ip WHERE server_id = ".intval($conf['server_id']) . " order by ip_address");
 				$ip_records = array();
 				$additionl_ip_records = 0;
@@ -195,14 +195,14 @@ class network_settings_plugin {
 								'ip_address' => $rec['ip_address'],
 								'netmask' => $server_config['netmask'],
 								'gateway' => $server_config['gateway'],
-								'broadcast' => $this->broadcast($rec['ip_address'],$server_config['netmask'])
+								'broadcast' => $this->broadcast($rec['ip_address'], $server_config['netmask'])
 							);
 							$additionl_ip_records = 1;
 							$n++;
 						}
 					}
 				}
-				
+
 				/*
 				 * If we have more than 1 IP we have to add the main-ip at the end
 				 * of the network-ip-list. If we don't do so, there may be problems
@@ -215,81 +215,81 @@ class network_settings_plugin {
 					$swap['ip_address'] = $ip_records[$n-1]['ip_address'];
 					$swap['netmask'] = $ip_records[$n-1]['netmask'];
 					$swap['gateway'] = $ip_records[$n-1]['gateway'];
-					
+
 					$ip_records[$n-1] = array(
 						'id' => $n-1,
 						'ip_address' => $server_config['ip_address'],
 						'netmask' => $server_config['netmask'],
 						'gateway' => $server_config['gateway'],
-						'broadcast' => $this->broadcast($server_config['ip_address'],$server_config['netmask'])
+						'broadcast' => $this->broadcast($server_config['ip_address'], $server_config['netmask'])
 					);
-					$network_tpl->setVar('ip_address',$swap['ip_address']);
-					$network_tpl->setVar('netmask',$swap['netmask']);
-					$network_tpl->setVar('gateway',$swap['gateway']);
-					$network_tpl->setVar('broadcast',$this->broadcast($swap['ip_address'],$swap['netmask']));
+					$network_tpl->setVar('ip_address', $swap['ip_address']);
+					$network_tpl->setVar('netmask', $swap['netmask']);
+					$network_tpl->setVar('gateway', $swap['gateway']);
+					$network_tpl->setVar('broadcast', $this->broadcast($swap['ip_address'], $swap['netmask']));
 				}
-				
-				$network_tpl->setVar('additionl_ip_records',$additionl_ip_records);
-				$network_tpl->setLoop('interfaces',$ip_records);
-				file_put_contents('/etc/conf.d/net',$network_tpl->grab());
+
+				$network_tpl->setVar('additionl_ip_records', $additionl_ip_records);
+				$network_tpl->setLoop('interfaces', $ip_records);
+				file_put_contents('/etc/conf.d/net', $network_tpl->grab());
 				unset($network_tpl);
-				
-				$app->log('Changed Network settings',LOGLEVEL_DEBUG);
+
+				$app->log('Changed Network settings', LOGLEVEL_DEBUG);
 				exec($conf['init_scripts'] . '/' . 'net.eth0 restart');
-			} 
+			}
 			else {
-				$app->log('Network configuration not available for this Linux distribution.',LOGLEVEL_DEBUG);
+				$app->log('Network configuration not available for this Linux distribution.', LOGLEVEL_DEBUG);
 			}
-			
+
 		} else {
 			if($data['mirrored'] == true) {
-				$app->log('Skipping network config request. IP addresses from amster are not configured on the mirror.',LOGLEVEL_DEBUG);
-			} 
+				$app->log('Skipping network config request. IP addresses from amster are not configured on the mirror.', LOGLEVEL_DEBUG);
+			}
 			if($server_config['auto_network_configuration'] == 'n') {
-				$app->log('Network configuration disabled in server settings.',LOGLEVEL_DEBUG);
+				$app->log('Network configuration disabled in server settings.', LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 	}
-	
+
 	function network($ip, $netmask){
 		$netmask = $this->netmask($netmask);
-		list($f1,$f2,$f3,$f4) = explode('.', $netmask);
-		$netmask_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-		list($f1,$f2,$f3,$f4) = explode('.', $ip);
-		$ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', $netmask);
+		$netmask_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
 		for($i=0;$i<32;$i++){
-			$network_bin .= substr($netmask_bin,$i,1) * substr($ip_bin,$i,1);
+			$network_bin .= substr($netmask_bin, $i, 1) * substr($ip_bin, $i, 1);
 		}
 		$network_bin = wordwrap($network_bin, 8, '.', 1);
-		list($f1,$f2,$f3,$f4) = explode('.', trim($network_bin));
+		list($f1, $f2, $f3, $f4) = explode('.', trim($network_bin));
 		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
 
 	function broadcast($ip, $netmask){
 		$netmask = $this->netmask($netmask);
 		$binary_netmask = $this->binary_netmask($netmask);
-		list($f1,$f2,$f3,$f4) = explode('.', $ip);
-		$ip_bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
-		$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask),32,'1',STR_PAD_RIGHT);
+		list($f1, $f2, $f3, $f4) = explode('.', $ip);
+		$ip_bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
+		$broadcast_bin = str_pad(substr($ip_bin, 0, $binary_netmask), 32, '1', STR_PAD_RIGHT);
 		$broadcast_bin = wordwrap($broadcast_bin, 8, '.', 1);
-		list($f1,$f2,$f3,$f4) = explode('.', trim($broadcast_bin));
+		list($f1, $f2, $f3, $f4) = explode('.', trim($broadcast_bin));
 		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
-	
+
 	function netmask($netmask){
-		list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-		$bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
 		$parts = explode('0', $bin);
 		$bin = str_pad($parts[0], 32, '0', STR_PAD_RIGHT);
 		$bin = wordwrap($bin, 8, '.', 1);
-		list($f1,$f2,$f3,$f4) = explode('.', trim($bin));
+		list($f1, $f2, $f3, $f4) = explode('.', trim($bin));
 		return bindec($f1).'.'.bindec($f2).'.'.bindec($f3).'.'.bindec($f4);
 	}
 
 	function binary_netmask($netmask){
-		list($f1,$f2,$f3,$f4) = explode('.', trim($netmask));
-		$bin = str_pad(decbin($f1),8,'0',STR_PAD_LEFT).str_pad(decbin($f2),8,'0',STR_PAD_LEFT).str_pad(decbin($f3),8,'0',STR_PAD_LEFT).str_pad(decbin($f4),8,'0',STR_PAD_LEFT);
+		list($f1, $f2, $f3, $f4) = explode('.', trim($netmask));
+		$bin = str_pad(decbin($f1), 8, '0', STR_PAD_LEFT).str_pad(decbin($f2), 8, '0', STR_PAD_LEFT).str_pad(decbin($f3), 8, '0', STR_PAD_LEFT).str_pad(decbin($f4), 8, '0', STR_PAD_LEFT);
 		$parts = explode('0', $bin);
 		return substr_count($parts[0], '1');
 	}
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 3cd366363f69beef7beb06ed215b5365c365bf3f..2e93944476e271505e87284032834d6785833c2f 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -61,52 +61,52 @@ class nginx_plugin {
 		/*
 		Register for the events
 		*/
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'ssl');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
 
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
 
-		$app->plugins->registerEvent('server_ip_insert',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_update',$this->plugin_name,'server_ip');
-		$app->plugins->registerEvent('server_ip_delete',$this->plugin_name,'server_ip');
+		$app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
+		$app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
 
 		/*
 		$app->plugins->registerEvent('webdav_user_insert',$this->plugin_name,'webdav');
 		$app->plugins->registerEvent('webdav_user_update',$this->plugin_name,'webdav');
 		$app->plugins->registerEvent('webdav_user_delete',$this->plugin_name,'webdav');
 		*/
-		
-		$app->plugins->registerEvent('client_delete',$this->plugin_name,'client_delete');
-		
-		$app->plugins->registerEvent('web_folder_user_insert',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_update',$this->plugin_name,'web_folder_user');
-		$app->plugins->registerEvent('web_folder_user_delete',$this->plugin_name,'web_folder_user');
-		
-		$app->plugins->registerEvent('web_folder_update',$this->plugin_name,'web_folder_update');
-		$app->plugins->registerEvent('web_folder_delete',$this->plugin_name,'web_folder_delete');
+
+		$app->plugins->registerEvent('client_delete', $this->plugin_name, 'client_delete');
+
+		$app->plugins->registerEvent('web_folder_user_insert', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_update', $this->plugin_name, 'web_folder_user');
+		$app->plugins->registerEvent('web_folder_user_delete', $this->plugin_name, 'web_folder_user');
+
+		$app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
+		$app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
 	}
 
 	// Handle the creation of SSL certificates
-	function ssl($event_name,$data) {
+	function ssl($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 
 		// load the server configuration options
 		$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.cnf',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;
 
 		// if(!is_dir($data['new']['document_root'].'/ssl')) exec('mkdir -p '.$data['new']['document_root'].'/ssl');
 		if(!is_dir($data['new']['document_root'].'/ssl')) $app->system->mkdirpath($data['new']['document_root'].'/ssl');
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -116,32 +116,32 @@ class nginx_plugin {
 
 		//* Create a SSL Certificate
 		if($data['new']['ssl_action'] == 'create' && $conf['mirror_server_id'] == 0) {
-		
+
 			$this->ssl_certificate_changed = true;
-			
+
 			//* Rename files if they exist
 			if(file_exists($key_file)){
-				$app->system->rename($key_file,$key_file.'.bak');
-				$app->system->chmod($key_file.'.bak',0400);
+				$app->system->rename($key_file, $key_file.'.bak');
+				$app->system->chmod($key_file.'.bak', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->rename($key_file2,$key_file2.'.bak');
-				$app->system->chmod($key_file2.'.bak',0400);
+				$app->system->rename($key_file2, $key_file2.'.bak');
+				$app->system->chmod($key_file2.'.bak', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->rename($csr_file,$csr_file.'.bak');
-			if(file_exists($crt_file)) $app->system->rename($crt_file,$crt_file.'.bak');
-			
+			if(file_exists($csr_file)) $app->system->rename($csr_file, $csr_file.'.bak');
+			if(file_exists($crt_file)) $app->system->rename($crt_file, $crt_file.'.bak');
+
 			$rand_file = $ssl_dir.'/random_file';
-			$rand_data = md5(uniqid(microtime(),1));
+			$rand_data = md5(uniqid(microtime(), 1));
 			for($i=0; $i<1000; $i++) {
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
-				$rand_data .= md5(uniqid(microtime(),1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
+				$rand_data .= md5(uniqid(microtime(), 1));
 			}
 			$app->system->file_put_contents($rand_file, $rand_data);
 
-			$ssl_password = substr(md5(uniqid(microtime(),1)), 0, 15);
+			$ssl_password = substr(md5(uniqid(microtime(), 1)), 0, 15);
 
 			$ssl_cnf = "        RANDFILE               = $rand_file
 
@@ -166,7 +166,7 @@ class nginx_plugin {
         challengePassword              = A challenge password";
 
 			$ssl_cnf_file = $ssl_dir.'/openssl.conf';
-			$app->system->file_put_contents($ssl_cnf_file,$ssl_cnf);
+			$app->system->file_put_contents($ssl_cnf_file, $ssl_cnf);
 
 			$rand_file = escapeshellcmd($rand_file);
 			$key_file = escapeshellcmd($key_file);
@@ -181,7 +181,7 @@ class nginx_plugin {
 			if(substr($domain, 0, 2) == '*.' && strpos($crt_file, '/ssl/\*.') !== false) $crt_file = str_replace('/ssl/\*.', '/ssl/*.', $crt_file); // wildcard certificate
 
 			if(is_file($ssl_cnf_file) && !is_link($ssl_cnf_file)) {
-				
+
 				exec("openssl genrsa -des3 -rand $rand_file -passout pass:$ssl_password -out $key_file 2048");
 				exec("openssl req -new -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -out $csr_file -days $ssl_days -config $config_file");
 				exec("openssl rsa -passin pass:$ssl_password -in $key_file -out $key_file2");
@@ -189,18 +189,18 @@ class nginx_plugin {
 				if(file_exists($web_config['CA_path'].'/openssl.cnf'))
 				{
 					exec("openssl ca -batch -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file");
-					$app->log("Creating CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file",LOGLEVEL_ERROR);
+					$app->log("Creating CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+					if (filesize($crt_file)==0 || !file_exists($crt_file)) $app->log("CA-Certificate signing failed.  openssl ca -out $crt_file -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -in $csr_file", LOGLEVEL_ERROR);
 				};
 				if (@filesize($crt_file)==0 || !file_exists($crt_file)){
 					exec("openssl req -x509 -passin pass:$ssl_password -passout pass:$ssl_password -key $key_file -in $csr_file -out $crt_file -days $ssl_days -config $config_file ");
-					$app->log("Creating self-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
+					$app->log("Creating self-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
 				};
-			
+
 			}
 
-			$app->system->chmod($key_file,0400);
-			$app->system->chmod($key_file2,0400);
+			$app->system->chmod($key_file, 0400);
+			$app->system->chmod($key_file2, 0400);
 			@$app->system->unlink($config_file);
 			@$app->system->unlink($rand_file);
 			$ssl_request = $app->db->quote($app->system->file_get_contents($csr_file));
@@ -224,29 +224,29 @@ class nginx_plugin {
 			$csr_file = $ssl_dir.'/'.$domain.".csr";
 			$crt_file = $ssl_dir.'/'.$domain.".crt";
 			//$bundle_file = $ssl_dir.'/'.$domain.".bundle";
-			
+
 			//* Backup files
 			if(file_exists($key_file)){
-				$app->system->copy($key_file,$key_file.'~');
-				$app->system->chmod($key_file.'~',0400);
+				$app->system->copy($key_file, $key_file.'~');
+				$app->system->chmod($key_file.'~', 0400);
 			}
 			if(file_exists($key_file2)){
-				$app->system->copy($key_file2,$key_file2.'~');
-				$app->system->chmod($key_file2.'~',0400);
+				$app->system->copy($key_file2, $key_file2.'~');
+				$app->system->chmod($key_file2.'~', 0400);
 			}
-			if(file_exists($csr_file)) $app->system->copy($csr_file,$csr_file.'~');
-			if(file_exists($crt_file)) $app->system->copy($crt_file,$crt_file.'~');
+			if(file_exists($csr_file)) $app->system->copy($csr_file, $csr_file.'~');
+			if(file_exists($crt_file)) $app->system->copy($crt_file, $crt_file.'~');
 			//if(file_exists($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'~');
-			
+
 			//* Write new ssl files
-			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file,$data["new"]["ssl_request"]);
-			if(trim($data["new"]["ssl_cert"]) != '') $app->system->file_put_contents($crt_file,$data["new"]["ssl_cert"]);
+			if(trim($data["new"]["ssl_request"]) != '') $app->system->file_put_contents($csr_file, $data["new"]["ssl_request"]);
+			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);
-			
+			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"]) != ''){				
+			if(trim($data["new"]["ssl_bundle"]) != ''){
 				if(file_exists($crt_file)){
 					$crt_file_contents = trim($app->system->file_get_contents($crt_file));
 				} else {
@@ -254,15 +254,15 @@ class nginx_plugin {
 				}
 				if($crt_file_contents != '') $crt_file_contents .= "\n";
 				$crt_file_contents .= $data["new"]["ssl_bundle"];
-				$app->system->file_put_contents($crt_file,$app->file->unix_nl($crt_file_contents));
+				$app->system->file_put_contents($crt_file, $app->file->unix_nl($crt_file_contents));
 				unset($crt_file_contents);
 			}
 			/* Update the DB of the (local) Server */
 			$app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			
+
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Saving SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Saving SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		//* Delete a SSL certificate
@@ -273,10 +273,10 @@ class nginx_plugin {
 			$crt_file = $ssl_dir.'/'.$domain.'.crt';
 			//$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
 			if(file_exists($web_config['CA_path'].'/openssl.cnf') && !is_link($web_config['CA_path'].'/openssl.cnf'))
-				{
-					exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
-					$app->log("Revoking CA-signed SSL Cert for: $domain",LOGLEVEL_DEBUG);
-				};
+			{
+				exec("openssl ca -batch -config ".$web_config['CA_path']."/openssl.cnf -passin pass:".$web_config['CA_pass']." -revoke $crt_file");
+				$app->log("Revoking CA-signed SSL Cert for: $domain", LOGLEVEL_DEBUG);
+			};
 			$app->system->unlink($csr_file);
 			$app->system->unlink($crt_file);
 			//$app->system->unlink($bundle_file);
@@ -286,32 +286,32 @@ class nginx_plugin {
 			/* Update also the master-DB of the Server-Farm */
 			$app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data['new']['domain']."'");
 			$app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data['new']['domain']."'");
-			$app->log('Deleting SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 	}
 
 
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
 
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 
 
 	}
 
 
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Check if the apache plugin is enabled
 		if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
-			$app->log('The nginx plugin cannot be used together with the apache2 plugin.',LOGLEVEL_WARN);
+			$app->log('The nginx plugin cannot be used together with the apache2 plugin.', LOGLEVEL_WARN);
 			return 0;
 		}
-		
+
 		if($this->action != 'insert') $this->action = 'update';
 
 		if($data['new']['type'] != 'vhost' && $data['new']['type'] != 'vhostsubdomain' && $data['new']['parent_domain_id'] > 0) {
@@ -325,7 +325,7 @@ class nginx_plugin {
 				$data['new'] = $tmp;
 				$data['old'] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
 
 			// This is not a vhost, so we need to update the parent record instead.
@@ -342,45 +342,45 @@ class nginx_plugin {
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
 			$nginx_chrooted = true;
-			$app->log('Info: nginx is chrooted.',LOGLEVEL_DEBUG);
+			$app->log('Info: nginx is chrooted.', LOGLEVEL_DEBUG);
 		} else {
 			$nginx_chrooted = false;
 		}
 
 		if($data['new']['document_root'] == '') {
-			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set',LOGLEVEL_WARN);
+			if($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') $app->log('document_root not set', LOGLEVEL_WARN);
 			return 0;
 		}
 		if($data['new']['system_user'] == 'root' or $data['new']['system_group'] == 'root') {
-			$app->log('Websites cannot be owned by the root user or group.',LOGLEVEL_WARN);
+			$app->log('Websites cannot be owned by the root user or group.', LOGLEVEL_WARN);
 			return 0;
 		}
 		if(trim($data['new']['domain']) == '') {
-			$app->log('domain is empty',LOGLEVEL_WARN);
+			$app->log('domain is empty', LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $web_folder = 'web';
-        $log_folder = 'log';
-        if($data['new']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
-            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
-            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
-            $web_folder = $data['new']['web_folder'];
-            $log_folder .= '/' . $subdomain_host;
-            unset($tmp);
-        }
+
+		$web_folder = 'web';
+		$log_folder = 'log';
+		if($data['new']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+			$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+			if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
+			$web_folder = $data['new']['web_folder'];
+			$log_folder .= '/' . $subdomain_host;
+			unset($tmp);
+		}
 
 		// Create group and user, if not exist
 		$app->uses('system');
-		
+
 		if($web_config['connect_userid_to_webid'] == 'y') {
 			//* Calculate the uid and gid
 			$connect_userid_to_webid_start = ($web_config['connect_userid_to_webid_start'] < 1000)?1000:intval($web_config['connect_userid_to_webid_start']);
 			$fixed_uid_gid = intval($connect_userid_to_webid_start + $data['new']['domain_id']);
 			$fixed_uid_param = '--uid '.$fixed_uid_gid;
 			$fixed_gid_param = '--gid '.$fixed_uid_gid;
-			
+
 			//* Check if a ispconfigend user and group exists and create them
 			if(!$app->system->is_group('ispconfigend')) {
 				exec('groupadd --gid '.($connect_userid_to_webid_start + 10000).' ispconfigend');
@@ -397,7 +397,7 @@ class nginx_plugin {
 		if($data['new']['system_group'] != '' && !$app->system->is_group($data['new']['system_group'])) {
 			exec('groupadd '.$fixed_gid_param.' '.$groupname);
 			if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' groupadd '.$groupname);
-			$app->log('Adding the group: '.$groupname,LOGLEVEL_DEBUG);
+			$app->log('Adding the group: '.$groupname, LOGLEVEL_DEBUG);
 		}
 
 		$username = escapeshellcmd($data['new']['system_user']);
@@ -409,7 +409,7 @@ class nginx_plugin {
 				exec('useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 				if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' useradd -d '.escapeshellcmd($data['new']['document_root'])." -g $groupname $fixed_uid_param $username -s /bin/false");
 			}
-			$app->log('Adding the user: '.$username,LOGLEVEL_DEBUG);
+			$app->log('Adding the user: '.$username, LOGLEVEL_DEBUG);
 		}
 
 		//* If the client of the site has been changed, we have a change of the document root
@@ -421,47 +421,47 @@ class nginx_plugin {
 			unset($old_client);
 
 			//* Remove the old symlinks
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$old_client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $old_client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// create the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
 
 			if($data["new"]["type"] != "vhostsubdomain") {
 				//* Move the site data
-				$tmp_docroot = explode('/',$data['new']['document_root']);
+				$tmp_docroot = explode('/', $data['new']['document_root']);
 				unset($tmp_docroot[count($tmp_docroot)-1]);
-				$new_dir = implode('/',$tmp_docroot);
+				$new_dir = implode('/', $tmp_docroot);
 
-				$tmp_docroot = explode('/',$data['old']['document_root']);
+				$tmp_docroot = explode('/', $data['old']['document_root']);
 				unset($tmp_docroot[count($tmp_docroot)-1]);
-				$old_dir = implode('/',$tmp_docroot);
+				$old_dir = implode('/', $tmp_docroot);
 
 				//* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path
 				if(@is_dir($data['new']['document_root'])) {
-					$app->system->web_folder_protection($data['new']['document_root'],false);
-					$app->system->rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
-					$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'),LOGLEVEL_DEBUG);
+					$app->system->web_folder_protection($data['new']['document_root'], false);
+					$app->system->rename($data['new']['document_root'], $data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'));
+					$app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d_H_i_s'), LOGLEVEL_DEBUG);
 				}
-			
+
 				//* Create new base directory, if it does not exist yet
 				if(!is_dir($new_dir)) $app->system->mkdirpath($new_dir);
-				$app->system->web_folder_protection($data['old']['document_root'],false);
+				$app->system->web_folder_protection($data['old']['document_root'], false);
 				exec('mv '.escapeshellarg($data['old']['document_root']).' '.escapeshellarg($new_dir));
 				//$app->system->rename($data['old']['document_root'],$new_dir);
-				$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG);
+				$app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir, LOGLEVEL_DEBUG);
 
 				// Handle the change in php_open_basedir
-				$data['new']['php_open_basedir'] = str_replace($data['old']['document_root'],$data['new']['document_root'],$data['old']['php_open_basedir']);
+				$data['new']['php_open_basedir'] = str_replace($data['old']['document_root'], $data['new']['document_root'], $data['old']['php_open_basedir']);
 
 				//* Change the owner of the website files to the new website owner
 				exec('chown --recursive --from='.escapeshellcmd($data['old']['system_user']).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data['new']['system_user']).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
@@ -475,20 +475,20 @@ class nginx_plugin {
 			}
 
 			if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-			
+
 			//* Change the log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 
 		}
 
 		//print_r($data);
 
 		// Check if the directories are there and create them if necessary.
-		$app->system->web_folder_protection($data['new']['document_root'],false);
-		
+		$app->system->web_folder_protection($data['new']['document_root'], false);
+
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder)) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder);
 		if(!is_dir($data['new']['document_root'].'/' . $web_folder . '/error') and $data['new']['errordocs']) $app->system->mkdirpath($data['new']['document_root'].'/' . $web_folder . '/error');
 		//if(!is_dir($data['new']['document_root'].'/'.$log_folder)) exec('mkdir -p '.$data['new']['document_root'].'/'.$log_folder);
@@ -496,44 +496,44 @@ class nginx_plugin {
 		if(!is_dir($data['new']['document_root'].'/cgi-bin')) $app->system->mkdirpath($data['new']['document_root'].'/cgi-bin');
 		if(!is_dir($data['new']['document_root'].'/tmp')) $app->system->mkdirpath($data['new']['document_root'].'/tmp');
 		//if(!is_dir($data['new']['document_root'].'/webdav')) $app->system->mkdirpath($data['new']['document_root'].'/webdav');
-		
+
 		//* Create the new private directory
 		if(!is_dir($data['new']['document_root'].'/private')) {
 			$app->system->mkdirpath($data['new']['document_root'].'/private');
-			$app->system->chmod($data['new']['document_root'].'/private',0710);
-			$app->system->chown($data['new']['document_root'].'/private',$username);
-			$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+			$app->system->chmod($data['new']['document_root'].'/private', 0710);
+			$app->system->chown($data['new']['document_root'].'/private', $username);
+			$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 		}
-		
-		
+
+
 		// Remove the symlink for the site, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
 			if(is_dir('/var/log/ispconfig/httpd/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/httpd/'.$data['old']['domain']);
 			if(is_link($data['old']['document_root'].'/'.$log_folder)) $app->system->unlink($data['old']['document_root'].'/'.$log_folder);
-		
+
 			//* remove old log mount
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
-			
+			$app->system->removeLine('/etc/fstab', $fstab_line);
+
 			//* Unmount log directory
 			exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder));
 		}
-		
+
 		//* Create the log dir if nescessary and mount it
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || !is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain']) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
 			if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
-			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
-			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+			$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, 'root');
+			$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 			exec('mount --bind '.escapeshellarg('/var/log/ispconfig/httpd/'.$data['new']['domain']).' '.escapeshellarg($data['new']['document_root'].'/'.$log_folder));
 			//* add mountpoint to fstab
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['new']['domain'].' '.$data['new']['document_root'].'/'.$log_folder.'    none    bind,nobootwait    0 0';
-			$app->system->replaceLine('/etc/fstab',$fstab_line,$fstab_line,1,1);
+			$app->system->replaceLine('/etc/fstab', $fstab_line, $fstab_line, 1, 1);
 		}
-		
-		$app->system->web_folder_protection($data['new']['document_root'],true);
+
+		$app->system->web_folder_protection($data['new']['document_root'], true);
 
 		// Get the client ID
 		$client = $app->dbmaster->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['new']['sys_groupid']));
@@ -542,28 +542,28 @@ class nginx_plugin {
 
 		// Remove old symlinks, if site is renamed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
-			$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+			$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 			if(is_array($tmp_symlinks_array)) {
 				foreach($tmp_symlinks_array as $tmp_symlink) {
-					$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-					$tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
+					$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+					$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
 					// Remove trailing slash
 					if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 					// remove the symlinks, if not exist
 					if(is_link($tmp_symlink)) {
 						exec('rm -f '.escapeshellcmd($tmp_symlink));
-						$app->log('Removed symlink: rm -f '.$tmp_symlink,LOGLEVEL_DEBUG);
+						$app->log('Removed symlink: rm -f '.$tmp_symlink, LOGLEVEL_DEBUG);
 					}
 				}
 			}
 		}
 
 		// Create the symlinks for the sites
-		$tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
+		$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
 		if(is_array($tmp_symlinks_array)) {
 			foreach($tmp_symlinks_array as $tmp_symlink) {
-				$tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-				$tmp_symlink = str_replace('[website_domain]',$data['new']['domain'],$tmp_symlink);
+				$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+				$tmp_symlink = str_replace('[website_domain]', $data['new']['domain'], $tmp_symlink);
 				// Remove trailing slash
 				if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
 				//* Remove symlink if target folder has been changed.
@@ -572,64 +572,64 @@ class nginx_plugin {
 				}
 				// create the symlinks, if not exist
 				if(!is_link($tmp_symlink)) {
-//					exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
+					//     exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					if ($web_config["website_symlinks_rel"] == 'y') {
 						$this->create_relative_link(escapeshellcmd($data["new"]["document_root"]), escapeshellcmd($tmp_symlink));
 					} else {
 						exec("ln -s ".escapeshellcmd($data["new"]["document_root"])."/ ".escapeshellcmd($tmp_symlink));
 					}
 
-					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink,LOGLEVEL_DEBUG);
+					$app->log('Creating symlink: ln -s '.$data['new']['document_root'].'/ '.$tmp_symlink, LOGLEVEL_DEBUG);
 				}
 			}
 		}
 
 
 
-        // Install the Standard or Custom Error, Index and other related files
-        // /usr/local/ispconfig/server/conf is for the standard files
-        // /usr/local/ispconfig/server/conf-custom is for the custom files
-        // setting a local var here
-           
-        // normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
+		// Install the Standard or Custom Error, Index and other related files
+		// /usr/local/ispconfig/server/conf is for the standard files
+		// /usr/local/ispconfig/server/conf-custom is for the custom files
+		// setting a local var here
+
+		// normally $conf['templates'] = "/usr/local/ispconfig/server/conf";
 		if($this->action == 'insert' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-            
-            // Copy the error pages
+
+			// Copy the error pages
 			if($data['new']['errordocs']) {
 				$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+				if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 				else {
 					if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 						exec('cp '. $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 					}
 					else {
-						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+						exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 					}
 				}
 				exec('chmod -R a+r '.$error_page_path);
 			}
 
-			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
-            
-			if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-            }
-			if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
-                exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-                if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
-                    exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
-                }
-            }
+			if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+
+				if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/robots.txt')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+				if(is_file($conf['rootpath'] . '/conf-custom/index/.htaccess')) {
+					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
+				}
+			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/index/standard_index.html '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']),0,2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
+					exec('cp ' . $conf['rootpath'] . '/conf/index/standard_index.html_'.substr(escapeshellcmd($conf['language']), 0, 2).' '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/index.html');
 					if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) exec('cp ' . $conf['rootpath'] . '/conf/index/favicon.ico '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) exec('cp ' . $conf['rootpath'] . '/conf/index/robots.txt '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
 					if(is_file($conf['rootpath'] . '/conf/index/.htaccess')) exec('cp ' . $conf['rootpath'] . '/conf/index/.htaccess '.escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/');
@@ -639,17 +639,17 @@ class nginx_plugin {
 
 			//** Copy the error documents on update when the error document checkbox has been activated and was deactivated before
 		} elseif ($this->action == 'update' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain') && $data['old']['errordocs'] == 0 && $data['new']['errordocs'] == 1) {
-            
+
 			$error_page_path = escapeshellcmd($data['new']['document_root']).'/' . $web_folder . '/error/';
-			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2))) {
-				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+			if (file_exists($conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2))) {
+				exec('cp ' . $conf['rootpath'] . '/conf-custom/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 			}
 			else {
 				if (file_exists($conf['rootpath'] . '/conf-custom/error/400.html')) {
 					exec('cp ' . $conf['rootpath'] . '/conf-custom/error/*.html '.$error_page_path);
 				}
 				else {
-					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']),0,2).'/* '.$error_page_path);
+					exec('cp ' . $conf['rootpath'] . '/conf/error/'.substr(escapeshellcmd($conf['language']), 0, 2).'/* '.$error_page_path);
 				}
 			}
 			exec('chmod -R a+r '.$error_page_path);
@@ -681,31 +681,31 @@ class nginx_plugin {
 
 		//* 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')) {
-		
-			$app->system->web_folder_protection($data['new']['document_root'],false);
-			
+
+			$app->system->web_folder_protection($data['new']['document_root'], false);
+
 			//* Check if we have the new private folder and create it if nescessary
 			if(!is_dir($data['new']['document_root'].'/private')) $app->system->mkdir($data['new']['document_root'].'/private');
-			
+
 			if($web_config['security_level'] == 20) {
-				
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0710);
+
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0710);
 				//$app->system->chmod($data['new']['document_root'].'/webdav',0710);
-				$app->system->chmod($data['new']['document_root'].'/private',0710);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
+				$app->system->chmod($data['new']['document_root'].'/private', 0710);
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
 
 				// make tmp directory writable for nginx and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-			
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-				
+
 				if($web_config['add_web_users_to_sshusers_group'] == 'y') {
 					$command = 'usermod';
 					$command .= ' --groups sshusers';
@@ -724,99 +724,99 @@ class nginx_plugin {
 					$app->system->server_conf['group_datei'] = $tmp_groupfile;
 					unset($tmp_groupfile);
 				}
-				
+
 				//* Chown all default directories
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				$app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
 				//$app->system->chown($data['new']['document_root'].'/webdav',$username);
 				//$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
-				$app->system->chown($data['new']['document_root'].'/private',$username);
-				$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
+				$app->system->chown($data['new']['document_root'].'/private', $username);
+				$app->system->chgrp($data['new']['document_root'].'/private', $groupname);
 
 				// If the security Level is set to medium
 			} else {
 
-				$app->system->chmod($data['new']['document_root'],0755);
-				$app->system->chmod($data['new']['document_root'].'/web',0755);
+				$app->system->chmod($data['new']['document_root'], 0755);
+				$app->system->chmod($data['new']['document_root'].'/web', 0755);
 				//$app->system->chmod($data['new']['document_root'].'/webdav',0755);
-				$app->system->chmod($data['new']['document_root'].'/ssl',0755);
-				$app->system->chmod($data['new']['document_root'].'/cgi-bin',0755);
-				
+				$app->system->chmod($data['new']['document_root'].'/ssl', 0755);
+				$app->system->chmod($data['new']['document_root'].'/cgi-bin', 0755);
+
 				// make temp directory writable for nginx and the website users
-				$app->system->chmod($data['new']['document_root'].'/tmp',0777);
-				
+				$app->system->chmod($data['new']['document_root'].'/tmp', 0777);
+
 				// Set Log directory to 755 to make the logs accessible by the FTP user
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
+					$app->system->chmod($data['new']['document_root'].'/'.$log_folder, 0755);
 				}
-				
-				$app->system->chown($data['new']['document_root'],'root');
-				$app->system->chgrp($data['new']['document_root'],'root');
-				$app->system->chown($data['new']['document_root'].'/cgi-bin',$username);
-				$app->system->chgrp($data['new']['document_root'].'/cgi-bin',$groupname);
+
+				$app->system->chown($data['new']['document_root'], 'root');
+				$app->system->chgrp($data['new']['document_root'], 'root');
+				$app->system->chown($data['new']['document_root'].'/cgi-bin', $username);
+				$app->system->chgrp($data['new']['document_root'].'/cgi-bin', $groupname);
 				if(realpath($data['new']['document_root'].'/'.$log_folder . '/error.log') == '/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log') {
-					$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root',false);
-					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,$groupname,false);
+					$app->system->chown($data['new']['document_root'].'/'.$log_folder, 'root', false);
+					$app->system->chgrp($data['new']['document_root'].'/'.$log_folder, $groupname, false);
 				}
-				
-                $app->system->chown($data['new']['document_root'].'/ssl','root');
-				$app->system->chgrp($data['new']['document_root'].'/ssl','root');
-				$app->system->chown($data['new']['document_root'].'/tmp',$username);
-				$app->system->chgrp($data['new']['document_root'].'/tmp',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/web/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/web/stats',$groupname);
+
+				$app->system->chown($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chgrp($data['new']['document_root'].'/ssl', 'root');
+				$app->system->chown($data['new']['document_root'].'/tmp', $username);
+				$app->system->chgrp($data['new']['document_root'].'/tmp', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/web/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/web/stats', $groupname);
 				//$app->system->chown($data['new']['document_root'].'/webdav',$username);
 				//$app->system->chgrp($data['new']['document_root'].'/webdav',$groupname);
 			}
 		} elseif(($this->action == 'insert' && $data['new']['type'] == 'vhostsubdomain') or ($web_config['set_folder_permissions_on_update'] == 'y' && $data['new']['type'] == 'vhostsubdomain')) {
 			if($web_config['security_level'] == 20) {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0710);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            } else {
-				$app->system->chmod($data['new']['document_root'].'/' . $web_folder,0755);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder,$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder,$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error',$groupname);
-				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats',$username);
-				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats',$groupname);
-            }
-        }
-		
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0710);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			} else {
+				$app->system->chmod($data['new']['document_root'].'/' . $web_folder, 0755);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder, $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder, $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/error', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/error', $groupname);
+				$app->system->chown($data['new']['document_root'].'/' . $web_folder . '/stats', $username);
+				$app->system->chgrp($data['new']['document_root'].'/' . $web_folder . '/stats', $groupname);
+			}
+		}
+
 		//* Protect web folders
-		$app->system->web_folder_protection($data['new']['document_root'],true);
-		
+		$app->system->web_folder_protection($data['new']['document_root'], true);
+
 		if($data['new']['type'] == 'vhost') {
-            // Change the ownership of the error log to the root user
-            if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
-            $app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-            $app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log','root');
-        }
+			// Change the ownership of the error log to the root user
+			if(!@is_file('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log')) exec('touch '.escapeshellcmd('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log'));
+			$app->system->chown('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+			$app->system->chgrp('/var/log/ispconfig/httpd/'.$data['new']['domain'].'/error.log', 'root');
+		}
 
 		// Change the ownership of the error log to the owner of the website
 		/*
@@ -865,24 +865,24 @@ class nginx_plugin {
 		$vhost_data['web_document_root'] = $data['new']['document_root'].'/' . $web_folder;
 		$vhost_data['web_document_root_www'] = $web_config['website_basedir'].'/'.$data['new']['domain'].'/' . $web_folder;
 		$vhost_data['web_basedir'] = $web_config['website_basedir'];
-		
+
 		// IPv6
 		if($data['new']['ipv6_address'] != ''){
 			$tpl->setVar('ipv6_enabled', 1);
 			if ($conf['serverconfig']['web']['vhost_rewrite_v6'] == 'y') {
 				if (isset($conf['serverconfig']['server']['v6_prefix']) && $conf['serverconfig']['server']['v6_prefix'] <> '') {
-					$explode_v6prefix=explode(':',$conf['serverconfig']['server']['v6_prefix']);
-					$explode_v6=explode(':',$data['new']['ipv6_address']);
+					$explode_v6prefix=explode(':', $conf['serverconfig']['server']['v6_prefix']);
+					$explode_v6=explode(':', $data['new']['ipv6_address']);
 
 					for ( $i = 0; $i <= count($explode_v6prefix)-3; $i++ ) {
-				        $explode_v6[$i] = $explode_v6prefix[$i];
+						$explode_v6[$i] = $explode_v6prefix[$i];
 					}
-					$data['new']['ipv6_address'] = implode(':',$explode_v6);
+					$data['new']['ipv6_address'] = implode(':', $explode_v6);
 					$vhost_data['ipv6_address'] = $data['new']['ipv6_address'];
 				}
 			}
 		}
-		
+
 		// PHP-FPM
 		// Support for multiple PHP versions
 		/*
@@ -898,7 +898,7 @@ class nginx_plugin {
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -906,22 +906,22 @@ class nginx_plugin {
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['new']['domain_id'];
 		$socket_dir = escapeshellcmd($web_config['php_fpm_socket_dir']);
-		if(substr($socket_dir,-1) != '/') $socket_dir .= '/';
-		
+		if(substr($socket_dir, -1) != '/') $socket_dir .= '/';
+
 		if($data['new']['php_fpm_use_socket'] == 'y'){
 			$use_tcp = 0;
 			$use_socket = 1;
@@ -933,12 +933,12 @@ class nginx_plugin {
 		$tpl->setVar('use_socket', $use_socket);
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
-		$tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(),1)).'.htm');
+		$tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(), 1)).'.htm');
 		$vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1;
-		
+
 		// 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();
@@ -954,10 +954,10 @@ class nginx_plugin {
 		}
 		$tpl->setLoop('rewrite_rules', $final_rewrite_rules);
 		*/
-		
+
 		// Custom rewrite rules
 		$final_rewrite_rules = array();
-		
+
 		if(isset($data['new']['rewrite_rules']) && trim($data['new']['rewrite_rules']) != '') {
 			$custom_rewrite_rules = trim($data['new']['rewrite_rules']);
 			$custom_rewrites_are_valid = true;
@@ -970,7 +970,7 @@ class nginx_plugin {
 			if(is_array($custom_rewrite_rule_lines) && !empty($custom_rewrite_rule_lines)){
 				foreach($custom_rewrite_rule_lines as $custom_rewrite_rule_line){
 					// ignore comments
-					if(substr(ltrim($custom_rewrite_rule_line),0,1) == '#'){
+					if(substr(ltrim($custom_rewrite_rule_line), 0, 1) == '#'){
 						$final_rewrite_rules[] = array('rewrite_rule' => $custom_rewrite_rule_line);
 						continue;
 					}
@@ -1032,7 +1032,7 @@ class nginx_plugin {
 			}
 		}
 		$tpl->setLoop('rewrite_rules', $final_rewrite_rules);
-		
+
 		// Custom nginx directives
 		$final_nginx_directives = array();
 		$nginx_directives = $data['new']['nginx_directives'];
@@ -1055,10 +1055,10 @@ class nginx_plugin {
 
 		if($domain!='' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
 			$vhost_data['ssl_enabled'] = 1;
-			$app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		} else {
 			$vhost_data['ssl_enabled'] = 0;
-			$app->log('SSL Disabled. '.$domain,LOGLEVEL_DEBUG);
+			$app->log('SSL Disabled. '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		// Set SEO Redirect
@@ -1075,23 +1075,23 @@ class nginx_plugin {
 		} else {
 			$vhost_data['seo_redirect_enabled'] = 0;
 		}
-		
-		
+
+
 
 		// Rewrite rules
 		$own_rewrite_rules = array();
 		$rewrite_rules = array();
 		$local_rewrite_rules = array();
 		if($data['new']['redirect_type'] != '' && $data['new']['redirect_path'] != '') {
-			if(substr($data['new']['redirect_path'],-1) != '/') $data['new']['redirect_path'] .= '/';
-			if(substr($data['new']['redirect_path'],0,8) == '[scheme]'){
+			if(substr($data['new']['redirect_path'], -1) != '/') $data['new']['redirect_path'] .= '/';
+			if(substr($data['new']['redirect_path'], 0, 8) == '[scheme]'){
 				if($data['new']['redirect_type'] != 'proxy'){
-					$data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'],8);
+					$data['new']['redirect_path'] = '$scheme'.substr($data['new']['redirect_path'], 8);
 				} else {
-					$data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'],8);
+					$data['new']['redirect_path'] = 'http'.substr($data['new']['redirect_path'], 8);
 				}
 			}
-			
+
 			// Custom proxy directives
 			if($data['new']['redirect_type'] == 'proxy' && trim($data['new']['proxy_directives'] != '')){
 				$final_proxy_directives = array();
@@ -1110,164 +1110,164 @@ class nginx_plugin {
 			}
 
 			switch($data['new']['subdomain']) {
-				case 'www':
-					$exclude_own_hostname = '';
-					if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path
+			case 'www':
+				$exclude_own_hostname = '';
+				if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+					if($data['new']['redirect_type'] == 'proxy'){
+						$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+						$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+						break;
+					}
+					$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				} else { // URL - check if URL is local
+					$tmp_redirect_path = $data['new']['redirect_path'];
+					if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+					$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+					if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+						// URL is local
+						if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+						if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+						//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
 						if($data['new']['redirect_type'] == 'proxy'){
 							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-							$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'],0,-1);
+							$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
 							break;
-						}
-						$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'],1,-1).(substr($data['new']['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					} else { // URL - check if URL is local
-						$tmp_redirect_path = $data['new']['redirect_path'];
-						if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7);
-						$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-						if(($tmp_redirect_path_parts['host'] == $data['new']['domain'] || $tmp_redirect_path_parts['host'] == 'www.'.$data['new']['domain']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-							// URL is local
-							if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1);
-							if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
-							//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-								$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
-								break;
-							} else {
-								$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'],1).(substr($tmp_redirect_path_parts['path'],1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-								$exclude_own_hostname = $tmp_redirect_path_parts['host'];
-							}
 						} else {
-							// external URL
-							$rewrite_exclude = '(.?)/';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['use_proxy'] = 'y';
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
+							$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+							$exclude_own_hostname = $tmp_redirect_path_parts['host'];
+						}
+					} else {
+						// external URL
+						$rewrite_exclude = '(.?)/';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['use_proxy'] = 'y';
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
 						}
-						unset($tmp_redirect_path);
-						unset($tmp_redirect_path_parts);
 					}
-					$own_rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
-						'rewrite_target' 	=> $data['new']['redirect_path'],
-						'rewrite_exclude'	=> $rewrite_exclude,
-						'rewrite_subdir'	=> $rewrite_subdir,
-						'exclude_own_hostname' => $exclude_own_hostname,
-						'proxy_directives'	=> $final_proxy_directives,
-						'use_rewrite'	=> ($data['new']['redirect_type'] == 'proxy' ? false:true),
-						'use_proxy'	=> ($data['new']['redirect_type'] == 'proxy' ? true:false));
-					break;
-				case '*':
-					$exclude_own_hostname = '';
-					if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path
+					unset($tmp_redirect_path);
+					unset($tmp_redirect_path_parts);
+				}
+				$own_rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+					'rewrite_target'  => $data['new']['redirect_path'],
+					'rewrite_exclude' => $rewrite_exclude,
+					'rewrite_subdir' => $rewrite_subdir,
+					'exclude_own_hostname' => $exclude_own_hostname,
+					'proxy_directives' => $final_proxy_directives,
+					'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+					'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+				break;
+			case '*':
+				$exclude_own_hostname = '';
+				if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+					if($data['new']['redirect_type'] == 'proxy'){
+						$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+						$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+						break;
+					}
+					$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				} else { // URL - check if URL is local
+					$tmp_redirect_path = $data['new']['redirect_path'];
+					if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+					$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+
+					//if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+					if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+						// URL is local
+						if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+						if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+						//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
 						if($data['new']['redirect_type'] == 'proxy'){
 							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-							$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'],0,-1);
+							$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
 							break;
-						}
-						$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'],1,-1).(substr($data['new']['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					} else { // URL - check if URL is local
-						$tmp_redirect_path = $data['new']['redirect_path'];
-						if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7);
-						$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-												
-						//if($is_serveralias && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-						if($this->url_is_local($tmp_redirect_path_parts['host'], $data['new']['domain_id']) && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-							// URL is local
-							if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1);
-							if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
-							//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-								$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
-								break;
-							} else {
-								$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'],1).(substr($tmp_redirect_path_parts['path'],1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-								$exclude_own_hostname = $tmp_redirect_path_parts['host'];
-							}
 						} else {
-							// external URL
-							$rewrite_exclude = '(.?)/';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['use_proxy'] = 'y';
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
+							$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+							$exclude_own_hostname = $tmp_redirect_path_parts['host'];
+						}
+					} else {
+						// external URL
+						$rewrite_exclude = '(.?)/';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['use_proxy'] = 'y';
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
 						}
-						unset($tmp_redirect_path);
-						unset($tmp_redirect_path_parts);
 					}
-					$own_rewrite_rules[] = array(	'rewrite_domain' 	=> '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
-						'rewrite_target' 	=> $data['new']['redirect_path'],
-						'rewrite_exclude'	=> $rewrite_exclude,
-						'rewrite_subdir'	=> $rewrite_subdir,
-						'exclude_own_hostname' => $exclude_own_hostname,
-						'proxy_directives'	=> $final_proxy_directives,
-						'use_rewrite'	=> ($data['new']['redirect_type'] == 'proxy' ? false:true),
-						'use_proxy'	=> ($data['new']['redirect_type'] == 'proxy' ? true:false));
-					break;
-				default:
-					if(substr($data['new']['redirect_path'],0,1) == '/'){ // relative path
-						$exclude_own_hostname = '';
+					unset($tmp_redirect_path);
+					unset($tmp_redirect_path_parts);
+				}
+				$own_rewrite_rules[] = array( 'rewrite_domain'  => '(^|\.)'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+					'rewrite_target'  => $data['new']['redirect_path'],
+					'rewrite_exclude' => $rewrite_exclude,
+					'rewrite_subdir' => $rewrite_subdir,
+					'exclude_own_hostname' => $exclude_own_hostname,
+					'proxy_directives' => $final_proxy_directives,
+					'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+					'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
+				break;
+			default:
+				if(substr($data['new']['redirect_path'], 0, 1) == '/'){ // relative path
+					$exclude_own_hostname = '';
+					if($data['new']['redirect_type'] == 'proxy'){
+						$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
+						$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
+						break;
+					}
+					$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				} else { // URL - check if URL is local
+					$tmp_redirect_path = $data['new']['redirect_path'];
+					if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
+					$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+					if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
+						// URL is local
+						if(substr($tmp_redirect_path_parts['path'], -1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'], 0, -1);
+						if(substr($tmp_redirect_path_parts['path'], 0, 1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
+						//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
 						if($data['new']['redirect_type'] == 'proxy'){
 							$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-							$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'],0,-1);
+							$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
 							break;
-						}
-						$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'],1,-1).(substr($data['new']['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-					} else { // URL - check if URL is local
-						$tmp_redirect_path = $data['new']['redirect_path'];
-						if(substr($tmp_redirect_path,0,7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path,7);
-						$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-						if($tmp_redirect_path_parts['host'] == $data['new']['domain'] && ($tmp_redirect_path_parts['port'] == '80' || $tmp_redirect_path_parts['port'] == '443' || !isset($tmp_redirect_path_parts['port']))){
-							// URL is local
-							if(substr($tmp_redirect_path_parts['path'],-1) == '/') $tmp_redirect_path_parts['path'] = substr($tmp_redirect_path_parts['path'],0,-1);
-							if(substr($tmp_redirect_path_parts['path'],0,1) != '/') $tmp_redirect_path_parts['path'] = '/'.$tmp_redirect_path_parts['path'];
-							//$rewrite_exclude = '((?!'.$tmp_redirect_path_parts['path'].'))';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['web_document_root_www_proxy'] = 'root '.$vhost_data['web_document_root_www'].';';
-								$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
-								break;
-							} else {
-								$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'],1).(substr($tmp_redirect_path_parts['path'],1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
-								$exclude_own_hostname = $tmp_redirect_path_parts['host'];
-							}
 						} else {
-							// external URL
-							$rewrite_exclude = '(.?)/';
-							if($data['new']['redirect_type'] == 'proxy'){
-								$vhost_data['use_proxy'] = 'y';
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
+							$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+							$exclude_own_hostname = $tmp_redirect_path_parts['host'];
+						}
+					} else {
+						// external URL
+						$rewrite_exclude = '(.?)/';
+						if($data['new']['redirect_type'] == 'proxy'){
+							$vhost_data['use_proxy'] = 'y';
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
 						}
-						unset($tmp_redirect_path);
-						unset($tmp_redirect_path_parts);
 					}
-					$own_rewrite_rules[] = array(	'rewrite_domain' 	=> '^'.$this->_rewrite_quote($data['new']['domain']),
-						'rewrite_type' 		=> ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
-						'rewrite_target' 	=> $data['new']['redirect_path'],
-						'rewrite_exclude'	=> $rewrite_exclude,
-						'rewrite_subdir'	=> $rewrite_subdir,
-						'exclude_own_hostname' => $exclude_own_hostname,
-						'proxy_directives'	=> $final_proxy_directives,
-						'use_rewrite'	=> ($data['new']['redirect_type'] == 'proxy' ? false:true),
-						'use_proxy'	=> ($data['new']['redirect_type'] == 'proxy' ? true:false));
+					unset($tmp_redirect_path);
+					unset($tmp_redirect_path_parts);
+				}
+				$own_rewrite_rules[] = array( 'rewrite_domain'  => '^'.$this->_rewrite_quote($data['new']['domain']),
+					'rewrite_type'   => ($data['new']['redirect_type'] == 'no')?'':$data['new']['redirect_type'],
+					'rewrite_target'  => $data['new']['redirect_path'],
+					'rewrite_exclude' => $rewrite_exclude,
+					'rewrite_subdir' => $rewrite_subdir,
+					'exclude_own_hostname' => $exclude_own_hostname,
+					'proxy_directives' => $final_proxy_directives,
+					'use_rewrite' => ($data['new']['redirect_type'] == 'proxy' ? false:true),
+					'use_proxy' => ($data['new']['redirect_type'] == 'proxy' ? true:false));
 			}
 		}
 
 		$tpl->setVar($vhost_data);
-		
+
 		$server_alias = array();
-		
+
 		// get autoalias
 		$auto_alias = $web_config['website_autoalias'];
 		if($auto_alias != '') {
@@ -1281,14 +1281,14 @@ class nginx_plugin {
 			unset($aa_replace);
 			$server_alias[] .= $auto_alias.' ';
 		}
-		
+
 		switch($data['new']['subdomain']) {
-			case 'www':
-				$server_alias[] = 'www.'.$data['new']['domain'].' ';
-				break;
-			case '*':
-				$server_alias[] = '*.'.$data['new']['domain'].' ';
-				break;
+		case 'www':
+			$server_alias[] = 'www.'.$data['new']['domain'].' ';
+			break;
+		case '*':
+			$server_alias[] = '*.'.$data['new']['domain'].' ';
+			break;
 		}
 
 		// get alias domains (co-domains and subdomains)
@@ -1296,7 +1296,7 @@ class nginx_plugin {
 		$alias_seo_redirects = array();
 		if(is_array($aliases)) {
 			foreach($aliases as $alias) {
-			
+
 				// Custom proxy directives
 				if($alias['redirect_type'] == 'proxy' && trim($alias['proxy_directives'] != '')){
 					$final_proxy_directives = array();
@@ -1313,21 +1313,21 @@ class nginx_plugin {
 				} else {
 					$final_proxy_directives = false;
 				}
-			
-				if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'],0,1) == '/') {
+
+				if($alias['redirect_type'] == '' || $alias['redirect_path'] == '' || substr($alias['redirect_path'], 0, 1) == '/') {
 					switch($alias['subdomain']) {
-						case 'www':
-							$server_alias[] = 'www.'.$alias['domain'].' '.$alias['domain'].' ';
-							break;
-						case '*':
-							$server_alias[] = '*.'.$alias['domain'].' '.$alias['domain'].' ';
-							break;
-						default:
-							$server_alias[] = $alias['domain'].' ';
-							break;
+					case 'www':
+						$server_alias[] = 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+						break;
+					case '*':
+						$server_alias[] = '*.'.$alias['domain'].' '.$alias['domain'].' ';
+						break;
+					default:
+						$server_alias[] = $alias['domain'].' ';
+						break;
 					}
-					$app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG);
-					
+					$app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
 					// Add SEO redirects for alias domains
 					if($alias['seo_redirect'] != '' && $data['new']['seo_redirect'] != '*_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_to_domain_tld' && ($alias['type'] == 'alias' || ($alias['type'] == 'subdomain' && $data['new']['seo_redirect'] != '*_domain_tld_to_www_domain_tld' && $data['new']['seo_redirect'] != '*_domain_tld_to_domain_tld'))){
 						$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
@@ -1336,167 +1336,167 @@ class nginx_plugin {
 						}
 					}
 				}
-				
+
 				// Local Rewriting (inside vhost server {} container)
-				if($alias['redirect_type'] != '' && substr($alias['redirect_path'],0,1) == '/' && $alias['redirect_type'] != 'proxy') {  // proxy makes no sense with local path
-					if(substr($alias['redirect_path'],-1) != '/') $alias['redirect_path'] .= '/';
-					$rewrite_exclude = '(?!/\b('.substr($alias['redirect_path'],1,-1).(substr($alias['redirect_path'],1,-1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
+				if($alias['redirect_type'] != '' && substr($alias['redirect_path'], 0, 1) == '/' && $alias['redirect_type'] != 'proxy') {  // proxy makes no sense with local path
+					if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
+					$rewrite_exclude = '(?!/\b('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
 					switch($alias['subdomain']) {
-						case 'www':
-							// example.com
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> $alias['domain'],
-								'local_redirect_operator'	=> '=',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
-
-							// www.example.com
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> 'www.'.$alias['domain'],
-								'local_redirect_operator'	=> '=',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
-							break;
-						case '*':
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$',
-								'local_redirect_operator'	=> '~*',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
-							break;
-						default:
-							$local_rewrite_rules[] = array(	'local_redirect_origin_domain' 	=> $alias['domain'],
-								'local_redirect_operator'	=> '=',
-								'local_redirect_exclude' => $rewrite_exclude,
-								'local_redirect_target' => $alias['redirect_path'],
-								'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+					case 'www':
+						// example.com
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => $alias['domain'],
+							'local_redirect_operator' => '=',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+
+						// www.example.com
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => 'www.'.$alias['domain'],
+							'local_redirect_operator' => '=',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+						break;
+					case '*':
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => '^('.str_replace('.', '\.', $alias['domain']).'|.+\.'.str_replace('.', '\.', $alias['domain']).')$',
+							'local_redirect_operator' => '~*',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
+						break;
+					default:
+						$local_rewrite_rules[] = array( 'local_redirect_origin_domain'  => $alias['domain'],
+							'local_redirect_operator' => '=',
+							'local_redirect_exclude' => $rewrite_exclude,
+							'local_redirect_target' => $alias['redirect_path'],
+							'local_redirect_type' => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type']);
 					}
 				}
-				
+
 				// External Rewriting (extra server {} containers)
-				if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'],0,1) != '/') {
-					if(substr($alias['redirect_path'],-1) != '/') $alias['redirect_path'] .= '/';
-					if(substr($alias['redirect_path'],0,8) == '[scheme]'){
+				if($alias['redirect_type'] != '' && $alias['redirect_path'] != '' && substr($alias['redirect_path'], 0, 1) != '/') {
+					if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
+					if(substr($alias['redirect_path'], 0, 8) == '[scheme]'){
 						if($alias['redirect_type'] != 'proxy'){
-							$alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'],8);
+							$alias['redirect_path'] = '$scheme'.substr($alias['redirect_path'], 8);
 						} else {
-							$alias['redirect_path'] = 'http'.substr($alias['redirect_path'],8);
+							$alias['redirect_path'] = 'http'.substr($alias['redirect_path'], 8);
 						}
 					}
-					
+
 					switch($alias['subdomain']) {
-						case 'www':
-							if($alias['redirect_type'] == 'proxy'){
-								$tmp_redirect_path = $alias['redirect_path'];
-								$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
-							
-							if($alias['redirect_type'] != 'proxy'){
-								if(substr($alias['redirect_path'],-1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'],0,-1);
-							}
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
-								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
-							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $alias['domain'],
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
-
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
-								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www');
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
+					case 'www':
+						if($alias['redirect_type'] == 'proxy'){
+							$tmp_redirect_path = $alias['redirect_path'];
+							$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+
+						if($alias['redirect_type'] != 'proxy'){
+							if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+						}
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> 'www.'.$alias['domain'],
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
-							break;
-						case '*':
-							if($alias['redirect_type'] == 'proxy'){
-								$tmp_redirect_path = $alias['redirect_path'];
-								$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => $alias['domain'],
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'www');
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							
-							if($alias['redirect_type'] != 'proxy'){
-								if(substr($alias['redirect_path'],-1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'],0,-1);
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => 'www.'.$alias['domain'],
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+						break;
+					case '*':
+						if($alias['redirect_type'] == 'proxy'){
+							$tmp_redirect_path = $alias['redirect_path'];
+							$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+
+						if($alias['redirect_type'] != 'proxy'){
+							if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+						}
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => $alias['domain'].' *.'.$alias['domain'],
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+						break;
+					default:
+						if($alias['redirect_type'] == 'proxy'){
+							$tmp_redirect_path = $alias['redirect_path'];
+							$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
+							$rewrite_subdir = $tmp_redirect_path_parts['path'];
+							if(substr($rewrite_subdir, 0, 1) == '/') $rewrite_subdir = substr($rewrite_subdir, 1);
+							if(substr($rewrite_subdir, -1) != '/') $rewrite_subdir .= '/';
+							if($rewrite_subdir == '/') $rewrite_subdir = '';
+						}
+
+						if($alias['redirect_type'] != 'proxy'){
+							if(substr($alias['redirect_path'], -1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'], 0, -1);
+						}
+						if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2);
+						else $domain_rule = $alias['domain'];
+						// Add SEO redirects for alias domains
+						$alias_seo_redirects2 = array();
+						if($alias['seo_redirect'] != ''){
+							if(substr($alias['domain'], 0, 2) === '*.'){
 								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
-							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $alias['domain'].' *.'.$alias['domain'],
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
-							break;
-						default:
-							if($alias['redirect_type'] == 'proxy'){
-								$tmp_redirect_path = $alias['redirect_path'];
-								$tmp_redirect_path_parts = parse_url($tmp_redirect_path);
-								$rewrite_subdir = $tmp_redirect_path_parts['path'];
-								if(substr($rewrite_subdir,0,1) == '/') $rewrite_subdir = substr($rewrite_subdir,1);
-								if(substr($rewrite_subdir,-1) != '/') $rewrite_subdir .= '/';
-								if($rewrite_subdir == '/') $rewrite_subdir = '';
-							}
-							
-							if($alias['redirect_type'] != 'proxy'){
-								if(substr($alias['redirect_path'],-1) == '/') $alias['redirect_path'] = substr($alias['redirect_path'],0,-1);
+							} else {
+								$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
 							}
-                            if(substr($alias['domain'], 0, 2) === '*.') $domain_rule = '*.'.substr($alias['domain'], 2);
-                            else $domain_rule = $alias['domain'];
-							// Add SEO redirects for alias domains
-							$alias_seo_redirects2 = array();
-							if($alias['seo_redirect'] != ''){
-								if(substr($alias['domain'], 0, 2) === '*.'){
-									$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_');
-								} else {
-									$tmp_seo_redirects = $this->get_seo_redirects($alias, 'alias_', 'none');
-								}
-								if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
-									$alias_seo_redirects2[] = $tmp_seo_redirects;
-								}
+							if(is_array($tmp_seo_redirects) && !empty($tmp_seo_redirects)){
+								$alias_seo_redirects2[] = $tmp_seo_redirects;
 							}
-							$rewrite_rules[] = array(	'rewrite_domain' 	=> $domain_rule,
-								'rewrite_type' 		=> ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
-								'rewrite_target' 	=> $alias['redirect_path'],
-								'rewrite_subdir'	=> $rewrite_subdir,
-								'proxy_directives'	=> $final_proxy_directives,
-								'use_rewrite'	=> ($alias['redirect_type'] == 'proxy' ? false:true),
-								'use_proxy'	=> ($alias['redirect_type'] == 'proxy' ? true:false),
-								'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
+						}
+						$rewrite_rules[] = array( 'rewrite_domain'  => $domain_rule,
+							'rewrite_type'   => ($alias['redirect_type'] == 'no')?'':$alias['redirect_type'],
+							'rewrite_target'  => $alias['redirect_path'],
+							'rewrite_subdir' => $rewrite_subdir,
+							'proxy_directives' => $final_proxy_directives,
+							'use_rewrite' => ($alias['redirect_type'] == 'proxy' ? false:true),
+							'use_proxy' => ($alias['redirect_type'] == 'proxy' ? true:false),
+							'alias_seo_redirects2' => (count($alias_seo_redirects2) > 0 ? $alias_seo_redirects2 : false));
 					}
 				}
 			}
@@ -1512,59 +1512,59 @@ class nginx_plugin {
 			}
 			unset($tmp_alias);
 
-			$tpl->setVar('alias',trim($server_alias_str));
+			$tpl->setVar('alias', trim($server_alias_str));
 		} else {
-			$tpl->setVar('alias','');
+			$tpl->setVar('alias', '');
 		}
 
 		if(count($rewrite_rules) > 0) {
-			$tpl->setLoop('redirects',$rewrite_rules);
+			$tpl->setLoop('redirects', $rewrite_rules);
 		}
 		if(count($own_rewrite_rules) > 0) {
-			$tpl->setLoop('own_redirects',$own_rewrite_rules);
+			$tpl->setLoop('own_redirects', $own_rewrite_rules);
 		}
 		if(count($local_rewrite_rules) > 0) {
-			$tpl->setLoop('local_redirects',$local_rewrite_rules);
+			$tpl->setLoop('local_redirects', $local_rewrite_rules);
 		}
 		if(count($alias_seo_redirects) > 0) {
-			$tpl->setLoop('alias_seo_redirects',$alias_seo_redirects);
+			$tpl->setLoop('alias_seo_redirects', $alias_seo_redirects);
 		}
-		
+
 		//* Create basic http auth for website statistics
 		$tpl->setVar('stats_auth_passwd_file', $data['new']['document_root']."/web/stats/.htpasswd_stats");
-		
+
 		// Create basic http auth for other directories
 		$basic_auth_locations = $this->_create_web_folder_auth_configuration($data['new']);
 		if(is_array($basic_auth_locations) && !empty($basic_auth_locations)) $tpl->setLoop('basic_auth_locations', $basic_auth_locations);
 
 		$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
 		//* Make a backup copy of vhost file
-		if(file_exists($vhost_file)) copy($vhost_file,$vhost_file.'~');
-		
+		if(file_exists($vhost_file)) copy($vhost_file, $vhost_file.'~');
+
 		//* Write vhost file
-		$app->system->file_put_contents($vhost_file,$this->nginx_merge_locations($tpl->grab()));
-		$app->log('Writing the vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
+		$app->system->file_put_contents($vhost_file, $this->nginx_merge_locations($tpl->grab()));
+		$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 		//* Set the symlink to enable the vhost
 		//* First we check if there is a old type of symlink and remove it
 		$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
 		if(is_link($vhost_symlink)) unlink($vhost_symlink);
-		
+
 		//* Remove old or changed symlinks
 		if($data['new']['subdomain'] != $data['old']['subdomain'] or $data['new']['active'] == 'n') {
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		//* New symlink
 		if($data['new']['subdomain'] == '*') {
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['new']['domain'].'.vhost');
@@ -1572,8 +1572,8 @@ class nginx_plugin {
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['new']['domain'].'.vhost');
 		}
 		if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
-			symlink($vhost_file,$vhost_symlink);
-			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			symlink($vhost_file, $vhost_symlink);
+			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		// remove old symlink and vhost file, if domain name of the site has changed
@@ -1581,78 +1581,78 @@ class nginx_plugin {
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)) {
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			$app->system->unlink($vhost_file);
-			$app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
 		}
-		
+
 		// create password file for stats directory
 		if(!is_file($data['new']['document_root'].'/web/stats/.htpasswd_stats') || $data['new']['stats_password'] != $data['old']['stats_password']) {
 			if(trim($data['new']['stats_password']) != '') {
 				$htp_file = 'admin:'.trim($data['new']['stats_password']);
-				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats',$htp_file);
-				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats',0755);
+				$app->system->file_put_contents($data['new']['document_root'].'/web/stats/.htpasswd_stats', $htp_file);
+				$app->system->chmod($data['new']['document_root'].'/web/stats/.htpasswd_stats', 0755);
 				unset($htp_file);
 			}
 		}
-		
+
 		//* Create awstats configuration
 		if($data['new']['stats_type'] == 'awstats' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain')) {
-			$this->awstats_update($data,$web_config);
+			$this->awstats_update($data, $web_config);
 		}
-		
-		$this->php_fpm_pool_update($data,$web_config,$pool_dir,$pool_name,$socket_dir);
-		
+
+		$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir);
+
 		if($web_config['check_apache_config'] == 'y') {
 			//* Test if nginx starts with the new configuration file
-			$nginx_online_status_before_restart = $this->_checkTcp('localhost',80);
-			$app->log('nginx status is: '.($nginx_online_status_before_restart === true? 'running' : 'down'),LOGLEVEL_DEBUG);
+			$nginx_online_status_before_restart = $this->_checkTcp('localhost', 80);
+			$app->log('nginx status is: '.($nginx_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+
+			$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);
 
-			$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);
-		
+
 			//* 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 === true? 'running' : 'down'),LOGLEVEL_DEBUG);
-			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);
+			$nginx_online_status_after_restart = $this->_checkTcp('localhost', 80);
+			$app->log('nginx online status after restart is: '.($nginx_online_status_after_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
+			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);
+					$app->log('Reason for nginx restart failure: '.implode("\n", $retval['output']), LOGLEVEL_WARN);
 					$app->dbmaster->datalogError(implode("\n", $retval['output']));
 				} 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);
+						$app->log('Reason for nginx restart failure: '.implode("\n", $tmp_output), LOGLEVEL_WARN);
 						$app->dbmaster->datalogError(implode("\n", $tmp_output));
 					}
 					unset($tmp_output, $tmp_retval);
 				}
-				$app->system->copy($vhost_file,$vhost_file.'.err');
-				
+				$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);
+					$app->system->copy($vhost_file.'~', $vhost_file);
 				} else {
 					//* There is no backup file, so we create a empty vhost file with a warning message inside
-					$app->system->file_put_contents($vhost_file,"# nginx did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
+					$app->system->file_put_contents($vhost_file, "# nginx did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors.");
 				}
-				
+
 				if($this->ssl_certificate_changed === true) {
 
 					$ssl_dir = $data['new']['document_root'].'/ssl';
@@ -1662,41 +1662,41 @@ class nginx_plugin {
 					$csr_file = $ssl_dir.'/'.$domain.'.csr';
 					$crt_file = $ssl_dir.'/'.$domain.'.crt';
 					//$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-					
+
 					//* Backup the files that might have caused the error
 					if(is_file($key_file)){
-						$app->system->copy($key_file,$key_file.'.err');
-						$app->system->chmod($key_file.'.err',0400);
+						$app->system->copy($key_file, $key_file.'.err');
+						$app->system->chmod($key_file.'.err', 0400);
 					}
 					if(is_file($key_file2)){
-						$app->system->copy($key_file2,$key_file2.'.err');
-						$app->system->chmod($key_file2.'.err',0400);
+						$app->system->copy($key_file2, $key_file2.'.err');
+						$app->system->chmod($key_file2.'.err', 0400);
 					}
-					if(is_file($csr_file)) $app->system->copy($csr_file,$csr_file.'.err');
-					if(is_file($crt_file)) $app->system->copy($crt_file,$crt_file.'.err');
+					if(is_file($csr_file)) $app->system->copy($csr_file, $csr_file.'.err');
+					if(is_file($crt_file)) $app->system->copy($crt_file, $crt_file.'.err');
 					//if(is_file($bundle_file)) $app->system->copy($bundle_file,$bundle_file.'.err');
-					
+
 					//* Restore the ~ backup files
-					if(is_file($key_file.'~')) $app->system->copy($key_file.'~',$key_file);
-					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~',$key_file2);
-					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~',$crt_file);
-					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~',$csr_file);
+					if(is_file($key_file.'~')) $app->system->copy($key_file.'~', $key_file);
+					if(is_file($key_file2.'~')) $app->system->copy($key_file2.'~', $key_file2);
+					if(is_file($crt_file.'~')) $app->system->copy($crt_file.'~', $crt_file);
+					if(is_file($csr_file.'~')) $app->system->copy($csr_file.'~', $csr_file);
 					//if(is_file($bundle_file.'~')) $app->system->copy($bundle_file.'~',$bundle_file);
-					
-					$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.',LOGLEVEL_WARN);
+
+					$app->log('nginx did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the SSL configuration. Saved non-working SSL files with .err extension.', LOGLEVEL_WARN);
 				}
-				
-				$app->services->restartService('httpd','restart');
+
+				$app->services->restartService('httpd', 'restart');
 			}
 		} else {
 			//* We do not check the nginx config after changes (is faster)
-			$app->services->restartServiceDelayed('httpd','reload');
+			$app->services->restartServiceDelayed('httpd', 'reload');
 		}
-		
-		//* The vhost is written and apache has been restarted, so we 
+
+		//* The vhost is written and apache has been restarted, so we
 		// can reset the ssl changed var to false and cleanup some files
 		$this->ssl_certificate_changed = false;
-		
+
 		$ssl_dir = $data['new']['document_root'].'/ssl';
 		$domain = $data['new']['ssl_domain'];
 		$key_file = $ssl_dir.'/'.$domain.'.key.org';
@@ -1704,13 +1704,13 @@ class nginx_plugin {
 		$csr_file = $ssl_dir.'/'.$domain.'.csr';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 		//$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
-		
+
 		if(@is_file($key_file.'~')) $app->system->unlink($key_file.'~');
 		if(@is_file($key2_file.'~')) $app->system->unlink($key2_file.'~');
 		if(@is_file($crt_file.'~')) $app->system->unlink($crt_file.'~');
 		if(@is_file($csr_file.'~')) $app->system->unlink($csr_file.'~');
 		//if(@is_file($bundle_file.'~')) $app->system->unlink($bundle_file.'~');
-		
+
 		// Remove the backup copy of the config file.
 		if(@is_file($vhost_file.'~')) $app->system->unlink($vhost_file.'~');
 
@@ -1719,15 +1719,15 @@ class nginx_plugin {
 
 	}
 
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
 		$app->uses('getconf');
 		$app->uses('system');
 		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
-		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'],false);
+
+		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') $app->system->web_folder_protection($data['old']['document_root'], false);
 
 		//* Check if this is a chrooted setup
 		if($web_config['website_basedir'] != '' && @is_file($web_config['website_basedir'].'/etc/passwd')) {
@@ -1735,12 +1735,12 @@ class nginx_plugin {
 		} else {
 			$nginx_chrooted = false;
 		}
-		
+
 		//* Remove the mounts
 		$log_folder = 'log';
-        $web_folder = '';
-        if($data['old']['type'] == 'vhostsubdomain') {
-            $tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
+		$web_folder = '';
+		if($data['old']['type'] == 'vhostsubdomain') {
+			$tmp = $app->db->queryOneRecord('SELECT `domain`,`document_root` FROM web_domain WHERE domain_id = '.intval($data['old']['parent_domain_id']));
 			if($tmp['domain'] != ''){
 				$subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['old']['domain']);
 			} else {
@@ -1762,7 +1762,7 @@ class nginx_plugin {
 				*/
 				// we are deleting the parent domain, so we can delete everything in the log directory
 				$subdomain_hosts = array();
-				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.','..'));
+				$files = array_diff(scandir($data['old']['document_root'].'/'.$log_folder), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_dir($data['old']['document_root'].'/'.$log_folder.'/'.$file)){
@@ -1781,10 +1781,10 @@ class nginx_plugin {
 				$log_folder .= '/' . $subdomain_host;
 			}
 			$web_folder = $data['old']['web_folder'];
-            unset($tmp);
+			unset($tmp);
 			unset($subdomain_hosts);
 		}
-        
+
 		if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain'){
 			if(is_array($log_folders) && !empty($log_folders)){
 				foreach($log_folders as $log_folder){
@@ -1796,16 +1796,16 @@ class nginx_plugin {
 				exec('umount '.escapeshellarg($data['old']['document_root'].'/'.$log_folder).' 2>/dev/null');
 			}
 		}
-		
+
 		//* remove mountpoint from fstab
 		if(is_array($log_folders) && !empty($log_folders)){
 			foreach($log_folders as $log_folder){
 				$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-				$app->system->removeLine('/etc/fstab',$fstab_line);
+				$app->system->removeLine('/etc/fstab', $fstab_line);
 			}
 		} else {
 			$fstab_line = '/var/log/ispconfig/httpd/'.$data['old']['domain'].' '.$data['old']['document_root'].'/'.$log_folder.'    none    bind';
-			$app->system->removeLine('/etc/fstab',$fstab_line);
+			$app->system->removeLine('/etc/fstab', $fstab_line);
 		}
 		unset($log_folders);
 
@@ -1817,241 +1817,241 @@ class nginx_plugin {
 			$data['old'] = $tmp;
 			$this->action = 'update';
 			// just run the update function
-			$this->update($event_name,$data);
+			$this->update($event_name, $data);
 
 		} else {
 			//* This is a website
-			// Deleting the vhost file, symlink and the data directory			
+			// Deleting the vhost file, symlink and the data directory
 			$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
-			
+
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/900-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
 			$vhost_symlink = escapeshellcmd($web_config['nginx_vhost_conf_enabled_dir'].'/100-'.$data['old']['domain'].'.vhost');
 			if(is_link($vhost_symlink)){
 				$app->system->unlink($vhost_symlink);
-				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+				$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			}
-			
+
 			$app->system->unlink($vhost_file);
-			$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
-            
-            if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
-                $docroot = escapeshellcmd($data['old']['document_root']);
-                if($docroot != '' && !stristr($docroot,'..')) {
-                    if($data['old']['type'] == 'vhost') {
-                        // this is a vhost - we delete everything in here.
-                        exec('rm -rf '.$docroot);
-                    } elseif(!stristr($data['old']['web_folder'], '..')) {
-                        // this is a vhost subdomain
-                        // IMPORTANT: do some folder checks before we delete this!
-                        $do_delete = true;
-                        $delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
-                        if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
-                        if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
-                        
-                        $path_elements = explode('/', $delete_folder);
-                        
-                        if($path_elements[0] == 'web' || $path_elements[0] === '') {
-                            // paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
-                            // we use strict check as otherwise directories named '0' may not be deleted
-                            $do_delete = false;
-                        } else {
-                            // read all vhost subdomains with same parent domain
-                            $used_paths = array();
-                            $tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
-                            foreach($tmp as $tmprec) {
-                                // we normalize the folder entries because we need to compare them
-                                $tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
-                                if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
-                                if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
-                                
-                                // add this path and it's parent paths to used_paths array
-                                while(strpos($tmp_folder, '/') !== false) {
-                                    if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                                    $tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
-                                }
-                                if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
-                            }
-                            unset($tmp);
-                            
-                            // loop and check if the path is still used and stop at first used one
-                            // set do_delete to false so nothing gets deleted if the web_folder itself is still used
-                            $do_delete = false;
-                            while(count($path_elements) > 0) {
-                                $tmp_folder = implode('/', $path_elements);
-                                if(in_array($tmp_folder, $used_paths) == true) break;
-                                
-                                // this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
-                                $delete_folder = $tmp_folder;
-                                $do_delete = true;
-                                array_pop($path_elements);
-                            }
-                            unset($tmp_folder);
-                            unset($used_paths);
-                        }
-                        
-                        if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
-                        
-                        unset($delete_folder);
-                        unset($path_elements);
-                    }
-                }
-			
-                //remove the php fastgi starter script if available
-                if ($data['old']['php'] == 'fast-cgi') {
-					$this->php_fpm_pool_delete($data,$web_config);
-                    $fastcgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$web_config['fastcgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($fastcgi_starter_path)) {
-                            exec('rm -rf '.$fastcgi_starter_path);
-                        }
-                    } else {
-                        $fcgi_starter_script = $fastcgi_starter_path.$web_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
-                        if (file_exists($fcgi_starter_script)) {
-                            exec('rm -f '.$fcgi_starter_script);
-                        }
-                    }
-                }
-                
-                // remove PHP-FPM pool
-                if ($data['old']['php'] == 'php-fpm') {
-                    $this->php_fpm_pool_delete($data,$web_config);
-                }
-
-                //remove the php cgi starter script if available
-                if ($data['old']['php'] == 'cgi') {
-                    // TODO: fetch the date from the server-settings
-                    $web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
-
-                    $cgi_starter_path = str_replace('[system_user]',$data['old']['system_user'],$web_config['cgi_starter_path']);
-                    if($data['old']['type'] == 'vhost') {
-                        if (is_dir($cgi_starter_path)) {
-                            exec('rm -rf '.$cgi_starter_path);
-                        }
-                    } else {
-                        $cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
-                        if (file_exists($cgi_starter_script)) {
-                            exec('rm -f '.$cgi_starter_script);
-                        }
-                    }
-                }
-            
-                $app->log('Removing website: '.$docroot,LOGLEVEL_DEBUG);
-
-                // Delete the symlinks for the sites
-                $client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
-                $client_id = intval($client['client_id']);
-                unset($client);
-                $tmp_symlinks_array = explode(':',$web_config['website_symlinks']);
-                if(is_array($tmp_symlinks_array)) {
-                    foreach($tmp_symlinks_array as $tmp_symlink) {
-                        $tmp_symlink = str_replace('[client_id]',$client_id,$tmp_symlink);
-                        $tmp_symlink = str_replace('[website_domain]',$data['old']['domain'],$tmp_symlink);
-                        // Remove trailing slash
-                        if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
-                        // create the symlinks, if not exist
-                        if(is_link($tmp_symlink)) {
-                            $app->system->unlink($tmp_symlink);
-                            $app->log('Removing symlink: '.$tmp_symlink,LOGLEVEL_DEBUG);
-                        }
-                    }
-                }
-                // end removing symlinks
-            } else {
-                // vhost subdomain
-            }
-
-            // Delete the log file directory
-            $vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
-            if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir,'..')) exec('rm -rf '.$vhost_logfile_dir);
-            $app->log('Removing website logfile directory: '.$vhost_logfile_dir,LOGLEVEL_DEBUG);
-
-            if($data['old']['type'] == 'vhost') {
-                //delete the web user
-                $command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
-                $command .= ' '.escapeshellcmd($data['old']['system_user']);
-                exec($command);
-                if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
-                
-            }
-            
-            //* Remove the awstats configuration file
-            if($data['old']['stats_type'] == 'awstats') {
-                $this->awstats_delete($data,$web_config);
-			}
-			
-			$app->services->restartServiceDelayed('httpd','reload');
-
-		}
-		
-		
-		if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'],true);
+			$app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+
+			if($data['old']['type'] == 'vhost' || $data['old']['type'] == 'vhostsubdomain') {
+				$docroot = escapeshellcmd($data['old']['document_root']);
+				if($docroot != '' && !stristr($docroot, '..')) {
+					if($data['old']['type'] == 'vhost') {
+						// this is a vhost - we delete everything in here.
+						exec('rm -rf '.$docroot);
+					} elseif(!stristr($data['old']['web_folder'], '..')) {
+						// this is a vhost subdomain
+						// IMPORTANT: do some folder checks before we delete this!
+						$do_delete = true;
+						$delete_folder = preg_replace('/[\/]{2,}/', '/', $web_folder); // replace / occuring multiple times
+						if(substr($delete_folder, 0, 1) === '/') $delete_folder = substr($delete_folder, 1);
+						if(substr($delete_folder, -1) === '/') $delete_folder = substr($delete_folder, 0, -1);
+
+						$path_elements = explode('/', $delete_folder);
+
+						if($path_elements[0] == 'web' || $path_elements[0] === '') {
+							// paths beginning with /web should NEVER EVER be deleted, empty paths should NEVER occur - but for safety reasons we check it here!
+							// we use strict check as otherwise directories named '0' may not be deleted
+							$do_delete = false;
+						} else {
+							// read all vhost subdomains with same parent domain
+							$used_paths = array();
+							$tmp = $app->db->queryAllRecords("SELECT `web_folder` FROM web_domain WHERE type = 'vhostsubdomain' AND parent_domain_id = ".intval($data['old']['parent_domain_id'])." AND domain_id != ".intval($data['old']['domain_id']));
+							foreach($tmp as $tmprec) {
+								// we normalize the folder entries because we need to compare them
+								$tmp_folder = preg_replace('/[\/]{2,}/', '/', $tmprec['web_folder']); // replace / occuring multiple times
+								if(substr($tmp_folder, 0, 1) === '/') $tmp_folder = substr($tmp_folder, 1);
+								if(substr($tmp_folder, -1) === '/') $tmp_folder = substr($tmp_folder, 0, -1);
+
+								// add this path and it's parent paths to used_paths array
+								while(strpos($tmp_folder, '/') !== false) {
+									if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+									$tmp_folder = substr($tmp_folder, 0, strrpos($tmp_folder, '/'));
+								}
+								if(in_array($tmp_folder, $used_paths) == false) $used_paths[] = $tmp_folder;
+							}
+							unset($tmp);
+
+							// loop and check if the path is still used and stop at first used one
+							// set do_delete to false so nothing gets deleted if the web_folder itself is still used
+							$do_delete = false;
+							while(count($path_elements) > 0) {
+								$tmp_folder = implode('/', $path_elements);
+								if(in_array($tmp_folder, $used_paths) == true) break;
+
+								// this path is not used - set it as path to delete, strip the last element from the array and set do_delete to true
+								$delete_folder = $tmp_folder;
+								$do_delete = true;
+								array_pop($path_elements);
+							}
+							unset($tmp_folder);
+							unset($used_paths);
+						}
+
+						if($do_delete === true && $delete_folder !== '') exec('rm -rf '.$docroot.'/'.$delete_folder);
+
+						unset($delete_folder);
+						unset($path_elements);
+					}
+				}
+
+				//remove the php fastgi starter script if available
+				if ($data['old']['php'] == 'fast-cgi') {
+					$this->php_fpm_pool_delete($data, $web_config);
+					$fastcgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['fastcgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($fastcgi_starter_path)) {
+							exec('rm -rf '.$fastcgi_starter_path);
+						}
+					} else {
+						$fcgi_starter_script = $fastcgi_starter_path.$web_config['fastcgi_starter_script'].'_web'.$data['old']['domain_id'];
+						if (file_exists($fcgi_starter_script)) {
+							exec('rm -f '.$fcgi_starter_script);
+						}
+					}
+				}
+
+				// remove PHP-FPM pool
+				if ($data['old']['php'] == 'php-fpm') {
+					$this->php_fpm_pool_delete($data, $web_config);
+				}
+
+				//remove the php cgi starter script if available
+				if ($data['old']['php'] == 'cgi') {
+					// TODO: fetch the date from the server-settings
+					$web_config['cgi_starter_path'] = $web_config['website_basedir'].'/php-cgi-scripts/[system_user]/';
+
+					$cgi_starter_path = str_replace('[system_user]', $data['old']['system_user'], $web_config['cgi_starter_path']);
+					if($data['old']['type'] == 'vhost') {
+						if (is_dir($cgi_starter_path)) {
+							exec('rm -rf '.$cgi_starter_path);
+						}
+					} else {
+						$cgi_starter_script = $cgi_starter_path.'php-cgi-starter_web'.$data['old']['domain_id'];
+						if (file_exists($cgi_starter_script)) {
+							exec('rm -f '.$cgi_starter_script);
+						}
+					}
+				}
+
+				$app->log('Removing website: '.$docroot, LOGLEVEL_DEBUG);
+
+				// Delete the symlinks for the sites
+				$client = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE sys_group.groupid = '.intval($data['old']['sys_groupid']));
+				$client_id = intval($client['client_id']);
+				unset($client);
+				$tmp_symlinks_array = explode(':', $web_config['website_symlinks']);
+				if(is_array($tmp_symlinks_array)) {
+					foreach($tmp_symlinks_array as $tmp_symlink) {
+						$tmp_symlink = str_replace('[client_id]', $client_id, $tmp_symlink);
+						$tmp_symlink = str_replace('[website_domain]', $data['old']['domain'], $tmp_symlink);
+						// Remove trailing slash
+						if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
+						// create the symlinks, if not exist
+						if(is_link($tmp_symlink)) {
+							$app->system->unlink($tmp_symlink);
+							$app->log('Removing symlink: '.$tmp_symlink, LOGLEVEL_DEBUG);
+						}
+					}
+				}
+				// end removing symlinks
+			} else {
+				// vhost subdomain
+			}
+
+			// Delete the log file directory
+			$vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/httpd/'.$data['old']['domain']);
+			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+			$app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
+
+			if($data['old']['type'] == 'vhost') {
+				//delete the web user
+				$command = 'killall -u '.escapeshellcmd($data['old']['system_user']).' ; userdel';
+				$command .= ' '.escapeshellcmd($data['old']['system_user']);
+				exec($command);
+				if($nginx_chrooted) $this->_exec('chroot '.escapeshellcmd($web_config['website_basedir']).' '.$command);
+
+			}
+
+			//* Remove the awstats configuration file
+			if($data['old']['stats_type'] == 'awstats') {
+				$this->awstats_delete($data, $web_config);
+			}
+
+			$app->services->restartServiceDelayed('httpd', 'reload');
+
+		}
+
+
+		if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
 	}
 
 	//* This function is called when a IP on the server is inserted, updated or deleted
-	function server_ip($event_name,$data) {
+	function server_ip($event_name, $data) {
 		return;
 	}
-	
+
 	//* Create or update the .htaccess folder protection
-	function web_folder_user($event_name,$data) {
+	function web_folder_user($event_name, $data) {
 		global $app, $conf;
 
 		$app->uses('system');
-		
+
 		if($event_name == 'web_folder_user_delete') {
 			$folder_id = $data['old']['web_folder_id'];
 		} else {
 			$folder_id = $data['new']['web_folder_id'];
 		}
-		
+
 		$folder = $app->db->queryOneRecord("SELECT * FROM web_folder WHERE web_folder_id = ".intval($folder_id));
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($folder_path,'..') || stristr($folder_path,'./') || stristr($folder_path,'\\')) {
-			$app->log('Folder path "'.$folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($folder_path, '..') || stristr($folder_path, './') || stristr($folder_path, '\\')) {
+			$app->log('Folder path "'.$folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($folder_path)) {
 			$app->system->mkdirpath($folder_path);
-			$app->system->chown($folder_path,$website['system_user']);
-			$app->system->chgrp($folder_path,$website['system_group']);
+			$app->system->chown($folder_path, $website['system_user']);
+			$app->system->chgrp($folder_path, $website['system_group']);
 		}
-		
+
 		//* Create empty .htpasswd file, if it does not exist
 		if(!is_file($folder_path.'.htpasswd')) {
 			touch($folder_path.'.htpasswd');
-			$app->system->chmod($folder_path.'.htpasswd',0755);
-			$app->system->chown($folder_path.'.htpasswd',$website['system_user']);
-			$app->system->chgrp($folder_path.'.htpasswd',$website['system_group']);
-			$app->log('Created file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->system->chmod($folder_path.'.htpasswd', 0755);
+			$app->system->chown($folder_path.'.htpasswd', $website['system_user']);
+			$app->system->chgrp($folder_path.'.htpasswd', $website['system_group']);
+			$app->log('Created file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		/*
 		$auth_users = $app->db->queryAllRecords("SELECT * FROM web_folder_user WHERE active = 'y' AND web_folder_id = ".intval($folder_id));
 		$htpasswd_content = '';
@@ -2064,132 +2064,132 @@ class nginx_plugin {
 		@file_put_contents($folder_path.'.htpasswd', $htpasswd_content);
 		$app->log('Changed .htpasswd file: '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
 		*/
-		
+
 		if(($data['new']['username'] != $data['old']['username'] || $data['new']['active'] == 'n') && $data['old']['username'] != '') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Add or remove the user from .htpasswd file
 		if($event_name == 'web_folder_user_delete') {
-			$app->system->removeLine($folder_path.'.htpasswd',$data['old']['username'].':');
-			$app->log('Removed user: '.$data['old']['username'],LOGLEVEL_DEBUG);
+			$app->system->removeLine($folder_path.'.htpasswd', $data['old']['username'].':');
+			$app->log('Removed user: '.$data['old']['username'], LOGLEVEL_DEBUG);
 		} else {
 			if($data['new']['active'] == 'y') {
-				$app->system->replaceLine($folder_path.'.htpasswd',$data['new']['username'].':',$data['new']['username'].':'.$data['new']['password'],0,1);
-				$app->log('Added or updated user: '.$data['new']['username'],LOGLEVEL_DEBUG);
+				$app->system->replaceLine($folder_path.'.htpasswd', $data['new']['username'].':', $data['new']['username'].':'.$data['new']['password'], 0, 1);
+				$app->log('Added or updated user: '.$data['new']['username'], LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		// write basic auth configuration to vhost file because nginx does not support .htaccess
 		$webdata['new'] = $webdata['old'] = $website;
 		$this->update('web_domain_update', $webdata);
 	}
-	
+
 	//* Remove .htpasswd file, when folder protection is removed
-	function web_folder_delete($event_name,$data) {
+	function web_folder_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$folder_id = $data['old']['web_folder_id'];
-		
+
 		$folder = $data['old'];
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($folder['parent_domain_id']));
-		
+
 		if(!is_array($folder) or !is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($folder['path'],0,1) == '/') $folder['path'] = substr($folder['path'],1);
-		if(substr($folder['path'],-1) == '/') $folder['path'] = substr($folder['path'],0,-1);
+		if(substr($folder['path'], 0, 1) == '/') $folder['path'] = substr($folder['path'], 1);
+		if(substr($folder['path'], -1) == '/') $folder['path'] = substr($folder['path'], 0, -1);
 		$folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$folder['path']);
-		if(substr($folder_path,-1) != '/') $folder_path .= '/';
-		
+		if(substr($folder_path, -1) != '/') $folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Folder path is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Folder path is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Remove .htpasswd file
 		if(is_file($folder_path.'.htpasswd')) {
 			$app->system->unlink($folder_path.'.htpasswd');
-			$app->log('Removed file '.$folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+			$app->log('Removed file '.$folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 		}
-		
+
 		// write basic auth configuration to vhost file because nginx does not support .htaccess
 		$webdata['new'] = $webdata['old'] = $website;
 		$this->update('web_domain_update', $webdata);
 	}
-	
+
 	//* Update folder protection, when path has been changed
-	function web_folder_update($event_name,$data) {
+	function web_folder_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$website = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-	
+
 		if(!is_array($website)) {
-			$app->log('Not able to retrieve folder or website record.',LOGLEVEL_DEBUG);
+			$app->log('Not able to retrieve folder or website record.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
-        $web_folder = 'web';
-        if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
-        
+
+		$web_folder = 'web';
+		if($website['type'] == 'vhostsubdomain') $web_folder = $website['web_folder'];
+
 		//* Get the folder path.
-		if(substr($data['old']['path'],0,1) == '/') $data['old']['path'] = substr($data['old']['path'],1);
-		if(substr($data['old']['path'],-1) == '/') $data['old']['path'] = substr($data['old']['path'],0,-1);
+		if(substr($data['old']['path'], 0, 1) == '/') $data['old']['path'] = substr($data['old']['path'], 1);
+		if(substr($data['old']['path'], -1) == '/') $data['old']['path'] = substr($data['old']['path'], 0, -1);
 		$old_folder_path = realpath($website['document_root'].'/' . $web_folder . '/'.$data['old']['path']);
-		if(substr($old_folder_path,-1) != '/') $old_folder_path .= '/';
-			
-		if(substr($data['new']['path'],0,1) == '/') $data['new']['path'] = substr($data['new']['path'],1);
-		if(substr($data['new']['path'],-1) == '/') $data['new']['path'] = substr($data['new']['path'],0,-1);
+		if(substr($old_folder_path, -1) != '/') $old_folder_path .= '/';
+
+		if(substr($data['new']['path'], 0, 1) == '/') $data['new']['path'] = substr($data['new']['path'], 1);
+		if(substr($data['new']['path'], -1) == '/') $data['new']['path'] = substr($data['new']['path'], 0, -1);
 		$new_folder_path = escapeshellcmd($website['document_root'].'/' . $web_folder . '/'.$data['new']['path']);
-		if(substr($new_folder_path,-1) != '/') $new_folder_path .= '/';
-		
+		if(substr($new_folder_path, -1) != '/') $new_folder_path .= '/';
+
 		//* Check if the resulting path is inside the docroot
-		if(stristr($new_folder_path,'..') || stristr($new_folder_path,'./') || stristr($new_folder_path,'\\')) {
-			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($new_folder_path, '..') || stristr($new_folder_path, './') || stristr($new_folder_path, '\\')) {
+			$app->log('Folder path "'.$new_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(stristr($old_folder_path,'..') || stristr($old_folder_path,'./') || stristr($old_folder_path,'\\')) {
-			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.',LOGLEVEL_DEBUG);
+		if(stristr($old_folder_path, '..') || stristr($old_folder_path, './') || stristr($old_folder_path, '\\')) {
+			$app->log('Folder path "'.$old_folder_path.'" contains .. or ./.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		
+
 		//* Check if the resulting path is inside the docroot
-		if(substr($old_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($old_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('Old folder path '.$old_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-		if(substr($new_folder_path,0,strlen($website['document_root'])) != $website['document_root']) {
-			$app->log('New folder path '.$new_folder_path.' is outside of docroot.',LOGLEVEL_DEBUG);
+		if(substr($new_folder_path, 0, strlen($website['document_root'])) != $website['document_root']) {
+			$app->log('New folder path '.$new_folder_path.' is outside of docroot.', LOGLEVEL_DEBUG);
 			return false;
 		}
-			
+
 		//* Create the folder path, if it does not exist
 		if(!is_dir($new_folder_path)) $app->system->mkdirpath($new_folder_path);
-		
+
 		if($data['old']['path'] != $data['new']['path']) {
 
-		
+
 			//* move .htpasswd file
 			if(is_file($old_folder_path.'.htpasswd')) {
-				$app->system->rename($old_folder_path.'.htpasswd',$new_folder_path.'.htpasswd');
-				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd',LOGLEVEL_DEBUG);
+				$app->system->rename($old_folder_path.'.htpasswd', $new_folder_path.'.htpasswd');
+				$app->log('Moved file '.$old_folder_path.'.htpasswd to '.$new_folder_path.'.htpasswd', LOGLEVEL_DEBUG);
 			}
-		
+
 		}
 
 		// write basic auth configuration to vhost file because nginx does not support .htaccess
 		$webdata['new'] = $webdata['old'] = $website;
 		$this->update('web_domain_update', $webdata);
 	}
-	
+
 	function _create_web_folder_auth_configuration($website){
 		global $app, $conf;
 		//* Create the domain.auth file which is included in the vhost configuration file
@@ -2203,13 +2203,13 @@ class nginx_plugin {
 		$basic_auth_locations = array();
 		if(is_array($website_auth_locations) && !empty($website_auth_locations)){
 			foreach($website_auth_locations as $website_auth_location){
-				if(substr($website_auth_location['path'],0,1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'],1);
-				if(substr($website_auth_location['path'],-1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'],0,-1);
+				if(substr($website_auth_location['path'], 0, 1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 1);
+				if(substr($website_auth_location['path'], -1) == '/') $website_auth_location['path'] = substr($website_auth_location['path'], 0, -1);
 				if($website_auth_location['path'] != ''){
 					$website_auth_location['path'] .= '/';
 				}
 				$basic_auth_locations[] = array('htpasswd_location' => '/'.$website_auth_location['path'],
-												'htpasswd_path' => $website['document_root'].'/' . ($website['type'] == 'vhostsubdomain' ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']);
+					'htpasswd_path' => $website['document_root'].'/' . ($website['type'] == 'vhostsubdomain' ? $website['web_folder'] : 'web') . '/'.$website_auth_location['path']);
 			}
 		}
 		return $basic_auth_locations;
@@ -2219,53 +2219,53 @@ class nginx_plugin {
 		//unset($tpl);
 		//$app->services->restartServiceDelayed('httpd','reload');
 	}
-	
+
 	//* Update the awstats configuration file
-	private function awstats_update ($data,$web_config) {
+	private function awstats_update ($data, $web_config) {
 		global $app;
-		
-        $web_folder = $data['new']['web_folder'];
-        if($data['new']['type'] == 'vhost') $web_folder = 'web';
+
+		$web_folder = $data['new']['web_folder'];
+		if($data['new']['type'] == 'vhost') $web_folder = 'web';
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) mkdir($data['new']['document_root']."/" . $web_folder . "/stats");
 		if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
 			if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 				$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
 			}
-			
+
 			$content = '';
 			$content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
 			$content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
 			$content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
 			$content .= "HostAliases=\"www.".$data['new']['domain']."  localhost 127.0.0.1\"\n";
-			
-			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',$content);
-			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
+
+			$app->system->file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', $content);
+			$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
-		
+
 		if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
 		if(file_exists("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master")) {
-			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf-custom/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		} else {
-			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master",$data['new']['document_root']."/" . $web_folder . "/stats/index.php");
+			$app->system->copy("/usr/local/ispconfig/server/conf/awstats_index.php.master", $data['new']['document_root']."/" . $web_folder . "/stats/index.php");
 		}
 	}
-	
+
 	//* Delete the awstats configuration file
-	private function awstats_delete ($data,$web_config) {
+	private function awstats_delete ($data, $web_config) {
 		global $app;
-		
+
 		$awstats_conf_dir = $web_config['awstats_conf_dir'];
-		
+
 		if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
 			$app->system->unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
-			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG);
+			$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf', LOGLEVEL_DEBUG);
 		}
 	}
-	
+
 	//* Update the PHP-FPM pool configuration file
-	private function php_fpm_pool_update ($data,$web_config,$pool_dir,$pool_name,$socket_dir) {
+	private function php_fpm_pool_update ($data, $web_config, $pool_dir, $pool_name, $socket_dir) {
 		global $app, $conf;
 		/*
 		if(trim($data['new']['fastcgi_php_version']) != ''){
@@ -2280,7 +2280,7 @@ class nginx_plugin {
 			if(trim($data['new']['fastcgi_php_version']) != ''){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['new']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
@@ -2288,15 +2288,15 @@ class nginx_plugin {
 			if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
 				$default_php_fpm = false;
 				list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-				if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+				if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 			} else {
 				$default_php_fpm = true;
 			}
 		}
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		if($data['new']['php'] == 'no'){
 			if(@is_file($pool_dir.$pool_name.'.conf')){
 				$app->system->unlink($pool_dir.$pool_name.'.conf');
@@ -2304,14 +2304,14 @@ class nginx_plugin {
 			}
 			if($data['old']['php'] != 'no'){
 				if(!$default_php_fpm){
-					$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+					$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 				} else {
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+					$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 				}
 			}
 			return;
 		}
-				
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate('php_fpm_pool.conf.master');
@@ -2326,10 +2326,10 @@ class nginx_plugin {
 		}
 		$tpl->setVar('use_tcp', $use_tcp);
 		$tpl->setVar('use_socket', $use_socket);
-			
+
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
-			
+
 		$tpl->setVar('fpm_pool', $pool_name);
 		$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
 		$tpl->setVar('fpm_user', $data['new']['system_user']);
@@ -2342,7 +2342,7 @@ class nginx_plugin {
 		$tpl->setVar('pm_process_idle_timeout', $data['new']['pm_process_idle_timeout']);
 		$tpl->setVar('pm_max_requests', $data['new']['pm_max_requests']);
 		$tpl->setVar('document_root', $data['new']['document_root']);
-		$tpl->setVar('security_level',$web_config['security_level']);
+		$tpl->setVar('security_level', $web_config['security_level']);
 		$php_open_basedir = ($data['new']['php_open_basedir'] == '')?escapeshellcmd($data['new']['document_root']):escapeshellcmd($data['new']['php_open_basedir']);
 		$tpl->setVar('php_open_basedir', $php_open_basedir);
 		if($php_open_basedir != ''){
@@ -2350,7 +2350,7 @@ class nginx_plugin {
 		} else {
 			$tpl->setVar('enable_php_open_basedir', ';');
 		}
-			
+
 		// Custom php.ini settings
 		$final_php_ini_settings = array();
 		$custom_php_ini_settings = trim($data['new']['custom_php_ini']);
@@ -2362,59 +2362,59 @@ class nginx_plugin {
 			if(is_array($ini_settings) && !empty($ini_settings)){
 				foreach($ini_settings as $ini_setting){
 					$ini_setting = trim($ini_setting);
-					if(substr($ini_setting,0,1) == ';') continue;
-					if(substr($ini_setting,0,1) == '#') continue;
-					if(substr($ini_setting,0,2) == '//') continue;
+					if(substr($ini_setting, 0, 1) == ';') continue;
+					if(substr($ini_setting, 0, 1) == '#') continue;
+					if(substr($ini_setting, 0, 2) == '//') continue;
 					list($key, $value) = explode('=', $ini_setting);
 					if($value){
 						$value = trim($value);
 						$key = trim($key);
 						switch (strtolower($value)) {
-							case '0':
-								// PHP-FPM might complain about invalid boolean value if you use 0
-								$value = 'off';
-							case '1':
-							case 'on':
-							case 'off':
-							case 'true':
-							case 'false':
-							case 'yes':
-							case 'no':
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
-								break;
-							default:
-								$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
+						case '0':
+							// PHP-FPM might complain about invalid boolean value if you use 0
+							$value = 'off';
+						case '1':
+						case 'on':
+						case 'off':
+						case 'true':
+						case 'false':
+						case 'yes':
+						case 'no':
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_flag['.$key.'] = '.$value);
+							break;
+						default:
+							$final_php_ini_settings[] = array('ini_setting' => 'php_admin_value['.$key.'] = '.$value);
 						}
 					}
 				}
 			}
 		}
-			
+
 		$tpl->setLoop('custom_php_ini_settings', $final_php_ini_settings);
-			
-		$app->system->file_put_contents($pool_dir.$pool_name.'.conf',$tpl->grab());
-		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
+
+		$app->system->file_put_contents($pool_dir.$pool_name.'.conf', $tpl->grab());
+		$app->log('Writing the PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
 		unset($tpl);
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
 		}
 		$php_versions = $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 = ".$conf["server_id"]);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
@@ -2422,71 +2422,71 @@ class nginx_plugin {
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
 	}
-	
+
 	//* Delete the PHP-FPM pool configuration file
-	private function php_fpm_pool_delete ($data,$web_config) {
+	private function php_fpm_pool_delete ($data, $web_config) {
 		global $app, $conf;
-		
+
 		if(trim($data['old']['fastcgi_php_version']) != '' && $data['old']['php'] != 'no'){
 			$default_php_fpm = false;
 			list($custom_php_fpm_name, $custom_php_fpm_init_script, $custom_php_fpm_ini_dir, $custom_php_fpm_pool_dir) = explode(':', trim($data['old']['fastcgi_php_version']));
-			if(substr($custom_php_fpm_ini_dir,-1) != '/') $custom_php_fpm_ini_dir .= '/';
+			if(substr($custom_php_fpm_ini_dir, -1) != '/') $custom_php_fpm_ini_dir .= '/';
 		} else {
 			$default_php_fpm = true;
 		}
-		
+
 		if($default_php_fpm){
 			$pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
 		} else {
 			$pool_dir = $custom_php_fpm_pool_dir;
 		}
-		
-		if(substr($pool_dir,-1) != '/') $pool_dir .= '/';
+
+		if(substr($pool_dir, -1) != '/') $pool_dir .= '/';
 		$pool_name = 'web'.$data['old']['domain_id'];
-		
+
 		if ( @is_file($pool_dir.$pool_name.'.conf') ) {
 			$app->system->unlink($pool_dir.$pool_name.'.conf');
-			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
+			$app->log('Removed PHP-FPM config file: '.$pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
 		}
-		
+
 		// delete pool in all other PHP versions
 		$default_pool_dir = escapeshellcmd($web_config['php_fpm_pool_dir']);
-		if(substr($default_pool_dir,-1) != '/') $default_pool_dir .= '/';
+		if(substr($default_pool_dir, -1) != '/') $default_pool_dir .= '/';
 		if($default_pool_dir != $pool_dir){
 			if ( @is_file($default_pool_dir.$pool_name.'.conf') ) {
-					$app->system->unlink($default_pool_dir.$pool_name.'.conf');
-					$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf',LOGLEVEL_DEBUG);
-					$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+				$app->system->unlink($default_pool_dir.$pool_name.'.conf');
+				$app->log('Removed PHP-FPM config file: '.$default_pool_dir.$pool_name.'.conf', LOGLEVEL_DEBUG);
+				$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 			}
-		}	
+		}
 		$php_versions = $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 = ".$data['old']['server_id']);
 		if(is_array($php_versions) && !empty($php_versions)){
 			foreach($php_versions as $php_version){
-				if(substr($php_version['php_fpm_pool_dir'],-1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
+				if(substr($php_version['php_fpm_pool_dir'], -1) != '/') $php_version['php_fpm_pool_dir'] .= '/';
 				if($php_version['php_fpm_pool_dir'] != $pool_dir){
 					if ( @is_file($php_version['php_fpm_pool_dir'].$pool_name.'.conf') ) {
 						$app->system->unlink($php_version['php_fpm_pool_dir'].$pool_name.'.conf');
-						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf',LOGLEVEL_DEBUG);
-						$app->services->restartService('php-fpm','reload:'.$php_version['php_fpm_init_script']);
+						$app->log('Removed PHP-FPM config file: '.$php_version['php_fpm_pool_dir'].$pool_name.'.conf', LOGLEVEL_DEBUG);
+						$app->services->restartService('php-fpm', 'reload:'.$php_version['php_fpm_init_script']);
 					}
 				}
 			}
 		}
-		
+
 		// Reload current PHP-FPM after all others
 		sleep(1);
 		if(!$default_php_fpm){
-			$app->services->restartService('php-fpm','reload:'.$custom_php_fpm_init_script);
+			$app->services->restartService('php-fpm', 'reload:'.$custom_php_fpm_init_script);
 		} else {
-			$app->services->restartService('php-fpm','reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
+			$app->services->restartService('php-fpm', 'reload:'.$conf['init_scripts'].'/'.$web_config['php_fpm_init_script']);
 		}
 	}
-	
+
 	private function nginx_replace($matches){
 		$location = 'location'.($matches[1] != '' ? ' '.$matches[1] : '').' '.$matches[2].' '.$matches[3];
 		if($matches[4] == '##merge##' || $matches[7] == '##merge##') $location .= ' ##merge##';
@@ -2496,21 +2496,21 @@ class nginx_plugin {
 		$location .= $matches[6];
 		return $location;
 	}
-	
+
 	private function nginx_merge_locations($vhost_conf){
 
 		$lines = explode("\n", $vhost_conf);
-		
+
 		// if whole location block is in one line, split it up into multiple lines
 		if(is_array($lines) && !empty($lines)){
 			$linecount = sizeof($lines);
 			for($h=0;$h<$linecount;$h++){
 				// remove comments
-				if(substr(trim($lines[$h]),0,1) == '#'){
+				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){
@@ -2530,16 +2530,16 @@ class nginx_plugin {
 				}
 				*/
 				$pattern = '/^[^\S\n]*location[^\S\n]+(?:(.+)[^\S\n]+)?(.+)[^\S\n]*(\{)[^\S\n]*(##merge##|##delete##)?[^\S\n]*(.+)[^\S\n]*(\})[^\S\n]*(##merge##|##delete##)?[^\S\n]*$/';
-				$lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') ,$lines[$h]);
+				$lines[$h] = preg_replace_callback($pattern, array($this, 'nginx_replace') , $lines[$h]);
 			}
 		}
 		$vhost_conf = implode("\n", $lines);
 		unset($lines);
 		unset($linecount);
-		
+
 		$lines = explode("\n", $vhost_conf);
-			
-		if(is_array($lines) && !empty($lines)){	
+
+		if(is_array($lines) && !empty($lines)){
 			$locations = array();
 			$locations_to_delete = array();
 			$islocation = false;
@@ -2551,13 +2551,13 @@ class nginx_plugin {
 				if(substr($l, 0, 8) == 'server {') $server_count += 1;
 				if($server_count > 1) break;
 				if(substr($l, 0, 8) == 'location' && !$islocation){
-				
+
 					$islocation = true;
 					$level = 0;
-					
+
 					// Remove unnecessary whitespace
 					$l = preg_replace('/\s\s+/', ' ', $l);
-					
+
 					$loc_parts = explode(' ', $l);
 					// see http://wiki.nginx.org/HttpCoreModule#location
 					if($loc_parts[1] == '=' || $loc_parts[1] == '~' || $loc_parts[1] == '~*' || $loc_parts[1] == '^~'){
@@ -2566,11 +2566,11 @@ class nginx_plugin {
 						$location = $loc_parts[1];
 					}
 					unset($loc_parts);
-					
+
 					if(!isset($locations[$location]['action'])) $locations[$location]['action'] = 'replace';
 					if(substr($l, -9) == '##merge##') $locations[$location]['action'] = 'merge';
 					if(substr($l, -10) == '##delete##') $locations[$location]['action'] = 'delete';
-					
+
 					if(!isset($locations[$location]['open_tag'])) $locations[$location]['open_tag'] = '        location '.$location.' {';
 					if(!isset($locations[$location]['location']) || $locations[$location]['action'] == 'replace') $locations[$location]['location'] = '';
 					if($locations[$location]['action'] == 'delete') $locations_to_delete[] = $location;
@@ -2578,9 +2578,9 @@ class nginx_plugin {
 					if(!isset($locations[$location]['start_line'])) $locations[$location]['start_line'] = $i;
 
 					unset($lines[$i]);
-					
+
 				} else {
-				
+
 					if($islocation){
 						if(strpos($l, '{') !== false){
 							$level += 1;
@@ -2595,17 +2595,17 @@ class nginx_plugin {
 						}
 						unset($lines[$i]);
 					}
-					
+
 				}
 			}
-			
+
 			if(is_array($locations) && !empty($locations)){
 				if(is_array($locations_to_delete) && !empty($locations_to_delete)){
 					foreach($locations_to_delete as $location_to_delete){
 						if(isset($locations[$location_to_delete])) unset($locations[$location_to_delete]);
 					}
 				}
-			
+
 				foreach($locations as $key => $val){
 					$new_location = $val['open_tag']."\n".$val['location'].$val['end_tag'];
 					$lines[$val['start_line']] = $new_location;
@@ -2614,54 +2614,54 @@ class nginx_plugin {
 			ksort($lines);
 			$vhost_conf = implode("\n", $lines);
 		}
-		
+
 		return trim($vhost_conf);
 	}
-	
-	function client_delete($event_name,$data) {
+
+	function client_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		$client_id = intval($data['old']['client_id']);
 		if($client_id > 0) {
-			
+
 			$client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
-			if(is_dir($client_dir) && !stristr($client_dir,'..')) {
+			if(is_dir($client_dir) && !stristr($client_dir, '..')) {
 				// remove symlinks from $client_dir
-				$files = array_diff(scandir($client_dir), array('.','..'));
+				$files = array_diff(scandir($client_dir), array('.', '..'));
 				if(is_array($files) && !empty($files)){
 					foreach($files as $file){
 						if(is_link($client_dir.'/'.$file)){
 							unlink($client_dir.'/'.$file);
-							$app->log('Removed symlink: '.$client_dir.'/'.$file,LOGLEVEL_DEBUG);
+							$app->log('Removed symlink: '.$client_dir.'/'.$file, LOGLEVEL_DEBUG);
 						}
 					}
 				}
-				
+
 				@rmdir($client_dir);
-				$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
+				$app->log('Removed client directory: '.$client_dir, 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);
+				$app->log('Removed group client'.$client_id, LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 	}
 
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-	
-	private function _checkTcp ($host,$port) {
 
-		$fp = @fsockopen ($host, $port, $errno, $errstr, 2);
+	private function _checkTcp ($host, $port) {
+
+		$fp = @fsockopen($host, $port, $errno, $errstr, 2);
 
 		if ($fp) {
 			fclose($fp);
@@ -2670,7 +2670,7 @@ class nginx_plugin {
 			return false;
 		}
 	}
-	
+
 	public function create_relative_link($f, $t) {
 		global $app;
 		// $from already exists
@@ -2697,11 +2697,11 @@ class nginx_plugin {
 
 		return symlink($cfrom, $to);
 	}
-    
-    private function _rewrite_quote($string) {
-        return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
-    }
-	
+
+	private function _rewrite_quote($string) {
+		return str_replace(array('.', '*', '?', '+'), array('\\.', '\\*', '\\?', '\\+'), $string);
+	}
+
 	private function url_is_local($hostname, $domain_id){
 		global $app;
 
@@ -2710,12 +2710,12 @@ class nginx_plugin {
 		if(is_array($webs) && !empty($webs)){
 			foreach($webs as $web){
 				// web domain doesn't match hostname
-				if(substr($hostname,-strlen($web['domain'])) != $web['domain']) continue;
+				if(substr($hostname, -strlen($web['domain'])) != $web['domain']) continue;
 				// own vhost and therefore server {} container of its own
 				//if($web['type'] == 'vhostsubdomain') continue;
 				// alias domains/subdomains using rewrites and therefore a server {} container of their own
 				//if(($web['type'] == 'alias' || $web['type'] == 'subdomain') && $web['redirect_type'] != '' && $web['redirect_path'] != '') continue;
-				
+
 				if($web['subdomain'] == '*'){
 					$pattern = '/\.?'.str_replace('.', '\.', $web['domain']).'$/i';
 				}
@@ -2760,16 +2760,16 @@ class nginx_plugin {
 				}
 			}
 		}
-		
+
 		return false;
 	}
-	
+
 	private function get_seo_redirects($web, $prefix = '', $force_subdomain = false){
 		// $force_subdomain = 'none|www'
 		$seo_redirects = array();
-		
+
 		if(substr($web['domain'], 0, 2) === '*.') $web['subdomain'] = '*';
-		
+
 		if(($web['subdomain'] == 'www' || $web['subdomain'] == '*') && $force_subdomain != 'www'){
 			if($web['seo_redirect'] == 'non_www_to_www'){
 				$seo_redirects[$prefix.'seo_redirect_origin_domain'] = $web['domain'];
diff --git a/server/plugins-available/nginx_reverseproxy_plugin.inc.php b/server/plugins-available/nginx_reverseproxy_plugin.inc.php
index ae4ffe9b954b92a72ae8ee65127b346cbd79c6e6..a17c5ba227ee02da923e4281d95b444cabdf7aaa 100644
--- a/server/plugins-available/nginx_reverseproxy_plugin.inc.php
+++ b/server/plugins-available/nginx_reverseproxy_plugin.inc.php
@@ -32,33 +32,33 @@ class nginx_reverseproxy_plugin {
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'ssl');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'ssl');
 
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
-		
-	//	$app->plugins->registerEvent('proxy_reverse_insert',$this->plugin_name,'rewrite_insert');
-	//	$app->plugins->registerEvent('proxy_reverse_update',$this->plugin_name,'rewrite_update');
-	//	$app->plugins->registerEvent('proxy_reverse_delete',$this->plugin_name,'rewrite_delete');
-	
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'ssl');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'ssl');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+		// $app->plugins->registerEvent('proxy_reverse_insert',$this->plugin_name,'rewrite_insert');
+		// $app->plugins->registerEvent('proxy_reverse_update',$this->plugin_name,'rewrite_update');
+		// $app->plugins->registerEvent('proxy_reverse_delete',$this->plugin_name,'rewrite_delete');
+
 
 
 	}
-	
-	
-	function insert($event_name,$data) {
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-	
+
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
 
 		if($this->action != 'insert') $this->action = 'update';
@@ -74,7 +74,7 @@ class nginx_reverseproxy_plugin {
 				$data['new'] = $tmp;
 				$data['old'] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
 
 			// This is not a vhost, so we need to update the parent record instead.
@@ -83,10 +83,10 @@ class nginx_reverseproxy_plugin {
 			$data['old'] = $tmp;
 			$this->action = 'update';
 		}
-		
-		
-		
-		
+
+
+
+
 		// load the server configuration options
 		$app->uses('getconf');
 		$nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web');
@@ -102,7 +102,7 @@ class nginx_reverseproxy_plugin {
 
 		$vhost_data = $data['new'];
 		$vhost_data['config_dir'] = $config['nginx']['config_dir'];
-	
+
 		$vhost_data['ssl_domain'] = $data['new']['ssl_domain'];
 		// Check if a SSL cert exists
 		$ssl_dir = $config['nginx']['config_dir'].'/ssl';
@@ -111,15 +111,15 @@ class nginx_reverseproxy_plugin {
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 		$bundle_file = $ssl_dir.'/'.$domain.'.bundle';
 
-        $vhost_data['nginx_directives'] = preg_replace("/\[IP\]/", $vhost_data['ip_address'], $vhost_data['nginx_directives']);
+		$vhost_data['nginx_directives'] = preg_replace("/\[IP\]/", $vhost_data['ip_address'], $vhost_data['nginx_directives']);
 
 
 		if($data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file)) {
 			$vhost_data['ssl_enabled'] = 1;
-			$app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Enable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		} else {
 			$vhost_data['ssl_enabled'] = 0;
-			$app->log('Disable SSL for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Disable SSL for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		if(@is_file($bundle_file)) $vhost_data['has_bundle_cert'] = 1;
@@ -127,34 +127,34 @@ class nginx_reverseproxy_plugin {
 
 		$tpl->setVar($vhost_data);
 
-		
+
 
 		// get alias domains (co-domains and subdomains)
 		$aliases = $app->dbmaster->queryAllRecords('SELECT * FROM web_domain WHERE parent_domain_id = '.$data['new']['domain_id']." AND type != 'vhostsubdomain' AND active = 'y'");
 		$server_alias = array();
 		switch($data['new']['subdomain']) {
-			case 'www':
-				$server_alias[] .= 'www.'.$data['new']['domain'].' ';
-				break;
-			case '*':
-				$server_alias[] .= '*.'.$data['new']['domain'].' ';
-				break;
+		case 'www':
+			$server_alias[] .= 'www.'.$data['new']['domain'].' ';
+			break;
+		case '*':
+			$server_alias[] .= '*.'.$data['new']['domain'].' ';
+			break;
 		}
 		if(is_array($aliases)) {
 			foreach($aliases as $alias) {
 				switch($alias['subdomain']) {
-					case 'www':
-						$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					case '*':
-						$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
-						break;
-					default:
-						$server_alias[] .= $alias['domain'].' ';
-						break;
+				case 'www':
+					$server_alias[] .= 'www.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				case '*':
+					$server_alias[] .= '*.'.$alias['domain'].' '.$alias['domain'].' ';
+					break;
+				default:
+					$server_alias[] .= $alias['domain'].' ';
+					break;
 				}
-				$app->log('Add server alias: '.$alias['domain'],LOGLEVEL_DEBUG);
-				
+				$app->log('Add server alias: '.$alias['domain'], LOGLEVEL_DEBUG);
+
 			}
 		}
 
@@ -170,66 +170,66 @@ class nginx_reverseproxy_plugin {
 			}
 			unset($tmp_alias);
 
-			$tpl->setVar('alias',trim($server_alias_str));
+			$tpl->setVar('alias', trim($server_alias_str));
 		} else {
-			$tpl->setVar('alias','');
+			$tpl->setVar('alias', '');
 		}
-		
+
 
 		$vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['new']['domain'].'.vhost');
 		//* Make a backup copy of vhost file
-		copy($vhost_file,$vhost_file.'~');
-		
+		copy($vhost_file, $vhost_file.'~');
+
 		//* Write vhost file
-		file_put_contents($vhost_file,$tpl->grab());
-		$app->log('Writing the vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
+		file_put_contents($vhost_file, $tpl->grab());
+		$app->log('Writing the vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 
 		// Set the symlink to enable the vhost
 		$vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['new']['domain'].'.vhost');
 		if($data['new']['active'] == 'y' && !is_link($vhost_symlink)) {
-			symlink($vhost_file,$vhost_symlink);
-			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			symlink($vhost_file, $vhost_symlink);
+			$app->log('Creating symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
 
 		// Remove the symlink, if site is inactive
 		if($data['new']['active'] == 'n' && is_link($vhost_symlink)) {
 			unlink($vhost_symlink);
-			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 		}
-		
+
 		if(!is_dir('/var/log/ispconfig/nginx/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/nginx/'.$data['new']['domain']);
 
 		// remove old symlink and vhost file, if domain name of the site has changed
 		if($this->action == 'update' && $data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain']) {
 			$vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_symlink);
-			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 			$vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_file);
-			$app->log('Removing file: '.$vhost_file,LOGLEVEL_DEBUG);
-			
+			$app->log('Removing file: '.$vhost_file, LOGLEVEL_DEBUG);
+
 			if(is_dir('/var/log/ispconfig/nginx/'.$data['old']['domain'])) exec('rm -rf /var/log/ispconfig/nginx/'.$data['old']['domain']);
 		}
-		
+
 		// request a httpd reload when all records have been processed
-		$app->services->restartServiceDelayed('nginx','restart');
-			
+		$app->services->restartServiceDelayed('nginx', 'restart');
+
 		// Remove the backup copy of the config file.
 		if(@is_file($vhost_file.'~')) unlink($vhost_file.'~');
-		
+
 
 		//* Unset action to clean it for next processed vhost.
 		$this->action = '';
 
 	}
-	
-	
-	
+
+
+
 
 	// Handle the creation of SSL certificates
-	function ssl($event_name,$data) {
+	function ssl($event_name, $data) {
 		global $app, $conf;
 
 		if(!is_dir($conf['nginx']['config_dir'].'/ssl')) exec('mkdir -p '.$conf['nginx']['config_dir'].'/ssl');
@@ -240,19 +240,19 @@ class nginx_reverseproxy_plugin {
 		$csr_file = $ssl_dir.'/'.$domain.'.csr';
 		$crt_file = $ssl_dir.'/'.$domain.'.crt';
 
-		
+
 		//* Save a SSL certificate to disk
 		if($data["new"]["ssl_action"] == 'save') {
 			$web = $app->masterdb->queryOneRecord("select wd.document_root, sp.ip_address from web_domain wd INNER JOIN server_ip sp USING(server_id) WHERE domain = '".$data['new']['domain']."'");
-			
+
 			$src_ssl_dir = $web["document_root"]."/ssl";
 			//$domain = $data["new"]["ssl_domain"];
 			//$csr_file = $ssl_dir.'/'.$domain.".csr";
 			//$crt_file = $ssl_dir.'/'.$domain.".crt";
 			//$bundle_file = $ssl_dir.'/'.$domain.".bundle";
 			$this->_exec('rsync -v -e ssh root@'.$web['ip_address'].':~/$src_ssl_dir '.$ssl_dir);
-			
-			$app->log('Syncing SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+
+			$app->log('Syncing SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 		//* Delete a SSL certificate
@@ -265,14 +265,14 @@ class nginx_reverseproxy_plugin {
 			unlink($csr_file);
 			unlink($crt_file);
 			unlink($bundle_file);
-			$app->log('Deleting SSL Cert for: '.$domain,LOGLEVEL_DEBUG);
+			$app->log('Deleting SSL Cert for: '.$domain, LOGLEVEL_DEBUG);
 		}
 
 
 	}
 
 
-	function delete($event_name,$data) {
+	function delete($event_name, $data) {
 		global $app, $conf;
 
 		// load the server configuration options
@@ -286,80 +286,80 @@ class nginx_reverseproxy_plugin {
 			// Deleting the vhost file, symlink and the data directory
 			$vhost_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_symlink);
-			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file,LOGLEVEL_DEBUG);
+			$app->log('Removing symlink: '.$vhost_symlink.'->'.$vhost_file, LOGLEVEL_DEBUG);
 
 			$vhost_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/'.$data['old']['domain'].'.vhost');
 			unlink($vhost_file);
-			$app->log('Removing vhost file: '.$vhost_file,LOGLEVEL_DEBUG);
-			
-			
+			$app->log('Removing vhost file: '.$vhost_file, LOGLEVEL_DEBUG);
+
+
 
 			// Delete the log file directory
 			$vhost_logfile_dir = escapeshellcmd('/var/log/ispconfig/nginx/'.$data['old']['domain']);
-			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir,'..')) exec('rm -rf '.$vhost_logfile_dir);
-			$app->log('Removing website logfile directory: '.$vhost_logfile_dir,LOGLEVEL_DEBUG);
+			if($data['old']['domain'] != '' && !stristr($vhost_logfile_dir, '..')) exec('rm -rf '.$vhost_logfile_dir);
+			$app->log('Removing website logfile directory: '.$vhost_logfile_dir, LOGLEVEL_DEBUG);
 
 		}
 	}
-	
+
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
-	
-	function rewrite_insert($event_name,$data) {
+
+	function rewrite_insert($event_name, $data) {
 		global $app, $conf;
 
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	function rewrite_update($event_name,$data) {
+
+	function rewrite_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$rules = $this->_getRewriteRules($app);
-		
+
 		$app->uses('getconf');
 		$nginx_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-		
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate("nginx_reverseproxy_rewrites.conf.master");
-		if (!empty($rules))$tpl->setLoop('nginx_rewrite_rules',$rules);
-		
+		if (!empty($rules))$tpl->setLoop('nginx_rewrite_rules', $rules);
+
 		$rewrites_file = escapeshellcmd($nginx_config['nginx_vhost_conf_dir'].'/default.rewrites.conf');
 		//* Make a backup copy of vhost file
-		copy($rewrites_file,$rewrites_file.'~');
-		
+		copy($rewrites_file, $rewrites_file.'~');
+
 		//* Write vhost file
-		file_put_contents($rewrites_file,$tpl->grab());
-		$app->log('Writing the nginx rewrites file: '.$rewrites_file,LOGLEVEL_DEBUG);
+		file_put_contents($rewrites_file, $tpl->grab());
+		$app->log('Writing the nginx rewrites file: '.$rewrites_file, LOGLEVEL_DEBUG);
 		unset($tpl);
 
 
 		// Set the symlink to enable the vhost
 		$rewrite_symlink = escapeshellcmd($nginx_config['nginx_vhost_conf_enabled_dir'].'/default.rewrites.conf');
-		
+
 		if(!is_link($rewrite_symlink)) {
-			symlink($rewrites_file,$rewrite_symlink);
-			$app->log('Creating symlink for nginx rewrites: '.$rewrite_symlink.'->'.$rewrites_file,LOGLEVEL_DEBUG);
-		}	
+			symlink($rewrites_file, $rewrite_symlink);
+			$app->log('Creating symlink for nginx rewrites: '.$rewrite_symlink.'->'.$rewrites_file, LOGLEVEL_DEBUG);
+		}
 	}
-	
-	function rewrite_delete($event_name,$data) {
+
+	function rewrite_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// just run the update function
-		$this->rewrite_update($event_name,$data);	
+		$this->rewrite_update($event_name, $data);
 	}
-	
+
 
 	function _getRewriteRules($app)
 	{
 		$rules = array();
-		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dst FROM proxy_reverse ORDER BY rewrite_id ASC");		
+		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dst FROM proxy_reverse ORDER BY rewrite_id ASC");
 		return $rules;
 	}
 
diff --git a/server/plugins-available/openvz_plugin.inc.php b/server/plugins-available/openvz_plugin.inc.php
index 9e0d75d3fb00ab20a07b69d2430306f16a240195..a50c3def49e81d3df6e6d8d8cbaf32f9966aecf3 100644
--- a/server/plugins-available/openvz_plugin.inc.php
+++ b/server/plugins-available/openvz_plugin.inc.php
@@ -29,142 +29,142 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class openvz_plugin {
-	
+
 	var $plugin_name = 'openvz_plugin';
 	var $class_name  = 'openvz_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		//* this is only true on openvz host servers, not in openvz guests
 		if(@file_exists('/proc/vz/version')) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* Virtual machine
-		$app->plugins->registerEvent('openvz_vm_insert',$this->plugin_name,'vm_insert');
-		$app->plugins->registerEvent('openvz_vm_update',$this->plugin_name,'vm_update');
-		$app->plugins->registerEvent('openvz_vm_delete',$this->plugin_name,'vm_delete');
-		
+		$app->plugins->registerEvent('openvz_vm_insert', $this->plugin_name, 'vm_insert');
+		$app->plugins->registerEvent('openvz_vm_update', $this->plugin_name, 'vm_update');
+		$app->plugins->registerEvent('openvz_vm_delete', $this->plugin_name, 'vm_delete');
+
 		//* Register for actions
-		$app->plugins->registerAction('openvz_start_vm',$this->plugin_name,'actions');
-		$app->plugins->registerAction('openvz_stop_vm',$this->plugin_name,'actions');
-		$app->plugins->registerAction('openvz_restart_vm',$this->plugin_name,'actions');
-		$app->plugins->registerAction('openvz_create_ostpl',$this->plugin_name,'actions');
-		
-		
-		
+		$app->plugins->registerAction('openvz_start_vm', $this->plugin_name, 'actions');
+		$app->plugins->registerAction('openvz_stop_vm', $this->plugin_name, 'actions');
+		$app->plugins->registerAction('openvz_restart_vm', $this->plugin_name, 'actions');
+		$app->plugins->registerAction('openvz_create_ostpl', $this->plugin_name, 'actions');
+
+
+
 	}
-	
-	
-	function vm_insert($event_name,$data) {
+
+
+	function vm_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$veid = intval($data['new']['veid']);
-		
+
 		if($veid == 0) {
-			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			$app->log("VEID = 0, we stop here.", LOGLEVEL_WARN);
 			return;
 		}
-		
+
 		$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$data['new']['ostemplate_id']);
 		$ostemplate = escapeshellcmd($tmp['template_file']);
 		unset($tmp);
-		
+
 		//* Create the virtual machine
 		exec("vzctl create $veid --ostemplate $ostemplate");
-		$app->log("Create OpenVZ VM: vzctl create $veid --ostemplate $ostemplate",LOGLEVEL_DEBUG);
-		
+		$app->log("Create OpenVZ VM: vzctl create $veid --ostemplate $ostemplate", LOGLEVEL_DEBUG);
+
 		//* Write the configuration of the VM
-		file_put_contents('/etc/vz/conf/'.$veid.'.conf',$data['new']['config']);
-		
+		file_put_contents('/etc/vz/conf/'.$veid.'.conf', $data['new']['config']);
+
 		//* Start the VM
 		if($data['new']['active'] == 'y') {
 			exec("vzctl start $veid");
-			$app->log("Starting OpenVZ VM: vzctl start $veid",LOGLEVEL_DEBUG);
+			$app->log("Starting OpenVZ VM: vzctl start $veid", LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Set the root password in the virtual machine
 		exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password']));
-		
+
 	}
-	
-	function vm_update($event_name,$data) {
+
+	function vm_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$veid = intval($data['new']['veid']);
-		
+
 		if($veid == 0) {
-			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			$app->log("VEID = 0, we stop here.", LOGLEVEL_WARN);
 			return;
 		}
-		
+
 		//* Write the configuration of the VM
-		file_put_contents('/etc/vz/conf/'.$veid.'.conf',$data['new']['config']);
-		$app->log("Writing new configuration for $veid",LOGLEVEL_DEBUG);
-		
+		file_put_contents('/etc/vz/conf/'.$veid.'.conf', $data['new']['config']);
+		$app->log("Writing new configuration for $veid", LOGLEVEL_DEBUG);
+
 		//* Apply config changes to the VM
 		if($data['new']['active'] == 'y' && $data['old']['active'] == 'y') {
 			exec("vzctl restart $veid");
-			$app->log("Restarting OpenVZ VM: vzctl restart $veid",LOGLEVEL_DEBUG);
+			$app->log("Restarting OpenVZ VM: vzctl restart $veid", LOGLEVEL_DEBUG);
 		} elseif ($data['new']['active'] == 'y' && $data['old']['active'] == 'n') {
 			exec("vzctl start $veid");
-			$app->log("Starting OpenVZ VM: vzctl start $veid",LOGLEVEL_DEBUG);
+			$app->log("Starting OpenVZ VM: vzctl start $veid", LOGLEVEL_DEBUG);
 		} elseif ($data['new']['active'] == 'n' && $data['old']['active'] == 'y') {
 			exec("vzctl stop $veid");
-			$app->log("Stopping OpenVZ VM: vzctl stop $veid",LOGLEVEL_DEBUG);
+			$app->log("Stopping OpenVZ VM: vzctl stop $veid", LOGLEVEL_DEBUG);
 		}
-		
+
 		//* Set the root password in the virtual machine
 		if($data['new']['vm_password'] != $data['old']['vm_password']) {
 			exec("vzctl set $veid --userpasswd root:".escapeshellcmd($data['new']['vm_password']));
 		}
-		
-		
+
+
 	}
-	
-	function vm_delete($event_name,$data) {
+
+	function vm_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$veid = intval($data['old']['veid']);
-		
+
 		if($veid == 0) {
-			$app->log("VEID = 0, we stop here.",LOGLEVEL_WARN);
+			$app->log("VEID = 0, we stop here.", LOGLEVEL_WARN);
 			return;
 		}
-		
+
 		exec("vzctl stop $veid");
 		exec("vzctl destroy $veid");
-		$app->log("Destroying OpenVZ VM: vzctl destroy $veid",LOGLEVEL_DEBUG);
-			
+		$app->log("Destroying OpenVZ VM: vzctl destroy $veid", LOGLEVEL_DEBUG);
+
 	}
-	
-	function actions($action_name,$data) {
+
+	function actions($action_name, $data) {
 		global $app, $conf;
-		
+
 		if ($action_name == 'openvz_start_vm') {
 			$veid = intval($data);
 			if($veid > 0) {
 				exec("vzctl start $veid");
-				$app->log("Start VM: vzctl start $veid",LOGLEVEL_DEBUG);
+				$app->log("Start VM: vzctl start $veid", LOGLEVEL_DEBUG);
 			}
 			return 'ok';
 		}
@@ -172,7 +172,7 @@ class openvz_plugin {
 			$veid = intval($data);
 			if($veid > 0) {
 				exec("vzctl stop $veid");
-				$app->log("Stop VM: vzctl stop $veid",LOGLEVEL_DEBUG);
+				$app->log("Stop VM: vzctl stop $veid", LOGLEVEL_DEBUG);
 			}
 			return 'ok';
 		}
@@ -180,12 +180,12 @@ class openvz_plugin {
 			$veid = intval($data);
 			if($veid > 0) {
 				exec("vzctl restart $veid");
-				$app->log("Restart VM: vzctl restart $veid",LOGLEVEL_DEBUG);
+				$app->log("Restart VM: vzctl restart $veid", LOGLEVEL_DEBUG);
 			}
 			return 'ok';
 		}
 		if ($action_name == 'openvz_create_ostpl') {
-			$parts = explode(':',$data);
+			$parts = explode(':', $data);
 			$veid = intval($parts[0]);
 			$template_cache_dir = '/vz/template/cache/';
 			$template_name = escapeshellcmd($parts[1]);
@@ -195,12 +195,12 @@ class openvz_plugin {
 				exec("mv ".$template_cache_dir."vzdump-openvz-".$veid."*.tgz ".$template_cache_dir.$template_name.".tar.gz");
 				exec("rm -f ".$template_cache_dir."vzdump-openvz-".$veid."*.log");
 			}
-			$app->log("Created OpenVZ OStemplate $template_name from VM $veid",LOGLEVEL_DEBUG);
+			$app->log("Created OpenVZ OStemplate $template_name from VM $veid", LOGLEVEL_DEBUG);
 			return 'ok';
 		}
-			
+
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/pma_symlink_plugin.inc.php b/server/plugins-available/pma_symlink_plugin.inc.php
index e2cb3a3914b5cf23882caadc2edb8a66f15b9dd7..db9b6f7f62613b781b67a96ef6d48cf1edc4e218 100644
--- a/server/plugins-available/pma_symlink_plugin.inc.php
+++ b/server/plugins-available/pma_symlink_plugin.inc.php
@@ -3,7 +3,7 @@
 /*
 Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
 All rights reserved.
-Modification (c) 2009, Marius Cramer, pixcept KG 
+Modification (c) 2009, Marius Cramer, pixcept KG
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -30,91 +30,91 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class pma_symlink_plugin {
-	
+
 	var $plugin_name = 'pma_symlink_plugin';
 	var $class_name = 'pma_symlink_plugin';
-	
-    var $action;
-    
+
+	var $action;
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
-			return false;
-		
+
+		return false;
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($this->action != 'insert') $this->action = 'update';
-		
+
 		if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) {
-			
+
 			$old_parent_domain_id = intval($data["old"]["parent_domain_id"]);
 			$new_parent_domain_id = intval($data["new"]["parent_domain_id"]);
-			
+
 			// If the parent_domain_id has been chenged, we will have to update the old site as well.
 			if($this->action == 'update' && $data["new"]["parent_domain_id"] != $data["old"]["parent_domain_id"]) {
 				$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$old_parent_domain_id." AND active = 'y'");
 				$data["new"] = $tmp;
 				$data["old"] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
-			
+
 			// This is not a vhost, so we need to update the parent record instead.
 			$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$new_parent_domain_id." AND active = 'y'");
 			$data["new"] = $tmp;
 			$data["old"] = $tmp;
 			$this->action = 'update';
 		}
-		
+
 		if($data["new"]["document_root"] == '') {
-			$app->log("document_root not set",LOGLEVEL_WARN);
+			$app->log("document_root not set", LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $symlink = true;
-        if($data["new"]["php"] == "suphp") $symlink = false;
-        elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        
-        
-        if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
-        if($symlink == false) {
-            if(is_link($data["new"]["document_root"].'/web/phpmyadmin')) unlink($data["new"]["document_root"].'/web/phpmyadmin');
-        } else {
-            if(!is_link($data["new"]["document_root"].'/web/phpmyadmin')) symlink('/var/www/phpmyadmin',$data["new"]["document_root"].'/web/phpmyadmin');
-            else symlink('/var/www/phpmyadmin',$data["new"]["document_root"].'/web/phpmyadmin');
-        }
+
+		$symlink = true;
+		if($data["new"]["php"] == "suphp") $symlink = false;
+		elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+		elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+
+
+		if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
+		if($symlink == false) {
+			if(is_link($data["new"]["document_root"].'/web/phpmyadmin')) unlink($data["new"]["document_root"].'/web/phpmyadmin');
+		} else {
+			if(!is_link($data["new"]["document_root"].'/web/phpmyadmin')) symlink('/var/www/phpmyadmin', $data["new"]["document_root"].'/web/phpmyadmin');
+			else symlink('/var/www/phpmyadmin', $data["new"]["document_root"].'/web/phpmyadmin');
+		}
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/postfix_filter_plugin.inc.php b/server/plugins-available/postfix_filter_plugin.inc.php
index db647d70a39669f8a82ff7bb2c3d347819b27bad..867df253a5f0e8117323e37e3a3215608f3f87cf 100644
--- a/server/plugins-available/postfix_filter_plugin.inc.php
+++ b/server/plugins-available/postfix_filter_plugin.inc.php
@@ -29,55 +29,55 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class postfix_filter_plugin {
-	
+
 	var $plugin_name = 'postfix_filter_plugin';
 	var $class_name = 'postfix_filter_plugin';
-	
-	
+
+
 	var $postfix_config_dir = '/etc/postfix';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('mail_content_filter_insert','postfix_filter_plugin','insert');
-		$app->plugins->registerEvent('mail_content_filter_update','postfix_filter_plugin','update');
-		$app->plugins->registerEvent('mail_content_filter_delete','postfix_filter_plugin','delete');
-		
-		
-		
+
+		$app->plugins->registerEvent('mail_content_filter_insert', 'postfix_filter_plugin', 'insert');
+		$app->plugins->registerEvent('mail_content_filter_update', 'postfix_filter_plugin', 'update');
+		$app->plugins->registerEvent('mail_content_filter_delete', 'postfix_filter_plugin', 'delete');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$type = $data["new"]["type"];
 		if($type != '') {
 			$sql = "SELECT * FROM mail_content_filter WHERE server_id = ".intval($conf["server_id"])." AND type = '".$app->db->quote($type)."' AND active = 'y'";
@@ -87,28 +87,28 @@ class postfix_filter_plugin {
 				$content .= $rule["pattern"];
 				$content .= "  ".$rule["action"]." ".$rule["data"]."\n";
 			}
-		
+
 			if($type == 'header') {
-				file_put_contents('/etc/postfix/header_checks',$content);
-				$app->log("Writing /etc/postfix/header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/header_checks', $content);
+				$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'mime_header') {
-				file_put_contents('/etc/postfix/mime_header_checks',$content);
-				$app->log("Writing /etc/postfix/mime_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/mime_header_checks', $content);
+				$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'nested_header') {
-				file_put_contents('/etc/postfix/nested_header_checks',$content);
-				$app->log("Writing /etc/postfix/nested_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/nested_header_checks', $content);
+				$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'body') {
-				file_put_contents('/etc/postfix/body_checks',$content);
-				$app->log("Writing /etc/postfix/body_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/body_checks', $content);
+				$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
 			}
 		}
-		
+
 		$type = $data["old"]["type"];
 		if($type != '') {
 			$sql = "SELECT * FROM mail_content_filter WHERE server_id = ".intval($conf["server_id"])." AND type = '".$app->db->quote($type)."' AND active = 'y'";
@@ -118,36 +118,36 @@ class postfix_filter_plugin {
 				$content .= $rule["pattern"];
 				$content .= "  ".$rule["action"]." ".$rule["data"]."\n";
 			}
-		
+
 			if($type == 'header') {
-				file_put_contents('/etc/postfix/header_checks',$content);
-				$app->log("Writing /etc/postfix/header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/header_checks', $content);
+				$app->log("Writing /etc/postfix/header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'mime_header') {
-				file_put_contents('/etc/postfix/mime_header_checks',$content);
-				$app->log("Writing /etc/postfix/mime_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/mime_header_checks', $content);
+				$app->log("Writing /etc/postfix/mime_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'nested_header') {
-				file_put_contents('/etc/postfix/nested_header_checks',$content);
-				$app->log("Writing /etc/postfix/nested_header_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/nested_header_checks', $content);
+				$app->log("Writing /etc/postfix/nested_header_checks", LOGLEVEL_DEBUG);
 			}
-		
+
 			if($type == 'body') {
-				file_put_contents('/etc/postfix/body_checks',$content);
-				$app->log("Writing /etc/postfix/body_checks",LOGLEVEL_DEBUG);
+				file_put_contents('/etc/postfix/body_checks', $content);
+				$app->log("Writing /etc/postfix/body_checks", LOGLEVEL_DEBUG);
 			}
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
+
+		$this->update($event_name, $data);
 	}
-	
+
 
 } // end class
 
-?>
\ No newline at end of file
+?>
diff --git a/server/plugins-available/postfix_server_plugin.inc.php b/server/plugins-available/postfix_server_plugin.inc.php
index 8d00e31804184f6a6820d4f15092d422eec18f1c..ad92decfe680347c63b8244b68929ad2abbd5bc3 100644
--- a/server/plugins-available/postfix_server_plugin.inc.php
+++ b/server/plugins-available/postfix_server_plugin.inc.php
@@ -29,62 +29,62 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class postfix_server_plugin {
-	
+
 	var $plugin_name = 'postfix_server_plugin';
 	var $class_name = 'postfix_server_plugin';
-	
-	
+
+
 	var $postfix_config_dir = '/etc/postfix';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['mail'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('server_insert','postfix_server_plugin','insert');
-		$app->plugins->registerEvent('server_update','postfix_server_plugin','update');
-		
-		
-		
+
+		$app->plugins->registerEvent('server_insert', 'postfix_server_plugin', 'insert');
+		$app->plugins->registerEvent('server_update', 'postfix_server_plugin', 'update');
+
+
+
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		$this->update($event_name,$data);
-		
+
+		$this->update($event_name, $data);
+
 	}
-	
+
 	// The purpose of this plugin is to rewrite the main.cf file
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		// get the config
 		$app->uses("getconf");
 		$old_ini_data = $app->ini_parser->parse_ini_string($data['old']['config']);
 		$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
-		
-		copy('/etc/postfix/main.cf','/etc/postfix/main.cf~');
-		
+
+		copy('/etc/postfix/main.cf', '/etc/postfix/main.cf~');
+
 		if($mail_config['relayhost'] != '') {
 			exec("postconf -e 'relayhost = ".$mail_config['relayhost']."'");
 			if($mail_config['relayhost_user'] != '' && $mail_config['relayhost_password'] != '') {
@@ -94,16 +94,16 @@ class postfix_server_plugin {
 			}
 			exec("postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'");
 			exec("postconf -e 'smtp_sasl_security_options ='");
-			
+
 			// Store the sasl passwd
 			$content = $mail_config['relayhost'].'   '.$mail_config['relayhost_user'].':'.$mail_config['relayhost_password'];
-			file_put_contents('/etc/postfix/sasl_passwd',$content);
+			file_put_contents('/etc/postfix/sasl_passwd', $content);
 			chmod('/etc/postfix/sasl_passwd', 0600);
 			chown('/etc/postfix/sasl_passwd', 'root');
 			chgrp('/etc/postfix/sasl_passwd', 'root');
 			exec('postmap /etc/postfix/sasl_passwd');
 			exec($conf['init_scripts'] . '/' . 'postfix restart');
-			
+
 		} else {
 			exec("postconf -e 'relayhost ='");
 		}
@@ -130,7 +130,7 @@ class postfix_server_plugin {
 
 		exec("postconf -e 'mailbox_size_limit = ".intval($mail_config['mailbox_size_limit']*1024*1024)."'");
 		exec("postconf -e 'message_size_limit = ".intval($mail_config['message_size_limit']*1024*1024)."'");
-		
+
 	}
 
 } // end class
diff --git a/server/plugins-available/powerdns_plugin.inc.php b/server/plugins-available/powerdns_plugin.inc.php
index 01419687ed9ea0f4afb2e8d4810ffd9b8f40fa6b..335371c60f110e76a0ec3879263dc392e7641284 100644
--- a/server/plugins-available/powerdns_plugin.inc.php
+++ b/server/plugins-available/powerdns_plugin.inc.php
@@ -78,58 +78,58 @@ TODO:
 */
 
 class powerdns_plugin {
-	
+
 	var $plugin_name = 'powerdns_plugin';
 	var $class_name  = 'powerdns_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if(isset($conf['powerdns']['installed']) && $conf['powerdns']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
+
 		//* SOA
-		$app->plugins->registerEvent('dns_soa_insert',$this->plugin_name,'soa_insert');
-		$app->plugins->registerEvent('dns_soa_update',$this->plugin_name,'soa_update');
-		$app->plugins->registerEvent('dns_soa_delete',$this->plugin_name,'soa_delete');
+		$app->plugins->registerEvent('dns_soa_insert', $this->plugin_name, 'soa_insert');
+		$app->plugins->registerEvent('dns_soa_update', $this->plugin_name, 'soa_update');
+		$app->plugins->registerEvent('dns_soa_delete', $this->plugin_name, 'soa_delete');
 
 		//* SLAVE
-		$app->plugins->registerEvent('dns_slave_insert',$this->plugin_name,'slave_insert');
-		$app->plugins->registerEvent('dns_slave_update',$this->plugin_name,'slave_update');
-		$app->plugins->registerEvent('dns_slave_delete',$this->plugin_name,'slave_delete');
-		
+		$app->plugins->registerEvent('dns_slave_insert', $this->plugin_name, 'slave_insert');
+		$app->plugins->registerEvent('dns_slave_update', $this->plugin_name, 'slave_update');
+		$app->plugins->registerEvent('dns_slave_delete', $this->plugin_name, 'slave_delete');
+
 		//* RR
-		$app->plugins->registerEvent('dns_rr_insert',$this->plugin_name,'rr_insert');
-		$app->plugins->registerEvent('dns_rr_update',$this->plugin_name,'rr_update');
-		$app->plugins->registerEvent('dns_rr_delete',$this->plugin_name,'rr_delete');
-		
+		$app->plugins->registerEvent('dns_rr_insert', $this->plugin_name, 'rr_insert');
+		$app->plugins->registerEvent('dns_rr_update', $this->plugin_name, 'rr_update');
+		$app->plugins->registerEvent('dns_rr_delete', $this->plugin_name, 'rr_delete');
+
 	}
-	
-	
-	function soa_insert($event_name,$data) {
+
+
+	function soa_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$origin = substr($data["new"]["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
 		$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
@@ -142,24 +142,24 @@ class powerdns_plugin {
 			$ns = $data["new"]["ns"].'.'.$origin;
 		}
 		if($ns == '') $ns = $origin;
-		
+
 		$hostmaster = substr($data["new"]["mbox"], 0, -1);
 		$content = $ns.' '.$hostmaster.' 0';
 		$ttl = $data["new"]["ttl"];
-		
+
 		$app->db->query("INSERT INTO powerdns.records (domain_id, name, type, content, ttl, prio, change_date, ispconfig_id) VALUES ($zone_id, '$origin', 'SOA', '$content', $ttl, 0, ".time().", $ispconfig_id)");
-	
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
-	
+
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
+
 	}
-	
-	function soa_update($event_name,$data) {
+
+	function soa_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y'){
 			if($data["old"]["active"] != 'Y') return;
-			$this->soa_delete($event_name,$data);
+			$this->soa_delete($event_name, $data);
 		} else {
 			if($data["old"]["active"] == 'Y'){
 				$origin = substr($data["new"]["origin"], 0, -1);
@@ -167,27 +167,27 @@ class powerdns_plugin {
 				$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
 				$serial_id = $serial["serial"];
 				//$app->db->query("UPDATE powerdns.domains SET name = '$origin', notified_serial = $serial_id WHERE ispconfig_id = $ispconfig_idi AND type = 'MASTER'");
-				//$app->db->query("UPDATE powerdns.domains SET name = '$origin' WHERE ispconfig_id = $ispconfig_id AND type = 'MASTER'");		
-		
+				//$app->db->query("UPDATE powerdns.domains SET name = '$origin' WHERE ispconfig_id = $ispconfig_id AND type = 'MASTER'");
+
 				if(substr($data["new"]["ns"], -1) == '.'){
 					$ns = substr($data["new"]["ns"], 0, -1);
 				} else {
 					$ns = $data["new"]["ns"].'.'.$origin;
 				}
 				if($ns == '') $ns = $origin;
-				
+
 				$hostmaster = substr($data["new"]["mbox"], 0, -1);
 				//$content = $ns.' '.$hostmaster.' 0';
 				$content = $ns.' '.$hostmaster.' '.$serial_id.'';
 				$ttl = $data["new"]["ttl"];
 				$app->db->query("UPDATE powerdns.records SET name = '$origin', content = '$content', ttl = $ttl, change_date = ".time()." WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
 
-		        //* Reload powerdns nameserver
-				$app->services->restartServiceDelayed('powerdns','reload');
+				//* Reload powerdns nameserver
+				$app->services->restartServiceDelayed('powerdns', 'reload');
 
 
 			} else {
-				$this->soa_insert($event_name,$data);
+				$this->soa_insert($event_name, $data);
 				$ispconfig_id = $data["new"]["id"];
 				if($records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = $ispconfig_id AND active = 'Y'")){
 					foreach($records as $record){
@@ -200,97 +200,97 @@ class powerdns_plugin {
 
 			}
 		}
-			
+
 	}
-	
-	function soa_delete($event_name,$data) {
+
+	function soa_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["old"]["id"]." AND type = 'MASTER'");
 		$zone_id = $zone["id"];
 		$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id");
 		$app->db->query("DELETE FROM powerdns.domains WHERE id = $zone_id");
 
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
-			
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
+
 	}
 
-	function slave_insert($event_name,$data) {
+	function slave_insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$origin = substr($data["new"]["origin"], 0, -1);
 		$ispconfig_id = $data["new"]["id"];
 		$master_ns = $data["new"]["ns"];
-		
+
 		$app->db->query("INSERT INTO powerdns.domains (name, type, master, ispconfig_id) VALUES ('$origin', 'SLAVE', '$master_ns', $ispconfig_id)");
 
 		//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
 		$zone_id = $app->db->insertID();
 
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
 
 	}
-	
-	function slave_update($event_name,$data) {
+
+	function slave_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y'){
 			if($data["old"]["active"] != 'Y') return;
-			$this->slave_delete($event_name,$data);
+			$this->slave_delete($event_name, $data);
 		} else {
 			if($data["old"]["active"] == 'Y'){
-		
-     			$origin = substr($data["new"]["origin"], 0, -1);
-      			$ispconfig_id = $data["new"]["id"];
-		    	$master_ns = $data["new"]["ns"];
-		
-		    	$app->db->query("UPDATE powerdns.domains SET name = '$origin', type = 'SLAVE', master = '$master_ns' WHERE ispconfig_id=$ispconfig_id AND type = 'SLAVE'");
+
+				$origin = substr($data["new"]["origin"], 0, -1);
+				$ispconfig_id = $data["new"]["id"];
+				$master_ns = $data["new"]["ns"];
+
+				$app->db->query("UPDATE powerdns.domains SET name = '$origin', type = 'SLAVE', master = '$master_ns' WHERE ispconfig_id=$ispconfig_id AND type = 'SLAVE'");
 				//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
-		    	$zone_id = $app->db->insertID();
+				$zone_id = $app->db->insertID();
 
-    			$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$ispconfig_id." AND type = 'SLAVE'");
-    			$zone_id = $zone["id"];
-    			$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id AND ispconfig_id = 0");
+				$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$ispconfig_id." AND type = 'SLAVE'");
+				$zone_id = $zone["id"];
+				$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id AND ispconfig_id = 0");
+
+				//* Reload powerdns nameserver
+				$app->services->restartServiceDelayed('powerdns', 'reload');
 
-		        //* Reload powerdns nameserver
-     		   $app->services->restartServiceDelayed('powerdns','reload');
-				
 			} else {
-				$this->slave_insert($event_name,$data);
+				$this->slave_insert($event_name, $data);
 
 			}
 		}
-			
+
 	}
-	
-	function slave_delete($event_name,$data) {
+
+	function slave_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["old"]["id"]." AND type = 'SLAVE'");
 		$zone_id = $zone["id"];
 		$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id");
 		$app->db->query("DELETE FROM powerdns.domains WHERE id = $zone_id");
 
-        //* Reload powerdns nameserver
-        $app->services->restartServiceDelayed('powerdns','reload');
-    			
+		//* Reload powerdns nameserver
+		$app->services->restartServiceDelayed('powerdns', 'reload');
+
 	}
-	
-	function rr_insert($event_name,$data) {
+
+	function rr_insert($event_name, $data) {
 		global $app, $conf;
 		if($data["new"]["active"] != 'Y') return;
-		
+
 		$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 		$origin = substr($zone["origin"], 0, -1);
 		$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
 		$zone_id = $powerdns_zone["id"];
-		
+
 		$type = $data["new"]["type"];
-		
+
 		if(substr($data["new"]["name"], -1) == '.'){
 			$name = substr($data["new"]["name"], 0, -1);
 		} else {
@@ -301,59 +301,59 @@ class powerdns_plugin {
 			}
 		}
 		if($name == '') $name = $origin;
-		
+
 		switch ($type) {
-			case "CNAME":
-			case "MX":
-			case "NS":
-			case "ALIAS":
-			case "PTR":
-			case "SRV":
-				if(substr($data["new"]["data"], -1) == '.'){
-					$content = substr($data["new"]["data"], 0, -1);
-				} else {
-					$content = $data["new"]["data"].'.'.$origin;
-				}
-				break;
-			case "HINFO":
-			    $content = $data["new"]["data"];
-				$quote1 = strpos($content, '"');
-				if($quote1 !== FALSE){
-					$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-				}
-				if($quote1 !== FALSE && $quote2 !== FALSE){
-					$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-					$content = $text_between_quotes.substr($content, ($quote2 + 2));
-				}
-				break;
-    		default:
-				$content = $data["new"]["data"];
+		case "CNAME":
+		case "MX":
+		case "NS":
+		case "ALIAS":
+		case "PTR":
+		case "SRV":
+			if(substr($data["new"]["data"], -1) == '.'){
+				$content = substr($data["new"]["data"], 0, -1);
+			} else {
+				$content = $data["new"]["data"].'.'.$origin;
+			}
+			break;
+		case "HINFO":
+			$content = $data["new"]["data"];
+			$quote1 = strpos($content, '"');
+			if($quote1 !== FALSE){
+				$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+			}
+			if($quote1 !== FALSE && $quote2 !== FALSE){
+				$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+				$content = $text_between_quotes.substr($content, ($quote2 + 2));
+			}
+			break;
+		default:
+			$content = $data["new"]["data"];
 		}
-		
+
 		$ttl = $data["new"]["ttl"];
 		$prio = $data["new"]["aux"];
 		$change_date = time();
 		$ispconfig_id = $data["new"]["id"];
-		
+
 		$app->db->query("INSERT INTO powerdns.records (domain_id, name, type, content, ttl, prio, change_date, ispconfig_id) VALUES ($zone_id, '$name', '$type', '$content', $ttl, $prio, $change_date, $ispconfig_id)");
-		
+
 	}
-	
-	function rr_update($event_name,$data) {
+
+	function rr_update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($data["new"]["active"] != 'Y'){
 			if($data["old"]["active"] != 'Y') return;
-			$this->rr_delete($event_name,$data);
+			$this->rr_delete($event_name, $data);
 		} else {
 			if($data["old"]["active"] == 'Y'){
 				$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
 				$origin = substr($zone["origin"], 0, -1);
 				$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
 				$zone_id = $powerdns_zone["id"];
-				
-				$type = $data["new"]["type"];	
-		
+
+				$type = $data["new"]["type"];
+
 				if(substr($data["new"]["name"], -1) == '.'){
 					$name = substr($data["new"]["name"], 0, -1);
 				} else {
@@ -366,56 +366,56 @@ class powerdns_plugin {
 				if($name == '') $name = $origin;
 
 				switch ($type) {
-					case "CNAME":
-					case "MX":
-					case "NS":
-					case "ALIAS":
-					case "PTR":
-					case "SRV":
-						if(substr($data["new"]["data"], -1) == '.'){
-							$content = substr($data["new"]["data"], 0, -1);
-						} else {
-							$content = $data["new"]["data"].'.'.$origin;
-						}
-						break;
-					case "HINFO":
-			    		$content = $data["new"]["data"];
-						$quote1 = strpos($content, '"');
-						if($quote1 !== FALSE){
-							$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
-						}
-						if($quote1 !== FALSE && $quote2 !== FALSE){
-							$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
-							$content = $text_between_quotes.substr($content, ($quote2 + 2));
-						}
-						break;
-    				default:
-						$content = $data["new"]["data"];
+				case "CNAME":
+				case "MX":
+				case "NS":
+				case "ALIAS":
+				case "PTR":
+				case "SRV":
+					if(substr($data["new"]["data"], -1) == '.'){
+						$content = substr($data["new"]["data"], 0, -1);
+					} else {
+						$content = $data["new"]["data"].'.'.$origin;
+					}
+					break;
+				case "HINFO":
+					$content = $data["new"]["data"];
+					$quote1 = strpos($content, '"');
+					if($quote1 !== FALSE){
+						$quote2 = strpos(substr($content, ($quote1 + 1)), '"');
+					}
+					if($quote1 !== FALSE && $quote2 !== FALSE){
+						$text_between_quotes = str_replace(' ', '_', substr($content, ($quote1 + 1), (($quote2 - $quote1))));
+						$content = $text_between_quotes.substr($content, ($quote2 + 2));
+					}
+					break;
+				default:
+					$content = $data["new"]["data"];
 				}
-		
+
 				$ttl = $data["new"]["ttl"];
 				$prio = $data["new"]["aux"];
 				$change_date = time();
 				$ispconfig_id = $data["new"]["id"];
 				//echo "UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE id = $record_id";
 				$app->db->query("UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
-				
+
 			} else {
-				$this->rr_insert($event_name,$data);
+				$this->rr_insert($event_name, $data);
 			}
 		}
-		
+
 	}
-	
-	function rr_delete($event_name,$data) {
+
+	function rr_delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$ispconfig_id = $data["old"]["id"];
 		$app->db->query("DELETE FROM powerdns.records WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
-		
+
 	}
-	
-	
+
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php
index 2924d49bcb8660edb25bbecffc610e33f0882cc4..33d887593fd2aa7eccc44050b4d54186b814d470 100755
--- a/server/plugins-available/shelluser_base_plugin.inc.php
+++ b/server/plugins-available/shelluser_base_plugin.inc.php
@@ -29,61 +29,61 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class shelluser_base_plugin {
-	
+
 	var $plugin_name = 'shelluser_base_plugin';
 	var $class_name = 'shelluser_base_plugin';
 	var $min_uid = 499;
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('shell_user_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('shell_user_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('shell_user_delete',$this->plugin_name,'delete');
 
-		
+		$app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('shell_user_delete', $this->plugin_name, 'delete');
+
+
 	}
-	
-	
-	function insert($event_name,$data) {
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		//* Check if the resulting path is inside the docroot
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-		if(substr(realpath($data['new']['dir']),0,strlen($web['document_root'])) != $web['document_root']) {
-			$app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN);
+		if(substr(realpath($data['new']['dir']), 0, strlen($web['document_root'])) != $web['document_root']) {
+			$app->log('Directory of the shell user is outside of website docroot.', LOGLEVEL_WARN);
 			return false;
 		}
-		
+
 		if($app->system->is_user($data['new']['puser'])) {
-			
+
 			//* Remove webfolder protection
-			$app->system->web_folder_protection($web['document_root'],false);
-			
+			$app->system->web_folder_protection($web['document_root'], false);
+
 			// Get the UID of the parent user
 			$uid = intval($app->system->getuid($data['new']['puser']));
 			if($uid > $this->min_uid) {
@@ -95,53 +95,53 @@ class shelluser_base_plugin {
 				$command .= ' -s '.escapeshellcmd($data['new']['shell']);
 				$command .= ' -u '.escapeshellcmd($uid);
 				$command .= ' '.escapeshellcmd($data['new']['username']);
-			
+
 				exec($command);
-				$app->log("Executed command: ".$command,LOGLEVEL_DEBUG);
-				$app->log("Added shelluser: ".$data['new']['username'],LOGLEVEL_DEBUG);
-								
+				$app->log("Executed command: ".$command, LOGLEVEL_DEBUG);
+				$app->log("Added shelluser: ".$data['new']['username'], LOGLEVEL_DEBUG);
+
 				// call the ssh-rsa update function
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->_setup_ssh_rsa();
-				
+
 				//* Create .bash_history file
 				$app->system->touch(escapeshellcmd($data['new']['dir']).'/.bash_history');
 				$app->system->chmod(escapeshellcmd($data['new']['dir']).'/.bash_history', 0755);
 				$app->system->chown(escapeshellcmd($data['new']['dir']).'/.bash_history', $data['new']['username']);
 				$app->system->chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history', $data['new']['pgroup']);
-				
+
 				//* Disable shell user temporarily if we use jailkit
 				if($data['new']['chroot'] == 'jailkit') {
 					$command = 'usermod -s /bin/false -L '.escapeshellcmd($data['new']['username']).' 2>/dev/null';
 					exec($command);
-					$app->log("Disabling shelluser temporarily: ".$command,LOGLEVEL_DEBUG);
+					$app->log("Disabling shelluser temporarily: ".$command, LOGLEVEL_DEBUG);
 				}
-				
+
 				//* Add webfolder protection again
-				$app->system->web_folder_protection($web['document_root'],true);
-			
+				$app->system->web_folder_protection($web['document_root'], true);
+
 			} else {
-				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
+				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.", LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log("Skipping insertion of user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
+			$app->log("Skipping insertion of user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.", LOGLEVEL_WARN);
 		}
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		//* Check if the resulting path is inside the docroot
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($data['new']['parent_domain_id']));
-		if(substr(realpath($data['new']['dir']),0,strlen($web['document_root'])) != $web['document_root']) {
-			$app->log('Directory of the shell user is outside of website docroot.',LOGLEVEL_WARN);
+		if(substr(realpath($data['new']['dir']), 0, strlen($web['document_root'])) != $web['document_root']) {
+			$app->log('Directory of the shell user is outside of website docroot.', LOGLEVEL_WARN);
 			return false;
 		}
-		
+
 		if($app->system->is_user($data['new']['puser'])) {
 			// Get the UID of the parent user
 			$uid = intval($app->system->getuid($data['new']['puser']));
@@ -158,45 +158,45 @@ class shelluser_base_plugin {
 					// $command .= ' --uid '.escapeshellcmd($uid);
 					$command .= ' --login '.escapeshellcmd($data['new']['username']);
 					$command .= ' '.escapeshellcmd($data['old']['username']);
-			
+
 					exec($command);
 					$app->log("Executed command: $command ",LOGLEVEL_DEBUG);
 					*/
 					//$groupinfo = $app->system->posix_getgrnam($data['new']['pgroup']);
-					$app->system->usermod($data['old']['username'],0, $app->system->getgid($data['new']['pgroup']), $data['new']['dir'], $data['new']['shell'], $data['new']['password'], $data['new']['username']);
-					$app->log("Updated shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
-									
+					$app->system->usermod($data['old']['username'], 0, $app->system->getgid($data['new']['pgroup']), $data['new']['dir'], $data['new']['shell'], $data['new']['password'], $data['new']['username']);
+					$app->log("Updated shelluser: ".$data['old']['username'], LOGLEVEL_DEBUG);
+
 					// call the ssh-rsa update function
 					$app->uses("getconf");
 					$this->data = $data;
 					$this->app = $app;
 					$this->_setup_ssh_rsa();
-					
+
 					//* Create .bash_history file
 					if(!is_file($data['new']['dir']).'/.bash_history') {
 						$app->system->touch(escapeshellcmd($data['new']['dir']).'/.bash_history');
 						$app->system->chmod(escapeshellcmd($data['new']['dir']).'/.bash_history', 0755);
-						$app->system->chown(escapeshellcmd($data['new']['dir']).'/.bash_history',escapeshellcmd($data['new']['username']));
-						$app->system->chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history',escapeshellcmd($data['new']['pgroup']));
+						$app->system->chown(escapeshellcmd($data['new']['dir']).'/.bash_history', escapeshellcmd($data['new']['username']));
+						$app->system->chgrp(escapeshellcmd($data['new']['dir']).'/.bash_history', escapeshellcmd($data['new']['pgroup']));
 					}
-					
+
 				} else {
 					// The user does not exist, so we insert it now
-					$this->insert($event_name,$data);
+					$this->insert($event_name, $data);
 				}
 			} else {
-				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.",LOGLEVEL_ERROR);
+				$app->log("UID = $uid for shelluser:".$data['new']['username']." not allowed.", LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log("Skipping update for user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.",LOGLEVEL_WARN);
+			$app->log("Skipping update for user:".$data['new']['username'].", parent user ".$data['new']['puser']." does not exist.", LOGLEVEL_WARN);
 		}
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		if($app->system->is_user($data['old']['username'])) {
 			// Get the UID of the user
 			$userid = intval($app->system->getuid($data['old']['username']));
@@ -206,21 +206,21 @@ class shelluser_base_plugin {
 					$command = 'userdel -f';
 					$command .= ' '.escapeshellcmd($data['old']['username']).' &> /dev/null';
 					exec($command);
-					$app->log("Deleted shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
+					$app->log("Deleted shelluser: ".$data['old']['username'], LOGLEVEL_DEBUG);
 				}
-			
+
 			} else {
-				$app->log("UID = $userid for shelluser:".$data['old']['username']." not allowed.",LOGLEVEL_ERROR);
+				$app->log("UID = $userid for shelluser:".$data['old']['username']." not allowed.", LOGLEVEL_ERROR);
 			}
 		} else {
-			$app->log("User:".$data['new']['username']." does not exist in in /etc/passwd, skipping delete.",LOGLEVEL_WARN);
+			$app->log("User:".$data['new']['username']." does not exist in in /etc/passwd, skipping delete.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	private function _setup_ssh_rsa() {
 		global $app;
-		$this->app->log("ssh-rsa setup shelluser_base",LOGLEVEL_DEBUG);
+		$this->app->log("ssh-rsa setup shelluser_base", LOGLEVEL_DEBUG);
 		// Get the client ID, username, and the key
 		$domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id']));
 		$sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid']));
@@ -230,38 +230,38 @@ class shelluser_base_plugin {
 		$userkey = $client_data['ssh_rsa'];
 		unset($domain_data);
 		unset($client_data);
-		
+
 		// ssh-rsa authentication variables
 		$sshrsa = $this->data['new']['ssh_rsa'];
 		$usrdir = escapeshellcmd($this->data['new']['dir']);
 		$sshdir = $usrdir.'/.ssh';
 		$sshkeys= $usrdir.'/.ssh/authorized_keys';
-		
+
 		$app->uses('file');
 		$sshrsa = $app->file->unix_nl($sshrsa);
-		$sshrsa = $app->file->remove_blank_lines($sshrsa,0);
-		
+		$sshrsa = $app->file->remove_blank_lines($sshrsa, 0);
+
 		// If this user has no key yet, generate a pair
 		if ($userkey == '' && $id > 0){
 			//Generate ssh-rsa-keys
 			exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
-			
+
 			// use the public key that has been generated
 			$userkey = $app->system->file_get_contents('/tmp/id_rsa.pub');
-			
+
 			// save keypair in client table
 			$this->app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote($app->system->file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote($userkey)."' WHERE client_id = ".$id);
-			
+
 			$app->system->unlink('/tmp/id_rsa');
 			$app->system->unlink('/tmp/id_rsa.pub');
-			$this->app->log("ssh-rsa keypair generated for ".$username,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
 		};
 
 		if (!file_exists($sshkeys)){
 			// add root's key
 			$app->file->mkdirs($sshdir, '0700');
 			if(is_file('/root/.ssh/authorized_keys')) $app->system->file_put_contents($sshkeys, $app->system->file_get_contents('/root/.ssh/authorized_keys'));
-		
+
 			// Remove duplicate keys
 			$existing_keys = @file($sshkeys);
 			$new_keys = explode("\n", $userkey);
@@ -273,33 +273,33 @@ class shelluser_base_plugin {
 				}
 			}
 			$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
+
 			// add the user's key
 			$app->system->file_put_contents($sshkeys, $final_keys);
 			$app->file->remove_blank_lines($sshkeys);
-			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys, LOGLEVEL_DEBUG);
 		}
-			
+
 		//* Get the keys
 		$existing_keys = file($sshkeys);
 		$new_keys = explode("\n", $sshrsa);
-		$old_keys = explode("\n",$this->data['old']['ssh_rsa']);
-			
+		$old_keys = explode("\n", $this->data['old']['ssh_rsa']);
+
 		//* Remove all old keys
 		if(is_array($old_keys)) {
 			foreach($old_keys as $key => $val) {
-				$k = array_search(trim($val),$existing_keys);
+				$k = array_search(trim($val), $existing_keys);
 				unset($existing_keys[$k]);
 			}
 		}
-			
+
 		//* merge the remaining keys and the ones fom the ispconfig database.
 		if(is_array($new_keys)) {
 			$final_keys_arr = array_merge($existing_keys, $new_keys);
 		} else {
 			$final_keys_arr = $existing_keys;
 		}
-			
+
 		$new_final_keys_arr = array();
 		if(is_array($final_keys_arr) && !empty($final_keys_arr)){
 			foreach($final_keys_arr as $key => $val){
@@ -307,18 +307,18 @@ class shelluser_base_plugin {
 			}
 		}
 		$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
-		// add the custom key 
+
+		// add the custom key
 		$app->system->file_put_contents($sshkeys, $final_keys);
 		$app->file->remove_blank_lines($sshkeys);
-		$this->app->log("ssh-rsa key updated in ".$sshkeys,LOGLEVEL_DEBUG);
-		
+		$this->app->log("ssh-rsa key updated in ".$sshkeys, LOGLEVEL_DEBUG);
+
 		// set proper file permissions
 		exec("chown -R ".escapeshellcmd($this->data['new']['puser']).":".escapeshellcmd($this->data['new']['pgroup'])." ".$sshdir);
 		exec("chmod 600 '$sshkeys'");
-		
+
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php
index 268df9c0829fc2cafdcc5dcf2deafd652b5f63fd..9816b70f3300fbc61103040f1856d61662739d80 100755
--- a/server/plugins-available/shelluser_jailkit_plugin.inc.php
+++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php
@@ -29,229 +29,233 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class shelluser_jailkit_plugin {
-	
+
 	//* $plugin_name and $class_name have to be the same then the name of this class
 	var $plugin_name = 'shelluser_jailkit_plugin';
 	var $class_name = 'shelluser_jailkit_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('shell_user_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('shell_user_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('shell_user_delete',$this->plugin_name,'delete');
 
-		
+		$app->plugins->registerEvent('shell_user_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('shell_user_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('shell_user_delete', $this->plugin_name, 'delete');
+
+
 	}
-	
+
 	//* This function is called, when a shell user is inserted in the database
-	function insert($event_name,$data) {
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['new']['parent_domain_id']);
-		
+
 		if($app->system->is_user($data['new']['username'])) {
-		
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
+
+
 			if ($data['new']['chroot'] == "jailkit")
 			{
-				
-				
+
+
 				// load the server configuration options
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($web['document_root'],false);
-			
+
+				$app->system->web_folder_protection($web['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
-				
+
 				$this->_add_jailkit_user();
-				
+
 				//* call the ssh-rsa update function
 				$this->_setup_ssh_rsa();
-				
+
 				//$command .= 'usermod -s /usr/sbin/jk_chrootsh -U '.escapeshellcmd($data['new']['username']);
 				//exec($command);
 				$app->system->usermod($data['new']['username'], 0, 0, '', '/usr/sbin/jk_chrootsh', '', '');
-				
+
 				//* Unlock user
 				$command = 'usermod -U '.escapeshellcmd($data['new']['username']).' 2>/dev/null';
 				exec($command);
-				
+
 				$this->_update_website_security_level();
-				$app->system->web_folder_protection($web['document_root'],true);
+				$app->system->web_folder_protection($web['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin -> insert username:".$data['new']['username'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin -> insert username:".$data['new']['username'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin -> insert username:".$data['new']['username']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin -> insert username:".$data['new']['username']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a shell user is updated in the database
-	function update($event_name,$data) {
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['new']['parent_domain_id']);
-		
+
 		if($app->system->is_user($data['new']['username'])) {
-		
+
+
+
 			/**
-		 	* Setup Jailkit Chroot System If Enabled 
-		 	*/
+			 * Setup Jailkit Chroot System If Enabled
+			 */
 			if ($data['new']['chroot'] == "jailkit")
 			{
-				
+
 				// load the server configuration options
 				$app->uses("getconf");
 				$this->data = $data;
 				$this->app = $app;
 				$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($web['document_root'],false);
-			
+
+				$app->system->web_folder_protection($web['document_root'], false);
+
 				$this->_setup_jailkit_chroot();
 				$this->_add_jailkit_user();
-				
+
 				//* call the ssh-rsa update function
 				$this->_setup_ssh_rsa();
-				
+
 				$this->_update_website_security_level();
-				
-				$app->system->web_folder_protection($web['document_root'],true);
+
+				$app->system->web_folder_protection($web['document_root'], true);
 			}
-		
-			$app->log("Jailkit Plugin -> update username:".$data['new']['username'],LOGLEVEL_DEBUG);
-			
+
+			$app->log("Jailkit Plugin -> update username:".$data['new']['username'], LOGLEVEL_DEBUG);
+
 		} else {
-			$app->log("Jailkit Plugin -> update username:".$data['new']['username']." skipped, the user does not exist.",LOGLEVEL_WARN);
+			$app->log("Jailkit Plugin -> update username:".$data['new']['username']." skipped, the user does not exist.", LOGLEVEL_WARN);
 		}
-		
+
 	}
-	
+
 	//* This function is called, when a shell user is deleted in the database
 	/**
 	 * TODO: Remove chroot user home and from the chroot passwd file
-	 */ 
-	function delete($event_name,$data) {
+	 */
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		$app->uses('system');
-		
+
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$data['old']['parent_domain_id']);
-		
+
 		if ($data['old']['chroot'] == "jailkit")
 		{
 			$app->uses("getconf");
 			$this->jailkit_config = $app->getconf->get_server_config($conf["server_id"], 'jailkit');
-			
+
 			$jailkit_chroot_userhome = $this->_get_home_dir($data['old']['username']);
-			
+
 			//commented out proved to be dangerous on config errors
 			//exec('rm -rf '.$data['old']['dir'].$jailkit_chroot_userhome);
-			
-			$app->system->web_folder_protection($web['document_root'],false);
-			
+
+			$app->system->web_folder_protection($web['document_root'], false);
+
 			if(@is_dir($data['old']['dir'].$jailkit_chroot_userhome)) {
 				$command = 'userdel -f';
 				$command .= ' '.escapeshellcmd($data['old']['username']).' &> /dev/null';
 				exec($command);
-				$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
+				$app->log("Jailkit Plugin -> delete chroot home:".$data['old']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
 			}
-			
-			$app->system->web_folder_protection($web['document_root'],true);
-			
+
+			$app->system->web_folder_protection($web['document_root'], true);
+
 		}
-		
-		$app->log("Jailkit Plugin -> delete username:".$data['old']['username'],LOGLEVEL_DEBUG);
-		
-		
+
+		$app->log("Jailkit Plugin -> delete username:".$data['old']['username'], LOGLEVEL_DEBUG);
+
+
 	}
-	
+
 	function _setup_jailkit_chroot()
 	{
-			global $app;
-			
-			//check if the chroot environment is created yet if not create it with a list of program sections from the config
-			if (!is_dir($this->data['new']['dir'].'/etc/jailkit'))
-			{
-				$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
-				$command .= ' '.escapeshellcmd($this->data['new']['dir']);
-				$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
-				exec($command.' 2>/dev/null');
-				
-				$this->app->log("Added jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
-				
-				$this->_add_jailkit_programs();
-				
-				//add bash.bashrc script
-				//we need to collect the domain name to be used as the HOSTNAME in the bashrc script
-				$web = $this->app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".intval($this->data['new']["parent_domain_id"]));
-				
-				$this->app->load('tpl');
-		
-				$tpl = new tpl();
-				$tpl->newTemplate("bash.bashrc.master");
-				
-				$tpl->setVar('jailkit_chroot',true);
-				$tpl->setVar('domain',$web['domain']);
-				$tpl->setVar('home_dir',$this->_get_home_dir(""));
-				
-				$bashrc = escapeshellcmd($this->data['new']['dir']).'/etc/bash.bashrc';
-				if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
-				
-				file_put_contents($bashrc,$tpl->grab());
-				unset($tpl);
-				
-				$this->app->log("Added bashrc script : ".$bashrc,LOGLEVEL_DEBUG);
-				
-				$tpl = new tpl();
-				$tpl->newTemplate("motd.master");
-				
-				$tpl->setVar('domain',$web['domain']);
-				
-				$motd = escapeshellcmd($this->data['new']['dir']).'/var/run/motd';
-				if(@is_file($motd) || @is_link($motd)) unlink($motd);
-				
-				$app->system->file_put_contents($motd,$tpl->grab());
-				
-			}
+		global $app;
+
+		//check if the chroot environment is created yet if not create it with a list of program sections from the config
+		if (!is_dir($this->data['new']['dir'].'/etc/jailkit'))
+		{
+			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_chroot.sh';
+			$command .= ' '.escapeshellcmd($this->data['new']['dir']);
+			$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_sections'].'\'';
+			exec($command.' 2>/dev/null');
+
+			$this->app->log("Added jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+			$this->_add_jailkit_programs();
+
+			//add bash.bashrc script
+			//we need to collect the domain name to be used as the HOSTNAME in the bashrc script
+			$web = $this->app->db->queryOneRecord("SELECT domain FROM web_domain WHERE domain_id = ".intval($this->data['new']["parent_domain_id"]));
+
+			$this->app->load('tpl');
+
+			$tpl = new tpl();
+			$tpl->newTemplate("bash.bashrc.master");
+
+			$tpl->setVar('jailkit_chroot', true);
+			$tpl->setVar('domain', $web['domain']);
+			$tpl->setVar('home_dir', $this->_get_home_dir(""));
+
+			$bashrc = escapeshellcmd($this->data['new']['dir']).'/etc/bash.bashrc';
+			if(@is_file($bashrc) || @is_link($bashrc)) unlink($bashrc);
+
+			file_put_contents($bashrc, $tpl->grab());
+			unset($tpl);
+
+			$this->app->log("Added bashrc script : ".$bashrc, LOGLEVEL_DEBUG);
+
+			$tpl = new tpl();
+			$tpl->newTemplate("motd.master");
+
+			$tpl->setVar('domain', $web['domain']);
+
+			$motd = escapeshellcmd($this->data['new']['dir']).'/var/run/motd';
+			if(@is_file($motd) || @is_link($motd)) unlink($motd);
+
+			$app->system->file_put_contents($motd, $tpl->grab());
+
+		}
 	}
-	
+
 	function _add_jailkit_programs()
 	{
 		//copy over further programs and its libraries
@@ -259,43 +263,43 @@ class shelluser_jailkit_plugin {
 		$command .= ' '.escapeshellcmd($this->data['new']['dir']);
 		$command .= ' \''.$this->jailkit_config['jailkit_chroot_app_programs'].'\'';
 		exec($command.' 2>/dev/null');
-		
-		$this->app->log("Added programs to jailkit chroot with command: ".$command,LOGLEVEL_DEBUG);
+
+		$this->app->log("Added programs to jailkit chroot with command: ".$command, LOGLEVEL_DEBUG);
 	}
-	
+
 	function _get_home_dir($username)
 	{
-		return str_replace("[username]",escapeshellcmd($username),$this->jailkit_config['jailkit_chroot_home']);
+		return str_replace("[username]", escapeshellcmd($username), $this->jailkit_config['jailkit_chroot_home']);
 	}
-	
+
 	function _add_jailkit_user()
 	{
-			global $app;
-			
-			//add the user to the chroot
-			$jailkit_chroot_userhome = $this->_get_home_dir($this->data['new']['username']);
-			$jailkit_chroot_puserhome = $this->_get_home_dir($this->data['new']['puser']);
-			
-			if(!is_dir($this->data['new']['dir'].'/etc')) mkdir($this->data['new']['dir'].'/etc', 0755);
-			if(!is_file($this->data['new']['dir'].'/etc/passwd')) touch($this->data['new']['dir'].'/etc/passwd', 0755);
-			
-			// IMPORTANT!
-			// ALWAYS create the user. Even if the user was created before
-			// if we check if the user exists, then a update (no shell -> jailkit) will not work
-			// and the user has FULL ACCESS to the root of the server!
-			$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
-			$command .= ' '.escapeshellcmd($this->data['new']['username']);
-			$command .= ' '.escapeshellcmd($this->data['new']['dir']);
-			$command .= ' '.$jailkit_chroot_userhome;
-			$command .= ' '.escapeshellcmd($this->data['new']['shell']);
-			$command .= ' '.$this->data['new']['puser'];
-			$command .= ' '.$jailkit_chroot_puserhome;
-			exec($command.' 2>/dev/null');
-			
-			//* Change the homedir of the shell user and parent user
-			//* We have to do this manually as the usermod command fails 
-			//* when the user is logged in or a command is running under that user
-			/*
+		global $app;
+
+		//add the user to the chroot
+		$jailkit_chroot_userhome = $this->_get_home_dir($this->data['new']['username']);
+		$jailkit_chroot_puserhome = $this->_get_home_dir($this->data['new']['puser']);
+
+		if(!is_dir($this->data['new']['dir'].'/etc')) mkdir($this->data['new']['dir'].'/etc', 0755);
+		if(!is_file($this->data['new']['dir'].'/etc/passwd')) touch($this->data['new']['dir'].'/etc/passwd', 0755);
+
+		// IMPORTANT!
+		// ALWAYS create the user. Even if the user was created before
+		// if we check if the user exists, then a update (no shell -> jailkit) will not work
+		// and the user has FULL ACCESS to the root of the server!
+		$command = '/usr/local/ispconfig/server/scripts/create_jailkit_user.sh';
+		$command .= ' '.escapeshellcmd($this->data['new']['username']);
+		$command .= ' '.escapeshellcmd($this->data['new']['dir']);
+		$command .= ' '.$jailkit_chroot_userhome;
+		$command .= ' '.escapeshellcmd($this->data['new']['shell']);
+		$command .= ' '.$this->data['new']['puser'];
+		$command .= ' '.$jailkit_chroot_puserhome;
+		exec($command.' 2>/dev/null');
+
+		//* Change the homedir of the shell user and parent user
+		//* We have to do this manually as the usermod command fails
+		//* when the user is logged in or a command is running under that user
+		/*
 			$passwd_file_array = file('/etc/passwd');
 			$passwd_out = '';
 			if(is_array($passwd_file_array)) {
@@ -313,59 +317,59 @@ class shelluser_jailkit_plugin {
 					}
 				}
 			}*/
-			
-			$app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
-			$app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
-				
-			$this->app->log("Added jailkit user to chroot with command: ".$command,LOGLEVEL_DEBUG);
-						
-			if(!is_dir($this->data['new']['dir'].$jailkit_chroot_userhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), 0755, true);
-			$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['username']);
-			$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['pgroup']);
-				
-			$this->app->log("Added created jailkit user home in : ".$this->data['new']['dir'].$jailkit_chroot_userhome,LOGLEVEL_DEBUG);
-			
-			if(!is_dir($this->data['new']['dir'].$jailkit_chroot_puserhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), 0755, true);
-			$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['puser']);
-			$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['pgroup']);
-				
-			$this->app->log("Added jailkit parent user home in : ".$this->data['new']['dir'].$jailkit_chroot_puserhome,LOGLEVEL_DEBUG);
-			
+
+		$app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
+		$app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh');
+
+		$this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG);
+
+		if(!is_dir($this->data['new']['dir'].$jailkit_chroot_userhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), 0755, true);
+		$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['username']);
+		$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_userhome), $this->data['new']['pgroup']);
+
+		$this->app->log("Added created jailkit user home in : ".$this->data['new']['dir'].$jailkit_chroot_userhome, LOGLEVEL_DEBUG);
+
+		if(!is_dir($this->data['new']['dir'].$jailkit_chroot_puserhome)) mkdir(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), 0755, true);
+		$app->system->chown(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['puser']);
+		$app->system->chgrp(escapeshellcmd($this->data['new']['dir'].$jailkit_chroot_puserhome), $this->data['new']['pgroup']);
+
+		$this->app->log("Added jailkit parent user home in : ".$this->data['new']['dir'].$jailkit_chroot_puserhome, LOGLEVEL_DEBUG);
+
 
 	}
-	
+
 	//* Update the website root directory permissions depending on the security level
 	function _update_website_security_level() {
-		global $app,$conf;
-		
+		global $app, $conf;
+
 		// load the server configuration options
 		$app->uses("getconf");
 		$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
-		
+
 		// Get the parent website of this shell user
 		$web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$this->data['new']['parent_domain_id']);
-		
+
 		//* If the security level is set to high
 		if($web_config['security_level'] == 20 && is_array($web)) {
-			$app->system->web_folder_protection($web["document_root"],false);
-			$app->system->chmod($web["document_root"],0755);
-			$app->system->chown($web["document_root"],'root');
-			$app->system->chgrp($web["document_root"],'root');
-			$app->system->web_folder_protection($web["document_root"],true);
+			$app->system->web_folder_protection($web["document_root"], false);
+			$app->system->chmod($web["document_root"], 0755);
+			$app->system->chown($web["document_root"], 'root');
+			$app->system->chgrp($web["document_root"], 'root');
+			$app->system->web_folder_protection($web["document_root"], true);
 		}
-		
+
 	}
-	
+
 	//* Wrapper for exec function for easier debugging
 	private function _exec($command) {
 		global $app;
-		$app->log('exec: '.$command,LOGLEVEL_DEBUG);
+		$app->log('exec: '.$command, LOGLEVEL_DEBUG);
 		exec($command);
 	}
 
 	private function _setup_ssh_rsa() {
 		global $app;
-		$this->app->log("ssh-rsa setup shelluser_jailkit",LOGLEVEL_DEBUG); 
+		$this->app->log("ssh-rsa setup shelluser_jailkit", LOGLEVEL_DEBUG);
 		// Get the client ID, username, and the key
 		$domain_data = $this->app->db->queryOneRecord('SELECT sys_groupid FROM web_domain WHERE web_domain.domain_id = '.intval($this->data['new']['parent_domain_id']));
 		$sys_group_data = $this->app->db->queryOneRecord('SELECT * FROM sys_group WHERE sys_group.groupid = '.intval($domain_data['sys_groupid']));
@@ -375,38 +379,38 @@ class shelluser_jailkit_plugin {
 		$userkey = $client_data['ssh_rsa'];
 		unset($domain_data);
 		unset($client_data);
-		
+
 		// ssh-rsa authentication variables
 		$sshrsa = $this->data['new']['ssh_rsa'];
 		$usrdir = escapeshellcmd($this->data['new']['dir']).'/'.$this->_get_home_dir($this->data['new']['username']);
 		$sshdir = $usrdir.'/.ssh';
 		$sshkeys= $usrdir.'/.ssh/authorized_keys';
-			
+
 		$app->uses('file');
 		$sshrsa = $app->file->unix_nl($sshrsa);
-		$sshrsa = $app->file->remove_blank_lines($sshrsa,0);
-		
+		$sshrsa = $app->file->remove_blank_lines($sshrsa, 0);
+
 		// If this user has no key yet, generate a pair
 		if ($userkey == '' && $id > 0){
 			//Generate ssh-rsa-keys
 			exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
-			
+
 			// use the public key that has been generated
 			$userkey = $app->system->file_get_contents('/tmp/id_rsa.pub');
-			
+
 			// save keypair in client table
 			$this->app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".$app->db->quote($app->system->file_get_contents('/tmp/id_rsa'))."', ssh_rsa = '".$app->db->quote($userkey)."' WHERE client_id = ".$id);
 
 			$app->system->unlink('/tmp/id_rsa');
 			$app->system->unlink('/tmp/id_rsa.pub');
-			$this->app->log("ssh-rsa keypair generated for ".$username,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa keypair generated for ".$username, LOGLEVEL_DEBUG);
 		};
-		
+
 		if (!file_exists($sshkeys)){
 			// add root's key
 			$app->file->mkdirs($sshdir, '0755');
 			if(is_file('/root/.ssh/authorized_keys')) $app->system->file_put_contents($sshkeys, $app->system->file_get_contents('/root/.ssh/authorized_keys'));
-		
+
 			// Remove duplicate keys
 			$existing_keys = @file($sshkeys);
 			$new_keys = explode("\n", $userkey);
@@ -418,32 +422,32 @@ class shelluser_jailkit_plugin {
 				}
 			}
 			$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
+
 			// add the user's key
 			file_put_contents($sshkeys, $final_keys);
 			$app->file->remove_blank_lines($sshkeys);
-			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys,LOGLEVEL_DEBUG);
+			$this->app->log("ssh-rsa authorisation keyfile created in ".$sshkeys, LOGLEVEL_DEBUG);
 		}
 		//* Get the keys
 		$existing_keys = file($sshkeys);
 		$new_keys = explode("\n", $sshrsa);
-		$old_keys = explode("\n",$this->data['old']['ssh_rsa']);
-			
+		$old_keys = explode("\n", $this->data['old']['ssh_rsa']);
+
 		//* Remove all old keys
 		if(is_array($old_keys)) {
 			foreach($old_keys as $key => $val) {
-				$k = array_search(trim($val),$existing_keys);
+				$k = array_search(trim($val), $existing_keys);
 				unset($existing_keys[$k]);
 			}
 		}
-			
+
 		//* merge the remaining keys and the ones fom the ispconfig database.
 		if(is_array($new_keys)) {
 			$final_keys_arr = array_merge($existing_keys, $new_keys);
 		} else {
 			$final_keys_arr = $existing_keys;
 		}
-			
+
 		$new_final_keys_arr = array();
 		if(is_array($final_keys_arr) && !empty($final_keys_arr)){
 			foreach($final_keys_arr as $key => $val){
@@ -451,18 +455,19 @@ class shelluser_jailkit_plugin {
 			}
 		}
 		$final_keys = implode("\n", array_flip(array_flip($new_final_keys_arr)));
-			
-		// add the custom key 
+
+		// add the custom key
 		$app->system->file_put_contents($sshkeys, $final_keys);
 		$app->file->remove_blank_lines($sshkeys);
-		$this->app->log("ssh-rsa key updated in ".$sshkeys,LOGLEVEL_DEBUG);
-		
+		$this->app->log("ssh-rsa key updated in ".$sshkeys, LOGLEVEL_DEBUG);
+
 		// set proper file permissions
 		exec("chown -R ".escapeshellcmd($this->data['new']['puser']).":".escapeshellcmd($this->data['new']['pgroup'])." ".$sshdir);
 		exec("chmod 700 ".$sshdir);
 		exec("chmod 600 '$sshkeys'");
-		
+
 	}
+
 } // end class
 
 ?>
diff --git a/server/plugins-available/software_update_plugin.inc.php b/server/plugins-available/software_update_plugin.inc.php
index a6b71625f5996c91e533e6a5af99ee8604db764a..6f12bf890a96870f0240a4eb3ee45cf5bc26d755 100644
--- a/server/plugins-available/software_update_plugin.inc.php
+++ b/server/plugins-available/software_update_plugin.inc.php
@@ -29,87 +29,87 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class software_update_plugin {
-	
+
 	var $plugin_name = 'software_update_plugin';
 	var $class_name  = 'software_update_plugin';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	public function onInstall() {
 		global $conf;
-		
+
 		return true;
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	public function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('software_update_inst_insert',$this->plugin_name,'process');
+
+		$app->plugins->registerEvent('software_update_inst_insert', $this->plugin_name, 'process');
 		//$app->plugins->registerEvent('software_update_inst_update',$this->plugin_name,'process');
 		//$app->plugins->registerEvent('software_update_inst_delete',$this->plugin_name,'process');
-		
+
 		//* Register for actions
-		$app->plugins->registerAction('os_update',$this->plugin_name,'os_update');
-		
-		
+		$app->plugins->registerAction('os_update', $this->plugin_name, 'os_update');
+
+
 	}
-	
+
 	private function set_install_status($inst_id, $status) {
-        global $app;
-        
-        $app->db->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
-        $app->dbmaster->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
-    }
-    
-	public function process($event_name,$data) {
+		global $app;
+
+		$app->db->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
+		$app->dbmaster->query("UPDATE software_update_inst SET status = '{$status}' WHERE software_update_inst_id = '{$inst_id}'");
+	}
+
+	public function process($event_name, $data) {
 		global $app, $conf;
-		
+
 		//* Get the info of the package:
 		$software_update_id = intval($data["new"]["software_update_id"]);
 		$software_update = $app->db->queryOneRecord("SELECT * FROM software_update WHERE software_update_id = '$software_update_id'");
 		$software_package = $app->db->queryOneRecord("SELECT * FROM software_package WHERE package_name = '".$app->db->quote($software_update['package_name'])."'");
-		
+
 		if($software_package['package_type'] == 'ispconfig' && !$conf['software_updates_enabled'] == true) {
-			$app->log('Software Updates not enabled on this server. To enable updates, set $conf["software_updates_enabled"] = true; in config.inc.php',LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log('Software Updates not enabled on this server. To enable updates, set $conf["software_updates_enabled"] = true; in config.inc.php', LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
-		
+
 		$installuser = '';
 		if($software_package['package_type'] == 'ispconfig') {
 			$installuser = '';
 		} elseif ($software_package['package_type'] == 'app') {
 			$installuser = 'ispapps';
 		} else {
-			$app->log('package_type not supported',LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log('package_type not supported', LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
-		
-		$temp_dir = '/tmp/'.md5 (uniqid (rand()));
-		$app->log("The temp dir is $temp_dir",LOGLEVEL_DEBUG);
+
+		$temp_dir = '/tmp/'.md5(uniqid(rand()));
+		$app->log("The temp dir is $temp_dir", LOGLEVEL_DEBUG);
 		mkdir($temp_dir);
 		if($installuser != '') chown($temp_dir, $installuser);
-		
+
 		if(!is_dir($temp_dir)) {
-			$app->log("Unable to create temp directory.",LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log("Unable to create temp directory.", LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
-		
+
 		//* Replace placeholders in download URL
-		$software_update["update_url"] = str_replace('{key}',$software_package['package_key'],$software_update["update_url"]);
-		
+		$software_update["update_url"] = str_replace('{key}', $software_package['package_key'], $software_update["update_url"]);
+
 		//* Download the update package
 		$cmd = "cd $temp_dir && wget ".$software_update["update_url"];
 		if($installuser == '') {
@@ -117,46 +117,46 @@ class software_update_plugin {
 		} else {
 			exec("su -c ".escapeshellarg($cmd)." $installuser");
 		}
-		$app->log("Downloading the update file from: ".$software_update["update_url"],LOGLEVEL_DEBUG);
-		
+		$app->log("Downloading the update file from: ".$software_update["update_url"], LOGLEVEL_DEBUG);
+
 		//$url_parts = parse_url($software_update["update_url"]);
 		//$update_filename = basename($url_parts["path"]);
 		//* Find the name of the zip file which contains the app.
 		$tmp_dir_handle = dir($temp_dir);
 		$update_filename = '';
 		while (false !== ($t = $tmp_dir_handle->read())) {
-			if($t != '.' && $t != '..' && is_file($temp_dir.'/'.$t) && substr($t,-4) == '.zip') {
+			if($t != '.' && $t != '..' && is_file($temp_dir.'/'.$t) && substr($t, -4) == '.zip') {
 				$update_filename = $t;
 			}
 		}
 		$tmp_dir_handle->close();
 		unset($tmp_dir_handle);
 		unset($t);
-		
+
 		if($update_filename == '') {
-			$app->log("No package file found. Download failed? Installation aborted.",LOGLEVEL_WARN);
+			$app->log("No package file found. Download failed? Installation aborted.", LOGLEVEL_WARN);
 			exec("rm -rf $temp_dir");
-			$app->log("Deleting the temp directory $temp_dir",LOGLEVEL_DEBUG);
+			$app->log("Deleting the temp directory $temp_dir", LOGLEVEL_DEBUG);
 			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			return false;
 		}
 
-		$app->log("The update filename is $update_filename",LOGLEVEL_DEBUG);
-		
+		$app->log("The update filename is $update_filename", LOGLEVEL_DEBUG);
+
 		if(is_file($temp_dir.'/'.$update_filename)) {
-			
+
 			//* Checking the md5sum
 			if(md5_file($temp_dir.'/'.$update_filename) != $software_update["update_md5"]) {
-				$app->log("The md5 sum of the downloaded file is incorrect. Update aborted.",LOGLEVEL_WARN);
+				$app->log("The md5 sum of the downloaded file is incorrect. Update aborted.", LOGLEVEL_WARN);
 				exec("rm -rf $temp_dir");
-				$app->log("Deleting the temp directory $temp_dir",LOGLEVEL_DEBUG);
+				$app->log("Deleting the temp directory $temp_dir", LOGLEVEL_DEBUG);
 				$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 				return false;
 			} else {
-				$app->log("MD5 checksum of the downloaded file verified.",LOGLEVEL_DEBUG);
+				$app->log("MD5 checksum of the downloaded file verified.", LOGLEVEL_DEBUG);
 			}
-			
-			
+
+
 			//* unpacking the update
 			$cmd = "cd $temp_dir && unzip $update_filename";
 			if($installuser == '') {
@@ -164,133 +164,133 @@ class software_update_plugin {
 			} else {
 				exec("su -c ".escapeshellarg($cmd)." $installuser");
 			}
-			
+
 			//* Create a database, if the package requires one
 			if($software_package['package_type'] == 'app' && $software_package['package_requires_db'] == 'mysql') {
-				
+
 				$app->uses('ini_parser');
 				$package_config = $app->ini_parser->parse_ini_string(stripslashes($software_package['package_config']));
-				
+
 				$this->create_app_db($package_config['mysql']);
-				$app->log("Creating the app DB.",LOGLEVEL_DEBUG);
-				
+				$app->log("Creating the app DB.", LOGLEVEL_DEBUG);
+
 				//* Load the sql dump into the database
 				if(is_file($temp_dir.'/setup.sql')) {
 					$db_config = $package_config['mysql'];
-					if(	$db_config['database_user'] != '' &&
+					if( $db_config['database_user'] != '' &&
 						$db_config['database_password'] != '' &&
 						$db_config['database_name'] != '' &&
 						$db_config['database_host'] != '') {
 						system("mysql --default-character-set=utf8 --force -h '".$db_config['database_host']."' -u '".$db_config['database_user']."' ".$db_config['database_name']." < ".escapeshellcmd($temp_dir.'/setup.sql'));
-						$app->log("Loading setup.sql dump into the app db.",LOGLEVEL_DEBUG);
+						$app->log("Loading setup.sql dump into the app db.", LOGLEVEL_DEBUG);
 					}
 				}
-				
+
 			}
-			
+
 			//* Save the package config file as app.ini
 			if($software_package['package_config'] != '') {
-				file_put_contents($temp_dir.'/app.ini',$software_package['package_config']);
-				$app->log("Writing ".$temp_dir.'/app.ini',LOGLEVEL_DEBUG);
+				file_put_contents($temp_dir.'/app.ini', $software_package['package_config']);
+				$app->log("Writing ".$temp_dir.'/app.ini', LOGLEVEL_DEBUG);
 			}
-			
+
 			if(is_file($temp_dir.'/setup.sh')) {
 				// Execute the setup script
 				exec('chmod +x '.$temp_dir.'/setup.sh');
-				$app->log("Executing setup.sh file in directory $temp_dir",LOGLEVEL_DEBUG);
+				$app->log("Executing setup.sh file in directory $temp_dir", LOGLEVEL_DEBUG);
 				$cmd = 'cd '.$temp_dir.' && ./setup.sh > package_install.log';
 				if($installuser == '') {
 					exec($cmd);
 				} else {
 					exec("su -c ".escapeshellarg($cmd)." $installuser");
 				}
-                
-                $log_data = @file_get_contents("{$temp_dir}/package_install.log");
-                if(preg_match("'.*\[OK\]\s*$'is", $log_data)) {
-                    $app->log("Installation successful",LOGLEVEL_DEBUG);
-                    $app->log($log_data,LOGLEVEL_DEBUG);
-                    $this->set_install_status($data["new"]["software_update_inst_id"], "installed");
-                } else {
-                    $app->log("Installation failed:\n\n" . $log_data,LOGLEVEL_WARN);
-                    $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
-                }
+
+				$log_data = @file_get_contents("{$temp_dir}/package_install.log");
+				if(preg_match("'.*\[OK\]\s*$'is", $log_data)) {
+					$app->log("Installation successful", LOGLEVEL_DEBUG);
+					$app->log($log_data, LOGLEVEL_DEBUG);
+					$this->set_install_status($data["new"]["software_update_inst_id"], "installed");
+				} else {
+					$app->log("Installation failed:\n\n" . $log_data, LOGLEVEL_WARN);
+					$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+				}
 			} else {
-				$app->log("setup.sh file not found",LOGLEVEL_ERROR);
-                $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+				$app->log("setup.sh file not found", LOGLEVEL_ERROR);
+				$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 			}
 		} else {
-			$app->log("Download of the update file failed",LOGLEVEL_WARN);
-            $this->set_install_status($data["new"]["software_update_inst_id"], "failed");
+			$app->log("Download of the update file failed", LOGLEVEL_WARN);
+			$this->set_install_status($data["new"]["software_update_inst_id"], "failed");
 		}
-		
+
 		if($temp_dir != '' && $temp_dir != '/') exec("rm -rf $temp_dir");
-		$app->log("Deleting the temp directory $temp_dir",LOGLEVEL_DEBUG);
+		$app->log("Deleting the temp directory $temp_dir", LOGLEVEL_DEBUG);
 	}
-	
+
 	private function create_app_db($db_config) {
 		global $app, $conf;
-		
-		if(	$db_config['database_user'] != '' &&
+
+		if( $db_config['database_user'] != '' &&
 			$db_config['database_password'] != '' &&
 			$db_config['database_name'] != '' &&
 			$db_config['database_host'] != '') {
-			
-			if(!include(ISPC_LIB_PATH.'/mysql_clientdb.conf')) {
-				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf',LOGLEVEL_ERROR);
+
+			if(!include ISPC_LIB_PATH.'/mysql_clientdb.conf') {
+				$app->log('Unable to open'.ISPC_LIB_PATH.'/mysql_clientdb.conf', LOGLEVEL_ERROR);
 				return;
 			}
-			
+
 			if($db_config['database_user'] == 'root') {
-				$app->log('User root not allowed for App databases',LOGLEVEL_WARNING);
+				$app->log('User root not allowed for App databases', LOGLEVEL_WARNING);
 				return;
 			}
-		
+
 			//* Connect to the database
 			$link = mysql_connect($clientdb_host, $clientdb_user, $clientdb_password);
 			if (!$link) {
-				$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR);
 				return;
 			}
 
 			$query_charset_table = '';
 
 			//* Create the new database
-			if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($db_config['database_name']).$query_charset_table,$link)) {
-				$app->log('Created MySQL database: '.$db_config['database_name'],LOGLEVEL_DEBUG);
+			if (mysql_query('CREATE DATABASE '.mysql_real_escape_string($db_config['database_name']).$query_charset_table, $link)) {
+				$app->log('Created MySQL database: '.$db_config['database_name'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to connect to the database'.mysql_error($link),LOGLEVEL_ERROR);
+				$app->log('Unable to connect to the database'.mysql_error($link), LOGLEVEL_ERROR);
 			}
-			
-			if(mysql_query("GRANT ALL ON ".mysql_real_escape_string($db_config['database_name'],$link).".* TO '".mysql_real_escape_string($db_config['database_user'],$link)."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysql_real_escape_string($db_config['database_password'],$link)."';",$link)) {
-			$app->log('Created MySQL user: '.$db_config['database_user'],LOGLEVEL_DEBUG);
+
+			if(mysql_query("GRANT ALL ON ".mysql_real_escape_string($db_config['database_name'], $link).".* TO '".mysql_real_escape_string($db_config['database_user'], $link)."'@'".$db_config['database_host']."' IDENTIFIED BY '".mysql_real_escape_string($db_config['database_password'], $link)."';", $link)) {
+				$app->log('Created MySQL user: '.$db_config['database_user'], LOGLEVEL_DEBUG);
 			} else {
-				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysql_error($link),LOGLEVEL_ERROR);
+				$app->log('Unable to create database user'.$db_config['database_user'].' '.mysql_error($link), LOGLEVEL_ERROR);
 			}
 
-			mysql_query("FLUSH PRIVILEGES;",$link);
+			mysql_query("FLUSH PRIVILEGES;", $link);
 			mysql_close($link);
-			
+
 		}
-		
+
 	}
-	
+
 	//* Operating system update
-	public function os_update($action_name,$data) {
+	public function os_update($action_name, $data) {
 		global $app;
-		 
+
 		//** Debian and compatible Linux distributions
 		if(file_exists('/etc/debian_version')) {
 			exec("aptitude update");
 			exec("aptitude safe-upgrade -y");
-			$app->log('Execeuted Debian / Ubuntu update',LOGLEVEL_DEBUG);
+			$app->log('Execeuted Debian / Ubuntu update', LOGLEVEL_DEBUG);
 		}
 
 		//** Gentoo Linux
 		if(file_exists('/etc/gentoo-release')) {
 			exec("glsa-check -f --nocolor affected");
-			$app->log('Execeuted Gentoo update',LOGLEVEL_DEBUG);
+			$app->log('Execeuted Gentoo update', LOGLEVEL_DEBUG);
 		}
-		
+
 		return 'ok';
 	}
 
diff --git a/server/plugins-available/squid_plugin.inc.php b/server/plugins-available/squid_plugin.inc.php
index 7e65b291cefa49928f2fba39305e9435afb0e31c..ef7751286e074acffb33d29858049c68ccb180d5 100644
--- a/server/plugins-available/squid_plugin.inc.php
+++ b/server/plugins-available/squid_plugin.inc.php
@@ -29,110 +29,110 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class squid_plugin {
-	
+
 	var $plugin_name = 'squid_plugin';
 	var $class_name = 'squid_plugin';
-	
+
 	// private variables
 	var $action = '';
-	
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
+
 		if(isset($conf['services']['proxy']) &&$conf['services']['proxy'] == true && isset($conf['squid']['installed']) && $conf['squid']['installed'] == true) {
 			return true;
 		} else {
 			return false;
 		}
-		
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		
-		$app->plugins->registerEvent('proxy_reverse_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('proxy_reverse_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('proxy_reverse_delete',$this->plugin_name,'delete');
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
-		$app->plugins->registerEvent('web_domain_delete',$this->plugin_name,'delete');
-		
-
-		
+
+
+		$app->plugins->registerEvent('proxy_reverse_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('proxy_reverse_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('proxy_reverse_delete', $this->plugin_name, 'delete');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
+		$app->plugins->registerEvent('web_domain_delete', $this->plugin_name, 'delete');
+
+
+
 	}
-	
-	
-	
-	
-	function insert($event_name,$data) {
+
+
+
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
-		
+
+
 		// just run the update function
-		$this->update($event_name,$data);
-		
-		
+		$this->update($event_name, $data);
+
+
 	}
-	
-	
-	function update($event_name,$data) {
+
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		$domains = $this->_getSquidDomains($app);
 		$rules = $this->_getSquidRewriteRules($app);
-		
+
 		$app->load('tpl');
 		$tpl = new tpl();
 		$tpl->newTemplate("squidRewriteRules.py.master");
-		if (!empty($rules))$tpl->setLoop('squid_rewrite_rules',$rules);
-		file_put_contents('/etc/squid/squidRewriteRules.py',$tpl->grab());
+		if (!empty($rules))$tpl->setLoop('squid_rewrite_rules', $rules);
+		file_put_contents('/etc/squid/squidRewriteRules.py', $tpl->grab());
 		unset($tpl);
-		$app->log('Writing squid rewrite configuration to /etc/squid/squidRewriteRules.py',LOGLEVEL_DEBUG);
-		
-		
+		$app->log('Writing squid rewrite configuration to /etc/squid/squidRewriteRules.py', LOGLEVEL_DEBUG);
+
+
 		$tpl = new tpl();
 		$tpl->newTemplate("domains.txt.master");
-		$tpl->setLoop('squid_domains',$domains);
-		file_put_contents('/etc/squid/domains.txt',$tpl->grab());
+		$tpl->setLoop('squid_domains', $domains);
+		file_put_contents('/etc/squid/domains.txt', $tpl->grab());
 		unset($tpl);
-		$app->log('Writing squid domains configuration to /etc/squid/domains.txt',LOGLEVEL_DEBUG);
-		
-		
+		$app->log('Writing squid domains configuration to /etc/squid/domains.txt', LOGLEVEL_DEBUG);
+
+
 		// request a httpd reload when all records have been processed
-		$app->services->restartServiceDelayed('squid','restart');
-		
+		$app->services->restartServiceDelayed('squid', 'restart');
+
 	}
-	
-	function delete($event_name,$data) {
+
+	function delete($event_name, $data) {
 		global $app, $conf;
-		
+
 		// load the server configuration options
 
 		// just run the update function
-		$this->update($event_name,$data);
-		
+		$this->update($event_name, $data);
+
 	}
-	
+
 	function _getSquidDomains($app)
 	{
 		$records = $app->dbmaster->queryAllRecords("SELECT ds.origin, dr.name, IF(origin=name,true,false) AS isRoot FROM dns_soa ds inner join dns_rr dr ON ds.id=dr.zone WHERE ds.active='Y' AND dr.type IN ('A','CNAME') AND dr.name NOT IN ('mail','ns1')");
 		$domains = array();
 		foreach ($records as $record) {
-			
-			$origin = substr($record["origin"],0,-1);
+
+			$origin = substr($record["origin"], 0, -1);
 			if ($record["isRoot"])
 			{
 				array_push($domains, array("domain" => $origin));
@@ -141,30 +141,30 @@ class squid_plugin {
 			}
 
 		}
-		
+
 		return $domains;
-		
+
 	}
-	
+
 	function _getSquidRewriteRules($app)
 	{
 		$rules = array();
-		
-		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dest FROM squid_reverse ORDER BY rewrite_id ASC");		
+
+		$rules = $app->db->queryAllRecords("SELECT rewrite_url_src, rewrite_url_dest FROM squid_reverse ORDER BY rewrite_id ASC");
 		$web_domains = $app->db->queryAllRecords("SELECT wd.subdomain, wd.domain, si.ip_address  FROM web_domain wd INNER JOIN server s USING(server_id) INNER JOIN server_ip si USING(server_id)");
-		
+
 		foreach ($web_domains as $domain) {
 			if ($domain["subdomain"] == "www") {
-				array_push($rules,array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)","rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
-				array_push($rules,array("rewrite_url_src"=>"^http://".$domain["domain"]."/(.*)","rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));		
+				array_push($rules, array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)", "rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
+				array_push($rules, array("rewrite_url_src"=>"^http://".$domain["domain"]."/(.*)", "rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
 			}  else {
-				array_push($rules,array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)","rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
-			}	
+				array_push($rules, array("rewrite_url_src"=>"^http://www.".$domain["domain"]."/(.*)", "rewrite_url_dest"=>"http://".$domain["ip_address"].":80/"));
+			}
 		}
 		return $rules;
 	}
 
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/webmail_symlink_plugin.inc.php b/server/plugins-available/webmail_symlink_plugin.inc.php
index 8530fc4e90df438e92cd8a06e1a256ff774e2a3a..43cca9b357956e4fe65eefbc47046e21e006fb10 100644
--- a/server/plugins-available/webmail_symlink_plugin.inc.php
+++ b/server/plugins-available/webmail_symlink_plugin.inc.php
@@ -3,7 +3,7 @@
 /*
 Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
 All rights reserved.
-Modification (c) 2009, Marius Cramer, pixcept KG 
+Modification (c) 2009, Marius Cramer, pixcept KG
 
 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
@@ -30,91 +30,91 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 class webmail_symlink_plugin {
-	
+
 	var $plugin_name = 'webmail_symlink_plugin';
 	var $class_name = 'webmail_symlink_plugin';
-	
-    var $action;
-    
+
+	var $action;
+
 	//* This function is called during ispconfig installation to determine
 	//  if a symlink shall be created for this plugin.
 	function onInstall() {
 		global $conf;
-		
-        return false;
-		
+
+		return false;
+
 	}
-	
-		
+
+
 	/*
 	 	This function is called when the plugin is loaded
 	*/
-	
+
 	function onLoad() {
 		global $app;
-		
+
 		/*
 		Register for the events
 		*/
-		
-		$app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
-		$app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
+
+		$app->plugins->registerEvent('web_domain_insert', $this->plugin_name, 'insert');
+		$app->plugins->registerEvent('web_domain_update', $this->plugin_name, 'update');
 	}
-	
-	function insert($event_name,$data) {
+
+	function insert($event_name, $data) {
 		global $app, $conf;
-		
+
 		$this->action = 'insert';
 		// just run the update function
-		$this->update($event_name,$data);
+		$this->update($event_name, $data);
 	}
-	
-	function update($event_name,$data) {
+
+	function update($event_name, $data) {
 		global $app, $conf;
-		
+
 		if($this->action != 'insert') $this->action = 'update';
-		
+
 		if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) {
-			
+
 			$old_parent_domain_id = intval($data["old"]["parent_domain_id"]);
 			$new_parent_domain_id = intval($data["new"]["parent_domain_id"]);
-			
+
 			// If the parent_domain_id has been chenged, we will have to update the old site as well.
 			if($this->action == 'update' && $data["new"]["parent_domain_id"] != $data["old"]["parent_domain_id"]) {
 				$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$old_parent_domain_id." AND active = 'y'");
 				$data["new"] = $tmp;
 				$data["old"] = $tmp;
 				$this->action = 'update';
-				$this->update($event_name,$data);
+				$this->update($event_name, $data);
 			}
-			
+
 			// This is not a vhost, so we need to update the parent record instead.
 			$tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$new_parent_domain_id." AND active = 'y'");
 			$data["new"] = $tmp;
 			$data["old"] = $tmp;
 			$this->action = 'update';
 		}
-		
+
 		if($data["new"]["document_root"] == '') {
-			$app->log("document_root not set",LOGLEVEL_WARN);
+			$app->log("document_root not set", LOGLEVEL_WARN);
 			return 0;
 		}
-		
-        $symlink = true;
-        if($data["new"]["php"] == "suphp") $symlink = false;
-        elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
-        
-        
-        if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
-        if($symlink == false) {
-            if(is_link($data["new"]["document_root"].'/web/webmail')) unlink($data["new"]["document_root"].'/web/webmail');
-        } else {
-            if(!is_link($data["new"]["document_root"]."/web/webmail")) symlink('/var/www/webmail',$data["new"]["document_root"].'/web/webmail');
-            else symlink('/var/www/webmail',$data["new"]["document_root"].'/web/webmail');
-        }
+
+		$symlink = true;
+		if($data["new"]["php"] == "suphp") $symlink = false;
+		elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+		elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
+
+
+		if(!is_dir($data["new"]["document_root"]."/web")) mkdir($data["new"]["document_root"].'/web', 0755, true);
+		if($symlink == false) {
+			if(is_link($data["new"]["document_root"].'/web/webmail')) unlink($data["new"]["document_root"].'/web/webmail');
+		} else {
+			if(!is_link($data["new"]["document_root"]."/web/webmail")) symlink('/var/www/webmail', $data["new"]["document_root"].'/web/webmail');
+			else symlink('/var/www/webmail', $data["new"]["document_root"].'/web/webmail');
+		}
 	}
-	
+
 
 } // end class
 
diff --git a/server/plugins-available/webserver_plugin.inc.php b/server/plugins-available/webserver_plugin.inc.php
index 0fcdf13c16144561540590183d8a8c28f8cc0df8..dd5a50b0561012f5fc072c391e08f4f30e7b0041 100644
--- a/server/plugins-available/webserver_plugin.inc.php
+++ b/server/plugins-available/webserver_plugin.inc.php
@@ -32,14 +32,16 @@ class webserver_plugin {
 
 	var $plugin_name = 'webserver_plugin';
 	var $class_name = 'webserver_plugin';
-	
+
 	/**
 	 * This function is called during ispconfig installation to determine
 	 * if a symlink shall be created for this plugin.
 	 */
+
+
 	public function onInstall() {
 		global $conf;
-        
+
 		if($conf['services']['web'] == true) {
 			return true;
 		} else {
@@ -53,7 +55,7 @@ class webserver_plugin {
 	public function onLoad() {
 		global $app;
 
-        $app->plugins->registerAction('server_plugins_loaded', $this->plugin_name, 'check_phpini_changes');
+		$app->plugins->registerAction('server_plugins_loaded', $this->plugin_name, 'check_phpini_changes');
 	}
 
 	/**
@@ -69,98 +71,99 @@ class webserver_plugin {
 	 */
 	public function check_phpini_changes() {
 		global $app, $conf;
-		
-        //** check if the main php.ini of the system changed so we need to regenerate all custom php.inis
-        $app->uses('getconf');
-        
-        //** files to check
-        $check_files = array();
-        
-        $web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
-        $fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
-        
-        if($web_config['php_ini_check_minutes'] == 0 || @date('i') % $web_config['php_ini_check_minutes'] != 0) {
-            $app->log('Info: php.ini change checking not enabled or not in this minute: ' . $web_config['php_ini_check_minutes'],LOGLEVEL_DEBUG);
-            return; // do not process
-        }
-        
-        //** add default php.ini files to check
-        $check_files[] = array('file' => $web_config['php_ini_path_apache'],
-                               'mode' => 'mod',
-                               'php_version' => ''); // default;
-        
-        $check_files[] = array('file' => $web_config['php_ini_path_cgi'],
-                               'mode' => '', // all but 'mod' and 'fast-cgi'
-                               'php_version' => ''); // default;
-        
-        if($fastcgi_config["fastcgi_phpini_path"] && $fastcgi_config["fastcgi_phpini_path"] != $web_config['php_ini_path_cgi']) {
-            $check_files[] = array('file' => $fastcgi_config["fastcgi_phpini_path"],
-                                   'mode' => 'fast-cgi',
-                                   'php_version' => ''); // default;
-        } else {
-            $check_files[] = array('file' => $web_config['php_ini_path_cgi'],
-                                   'mode' => 'fast-cgi', // all but 'mod'
-                                   'php_version' => ''); // default;
-        }
-        
-        
-        //** read additional php versions of this server
-        $php_versions = $app->db->queryAllRecords('SELECT server_php_id, php_fastcgi_ini_dir, php_fpm_ini_dir FROM server_php WHERE server_id = ' . intval($conf['server_id']));
-        foreach($php_versions as $php) {
-            if($php['php_fastcgi_ini_dir'] && $php['php_fastcgi_ini_dir'] . '/php.ini' != $web_config['php_ini_path_cgi']) {
-                $check_files[] = array('file' => $php['php_fastcgi_ini_dir'] . '/php.ini',
-                                       'mode' => 'fast-cgi',
-                                       'php_version' => $php['php_fastcgi_ini_dir']);
-            } elseif($php['php_fpm_ini_dir'] && $php['php_fpm_ini_dir'] . '/php.ini' != $web_config['php_ini_path_cgi']) {
-                $check_files[] = array('file' => $php['php_fpm_ini_dir'] . '/php.ini',
-                                       'mode' => 'php-fpm',
-                                       'php_version' => $php['php_fpm_ini_dir']);
-            }
-        }
-        unset($php_versions);
-        
-        //** read md5sum status file
-        $new_php_ini_md5 = array();
-        $php_ini_md5 = array();
-        $php_ini_changed = false;
-        $rewrite_ini_files = false;
-        
-        if(file_exists(SCRIPT_PATH . '/temp/php.ini.md5sum')) {
-            $rewrite_ini_files = true;
-            $php_ini_md5 = unserialize(base64_decode(trim($app->system->file_get_contents(SCRIPT_PATH . '/temp/php.ini.md5sum'))));
-        }
-        if(!is_array($php_ini_md5)) $php_ini_md5 = array();
-        
-        $processed = array();
-        foreach($check_files as $file) {
-            $file_path = $file['file'];
-            if(substr($file_path, -8) !== '/php.ini') $file_path .= (substr($file_path, -1) !== '/' ? '/' : '') . 'php.ini';
-            if(!file_exists($file_path)) continue;
-            
-            //** check if this php.ini file was already processed (if additional php version uses same php.ini)
-            $ident = $file_path . '::' . $file['mode'] . '::' . $file['php_version'];
-            if(in_array($ident, $processed) == true) continue;
-            $processed[] = $ident;
-            
-            //** check if md5sum of file changed
-            $file_md5 = md5_file($file_path);
-            if(array_key_exists($file_path, $php_ini_md5) == false || $php_ini_md5[$file_path] != $file_md5) {
-                $php_ini_changed = true;
-                
-                $app->log('Info: PHP.ini changed: ' . $file_path . ', mode ' . $file['mode'] . ' vers ' . $file['php_version'] . '.',LOGLEVEL_DEBUG);
-                // raise action for this file
-                if($rewrite_ini_files == true) $app->plugins->raiseAction('php_ini_changed', $file);
-            }
-            
-            $new_php_ini_md5[$file_path] = $file_md5;
-        }
-        
-        //** write new md5 sums if something changed
-        if($php_ini_changed == true) $app->system->file_put_contents(SCRIPT_PATH . '/temp/php.ini.md5sum', base64_encode(serialize($new_php_ini_md5)));
-        unset($new_php_ini_md5);
-        unset($php_ini_md5);
-        unset($processed);
+
+		//** check if the main php.ini of the system changed so we need to regenerate all custom php.inis
+		$app->uses('getconf');
+
+		//** files to check
+		$check_files = array();
+
+		$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
+		$fastcgi_config = $app->getconf->get_server_config($conf['server_id'], 'fastcgi');
+
+		if($web_config['php_ini_check_minutes'] == 0 || @date('i') % $web_config['php_ini_check_minutes'] != 0) {
+			$app->log('Info: php.ini change checking not enabled or not in this minute: ' . $web_config['php_ini_check_minutes'], LOGLEVEL_DEBUG);
+			return; // do not process
+		}
+
+		//** add default php.ini files to check
+		$check_files[] = array('file' => $web_config['php_ini_path_apache'],
+			'mode' => 'mod',
+			'php_version' => ''); // default;
+
+		$check_files[] = array('file' => $web_config['php_ini_path_cgi'],
+			'mode' => '', // all but 'mod' and 'fast-cgi'
+			'php_version' => ''); // default;
+
+		if($fastcgi_config["fastcgi_phpini_path"] && $fastcgi_config["fastcgi_phpini_path"] != $web_config['php_ini_path_cgi']) {
+			$check_files[] = array('file' => $fastcgi_config["fastcgi_phpini_path"],
+				'mode' => 'fast-cgi',
+				'php_version' => ''); // default;
+		} else {
+			$check_files[] = array('file' => $web_config['php_ini_path_cgi'],
+				'mode' => 'fast-cgi', // all but 'mod'
+				'php_version' => ''); // default;
+		}
+
+
+		//** read additional php versions of this server
+		$php_versions = $app->db->queryAllRecords('SELECT server_php_id, php_fastcgi_ini_dir, php_fpm_ini_dir FROM server_php WHERE server_id = ' . intval($conf['server_id']));
+		foreach($php_versions as $php) {
+			if($php['php_fastcgi_ini_dir'] && $php['php_fastcgi_ini_dir'] . '/php.ini' != $web_config['php_ini_path_cgi']) {
+				$check_files[] = array('file' => $php['php_fastcgi_ini_dir'] . '/php.ini',
+					'mode' => 'fast-cgi',
+					'php_version' => $php['php_fastcgi_ini_dir']);
+			} elseif($php['php_fpm_ini_dir'] && $php['php_fpm_ini_dir'] . '/php.ini' != $web_config['php_ini_path_cgi']) {
+				$check_files[] = array('file' => $php['php_fpm_ini_dir'] . '/php.ini',
+					'mode' => 'php-fpm',
+					'php_version' => $php['php_fpm_ini_dir']);
+			}
+		}
+		unset($php_versions);
+
+		//** read md5sum status file
+		$new_php_ini_md5 = array();
+		$php_ini_md5 = array();
+		$php_ini_changed = false;
+		$rewrite_ini_files = false;
+
+		if(file_exists(SCRIPT_PATH . '/temp/php.ini.md5sum')) {
+			$rewrite_ini_files = true;
+			$php_ini_md5 = unserialize(base64_decode(trim($app->system->file_get_contents(SCRIPT_PATH . '/temp/php.ini.md5sum'))));
+		}
+		if(!is_array($php_ini_md5)) $php_ini_md5 = array();
+
+		$processed = array();
+		foreach($check_files as $file) {
+			$file_path = $file['file'];
+			if(substr($file_path, -8) !== '/php.ini') $file_path .= (substr($file_path, -1) !== '/' ? '/' : '') . 'php.ini';
+			if(!file_exists($file_path)) continue;
+
+			//** check if this php.ini file was already processed (if additional php version uses same php.ini)
+			$ident = $file_path . '::' . $file['mode'] . '::' . $file['php_version'];
+			if(in_array($ident, $processed) == true) continue;
+			$processed[] = $ident;
+
+			//** check if md5sum of file changed
+			$file_md5 = md5_file($file_path);
+			if(array_key_exists($file_path, $php_ini_md5) == false || $php_ini_md5[$file_path] != $file_md5) {
+				$php_ini_changed = true;
+
+				$app->log('Info: PHP.ini changed: ' . $file_path . ', mode ' . $file['mode'] . ' vers ' . $file['php_version'] . '.', LOGLEVEL_DEBUG);
+				// raise action for this file
+				if($rewrite_ini_files == true) $app->plugins->raiseAction('php_ini_changed', $file);
+			}
+
+			$new_php_ini_md5[$file_path] = $file_md5;
+		}
+
+		//** write new md5 sums if something changed
+		if($php_ini_changed == true) $app->system->file_put_contents(SCRIPT_PATH . '/temp/php.ini.md5sum', base64_encode(serialize($new_php_ini_md5)));
+		unset($new_php_ini_md5);
+		unset($php_ini_md5);
+		unset($processed);
 	}
+
 }
 
 ?>
diff --git a/server/scripts/ispconfig_update.php b/server/scripts/ispconfig_update.php
index 58d8ef5b8a551372467bde7a5d2e0ffe047f0a1a..6843e7bde28b1aee47b241fea8fbc691b67dee46 100644
--- a/server/scripts/ispconfig_update.php
+++ b/server/scripts/ispconfig_update.php
@@ -29,8 +29,8 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 function sread() {
-    $input = fgets(STDIN);
-    return rtrim($input);
+	$input = fgets(STDIN);
+	return rtrim($input);
 }
 
 function swrite($text = '') {
@@ -42,53 +42,53 @@ function swriteln($text = '') {
 }
 
 function simple_query($query, $answers, $default)
-{		
-		$finished = false;
-		do {
-			$answers_str = implode(',', $answers);
-			swrite($query.' ('.$answers_str.') ['.$default.']: ');
-			$input = sread();
-			
-			//* Stop the installation
-			if($input == 'quit') {
-				swriteln("Installation terminated by user.\n");
-				die();
-			}
-			
-			//* Select the default
-			if($input == '') {
-				$answer = $default;
-				$finished = true;
-			}
-			
-            //* Set answer id valid
-			if(in_array($input, $answers)) {
-				$answer = $input;
-				$finished = true;
-			}
-			
-		} while ($finished == false);
-		swriteln();
-		return $answer;
+{
+	$finished = false;
+	do {
+		$answers_str = implode(',', $answers);
+		swrite($query.' ('.$answers_str.') ['.$default.']: ');
+		$input = sread();
+
+		//* Stop the installation
+		if($input == 'quit') {
+			swriteln("Installation terminated by user.\n");
+			die();
+		}
+
+		//* Select the default
+		if($input == '') {
+			$answer = $default;
+			$finished = true;
+		}
+
+		//* Set answer id valid
+		if(in_array($input, $answers)) {
+			$answer = $input;
+			$finished = true;
+		}
+
+	} while ($finished == false);
+	swriteln();
+	return $answer;
 }
 
-require_once('/usr/local/ispconfig/server/lib/config.inc.php');
+require_once '/usr/local/ispconfig/server/lib/config.inc.php';
 
 
-echo "\n\n".str_repeat('-',80)."\n";
-echo " _____ ___________   _____              __ _       
-|_   _/  ___| ___ \ /  __ \            / _(_)      
-  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _ 
+echo "\n\n".str_repeat('-', 80)."\n";
+echo " _____ ___________   _____              __ _
+|_   _/  ___| ___ \ /  __ \            / _(_)
+  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _
   | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |
  _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| |
  \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, |
                                               __/ |
                                              |___/ ";
-echo "\n".str_repeat('-',80)."\n";
+echo "\n".str_repeat('-', 80)."\n";
 echo "\n\n>> Update  \n\n";
 echo "Please choose the update method. For production systems select 'stable'. \nThe update from svn is only for development systems and may break your current setup.\nNote: Update all slave server, before you update master server.\n\n";
 
-$method = simple_query('Select update method', array('stable','svn'), 'stable');
+$method = simple_query('Select update method', array('stable', 'svn'), 'stable');
 
 if($method == 'stable') {
 	$new_version = @file_get_contents('http://www.ispconfig.org/downloads/ispconfig3_version.txt') or die('Unable to retrieve version file.');
@@ -106,4 +106,4 @@ if($method == 'stable') {
 
 
 
-?>
\ No newline at end of file
+?>
diff --git a/server/server.php b/server/server.php
index 2ead4904321edc18ad2ad9e7cbf864a4d1a968e5..60251e3c84dc35082ac260b480e20583535cb68f 100644
--- a/server/server.php
+++ b/server/server.php
@@ -28,8 +28,8 @@
  */
 
 define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
-require(SCRIPT_PATH."/lib/config.inc.php");
-require(SCRIPT_PATH."/lib/app.inc.php");
+require SCRIPT_PATH."/lib/config.inc.php";
+require SCRIPT_PATH."/lib/app.inc.php";
 
 set_time_limit(0);
 ini_set('error_reporting', E_ALL & ~E_NOTICE);
@@ -42,16 +42,16 @@ $conf['server_id'] = intval($conf['server_id']);
  */
 if ($app->dbmaster->connect_error == NULL) {
 	$server_db_record = $app->dbmaster->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']);
-	
+
 	if(!is_array($server_db_record)) die('Unable to load the server configuration from database.');
-	
-	//* Get the number of the last processed datalog_id, if the id of the local server 
+
+	//* Get the number of the last processed datalog_id, if the id of the local server
 	//* is > then the one of the remote system, then use the local ID as we might not have
 	//* reached the remote server during the last run then.
 	$local_server_db_record = $app->db->queryOneRecord("SELECT * FROM server WHERE server_id = " . $conf['server_id']);
-	$conf['last_datalog_id'] = (int) max($server_db_record['updated'],$local_server_db_record['updated']);
+	$conf['last_datalog_id'] = (int) max($server_db_record['updated'], $local_server_db_record['updated']);
 	unset($local_server_db_record);
-	
+
 	$conf['mirror_server_id'] = (int) $server_db_record['mirror_server_id'];
 
 	// Load the ini_parser
@@ -62,21 +62,21 @@ if ($app->dbmaster->connect_error == NULL) {
 
 	// 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");
 	$sys_ini = $app->db->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)
 	 */
@@ -87,14 +87,14 @@ if ($app->dbmaster->connect_error == NULL) {
 
 	// protect the file
 	chmod(dirname(__FILE__) . "/temp/rescue_module_serverconfig.ser.txt", 0600);
-	
+
 } else {
 	/*
 	 * The master-db is not available.
 	 * Problem: because we need to start the rescue-module (to rescue the DB if this IS the
 	 * server, the master-db is running at) we have to initialize some config...
 	 */
-	
+
 	/*
 	 * If there is a temp-file with the data we could get from the database, then we use it
 	 */
@@ -102,14 +102,14 @@ if ($app->dbmaster->connect_error == NULL) {
 	if (file_exists(dirname(__FILE__) . "/temp/rescue_module_serverconfig.ser.txt")){
 		$tmp = unserialize(file_get_contents(dirname(__FILE__) . "/temp/rescue_module_serverconfig.ser.txt"));
 	}
-	
+
 	// maxint at 32 and 64 bit systems
-	$conf['last_datalog_id'] = intval('9223372036854775807'); 
+	$conf['last_datalog_id'] = intval('9223372036854775807');
 
 	// no mirror
-	$conf['mirror_server_id'] = 0; 
+	$conf['mirror_server_id'] = 0;
 
-	// Set the loglevel 
+	// Set the loglevel
 	$conf['log_priority'] = (isset($tmp['serverconfig']['server']['loglevel']))? $tmp['serverconfig']['server']['loglevel'] : LOGLEVEL_ERROR;
 	/*
 	 * Set the configuration to rescue the database
@@ -147,6 +147,8 @@ if (is_file($conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock')) {
 $app->log('Set Lock: ' . $conf['temppath'] . $conf['fs_div'] . '.ispconfig_lock', LOGLEVEL_DEBUG);
 
 /** Do we need to start the core-modules */
+
+
 $needStartCore = true;
 
 /*
@@ -163,16 +165,16 @@ if ($app->db->connect_error == NULL && $app->dbmaster->connect_error == NULL) {
 
 	$tmp_num_records = $tmp_rec['number'];
 	unset($tmp_rec);
-	
+
 	//** Load required base-classes
 	$app->uses('modules,plugins,file,services,system');
 	//** Load the modules that are in the mods-enabled folder
 	$app->modules->loadModules('all');
 	//** Load the plugins that are in the plugins-enabled folder
 	$app->plugins->loadPlugins('all');
-	
+
 	$app->plugins->raiseAction('server_plugins_loaded', '');
-	
+
 	if ($tmp_num_records > 0) {
 		$app->log("Found $tmp_num_records changes, starting update process.", LOGLEVEL_DEBUG);
 		//** Go through the sys_datalog table and call the processing functions
@@ -185,7 +187,7 @@ if ($app->db->connect_error == NULL && $app->dbmaster->connect_error == NULL) {
 	$app->services->processDelayedActions();
 	//** All modules are already loaded and processed, so there is NO NEED to load the core once again...
 	$needStartCore = false;
-	
+
 } else {
 	if ($app->db->connect->connect_error == NULL) {
 		$app->log('Unable to connect to local server.' . $app->db->errorMessage, LOGLEVEL_WARN);