X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Fsteps%2Faddressbook%2Fgroups.inc;h=a7be494912cd2c9c5872cf12ed969d62c6e01b1f;hb=HEAD;hp=f54c59cddf37934388bcab2b0f75fe304d043c1e;hpb=0049b44955bd98230dd609e8dd84bde1747eb278;p=roundcube.git diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc index f54c59c..a7be494 100644 --- a/program/steps/addressbook/groups.inc +++ b/program/steps/addressbook/groups.inc @@ -5,7 +5,7 @@ | program/steps/addressbook/groups.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2010, Roundcube Dev. - Switzerland | + | Copyright (C) 2010, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -15,17 +15,18 @@ | Author: Thomas Bruederli | +-----------------------------------------------------------------------+ - $Id: groups.inc 4252 2010-11-23 08:18:39Z alec $ + $Id: groups.inc 4850 2011-06-14 13:45:26Z alec $ */ +$source = get_input_value('_source', RCUBE_INPUT_GPC); +$CONTACTS = rcmail_contact_source($source, true); + if ($CONTACTS->readonly || !$CONTACTS->groups) { $OUTPUT->show_message('sourceisreadonly', 'warning'); $OUTPUT->send(); } -$source = get_input_value('_source', RCUBE_INPUT_GPC); - 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)); @@ -68,7 +69,7 @@ else if ($RCMAIL->action == 'group-delmembers') { } else if ($RCMAIL->action == 'group-create') { - if ($name = trim(get_input_value('_name', RCUBE_INPUT_POST))) { + if ($name = trim(get_input_value('_name', RCUBE_INPUT_POST, true))) { $plugin = $RCMAIL->plugins->exec_hook('group_create', array('name' => $name, 'source' => $source)); if (!$plugin['abort']) @@ -78,9 +79,9 @@ else if ($RCMAIL->action == 'group-create') { } if ($created && $OUTPUT->ajax_call) { + $created['name'] = Q($created['name']); $OUTPUT->show_message('groupcreated', 'confirmation'); - $OUTPUT->command('insert_contact_group', array( - 'source' => $source, 'id' => $created['id'], 'name' => $created['name'])); + $OUTPUT->command('insert_contact_group', array('source' => $source) + $created); } else if (!$created) { $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); @@ -88,11 +89,11 @@ else if ($RCMAIL->action == 'group-create') { } 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, true)))) { $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']); + $newname = $CONTACTS->rename_group($gid, $plugin['name'], $newgid); else $newname = $plugin['result']; } @@ -100,7 +101,7 @@ else if ($RCMAIL->action == 'group-rename') { if ($newname && $OUTPUT->ajax_call) { $OUTPUT->show_message('grouprenamed', 'confirmation'); $OUTPUT->command('update_contact_group', array( - 'source' => $source, 'id' => $gid, 'name' => $newname)); + 'source' => $source, 'id' => $gid, 'name' => Q($newname), 'newid' => $newgid)); } else if (!$newname) $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error');