diff --git a/app/email_logs/app_config.php b/app/email_logs/app_config.php deleted file mode 100644 index 0eac990d59..0000000000 --- a/app/email_logs/app_config.php +++ /dev/null @@ -1,135 +0,0 @@ - \ No newline at end of file diff --git a/app/email_logs/app_languages.php b/app/email_logs/app_languages.php deleted file mode 100644 index 1986fbe574..0000000000 --- a/app/email_logs/app_languages.php +++ /dev/null @@ -1,844 +0,0 @@ - diff --git a/app/email_logs/app_menu.php b/app/email_logs/app_menu.php deleted file mode 100644 index c3025caa72..0000000000 --- a/app/email_logs/app_menu.php +++ /dev/null @@ -1,37 +0,0 @@ - diff --git a/app/email_logs/email_log_cron.php b/app/email_logs/email_log_cron.php deleted file mode 100644 index d0b41ea8ff..0000000000 --- a/app/email_logs/email_log_cron.php +++ /dev/null @@ -1,60 +0,0 @@ -get(); - } - else { - die('access denied'); - } - -//get the failed emails - $sql = "select email_log_uuid, email from v_email_logs limit 100"; - $database = new database; - $emails = $database->select($sql, null, 'all'); - -//process the emails - if (is_array($emails) && @sizeof($emails) != 0) { - foreach($emails as $x => $row) { - $email_log_uuid = $row['email_log_uuid']; - $msg = $row['email']; - - require_once "secure/v_mailto.php"; - if ($mailer_error == '') { - //set the message - message::add($text['message-message_resent']); - - //build delete array - $array['email_logs'][$x]['email_log_uuid'] = $email_log_uuid; - } - unset($mailer_error); - } - if (is_array($array) && @sizeof($array) != 0) { - //grant temporary permissions - $p = new permissions; - $p->add('email_log_delete', 'temp'); - //execute delete - $database = new database; - $database->app_name = 'email_logs'; - $database->app_uuid = 'bd64f590-9a24-468d-951f-6639ac728694'; - $database->delete($array); - unset($array); - //revoke temporary permissions - $p->delete('email_log_delete', 'temp'); - } - } - unset($sql, $emails, $x, $row); - -?> diff --git a/app/email_logs/email_log_view.php b/app/email_logs/email_log_view.php deleted file mode 100644 index a53904cd6e..0000000000 --- a/app/email_logs/email_log_view.php +++ /dev/null @@ -1,205 +0,0 @@ - - Copyright (C) 2008-2019 - All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//set the include path - $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); - set_include_path(parse_ini_file($conf[0])['document.root']); - -//includes files - require_once "resources/require.php"; - require_once "resources/check_auth.php"; - require_once "resources/pop3/mime_parser.php"; - require_once "resources/pop3/rfc822_addresses.php"; - -//check permissions - if (permission_exists('email_log_view')) { - //access granted - } - else { - echo "access denied"; - exit; - } - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get email - $email_log_uuid = $_REQUEST["id"]; - - if (is_uuid($email_log_uuid)) { - $sql = "select * from v_email_logs "; - $sql .= "where email_log_uuid = :email_log_uuid "; - $sql .= "and domain_uuid = :domain_uuid "; - $parameters['email_log_uuid'] = $email_log_uuid; - $parameters['domain_uuid'] = $domain_uuid; - $database = new database; - $row = $database->select($sql, $parameters, 'row'); - if (is_array($row) && @sizeof($row) != 0) { - $sent = $row['sent_date']; - $type = $row['type']; - $status = $row['status']; - $email = $row['email']; - } - else { - message::add($text['message-invalid_email']); - header("Location: email_logs.php"); - exit; - } - unset($sql, $parameters, $row); - } - else { - header("Location: email_logs.php"); - exit; - } - -//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 { - message::add($text['message-decoding_error'].(($mime->error != '') ? ': '.htmlspecialchars($mime->error) : null)); - header("Location: email_logs.php"); - exit; - } - -//show the header - $document['title'] = $text['title-view_email']; - require_once "resources/header.php"; - -//show the content - echo "
\n"; - echo "
".$text['header-view_email']."
\n"; - echo "
\n"; - echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'email_logs.php']); - if (permission_exists('email_download')) { - echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'email_logs.php?id='.urlencode($email_log_uuid).'&a=download']); - } - if (permission_exists('email_resend')) { - echo button::create(['type'=>'button','label'=>$text['button-resend'],'icon'=>'paper-plane','id'=>'btn_save','link'=>'email_logs.php?id='.urlencode($email_log_uuid).'&a=resend']); - } - echo "
\n"; - echo "
\n"; - echo "
\n"; - - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "
".$text['label-sent']."".$sent."
".$text['label-type']."".$text['label-type_'.$type]."
".$text['label-status']."".$text['label-status_'.$status]."
".$text['label-from']."".$from."
".$text['label-to']."".$to."
".$text['label-subject']."".$subject."
".$text['label-message'].""; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
".$text['label-attachment']."".$file_name." (".round($file_size/1024,2)." KB)
\n"; - echo "

