source: github/program/steps/mail/move_del.inc @ b190970

HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
Last change on this file since b190970 was b190970, checked in by thomascube <thomas@…>, 7 years ago

Introducing preview pane and conditional skin tags

  • Property mode set to 100644
File size: 2.9 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/mail/move_del.inc                                       |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Move the submitted messages to a specific mailbox or delete them    |
13 |                                                                       |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16 +-----------------------------------------------------------------------+
17
18 $Id$
19
20*/
21
22$REMOTE_REQUEST = TRUE;
23
24// move messages
25if ($_action=='moveto' && $_GET['_uid'] && $_GET['_target_mbox'])
26  {
27  $count = sizeof(explode(',', $_GET['_uid']));
28  $moved = $IMAP->move_message($_GET['_uid'], $_GET['_target_mbox'], $_GET['_mbox']);
29 
30  if (!$moved)
31    {
32    // send error message
33    $commands = "this.list_mailbox();\n";
34    $commands .= show_message('errormoving', 'error');
35    rcube_remote_response($commands);
36    exit;
37    }
38  }
39
40// delete messages
41else if ($_action=='delete' && $_GET['_uid'])
42  {
43  $count = sizeof(explode(',', $_GET['_uid']));
44  $del = $IMAP->delete_message($_GET['_uid'], $_GET['_mbox']);
45 
46  if (!$del)
47    {
48    // send error message
49    $commands = "this.list_mailbox();\n";
50    $commands .= show_message('errordeleting', 'error');
51    rcube_remote_response($commands);
52    exit;
53    }
54  }
55 
56// unknown action or missing query param
57else
58  {
59  exit;
60  }
61
62
63// update message count display
64$pages = ceil($IMAP->messagecount()/$IMAP->page_size);
65$commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text());
66$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
67
68
69// update mailboxlist
70$mbox = $IMAP->get_mailbox_name();
71$commands .= sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->messagecount($mbox, 'UNSEEN'));
72
73if ($_action=='moveto')
74  $commands .= sprintf("this.set_unread_count('%s', %d);\n", $_GET['_target_mbox'], $IMAP->messagecount($_GET['_target_mbox'], 'UNSEEN'));
75
76$commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
77
78// add new rows from next page (if any)
79if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages)
80  {
81  $a_headers = $IMAP->list_headers($mbox, null, $_SESSION['sort_col'], $_SESSION['sort_order']);
82  $a_headers = array_slice($a_headers, -$count, $count);
83  $commands .= rcmail_js_message_list($a_headers);
84  }
85
86 
87// send response
88rcube_remote_response($commands);
89
90exit;
91?>
Note: See TracBrowser for help on using the repository browser.