Update and rename email_view.php to email_log_view.php

This commit is contained in:
FusionPBX 2019-04-18 09:15:41 -06:00 committed by GitHub
parent 29bc8ff39c
commit 4e06fa466e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 18 deletions

View File

@ -23,37 +23,40 @@
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
*/ */
include "root.php";
require_once "resources/require.php"; //includes
require_once "resources/check_auth.php"; include "root.php";
if (permission_exists('email_view')) { require_once "resources/require.php";
//access granted require_once "resources/check_auth.php";
}
else { //check permissions
echo "access denied"; if (permission_exists('email_log_view')) {
exit; //access granted
} }
else {
echo "access denied";
exit;
}
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
//get email //get email
$email_uuid = check_str($_REQUEST["id"]); $email_log_uuid = check_str($_REQUEST["id"]);
$msg_found = false; $msg_found = false;
if ($email_uuid != '') { if ($email_uuid != '') {
$sql = "select * from v_emails "; $sql = "select * from v_email_logs ";
$sql .= "where email_uuid = '".$email_uuid."' "; $sql .= "where email_uuid = '".$email_log_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' "; $sql .= "and domain_uuid = '".$domain_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql); unset ($prep_statement, $sql);
if ($result_count > 0) { if (is_array($result)) {
foreach($result as $row) { foreach($result as $row) {
$sent = $row['sent_date']; $sent = $row['sent_date'];
$type = $row['type']; $type = $row['type'];
@ -67,7 +70,7 @@ else {
if (!$msg_found) { if (!$msg_found) {
message::add($text['message-invalid_email']); message::add($text['message-invalid_email']);
header("Location: emails.php"); header("Location: email_logs.php");
exit; exit;
} }
@ -122,7 +125,7 @@ else {
} }
else { else {
message::add($text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null)); message::add($text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null));
header("Location: emails.php"); header("Location: email_logs.php");
exit; exit;
} }
@ -204,4 +207,5 @@ else {
//include the footer //include the footer
require_once "resources/footer.php"; require_once "resources/footer.php";
?>
?>