diff -ru postfixamin-2.3.2/create-mailbox.php ./create-mailbox.php
--- ./create-mailbox.php 2010-05-18 00:56:23.000000000 +0200
+++ ./create-mailbox.php 2010-10-12 16:58:07.103049751 +0200
@@ -133,7 +133,7 @@
if ($CONF['quota'] == "YES")
{
- if (!check_quota ($fQuota, $fDomain))
+ if (!check_quota ($fQuota, $fUsername, $fDomain))
{
$error = 1;
$tUsername = escape_string ($_POST['fUsername']);
diff -ru postfixadmin-2.3.2/functions.inc.php ./functions.inc.php
--- ./functions.inc.php 2010-08-22 23:41:31.000000000 +0200
+++ ./functions.inc.php 2010-10-12 17:02:05.758725599 +0200
@@ -665,13 +665,33 @@
}
+//
+// get_mailbox_quota
+// Action: Get mailbox quota
+// Call: get_mailbox_quota (string mailbox)
+//
+function get_mailbox_quota ($mailbox)
+{
+ global $CONF;
+ $list = array ();
+ $result = db_query ("SELECT quota FROM mailbox WHERE username='$mailbox'");
+ $row = db_row ($result['result']);
+ if ( $row[0] == "" ) {
+ $mailbox_quota = "0";
+ } else {
+ $mailbox_quota = $row[0] / $CONF['quota_multiplier'];
+ }
+ return $mailbox_quota;
+}
+
+
//
// check_quota
// Action: Checks if the user is creating a mailbox with the correct quota
// Call: check_quota (string domain)
//
-function check_quota ($quota, $domain)
+function check_quota ($quota, $mailbox, $domain)
{
$limit = get_domain_properties ($domain);
if ($limit['maxquota'] == 0)
@@ -686,7 +706,8 @@
{
return false;
}
- if ($quota > $limit['maxquota'])
+ #if ($quota > $limit['maxquota'])
+ if ($quota > ($limit['maxquota']-$limit['used_quota']+get_mailbox_quota($mailbox)))
{
return false;
}
--- edit-mailbox.php 2010-10-12 17:31:19.000000000 +0200
+++ /tmp/admin/edit-mailbox.php 2008-12-12 20:40:39.000000000 +0100
@@ -98,7 +98,6 @@
if (isset ($_POST['fQuota'])) $fQuota = intval ($_POST['fQuota']);
if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']);
+ if( strlen($fPassword2) != 0) {
if($fPassword != $user_details['password'] || $fPassword2 != $user_details['password']){
$min_length = $CONF['min_password_length'];
@@ -116,10 +115,9 @@
$error = 1;
}
}
+ }
if ($CONF['quota'] == "YES")
{
+ if (!check_quota ($fQuota, $fUsername, $fDomain))
- if (!check_quota ($fQuota, $fDomain))
{
$error = 1;
$tName = $fName;