summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-04-06 06:40:45 +0000
committerthomascube <thomas@roundcube.net>2010-04-06 06:40:45 +0000
commitd1851ba77b26683b3b3ada4e08127794519d3eb6 (patch)
treef1f65afc90f335ca5f160c57c8313ec44413916f
parent3616845126d91e6bf5bf9f1c28ce73a3da6e1976 (diff)
Configurable limit of address group members
-rw-r--r--config/main.inc.php.dist4
-rw-r--r--program/localization/de_CH/messages.inc2
-rw-r--r--program/localization/en_US/messages.inc3
-rw-r--r--program/steps/addressbook/groups.inc7
4 files changed, 14 insertions, 2 deletions
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 6be1f1e5f..6d12e6024 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -183,6 +183,10 @@ $rcmail_config['sendmail_delay'] = 0;
// Maximum number of recipients per message. Default: 0 (no limit)
$rcmail_config['max_recipients'] = 0;
+// Maximum allowednumber of members of an address group. Default: 0 (no limit)
+// If 'max_recipients' is set this value should be less or equal
+$rcmail_config['max_group_members'] = 0;
+
// add this user-agent to message headers when sending
$rcmail_config['useragent'] = 'RoundCube Webmail/'.RCMAIL_VERSION;
diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc
index be61cc78d..e0ca1c986 100644
--- a/program/localization/de_CH/messages.inc
+++ b/program/localization/de_CH/messages.inc
@@ -109,5 +109,7 @@ $messages['smtptoerror'] = 'SMTP Fehler ($code): Der Empfänger ("$to") konnte n
$messages['smtprecipientserror'] = 'SMTP Fehler: Die Empfängerliste konnte nicht verarbeitet werden';
$messages['smtperror'] = 'SMTP Fehler: $msg';
$messages['emailformaterror'] = 'Ungültige E-Mail-Adresse: $email';
+$messages['toomanyrecipients'] = 'Zuviele Empfänger angegeben. Reduzieren Sie die Empfängeradressen auf $max.';
+$messages['maxgroupmembersreached'] = 'Die Anzahl Adressen in dieser Gruppe überschreitet das Maximum von $max';
?>
diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc
index 1dfdb96ba..8822f302b 100644
--- a/program/localization/en_US/messages.inc
+++ b/program/localization/en_US/messages.inc
@@ -110,7 +110,8 @@ $messages['smtpfromerror'] = 'SMTP Error ($code): Failed to set sender "$from"';
$messages['smtptoerror'] = 'SMTP Error ($code): Failed to add recipient "$to"';
$messages['smtprecipientserror'] = 'SMTP Error: Unable to parse recipients list';
$messages['smtperror'] = 'SMTP Error: $msg';
-$messages['emailformaterror'] = 'Incorrect e-mail address: $email';
+$messages['emailformaterror'] = 'Invalid e-mail address: $email';
$messages['toomanyrecipients'] = 'Too many recipients. Reduce the number of recipients to $max.';
+$messages['maxgroupmembersreached'] = 'The number of group members exceeds the maximum of $max';
?>
diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc
index df44703a9..eda258c6e 100644
--- a/program/steps/addressbook/groups.inc
+++ b/program/steps/addressbook/groups.inc
@@ -31,7 +31,12 @@ if ($RCMAIL->action == 'group-addmembers') {
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) {
$plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
- if (!$plugin['abort'] && $CONTACTS->add_to_group($gid, $plugin['ids']))
+ $CONTACTS->set_group($gid);
+ $num2add = count(explode(',', $plugin['ids']));
+
+ if (!$plugin['abort'] && ($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum))
+ $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
+ else if (!$plugin['abort'] && $CONTACTS->add_to_group($gid, $plugin['ids']))
$OUTPUT->show_message('contactaddedtogroup');
else if ($plugin['message'])
$OUTPUT->show_message($plugin['message'], 'warning');