thomascube
2006-03-04 f5121b5639992fc9e51fd551bac2254429b638fa
commit | author | age
4e17e6 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/mail/mark.inc                                           |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
8  | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
30233b 9  | Licensed under the GNU GPL                                            |
4e17e6 10  |                                                                       |
T 11  | PURPOSE:                                                              |
12  |   Mark the submitted messages with the specified flag                 |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
18  $Id$
19
20 */
21
22 $REMOTE_REQUEST = TRUE;
23
24 $a_flags_map = array('read' => 'SEEN',
25                      'unread' => 'UNSEEN');
26
27 if ($_GET['_uid'] && $_GET['_flag'])
28   {
29   $flag = $a_flags_map[$_GET['_flag']] ? $a_flags_map[$_GET['_flag']] : strtoupper($_GET['_flag']);
30   $marked = $IMAP->set_flag($_GET['_uid'], $flag);
31   
32   if ($marked)
33     {
34     $mbox = $IMAP->get_mailbox_name();
35     $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->messagecount($mbox, 'UNSEEN'));
36     rcube_remote_response($commands);
37     }
38   }
39   
40 exit;
41 ?>