本文整理汇总了PHP中Server::InitDataBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::InitDataBlock方法的具体用法?PHP Server::InitDataBlock怎么用?PHP Server::InitDataBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server::InitDataBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDisabledFunctions
function getDisabledFunctions()
{
Server::InitDataBlock(array("INTERNAL", "GROUPS"));
$currentMIV = @ini_get("max_input_vars");
$currentMIVText = $currentMIV;
if (empty($currentMIV)) {
$currentMIV = 1000;
$currentMIVText = "unknown (default=1000)";
}
$message = null;
if (count(Server::$Operators) > 0 && ($miv = (count(Server::$Groups) + count(Server::$Operators)) * 75) > $currentMIV) {
$message .= "<span class=\"lz_index_error_cat\">PHP Configuration:<br></span> <span class=\"lz_index_red\">PHP configuration \"max_input_vars\" (see php.ini) must be increased to " . $miv . " (or greater).<br><br>Your current configuration is " . $currentMIVText . ".</span><br><br>";
}
if (!function_exists("file_get_contents") && ini_get('allow_url_fopen')) {
$message .= "<span class=\"lz_index_error_cat\">Disabled function: file_get_contents<br></span> <span class=\"lz_index_red\">LiveZilla requires the PHP function file_get_contents to be activated.</span><br><br>";
}
if (!function_exists("fsockopen")) {
$message .= "<span class=\"lz_index_error_cat\">Disabled function: fsockopen<br></span> <span class=\"lz_index_orange\">LiveZilla requires the PHP function fsockopen to be activated in order to send and receive emails.</span><br><br>";
}
if (!function_exists("iconv_mime_decode")) {
$message .= "<span class=\"lz_index_error_cat\">Missing PHP extension: ICONV<br></span> <span class=\"lz_index_orange\">LiveZilla requires the PHP extension iconv to parse incoming emails. Please add the iconv package to your PHP configuration.</span><br><br>";
}
if (!ini_get('allow_url_fopen')) {
$message .= "<span class=\"lz_index_error_cat\">Disabled wrapper: allow_url_fopen<br></span> <span class=\"lz_index_orange\">LiveZilla requires allow_url_fopen to be activated in order to send PUSH Messages to APPs and to send/receive Social Media updates.</span><br><br>";
}
return $message;
}
示例2: isChat
function isChat()
{
define("SESSION", getSessionId());
Server::InitDataBlock(array("FILTERS"));
define("IS_FLOOD", Filter::IsFlood(Communication::GetIP(), null, true));
define("IS_FILTERED", DataManager::$Filters->Match(Communication::GetIP(), LocalizationManager::ImplodeLanguages(!empty($_SERVER["HTTP_ACCEPT_LANGUAGE"]) ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : ""), SESSION));
$parameters = Communication::GetTargetParameters();
if (operatorsAvailable(0, $parameters["exclude"], $parameters["include_group"], $parameters["include_user"]) > 0) {
return true;
}
return false;
}
示例3: define
* 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 . "_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);
示例4: Close
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);
}
示例5: define
* 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 (Server::InitDataProvider()) {
Server::InitDataBlock(array("DBCONFIG", "INTERNAL"));
LocalizationManager::AutoLoad();
$fb_html = IOStruct::GetFile(PATH_TEMPLATES . "feedback.tpl");
$chat = VisitorChat::GetByChatId(intval(Communication::ReadParameter("cid", 0)));
$ticket = Ticket::GetById(intval(Communication::ReadParameter("tid", "")));
if ($ticket != null) {
$ticket->LoadMessages();
$ticket->LoadStatus();
}
if (Feedback::IsFlood()) {
$fb_html = str_replace("<!--title-->", "<br><br><br>" . str_replace("<!--count-->", MAX_FEEDBACKS_PER_DAY, LocalizationManager::$TranslationStrings["client_feedback_max"]) . "<script>parent.parent.lz_chat_feedback_result();</script>", $fb_html);
$fb_html = str_replace("<!--visible-->", "none", $fb_html);
} else {
if (!empty($_POST)) {
$userid = "";
$feedback = new Feedback(getId(32));
示例6: processCancelInvitation
function processCancelInvitation()
{
if (isset($_POST[POST_INTERN_PROCESS_CANCEL_INVITATION])) {
$users = explode(POST_ACTION_VALUE_SPLITTER, utf8_decode($_POST[POST_INTERN_PROCESS_CANCEL_INVITATION]));
foreach ($users as $uid) {
if (isset(Server::$Visitors[$uid])) {
Server::$Visitors[$uid]->ForceUpdate();
}
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_REQUESTS . "` SET `closed`=1,`canceled`='" . DBManager::RealEscape(CALLER_SYSTEM_ID) . "' WHERE `canceled`='' AND `accepted`=0 AND `declined`=0 AND `receiver_user_id`='" . DBManager::RealEscape($uid) . "';");
}
Server::$Visitors = null;
Server::InitDataBlock(array("VISITOR"));
}
}
示例7: define
* 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";
Server::DefineURL("checkout.php");
@set_error_handler("handleError");
Server::InitDataProvider();
Server::InitDataBlock(array("DBCONFIG"));
if (!empty($_POST["form_visitor_id"]) && !empty($_POST["form_total_price"]) && !empty($_POST["form_currency"]) && is_numeric($_POST["form_total_price"]) && strlen($_POST["form_currency"]) <= 3) {
LocalizationManager::AutoLoad();
$ticket = new CommercialChatVoucher($_POST["form_voucher_type"], strtoupper(getId(16)));
$ticket->VisitorId = $_POST["form_visitor_id"];
$ticket->Company = $_POST["form_company"];
$ticket->Email = $_POST["form_email"];
$ticket->Firstname = $_POST["form_firstname"];
$ticket->Lastname = $_POST["form_lastname"];
$ticket->Address1 = $_POST["form_address_1"];
$ticket->Address2 = $_POST["form_address_2"];
$ticket->ZIP = $_POST["form_zip"];
$ticket->State = $_POST["form_state"];
$ticket->Country = $_POST["form_country"];
$ticket->Phone = $_POST["form_phone"];
$ticket->City = $_POST["form_city"];
示例8: str_replace
$html = str_replace("<!--alert-->", getAlertTemplate(), $html);
$html = str_replace("<!--com_chats-->", getChatVoucherTemplate(), $html);
$html = str_replace("<!--ssl_secured-->", Communication::GetScheme() == SCHEME_HTTP_SECURE && !empty(Server::$Configuration->File["gl_sssl"]) ? "" : "display:none;", $html);
$html = str_replace("<!--bgc-->", $color = Communication::ReadParameter("epc", "#73be28"), $html);
$html = str_replace("<!--color-->", Colors::TransformHEX($color, 30), $html);
} else {
if ($_GET[GET_EXTERN_TEMPLATE] == "lz_chat_frame_chat") {
$html = IOStruct::GetFile(PATH_FRAMES . $_GET[GET_EXTERN_TEMPLATE] . ".tpl");
$html = str_replace("<!--alert-->", getAlertTemplate(), $html);
$tlanguages = "";
if (strlen(Server::$Configuration->File["gl_otrs"]) > 1) {
$mylang = LocalizationManager::GetBrowserLocalization();
$tlanguages = getLanguageSelects(LocalizationManager::GetBrowserLocalization());
}
$html = str_replace("<!--languages-->", $tlanguages, $html);
Server::InitDataBlock(array("GROUPS"));
$groupid = $_POST["intgroup"];
if (!empty($groupid) && isset(Server::$Groups[$groupid])) {
$html = str_replace("<!--SM_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[0]) ? "none" : "", $html);
$html = str_replace("<!--SO_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[1]) ? "none" : "", $html);
$html = str_replace("<!--PR_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[2]) ? "none" : "", $html);
$html = str_replace("<!--FV_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[4]) ? "none" : "", $html);
$html = str_replace("<!--FU_HIDDEN-->", empty(Server::$Groups[$groupid]->ChatFunctions[5]) || !empty($_GET[GET_EXTERN_DYNAMIC_GROUP]) ? "none" : "", $html);
$html = str_replace("<!--post_chat_js-->", base64_encode(Server::$Groups[$groupid]->PostJS), $html);
}
$html = str_replace("<!--TR_HIDDEN-->", strlen(Server::$Configuration->File["gl_otrs"]) > 1 ? "" : "none", $html);
$html = str_replace("<!--ET_HIDDEN-->", !empty(Server::$Configuration->File["gl_retr"]) && !empty(Server::$Configuration->File["gl_soct"]) ? "" : "none", $html);
}
}
}
$header = IOStruct::GetFile(PATH_TEMPLATES . "header.tpl");
示例9: TriggerEvents
static function TriggerEvents()
{
if (count(Server::$Events) == 0) {
return;
}
$actionData = "";
$url = VisitorMonitoring::$Browser->History[count(VisitorMonitoring::$Browser->History) - 1];
$previous = count(VisitorMonitoring::$Browser->History) > 1 ? VisitorMonitoring::$Browser->History[count(VisitorMonitoring::$Browser->History) - 2]->Url->GetAbsoluteUrl() : "";
foreach (Server::$Events->Events as $event) {
if (!$event->IsActive || empty($url)) {
continue;
}
$urlor = count($event->FunnelUrls) == 0 && $event->MatchesURLCriterias($url->Url->GetAbsoluteUrl(), $url->Referrer->GetAbsoluteUrl(), $previous, time() - $url->Entrance);
$urlfunnel = count($event->FunnelUrls) > 0 && $event->MatchesURLFunnelCriterias(VisitorMonitoring::$Browser->History);
$global = $event->MatchesGlobalCriterias(count(VisitorMonitoring::$Browser->History), VisitorMonitoring::$Visitor->ExitTime - VisitorMonitoring::$Visitor->FirstActive, VisitorMonitoring::$Visitor->HasAcceptedChatRequest, VisitorMonitoring::$Visitor->HasDeclinedChatRequest, VisitorMonitoring::$Visitor->WasInChat(), VisitorMonitoring::$Browser->Query, VisitorMonitoring::$IsMobile || VisitorMonitoring::$IsTablet, VisitorMonitoring::$Visitor->GeoCountryISO2);
if ($global && ($urlfunnel || $urlor)) {
foreach (array($event->Goals, $event->Actions) as $elements) {
foreach ($elements as $action) {
$EventTrigger = new EventTrigger(CALLER_USER_ID, CALLER_BROWSER_ID, $action->Id, time(), 1);
$EventTrigger->Load();
$aexists = $action->Exists(CALLER_USER_ID, CALLER_BROWSER_ID);
if (!$EventTrigger->Exists || $EventTrigger->Exists && $event->MatchesTriggerCriterias($EventTrigger)) {
if (!$aexists) {
if ($event->SaveInCookie) {
if (!Is::Null(Cookie::Get("ea_" . $action->Id))) {
continue;
} else {
Cookie::Set("ea_" . $action->Id, time());
}
}
$EventTrigger->Save($event->Id);
if ($action->Type < 2) {
foreach ($action->GetInternalReceivers() as $user_id) {
$intaction = new EventActionInternal($user_id, $EventTrigger->Id);
$intaction->Save();
}
} else {
if ($action->Type == 2 && !defined("EVENT_INVITATION")) {
$sender = getActionSender($action->Invitation->Senders, true);
Server::InitDataBlock(array("GROUPS"));
if (!empty($sender) && !empty(Server::$Groups[$sender->GroupId]) && Server::$Groups[$sender->GroupId]->IsHumanAvailable(false) && !(VisitorMonitoring::$Browser->ChatRequest != null && !VisitorMonitoring::$Browser->ChatRequest->Closed) && !VisitorMonitoring::$Visitor->IsInChat(false, null, true)) {
define("EVENT_INVITATION", true);
$chatrequest = new ChatRequest($sender->UserSystemId, $sender->GroupId, CALLER_USER_ID, CALLER_BROWSER_ID, getActionText($sender, $action));
$chatrequest->EventActionId = $action->Id;
$chatrequest->Save();
if (!$chatrequest->Displayed) {
VisitorMonitoring::$Browser->ForceUpdate();
}
VisitorMonitoring::$Browser->ChatRequest = $chatrequest;
}
} else {
if ($action->Type == 3 && !defined("EVENT_ALERT")) {
define("EVENT_ALERT", true);
$alert = new Alert(CALLER_USER_ID, CALLER_BROWSER_ID, $action->Value);
$alert->EventActionId = $action->Id;
$alert->Save();
VisitorMonitoring::$Browser->LoadAlerts();
} else {
if ($action->Type == 4 && !defined("EVENT_WEBSITE_PUSH")) {
define("EVENT_WEBSITE_PUSH", true);
$sender = getActionSender($action->WebsitePush->Senders, false);
$websitepush = new WebsitePush($sender->UserSystemId, $sender->GroupId, CALLER_USER_ID, CALLER_BROWSER_ID, getActionText($sender, $action), $action->WebsitePush->Ask, $action->WebsitePush->TargetURL);
$websitepush->EventActionId = $action->Id;
$websitepush->Save();
VisitorMonitoring::$Browser->LoadWebsitePush();
} else {
if ($action->Type == 5 && !defined("EVENT_OVERLAY_BOX")) {
define("EVENT_OVERLAY_BOX", true);
$overlaybox = new OverlayBox(CALLER_USER_ID, CALLER_BROWSER_ID, $action->Value);
$overlaybox->EventActionId = $action->Id;
$overlaybox->Save();
VisitorMonitoring::$Browser->LoadOverlayBoxes();
} else {
if ($action->Type == 9 && STATS_ACTIVE) {
Server::$Statistic->ProcessAction(ST_ACTION_GOAL, array(CALLER_USER_ID, $action->Id, VisitorMonitoring::$Visitor->Visits == 1 ? 1 : 0, VisitorMonitoring::$Browser->GetQueryId(Cookie::Get("sp"), null, 255, true)));
}
}
}
}
}
}
}
}
if ($EventTrigger->Exists && $aexists) {
$EventTrigger->Update();
}
}
}
}
}
return $actionData;
}
示例10: CommercialChatVoucherCreate
function CommercialChatVoucherCreate()
{
Server::InitDataBlock(array("DBCONFIG"));
$voucher = new CommercialChatVoucher("1", strtoupper(getId(16)));
$params = ApiV2::GetObjectFields("CommercialChatVoucher");
if ($voucher = $this->CreateFromJSON($params, json_decode($_POST["p_data"]), $voucher, "CommercialChatVoucher")) {
if (!isset(Server::$Configuration->Database["cct"][$voucher->TypeId])) {
$this->ErrorField = "TypeId";
} else {
if (empty($voucher->Id)) {
$voucher->Id = strtoupper(getId(16));
}
$voucher->ChatSessionsMax = Server::$Configuration->Database["cct"][$voucher->TypeId]->ChatSessionsMax;
$voucher->ChatTimeMax = Server::$Configuration->Database["cct"][$voucher->TypeId]->ChatTimeMax * 60;
if ($voucher->Save()) {
$voucher->SetVoucherParams($voucher->Voided, $voucher->Paid);
$this->JSONOutput = APIV2::Encode(ApiV2::ClearObject($params, $voucher), $this->JSONParams);
} else {
$this->ErrorField = "Id";
}
}
}
}
示例11: define
define("IN_API", true);
define("LIVEZILLA_PATH", "../../");
@set_time_limit(30);
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";
require LIVEZILLA_PATH . "_lib/objects.internal.inc.php";
@set_error_handler("handleError");
@error_reporting(E_ALL);
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Keep-Alive: timeout=5, max=100");
Server::DefineURL("api.php");
Server::InitDataProvider();
Server::InitDataBlock(array("INTERNAL", "INPUTS", "DBCONFIG"));
OperatorRequest::Validate(true);
if (OperatorRequest::IsValidated() && Is::Defined("CALLER_SYSTEM_ID")) {
if (Server::$Operators[CALLER_SYSTEM_ID]->GetPermission(46) != PERMISSION_NONE) {
require "objects.apiv2.inc.php";
$apiv2 = new ApiV2(isset($_POST["p_json_pretty"]));
if ($apiv2->RunActions() && empty($apiv2->ErrorField) && !empty($apiv2->JSONOutput)) {
exit($apiv2->JSONOutput);
} else {
APIErrorExit($apiv2->GetErrorCodes());
}
} else {
APIErrorExit("LZAV20002");
}
} else {
APIErrorExit("LZAV20001");
示例12: getOperators
function getOperators()
{
$array = array();
Server::InitDataBlock(array("INTERNAL", "GROUPS"));
foreach (Server::$Operators as $sysId => $internaluser) {
$internaluser->IsExternal(Server::$Groups);
$array[$sysId] = $internaluser;
}
return $array;
}
示例13: GetMatchingVoucher
static function GetMatchingVoucher($_groupId, $_voucherid)
{
Server::InitDataBlock(array("GROUPS", "DBCONFIG"));
$ticket = new CommercialChatVoucher("", $_voucherid);
$ticket->Load();
$result = DBManager::Execute(true, $d = "SELECT *,`t1`.`id` AS `voucherid`, SUM(`chat_time_max`) AS `chat_time_max`, SUM(`chat_time`) AS `chat_time`, SUM(`chat_sessions`) AS `chat_sessions`, SUM(`chat_sessions_max`) AS `chat_sessions_max`, MAX(`expires`) AS `expires` FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_VOUCHERS . "` AS `t1` INNER JOIN `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` AS `t2` ON `t1`.`tid`=`t2`.`id` WHERE `t1`.`id`='" . DBManager::RealEscape($_voucherid) . "' ORDER BY `created` ASC;");
while ($row = @DBManager::FetchArray($result)) {
if (!empty(Server::$Configuration->Database["cct"][$row["tid"]])) {
$ticket = new CommercialChatVoucher($row);
if (in_array($row["tid"], Server::$Groups[$_groupId]->ChatVouchersRequired)) {
return $ticket;
}
}
}
return null;
}
示例14: define
if (!defined("LIVEZILLA_PATH")) {
define("LIVEZILLA_PATH", "./");
}
@ini_set('session.use_cookies', '0');
@error_reporting(E_ALL);
require_once LIVEZILLA_PATH . "_lib/functions.external.inc.php";
require_once LIVEZILLA_PATH . "_lib/objects.external.inc.php";
@set_time_limit(Server::$Configuration->File["timeout_chats"]);
if (!isset($_GET["file"])) {
@set_error_handler("handleError");
}
if (!isset($_GET[GET_TRACK_BROWSERID])) {
exit;
}
LocalizationManager::AutoLoad();
Server::InitDataBlock(array("INTERNAL", "GROUPS", "FILTERS", "INPUTS"));
$OVERLAY = new OverlayChat();
$USER = VisitorMonitoring::$Visitor;
$USER->Browsers[0] = new VisitorChat($USER->UserId, $USER->UserId . "_OVL");
$USER->Browsers[1] = VisitorMonitoring::$Browser;
$OVERLAY->GroupBuilder = new GroupBuilder($USER->Browsers[0]->DesiredChatGroup, $USER->Browsers[0]->DesiredChatPartner, false);
$OVERLAY->GroupBuilder->Generate(null, true);
$USER->Browsers[0]->Overlay = true;
$USER->Browsers[0]->Load();
$USER->Browsers[0]->LoadUserData();
if ($USER->Browsers[0]->FirstCall) {
$USER->AddFunctionCall("lz_chat_init_data_change(null);", false);
}
$OVERLAY->KnowledgebaseSearch();
if (IS_FILTERED && !FILTER_ALLOW_CHATS) {
$USER->Browsers[0]->CloseChat();
示例15: demandTickets
function demandTickets($xml = "", $q_filter = "", $q_searchw = "", $q_searchf = "", $c_total = 0, $c_totalread = 0, $c_totalquery = 0, $c_lmc = 0, $c_name = "", $c_text = "", $loads = 0)
{
$permission = Server::$Operators[CALLER_SYSTEM_ID]->GetPermission(PERMISSION_TICKETS);
if ($permission != PERMISSION_NONE) {
if (!CacheManager::IsDataUpdate(POST_INTERN_DUT_TICKETS, DATA_UPDATE_KEY_TICKETS) && CacheManager::$DataUpdateTimes[DATA_UPDATE_KEY_TICKETS] != 0) {
return;
}
if (!isset($_POST["p_dt_c_id"])) {
$_POST["p_dt_c_id"] = $_POST["p_dt_u_id"] = "";
}
if (!empty($_POST["p_dt_q"])) {
unset($_POST["p_dt_f"], $_POST["p_dt_fc"], $_POST["p_dt_fp"], $_POST["p_dt_fg"]);
}
if (!isset($_POST["p_dt_f"])) {
$_POST["p_dt_f"] = "0123";
} else {
if ($_POST["p_dt_f"] == "") {
$_POST["p_dt_f"] = "9";
}
}
if (!isset($_POST["p_dt_fc"])) {
$_POST["p_dt_fc"] = "01234567";
} else {
if ($_POST["p_dt_fc"] == "") {
$_POST["p_dt_fc"] = "9";
}
}
$loads = !empty($_POST["p_dt_l"]) && is_numeric($_POST["p_dt_l"]) ? $_POST["p_dt_l"] : DATA_DEMAND_LOADS;
$limit = !empty($_POST["p_dt_p"]) && is_numeric($_POST["p_dt_p"]) && $_POST["p_dt_p"] > 1 ? ($_POST["p_dt_p"] - 1) * $loads : 0;
$q_sort = array();
$q_sort["id"] = " AND `deleted`=0 GROUP BY `" . DB_PREFIX . DATABASE_TICKETS . "`.`id` ORDER BY `" . DB_PREFIX . DATABASE_TICKETS . "`.`id` " . (!empty($_POST["p_dt_s_d"]) ? $_POST["p_dt_s_d"] : "DESC");
$q_sort["update"] = " AND `deleted`=0 GROUP BY `" . DB_PREFIX . DATABASE_TICKETS . "`.`id` ORDER BY `" . DB_PREFIX . DATABASE_TICKETS . "`.`last_update` " . (!empty($_POST["p_dt_s_d"]) ? $_POST["p_dt_s_d"] : "DESC");
$q_sort["wait"] = " AND `deleted`=0 GROUP BY `" . DB_PREFIX . DATABASE_TICKETS . "`.`id` ORDER BY `" . DB_PREFIX . DATABASE_TICKETS . "`.`wait_begin` " . (!empty($_POST["p_dt_s_d"]) ? $_POST["p_dt_s_d"] : "ASC");
$sort_index = !empty($_POST["p_dt_s"]) && !empty($q_sort[$_POST["p_dt_s"]]) ? $_POST["p_dt_s"] : "id";
if (!(!empty($_POST["p_dt_mr"]) && is_numeric($_POST["p_dt_mr"]))) {
$max_last_update_read = time() - 14 * 86400;
} else {
$max_last_update_read = $_POST["p_dt_mr"];
}
$fchars = str_split($_POST["p_dt_f"]);
foreach ($fchars as $fchar) {
if (is_numeric($fchar)) {
if (!empty($fchar)) {
$q_filter .= empty($q_filter) ? " `te`.`status`=" . $fchar : " OR `te`.`status`=" . $fchar;
} else {
$q_filter .= empty($q_filter) ? " `te`.`status` IS NULL OR `te`.`status`=0" : " OR `te`.`status` IS NULL OR `te`.`status`=0";
}
}
}
$fchars = str_split($_POST["p_dt_fc"]);
$q_filter_channel = "";
foreach ($fchars as $fchar) {
if (is_numeric($fchar)) {
if (!empty($fchar)) {
$q_filter_channel .= empty($q_filter_channel) ? "`creation_type`=" . $fchar : " OR `creation_type`=" . $fchar;
} else {
$q_filter_channel .= empty($q_filter_channel) ? "`creation_type` IS NULL OR `creation_type`=0" : " OR `creation_type` IS NULL OR `creation_type`=0";
}
}
}
$q_filter = empty($q_filter) ? $q_filter_channel : "(" . $q_filter . ") AND ( " . $q_filter_channel . ")";
if (!empty($_POST["p_dt_fp"])) {
if (empty($q_filter)) {
$q_filter .= "`te`.`editor_id`='" . DBManager::RealEscape(CALLER_SYSTEM_ID) . "'";
} else {
$q_filter = "(" . $q_filter . ") AND `te`.`editor_id`='" . DBManager::RealEscape(CALLER_SYSTEM_ID) . "'";
}
}
if (!empty($_POST["p_dt_fg"]) && $permission == PERMISSION_FULL) {
if (empty($q_filter)) {
$q_filter .= "`target_group_id` IN ('" . implode("','", Server::$Operators[CALLER_SYSTEM_ID]->Groups) . "')";
} else {
$q_filter = "(" . $q_filter . ") AND `target_group_id` IN ('" . implode("','", Server::$Operators[CALLER_SYSTEM_ID]->Groups) . "')";
}
}
if (!empty($_POST["p_dt_q"])) {
$q = DBManager::RealEscape(strtolower($_POST["p_dt_q"]), true);
$q_searchf = " LEFT JOIN `" . DB_PREFIX . DATABASE_TICKET_CUSTOMS . "` AS `tc` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`tc`.`ticket_id`";
$q_searchf .= " LEFT JOIN `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` AS `tm` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`tm`.`ticket_id` ";
$q_searchf .= " LEFT JOIN `" . DB_PREFIX . DATABASE_OPERATORS . "` AS `do` ON `te`.`editor_id`=`do`.`system_id` ";
$q_searchw = "LOWER(`" . DB_PREFIX . DATABASE_TICKETS . "`.`hash`) LIKE '%" . $q . "%' OR LOWER(`do`.`fullname`) LIKE '%" . $q . "%' OR `tm`.`sender_id` LIKE '%" . $q . "%' OR `tm`.`ticket_id` LIKE '%" . $q . "%' OR LOWER(`tc`.`value`) LIKE '%" . $q . "%' OR LOWER(`tm`.`text`) LIKE '%" . $q . "%' OR LOWER(`tm`.`fullname`) LIKE '%" . $q . "%' OR LOWER(`tm`.`email`) LIKE '%" . $q . "%' OR LOWER(`tm`.`company`) LIKE '%" . $q . "%' OR LOWER(`tm`.`phone`) LIKE '%" . $q . "%' OR LOWER(`tm`.`subject`) LIKE '%" . $q . "%'";
if (!empty($_POST["p_dt_q_e"])) {
$q_e = DBManager::RealEscape(strtolower($_POST["p_dt_q_e"]));
$emails = explode(",", $q_e);
foreach ($emails as $email) {
$q_searchw .= " OR LOWER(`tm`.`email`) LIKE '%" . DBManager::RealEscape(trim($email), true) . "%'";
}
}
$q_searchw = " AND (" . $q_searchw . ")";
}
Server::InitDataBlock(array("INPUTS"));
$q_grperm = $permission == PERMISSION_FULL ? "" : "`target_group_id` IN ('" . implode("','", Server::$Operators[CALLER_SYSTEM_ID]->Groups) . "') AND ";
$q_inner = "FROM `" . DB_PREFIX . DATABASE_TICKETS . "` LEFT JOIN `" . DB_PREFIX . DATABASE_TICKET_EDITORS . "` AS `te` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`te`.`ticket_id` " . $q_searchf . "WHERE " . $q_grperm . "`deleted`=0 AND (" . $q_filter . ")" . $q_searchw . $q_sort[$sort_index];
$result = DBManager::Execute(true, $d = "SELECT * " . $q_inner . " LIMIT " . $limit . "," . DBManager::RealEscape($loads) . ";");
if ($result) {
while ($row = DBManager::FetchArray($result)) {
$ticket = new Ticket($row, null, null);
$ticket->LoadLogs();
if (count($ticket->Messages) > 0) {
$xml .= $ticket->GetXML(true, true);
//.........这里部分代码省略.........