define("IN_LIVEZILLA", true); if (!defined("LIVEZILLA_PATH")) { define("LIVEZILLA_PATH", "./"); } @ini_set('session.use_cookies', '0'); @error_reporting(E_ALL); $html = ""; require LIVEZILLA_PATH . "_definitions/definitions.inc.php"; require LIVEZILLA_PATH . "_lib/functions.global.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.protocol.inc.php"; require LIVEZILLA_PATH . "_definitions/definitions.dynamic.inc.php"; require LIVEZILLA_PATH . "_lib/functions.external.inc.php"; require LIVEZILLA_PATH . "_lib/objects.external.inc.php"; Server::DefineURL(FILE_CHAT); Server::InitDataProvider(); LocalizationManager::AutoLoad(); $browserId = getId(USER_ID_LENGTH); if (!isset($_GET[GET_EXTERN_TEMPLATE])) { @set_time_limit(Server::$Configuration->File["timeout_chats"]); if (!isset($_GET["file"])) { @set_error_handler("handleError"); } define("SESSION", getSessionId()); if (empty(Server::$Configuration->File["gl_om_pop_up"]) && Server::$Configuration->File["gl_om_mode"] == 1) { Server::InitDataBlock(array("INTERNAL", "GROUPS", "FILTERS")); $groupbuilder = new GroupBuilder(); $groupbuilder->Generate(); if (!$groupbuilder->GroupAvailable) { exit("<html><script language=\"JavaScript\">if(typeof(window.opener != null) != 'undefined')window.opener.location = \"" . Server::$Configuration->File["gl_om_http"] . "\";window.close();</script></html>"); } } else {
/**************************************************************************************** * LiveZilla report.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); 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"; @set_error_handler("handleError"); if (!empty($_GET["h"]) && !empty($_GET["y"]) && isset($_GET["m"]) && isset($_GET["d"]) && Server::InitDataProvider()) { Server::DefineURL("report.php"); Server::InitStatisticProvider(); $repData = StatisticProvider::GetReportFromHash($_GET["h"], $_GET["y"], $_GET["m"], $_GET["d"], !empty($_GET["u"])); if ($repData !== false) { LocalizationManager::AutoLoad(strtolower(Server::$Configuration->File["gl_default_language"]), true); $repData = Server::Replace($repData, true, false, false, true); exit($repData); } } exit("Sorry, report was not found.");
function SendPaidEmail($_purchasedForGroup = "") { Server::InitDataBlock(array("DBCONFIG")); $loc = Server::$Configuration->Database["cct"][$this->TypeId]->GetLocalization($this->Language); if ($loc != null && !empty($loc->EmailVoucherPaid)) { $email = $loc->EmailVoucherPaid; $email = str_replace("%buyer_first_name%", $this->Firstname, $email); $email = str_replace("%buyer_last_name%", $this->Lastname, $email); $email = str_replace("%voucher_code%", $this->Id, $email); $email = str_replace("%website_name%", Server::$Configuration->File["gl_site_name"], $email); $email = str_replace("%chat_url%", $this->GetVoucherChatURL($_purchasedForGroup), $email); LocalizationManager::AutoLoad($loc->LanguageISOTwoLetter); $defmailbox = Mailbox::GetDefaultOutgoing(); if ($defmailbox != null) { Communication::SendEmail($defmailbox, $this->Email, $defmailbox->Email, $email, "", LocalizationManager::$TranslationStrings["client_voucher_email_subject_paid"]); } } }
function buildReports($xml = "") { if (empty($_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME])) { return; } if (empty(Server::$Statistic->CurrentDay) || Server::$Operators[CALLER_SYSTEM_ID]->GetPermission(PERMISSION_REPORTS) == PERMISSION_NONE) { return; } if ($_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME] == XML_CLIP_NULL) { $_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME] = "0_0"; } $parts = explode("_", $_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME]); if ($result = DBManager::Execute(true, "SELECT *,(SELECT MAX(`time`) FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "`) AS `maxtime`,(SELECT MAX(`mtime`) FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE `maxtime`=`time`) AS `maxmtime` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE (`time` = " . DBManager::RealEscape($parts[0]) . " AND `mtime` > " . DBManager::RealEscape($parts[1]) . ") OR (`time` > " . DBManager::RealEscape($parts[0]) . ") ORDER BY `time` ASC,`mtime` ASC LIMIT 1")) { while ($row = DBManager::FetchArray($result)) { if ($row["month"] == 0) { $report = new StatisticYear($row["year"], 0, 0, $row["aggregated"], $row["mtime"]); } else { if ($row["day"] == 0) { $report = new StatisticMonth($row["year"], $row["month"], 0, $row["aggregated"], $row["mtime"]); } else { $report = new StatisticDay($row["year"], $row["month"], $row["day"], $row["aggregated"], $row["mtime"]); } } $type = -1; $update = false; $value = ""; if ($report->Type == STATISTIC_PERIOD_TYPE_DAY) { if ($_POST[POST_INTERN_PROCESS_UPDATE_REPORT_TYPE] == 1) { if (Server::$Statistic->CurrentDay->CreateVisitorList) { if (empty($row["aggregated"]) && (!@file_exists($report->GetFilename(true, true)) || $row["time"] < time() - StatisticProvider::$AutoUpdateTime)) { $report->SaveVisitorListToFile(); } if (@file_exists($report->GetFilename(true, true))) { $value = IOStruct::GetFile($report->GetFilename(true, true)); } } $type = 1; } else { if ($_POST[POST_INTERN_PROCESS_UPDATE_REPORT_TYPE] == 0) { if (Server::$Statistic->CurrentDay->CreateReport) { if (empty($row["aggregated"]) && (!@file_exists($report->GetFilename(true, false)) || $row["time"] < time() - StatisticProvider::$AutoUpdateTime)) { $update = true; $report->SaveReportToFile(); } else { if (@file_exists($report->GetFilename(true, false))) { $value = IOStruct::GetFile($report->GetFilename(true, false)); } } } $type = 0; } } } else { if (empty($row["aggregated"]) && (!@file_exists($report->GetFilename(true, false)) || $row["time"] < time() - StatisticProvider::$AutoUpdateTime)) { $report->SaveReportToFile(); } if (@file_exists($report->GetFilename(true, false))) { $value = IOStruct::GetFile($report->GetFilename(true, false)); } $type = $report->Type == STATISTIC_PERIOD_TYPE_MONTH ? 2 : 3; } if ($type > -1) { $convrate = $row["sessions"] > 0 ? round(100 * $row["conversions"] / $row["sessions"], StatisticProvider::$RoundPrecision) : 0; $chats = $chatsd = 0; $qmonth = $report->Type == STATISTIC_PERIOD_TYPE_YEAR ? "" : " AND `month`='" . DBManager::RealEscape($row["month"]) . "'"; $qday = $report->Type != STATISTIC_PERIOD_TYPE_DAY ? "" : " AND `day`='" . DBManager::RealEscape($row["day"]) . "'"; if ($results = DBManager::Execute(true, "SELECT (SUM(`amount`)-SUM(`multi`)) AS `samount` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS_CHATS . "` WHERE `year`='" . DBManager::RealEscape($row["year"]) . "'" . $qmonth . $qday . "")) { if (DBManager::GetRowCount($results) == 1) { $rows = DBManager::FetchArray($results); if (is_numeric($rows["samount"])) { $chats = $rows["samount"]; } } } LocalizationManager::AutoLoad("", true); $value = Server::Replace($value, true, false, false, true); $xml .= "<r cid=\"" . base64_encode(getId(3)) . "\" ragg=\"" . base64_encode(empty($row["aggregated"]) ? 0 : 1) . "\" rtype=\"" . base64_encode($type) . "\" convrate=\"" . base64_encode($convrate) . "\" chats=\"" . base64_encode($chats) . "\" update=\"" . base64_encode($update ? 1 : 0) . "\" visitors=\"" . base64_encode($row["sessions"]) . "\" time=\"" . base64_encode($row["time"]) . "\" mtime=\"" . base64_encode($row["mtime"]) . "\" year=\"" . base64_encode($row["year"]) . "\" month=\"" . base64_encode($row["month"]) . "\" day=\"" . base64_encode($row["day"]) . "\">" . base64_encode($value) . "</r>\r\n"; } $xml .= "<ri maxtime=\"" . base64_encode($row["maxtime"]) . "\" maxmtime=\"" . base64_encode($row["maxmtime"]) . "\" />"; } } Server::$Response->SetStandardResponse(1, $xml); }
function Close() { Server::InitDataBlock(array("INTERNAL")); LocalizationManager::AutoLoad(strtolower(Server::$Configuration->File["gl_default_language"]), true); if ($this->Type == STATISTIC_PERIOD_TYPE_DAY) { $this->CleanDatabases(Server::$Configuration->File["gl_dvhd"] * 2); if ($this->CreateReport) { $this->SaveReportToFile(); } if ($this->CreateVisitorList) { $this->SaveVisitorListToFile(); } $this->CleanDatabases(Server::$Configuration->File["gl_dvhd"]); } else { if ($this->CreateReport) { $this->SaveReportToFile(); } } LocalizationManager::AutoLoad("", true); }
$html = str_replace("<!--voucher_id-->", Encoding::Base64UrlEncode($ticket->Id), $html); $html = str_replace("<!--server-->", LIVEZILLA_URL, $html); $ofc = !empty($_POST["form_ofc"]) ? "&ofc=MQ__" : ""; if (!empty($_POST["form_extends"]) && !empty($_POST["form_group"])) { $html = str_replace("<!--co-->", "&co=" . Encoding::Base64UrlEncode($_POST["form_extends"]) . "&intgroup=" . Encoding::Base64UrlEncode($_POST["form_group"]) . $ofc, $html); } else { if (!empty($_POST["form_group"])) { $html = str_replace("<!--co-->", "&intgroup=" . Encoding::Base64UrlEncode($_POST["form_group"]) . $ofc, $html); } else { $html = str_replace("<!--co-->", $ofc, $html); } } exit($html); } else { if (!empty($_GET["confirm"]) && $_GET["confirm"] == "1" && !empty($_GET["vc"]) && strlen(Encoding::Base64UrlDecode($_GET["vc"])) == 16) { require LIVEZILLA_PATH . "_lib/functions.pp.paypal.inc.php"; $voucher = new CommercialChatVoucher("", Encoding::Base64UrlDecode($_GET["vc"])); if ($voucher->Load()) { if (PayProvValidatePayment($voucher->Price)) { LocalizationManager::AutoLoad($voucher->Language); $voucher->SetPaymentDetails(PayProvGetPaymentId(), PayProvGetPayerId(), PayProvGetPaymentDetails()); if (empty($PAYMENTERROR)) { $voucher->SetVoucherParams(!empty($voucher->Voided), true, false, false, false, true, Encoding::Base64UrlDecode($_GET[GET_EXTERN_GROUP])); } else { $voucher->SetVoucherParams(!empty($voucher->Voided), false, false, false, false); } } } } } Server::UnloadDataProvider();