function processResources($count = 0, $xml = "") { while (isset($_POST[POST_INTERN_PROCESS_RESOURCES . "_va_" . $count])) { $kbe = new KnowledgeBaseEntry(); $kbe->EditorId = $kbe->OwnerId = CALLER_SYSTEM_ID; $kbe->Id = $_POST[POST_INTERN_PROCESS_RESOURCES . "_va_" . $count]; $kbe->Value = base64_decode($_POST[POST_INTERN_PROCESS_RESOURCES . "_vb_" . $count]); $kbe->Type = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vc_" . $count]; $kbe->Title = base64_decode($_POST[POST_INTERN_PROCESS_RESOURCES . "_vd_" . $count]); $kbe->IsDiscarded = !empty($_POST[POST_INTERN_PROCESS_RESOURCES . "_ve_" . $count]); $kbe->ParentId = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vf_" . $count]; $kbe->Rank = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vg_" . $count]; $kbe->Size = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vh_" . $count]; $kbe->Tags = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vi_" . $count]; $kbe->Languages = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vj_" . $count]; $kbe->Tags = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vi_" . $count]; $kbe->IsPublic = !empty($_POST[POST_INTERN_PROCESS_RESOURCES . "_vk_" . $count]); $kbe->FulltextSearch = !empty($_POST[POST_INTERN_PROCESS_RESOURCES . "_vl_" . $count]); $kbe->ShortcutWord = $_POST[POST_INTERN_PROCESS_RESOURCES . "_vm_" . $count]; $kbe->AllowBotAccess = !empty($_POST[POST_INTERN_PROCESS_RESOURCES . "_vn_" . $count]); $kbe->Save(); $xml .= "<r rid=\"" . base64_encode($kbe->Id) . "\" disc=\"" . base64_encode($_POST[POST_INTERN_PROCESS_RESOURCES . "_ve_" . $count]) . "\" />\r\n"; $count++; } Server::$Response->SetStandardResponse(1, $xml); }
function CalculateRank() { if ($this->ParentId == "1") { $this->Rank = 1; return; } $this->Rank = -1; $rank = 0; $parent = $this->ParentId; while (true) { $perow = KnowledgeBaseEntry::GetById($parent, false); if ($perow != null) { $parent = $perow["parentid"]; $rank++; } else { break; } } if ($rank > 0) { $this->Rank = $rank + 1; } else { $this->Rank = 1; } }
private function SEND_PHP_MAIL($_receiver = "", $result = "", $_html = false) { if (strpos($_receiver, ",") !== false) { $emails = explode(",", $_receiver); foreach ($emails as $mail) { if (!empty($mail) && !Is::Null(strpos($mail, "@"))) { $result = $this->SEND_PHP_MAIL(trim($mail), $result); } } return $result; } $mailtext = $this->MailBodyText; $ehash = md5(date('r', time())); $EOL = "\r\n"; if (empty($this->FakeSender)) { $headers = "From: " . $this->Mailbox->Email . $EOL; } else { $headers = "From: " . $this->FakeSender . $EOL; } $headers .= "Reply-To: " . $this->ReplyTo . $EOL; $headers .= "Date: " . date("r") . $EOL; $headers .= "MIME-Version: 1.0" . $EOL; $headers .= "X-Mailer: LiveZilla.net/" . VERSION . $EOL; if ($this->Attachments != null) { $headers .= "Content-Type: multipart/mixed; boundary=\"" . $ehash . "\"" . $EOL . $EOL; $headers .= "--" . $ehash . $EOL; $headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed" . $EOL; $headers .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL; $headers .= $mailtext . $EOL . $EOL; $headers .= "--" . $ehash . $EOL; foreach ($this->Attachments as $resId) { $res = KnowledgeBaseEntry::GetById($resId); if ($res == null) { continue; } $content = chunk_split(base64_encode(file_get_contents("./uploads/" . $res["value"]))); $headers .= "Content-Type: application/octet-stream; name=\"" . $res["title"] . "\"" . $EOL; $headers .= "Content-Transfer-Encoding: base64" . $EOL; $headers .= "Content-Disposition: attachment; filename=\"" . $res["title"] . "\"" . $EOL . $EOL; $headers .= $content . $EOL . $EOL; $headers .= "--" . $ehash . $EOL; } $mailtext = ""; $headers .= "--" . $ehash . "--" . $EOL; } else { $headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed" . $EOL; $headers .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL; } if (@mail($_receiver, $this->Subject, $mailtext, $headers)) { return 1; } else { return "The email could not be sent using PHP mail(). Please try another Return Email Address or use SMTP."; } }
define("IN_LIVEZILLA", true); header('Content-Type: text/html; charset=utf-8'); if (!defined("LIVEZILLA_PATH")) { define("LIVEZILLA_PATH", "./"); } require LIVEZILLA_PATH . "_definitions/definitions.inc.php"; require LIVEZILLA_PATH . "_lib/functions.global.inc.php"; require LIVEZILLA_PATH . "_lib/functions.external.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; @set_error_handler("handleError"); Server::InitDataProvider(); Server::DefineURL("knowledgebase.php"); LocalizationManager::AutoLoad(); $color = ExternalChat::ReadTextColor(); $entry = KnowledgeBaseEntry::GetById(Communication::ReadParameter("id", ""), true); if (!empty($entry)) { $html = IOStruct::GetFile(PATH_TEMPLATES . "kb_entry.tpl"); if (!empty(Server::$Configuration->File["gl_kcss"])) { $html = str_replace("<!--custom_css-->", "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . Server::$Configuration->File["gl_kcss"] . "\">", $html); } if (Server::$Configuration->File["gl_knbr"]) { $rresult = $entry->GetRateResult(); if (($rate = Communication::ReadParameter("h", -1)) != -1) { $html = str_replace("<!--rate_text-->", "<br><div id=\"lz_chat_dialog_kb_rate\">" . $LZLANG["client_feedback_success"] . "</div>", $html); $entry->SaveRateResult($rate); } else { $bhtml = "<a href=\"./knowledgebase.php?id=<!--id-->&h=MQ__\"><!--lang_client_yes--></a><a href=\"./knowledgebase.php?id=<!--id-->&h=MA__\"><!--lang_client_no--></a>"; $fhtml = $rresult[0] > 0 ? str_replace("<!--users-->", $rresult[0], str_replace("<!--total-->", $rresult[1], $LZLANG["client_found_helpful"])) . " " : ""; $html = str_replace("<!--rate_text-->", "<br><div id=\"lz_chat_dialog_kb_rate\">" . $fhtml . $LZLANG["client_was_helpful"] . $bhtml . "</div>", $html); }
/**************************************************************************************** * LiveZilla getfile.php * * Copyright 2014 LiveZilla GmbH * All rights reserved. * LiveZilla is a registered trademark. * * Improper changes to this file may cause critical errors. ***************************************************************************************/ define("IN_LIVEZILLA", true); if (!defined("LIVEZILLA_PATH")) { define("LIVEZILLA_PATH", "./"); } require LIVEZILLA_PATH . "_definitions/definitions.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; require LIVEZILLA_PATH . "_lib/functions.global.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; if (isset($_GET["id"]) && Server::InitDataProvider()) { $id = $_GET["id"]; if (strpos($id, ".") === false && !Is::Null($res = KnowledgeBaseEntry::GetById($id))) { if (file_exists("./uploads/" . $res["value"]) && strpos($res["value"], "..") === false) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize("./uploads/" . $res["value"])); header('Content-Disposition: attachment; filename=' . urlencode($res["title"])); exit(file_get_contents("./uploads/" . $res["value"])); } } } header("HTTP/1.0 404 Not Found");
function KnowledgebaseEntryCreate() { $kbEntry = new KnowledgeBaseEntry(); $params = ApiV2::GetObjectFields("KnowledgeBaseEntry"); if ($kbEntry = $this->CreateFromJSON($params, json_decode($_POST["p_data"]), $kbEntry, "KnowledgeBaseEntry")) { $parent = KnowledgeBaseEntry::GetById($kbEntry->ParentId, false); if ($parent == null) { $this->ErrorFilter = "ParentId"; } else { $kbEntry->CalculateRank(); $kbEntry->EditorId = CALLER_SYSTEM_ID; $kbEntry->OwnerId = CALLER_SYSTEM_ID; $kbEntry->Edited = $kbEntry->Created = time() + 1; if (empty($kbEntry->Id)) { $kbEntry->Id = getId(32); } $kbEntry->Save(); $this->JSONOutput = APIV2::Encode(array("KnowledgeBaseEntry" => ApiV2::ClearObject($params, $kbEntry)), $this->JSONParams); } } }
function FormatBotAutoReplies($_chat, $_answers, $_alternate = true, $html = "", $single = "") { $tth = "."; $bind = " " . LocalizationManager::$TranslationStrings["client_or"] . " "; if (!empty(Server::$Groups[$_chat->DesiredChatGroup]) && Server::$Groups[$_chat->DesiredChatGroup]->IsHumanAvailable()) { $resultpc = DBManager::Execute(false, "SELECT * FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($_chat->ChatId) . "' AND `repost`=0 AND `receiver`='" . DBManager::RealEscape($this->SystemId) . "';"); if ($this->WelcomeManager && DBManager::GetRowCount($resultpc) >= $this->WelcomeManagerOfferHumanChatAfter) { $tth = " " . LocalizationManager::$TranslationStrings["client_or"] . " <a class=\"lz_chat_human\" onclick=\"var _this = this;lz_chat_set_talk_to_human(true,true);this.className='';this.style.cursor='wait';setTimeout(function(){_this.style.cursor='default'; },3000);\">" . LocalizationManager::$TranslationStrings["client_talk_to_human"] . "</a>."; $bind = ", "; } } $lm = empty(Server::$Configuration->File["gl_dtfbc"]) ? $bind . " <a class=\"lz_chat_mail\" onclick=\"lz_chat_require_leave_message();\">" . LocalizationManager::$TranslationStrings["client_leave_a_message"] . "</a>" : ""; if (count($_answers) == 0) { return LocalizationManager::$TranslationStrings["client_bot_no_result_found"] . $lm . $tth; } else { if (count($_answers) > 0) { $html .= LocalizationManager::$TranslationStrings["client_your_result"] . "<br>"; $html .= "<ul class=\"lz_chat_bot_resource\">"; foreach ($_answers as $qa) { if (!empty($qa->ResourceId)) { $res = KnowledgeBaseEntry::GetById($qa->ResourceId); $target = $qa->NewWindow ? "target=\"_blank\" " : ""; $html .= "<li>"; if ($res["type"] == 2) { $html .= "<a class=\"lz_chat_link\" href=\"" . $res["value"] . "\" " . $target . ">" . $res["title"] . "</a>"; } else { if ($res["type"] == 3 || $res["type"] == 4) { $html .= "<a class=\"lz_chat_link\" href=\"" . LIVEZILLA_URL . "getfile.php?id=" . $res["id"] . "\" " . $target . ">" . $res["title"] . "</a>"; } else { $html .= "<b>" . $res["title"] . "</b><br><br>" . str_replace("<a ", "<a " . $target, str_replace("<A", "<a", $res["value"])); } } $html .= "</li>"; } else { if (!empty($qa->Answer)) { $single = $qa->Answer . "<br><br>"; break; } } } $html .= "</ul>"; } } if (!empty($single)) { $html = $single; } $html = Server::$Groups[$_chat->DesiredChatGroup]->TextReplace($html, Visitor::$BrowserLanguage); $html = $_chat->TextReplace($html); $html = $this->TextReplace($html); $html = Configuration::Replace($html); return $html . ($_alternate ? LocalizationManager::$TranslationStrings["client_bot_result_found"] . $lm . $tth : ""); }