]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/mail/mark.inc
Imported Upstream version 0.2~alpha
[roundcube.git] / program / steps / mail / mark.inc
1 <?php
2 /*
3  +-----------------------------------------------------------------------+
4  | program/steps/mail/mark.inc                                           |
5  |                                                                       |
6  | This file is part of the RoundCube Webmail client                     |
7  | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
8  | Licensed under the GNU GPL                                            |
9  |                                                                       |
10  | PURPOSE:                                                              |
11  |   Mark the submitted messages with the specified flag                 |
12  |                                                                       |
13  +-----------------------------------------------------------------------+
14  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
15  +-----------------------------------------------------------------------+
16
17  $Id: mark.inc 1292 2008-04-12 17:37:22Z alec $
18
19 */
20
21 $a_flags_map = array(
22   'undelete' => 'UNDELETED',
23   'delete' => 'DELETED',
24   'read' => 'SEEN',
25   'unread' => 'UNSEEN');
26
27 if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST)))
28 {
29   $flag = $a_flags_map[$flag] ? $a_flags_map[$flag] : strtoupper($flag);
30   $marked = $IMAP->set_flag($uids, $flag);
31
32   if($flag == 'DELETED' && $CONFIG['read_when_deleted'] && !empty($_POST['_ruid']))
33     {
34     $uids = get_input_value('_ruid', RCUBE_INPUT_POST);
35     $read = $IMAP->set_flag($uids, 'SEEN');
36     
37     if ($read != -1)
38       $OUTPUT->command('flag_deleted_as_read', $uids);
39     }
40
41   if ($marked != -1)
42   {
43     $mbox_name = $IMAP->get_mailbox_name();
44     $OUTPUT->command('set_unread_count', $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'), ($mbox_name == 'INBOX'));
45     $OUTPUT->send();
46   }
47 }
48   
49 exit;
50 ?>