From 512f11d01b3a1c3b94e030091f047596f05639b2 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 10 Aug 2012 08:49:07 +0000
Subject: [PATCH] - Fixed: FS#2292 - monitor_tools.inc.php uses /var/vmail and
 not the mail directory specified in server config - Changed code comment in
 login/index.php file.

---
 interface/web/login/index.php            | 2 +-
 server/lib/classes/monitor_tools.inc.php | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/interface/web/login/index.php b/interface/web/login/index.php
index 101442a909..65b2362303 100644
--- a/interface/web/login/index.php
+++ b/interface/web/login/index.php
@@ -111,7 +111,7 @@ class login_index {
 	        	//* 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);
-	        	//* login to much wrong
+	        	//* too many failedlogins
 	        	if($alreadyfailed['times'] > 5) {
 	        		$error = $app->lng('error_user_too_many_logins');
 	        	} else {
diff --git a/server/lib/classes/monitor_tools.inc.php b/server/lib/classes/monitor_tools.inc.php
index e81c2de922..1913037ae4 100644
--- a/server/lib/classes/monitor_tools.inc.php
+++ b/server/lib/classes/monitor_tools.inc.php
@@ -238,18 +238,18 @@ class monitor_tools {
 		//* The state of the email_quota.
 		$state = 'ok';
 		
-		$mailboxes = $app->db->queryAllRecords("SELECT email FROM mail_user WHERE server_id = $server_id");
+		$mailboxes = $app->db->queryAllRecords("SELECT email,maildir FROM mail_user WHERE server_id = $server_id");
 		if(is_array($mailboxes)) {
 			foreach($mailboxes as $mb) {
 				$email = $mb['email'];
 				$email_parts = explode('@',$mb['email']);
-				$filename = '/var/vmail/'.$email_parts[1].'/'.$email_parts[0].'/.quotausage';
-				if(file_exists($filename)) {
+				$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('/var/vmail/'.$email_parts[1].'/'.$email_parts[0]),$out);
+					exec('du -s '.escapeshellcmd($mb['maildir']),$out);
 					$parts = explode(' ',$out[0]);
 					$data[$email]['used'] = intval($parts[0])*1024;
 					unset($out);
-- 
GitLab