]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/mail/mark.inc
Imported Upstream version 0.1~beta2.2~dfsg
[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, 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 232 2006-05-18 15:46:50Z cmcnulty $
18
19 */
20
21 $REMOTE_REQUEST = TRUE;
22
23 $a_flags_map = array('undelete' => 'UNDELETED',
24                      'delete' => 'DELETED',
25                      'read' => 'SEEN',
26                      'unread' => 'UNSEEN');
27
28 if ($_GET['_uid'] && $_GET['_flag'])
29   {
30   $flag = $a_flags_map[$_GET['_flag']] ? $a_flags_map[$_GET['_flag']] : strtoupper($_GET['_flag']);
31   $marked = $IMAP->set_flag($_GET['_uid'], $flag);
32   if ($marked != -1)
33     {
34     $mbox_name = $IMAP->get_mailbox_name();
35     $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox_name, $IMAP->messagecount($mbox_name, 'UNSEEN'));
36     rcube_remote_response($commands);
37     }
38   }
39   
40 exit;
41 ?>