|
|
@ -25,54 +25,70 @@ if ($CONTACTS->readonly || !$CONTACTS->groups) {
|
|
|
|
$OUTPUT->send();
|
|
|
|
$OUTPUT->send();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($RCMAIL->action == 'group-addmember') {
|
|
|
|
$source = get_input_value('_source', RCUBE_INPUT_GPC);
|
|
|
|
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST)))
|
|
|
|
|
|
|
|
if ($CONTACTS->add_to_group($gid, $ids))
|
|
|
|
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_addmember', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$plugin['abort'] && $CONTACTS->add_to_group($gid, $plugin['ids']))
|
|
|
|
$OUTPUT->show_message('contactaddedtogroup');
|
|
|
|
$OUTPUT->show_message('contactaddedtogroup');
|
|
|
|
//else
|
|
|
|
else if ($plugin['message'])
|
|
|
|
// $OUTPUT->show_message('erroraddingcontact', 'warning');
|
|
|
|
$OUTPUT->show_message($plugin['message'], 'warning');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if ($RCMAIL->action == 'group-delmembers') {
|
|
|
|
|
|
|
|
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) {
|
|
|
|
|
|
|
|
$plugin = $RCMAIL->plugins->exec_hook('group_delmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source));
|
|
|
|
|
|
|
|
$ids = $plugin['ids'];
|
|
|
|
|
|
|
|
|
|
|
|
else if ($RCMAIL->action == 'group-delmember') {
|
|
|
|
if (!$plugin['abort'] && $CONTACTS->remove_from_group($gid, $ids))
|
|
|
|
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST)))
|
|
|
|
|
|
|
|
if ($CONTACTS->remove_from_group($gid, $ids))
|
|
|
|
|
|
|
|
$OUTPUT->show_message('contactremovedfromgroup');
|
|
|
|
$OUTPUT->show_message('contactremovedfromgroup');
|
|
|
|
//else
|
|
|
|
else if ($plugin['message'])
|
|
|
|
// $OUTPUT->show_message('erroraddingcontact', 'warning');
|
|
|
|
$OUTPUT->show_message($plugin['message'], 'warning');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if ($RCMAIL->action == 'group-create') {
|
|
|
|
else if ($RCMAIL->action == 'group-create') {
|
|
|
|
if (!empty($_POST['_name'])) {
|
|
|
|
if ($name = trim(get_input_value('_name', RCUBE_INPUT_POST))) {
|
|
|
|
$name = trim(get_input_value('_name', RCUBE_INPUT_POST));
|
|
|
|
$plugin = $RCMAIL->plugins->exec_hook('group_create', array('name' => $name, 'source' => $source));
|
|
|
|
$created = $CONTACTS->create_group($name);
|
|
|
|
if (!$plugin['abort'])
|
|
|
|
|
|
|
|
$created = $CONTACTS->create_group($plugin['name']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($created && $OUTPUT->ajax_call) {
|
|
|
|
if ($created && $OUTPUT->ajax_call) {
|
|
|
|
$OUTPUT->command('insert_contact_group', $created);
|
|
|
|
$OUTPUT->command('insert_contact_group', $created);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!$create) {
|
|
|
|
else if (!$created) {
|
|
|
|
$OUTPUT->show_message('errorsaving', 'error');
|
|
|
|
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if ($RCMAIL->action == 'group-rename') {
|
|
|
|
else if ($RCMAIL->action == 'group-rename') {
|
|
|
|
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($name = trim(get_input_value('_name', RCUBE_INPUT_POST))))
|
|
|
|
if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($name = trim(get_input_value('_name', RCUBE_INPUT_POST)))) {
|
|
|
|
$newname = $CONTACTS->rename_group($gid, $name);
|
|
|
|
$plugin = $RCMAIL->plugins->exec_hook('group_rename', array('group_id' => $gid, 'name' => $name, 'source' => $source));
|
|
|
|
|
|
|
|
if (!$plugin['abort'])
|
|
|
|
|
|
|
|
$newname = $CONTACTS->rename_group($gid, $plugin['name']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($newname && $OUTPUT->ajax_call)
|
|
|
|
if ($newname && $OUTPUT->ajax_call)
|
|
|
|
$OUTPUT->command('update_contact_group', $gid, $newname);
|
|
|
|
$OUTPUT->command('update_contact_group', $gid, $newname);
|
|
|
|
else if (!$newname)
|
|
|
|
else if (!$newname)
|
|
|
|
$OUTPUT->show_message('errorsaving', 'error');
|
|
|
|
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if ($RCMAIL->action == 'group-delete') {
|
|
|
|
else if ($RCMAIL->action == 'group-delete') {
|
|
|
|
if ($gid = get_input_value('_gid', RCUBE_INPUT_POST))
|
|
|
|
if ($gid = get_input_value('_gid', RCUBE_INPUT_POST)) {
|
|
|
|
|
|
|
|
$plugin = $RCMAIL->plugins->exec_hook('group_delete', array('group_id' => $gid, 'source' => $source));
|
|
|
|
|
|
|
|
if (!$plugin['abort'])
|
|
|
|
$deleted = $CONTACTS->delete_group($gid);
|
|
|
|
$deleted = $CONTACTS->delete_group($gid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($deleted)
|
|
|
|
if ($deleted)
|
|
|
|
$OUTPUT->command('remove_group_item', $gid);
|
|
|
|
$OUTPUT->command('remove_group_item', $gid);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
$OUTPUT->show_message('errorsaving', 'error');
|
|
|
|
$OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// send response
|
|
|
|
// send response
|
|
|
|