forked from zedzedtop/mailzu
-
Notifications
You must be signed in to change notification settings - Fork 7
/
messagesPendingAdmin.php
96 lines (75 loc) · 3.39 KB
/
messagesPendingAdmin.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
<?php
/**
* Display all pending requests for the site.
*
* @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
}
// grab the display size limit set in config.php
$sizeLimit = isset ($conf['app']['displaySizeLimit']) && is_numeric($conf['app']['displaySizeLimit']) ?
$conf['app']['displaySizeLimit'] : 50;
$_SESSION['sessionNav'] = "Site Pending Requests";
// Get current page number
$requestedPage = CmnFns::getGlobalVar('page', GET);
$db = new DBEngine();
$t = new Template(translate('Site Quarantine'));
$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();
if (!Auth::isMailAdmin()) {
CmnFns::do_error_box(translate('Access Denied'));
} else {
// Arbitrary type for Admin
$content_type = (CmnFns::get_ctype() ?: 'A');
// Draw search engine
printSearchEngine($content_type, $_SERVER['PHP_SELF'], 1);
echo '<br>';
if (CmnFns::getGlobalVar('search_action', GET) == translate('Clear search results')) CmnFns::redirect_js($_SERVER['PHP_SELF']);
$search_array1 = $db->convertSearch2SQL('msgs.from_addr', CmnFns::getGlobalVar('f_criterion', GET), CmnFns::getGlobalVar('f_string', GET));
$search_array2 = $db->convertSearch2SQL('msgs.subject', CmnFns::getGlobalVar('s_criterion', GET), CmnFns::getGlobalVar('s_string', GET));
$search_array3 = $db->convertSearch2SQL('recip.email', CmnFns::getGlobalVar('t_criterion', GET), CmnFns::getGlobalVar('t_string', GET));
$search_array4 = $db->convertSearch2SQL('msgs.mail_id', CmnFns::getGlobalVar('m_criterion', GET), CmnFns::getGlobalVar('m_string', GET));
$search_array = array_merge($search_array1, $search_array2, $search_array3, $search_array4);
$order = array('msgs.time_num', 'from_addr', 'msgs.subject', 'spam_level', 'recip.email', 'msgs.content', 'mail_id');
// Print a loading message until database returns...
printMessage(translate('Retrieving Messages...'));
$messages = $db->get_user_messages($content_type, $_SESSION['sessionMail'], CmnFns::get_value_order($order), CmnFns::get_vert_order(), $search_array, 1, 1, $requestedPage);
// Compute maximum number of pages
$maxPage = (ceil($db->numRows / $sizeLimit) - 1);
// If $requestedPage > $maxPage, then redirect to $maxPage instead of $requestedPage
if ($requestedPage > $maxPage) {
$query_string = CmnFns::array_to_query_string($_GET, array('page'));
$query_string = str_replace('&', '&', $query_string);
CmnFns::redirect_js($_SERVER['PHP_SELF'] . '?' . $query_string . '&page=' . $maxPage);
}
showMessagesTable($content_type, $messages, $requestedPage, CmnFns::get_value_order($order), CmnFns::get_vert_order());
// Hide the message after the table loads.
hideMessage(translate('Retrieving Messages...'));
}
endDataDisplayCol();
$t->endMain();
$t->printHTMLFooter();
?>