4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/copy.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2007, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Copy a contact record from one direcotry to another |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: copy.inc 471 2007-02-09 21:25:50Z thomasb $
22 // only process ajax requests
23 if (!$OUTPUT->ajax_call)
26 $cid = get_input_value('_cid', RCUBE_INPUT_POST);
27 $target = get_input_value('_to', RCUBE_INPUT_POST);
29 if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && strlen($target) && $target !== $source)
32 $TARGET = $RCMAIL->get_address_book($target);
34 if ($TARGET && $TARGET->ready && !$TARGET->readonly) {
35 $arr_cids = split(',', $cid);
36 foreach ($arr_cids as $cid) {
37 $plugin = $RCMAIL->plugins->exec_hook('create_contact', array('record' => $CONTACTS->get_record($cid, true), 'source' => $target));
38 $a_record = $plugin['record'];
40 if (!$plugin['abort'])
41 if ($TARGET->insert($a_record, true))
47 $OUTPUT->show_message('copyerror', 'error');
49 $OUTPUT->show_message('copysuccess', 'notice', array('nr' => $success));
51 // close connection to second address directory