function GroupBuilder($_internalUsers, $_internalGroups, $_config, $_reqGroup = "", $_reqOperator = "", $allowCom = true) { $this->ReqGroup = !empty($_GET[GET_EXTERN_GROUP]) ? base64UrlDecode($_GET[GET_EXTERN_GROUP]) : $_reqGroup; $this->ReqOperator = !empty($_GET[GET_EXTERN_INTERN_USER_ID]) ? base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : $_reqOperator; $this->InternalUsers = $_internalUsers; $this->InternalGroups = $_internalGroups; $this->Config = $_config; $this->GroupValues["groups_online"] = array(); $this->GroupValues["groups_offline"] = array(); $this->GroupValues["groups_online_amounts"] = array(); $this->GroupValues["groups_output"] = array(); $this->GroupValues["groups_hidden"] = array(); $this->GroupValues["set_by_get_user"] = null; $this->GroupValues["set_by_get_group"] = null; $this->GroupValues["set_by_cookie"] = null; $this->GroupValues["set_by_standard"] = null; $this->GroupValues["set_by_online"] = null; $this->GroupValues["req_for_user"] = !empty($this->ReqOperator); $this->GroupValues["req_for_group"] = !empty($this->ReqGroup); $this->Parameters = getTargetParameters($allowCom); if ($this->Parameters["include_group"] != null || $this->Parameters["include_user"] != null) { foreach ($_internalGroups as $gid => $group) { if (!($this->Parameters["include_group"] != null && in_array($gid, $this->Parameters["include_group"]))) { if (!($this->Parameters["include_user"] != null && in_array($gid, $_internalUsers[Operator::GetSystemId($this->Parameters["include_user"])]->GetGroupList(false)))) { $this->GroupValues["groups_hidden"][] = $gid; } } } } if ($this->Parameters["exclude"] != null) { $this->GroupValues["groups_hidden"] = $this->Parameters["exclude"]; } }
function DefineTargets() { global $USER; if (!empty($_GET["tth"]) || $USER->IsInChat(true, $USER->Browsers[0]) || Visitor::$OpenChatExternal) { define("IGNORE_WM", true); } if (defined("IGNORE_WM") && !empty($USER->Browsers[0]->DesiredChatPartner) && Server::$Operators[$USER->Browsers[0]->DesiredChatPartner]->IsBot) { $USER->Browsers[0]->DesiredChatPartner = ""; } if (!empty($USER->Browsers[1]->ChatRequest) && $USER->Browsers[1]->ChatRequest->Closed && !$USER->Browsers[1]->ChatRequest->Accepted && @Server::$Operators[$USER->Browsers[1]->ChatRequest->SenderSystemId]->UserStatus < USER_STATUS_OFFLINE && Server::$Operators[$USER->Browsers[1]->ChatRequest->SenderSystemId]->IsExternal(Server::$Groups, null, array($USER->Browsers[1]->ChatRequest->SenderGroupId))) { $USER->Browsers[0]->DesiredChatPartner = $USER->Browsers[1]->ChatRequest->SenderSystemId; $USER->Browsers[0]->DesiredChatGroup = $USER->Browsers[1]->ChatRequest->SenderGroupId; $this->OperatorCount = 1; } else { if (!(!empty($USER->Browsers[0]->Forward) && !empty($USER->Browsers[0]->DesiredChatGroup))) { if (!empty($_GET[GET_EXTERN_INTERN_USER_ID])) { $USER->Browsers[0]->DesiredChatPartner = Operator::GetSystemId(Encoding::Base64UrlDecode(getParam(GET_EXTERN_INTERN_USER_ID))); } if (!empty($USER->Browsers[0]->InitChatWith)) { $USER->Browsers[0]->DesiredChatPartner = $USER->Browsers[0]->InitChatWith; } if (!empty($USER->Browsers[0]->Forward)) { $USER->Browsers[0]->DesiredChatPartner = ""; } if (!(!empty($USER->Browsers[0]->DesiredChatPartner) && !empty($USER->Browsers[0]->DesiredChatGroup) && !empty($USER->Browsers[0]->OperatorId))) { $USER->Browsers[0]->DesiredChatGroup = $this->GroupBuilder->GetTargetGroup($this->OperatorCount, $USER->Browsers[0]->DesiredChatPartner, $USER->Browsers[0]->DesiredChatGroup); } else { $this->OperatorCount = 1; } } else { $this->OperatorCount = 1; } } ChatRouter::$WelcomeManager = false; $this->Human = $this->HumanGeneral = false; $this->Botmode = empty($USER->Browsers[0]->Forward) && !Visitor::$OpenChatExternal; $this->RepollRequired = false; }
$html = str_replace("<!--is_small-->", To::BoolString(!empty($_GET["s"])), $html); $html = str_replace("<!--is_logo-->", To::BoolString(!empty(Server::$Configuration->File["gl_cali"]) || !empty(Server::$Configuration->File["gl_cahi"])), $html); $html = str_replace("<!--is_mobile-->", To::BoolString($MobileDetect->isMobile() && !$MobileDetect->isTablet()), $html); $html = str_replace("<!--ticket_file_uploads-->", To::BoolString(true), $html); $html = str_replace("<!--kb_suggest-->", To::BoolString(Server::$Configuration->File["gl_knbs"]), $html); $html = str_replace("<!--kb_query_min_length-->", intval(Server::$Configuration->File["gl_kbml"]), $html); $html = str_replace("<!--show_waiting_message-->", To::BoolString(strlen(Server::$Configuration->File["gl_wmes"]) > 0), $html); $html = str_replace("<!--waiting_message_time-->", Server::$Configuration->File["gl_wmes"], $html); $html = str_replace("<!--extern_frequency-->", Server::$Configuration->File["poll_frequency_clients"], $html); $html = str_replace("<!--cbcd-->", To::BoolString(Server::$Configuration->File["gl_cbcd"]), $html); $html = str_replace("<!--bookmark_name-->", base64_encode(Server::$Configuration->File["gl_site_name"]), $html); $html = str_replace("<!--user_id-->", SESSION, $html); $html = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, $html); $html = GeoTracking::Replace($html); $html = str_replace("<!--requested_intern_userid-->", base64_encode(!empty($_GET[GET_EXTERN_INTERN_USER_ID]) && isset(Server::$Operators[Operator::GetSystemId(Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]) ? Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : ""), $html); $html = str_replace("<!--requested_intern_fullname-->", base64_encode(!empty($_GET[GET_EXTERN_INTERN_USER_ID]) && isset(Server::$Operators[Operator::GetSystemId(Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]) ? Server::$Operators[Operator::GetSystemId(Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]))]->Fullname : ""), $html); $html = str_replace("<!--debug-->", To::BoolString(!empty($_GET["debug"])), $html); $html = str_replace("<!--geo_resolute-->", To::BoolString(!empty(Server::$Configuration->File["gl_use_ngl"]) && !(Cookie::Get("geo_data") != null && Cookie::Get("geo_data") > time() - 2592000) && !GeoTracking::SpanExists()), $html); $html = str_replace("<!--chat_id-->", !empty($_GET["cid"]) ? getParam("cid") : "", $html); $html = str_replace("<!--gtv2_api_key-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? Server::$Configuration->File["gl_otrs"] : "", $html); $html = str_replace("<!--template_message_intern-->", base64_encode(str_replace("<!--color-->", ExternalChat::ReadBackgroundColor(), str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_INTERN)))), $html); $html = str_replace("<!--template_message_extern-->", base64_encode(str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_EXTERN))), $html); $html = str_replace("<!--template_message_add-->", base64_encode(str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_ADD))), $html); $html = str_replace("<!--template_message_add_alt-->", base64_encode(str_replace("<!--dir-->", LocalizationManager::$Direction, IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_ADD_ALTERNATE))), $html); $html = str_replace("<!--primary_color-->", ExternalChat::ReadBackgroundColor(), $html); $html = str_replace("<!--secondary_color-->", ExternalChat::ReadTextColor(), $html); $html = str_replace("<!--direct_login-->", To::BoolString(isset($_GET[GET_EXTERN_USER_NAME]) && !isset($_GET[GET_EXTERN_RESET]) || isset($_GET["dl"])), $html); $html = str_replace("<!--preselect_ticket-->", To::BoolString(isset($_GET["pt"])), $html); $html = str_replace("<!--is_ie-->", To::BoolString(!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false), $html); $html = str_replace("<!--is_ios-->", To::BoolString($MobileDetect->isIOS()), $html); $html = str_replace("<!--setup_error-->", base64_encode(buildLoginErrorField()), $html);
* 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 . "_lib/functions.global.inc.php"; require LIVEZILLA_PATH . "_lib/objects.global.users.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; header("Content-Type: image/jpg;"); @set_error_handler("handleError"); if (isset($_GET["intid"]) && initDataProvider()) { initData(array("INTERNAL")); $id = Operator::GetSystemId(base64UrlDecode($_GET["intid"])); if (isset($INTERNAL[$id])) { if (!empty($INTERNAL[$id]->WebcamPicture)) { exit(base64_decode($INTERNAL[$id]->WebcamPicture)); } else { if (!empty($INTERNAL[$id]->ProfilePicture)) { exit(base64_decode($INTERNAL[$id]->ProfilePicture)); } } } } exit(getFile("./images/nopic.jpg"));
* 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["intid"]) && Server::InitDataProvider()) { Server::InitDataBlock(array("INTERNAL")); $id = Operator::GetSystemId($_GET["intid"]); if (isset(Server::$Operators[$id])) { $sysid = $_GET["intid"]; if (!empty(Server::$Operators[$id]->Profile)) { header("Content-Type: application/vcard;"); header("Content-Disposition: attachment; filename=" . utf8_decode($sysid) . ".vcf"); $vcard = IOStruct::GetFile("./templates/vcard.tpl"); $vcard = str_replace("<!--Name-->", qp_encode(Server::$Operators[$id]->Profile->Name), $vcard); $vcard = str_replace("<!--Firstname-->", qp_encode(Server::$Operators[$id]->Profile->Firstname), $vcard); $vcard = str_replace("<!--Company-->", qp_encode(Server::$Operators[$id]->Profile->Company), $vcard); $vcard = str_replace("<!--Comments-->", qp_encode(Server::$Operators[$id]->Profile->Comments), $vcard); $vcard = str_replace("<!--Phone-->", qp_encode(Server::$Operators[$id]->Profile->Phone), $vcard); $vcard = str_replace("<!--Fax-->", qp_encode(Server::$Operators[$id]->Profile->Fax), $vcard); $vcard = str_replace("<!--Street-->", qp_encode(Server::$Operators[$id]->Profile->Street), $vcard); $vcard = str_replace("<!--City-->", qp_encode(Server::$Operators[$id]->Profile->City), $vcard); $vcard = str_replace("<!--ZIP-->", qp_encode(Server::$Operators[$id]->Profile->ZIP), $vcard);
function SaveTicket($_group, $_name, $_email, $_company, $_country, $_phone, $_cmb = false, $_text, $_custom = true, $_url = "") { global $INPUTS, $CONFIG, $INTERNAL; $isSpam = !empty($CONFIG["gl_sft"]) && createSPAMFilter(); $ticket = new Ticket(getObjectId("ticket_id", DATABASE_TICKETS), strtoupper(!empty($this->Language) ? $this->Language : $CONFIG["gl_default_language"])); $ticket->Messages[0]->Id = $ticket->Id; $ticket->Messages[0]->IP = getIP(); if (!isTicketFlood() && !$isSpam) { initData(array("INPUTS")); $ticket->SenderUserId = $ticket->Messages[0]->SenderUserId = $this->UserId; $ticket->Group = $_group; $ticket->Messages[0]->Fullname = $this->Browsers[0]->Fullname = $_name; $ticket->Messages[0]->Email = $this->Browsers[0]->Email = $_email; $ticket->Messages[0]->Company = $this->Browsers[0]->Company = $_company; $ticket->Messages[0]->Phone = $this->Browsers[0]->Phone = $_phone; $ticket->Messages[0]->Text = $_text; $ticket->Messages[0]->CallMeBack = $_cmb; $ticket->Messages[0]->Country = $_country; $ticket->Messages[0]->EmailId = getId(32); $ticket->Messages[0]->ChannelId = getId(32); $ticket->Messages[0]->Edited = $ticket->Messages[0]->Created = time(); $ticket->Messages[0]->Subject = $_url; $this->Browsers[0]->DesiredChatGroup = $ticket->Group; $this->Browsers[0]->SetCookieGroup(); if ($_custom) { foreach ($INPUTS as $index => $input) { if ($input->Active && $input->Custom) { if (isset($_POST["p_cf" . $index]) && !isset($_group->TicketInputsHidden[$index])) { $ticket->Messages[0]->Customs[$index] = $this->Browsers[0]->Customs[$index] = base64UrlDecode($_POST["p_cf" . $index]); } else { if (isset($_GET["cf" . $index]) && !isset($_group->TicketInputsHidden[$index])) { $ticket->Messages[0]->Customs[$index] = $this->Browsers[0]->Customs[$index] = base64UrlDecode($_GET["cf" . $index]); } } if ($input->Cookie && !empty($ticket->Messages[0]->Customs[$index])) { setCookieValue("cf_" . $index, $ticket->Messages[0]->Customs[$index]); } } else { if ($input->Active) { if ($input->Index == 111 && $input->Cookie) { setCookieValue("form_111", $ticket->Messages[0]->Fullname); } else { if ($input->Index == 112 && $input->Cookie) { setCookieValue("form_112", $ticket->Messages[0]->Email); } else { if ($input->Index == 113 && $input->Cookie) { setCookieValue("form_113", $ticket->Messages[0]->Company); } else { if ($input->Index == 114 && $input->Cookie) { setCookieValue("form_114", $ticket->Messages[0]->Text); } else { if ($input->Index == 116 && $input->Cookie) { setCookieValue("form_116", $ticket->Messages[0]->Phone); } } } } } } } } } if ($CONFIG["gl_adct"] == 1 || !(!empty($CONFIG["gl_rm_om"]) && $CONFIG["gl_rm_om_time"] == 0)) { $ticket->Save(); $ticket->AutoAssignEditor(); $ticket->SetLastUpdate(time()); } $this->AddFunctionCall("lz_chat_mail_callback(true);", false); if (!empty($_POST[POST_EXTERN_REQUESTED_INTERNID]) && !empty($INTERNAL[Operator::GetSystemId(base64UrlDecode($_POST[POST_EXTERN_REQUESTED_INTERNID]))])) { $TicketEditor = new TicketEditor($ticket->Id); $TicketEditor->Editor = Operator::GetSystemId(base64UrlDecode($_POST[POST_EXTERN_REQUESTED_INTERNID])); $TicketEditor->Status = 0; $TicketEditor->GroupId = $ticket->Group; $TicketEditor->Save(); } return $ticket; } else { $this->AddFunctionCall("lz_chat_mail_callback(false);", false); } return false; }
* * 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 . "_lib/functions.global.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; header("Content-Type: image/jpg;"); @set_error_handler("handleError"); if (isset($_GET["intid"]) && Server::InitDataProvider()) { Server::InitDataBlock(array("INTERNAL")); $id = Operator::GetSystemId(Encoding::Base64UrlDecode($_GET["intid"])); if (isset(Server::$Operators[$id])) { if (!empty(Server::$Operators[$id]->WebcamPicture)) { exit(base64_decode(Server::$Operators[$id]->WebcamPicture)); } else { if (!empty(Server::$Operators[$id]->ProfilePicture)) { exit(base64_decode(Server::$Operators[$id]->ProfilePicture)); } } } } exit(IOStruct::GetFile("./images/avatar.png"));
function operatorsAvailable($_amount = 0, $_exclude = null, $include_group = null, $include_user = null, $_allowBots = false) { global $INTERNAL, $GROUPS; if (!DB_CONNECTION) { return 0; } initData(array("INTERNAL", "GROUPS")); if (!empty($include_user)) { $include_group = $INTERNAL[Operator::GetSystemId($include_user)]->GetGroupList(true); } foreach ($INTERNAL as $internaluser) { $isex = $internaluser->IsExternal($GROUPS, $_exclude, $include_group); if ($isex && $internaluser->Status < USER_STATUS_OFFLINE) { if ($_allowBots || !$internaluser->IsBot) { $_amount++; } } } return $_amount; }
function GetPredefinedOperator($_user, &$direct_target, $_allowBots, $_requireBot, $desired = "") { if (!empty($this->TargetOperatorSystemId) && isset(Server::$Operators[$this->TargetOperatorSystemId]) && Server::$Operators[$this->TargetOperatorSystemId]->Status < USER_STATUS_OFFLINE) { if (!(!empty($this->TargetGroupId) && !in_array($this->TargetGroupId, Server::$Operators[$this->TargetOperatorSystemId]->GetGroupList(true)))) { $desired = $this->TargetOperatorSystemId; } } else { $this->TargetOperatorSystemId = null; $opParam = Operator::ReadParams(); if (!empty($opParam)) { $desired = $direct_target = Operator::GetSystemId($opParam); } else { if (!Is::Null(Cookie::Get("internal_user")) && !empty(Server::$Configuration->File["gl_save_op"])) { $desired = Operator::GetSystemId(Cookie::Get("internal_user")); if (!empty(Server::$Operators[$desired]) && !(!empty($this->TargetGroupId) && !in_array($this->TargetGroupId, Server::$Operators[$desired]->GetGroupList(true)))) { $direct_target = $desired; } else { $desired = ""; } } else { if (empty($desired) && !empty(Server::$Configuration->File["gl_save_op"])) { $desired = $_user->GetLastChatOperator(true); } } } } if (!empty($desired) && Server::$Operators[$desired]->MobileSleep($_user->Browsers[0])) { $this->TargetOperatorSystemId = $desired = ""; } else { if (!empty($desired) && !$_allowBots && Server::$Operators[$desired]->IsBot) { $this->TargetOperatorSystemId = $desired = ""; } else { if (!empty($desired) && $_requireBot && !Server::$Operators[$desired]->IsBot) { $this->TargetOperatorSystemId = $desired = ""; } } } return $desired; }
function getPredefinedOperator(&$fromCookie, $_allowBots, $_requireBot, $desired = "") { global $USER, $INTERNAL; if (!empty($USER->Browsers[0]->DesiredChatPartner) && isset($INTERNAL[$USER->Browsers[0]->DesiredChatPartner]) && $INTERNAL[$USER->Browsers[0]->DesiredChatPartner]->Status < USER_STATUS_OFFLINE) { if (!(!empty($USER->Browsers[0]->DesiredChatGroup) && !in_array($USER->Browsers[0]->DesiredChatGroup, $INTERNAL[$USER->Browsers[0]->DesiredChatPartner]->GetGroupList(true)))) { $desired = $USER->Browsers[0]->DesiredChatPartner; } } else { $USER->Browsers[0]->DesiredChatPartner = null; $opParam = getOperatorParameter(); if (!empty($opParam)) { $desired = Operator::GetSystemId($opParam); } else { if (!isnull(getCookieValue("internal_user")) && !empty($CONFIG["gl_save_op"])) { $desired = Operator::GetSystemId(getCookieValue("internal_user")); if (!empty($INTERNAL[$desired]) && !(!empty($USER->Browsers[0]->DesiredChatGroup) && !in_array($USER->Browsers[0]->DesiredChatGroup, $INTERNAL[$desired]->GetGroupList(true)))) { $fromCookie = $desired; } else { $desired = ""; } } } } if (!empty($desired) && $INTERNAL[$desired]->MobileSleep($USER->Browsers[0]->Forward)) { $USER->Browsers[0]->DesiredChatPartner = $desired = ""; } else { if (!empty($desired) && !$_allowBots && $INTERNAL[$desired]->IsBot) { $USER->Browsers[0]->DesiredChatPartner = $desired = ""; } else { if (!empty($desired) && $_requireBot && !$INTERNAL[$desired]->IsBot) { $USER->Browsers[0]->DesiredChatPartner = $desired = ""; } } } return $desired; }
function GetXML($_internal, $_full) { if ($_full) { $intern = isset($_internal[Operator::GetSystemId($this->InternId)]) ? $_internal[Operator::GetSystemId($this->InternId)]->Fullname : $this->InternId; return "<val id=\"" . base64_encode($this->Id) . "\" cr=\"" . base64_encode($this->Created) . "\" rc=\"" . base64_encode($this->RateComment) . "\" rp=\"" . base64_encode($this->RatePoliteness) . "\" rq=\"" . base64_encode($this->RateQualification) . "\" fn=\"" . base64_encode($this->Fullname) . "\" em=\"" . base64_encode($this->Email) . "\" co=\"" . base64_encode($this->Company) . "\" ii=\"" . base64_encode($intern) . "\" ui=\"" . base64_encode($this->UserId) . "\" />\r\n"; } else { return "<val id=\"" . base64_encode($this->Id) . "\" cr=\"" . base64_encode($this->Created) . "\" />\r\n"; } }
function TicketEditorAssign() { $editor = new TicketEditor(); $params = ApiV2::GetObjectFields("TicketEditor"); if ($editor = $this->CreateFromJSON($params, json_decode($_POST["p_data"]), $editor, "TicketEditor")) { $Ticket = new Ticket(); $Ticket->Id = $editor->Id; if ($Ticket->Load()) { $editor->Editor = Operator::GetSystemId($editor->Editor); if (isset(Server::$Operators[$editor->Editor])) { if (!empty($editor->GroupId) && in_array($editor->GroupId, Server::$Operators[$editor->Editor]->GetGroupList(true))) { $editor->Save(); $Ticket->Editor = $editor; if ($Ticket->Group != $editor->GroupId) { $Ticket->SetGroup($editor->GroupId); } $Ticket->LoadMessages(); $Ticket->SetLastUpdate(time()); $this->JSONOutput = APIV2::Encode(array("TicketEditor" => ApiV2::ClearObject($params, $editor)), $this->JSONParams); CacheManager::SetDataUpdateTime(DATA_UPDATE_KEY_TICKETS); } else { $this->ErrorField = "GroupId"; } } else { $this->ErrorField = "Editor"; } } else { $this->ErrorField = "Id"; } } }
$USER->Browsers[0]->Load(); } if (!empty($_GET["tth"]) || $USER->IsInChat(true, $USER->Browsers[0]) || $openChatExternal) { define("IGNORE_WM", true); } if (defined("IGNORE_WM") && !empty($USER->Browsers[0]->DesiredChatPartner) && $INTERNAL[$USER->Browsers[0]->DesiredChatPartner]->IsBot) { $USER->Browsers[0]->DesiredChatPartner = ""; } if (!empty($USER->Browsers[1]->ChatRequest) && $USER->Browsers[1]->ChatRequest->Closed && !$USER->Browsers[1]->ChatRequest->Accepted && @$INTERNAL[$USER->Browsers[1]->ChatRequest->SenderSystemId]->UserStatus < USER_STATUS_OFFLINE && $INTERNAL[$USER->Browsers[1]->ChatRequest->SenderSystemId]->IsExternal($GROUPS, null, array($USER->Browsers[1]->ChatRequest->SenderGroupId), true)) { $USER->Browsers[0]->DesiredChatPartner = $USER->Browsers[1]->ChatRequest->SenderSystemId; $USER->Browsers[0]->DesiredChatGroup = $USER->Browsers[1]->ChatRequest->SenderGroupId; $OPERATOR_COUNT = 1; } else { if (!(!empty($USER->Browsers[0]->Forward) && !empty($USER->Browsers[0]->DesiredChatGroup))) { if (!empty($_GET[GET_EXTERN_INTERN_USER_ID])) { $USER->Browsers[0]->DesiredChatPartner = Operator::GetSystemId(base64UrlDecode(getParam(GET_EXTERN_INTERN_USER_ID))); } if (!empty($USER->Browsers[0]->InitChatWith)) { $USER->Browsers[0]->DesiredChatPartner = $USER->Browsers[0]->InitChatWith; } if (!empty($USER->Browsers[0]->Forward)) { $USER->Browsers[0]->DesiredChatPartner = ""; } if (!(!empty($USER->Browsers[0]->DesiredChatPartner) && !empty($USER->Browsers[0]->DesiredChatGroup) && !empty($USER->Browsers[0]->InternalUser))) { $USER->Browsers[0]->DesiredChatGroup = $GroupBuilder->GetTargetGroup($OPERATOR_COUNT, $USER->Browsers[0]->DesiredChatPartner); } else { $OPERATOR_COUNT = 1; } } else { $OPERATOR_COUNT = 1; }
function SaveTicket($_group, $_country, $_cmb = false, $_custom = true, $_url = "", $changed = false) { global $INPUTS, $CONFIG, $INTERNAL, $GROUPS; $isSpam = !empty($CONFIG["gl_sft"]) && createSPAMFilter(); $ticket = new Ticket(getObjectId("ticket_id", DATABASE_TICKETS), strtoupper(!empty($this->Language) ? $this->Language : $CONFIG["gl_default_language"])); $ticket->Messages[0]->Id = $ticket->Id; $ticket->Messages[0]->IP = getIP(); $group = $GROUPS[$_group]; if (!isTicketFlood() && !$isSpam) { initData(array("INPUTS")); $ticket->SenderUserId = $ticket->Messages[0]->SenderUserId = $this->UserId; $ticket->Group = $_group; $ticket->Messages[0]->Fullname = $this->Browsers[0]->Fullname = $group->GetServerInput($INPUTS[111], false, "", $changed); $ticket->Messages[0]->Email = $this->Browsers[0]->Email = $group->GetServerInput($INPUTS[112], false, "", $changed); $ticket->Messages[0]->Company = $this->Browsers[0]->Company = $group->GetServerInput($INPUTS[113], false, "", $changed); $ticket->Messages[0]->Phone = $this->Browsers[0]->Phone = $group->GetServerInput($INPUTS[116], false, "", $changed); $ticket->Messages[0]->Text = $group->GetServerInput($INPUTS[114], false, "", $changed); $ticket->Messages[0]->CallMeBack = $_cmb; $ticket->Messages[0]->Country = $_country; $ticket->Messages[0]->EmailId = getId(32); $ticket->Messages[0]->ChannelId = getId(32); $ticket->Messages[0]->Edited = $ticket->Messages[0]->Created = time(); if (empty($_url)) { $_url = Visitor::GetLastURLFromVisitor($this->UserId); } $ticket->Messages[0]->Subject = $_url; $this->Browsers[0]->DesiredChatGroup = $ticket->Group; $this->Browsers[0]->SetCookieGroup(); if ($_custom) { foreach ($INPUTS as $index => $input) { if ($input->Active && $input->Custom) { $value = $group->GetServerInput($input, false, "", $changed); if ($input->Type != "File" && !empty($value) && !in_array($index, $group->TicketInputsHidden)) { $ticket->Messages[0]->Customs[$index] = $this->Browsers[0]->Customs[$index] = $value; } else { if ($input->Type == "File" && isset($_FILES["p_cf" . $index]) && !in_array($index, $group->TicketInputsHidden)) { $ticket->Messages[0]->Customs[$index] = $this->Browsers[0]->Customs[$index] = $ticket->Messages[0]->AppendPostFile("p_cf" . $index, $this->UserId); } } if ($input->Cookie && !empty($ticket->Messages[0]->Customs[$index]) && $input->Type != "File") { setCookieValue("cf_" . $index, $ticket->Messages[0]->Customs[$index]); } } else { if ($input->Active) { if ($input->Index == 111 && $input->Cookie) { setCookieValue("form_111", $ticket->Messages[0]->Fullname); } else { if ($input->Index == 112 && $input->Cookie) { setCookieValue("form_112", $ticket->Messages[0]->Email); } else { if ($input->Index == 113 && $input->Cookie) { setCookieValue("form_113", $ticket->Messages[0]->Company); } else { if ($input->Index == 114 && $input->Cookie) { setCookieValue("form_114", $ticket->Messages[0]->Text); } else { if ($input->Index == 116 && $input->Cookie) { setCookieValue("form_116", $ticket->Messages[0]->Phone); } } } } } } } } } if ($CONFIG["gl_adct"] == 1 || !(!empty($CONFIG["gl_rm_om"]) && $CONFIG["gl_rm_om_time"] == 0)) { $ticket->Save(); $ticket->AutoAssignEditor(); $ticket->SetLastUpdate(time()); } $this->AddFunctionCall("lz_chat_mail_callback(true);", false); if (!empty($_POST[POST_EXTERN_REQUESTED_INTERNID]) && !empty($INTERNAL[Operator::GetSystemId(base64UrlDecode($_POST[POST_EXTERN_REQUESTED_INTERNID]))])) { $TicketEditor = new TicketEditor($ticket->Id); $TicketEditor->Editor = Operator::GetSystemId(base64UrlDecode($_POST[POST_EXTERN_REQUESTED_INTERNID])); $TicketEditor->Status = 0; $TicketEditor->GroupId = $ticket->Group; $TicketEditor->Save(); } if (!empty($CONFIG["gl_mpm"])) { foreach ($INTERNAL as $operator) { if ($operator->IsInPushMessageState()) { if ($operator->HasAccessToTicket($ticket)) { $operator->AddPushMessage($ticket->Id, $this->SystemId, $_name, 2, $_text); } } } } return $ticket; } else { $this->AddFunctionCall("lz_chat_mail_callback(false);", false); } return false; }
function ReloadGroups($_overlay = false, $_preSelect = true) { Server::InitDataBlock(array("INTERNAL", "FILTERS")); $grParam = UserGroup::ReadParams(); $opParam = Operator::ReadParams(); if (!empty($grParam) && empty($this->Browsers[0]->DesiredChatGroup)) { $this->Browsers[0]->DesiredChatGroup = $grParam; } if (!empty($opParam)) { $this->Browsers[0]->DesiredChatPartner = Operator::GetSystemId($opParam); } $groupbuilder = new GroupBuilder($this->Browsers[0]->DesiredChatGroup, $this->Browsers[0]->DesiredChatPartner); $groupbuilder->Generate($this); if (!empty($opParam)) { $this->Browsers[0]->DesiredChatPartner = Operator::GetSystemId($opParam); } $groupsAvailable = To::BoolString($groupbuilder->GroupAvailable || isset($_POST[GET_EXTERN_RESET]) && strlen($groupbuilder->ErrorHTML) <= 2); $_preSelect = $_preSelect ? Encoding::Base64UrlEncode($this->Browsers[0]->DesiredChatGroup) : ""; $this->AddFunctionCall("lz_chat_set_groups(" . $groupsAvailable . ",\"" . $groupbuilder->Result . "\" ," . $groupbuilder->ErrorHTML . ",'" . $_preSelect . "');", false); if (!$_overlay) { $this->AddFunctionCall("lz_chat_release(" . $groupsAvailable . "," . $groupbuilder->ErrorHTML . ");", false); } }