\r\n --> \n
Cause all the .php files containing lines ending with \r\n to instead end with \n.
DYI with:
find fusionpbx -type f -name '*.php' -exec dos2unix '{}' \;
This commit is contained in:
+93
-93
@@ -1,93 +1,93 @@
|
||||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = "Emails";
|
||||
$apps[$x]['uuid'] = "bd64f590-9a24-468d-951f-6639ac728694";
|
||||
$apps[$x]['category'] = "Switch";
|
||||
$apps[$x]['subcategory'] = "";
|
||||
$apps[$x]['version'] = "";
|
||||
$apps[$x]['license'] = "Mozilla Public License 1.1";
|
||||
$apps[$x]['url'] = "http://www.fusionpbx.com";
|
||||
$apps[$x]['description']['en-us'] = "Manage failed email messages.";
|
||||
$apps[$x]['description']['es-cl'] = "Gestionar los mensajes fallidos.";
|
||||
$apps[$x]['description']['es-mx'] = "";
|
||||
$apps[$x]['description']['de-de'] = "";
|
||||
$apps[$x]['description']['de-ch'] = "";
|
||||
$apps[$x]['description']['de-at'] = "";
|
||||
$apps[$x]['description']['fr-fr'] = "GÈrer les messages Èlectroniques ÈchouÈ.";
|
||||
$apps[$x]['description']['fr-ca'] = "";
|
||||
$apps[$x]['description']['fr-ch'] = "";
|
||||
$apps[$x]['description']['pt-pt'] = "Gerenciar mensagens de e-mail falhou.";
|
||||
$apps[$x]['description']['pt-br'] = "";
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_view";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_delete";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_download";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_resend";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "emails_all";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
|
||||
|
||||
//schema details
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_emails";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_xml_cdr";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sent_date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "timestamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "timestamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "type";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "status";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
//application details
|
||||
$apps[$x]['name'] = "Emails";
|
||||
$apps[$x]['uuid'] = "bd64f590-9a24-468d-951f-6639ac728694";
|
||||
$apps[$x]['category'] = "Switch";
|
||||
$apps[$x]['subcategory'] = "";
|
||||
$apps[$x]['version'] = "";
|
||||
$apps[$x]['license'] = "Mozilla Public License 1.1";
|
||||
$apps[$x]['url'] = "http://www.fusionpbx.com";
|
||||
$apps[$x]['description']['en-us'] = "Manage failed email messages.";
|
||||
$apps[$x]['description']['es-cl'] = "Gestionar los mensajes fallidos.";
|
||||
$apps[$x]['description']['es-mx'] = "";
|
||||
$apps[$x]['description']['de-de'] = "";
|
||||
$apps[$x]['description']['de-ch'] = "";
|
||||
$apps[$x]['description']['de-at'] = "";
|
||||
$apps[$x]['description']['fr-fr'] = "GÈrer les messages Èlectroniques ÈchouÈ.";
|
||||
$apps[$x]['description']['fr-ca'] = "";
|
||||
$apps[$x]['description']['fr-ch'] = "";
|
||||
$apps[$x]['description']['pt-pt'] = "Gerenciar mensagens de e-mail falhou.";
|
||||
$apps[$x]['description']['pt-br'] = "";
|
||||
|
||||
//permission details
|
||||
$y = 0;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_view";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_delete";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_download";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "email_resend";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
$apps[$x]['permissions'][$y]['name'] = "emails_all";
|
||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||
$y++;
|
||||
|
||||
|
||||
//schema details
|
||||
$y = 1; //table array index
|
||||
$z = 0; //field array index
|
||||
$apps[$x]['db'][$y]['table'] = "v_emails";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "call_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_xml_cdr";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sent_date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "timestamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "date";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "timestamp";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "type";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "status";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "email";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
|
||||
?>
|
||||
|
||||
+64
-64
@@ -1,65 +1,65 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2008-2015
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('email_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get posted values, if any
|
||||
$email_uuid = $_REQUEST["id"];
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "delete from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
$sql .= "";
|
||||
} else {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql, $prep_statement);
|
||||
|
||||
//set message
|
||||
if ($_SESSION["message"] == '') {
|
||||
$_SESSION["message"] = $text['message-delete'];
|
||||
}
|
||||
}
|
||||
|
||||
//redirect user
|
||||
header("Location: emails.php");
|
||||
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2008-2015
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('email_delete')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get posted values, if any
|
||||
$email_uuid = $_REQUEST["id"];
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "delete from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
$sql .= "";
|
||||
} else {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset($sql, $prep_statement);
|
||||
|
||||
//set message
|
||||
if ($_SESSION["message"] == '') {
|
||||
$_SESSION["message"] = $text['message-delete'];
|
||||
}
|
||||
}
|
||||
|
||||
//redirect user
|
||||
header("Location: emails.php");
|
||||
|
||||
?>
|
||||
+206
-206
@@ -1,207 +1,207 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2008-2015
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('email_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get email
|
||||
$email_uuid = check_str($_REQUEST["id"]);
|
||||
|
||||
$msg_found = false;
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "select * from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$sent = $row['sent_date'];
|
||||
$type = $row['type'];
|
||||
$status = $row['status'];
|
||||
$email = $row['email'];
|
||||
$msg_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$msg_found) {
|
||||
$_SESSION["message"] = $text['message-invalid_email'];
|
||||
header("Location: emails.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//includes
|
||||
require('resources/pop3/mime_parser.php');
|
||||
require('resources/pop3/rfc822_addresses.php');
|
||||
|
||||
//parse the email message
|
||||
$mime = new mime_parser_class;
|
||||
$mime->decode_bodies = 1;
|
||||
$parameters = array('Data' => $email);
|
||||
$success = $mime->Decode($parameters, $decoded);
|
||||
|
||||
if ($success) {
|
||||
//get the headers
|
||||
$headers = json_decode($decoded[0]["Headers"]["x-headers:"], true);
|
||||
$subject = $decoded[0]["Headers"]["subject:"];
|
||||
$from = $decoded[0]["Headers"]["from:"];
|
||||
$reply_to = $decoded[0]["Headers"]["reply-to:"];
|
||||
$to = $decoded[0]["Headers"]["to:"];
|
||||
$subject = $decoded[0]["Headers"]["subject:"];
|
||||
|
||||
if (substr_count($subject, '=?utf-8?B?') > 0) {
|
||||
$subject = str_replace('=?utf-8?B?', '', $subject);
|
||||
$subject = str_replace('?=', '', $subject);
|
||||
$subject = base64_decode($subject);
|
||||
}
|
||||
|
||||
//get the body
|
||||
$body = '';
|
||||
$content_type = $decoded[0]['Headers']['content-type:'];
|
||||
if (substr($content_type, 0, 15) == "multipart/mixed" || substr($content_type, 0, 21) == "multipart/alternative") {
|
||||
foreach($decoded[0]["Parts"] as $row) {
|
||||
$body_content_type = $row["Headers"]["content-type:"];
|
||||
if (substr($body_content_type, 0, 9) == "text/html") { $body = $row["Body"]; }
|
||||
if (substr($body_content_type, 0, 10) == "text/plain") { $body_plain = $row["Body"]; $body = $body_plain; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
$content_type_array = explode(";", $content_type);
|
||||
$body = $decoded[0]["Body"];
|
||||
}
|
||||
|
||||
//get the attachments (if any)
|
||||
foreach ($decoded[0]['Parts'] as &$parts_array) {
|
||||
$content_type = $parts_array["Parts"][0]["Headers"]["content-type:"]; //audio/wav; name="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
|
||||
$content_transfer_encoding = $parts_array["Parts"][0]["Headers"]["content-transfer-encoding:"]; //base64
|
||||
$content_disposition = $parts_array["Parts"][0]["Headers"]["content-disposition"]; //attachment; filename="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
|
||||
$file_name = $parts_array["FileName"];
|
||||
$file_size = $parts_array["BodyLength"];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$_SESSION["message"] = $text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null);
|
||||
header("Location: emails.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//show the header
|
||||
$document['title'] = $text['title-view_email'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>";
|
||||
echo " <td valign='top' align='left' nowrap>";
|
||||
echo " <b>".$text['header-view_email']."</b>\n";
|
||||
echo " </td>";
|
||||
echo " <td valign='top' align='right' nowrap>";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location.href='emails.php';\" value='".$text['button-back']."'>";
|
||||
if (permission_exists('email_download')) {
|
||||
echo " <input type='button' class='btn' alt='".$text['button-download']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=download';\" value='".$text['button-download']."'>";
|
||||
}
|
||||
if (permission_exists('email_resend')) {
|
||||
echo " <input type='button' class='btn' alt='".$text['button-resend']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=resend';\" value='".$text['button-resend']."'>";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>".$text['label-sent']."</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>".$sent."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-type']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$text['label-type_'.$type]."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-status']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$text['label-status_'.$status]."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-from']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$from."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-to']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$to."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-subject']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$subject."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-message']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>";
|
||||
echo " <iframe id='msg_display' width='100%' height='250' scrolling='auto' cellspacing='0' style='border: 1px solid #c5d1e5; overflow: scroll;'></iframe>\n";
|
||||
echo " <textarea id='msg' width='1' height='1' style='width: 1px; height: 1px; display: none;'>".$body."</textarea>\n";
|
||||
echo " <script>";
|
||||
echo " var iframe = document.getElementById('msg_display');";
|
||||
echo " iframe.contentDocument.write(document.getElementById('msg').value);";
|
||||
echo " iframe.contentDocument.close();";
|
||||
echo " </script>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-attachment']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$file_name." (".round($file_size/1024,2)." KB)</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2008-2015
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('email_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get email
|
||||
$email_uuid = check_str($_REQUEST["id"]);
|
||||
|
||||
$msg_found = false;
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "select * from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$sent = $row['sent_date'];
|
||||
$type = $row['type'];
|
||||
$status = $row['status'];
|
||||
$email = $row['email'];
|
||||
$msg_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$msg_found) {
|
||||
$_SESSION["message"] = $text['message-invalid_email'];
|
||||
header("Location: emails.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//includes
|
||||
require('resources/pop3/mime_parser.php');
|
||||
require('resources/pop3/rfc822_addresses.php');
|
||||
|
||||
//parse the email message
|
||||
$mime = new mime_parser_class;
|
||||
$mime->decode_bodies = 1;
|
||||
$parameters = array('Data' => $email);
|
||||
$success = $mime->Decode($parameters, $decoded);
|
||||
|
||||
if ($success) {
|
||||
//get the headers
|
||||
$headers = json_decode($decoded[0]["Headers"]["x-headers:"], true);
|
||||
$subject = $decoded[0]["Headers"]["subject:"];
|
||||
$from = $decoded[0]["Headers"]["from:"];
|
||||
$reply_to = $decoded[0]["Headers"]["reply-to:"];
|
||||
$to = $decoded[0]["Headers"]["to:"];
|
||||
$subject = $decoded[0]["Headers"]["subject:"];
|
||||
|
||||
if (substr_count($subject, '=?utf-8?B?') > 0) {
|
||||
$subject = str_replace('=?utf-8?B?', '', $subject);
|
||||
$subject = str_replace('?=', '', $subject);
|
||||
$subject = base64_decode($subject);
|
||||
}
|
||||
|
||||
//get the body
|
||||
$body = '';
|
||||
$content_type = $decoded[0]['Headers']['content-type:'];
|
||||
if (substr($content_type, 0, 15) == "multipart/mixed" || substr($content_type, 0, 21) == "multipart/alternative") {
|
||||
foreach($decoded[0]["Parts"] as $row) {
|
||||
$body_content_type = $row["Headers"]["content-type:"];
|
||||
if (substr($body_content_type, 0, 9) == "text/html") { $body = $row["Body"]; }
|
||||
if (substr($body_content_type, 0, 10) == "text/plain") { $body_plain = $row["Body"]; $body = $body_plain; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
$content_type_array = explode(";", $content_type);
|
||||
$body = $decoded[0]["Body"];
|
||||
}
|
||||
|
||||
//get the attachments (if any)
|
||||
foreach ($decoded[0]['Parts'] as &$parts_array) {
|
||||
$content_type = $parts_array["Parts"][0]["Headers"]["content-type:"]; //audio/wav; name="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
|
||||
$content_transfer_encoding = $parts_array["Parts"][0]["Headers"]["content-transfer-encoding:"]; //base64
|
||||
$content_disposition = $parts_array["Parts"][0]["Headers"]["content-disposition"]; //attachment; filename="msg_b64f97e0-8570-11e4-8400-35da04cdaa74.wav"
|
||||
$file_name = $parts_array["FileName"];
|
||||
$file_size = $parts_array["BodyLength"];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$_SESSION["message"] = $text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null);
|
||||
header("Location: emails.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
//show the header
|
||||
$document['title'] = $text['title-view_email'];
|
||||
require_once "resources/header.php";
|
||||
|
||||
//show content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>";
|
||||
echo " <td valign='top' align='left' nowrap>";
|
||||
echo " <b>".$text['header-view_email']."</b>\n";
|
||||
echo " </td>";
|
||||
echo " <td valign='top' align='right' nowrap>";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location.href='emails.php';\" value='".$text['button-back']."'>";
|
||||
if (permission_exists('email_download')) {
|
||||
echo " <input type='button' class='btn' alt='".$text['button-download']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=download';\" value='".$text['button-download']."'>";
|
||||
}
|
||||
if (permission_exists('email_resend')) {
|
||||
echo " <input type='button' class='btn' alt='".$text['button-resend']."' onclick=\"document.location.href='emails.php?id=".$email_uuid."&a=resend';\" value='".$text['button-resend']."'>";
|
||||
}
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br>\n";
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>".$text['label-sent']."</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>".$sent."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-type']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$text['label-type_'.$type]."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-status']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$text['label-status_'.$status]."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-from']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$from."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-to']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$to."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-subject']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$subject."</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-message']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>";
|
||||
echo " <iframe id='msg_display' width='100%' height='250' scrolling='auto' cellspacing='0' style='border: 1px solid #c5d1e5; overflow: scroll;'></iframe>\n";
|
||||
echo " <textarea id='msg' width='1' height='1' style='width: 1px; height: 1px; display: none;'>".$body."</textarea>\n";
|
||||
echo " <script>";
|
||||
echo " var iframe = document.getElementById('msg_display');";
|
||||
echo " iframe.contentDocument.write(document.getElementById('msg').value);";
|
||||
echo " iframe.contentDocument.close();";
|
||||
echo " </script>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>".$text['label-attachment']."</td>\n";
|
||||
echo "<td class='vtable' align='left'>".$file_name." (".round($file_size/1024,2)." KB)</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<br><br>";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
+271
-271
@@ -1,271 +1,271 @@
|
||||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('email_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = ($_GET["order_by"] != '') ? $_GET["order_by"] : 'sent_date';
|
||||
$order = ($_GET["order"] != '') ? $_GET["order"] : 'desc';
|
||||
|
||||
//download email
|
||||
if ($_REQUEST['a'] == 'download' && permission_exists('email_download')) {
|
||||
$email_uuid = check_str($_REQUEST["id"]);
|
||||
|
||||
$msg_found = false;
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "select call_uuid, email from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$call_uuid = $row['call_uuid'];
|
||||
$email = $row['email'];
|
||||
$msg_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset ($prep_statement, $sql, $result, $result_count);
|
||||
}
|
||||
|
||||
if ($msg_found) {
|
||||
header("Content-Type: message/rfc822");
|
||||
header('Content-Disposition: attachment; filename="'.$call_uuid.'.eml"');
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Content-Length: ".strlen($email));
|
||||
echo $email;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//resend email
|
||||
if ($_REQUEST['a'] == 'resend' && permission_exists('email_resend')) {
|
||||
$email_uuid = check_str($_REQUEST["id"]);
|
||||
$resend = true;
|
||||
|
||||
$msg_found = false;
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "select email from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
if (!permission_exists('emails_all') || $_REQUEST['showall'] != 'true') {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$email = $row['email'];
|
||||
$msg_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset ($prep_statement, $sql, $result, $result_count);
|
||||
}
|
||||
|
||||
if ($msg_found) {
|
||||
$msg = $email;
|
||||
require_once "secure/v_mailto.php";
|
||||
if ($mailer_error == '') {
|
||||
$_SESSION["message"] = $text['message-message_resent'];
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
header("Location: email_delete.php?id=".$email_uuid."&showall=true");
|
||||
} else {
|
||||
header("Location: email_delete.php?id=".$email_uuid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$_SESSION["message_mood"] = 'negative';
|
||||
$_SESSION["message_delay"] = '4'; //sec
|
||||
$_SESSION["message"] = $text['message-resend_failed'].": ".$mailer_error;
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
header("Location: emails.php?showall=true");
|
||||
} else {
|
||||
header("Location: emails.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
//additional includes
|
||||
$document['title'] = $text['title-emails'];
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'>";
|
||||
echo " <b>".$text['header-emails']."</b>";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-emails'];
|
||||
echo " </td>\n";
|
||||
echo " <td width='50%' align='right' valign='top'>\n";
|
||||
if (permission_exists('emails_all')) {
|
||||
if ($_REQUEST['showall'] != 'true') {
|
||||
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='emails.php?showall=true';\">\n";
|
||||
}
|
||||
}
|
||||
echo " <input type='button' class='btn' alt=\"".$text['button-refresh']."\" onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_emails ";
|
||||
if (permission_exists('emails_all')) {
|
||||
if ($_REQUEST['showall'] != 'true') {
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
$param .= "&showall=true";
|
||||
} else {
|
||||
$param = "";
|
||||
}
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_emails ";
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
$sql .= " join v_domains on v_emails.domain_uuid = v_domains.domain_uuid ";
|
||||
} else {
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
if (strlen($order_by)> 0) { $sql .= "order by ".$order_by." ".$order." "; }
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, null, null, $param);
|
||||
}
|
||||
echo th_order_by('sent_date', $text['label-sent'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('type', $text['label-type'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('status', $text['label-status'], $order_by, $order, null, null, $param);
|
||||
echo "<th>".$text['label-message']."</th>\n";
|
||||
echo "<th>".$text['label-reference']."</th>\n";
|
||||
echo "<td class='list_control_icons'> </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
|
||||
//get call details
|
||||
$sql = "select caller_id_name, caller_id_number, destination_number from v_xml_cdr ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and uuid = '".$row['call_uuid']."' ";
|
||||
//echo "<tr><td colspan='40'>".$sql."</td></tr>";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result2 = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result2 as $row2) {
|
||||
$caller_id_name = ($row2['caller_id_name'] != '') ? $row2['caller_id_name'] : null;
|
||||
$caller_id_number = ($row2['caller_id_number'] != '') ? $row2['caller_id_number'] : null;
|
||||
$destination_number = ($row2['destination_number'] != '') ? $row2['destination_number'] : null;
|
||||
}
|
||||
unset($prep_statement, $sql);
|
||||
|
||||
$tr_link = "href='email_view.php?id=".$row['email_uuid']."'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_name']."</td>\n";
|
||||
}
|
||||
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
$sent_date = explode('.', $row['sent_date']);
|
||||
echo $sent_date[0];
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-type_'.$row['type']]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-status_'.$row['status']]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'>";
|
||||
echo " <a href='email_view.php?id=".$row['email_uuid']."'>".$text['label-message_view']."</a> ";
|
||||
if (permission_exists('email_download')) {
|
||||
echo " <a href='?id=".$row['email_uuid']."&a=download'>".$text['label-download']."</a> ";
|
||||
}
|
||||
if (permission_exists('email_resend')) {
|
||||
echo " <a href='?id=".$row['email_uuid']."&a=resend";
|
||||
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
|
||||
echo "&showall=true";
|
||||
}
|
||||
echo "'>" . $text['label-resend']."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg tr_link_void' style='white-space: nowrap; vertical-align: top;'>";
|
||||
echo " <a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr_details.php?uuid=".$row['call_uuid']."'>".$text['label-reference_cdr']."</a>";
|
||||
echo " ".($caller_id_name != '') ? " ".$caller_id_name." (".format_phone($caller_id_number).")" : $caller_id_number;
|
||||
echo " <span style='font-size: 150%; line-height: 10px;'>⇢</span> ".$destination_number;
|
||||
echo " </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
echo "<a href='email_view.php?id=".$row['email_uuid']."' alt='".$text['label-message_view']."'>$v_link_label_view</a>";
|
||||
if (permission_exists('email_delete')) {
|
||||
echo "<a href='email_delete.php?id=".$row['email_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='21' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
<?php
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('email_view')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get variables used to control the order
|
||||
$order_by = ($_GET["order_by"] != '') ? $_GET["order_by"] : 'sent_date';
|
||||
$order = ($_GET["order"] != '') ? $_GET["order"] : 'desc';
|
||||
|
||||
//download email
|
||||
if ($_REQUEST['a'] == 'download' && permission_exists('email_download')) {
|
||||
$email_uuid = check_str($_REQUEST["id"]);
|
||||
|
||||
$msg_found = false;
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "select call_uuid, email from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$call_uuid = $row['call_uuid'];
|
||||
$email = $row['email'];
|
||||
$msg_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset ($prep_statement, $sql, $result, $result_count);
|
||||
}
|
||||
|
||||
if ($msg_found) {
|
||||
header("Content-Type: message/rfc822");
|
||||
header('Content-Disposition: attachment; filename="'.$call_uuid.'.eml"');
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header("Content-Length: ".strlen($email));
|
||||
echo $email;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//resend email
|
||||
if ($_REQUEST['a'] == 'resend' && permission_exists('email_resend')) {
|
||||
$email_uuid = check_str($_REQUEST["id"]);
|
||||
$resend = true;
|
||||
|
||||
$msg_found = false;
|
||||
|
||||
if ($email_uuid != '') {
|
||||
$sql = "select email from v_emails ";
|
||||
$sql .= "where email_uuid = '".$email_uuid."' ";
|
||||
if (!permission_exists('emails_all') || $_REQUEST['showall'] != 'true') {
|
||||
$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
$email = $row['email'];
|
||||
$msg_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset ($prep_statement, $sql, $result, $result_count);
|
||||
}
|
||||
|
||||
if ($msg_found) {
|
||||
$msg = $email;
|
||||
require_once "secure/v_mailto.php";
|
||||
if ($mailer_error == '') {
|
||||
$_SESSION["message"] = $text['message-message_resent'];
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
header("Location: email_delete.php?id=".$email_uuid."&showall=true");
|
||||
} else {
|
||||
header("Location: email_delete.php?id=".$email_uuid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$_SESSION["message_mood"] = 'negative';
|
||||
$_SESSION["message_delay"] = '4'; //sec
|
||||
$_SESSION["message"] = $text['message-resend_failed'].": ".$mailer_error;
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
header("Location: emails.php?showall=true");
|
||||
} else {
|
||||
header("Location: emails.php");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
//additional includes
|
||||
$document['title'] = $text['title-emails'];
|
||||
require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='50%' align='left' valign='top' nowrap='nowrap'>";
|
||||
echo " <b>".$text['header-emails']."</b>";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-emails'];
|
||||
echo " </td>\n";
|
||||
echo " <td width='50%' align='right' valign='top'>\n";
|
||||
if (permission_exists('emails_all')) {
|
||||
if ($_REQUEST['showall'] != 'true') {
|
||||
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='emails.php?showall=true';\">\n";
|
||||
}
|
||||
}
|
||||
echo " <input type='button' class='btn' alt=\"".$text['button-refresh']."\" onclick=\"document.location.reload();\" value='".$text['button-refresh']."'>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_emails ";
|
||||
if (permission_exists('emails_all')) {
|
||||
if ($_REQUEST['showall'] != 'true') {
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
}
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
$num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0;
|
||||
}
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
$param .= "&showall=true";
|
||||
} else {
|
||||
$param = "";
|
||||
}
|
||||
$page = $_GET['page'];
|
||||
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_emails ";
|
||||
if (permission_exists('emails_all') && $_REQUEST['showall'] == 'true') {
|
||||
$sql .= " join v_domains on v_emails.domain_uuid = v_domains.domain_uuid ";
|
||||
} else {
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
}
|
||||
if (strlen($order_by)> 0) { $sql .= "order by ".$order_by." ".$order." "; }
|
||||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, null, null, $param);
|
||||
}
|
||||
echo th_order_by('sent_date', $text['label-sent'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('type', $text['label-type'], $order_by, $order, null, null, $param);
|
||||
echo th_order_by('status', $text['label-status'], $order_by, $order, null, null, $param);
|
||||
echo "<th>".$text['label-message']."</th>\n";
|
||||
echo "<th>".$text['label-reference']."</th>\n";
|
||||
echo "<td class='list_control_icons'> </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
|
||||
//get call details
|
||||
$sql = "select caller_id_name, caller_id_number, destination_number from v_xml_cdr ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and uuid = '".$row['call_uuid']."' ";
|
||||
//echo "<tr><td colspan='40'>".$sql."</td></tr>";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result2 = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result2 as $row2) {
|
||||
$caller_id_name = ($row2['caller_id_name'] != '') ? $row2['caller_id_name'] : null;
|
||||
$caller_id_number = ($row2['caller_id_number'] != '') ? $row2['caller_id_number'] : null;
|
||||
$destination_number = ($row2['destination_number'] != '') ? $row2['destination_number'] : null;
|
||||
}
|
||||
unset($prep_statement, $sql);
|
||||
|
||||
$tr_link = "href='email_view.php?id=".$row['email_uuid']."'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['domain_name']."</td>\n";
|
||||
}
|
||||
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
$sent_date = explode('.', $row['sent_date']);
|
||||
echo $sent_date[0];
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-type_'.$row['type']]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-status_'.$row['status']]."</td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void'>";
|
||||
echo " <a href='email_view.php?id=".$row['email_uuid']."'>".$text['label-message_view']."</a> ";
|
||||
if (permission_exists('email_download')) {
|
||||
echo " <a href='?id=".$row['email_uuid']."&a=download'>".$text['label-download']."</a> ";
|
||||
}
|
||||
if (permission_exists('email_resend')) {
|
||||
echo " <a href='?id=".$row['email_uuid']."&a=resend";
|
||||
if ($_REQUEST['showall'] == true && permission_exists('emails_all')) {
|
||||
echo "&showall=true";
|
||||
}
|
||||
echo "'>" . $text['label-resend']."</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='row_stylebg tr_link_void' style='white-space: nowrap; vertical-align: top;'>";
|
||||
echo " <a href='".PROJECT_PATH."/app/xml_cdr/xml_cdr_details.php?uuid=".$row['call_uuid']."'>".$text['label-reference_cdr']."</a>";
|
||||
echo " ".($caller_id_name != '') ? " ".$caller_id_name." (".format_phone($caller_id_number).")" : $caller_id_number;
|
||||
echo " <span style='font-size: 150%; line-height: 10px;'>⇢</span> ".$destination_number;
|
||||
echo " </td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
echo "<a href='email_view.php?id=".$row['email_uuid']."' alt='".$text['label-message_view']."'>$v_link_label_view</a>";
|
||||
if (permission_exists('email_delete')) {
|
||||
echo "<a href='email_delete.php?id=".$row['email_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($c==0) { $c=1; } else { $c=0; }
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='21' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap='nowrap'>$paging_controls</td>\n";
|
||||
echo " <td width='33.3%' nowrap='nowrap'> </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br /><br />";
|
||||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user