alecpl
2009-04-06 779cbe0066b10cbbe754184e4aed33d2502ff456
commit | author | age
4e17e6 1 <?php
T 2 /*
3  +-----------------------------------------------------------------------+
4  | program/steps/mail/mark.inc                                           |
5  |                                                                       |
6  | This file is part of the RoundCube Webmail client                     |
f11541 7  | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
30233b 8  | Licensed under the GNU GPL                                            |
4e17e6 9  |                                                                       |
T 10  | PURPOSE:                                                              |
11  |   Mark the submitted messages with the specified flag                 |
12  |                                                                       |
13  +-----------------------------------------------------------------------+
14  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
15  +-----------------------------------------------------------------------+
16
17  $Id$
18
19 */
20
f11541 21 $a_flags_map = array(
T 22   'undelete' => 'UNDELETED',
23   'delete' => 'DELETED',
24   'read' => 'SEEN',
e189a6 25   'unread' => 'UNSEEN',
A 26   'flagged' => 'FLAGGED',
27   'unflagged' => 'UNFLAGGED');
4e17e6 28
8d0758 29 if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST)))
f11541 30 {
b3ce79 31   $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag);
T 32   $marked = $IMAP->set_flag($uids, $flag);
f11541 33
3d3531 34   if($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid']))
A 35     {
36     $uids = get_input_value('_ruid', RCUBE_INPUT_POST);
37     $read = $IMAP->set_flag($uids, 'SEEN');
38     
39     if ($read != -1)
40       $OUTPUT->command('flag_deleted_as_read', $uids);
41     }
42
e70b3b 43   if ($marked != -1 && ($flag == 'SEEN' || $flag == 'UNSEEN'))
f11541 44   {
c5ac07 45     $mbox_name = $IMAP->get_mailbox_name();
cf1f0f 46     $OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX'));
4e17e6 47   }
e70b3b 48
A 49   $OUTPUT->send();
f11541 50 }
4e17e6 51   
T 52 exit;
53 ?>