comparison program/steps/addressbook/undo.inc @ 0:4681f974d28b

vanilla 1.3.3 distro, I hope
author Charlie Root
date Thu, 04 Jan 2018 15:52:31 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4681f974d28b
1 <?php
2
3 /**
4 +-----------------------------------------------------------------------+
5 | program/steps/addressbook/undo.inc |
6 | |
7 | This file is part of the Roundcube Webmail client |
8 | Copyright (C) 2011-2013, Kolab Systems AG |
9 | |
10 | Licensed under the GNU General Public License version 3 or |
11 | any later version with exceptions for skins & plugins. |
12 | See the README file for a full license statement. |
13 | |
14 | PURPOSE: |
15 | Undelete contacts (CIDs) from last delete action |
16 | |
17 +-----------------------------------------------------------------------+
18 | Author: Aleksander Machniak <machniak@kolabsys.com> |
19 +-----------------------------------------------------------------------+
20 */
21
22 // process ajax requests only
23 if (!$OUTPUT->ajax_call) {
24 return;
25 }
26
27 $undo = $_SESSION['contact_undo'];
28 $delcnt = 0;
29
30 foreach ((array)$undo['data'] as $source => $cid) {
31 $CONTACTS = rcmail_contact_source($source);
32
33 $plugin = $RCMAIL->plugins->exec_hook('contact_undelete', array(
34 'id' => $cid, 'source' => $source));
35
36 $restored = !$plugin['abort'] ? $CONTACTS->undelete($cid) : $plugin['result'];
37
38 if (!$restored) {
39 $OUTPUT->show_message($plugin['message'] ?: 'contactrestoreerror', 'error');
40 $OUTPUT->command('list_contacts');
41 $OUTPUT->send();
42 }
43 else {
44 $delcnt += $restored;
45 }
46 }
47
48 $RCMAIL->session->remove('contact_undo');
49
50 $OUTPUT->show_message('contactrestored', 'confirmation');
51 $OUTPUT->command('list_contacts');
52
53 // send response
54 $OUTPUT->send();