functions.inc.php:

- new function allowed_quota to get the allowed maximum quota for a mailbox.
  Based on a patch by wvolz (wvolz@SF), but with several enhancements/changes.
  https://sourceforge.net/tracker/index.php?func=detail&aid=2856577&group_id=191583&atid=937966
- added a TODO note

edit-mailbox.php:
- get maximum allowed quota via allowed_quota() instead of just using
  the maxquota of the domain


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1156 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 13 years ago
parent 58815ccd7d
commit 0656852d4e

@ -74,12 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
$tActive = ('t'==$user_details['active']) ? 1 : 0;
}
$result = db_query ("SELECT * FROM $table_domain WHERE domain='$fDomain'");
if ($result['rows'] == 1)
{
$row = db_array ($result['result']);
$tMaxquota = $row['maxquota'];
}
$tMaxquota = allowed_quota($fDomain, $user_details['quota']);
}
}
@ -121,6 +116,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tName = $fName;
$tQuota = $fQuota;
$tActive = $fActive;
$tMaxquota = allowed_quota($fDomain, $user_details['quota']);
$pEdit_mailbox_quota_text_error = $PALANG['pEdit_mailbox_quota_text_error'];
}
}

@ -704,6 +704,30 @@ function check_quota ($quota, $domain, $username="") {
}
/**
* Get allowed maximum quota for a mailbox
* @param String $domain
* @param Integer $current_user_quota (in bytes)
* @return Integer allowed maximum quota (in MB)
*/
function allowed_quota($domain, $current_user_quota) {
$domain_properties = get_domain_properties($domain);
$tMaxquota = $domain_properties['maxquota'];
if (boolconf('domain_quota') && $domain_properties['quota']) {
$dquota = $domain_properties['quota'] - divide_quota($domain_properties['quota_sum'] - $current_user_quota);
if ($dquota < $tMaxquota) {
$tMaxquota = $dquota;
}
if ($tMaxquota == 0) {
$tMaxquota = $dquota;
}
}
return $tMaxquota;
}
//
// multiply_quota
@ -1218,7 +1242,7 @@ function pacrypt ($pw, $pw_db="") {
die ('unknown/invalid $CONF["encrypt"] setting: ' . $CONF['encrypt']);
}
$password = escape_string ($password);
$password = escape_string ($password); # TODO: disable escaping - https://sourceforge.net/tracker/?func=detail&aid=3301752&group_id=191583&atid=937964
return $password;
}

Loading…
Cancel
Save