summaryrefslogtreecommitdiff
path: root/program/steps
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 /program/steps
parent3616845126d91e6bf5bf9f1c28ce73a3da6e1976 (diff)
Configurable limit of address group members
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/groups.inc7
1 files changed, 6 insertions, 1 deletions
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');