forked from zedzedtop/mailzu
-
Notifications
You must be signed in to change notification settings - Fork 7
/
messagesProcessing.php
123 lines (108 loc) · 3.93 KB
/
messagesProcessing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
* This file processes the messages that were selected
* in messagesIndex.php for logged in users.
*
* @author Gergely Nagy <[email protected]>
* @version 2021-11-08
* @package mailzu-ng
*
* Copyright (C) 2021 mailzu-ng
* License: GPL, see LICENSE
*/
/**
* Include autoloader
*/
include_once('lib/autoload.php');
/**
* Include common output functions
*/
include_once('templates/common.template.php');
/**
* Include quarantine-specific output functions
*/
include_once('templates/quarantine.template.php');
if (!Auth::is_logged_in()) {
(new Auth())->print_login_msg(); // Check if user is logged in
}
//Turn off all error reporting, useless for users
error_reporting(0);
$db = new DBEngine();
$t = new Template(translate('Message Processing'));
$t->printHTMLHeader();
$t->printWelcome();
$t->startMain();
// Break table into 2 columns, put quick links on left side and all other tables on the right
startQuickLinksCol();
showQuickLinks(); // Print out My Quick Links
startDataDisplayCol();
$action = CmnFns::get_action();
$content_type = CmnFns::get_ctype();
$query_string = CmnFns::get_query_string();
$mail_id_array = CmnFns::getGlobalVar('mail_id_array', POST);
switch ($_SESSION['sessionNav']) {
case 'My Quarantine':
$referral = 'messagesIndex.php';
break;
case 'Site Quarantine':
$referral = 'messagesAdmin.php';
break;
case 'My Pending Requests':
case 'Site Pending Requests':
$referral = 'messagesPending.php';
break;
}
// If no message was selected and the action is not "Delete All"
if (!isset($mail_id_array) && $action != translate('Delete All'))
printNoMesgWarning();
elseif (isset($action)) {
switch ($action) {
case translate('Release'):
case translate('Release/Request release'):
$failed_array = releaseMessages($_SESSION['sessionMail'], $mail_id_array);
if (is_array($failed_array) && !empty($failed_array)) {
showFailedMessagesTable($action, $content_type, $failed_array);
printCpanelBr();
printReportButtons($query_string, $failed_array, $action);
} else {
CmnFns::redirect_js($referral . '?' . $query_string);
}
break;
case translate('Cancel Request'):
$failed_array = updateMessages('', $content_type, $_SESSION['sessionMail'], $mail_id_array);
if (is_array($failed_array) && !empty($failed_array)) {
showFailedMessagesTable($action, $content_type, $failed_array);
printCpanelBr();
printReportButtons($query_string, $failed_array, $action);
} else {
CmnFns::redirect_js($referral . '?' . $query_string);
}
break;
case translate('Delete'):
$failed_array = updateMessages('D', $content_type, $_SESSION['sessionMail'], $mail_id_array);
if (is_array($failed_array) && !empty($failed_array)) {
showFailedMessagesTable($action, $content_type, $failed_array);
printCpanelBr();
printReportButtons($query_string, $failed_array, $action);
} else {
CmnFns::redirect_js($referral . '?' . $query_string);
}
break;
case translate('Delete All'):
$failed_array = updateMessages('D', $content_type, $_SESSION['sessionMail'], '', true);
if (is_array($failed_array) && !empty($failed_array)) {
showFailedMessagesTable($action, $content_type, $failed_array);
printCpanelBr();
printReportButtons($query_string, $failed_array, $action);
} else {
CmnFns::redirect_js($referral . '?' . $query_string);
}
break;
default:
CmnFns::do_error_box(translate('Unknown action type'), '', false);
}
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
?>