From 9102b62a6e1f7484c0d88826de069e49cb72c898 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 3 May 2009 17:23:48 +0000 Subject: [PATCH] functions.inc.php: - gen_show_status(): add support for recipient_delimiter when checking aliases This implements part (8) of https://sourceforge.net/tracker/?func=detail&aid=1951926&group_id=191583&atid=937967 config.inc.php: - add new setting $CONF['recipient_delimiter'] git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@650 a1433add-5e2c-0410-b055-b7f2511e0802 --- config.inc.php | 4 ++++ functions.inc.php | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.inc.php b/config.inc.php index 2bbca1e1..c7c1f6b5 100644 --- a/config.inc.php +++ b/config.inc.php @@ -301,6 +301,10 @@ $CONF['show_popimap_color']='darkgrey'; // - add the corresponding color to show_custom_colors $CONF['show_custom_domains']=array("subdomain.domain.ext","domain2.ext"); $CONF['show_custom_colors']=array("lightgreen","lightblue"); +// If you use a recipient_delimiter in your postfix config, you can also honor it when aliases are checked. +// Example: $CONF['recipient_delimiter'] = "+"; +// Set to "" to disable this check. +$CONF['recipient_delimiter'] = ""; // Optional: diff --git a/functions.inc.php b/functions.inc.php index bd64e8ca..a0d53f4e 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -2140,7 +2140,13 @@ function gen_show_status ($show_alias) while ( ($g=array_pop($gotos)) && $stat_ok ) { $stat_catchall = substr($g,strpos($g,"@")); - $stat_result = db_query ("SELECT address FROM $table_alias WHERE address = '$g' OR address = '$stat_catchall'"); + $stat_delimiter = ""; + if (!empty($CONF['recipient_delimiter'])) { + $delimiter = preg_quote($CONF['recipient_delimiter'], "/"); + $stat_delimiter = preg_replace('/' .$delimiter. '[^' .$delimiter. ']*@/', "@", $g); + $stat_delimiter = "OR address = '$stat_delimiter'"; + } + $stat_result = db_query ("SELECT address FROM $table_alias WHERE address = '$g' OR address = '$stat_catchall' $stat_delimiter"); if ($stat_result['rows'] == 0) { $stat_ok = 0;