-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
admin_mail_queue_message_view.php
77 lines (62 loc) · 2.7 KB
/
admin_mail_queue_message_view.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
<?php
require_once "inc_all_admin.php";
//Initialize the HTML Purifier to prevent XSS
require "plugins/htmlpurifier/HTMLPurifier.standalone.php";
$purifier_config = HTMLPurifier_Config::createDefault();
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
$purifier = new HTMLPurifier($purifier_config);
if (isset($_GET['email_id'])) {
$email_id = intval($_GET['email_id']);
} else {
echo "You dont belong here";
exit();
}
$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id");
$row = mysqli_fetch_array($sql);
$email_from = nullable_htmlentities($row['email_from']);
$email_from_name = nullable_htmlentities($row['email_from_name']);
$email_recipient = nullable_htmlentities($row['email_recipient']);
$email_recipient_name = nullable_htmlentities($row['email_recipient_name']);
$email_subject = nullable_htmlentities($row['email_subject']);
$email_content = $purifier->purify($row['email_content']);
$email_attempts = intval($row['email_attempts']);
$email_queued_at = nullable_htmlentities($row['email_queued_at']);
$email_failed_at = nullable_htmlentities($row['email_failed_at']);
$email_sent_at = nullable_htmlentities($row['email_sent_at']);
$email_status = intval($row['email_status']);
if ($email_status == 0) {
$email_status_display = "<div class='text-primary'>Queued</div>";
} elseif($email_status == 1) {
$email_status_display = "<div class='text-warning'>Sending</div>";
} elseif($email_status == 2) {
$email_status_display = "<div class='text-danger'>Failed</div><small class='text-secondary'>$email_failed_at</small>";
} else {
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
}
?>
<ol class="breadcrumb d-print-none">
<li class="breadcrumb-item">
<a href="admin_user.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a>
</li>
<li class="breadcrumb-item">
<a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a>
</li>
<li class="breadcrumb-item active"><i class="fas fa-fw fa-envelope-open mr-2"></i><?php echo $email_subject; ?></li>
</ol>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header bg-dark">
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
<div>Subject: <?php echo $email_subject; ?></div>
</div>
<div class="card-body prettyContent">
<?php echo $email_content; ?>
</div>
</div>
</div>
</div>
<script src="js/pretty_content.js"></script>
<?php
require_once "footer.php";