本文整理汇总了PHP中Chat::Generate方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::Generate方法的具体用法?PHP Chat::Generate怎么用?PHP Chat::Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::Generate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveToArchive
static function SaveToArchive($_chatId, $_externalFullname, $_externalId, $_internalId, $_groupId, $_email, $_company, $_phone, $_host, $_ip, $_question, $_transcriptSent = false, $_waitingtime, $_startResult, $_endResult)
{
$result = DBManager::Execute(true, "SELECT `voucher_id`,`endtime`,`transcript_text`,`transcript_html`,`iso_language`,`time` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `chat_id`='" . DBManager::RealEscape($_chatId) . "' LIMIT 1;");
$row = DBManager::FetchArray($result);
LocalizationManager::AutoLoad($row["iso_language"], true);
CacheManager::SetDataUpdateTime(DATA_UPDATE_KEY_CHATS);
$_externalFullname = empty($_externalFullname) ? LocalizationManager::$TranslationStrings["client_guest"] . " " . Visitor::GetNoName($_externalId . $_ip) : $_externalFullname;
$filter = new Chat();
$filter->Generate($_chatId, $_externalFullname, true, true, $_question, $row["time"]);
$filter->PlainText = Server::Replace($filter->PlainText, true, false, false);
$filter->HTML = Server::Replace($filter->HTML, true, false, false);
$tsData = array($row["transcript_text"], $row["transcript_html"]);
for ($i = 0; $i < count($tsData); $i++) {
if ($i == 1 && empty($tsData[$i])) {
continue;
}
$tsData[$i] = Server::Replace($tsData[$i], true, false, false);
if (!empty($filter->PlainText)) {
$tText = ($i == 0 ? $filter->PlainText : nl2br(htmlentities($filter->PlainText, ENT_QUOTES, "UTF-8"))) . "<!--lz_ref_link-->";
$tsData[$i] = str_replace("%localdate%", date("r", $filter->FirstPost), $tsData[$i]);
if (strpos($tsData[$i], "%transcript%") === false && strpos($tsData[$i], "%mailtext%") === false) {
$tsData[$i] .= $tText;
} else {
if (strpos($tsData[$i], "%transcript%") !== false) {
$tsData[$i] = str_replace("%transcript%", $tText, $tsData[$i]);
} else {
if (strpos($tsData[$i], "%mailtext%") !== false) {
$tsData[$i] = str_replace("%mailtext%", $tText, $tsData[$i]);
}
}
}
} else {
$tsData[$i] = "";
}
$tsData[$i] = str_replace("%company_logo_url%", Server::$Configuration->File["gl_cali"], $tsData[$i]);
$tsData[$i] = str_replace(array("%email%", "%eemail%"), $_email, $tsData[$i]);
$tsData[$i] = str_replace(array("%fullname%", "%efullname%"), $_externalFullname, $tsData[$i]);
$tsData[$i] = str_replace("%rating%", Feedback::GetRatingAVG($_chatId), $tsData[$i]);
}
$name = !empty($_externalFullname) ? ",`fullname`='" . DBManager::RealEscape($_externalFullname) . "'" : "";
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `external_id`='" . DBManager::RealEscape($_externalId) . "',`closed`='" . DBManager::RealEscape(time()) . "'" . $name . ",`internal_id`='" . DBManager::RealEscape($_internalId) . "',`group_id`='" . DBManager::RealEscape($_groupId) . "',`html`='" . DBManager::RealEscape($filter->HTML) . "',`plaintext`='" . DBManager::RealEscape($filter->PlainText) . "',`transcript_text`='" . DBManager::RealEscape($tsData[0]) . "',`transcript_html`='" . DBManager::RealEscape($tsData[1]) . "',`fullname`='" . DBManager::RealEscape($_externalFullname) . "',`email`='" . DBManager::RealEscape($_email) . "',`company`='" . DBManager::RealEscape($_company) . "',`phone`='" . DBManager::RealEscape($_phone) . "',`host`='" . DBManager::RealEscape($_host) . "',`ip`='" . DBManager::RealEscape($_ip) . "',`gzip`=0,`wait`='" . DBManager::RealEscape($_waitingtime) . "',`accepted`='" . DBManager::RealEscape($_startResult) . "',`ended`='" . DBManager::RealEscape($_endResult) . "',`transcript_sent`='" . DBManager::RealEscape(empty(Server::$Configuration->File["gl_soct"]) && empty(Server::$Configuration->File["gl_scct"]) && empty(Server::$Configuration->File["gl_scto"]) && empty(Server::$Configuration->File["gl_sctg"]) || empty($tsData) || $filter->ElementCount < 3 || $_transcriptSent ? "1" : "0") . "',`question`='" . DBManager::RealEscape(cutString($_question, 255)) . "' WHERE `chat_id`='" . DBManager::RealEscape($_chatId) . "' AND `closed`=0 LIMIT 1;");
$result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` WHERE `channel_id`='" . DBManager::RealEscape($_chatId) . "';");
if ($result && ($rowc = DBManager::FetchArray($result))) {
$Ticket = new Ticket($rowc["ticket_id"], true);
$Ticket->LinkChat($rowc["channel_id"], $rowc["id"]);
}
}
示例2: define
* All rights reserved.
* LiveZilla is a registered trademark.
*
* Improper changes to this file may cause critical errors.
***************************************************************************************/
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 . "_definitions/definitions.dynamic.inc.php";
require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php";
Server::DefineURL("print.php");
@set_error_handler("handleError");
if (Server::InitDataProvider()) {
if (!empty($_GET[GET_TRACK_CHATID]) && !empty($_GET[GET_TRACK_BROWSERID]) && !empty($_GET[GET_TRACK_USERID])) {
$archive = new Chat();
$archive->ChatId = intval(Communication::GetParameter("c", ""));
$archive->Load();
$chat = VisitorChat::GetByChatId($archive->ChatId);
if ($chat->BrowserId == Communication::GetParameter(GET_TRACK_BROWSERID, "") && $chat->UserId == Communication::GetParameter(GET_TRACK_USERID, "") && $chat->LastActive > time() - 3600) {
$print = IOStruct::GetFile(PATH_TEMPLATES . "print.tpl");
$archive->Generate($archive->ChatId, "", true, true);
$print = str_replace("<!--chat_id-->", $archive->ChatId, $print);
$print = str_replace("<!--transcript-->", nl2br($archive->PlainText), $print);
}
exit($print);
}
}
示例3: closeArchiveEntry
function closeArchiveEntry($_chatId, $_externalFullname, $_externalId, $_internalId, $_groupId, $_email, $_company, $_phone, $_host, $_ip, $_question, $_transcriptSent = false, $_waitingtime, $_startResult, $_endResult)
{
global $CONFIG, $LZLANG;
$result = queryDB(true, "SELECT `voucher_id`,`endtime`,`transcript_text`,`iso_language`,`time` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `chat_id`='" . DBManager::RealEscape($_chatId) . "' LIMIT 1;");
$row = DBManager::FetchArray($result);
languageSelect($row["iso_language"], true);
$etpl = $row["transcript_text"];
$etpl = applyReplacements($etpl, true, false, false);
CacheManager::SetDataUpdateTime(DATA_UPDATE_KEY_CHATS);
$_externalFullname = empty($_externalFullname) ? $LZLANG["client_guest"] . " " . getNoName($_externalId . $_ip) : $_externalFullname;
$filter = new Chat();
$filter->Generate($_chatId, $_externalFullname, true, true, $_question, $row["time"]);
$filter->PlainText = applyReplacements($filter->PlainText, true, false, false);
$filter->HTML = applyReplacements($filter->HTML, true, false, false);
if (!empty($filter->PlainText)) {
$etpl = str_replace("%localdate%", date("r", $filter->FirstPost), $etpl);
if (strpos($etpl, "%transcript%") === false && strpos($etpl, "%mailtext%") === false) {
$etpl .= $filter->PlainText;
} else {
if (strpos($etpl, "%transcript%") !== false) {
$etpl = str_replace("%transcript%", $filter->PlainText, $etpl);
} else {
if (strpos($etpl, "%mailtext%") !== false) {
$etpl = str_replace("%mailtext%", $filter->PlainText, $etpl);
}
}
}
} else {
$etpl = "";
}
$etpl = str_replace(array("%email%", "%eemail%"), $_email, $etpl);
$etpl = str_replace(array("%fullname%", "%efullname%"), $_externalFullname, $etpl);
$etpl = str_replace("%rating%", getRatingAVGFromChatId($_chatId), $etpl);
$name = !empty($_externalFullname) ? ",`fullname`='" . DBManager::RealEscape($_externalFullname) . "'" : "";
queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `external_id`='" . DBManager::RealEscape($_externalId) . "',`closed`='" . DBManager::RealEscape(time()) . "'" . $name . ",`internal_id`='" . DBManager::RealEscape($_internalId) . "',`group_id`='" . DBManager::RealEscape($_groupId) . "',`html`='" . DBManager::RealEscape($filter->HTML) . "',`plaintext`='" . DBManager::RealEscape($filter->PlainText) . "',`transcript_text`='" . DBManager::RealEscape($etpl) . "',`email`='" . DBManager::RealEscape($_email) . "',`company`='" . DBManager::RealEscape($_company) . "',`phone`='" . DBManager::RealEscape($_phone) . "',`host`='" . DBManager::RealEscape($_host) . "',`ip`='" . DBManager::RealEscape($_ip) . "',`gzip`=0,`wait`='" . DBManager::RealEscape($_waitingtime) . "',`accepted`='" . DBManager::RealEscape($_startResult) . "',`ended`='" . DBManager::RealEscape($_endResult) . "',`transcript_sent`='" . DBManager::RealEscape(empty($CONFIG["gl_soct"]) && empty($CONFIG["gl_scct"]) && empty($CONFIG["gl_scto"]) && empty($CONFIG["gl_sctg"]) || empty($etpl) || $filter->ElementCount == 0 || $_transcriptSent ? "1" : "0") . "',`question`='" . DBManager::RealEscape(cutString($_question, 255)) . "' WHERE `chat_id`='" . DBManager::RealEscape($_chatId) . "' AND `closed`=0 LIMIT 1;");
$result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` WHERE `channel_id`='" . DBManager::RealEscape($_chatId) . "';");
if ($result && ($rowc = DBManager::FetchArray($result))) {
$Ticket = new Ticket($rowc["ticket_id"], true);
$Ticket->LinkChat($rowc["channel_id"], $rowc["id"]);
}
}