$browser = new VisitorBrowser($chat->BrowserId, $chat->UserId, false); $browser->LoadUserData(); $feedback->UserData = $browser->UserData; Visitor::CloseAllOverlays($chat->UserId); } else { if ($ticket != null) { $feedback->UserId = $ticket->SenderUserId; $feedback->TicketId = $ticket->Id; if (!empty($ticket->Editor)) { $feedback->OperatorId = $ticket->Editor->Editor; $feedback->GroupId = $ticket->Editor->GroupId; } $feedback->UserData = UserData::FromTicketMessage($ticket->Messages[0]); } } $isSpam = !empty(Server::$Configuration->File["gl_sfc"]) && Visitor::CreateSPAMFilter($userid, false); if (!$isSpam) { $feedback->AddCriteriaDataFromServerInput(); $feedback->Save(); } else { Logging::GeneralLog("Feedback matches SPAM filter rule."); } $fb_html = str_replace("<!--sub_title-->", "<br>" . LocalizationManager::$TranslationStrings["client_feedback_success"] . "<script>parent.parent.lz_chat_feedback_result();</script>", $fb_html); $fb_html = str_replace("<!--title-->", "<br><br><br>" . LocalizationManager::$TranslationStrings["client_thank_you"], $fb_html); $fb_html = str_replace("<!--visible-->", "none", $fb_html); } else { $inputs_html = $js_id_list = ""; foreach (Server::$Configuration->Database["gl_fb"] as $id => $criteria) { if (!empty($js_id_list)) { $js_id_list .= ","; }
function processPost($id, $post, $systemid, $counter, $rgroup, $chatid, $_received = false) { global $USER; $post->Id = $id; if (isset($_POST["p_pt" . $counter])) { $post->Translation = Encoding::Base64UrlDecode($_POST["p_pt" . $counter]); $post->TranslationISO = Encoding::Base64UrlDecode($_POST["p_ptiso" . $counter]); } $post->ChatId = $chatid; $post->ReceiverOriginal = $post->Receiver = $systemid; $post->ReceiverGroup = $rgroup; $post->Received = $_received; $post->Save(); if (!empty(Server::$Configuration->File["gl_sfc"]) && Visitor::CreateSPAMFilter($USER->UserId)) { return false; } return true; }
function CreateChat($_internalUser, $_visitor, $_host = false, $custom = "", $etpl = "", $_customsInTranscript = true, $_externalSelf = true, $pdm = null) { if (!empty(Server::$Configuration->File["gl_sfc"]) && Visitor::CreateSPAMFilter($this->UserId) || empty($this->ChatId)) { return; } if (!empty($_internalUser)) { UserGroup::RemoveFromAllDynamicGroups($this->SystemId); $this->LoadForward(); if (UserGroup::PersistentJoin($this->UserId, $this->SystemId)) { $this->RemoteActivate($_internalUser); } $this->OperatorId = $_internalUser->SystemId; $_internalUser->SetLastChatAllocation(); } else { $this->OperatorId = ""; } $this->SetStatus(CHAT_STATUS_WAITING); Server::InitDataBlock(array("INPUTS")); DBManager::Execute(false, "INSERT INTO `" . DB_PREFIX . DATABASE_VISITOR_CHAT_OPERATORS . "` (`chat_id`,`user_id`,`jtime`,`status`) VALUES ('" . DBManager::RealEscape($this->ChatId) . "','" . DBManager::RealEscape($this->OperatorId) . "'," . time() . "," . ($_host ? 0 : 1) . ");"); $this->CreateArchiveEntry($_internalUser, $_visitor, $custom, $etpl, $_customsInTranscript, $pdm); if ($_internalUser->IsBot) { $this->RemoteActivate($_internalUser); } else { if (!empty($_internalUser->AppDeviceId) && $_internalUser->AppBackgroundMode) { $name = !empty($this->UserData->Fullname) ? $this->UserData->Fullname : Visitor::GetNoName($this->UserId . Communication::GetIP()); $_internalUser->AddPushMessage($this->ChatId, $this->SystemId, $name, 0); } } if (!empty($_GET["acid"])) { $pchatid = Encoding::Base64UrlDecode($_GET["acid"]); $result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `visitor_id`='" . DBManager::RealEscape($this->UserId) . "' AND `chat_id`='" . DBManager::RealEscape($pchatid) . "' AND (`exit` > " . (time() - 30) . " OR `exit`=0) LIMIT 1;"); if ($result && DBManager::GetRowCount($result) == 1) { $row = DBManager::FetchArray($result); if (empty($row["waiting"])) { $this->RepostChatHistory(2, $pchatid, $this->OperatorId, 0, 0, $this->UserId . "~" . $this->UserId . "_OVL", $this->ChatId, $this->SystemId, true, false, $_externalSelf); } } } }