From d1851ba77b26683b3b3ada4e08127794519d3eb6 Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 6 Apr 2010 06:40:45 +0000 Subject: Configurable limit of address group members --- program/steps/addressbook/groups.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'program/steps/addressbook') 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'); -- cgit v1.2.3