コード例 #1
0
 $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);
 $html = str_replace("<!--offline_message_mode-->", Server::$Configuration->File["gl_om_mode"], $html);
 $html = str_replace("<!--offline_message_http-->", Server::$Configuration->File["gl_om_http"], $html);
コード例 #2
0
 static function Replace($_toReplace, $jsa = "")
 {
     $_toReplace = str_replace("<!--geo_url-->", GeoTracking::GetURL() . "?aid=" . Server::$Configuration->File["wcl_geo_tracking"] . "&sid=" . base64_encode(Server::$Configuration->File["gl_lzid"]) . "&dbp=" . Server::$Configuration->File["gl_gtdb"], $_toReplace);
     if (!empty(Server::$Configuration->File["gl_use_ngl"])) {
         if (!Is::Null(trim(Server::$Configuration->File["gl_pr_ngl"]))) {
             $gkey = Server::$Configuration->File["gl_pr_ngl"];
         }
         if (!empty($gkey)) {
             $jsc = "var chars = new Array(";
             $jso = "var order = new Array(";
             $chars = str_split(sha1($gkey . date("d"), false));
             $keys = array_keys($chars);
             shuffle($keys);
             foreach ($keys as $key) {
                 $jsc .= "'" . $chars[$key] . "',";
                 $jso .= $key . ",";
             }
             $jsa .= $jsc . "0);\r\n";
             $jsa .= $jso . "0);\r\n";
             $jsa .= "while(lz_oak.length < (chars.length-1))for(var f in order)if(order[f] == lz_oak.length)lz_oak += chars[f];\r\n";
         }
     }
     $_toReplace = str_replace("<!--calcoak-->", $jsa, $_toReplace);
     $_toReplace = str_replace("<!--mip-->", Communication::GetIP(false, true), $_toReplace);
     return $_toReplace;
 }
コード例 #3
0
 static function UpdateConfiguration($id = 0)
 {
     if (OperatorRequest::IsValidated() && Is::Defined("VALIDATED_FULL_LOGIN") && OperatorRequest::IsAdministrator(true)) {
         Logging::SecurityLog("ServerManager::UpdateConfiguration", "", CALLER_SYSTEM_ID);
         if (Is::Defined("STATS_ACTIVE") && !empty($_POST["p_reset_stats"])) {
             Server::$Statistic->ResetAll();
         }
         $int = 0;
         if (DB_CONNECTION) {
             DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` SET `delete`='1';");
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_LOCALIZATIONS . "`;");
             while (!empty($_POST["p_cfg_cct_id_" . $int])) {
                 $cct = new CommercialChatBillingType($_POST["p_cfg_cct_id_" . $int], $_POST["p_cfg_cct_mnoc_" . $int], $_POST["p_cfg_cct_mtloc_" . $int], $_POST["p_cfg_cct_tae_" . $int], $_POST["p_cfg_cct_tvbo_" . $int], $_POST["p_cfg_cct_svbo_" . $int], $_POST["p_cfg_cct_evbo_" . $int], $_POST["p_cfg_cct_citl_" . $int], $_POST["p_cfg_cct_p_" . $int]);
                 $cct->Save();
                 $iint = 0;
                 while (!empty($_POST["p_cfg_cctli_id_" . $int . "_" . $iint])) {
                     $cctl = new CommercialChatVoucherLocalization($_POST["p_cfg_cctli_id_" . $int . "_" . $iint], $_POST["p_cfg_cctli_itl_" . $int . "_" . $iint], $_POST["p_cfg_cctli_t_" . $int . "_" . $iint], $_POST["p_cfg_cctli_d_" . $int . "_" . $iint], $_POST["p_cfg_cctli_terms_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvc_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvp_" . $int . "_" . $iint], $_POST["p_cfg_cctli_emvu_" . $int . "_" . $iint], $_POST["p_cfg_cctli_exr_" . $int . "_" . $iint]);
                     $cctl->Save($_POST["p_cfg_cct_id_" . $int]);
                     $iint++;
                 }
                 $int++;
             }
             $int = 0;
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_PROVIDERS . "`;");
             while (!empty($_POST["p_cfg_ccpp_id_" . $int])) {
                 $ccpp = new CommercialChatPaymentProvider($_POST["p_cfg_ccpp_id_" . $int], $_POST["p_cfg_ccpp_n_" . $int], $_POST["p_cfg_ccpp_a_" . $int], $_POST["p_cfg_ccpp_u_" . $int], $_POST["p_cfg_ccpp_l_" . $int]);
                 $ccpp->Save();
                 $int++;
             }
             $int = 0;
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_MAILBOXES . "`;");
             while (!empty($_POST["p_cfg_es_i_" . $int])) {
                 $acc = new Mailbox($int, true);
                 $acc->Save();
                 $int++;
             }
             $int = 0;
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_FEEDBACK_CRITERIA_CONFIG . "`;");
             while (isset($_POST["p_cfg_fc_i_" . $int])) {
                 $fc = new FeedbackCriteria($int, true);
                 $fc->Save();
                 $int++;
             }
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` WHERE `delete`='1';");
             DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CONFIG . "`;");
             foreach ($_POST as $key => $value) {
                 if (strpos($key, "p_cfg_g_") === 0) {
                     $skey = str_replace("p_cfg_g_", "", $key);
                     $value = base64_decode($value);
                     DBManager::Execute(true, "REPLACE INTO `" . DB_PREFIX . DATABASE_CONFIG . "` (`key`,`value`) VALUES ('" . DBManager::RealEscape($skey) . "','" . DBManager::RealEscape($value) . "');");
                 }
             }
             CacheManager::Flush();
         }
         if (isset($_POST["p_available"])) {
             ServerManager::UpdateAvailability(!empty($_POST["p_available"]));
         }
         //$id = IOStruct::CreateFile($file,base64_decode($_POST["p_upload_value"]),true);
     }
     GeoTracking::SpanRemove(true);
     CacheManager::Flush();
     Server::$Response->SetStandardResponse($id, "");
 }