"; - -//include the footer - require_once "resources/footer.php"; - -?> \ No newline at end of file diff --git a/app/email_logs/email_logs.php b/app/email_logs/email_logs.php deleted file mode 100644 index ff4f1a4d13..0000000000 --- a/app/email_logs/email_logs.php +++ /dev/null @@ -1,376 +0,0 @@ - -*/ - -//set the include path - $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); - set_include_path(parse_ini_file($conf[0])['document.root']); - -//includes files - require_once "resources/require.php"; - require_once "resources/check_auth.php"; - require_once "resources/paging.php"; - -//check permissions - if (permission_exists('email_log_view')) { - //access granted - } - else { - echo "access denied"; - exit; - } - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//get posted data - if (is_array($_POST['emails'])) { - $action = $_POST['action']; - $search = $_POST['search']; - $emails = $_POST['emails']; - } - -//process the http post data by action - if ($action != '' && is_array($emails) && @sizeof($emails) != 0) { - switch ($action) { - case 'resend': - if (permission_exists('email_log_resend')) { - $obj = new email_logs; - $obj->resend($emails); - } - break; - case 'delete': - if (permission_exists('email_log_delete')) { - $obj = new email_logs; - $obj->delete($emails); - } - break; - } - - header('Location: email_logs.php'.($search != '' ? '?search='.urlencode($search) : null)); - exit; - } - -//get order and order by and sanatize the values - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; - -//add the search term - $search = strtolower($_GET["search"]); - -//prepare to page the results - $sql = "select count(*) from v_email_logs "; - if ($_REQUEST['show'] == 'all' && permission_exists('email_log_all')) { - $sql .= "where true "; - } - else { - $sql .= "where domain_uuid = :domain_uuid "; - $parameters['domain_uuid'] = $domain_uuid; - } - if (!empty($search)) { - $sql = "and ("; - $sql .= "lower(type) like :search "; - $sql .= "or lower(email) like :search "; - $sql .= ") "; - $parameters['search'] = '%'.$search.'%'; - } - $database = new database; - $num_rows = $database->select($sql, $parameters, 'column'); - -//prepare to page the results - $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = "search=".$search; - if ($_GET['show'] == "all" && permission_exists('email_log_all')) { - $param .= "&show=all"; - } - $page = $_GET['page']; - if (empty($page)) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); - list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); - $offset = $rows_per_page * $page; - -//get the list - $sql = "select * from v_email_logs "; - if ($_REQUEST['show'] == 'all' && permission_exists('email_log_all')) { - $sql .= "where true "; - } - else { - $sql .= "where domain_uuid = :domain_uuid "; - $parameters['domain_uuid'] = $domain_uuid; - } - if (!empty($search)) { - $sql = "and ("; - $sql .= "lower(type) like :search "; - $sql .= "or lower(email) like :search "; - $sql .= ") "; - $parameters['search'] = '%'.$search.'%'; - } - $sql .= order_by($order_by, $order, 'sent_date', 'desc'); - $sql .= limit_offset($rows_per_page, $offset); - $database = new database; - $result = $database->select($sql, $parameters, 'all'); - unset($sql, $parameters); - -//get call details - if (is_array($result) && @sizeof($result) != 0) { - foreach ($result as $row) { - $sql = "select caller_id_name, caller_id_number, destination_number "; - $sql .= "from v_xml_cdr "; - $sql .= "where domain_uuid = :domain_uuid "; - $sql .= "and xml_cdr_uuid = :uuid "; - $parameters['domain_uuid'] = $domain_uuid; - $parameters['uuid'] = $row['call_uuid']; - $database = new database; - $result2 = $database->select($sql, $parameters, 'all'); - if (is_array($result2) && @sizeof($result2) != 0) { - foreach($result2 as $row2) { - $call[$row['call_uuid']]['caller_id_name'] = $row2['caller_id_name']; - $call[$row['call_uuid']]['caller_id_number'] = $row2['caller_id_number']; - $call[$row['call_uuid']]['destination_number'] = $row2['destination_number']; - } - } - unset($sql, $parameters, $result2, $row2); - } - } - -//create token - $object = new token; - $token = $object->create('/app/email_logs/email_logs.php'); - -//include the header - $document['title'] = $text['title-emails']; - require_once "resources/header.php"; - -//test result layer - echo "\n"; - - echo "\n"; - -//show the content - echo "
\n"; - echo "
".$text['header-emails']." (".$num_rows.")
\n"; - echo "
\n"; - echo "
\n"; - echo button::create(['label'=>$text['button-test'],'icon'=>'tools','type'=>'button','id'=>'test_button','style'=>'margin-right: 15px;','onclick'=>"$(this).fadeOut(400, function(){ $('span#form_test').fadeIn(400); $('#to').trigger('focus'); });"]); - echo " \n"; - echo " \n"; - echo "
"; - if (permission_exists('email_log_resend') && $result) { - echo button::create(['type'=>'button','label'=>$text['button-resend'],'icon'=>'paper-plane','onclick'=>"modal_open('modal-resend','btn_resend');"]); - } - if (permission_exists('email_log_delete') && $result) { - echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','onclick'=>"modal_open('modal-delete','btn_delete');"]); - } - echo "\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - - if (permission_exists('email_log_resend') && $result) { - echo modal::create(['id'=>'modal-resend','type'=>'general','message'=>$text['confirm-resend'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_resend','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('resend'); list_form_submit('form_list');"])]); - } - if (permission_exists('email_log_delete') && $result) { - echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]); - } - - echo $text['description-emails']."\n"; - echo "

\n"; - - /* - echo "
\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
"; - echo " ".$text['header-emails'].""; - echo "

"; - echo " ".$text['description-emails']; - echo "
\n"; - echo " \n"; - echo " \n"; - if (permission_exists('email_log_all')) { - if ($_REQUEST['showall'] != 'true') { - echo " \n"; - } - } - echo " \n"; - echo "
\n"; - echo "\n"; - echo "
\n"; - echo "
\n"; - */ - - echo "
\n"; - echo "\n"; - echo "\n"; - - echo "\n"; - echo "\n"; - if (permission_exists('email_log_resend') || permission_exists('email_log_delete')) { - echo " \n"; - } - if ($_GET['show'] == "all" && permission_exists('email_log_all')) { - echo th_order_by('domain_name', $text['label-domain'], $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 "\n"; - echo "\n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { - echo " \n"; - } - echo "\n"; - - if (is_array($result) && @sizeof($result) != 0) { - $x = 0; - foreach($result as $row) { - $list_row_url = "email_log_view.php?id=".urlencode($row['email_log_uuid']); - echo "\n"; - if (permission_exists('email_log_resend') || permission_exists('email_log_delete')) { - echo " \n"; - } - if ($_GET['show'] == "all" && permission_exists('email_log_all')) { - echo " \n"; - } - $sent_date = explode('.', $row['sent_date']); - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - if ($_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { - echo " \n"; - } - echo "\n"; - $x++; - - } - unset($result); - } - - echo "
\n"; - echo " \n"; - echo " ".$text['label-actions']."".$text['label-reference']." 
\n"; - echo " \n"; - echo " \n"; - echo " ".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."".$sent_date[0]."".$text['label-type_'.escape($row['type'])]."".$text['label-status_'.escape($row['status'])].""; - echo button::create(['type'=>'button','title'=>$text['label-message_view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>$list_row_url]); - echo "
\n"; - echo "
\n"; - echo "
".$paging_controls."
\n"; - - echo "\n"; - - echo "
\n"; - -//test script - echo "\n"; - -//include the footer - require_once "resources/footer.php"; - -?> diff --git a/app/email_logs/email_test.php b/app/email_logs/email_test.php deleted file mode 100644 index 2c5d1f254f..0000000000 --- a/app/email_logs/email_test.php +++ /dev/null @@ -1,127 +0,0 @@ - - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -//set the include path - $conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE); - set_include_path(parse_ini_file($conf[0])['document.root']); - -//includes files - require_once "resources/require.php"; - require_once "resources/check_auth.php"; - -//check permissions - if (!permission_exists('email_log_view')) { - echo "access denied"; - exit; - } - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//validate the token - $token = new token; - if (!$token->validate('/app/email_logs/email_logs.php')) { - //message::add($text['message-invalid_token'],'negative'); - echo ""; - echo "
\n"; - echo $text['message-invalid_token']; - echo "

\n"; - echo " \n"; - echo "
\n"; - exit; - } - - -//show the content - echo "".$text['header-settings']."\n"; - echo "

\n"; - ksort($_SESSION['email']); - foreach ($_SESSION['email'] as $name => $setting) { - foreach ($setting as $type => $value) { - if ($type == 'uuid') { $uuid = $value; continue; } - if ($name == 'smtp_password') { $value = '[REDACTED]'; } - if (permission_exists('default_setting_edit')) { - echo "".$name.': '.$value."
\n"; - } - else { - echo $name.': '.$value."
\n"; - } - } - } - echo "

\n"; - - echo "".$text['header-connection']."\n"; - echo "

\n"; - -//prepare the email - $email_recipient = check_str($_POST['to']); - - $email_body = "Test Message

\n"; - $email_body .= "This message is a test of the SMTP settings configured within your PBX.
\n"; - $email_body .= "If you received this message, your current SMTP settings are valid.

\n"; - - //$email_attachments[0]['type'] = 'file'; - //$email_attachments[0]['name'] = 'logo.png'; - //$email_attachments[0]['value'] = $_SERVER["PROJECT_ROOT"]."/themes/default/images/logo.png"; - - $email_from_address = $_SESSION['email']['smtp_from']['text']; - $email_from_name = $_SESSION['email']['smtp_from_name']['text']; - -//send email - //$sent = !send_email($email_recipient, 'Test Message', $email_body, $email_error, null, null, 3, 3, $email_attachments) ? false : true; - //$email_response = ob_get_clean(); - -//send email - $email = new email; - $email->recipients = $email_recipient; - $email->subject = 'Test Message'; - $email->body = $email_body; - $email->from_address = $email_from_address; - $email->from_name = $email_from_name; - $email->attachments = $email_attachments; - $email->debug_level = 3; - $email->method = 'direct'; - $sent = $email->send(); - $email_response = $email->response; - //$email_error = $email->email_error; - -//show the response - echo $email_response; - -//show additional information - echo "

\n"; - - echo "".$text['header-result']."\n"; - echo "

\n"; - echo $sent ? "Message Sent Successfully
Receipient: ".$email_recipient."" : "Message Failed...
".$email_error; - - echo "
\n"; - echo "
\n"; - echo " \n"; - echo "
\n"; - -?> diff --git a/app/email_logs/resources/classes/email_logs.php b/app/email_logs/resources/classes/email_logs.php deleted file mode 100644 index c9eed495ba..0000000000 --- a/app/email_logs/resources/classes/email_logs.php +++ /dev/null @@ -1,193 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2019 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//define the email logs class -if (!class_exists('email_logs')) { - class email_logs { - - /** - * declare private parameters - */ - private $app_name; - private $app_uuid; - private $permission_prefix; - private $list_page; - private $table; - private $uuid_prefix; - - /** - * called when the object is created - */ - public function __construct() { - - //assign private parameters - $this->app_name = 'email_logs'; - $this->app_uuid = 'bd64f590-9a24-468d-951f-6639ac728694'; - $this->permission_prefix = 'email_log_'; - $this->list_page = 'email_logs.php'; - $this->table = 'email_logs'; - $this->uuid_prefix = 'email_log_'; - - } - - /** - * delete records - */ - public function delete($records) { - if (permission_exists($this->permission_prefix.'delete')) { - - //add multi-lingual support - $language = new text; - $text = $language->get(); - - //validate the token - $token = new token; - if (!$token->validate('/app/email_logs/email_logs.php')) { - message::add($text['message-invalid_token'],'negative'); - header('Location: '.$this->list_page); - exit; - } - - //delete multiple records - if (is_array($records) && @sizeof($records) != 0) { - - //build the delete array - foreach ($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; - } - } - - //delete the checked rows - if (is_array($array) && @sizeof($array) != 0) { - - //execute delete - $database = new database; - $database->app_name = $this->app_name; - $database->app_uuid = $this->app_uuid; - $database->delete($array); - unset($array); - - //set message - message::add($text['message-delete']); - } - unset($records); - } - } - } - - /** - * resend records - */ - public function resend($records) { - if (permission_exists($this->permission_prefix.'resend')) { - - //add multi-lingual support - $language = new text; - $text = $language->get(); - - //validate the token - $token = new token; - if (!$token->validate('/app/email_logs/email_logs.php')) { - message::add($text['message-invalid_token'],'negative'); - header('Location: '.$this->list_page); - exit; - } - - //resend multiple records (eventually) - if (is_array($records) && @sizeof($records) != 0) { - - //retrieve checked records - foreach($records as $x => $record) { - if ($record['checked'] == 'true' && is_uuid($record['uuid'])) { - $uuids[] = $record['uuid']; - } - } - - //resend emails - if (is_array($uuids) && @sizeof($uuids) != 0) { - $x = 0; - foreach ($uuids as $x => $uuid) { - - //get email message - $sql = "select email from v_email_logs "; - $sql .= "where email_log_uuid = :email_log_uuid "; - $parameters['email_log_uuid'] = $uuid; - $database = new database; - $msg = $database->select($sql, $parameters, 'column'); - $found = $msg != '' ? true : false; - unset($sql, $parameters, $row); - - //resend email - if ($found) { - $resend = true; - require "secure/v_mailto.php"; - - if ($sent) { - - //build the delete array - $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; - - //grant temporary permissions - $p = new permissions; - $p->add('email_log_delete', 'temp'); - - //delete the email log - $database = new database; - $database->app_name = $this->app_name; - $database->app_uuid = $this->app_uuid; - $database->delete($array); - unset($array); - - //revoke temporary permissions - $p->delete('email_log_delete', 'temp'); - - //set message - message::add($text['message-message_resent']); - - } - else { - //set message - message::add($text['message-resend_failed'].": ".$email->email_error, 'negative', 4000); - - } - } - - //increment counter - $x++; - - } - } - - } - - } - } - - } //class -} - -?>