commit | author | age
|
f11541
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/addressbook/copy.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
|
8 |
| Copyright (C) 2007, RoundCube Dev. - Switzerland | |
|
9 |
| Licensed under the GNU GPL | |
|
10 |
| | |
|
11 |
| PURPOSE: | |
|
12 |
| Copy a contact record from one direcotry to another | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id: copy.inc 471 2007-02-09 21:25:50Z thomasb $ |
|
19 |
|
|
20 |
*/ |
|
21 |
|
|
22 |
$cid = get_input_value('_cid', RCUBE_INPUT_POST); |
|
23 |
$target = get_input_value('_to', RCUBE_INPUT_POST); |
|
24 |
if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && strlen($target) && $target != $source) |
|
25 |
{ |
ade8e1
|
26 |
$success = false; |
T |
27 |
$TARGET = $RCMAIL->get_address_book($target); |
|
28 |
|
f11541
|
29 |
if ($TARGET && $TARGET->ready && !$TARGET->readonly) |
T |
30 |
$success = $TARGET->insert($CONTACTS->search($CONTACTS->primary_key, $cid), true); |
|
31 |
|
|
32 |
if (empty($success)) |
|
33 |
$OUTPUT->show_message('copyerror', 'error'); |
|
34 |
else |
|
35 |
$OUTPUT->show_message('copysuccess', 'notice', array('nr' => count($success))); |
6b603d
|
36 |
|
T |
37 |
// close connection to second address directory |
|
38 |
$TARGET->close(); |
f11541
|
39 |
} |
6b603d
|
40 |
|
f11541
|
41 |
// send response |
T |
42 |
$OUTPUT->send(); |
|
43 |
|
|
44 |
?> |