コード例 #4
0
 if (empty($_GET[GET_TRACK_NO_SEARCH_ENGINE])) {
     exit(IOStruct::GetFile(TEMPLATE_HTML_SUPPORT));
 }
 VisitorMonitoring::$Visitor->CreateSignature();
 VisitorMonitoring::$Response = IOStruct::GetFile(TEMPLATE_SCRIPT_TRACK);
 VisitorMonitoring::$Response = str_replace("<!--file_chat-->", FILE_CHAT, VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--server_id-->", substr(md5(Server::$Configuration->File["gl_lzid"]), 5, 5), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--server-->", LIVEZILLA_URL, VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--website-->", Encoding::Base64UrlEncode(Communication::GetParameter("ws", "", $nu, null, null, 255)), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--area_code-->", Communication::GetParameter(GET_TRACK_SPECIAL_AREA_CODE, "", $nu, null, null, 255, false, false), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--browser_id-->", htmlentities(CALLER_BROWSER_ID, ENT_QUOTES, "UTF-8"), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_id-->", htmlentities(VisitorMonitoring::$Visitor->UserId, ENT_QUOTES, "UTF-8"), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--connection_error_span-->", CONNECTION_ERROR_SPAN, VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--poll_frequency-->", VisitorMonitoring::GetPollFrequency(false, false), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = GeoTracking::Replace(VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--geo_resolute-->", To::BoolString(VisitorMonitoring::$Visitor->UserId == CALLER_USER_ID && !empty(Server::$Configuration->File["gl_use_ngl"]) && VisitorMonitoring::$Visitor->FirstCall && !(!Is::Null(Cookie::Get("geo_data")) && Cookie::Get("geo_data") > time() - 2592000) && !GeoTracking::SpanExists()), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--alert_html-->", base64_encode(getAlertTemplate()), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_company-->", Encoding::Base64UrlEncode(VisitorMonitoring::$Browser->UserData->Company), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_question-->", Encoding::Base64UrlEncode(VisitorMonitoring::$Browser->UserData->Text), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_phone-->", Encoding::Base64UrlEncode(VisitorMonitoring::$Browser->UserData->Phone), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_language-->", Communication::GetParameter(GET_EXTERN_USER_LANGUAGE, "", $nu, null, null, 5, true, true, true, true), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_header-->", Communication::GetParameter(GET_EXTERN_USER_HEADER, "", $nu, FILTER_SANITIZE_URL, null, 0, true, true, true, true), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--user_customs-->", getJSCustomArray(VisitorMonitoring::$Browser->UserData->Customs), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--is_mobile-->", To::BoolString(VisitorMonitoring::$IsMobile), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--is_ie-->", To::BoolString($detector->BrowserName == "Internet Explorer"), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--direct_login-->", To::BoolString(Communication::ReadParameter("dl")), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--is_ovlpos-->", To::BoolString($detector->BrowserName != "Internet Explorer" || $detector->BrowserVersion > 6), VisitorMonitoring::$Response);
 VisitorMonitoring::$Response = str_replace("<!--is_ovlc-->", To::BoolString(!empty($_GET["ovlc"])), VisitorMonitoring::$Response);
 if (!empty($_GET["ovlc"]) && !VisitorMonitoring::$HideOverlayOnMobile) {
     require LIVEZILLA_PATH . "_lib/functions.external.inc.php";
     VisitorMonitoring::$Response .= IOStruct::GetFile(TEMPLATE_SCRIPT_OVERLAY_CHAT);
コード例 #5
0
 function Save($_resolution, $_color, $_timezone, $_lat, $_long, $_countryiso2, $_city, $_region, $_geotimezone, $_isp, $_geosspan, $_grid, $_js = true, $_fromCookie = false)
 {
     if (!$this->FirstCall) {
         $this->KeepAlive();
     } else {
         if (!Is::Null(Cookie::Get("visits")) && $this->Visits == 1) {
             $this->Visits = Cookie::Get("visits") + 1;
         }
         Cookie::Set("visits", $this->Visits);
         if (!Is::Null(Cookie::Get("last_visit"))) {
             $this->VisitLast = Cookie::Get("last_visit");
         }
         Cookie::Set("last_visit", time());
         $this->IP = Communication::GetIP();
         $this->SystemInfo = !empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
         $localization = LocalizationManager::GetBrowserLocalization();
         $this->Language = $localization[0];
         if (!empty($localization[1])) {
             $this->GeoCountryISO2 = $localization[1];
         }
         $this->Resolution = !empty($_resolution) && count($_resolution) == 2 && !empty($_resolution[0]) && !empty($_resolution[1]) ? $_resolution[0] . " x " . $_resolution[1] : "";
         $this->Resolution .= !empty($_color) ? " (" . $_color . " Bit)" : "";
         $this->GeoTimezoneOffset = SystemTime::GetLocalTimezone($_timezone);
         $this->GeoResult = 0;
         if (!empty($_geosspan)) {
             GeoTracking::SpanCreate($_geosspan);
         }
         if (!empty(Server::$Configuration->File["gl_use_ngl"]) && $_js) {
             if (!Is::Null(Cookie::Get("geo_data")) && !Is::Null(Cookie::Get(GEO_LATITUDE))) {
                 $this->GeoLatitude = Cookie::Get(GEO_LATITUDE);
                 $this->GeoLongitude = Cookie::Get(GEO_LONGITUDE);
                 $this->GeoCountryISO2 = Cookie::Get(GEO_COUNTRY_ISO_2);
                 $this->GeoCity = Cookie::Get(GEO_CITY);
                 $this->GeoRegion = Cookie::Get(GEO_REGION);
                 $this->GeoTimezoneOffset = Cookie::Get(GEO_TIMEZONE);
                 $this->GeoISP = Cookie::Get(GEO_ISP);
                 $_fromCookie = true;
             } else {
                 if (!empty($_lat) && $_lat > -180) {
                     Cookie::Set(GEO_LATITUDE, $this->GeoLatitude = $_lat);
                     Cookie::Set(GEO_LONGITUDE, $this->GeoLongitude = $_long);
                     Cookie::Set(GEO_COUNTRY_ISO_2, $this->GeoCountryISO2 = $_countryiso2);
                     Cookie::Set(GEO_CITY, $this->GeoCity = $_city);
                     Cookie::Set(GEO_REGION, $this->GeoRegion = $_region);
                     Cookie::Set(GEO_TIMEZONE, $this->GeoTimezoneOffset = $_geotimezone);
                     Cookie::Set(GEO_ISP, $this->GeoISP = $_isp);
                     Cookie::Set("geo_data", time());
                 } else {
                     if (!empty($_lat)) {
                         $this->GeoLatitude = $_lat;
                         $this->GeoLongitude = $_long;
                     }
                 }
             }
             GeoTracking::SpanRemove(false);
             if ($_fromCookie) {
                 $this->GeoResultId = 6;
             } else {
                 if (!Is::Null($span = GeoTracking::SpanExists())) {
                     if ($span > time() + CONNECTION_ERROR_SPAN) {
                         $this->GeoResultId = 5;
                     } else {
                         $this->GeoResultId = 4;
                     }
                 } else {
                     if ($_lat == -777) {
                         $this->GeoResultId = 5;
                     } else {
                         if ($_lat == -522) {
                             $this->GeoResultId = 2;
                         } else {
                             if ($_grid != 4) {
                                 $this->GeoResultId = 3;
                             } else {
                                 $this->GeoResultId = $_grid;
                             }
                         }
                     }
                 }
             }
         } else {
             $this->GeoResultId = 7;
         }
         Server::InitDataBlock(array("COUNTRIES"));
         if (isset(Server::$CountryAliases[$this->GeoCountryISO2])) {
             $this->GeoCountryISO2 = Server::$CountryAliases[$this->GeoCountryISO2];
         }
         $detector = new DeviceDetector();
         $detector->DetectBrowser($this->Host);
         if ($detector->AgentType == AGENT_TYPE_BROWSER || $detector->AgentType == AGENT_TYPE_UNKNOWN) {
             $detector->DetectOperatingSystem($this->Host);
             $bid = $this->GetBrowserId($detector->Browser, $detector->AgentType);
             $oid = $this->GetOSId($detector->OperatingSystem);
             $this->CreateSignature();
             DBManager::Execute(true, "INSERT IGNORE INTO `" . DB_PREFIX . DATABASE_VISITORS . "` (`id`, `entrance`,`last_active`, `host`,`ip`,`system`,`browser`, `visits`,`visit_id`,`visit_last`,`resolution`, `language`, `country`, `city`, `region`, `isp`, `timezone`, `latitude`, `longitude`, `geo_result`, `js`, `signature`) VALUES ('" . DBManager::RealEscape($this->UserId) . "', '" . DBManager::RealEscape(time()) . "','" . DBManager::RealEscape(time()) . "', '" . DBManager::RealEscape($this->Host) . "', '" . DBManager::RealEscape($this->IP) . "', '" . DBManager::RealEscape($oid) . "','" . DBManager::RealEscape($bid) . "', '" . DBManager::RealEscape($this->Visits) . "', '" . DBManager::RealEscape($this->VisitId) . "','" . DBManager::RealEscape($this->VisitLast) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_RESOLUTIONS, "resolution", $this->Resolution, false, 32)) . "', '" . DBManager::RealEscape(substr(strtoupper($this->Language), 0, 5)) . "','" . DBManager::RealEscape($this->GeoCountryISO2) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_CITIES, "city", $this->GeoCity, false)) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_REGIONS, "region", $this->GeoRegion, false)) . "', '" . DBManager::RealEscape(CacheManager::GetDataTableIdFromValue(DATABASE_VISITOR_DATA_ISPS, "isp", utf8_encode($this->GeoISP), false)) . "', '" . DBManager::RealEscape($this->GeoTimezoneOffset) . "', '" . DBManager::RealEscape($this->GeoLatitude) . "', '" . DBManager::RealEscape($this->GeoLongitude) . "', '" . DBManager::RealEscape($this->GeoResultId) . "', '" . DBManager::RealEscape($_js ? 1 : 0) . "', '" . DBManager::RealEscape($this->Signature) . "');");
             if ($this->VisitsDay > 1 && DBManager::GetAffectedRowCount() == 1) {
                 DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_VISITORS . "` SET `visit_latest`=0 WHERE `id`='" . DBManager::RealEscape($this->UserId) . "' AND `visit_id`!='" . DBManager::RealEscape($this->VisitId) . "';");
             }
         } else {
             if (STATS_ACTIVE) {
                 $this->IsCrawler = true;
                 Server::$Statistic->ProcessAction(ST_ACTION_LOG_CRAWLER_ACCESS, array($this->GetCrawlerId($detector->Browser), null));
             }
         }
     }
 }