SF.net SVN: postfixadmin:[819] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2010-04-19 22:26:24
|
Revision: 819 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=819&view=rev Author: GingerDog Date: 2010-04-19 22:26:18 +0000 (Mon, 19 Apr 2010) Log Message: ----------- patch from https://sourceforge.net/tracker/?func=detail&aid=2976213&group_id=191583&atid=937966 - maildir_name_hook function - allow a user specified function to be used to create the maildir path - thanks to W. Rossmann Modified Paths: -------------- trunk/config.inc.php trunk/create-mailbox.php trunk/functions.inc.php Removed Paths: ------------- trunk/ADDITIONS/postfixadmin-0.3-1.4.tar.gz Deleted: trunk/ADDITIONS/postfixadmin-0.3-1.4.tar.gz =================================================================== (Binary files differ) Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2010-03-24 16:46:34 UTC (rev 818) +++ trunk/config.inc.php 2010-04-19 22:26:18 UTC (rev 819) @@ -147,6 +147,12 @@ // NO: /usr/local/virtual/domain.tld/username // Note: If $CONF['domain_path'] is set to NO, this setting will be forced to YES. $CONF['domain_in_mailbox'] = 'YES'; +// If you want to define your own function to generate a maildir path set this to the name of the function. +// Notes: +// - this configuration directive will override both domain_path and domain_in_mailbox +// - the maildir_name_hook() function example is present in functions.inc.php comments +// - if the function does not exist the program will default to the above domain_path and domain_in_mailbox settings +$CONF['maildir_name_hook'] = 'NO'; // Default Domain Values // Specify your default values below. Quota in MB. Modified: trunk/create-mailbox.php =================================================================== --- trunk/create-mailbox.php 2010-03-24 16:46:34 UTC (rev 818) +++ trunk/create-mailbox.php 2010-04-19 22:26:18 UTC (rev 819) @@ -158,7 +158,11 @@ { $password = pacrypt ($fPassword); - if ($CONF['domain_path'] == "YES") + if($CONF['maildir_name_hook'] != 'NO' && function_exists($CONF['maildir_name_hook'])) { + $hook_func = $CONF['maildir_name_hook']; + $maildir = $hook_func ($fDomain, $fUsername); + } + else if ($CONF['domain_path'] == "YES") { if ($CONF['domain_in_mailbox'] == "YES") { Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2010-03-24 16:46:34 UTC (rev 818) +++ trunk/functions.inc.php 2010-04-19 22:26:18 UTC (rev 819) @@ -2372,7 +2372,28 @@ } } ++/* + maildir_name_hook + + Called by create-mailbox.php if $CONF['maildir_name_hook'] == 'YES' + - allows for customized maildir paths determined by a custom function + - the below example will return append a single-character directory to the + beginning of the maildir, splitting domains more or less evenly over + 36 directories for improved filesystem performance with large numbers + of domains. + + Returns: maildir path + ie. I/example.com/user/ + */ +/* +function maildir_name_hook($domain, $user) { + $chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + $dir_index = hexdec(substr(md5($domain), 28)) % strlen($chars); + $dir = substr($chars, $dir_index, 1); + return sprintf("%s/%s/%s/", $dir, $domain, $user); +} + */ $table_admin = table_by_key ('admin'); $table_alias = table_by_key ('alias'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |