source: github/program/steps/mail/move_del.inc @ 04c6180

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

Fixed wrong message listing when showing search results

  • Property mode set to 100644
File size: 3.3 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// refresh saved seach set after moving some messages
63if (($search_request = $_GET['_search']) && $IMAP->search_set)
64  $_SESSION['search'][$search_request] = $IMAP->refresh_search();
65
66
67// update message count display
68$msg_count = $IMAP->messagecount();
69$pages = ceil($msg_count / $IMAP->page_size);
70$commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text($msg_count));
71$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages);
72
73
74// update mailboxlist
75$mbox = $IMAP->get_mailbox_name();
76$commands .= sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->messagecount($mbox, 'UNSEEN'));
77
78if ($_action=='moveto')
79  $commands .= sprintf("this.set_unread_count('%s', %d);\n", $_GET['_target_mbox'], $IMAP->messagecount($_GET['_target_mbox'], 'UNSEEN'));
80
81$commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
82
83// add new rows from next page (if any)
84if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages)
85  {
86  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
87  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
88 
89  $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order);
90  $a_headers = array_slice($a_headers, -$count, $count);
91
92  $commands .= rcmail_js_message_list($a_headers);
93  }
94
95
96// send response
97rcube_remote_response($commands);
98
99exit;
100?>
Note: See TracBrowser for help on using the repository browser.