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

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

Applied patch for updating page title (#1484727, #1484650)

  • Property mode set to 100644
File size: 3.8 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-2007, 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// count messages before changing anything
23$old_count = $IMAP->messagecount();
24$old_pages = ceil($old_count / $IMAP->page_size);
25
26// move messages
27if ($_action=='moveto' && !empty($_POST['_uid']) && !empty($_POST['_target_mbox']))
28{
29  $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
30  $target = get_input_value('_target_mbox', RCUBE_INPUT_POST);
31  $moved = $IMAP->move_message($uids, $target, get_input_value('_mbox', RCUBE_INPUT_POST));
32 
33  if (!$moved)
34  {
35    // send error message
36    $OUTPUT->command('list_mailbox');
37    $OUTPUT->show_message('errormoving', 'error');
38    $OUTPUT->send();
39    exit;
40  }
41}
42
43// delete messages
44else if ($_action=='delete' && !empty($_POST['_uid']))
45{
46  $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
47  $del = $IMAP->delete_message($uids, get_input_value('_mbox', RCUBE_INPUT_POST));
48 
49  if (!$del)
50  {
51    // send error message
52    $OUTPUT->command('list_mailbox');
53    $OUTPUT->show_message('errordeleting', 'error');
54    $OUTPUT->send();
55    exit;
56  }
57}
58 
59// unknown action or missing query param
60else
61  exit;
62
63// refresh saved search set after moving some messages
64if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set)
65  $_SESSION['search'][$search_request] = $IMAP->refresh_search();
66
67
68$msg_count = $IMAP->messagecount();
69$pages = ceil($msg_count / $IMAP->page_size);
70$nextpage_count = $old_count - $IMAP->page_size * $IMAP->list_page;
71$remaining = $msg_count - $IMAP->page_size * ($IMAP->list_page - 1);
72
73// jump back one page (user removed the whole last page)
74if ($IMAP->list_page > 1 && $nextpage_count <= 0 && $remaining == 0)
75{
76  $IMAP->set_page($IMAP->list_page-1);
77  $_SESSION['page'] = $IMAP->list_page;
78  $jump_back = true;
79}
80
81// update message count display
82$OUTPUT->set_env('pagecount', $pages);
83$OUTPUT->set_env('current_page', $IMAP->list_page);
84$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count));
85
86
87// update mailboxlist
88$mbox = $IMAP->get_mailbox_name();
89$OUTPUT->command('set_unread_count', $mbox, $IMAP->messagecount($mbox, 'UNSEEN'), ($mbox == 'INBOX'));
90
91if ($_action=='moveto' && $target)
92  $OUTPUT->command('set_unread_count', $target, $IMAP->messagecount($target, 'UNSEEN'));
93
94$OUTPUT->command('set_quota', $IMAP->get_quota());
95
96// add new rows from next page (if any)
97if ($_POST['_from']!='show' && ($jump_back || $nextpage_count > 0))
98{
99  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
100  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
101 
102  $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order);
103  if (!$jump_back)
104    $a_headers = array_slice($a_headers, -$count, $count);
105
106  rcmail_js_message_list($a_headers);
107}
108
109
110// send response
111$OUTPUT->send();
112
113?>
Note: See TracBrowser for help on using the repository browser.