static function SendTestMail($amount = 0) { Logging::SecurityLog("ServerManager::SendTestMail", "", CALLER_SYSTEM_ID); if (OperatorRequest::IsValidated() && OperatorRequest::IsAdministrator(true)) { $account = Mailbox::GetById($_POST["p_mailbox"]); try { if ($account->Type == "IMAP" || $account->Type == "POP") { $reload = false; $amount = $account->Download($reload, false, true); $return = 1; } else { $return = Communication::SendEmail($account, $account->Email, $account->Email, "LiveZilla Test Mail", "", "LiveZilla Test Mail", true); } } catch (Exception $e) { Logging::GeneralLog(serialize($e)); $return = $e->getMessage(); } if (is_array($amount)) { $amount = count($amount); } if ($return == 1) { Server::$Response->SetStandardResponse(1, base64_encode($amount)); } else { Server::$Response->SetStandardResponse(2, base64_encode($return)); } } }
function SendAutoresponder($_visitor = null, $_browser = null, $_message = null) { if (empty($_message)) { $_message = $this->Messages[0]; } $tsData = array("", "", ""); if (!empty(Server::$Groups[$this->Group]->PredefinedMessages)) { $pdm = PredefinedMessage::GetByLanguage(Server::$Groups[$this->Group]->PredefinedMessages, $this->Language); if ($pdm != null) { if (!empty($pdm->EmailTicketResponderBodyPlaintext)) { $tsData[0] = $pdm->EmailTicketResponderBodyPlaintext; } if (!empty($pdm->EmailTicketResponderBodyHTML)) { $tsData[1] = $pdm->EmailTicketResponderBodyHTML; } $tsData[2] = $pdm->SubjectTicketResponder; } } for ($i = 0; $i < count($tsData); $i++) { $tText = ($i != 1 ? $_message->Text : nl2br($_message->Text)) . "<!--lz_ref_link-->"; $tsData[$i] = str_replace("%mailtext%", $tText, $tsData[$i]); $tsData[$i] = $_message->TextReplace($tsData[$i], $this->Group); $tsData[$i] = $this->TextReplace($tsData[$i]); $tsData[$i] = Server::$Groups[$this->Group]->TextReplace($tsData[$i], $this->Language); if (!empty($_visitor)) { $tsData[$i] = $_visitor->TextReplace($tsData[$i]); } if (!empty($_browser)) { $tsData[$i] = $_browser->TextReplace($tsData[$i]); } $tsData[$i] = Configuration::Replace($tsData[$i]); $tsData[$i] = Mailbox::FinalizeEmail($tsData[$i], $i == 1); $tsData[$i] = Server::Replace($tsData[$i]); } //$mailbox = Mailbox::GetDefaultOutgoing(); $mailbox = Mailbox::GetById(Server::$Groups[$this->Group]->TicketEmailOut, true); if ($mailbox != null) { $mb = clone $mailbox; $replytoint = Mailbox::IsValidEmail($_message->Email) ? $_message->Email : $mb->Email; $replytoex = $mb->Email; $fakeSender = ""; if (!empty(Server::$Configuration->File["gl_usmasend"]) && Mailbox::IsValidEmail($_message->Email)) { $fakeSender = $_message->Email; } if (!empty(Server::$Configuration->File["gl_scom"])) { Communication::SendEmail($mb, Server::$Configuration->File["gl_scom"], $replytoint, $tsData[0], $tsData[1], $tsData[2], false, null, $fakeSender); } if (!empty(Server::$Configuration->File["gl_sgom"])) { Communication::SendEmail($mb, Server::$Groups[$this->Group]->Email, $replytoint, $tsData[0], $tsData[1], $tsData[2], false, null, $fakeSender); } if (!empty(Server::$Configuration->File["gl_ssom"]) && Mailbox::IsValidEmail($_message->Email)) { Communication::SendEmail($mb, str_replace(";", ",", $_message->Email), $replytoex, $tsData[0], $tsData[1], $tsData[2], false, null, $fakeSender); } } }
function processTicketActions($count = 0) { global $GROUPS, $CONFIG; $temporaryIds = array(); while (isset($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vc"])) { $type = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vc"]; if ($type == "SetTicketStatus") { $Ticket = new Ticket(); $Ticket->Id = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_va"]; if ($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"] != $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]) { $Ticket->Log(0, CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]); } if (!empty($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vb"]) && $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vb"] != $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_3"]) { $Ticket->Log(2, CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vb"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_3"]); } if ($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"] != $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]) { $Ticket->Log(3, CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]); } $TicketEditor = new TicketEditor($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_va"]); if (!empty($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vb"])) { $TicketEditor->Editor = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vb"]; } $TicketEditor->Status = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"]; $TicketEditor->GroupId = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"]; $TicketEditor->Save(); if ($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"] != $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]) { $Ticket->SetGroup($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"]); } $Ticket->Editor = $TicketEditor; $Ticket->LoadMessages(); $Ticket->SetLastUpdate(time()); } else { if ($type == "AddTicketEditorReply") { $Ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_3"]); $Ticket->Group = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]; $Ticket->Messages[0]->Id = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_6"]; $Ticket->Messages[0]->ChannelId = getId(32); $Ticket->Messages[0]->Hash = $Ticket->GetHash(false); $Ticket->Messages[0]->SenderUserId = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vb"]; $Ticket->Messages[0]->Type = 1; $Ticket->Messages[0]->Email = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]; $Ticket->Messages[0]->Text = Mailbox::FinalizeEmail($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"]); $Ticket->Messages[0]->Subject = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_5"]; $Ticket->Messages[0]->Save($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_va"], time()); $acount = 7; $att = array(); while (isset($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_" . $acount])) { $att[$_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_" . $acount]] = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_" . $acount]; $Ticket->Messages[0]->ApplyAttachment($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_" . $acount++]); } $mailbox = Mailbox::GetById($GROUPS[$Ticket->Group]->TicketEmailOut, true); $Ticket->SendEditorReply($mailbox, $Ticket->Messages[0]->Text, getPredefinedMessage($GROUPS[$Ticket->Group]->PredefinedMessages, $Ticket->Language), $att, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_5"]); if (!empty($CONFIG["gl_ctor"])) { $Ticket->LoadStatus(); $Ticket->Editor->Status = TICKET_STATUS_CLOSED; $Ticket->Editor->Save(); } $Ticket->SetLastUpdate(time()); } else { if ($type == "SetTicketLanguage") { $Ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"]); $Ticket->SetLanguage($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"]); $Ticket->Log(1, CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]); $Ticket->SetLastUpdate(time()); } else { if ($type == "DeleteTicketFromServer") { $Ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], ""); $Ticket->Destroy(); $Ticket->Log(7, CALLER_SYSTEM_ID, 0, 1); $Ticket->SetLastUpdate(time()); } else { if ($type == "AddComment") { $Ticket = new TicketMessage($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], ""); $Ticket->AddComment(CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]); $Ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"], ""); $Ticket->SetLastUpdate(time()); } else { if ($type == "LinkChat") { if (!empty($temporaryIds[$_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"]])) { $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"] = $temporaryIds[$_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"]]; } $Ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], ""); $Ticket->LinkChat($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], getId(32)); $Ticket->Log(5, CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"]); $Ticket->SetLastUpdate(time()); } else { if ($type == "LinkTicket") { $Ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], ""); $TicketSub = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], ""); $counts[$Ticket->Id] = Ticket::GetMessageCount($Ticket->Id); $counts[$TicketSub->Id] = Ticket::GetMessageCount($TicketSub->Id); if ($counts[$Ticket->Id] > $counts[$TicketSub->Id]) { $Ticket->LinkTicket($TicketSub->Id, getId(32)); } else { $TicketSub->LinkTicket($Ticket->Id, getId(32)); } $Ticket->SetLastUpdate(time()); } else { if ($type == "EditMessage") { $ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], ""); $message = new TicketMessage($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], ""); $message->Load(); $message->ChangeValue($ticket, 10, CALLER_SYSTEM_ID, $message->Fullname, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]); $message->ChangeValue($ticket, 11, CALLER_SYSTEM_ID, $message->Email, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_3"]); $message->ChangeValue($ticket, 12, CALLER_SYSTEM_ID, $message->Company, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]); $message->ChangeValue($ticket, 13, CALLER_SYSTEM_ID, $message->Phone, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_5"]); $message->ChangeValue($ticket, 14, CALLER_SYSTEM_ID, $message->Subject, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_6"]); $message->ChangeValue($ticket, 15, CALLER_SYSTEM_ID, $message->Text, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_7"]); $message->ApplyCustomFromPost($count, true, $ticket, CALLER_SYSTEM_ID); $message->Save($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], true); $ticket->SetLastUpdate(time(), false); } else { if ($type == "CreateTicket") { $Ticket = new Ticket(getObjectId("ticket_id", DATABASE_TICKETS), ""); $temporaryIds[$_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_11"]] = $Ticket->Id; $Ticket->Messages[0]->Id = $Ticket->Id; $Ticket->Messages[0]->ChannelId = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]; $Ticket->CreationType = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_3"]; $Ticket->Group = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_6"]; $Ticket->Language = strtoupper(trim($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_10"])); $Ticket->Messages[0]->Fullname = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"]; $Ticket->Messages[0]->Email = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"]; $Ticket->Messages[0]->Text = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]; $Ticket->Messages[0]->Company = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_7"]; $Ticket->Messages[0]->Phone = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_8"]; $Ticket->Messages[0]->Type = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_9"]; $Ticket->Messages[0]->Subject = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_15"]; $Ticket->Messages[0]->ApplyCustomFromPost($count); $cid = 0; while (isset($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_" . $cid])) { $value = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_" . $cid++]; if (strpos($value, "[att]") === 0) { $Ticket->Messages[0]->ApplyAttachment(base64_decode(str_replace("[att]", "", $value))); } else { if (strpos($value, "[com]") === 0) { $Ticket->Messages[0]->AddComment(CALLER_SYSTEM_ID, $Ticket->Id, base64_decode(str_replace("[com]", "", $value))); } } } $Ticket->Messages[0]->LoadAttachments(); if (!empty($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"])) { $email = new TicketEmail($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"], false, ""); $email->LoadAttachments(); foreach ($email->Attachments as $rid => $res) { if (empty($Ticket->Messages[0]->Attachments[$rid])) { processResource(CALLER_SYSTEM_ID, $rid, "", RESOURCE_TYPE_FILE_INTERNAL, "", true, 100, 1, 0); } } $email->Destroy(); } $Ticket->Save(); $TicketEditor = new TicketEditor($Ticket->Id); $TicketEditor->Editor = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_13"]; $TicketEditor->Status = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_12"]; $TicketEditor->GroupId = $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_14"]; $TicketEditor->Save(); $Ticket->Log(6, CALLER_SYSTEM_ID, $Ticket->Id, ""); $Ticket->SetLastUpdate(time()); } else { if ($type == "SetEmailStatus") { $Email = new TicketEmail($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]); $Email->SetStatus(); } else { if ($type == "ForwardMessage") { $message = new TicketMessage($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], ""); $message->Load(); $message->Forward($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_3"], $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_4"]); $ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_5"], ""); $ticket->Log(9, CALLER_SYSTEM_ID, $message->Id, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_2"]); } else { if ($type == "MoveMessageIntoTicket") { $message = new TicketMessage($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_1"], ""); $message->Load(true); $message->ChannelId = getId(32); $ticket = new Ticket($_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], ""); $ticket->Load(); $ticket->Id = $message->Id = getObjectId("ticket_id", DATABASE_TICKETS); $ticket->Messages = array(); $ticket->Messages[0] = $message; $ticket->Save(); $ticket->Log(8, CALLER_SYSTEM_ID, $ticket->Id, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"]); $message->SaveAttachments(); $message->SaveComments($ticket->Id); } else { if ($type == "DeleteAttachment") { processResource(CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_TICKET_ACTIONS . "_" . $count . "_vd_0"], "", RESOURCE_TYPE_FILE_INTERNAL, "", true, "100", "1"); } } } } } } } } } } } } } $count++; } if ($count > 0) { CacheManager::SetDataUpdateTime(DATA_UPDATE_KEY_TICKETS); CacheManager::SetDataUpdateTime(DATA_UPDATE_KEY_EMAILS); } }
function sendChatTranscripts($_custom = false) { global $CONFIG, $INTERNAL, $GROUPS, $INPUTS; initData(array("INTERNAL", "INPUTS")); closeChats(); $defmailbox = Mailbox::GetDefaultOutgoing(); $result = queryDB(false, "SELECT `voucher_id`,`subject`,`customs`,`internal_id`,`transcript_text`,`transcript_receiver`,`email`,`chat_id`,`fullname`,`group_id` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `endtime`>0 AND `closed`>0 AND `transcript_sent`=0 LIMIT 1;"); if ($result) { while ($row = DBManager::FetchArray($result)) { if (empty($row["transcript_text"])) { continue; } queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_sent`=1 WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "' LIMIT 1;"); $rcvs = str_replace(array("%fullname%", "%efullname%"), $row["fullname"], $row["transcript_text"]); $rcvs = str_replace(array("%email%", "%eemail%"), $row["email"], $rcvs); $rcvs = str_replace("%rating%", getRatingAVGFromChatId($row["chat_id"]), $rcvs); $subject = $row["subject"]; $customs = @unserialize($row["customs"]); $fakeSender = ""; foreach ($INPUTS as $index => $input) { if ($input->Active && $input->Custom && !isset($GROUPS[$row["group_id"]]->TicketInputsHidden[$index])) { $cv = ""; if ($input->Type == "CheckBox") { $cv = !empty($customs[$input->Name]) ? "<!--lang_client_yes-->" : "<!--lang_client_no-->"; } else { if (!empty($customs[$input->Name]) || $input->Type == "ComboBox") { $cv = $input->GetClientValue(@$customs[$input->Name]); } } $rcvs = str_replace("%custom" . $index . "%", $cv, $rcvs); } } $rcvs = applyReplacements($rcvs); $rcvs = Mailbox::FinalizeEmail($rcvs . "\r\n\r\n<!--lz_ref_link-->"); $mailbox = null; if (!empty($row["group_id"]) && isset($GROUPS[$row["group_id"]]) && !empty($GROUPS[$row["group_id"]]->ChatEmailOut)) { $mailbox = Mailbox::GetById($GROUPS[$row["group_id"]]->ChatEmailOut); } $mailbox = !empty($mailbox) ? $mailbox : $defmailbox; if ((!empty($CONFIG["gl_soct"]) || $_custom) && !empty($row["transcript_receiver"])) { sendMail($mailbox, $row["transcript_receiver"], $mailbox->Email, $rcvs, $subject); } if (!empty($CONFIG["gl_scto"]) && !$_custom) { initData(array("INTERNAL")); $receivers = array(); $resulti = queryDB(true, "SELECT `sender`,`receiver` FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($row["chat_id"]) . "';"); if ($resulti) { while ($rowi = DBManager::FetchArray($resulti)) { if (!empty($INTERNAL[$rowi["sender"]]) && !in_array($rowi["sender"], $receivers)) { $receivers[] = $rowi["sender"]; } else { if (!empty($INTERNAL[$rowi["receiver"]]) && !in_array($rowi["receiver"], $receivers)) { $receivers[] = $rowi["receiver"]; } else { continue; } } sendMail($mailbox, $INTERNAL[$receivers[count($receivers) - 1]]->Email, $mailbox->Email, $rcvs, $subject); } } } if (!empty($CONFIG["gl_sctg"]) && !$_custom) { initData(array("GROUPS")); sendMail($mailbox, $GROUPS[$row["group_id"]]->Email, $mailbox->Email, $rcvs, $subject); } if (!empty($mailbox) && !empty($CONFIG["gl_scct"])) { if (!empty($CONFIG["gl_uvec"])) { if (Mailbox::IsValidEmail($row["transcript_receiver"])) { $fakeSender = $row["transcript_receiver"]; } else { if (Mailbox::IsValidEmail($row["email"])) { $fakeSender = $row["email"]; } } } sendMail($mailbox, $CONFIG["gl_scct"], $mailbox->Email, $rcvs, $subject, false, null, $fakeSender); } if (!empty($row["voucher_id"])) { $ticket = new CommercialChatVoucher(null, $row["voucher_id"]); $ticket->Load(); $ticket->SendStatusEmail(); } } } if (!empty($CONFIG["gl_rm_chats"]) && $CONFIG["gl_rm_chats_time"] == 0) { queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `transcript_sent` = '1';"); } }
function sendTestMail($amount = 0) { global $RESPONSE; $account = Mailbox::GetById($_POST["p_mailbox"]); try { if ($account->Type == "IMAP" || $account->Type == "POP") { $reload = false; $amount = downloadFromMailbox($reload, $account->Type, $account->Host, $account->Port, $account->Password, $account->Username, $account->SSL, false, true); $return = 1; } else { $return = sendMail($account, $account->Email, $account->Email, "LiveZilla Test Mail", "LiveZilla Test Mail", true); } } catch (Exception $e) { logit(serialize($e)); $return = $e->getMessage(); } if (is_array($amount)) { $amount = count($amount); } if ($return == 1) { $RESPONSE->SetStandardResponse(1, base64_encode($amount)); } else { $RESPONSE->SetStandardResponse(2, base64_encode($return)); } }
function Forward($_groupId, $_toEmail, $_subject = "", $_text = "") { global $GROUPS; $att = array(); $mailbox = Mailbox::GetById($GROUPS[$_groupId]->TicketEmailOut, true); foreach ($this->Attachments as $resid => $title) { $att[] = $resid; } if (empty($_text) && !empty($this->Text)) { $_text = $this->Text; } if ($mailbox != null) { sendMail($mailbox, str_replace(";", ",", $_toEmail), $mailbox->Email, $_text, $_subject, false, $att); } }