本文整理汇总了PHP中DBManager::RealEscape方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::RealEscape方法的具体用法?PHP DBManager::RealEscape怎么用?PHP DBManager::RealEscape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::RealEscape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
//.........这里部分代码省略.........
示例2: GetForwards
function GetForwards()
{
$list = array();
$result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "` WHERE `target_group_id`='" . DBManager::RealEscape($this->DesiredChatGroup) . "' AND `visitor_id`='" . DBManager::RealEscape($this->UserId) . "' AND `browser_id`='" . DBManager::RealEscape($this->BrowserId) . "' ORDER BY `created` ASC;");
while ($row = DBManager::FetchArray($result)) {
$list[] = new Forward($row);
}
return $list;
}
示例3: processChatActions
function processChatActions()
{
global $INTERNAL, $RVISITOR;
$count = 0;
while (isset($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"])) {
$type = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vd"];
if ($type == "OperatorSignOff") {
$op = $INTERNAL[$_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]];
$op->SignOff();
} else {
if ($type == "SendChatTranscriptTo") {
$value = 1;
while (!empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_" . $value])) {
queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` SET `transcript_sent`=0,`transcript_receiver`='" . DBManager::RealEscape($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]) . "' WHERE `transcript_sent`=1 AND `chat_id`='" . DBManager::RealEscape($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_" . $value]) . "' LIMIT 1;");
$value++;
}
sendChatTranscripts(true);
} else {
if ($type == "CreatePublicGroup") {
$room = new UserGroup();
$room->IsDynamic = true;
$room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"];
$room->Descriptions["EN"] = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"];
$room->Owner = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"];
$room->Save();
$room->AddMember($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"], !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_3"]));
} else {
if ($type == "DeletePublicGroup") {
$room = new UserGroup();
$room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"];
$room->Destroy();
} else {
if ($type == "JoinPublicGroup") {
$room = new UserGroup();
$room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"];
$room->AddMember($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"], !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_3"]));
} else {
if ($type == "QuitPublicGroup") {
$room = new UserGroup();
$room->Id = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"];
$room->RemoveMember($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]);
} else {
if ($type == "StartOverlayChat") {
$chat = new VisitorChat($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]);
$chat->RequestInitChat(CALLER_SYSTEM_ID);
} else {
if ($type == "AddVisitorComment") {
$visitor = new Visitor($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
$visitor->SaveComment(CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]);
} else {
if ($type == "DownloadRecentHistory") {
$RVISITOR = new Visitor($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
$RVISITOR->LoadRecentVisits(true, $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]);
} else {
if ($type == "SetTranslation") {
$chat = new VisitorChat($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]);
$chat->ChatId = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"];
$chat->SetTranslation($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]);
} else {
if ($type == "SetChatTicketParam") {
$ticket = new CommercialChatVoucher("", $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
$ticket->Load();
$ticket->SetVoucherParams(!empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_1"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_2"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_3"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_4"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_5"]), !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_6"]));
} else {
if (strlen($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]) > 0 && strlen($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"]) > 0) {
$chat = new VisitorChat($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_va"], $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vb"]);
$chat->ChatId = $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_vc"];
$chat->Load();
if ($type == "SetCallMeBackStatus") {
$chat->SetCallMeBackStatus($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
} else {
if ($type == "JoinChatInvisible") {
$chat->JoinChat(CALLER_SYSTEM_ID, true, !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]));
} else {
if ($type == "JoinChat") {
$chat->JoinChat(CALLER_SYSTEM_ID, false, !empty($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]));
} else {
if ($type == "SetPriority") {
$chat->SetPriority($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
} else {
if ($type == "SetTargetOperator") {
$chat->SetTargetOperator($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
} else {
if ($type == "SetTargetGroup") {
$chat->SetTargetGroup($_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
} else {
if ($type == "AcceptChat") {
$chat->InternalActivate();
} else {
if ($type == "CloseChat") {
$chat->InternalClose(CALLER_SYSTEM_ID);
} else {
if ($type == "TakeChat") {
$chat->TakeChat(CALLER_SYSTEM_ID, $_POST[POST_INTERN_PROCESS_CHAT_ACTION . "_" . $count . "_ve_0"]);
} else {
if ($type == "DeclineChat") {
$chat->InternalDecline(CALLER_SYSTEM_ID);
} else {
if ($type == "LeaveChat") {
$chat->LeaveChat(CALLER_SYSTEM_ID);
//.........这里部分代码省略.........
示例4: header
}
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/functions.external.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::InitDataProvider();
if (!empty($_GET["value"]) && strlen($_GET["value"]) == 16) {
$ticket = VisitorChat::GetMatchingVoucher($_GET[GET_EXTERN_GROUP], $_GET["value"]);
if (!empty($ticket) && !$ticket->CheckForVoid() && $ticket->Paid) {
$ticket->UpdateVoucherChatTime(0, empty($ticket->FirstUsed));
$sessions = $ticket->ChatSessionsMax < 0 ? 0 : $ticket->ChatSessionsMax;
if ($result = DBManager::Execute(true, "SELECT `exit` FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_ticket_id`='" . DBManager::RealEscape($ticket->Id) . "' AND `exit`=0 LIMIT 1;")) {
if ($row = DBManager::FetchArray($result)) {
exit("lz_validate_com_chat_input_result(false,true,1,'',0,0,0,false,false,false);");
}
}
exit("lz_validate_com_chat_input_result(true,false,1,'" . $ticket->Id . "'," . $ticket->ChatTime . "," . $ticket->ChatTimeMax . "," . $ticket->ChatSessions . "," . $ticket->ChatSessionsMax . "," . $ticket->VoucherAutoExpire . "," . To::BoolString($ticket->VoucherAutoExpire < time()) . ");");
} else {
if (!empty($ticket)) {
exit("lz_validate_com_chat_input_result(false,false,1,'',0,0,0,false,false,false);");
}
}
}
exit("lz_validate_com_chat_input_result(false,false,0,'',0,0,0,false,false,false);");
Server::UnloadDataProvider();
示例5: GetMatchingVoucher
public static function GetMatchingVoucher($_groupId, $_voucherid)
{
global $CONFIG, $GROUPS;
initData(array("GROUPS"));
$ticket = new CommercialChatVoucher("", $_voucherid);
$ticket->Load();
$result = queryDB(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($CONFIG["db"]["cct"][$row["tid"]])) {
$ticket = new CommercialChatVoucher($row);
if (in_array($row["tid"], $GROUPS[$_groupId]->ChatVouchersRequired)) {
return $ticket;
}
}
}
return null;
}
示例6: Listen
function Listen()
{
global $USER;
$isOp = false;
if ($USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE) {
$result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHAT_OPERATORS . "` WHERE `chat_id`='" . DBManager::RealEscape($USER->Browsers[0]->ChatId) . "' ORDER BY `status` DESC, `dtime` DESC;");
while ($row = DBManager::FetchArray($result)) {
if (isset(Server::$Operators[$row["user_id"]])) {
$ChatMember = new ChatMember($row["user_id"], $row["status"], !empty($row["declined"]), $row["jtime"], $row["ltime"]);
if ($ChatMember->Status == 1 && $ChatMember->Joined >= $USER->Browsers[0]->LastActive) {
$isOp = true;
$this->AddHTML(str_replace("<!--message-->", str_replace("<!--intern_name-->", Server::$Operators[$ChatMember->SystemId]->Fullname, LocalizationManager::$TranslationStrings["client_intern_arrives"]), IOStruct::GetFile(TEMPLATE_HTML_MESSAGE_OVERLAY_CHAT_STATUS)), "sys", "LMMJ" . $ChatMember->SystemId);
} else {
if (($ChatMember->Status == 9 || $ChatMember->Status == 2) && $ChatMember->Left >= $USER->Browsers[0]->LastActive && $ChatMember->Joined > 0) {
$this->AddHTML($this->GetLeaveChatHTML(false, Server::$Operators[$ChatMember->SystemId]->Fullname), "sys", "LCM01" . $ChatMember->SystemId);
}
}
if ($ChatMember->Status == 0) {
$isOp = true;
}
}
}
} else {
$isOp = true;
}
if (Communication::ReadParameter("ovlif")) {
$this->InitFeedback();
}
$USER->Browsers[0]->Typing = isset($_GET["typ"]);
if (!$USER->Browsers[0]->Declined) {
$USER->Browsers[0]->Save();
}
$USER->Browsers[0]->ValidateOperator();
$this->CurrentOperatorId = Communication::GetParameter("op", "", $c, FILTER_SANITIZE_SPECIAL_CHARS, null, 32);
if ($USER->Browsers[0]->Waiting && $this->Botmode || empty($USER->Browsers[0]->OperatorId) && !empty($this->CurrentOperatorId) && isset(Server::$Operators[$this->CurrentOperatorId]) && !Server::$Operators[$this->CurrentOperatorId]->IsBot || !empty($this->CurrentOperatorId) && empty($USER->Browsers[0]->ChatId) && !$this->Botmode || !$isOp || $USER->Browsers[0]->Closed) {
if (!$USER->Browsers[0]->ExternalClosed) {
$USER->Browsers[0]->ExternalClose();
$USER->Browsers[0]->Save();
$USER->Browsers[0]->Load();
}
$USER->Browsers[0]->Members = array();
if (!empty($this->CurrentOperatorId) && !empty(Server::$Operators[$this->CurrentOperatorId]) && $isOp) {
$this->AddHTML($this->GetLeaveChatHTML(true, Server::$Operators[$this->CurrentOperatorId]->Fullname), "sys", "LCM01" . $this->CurrentOperatorId);
if (!empty(Server::$Configuration->File["gl_fboe"]) && Communication::ReadParameter("po", 0) == 0 && !Server::$Operators[$this->CurrentOperatorId]->IsBot) {
if (!empty(Server::$Groups[$USER->Browsers[0]->DesiredChatGroup]->ChatFunctions[3])) {
$this->InitFeedback(false);
}
}
$this->Flags["LMR"] = "null";
$USER->Browsers[0]->OperatorId = null;
$this->CurrentOperatorId = "";
$this->RepollRequired = true;
}
}
}
示例7: UpdateConfiguration
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, "");
}
示例8: getChatVoucherTemplate
function getChatVoucherTemplate($html = "")
{
global $CONFIG, $COUNTRIES, $LZLANG;
if (!is("DB_CONNECTION") || !empty($CONFIG["db"]["ccpp"]["Custom"])) {
return "";
}
if (!empty($CONFIG["gl_ccac"])) {
foreach ($CONFIG["db"]["cct"] as $type) {
$html .= $type->GetTemplate();
}
}
$cchtml = getFile(PATH_TEMPLATES . "chat_voucher_checkout.tpl");
$mycountry = "";
$replacements = array("<!--lp_company-->" => "", "<!--lp_firstname-->" => "", "<!--lp_email-->" => "", "<!--lp_lastname-->" => "", "<!--lp_taxid-->" => "", "<!--lp_business_type-->" => "", "<!--lp_address_1-->" => "", "<!--lp_address_2-->" => "", "<!--lp_city-->" => "", "<!--lp_state-->" => "", "<!--lp_country-->" => "", "<!--lp_phone-->" => "", "<!--lp_zip-->" => "");
$prefillco = !empty($_GET["co"]) ? " OR id='" . DBManager::RealEscape(base64URLDecode($_GET["co"])) . "'" : "";
if (!isnull(getCookieValue("userid")) || !empty($prefillco)) {
$result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_VOUCHERS . "` WHERE `visitor_id`='" . DBManager::RealEscape(getCookieValue("userid")) . "'" . $prefillco . " ORDER BY `created` DESC LIMIT 1;");
if ($result) {
if ($row = DBManager::FetchArray($result)) {
$replacements = array("<!--lp_company-->" => $row["company"], "<!--lp_firstname-->" => $row["firstname"], "<!--lp_lastname-->" => $row["lastname"], "<!--lp_taxid-->" => $row["tax_id"], "<!--lp_email-->" => $row["email"], "<!--lp_business_type-->" => $row["business_type"], "<!--lp_address_1-->" => $row["address_1"], "<!--lp_address_2-->" => $row["address_2"], "<!--lp_city-->" => $row["city"], "<!--lp_state-->" => $row["state"], "<!--lp_country-->" => $row["country"], "<!--lp_phone-->" => $row["phone"], "<!--lp_zip-->" => $row["zip"]);
$mycountry = $row["country"];
}
}
}
$clist = $COUNTRIES;
asort($clist);
$countrieshtml = "";
foreach ($clist as $isokey => $value) {
if (!empty($isokey)) {
$countrieshtml .= $isokey == $mycountry ? "<option value=\"" . $isokey . "\" SELECTED>" . utf8_encode($value) . "</option>" : "<option value=\"" . $isokey . "\">" . utf8_encode($value) . "</option>";
}
}
$cchtml = str_replace("<!--countries-->", $countrieshtml, $cchtml);
foreach ($replacements as $key => $value) {
$cchtml = str_replace($key, $value, $cchtml);
}
$cchtml = str_replace("<!--show_VAT-->", !empty($CONFIG["gl_ccsv"]) ? "''" : "none", $cchtml);
$cchtml = str_replace("<!--voucher_form-->", $html, $cchtml);
if (!empty($CONFIG["db"]["ccpp"]["PayPal"]->LogoURL)) {
$cchtml = str_replace("<!--pp_logo_url-->", " src=\"" . $CONFIG["db"]["ccpp"]["PayPal"]->LogoURL . "\"", $cchtml);
} else {
$cchtml = str_replace("<!--pp_logo_url-->", "", $cchtml);
}
$cchtml = str_replace("<!--extends_voucher-->", !empty($_GET["co"]) && strlen(base64UrlDecode($_GET["co"])) == 16 ? base64UrlDecode($_GET["co"]) : "", $cchtml);
$cchtml = str_replace("<!--ofc-->", !empty($_GET["ofc"]) ? "MQ__" : "", $cchtml);
$cchtml = str_replace("<!--VAT-->", str_replace("<!--VAT-->", $CONFIG["gl_ccva"], $LZLANG["client_voucher_include_vat"]), $cchtml);
return $cchtml;
}
示例9: InitConnection
function InitConnection()
{
if (DBManager::$Extension == "mysql") {
DBManager::$Provider = @mysql_connect($this->Host, $this->Username, $this->Password);
} else {
if (DBManager::$Extension == "mysqli") {
DBManager::$Provider = @mysqli_connect($this->Host, $this->Username, $this->Password);
}
}
if (DBManager::$Provider && !empty($this->Database)) {
$this->Query(false, "SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
if ($this->SelectDatabase(DBManager::RealEscape($this->Database))) {
DBManager::$Connected = true;
}
}
return DBManager::$Connected;
}
示例10: testDataBase
function testDataBase($_host, $_user, $_pass, $_dbname, $_prefix, $_extension = "", $_intense = false)
{
global $DB_CONNECTOR;
$connection = new DBManager($_user, $_pass, $_host, "", $_prefix);
if (!empty($_extension)) {
DBManager::$Extension = $_extension;
}
if (DBManager::$Extension == "mysql" && !function_exists("mysql_connect")) {
return "PHP MySQL extension is missing (php_mysql.dll)";
} else {
if (DBManager::$Extension == "mysqli" && !function_exists("mysqli_connect")) {
return "PHP/MySQLi extension is missing (php_mysqli.dll)";
}
}
$connection->InitConnection();
$connection->Query(false, "SET NAMES 'utf8'");
if (!DBManager::$Provider) {
$error = DBManager::GetError();
return "Can't connect to database. Invalid host or login! (" . DBManager::GetErrorCode() . (!empty($error) ? ": " . $error : "") . ")";
} else {
$db_selected = $connection->SelectDatabase(DBManager::RealEscape($_dbname));
if (!$db_selected) {
return DBManager::GetErrorCode() . ": " . DBManager::GetError();
} else {
$resultv = $connection->Query(false, "SELECT VERSION() as `mysql_version`");
if (!$resultv) {
return DBManager::GetErrorCode() . ": " . DBManager::GetError();
} else {
$mrow = @DBManager::FetchArray($resultv);
$mversion = explode(".", $mrow["mysql_version"]);
if (count($mversion) > 0 && $mversion[0] < MYSQL_NEEDED_MAJOR) {
return "LiveZilla requires MySQL version " . MYSQL_NEEDED_MAJOR . " or greater. The MySQL version installed on your server is " . $mrow["mysql_version"] . ".";
}
}
$result = $connection->Query(false, "SELECT `version`,`chat_id`,`ticket_id` FROM `" . DBManager::RealEscape($_prefix) . DATABASE_INFO . "` ORDER BY `version` DESC LIMIT 1");
$row = @DBManager::FetchArray($result);
$version = $row["version"];
if (!$result || empty($version)) {
return "Cannot read the LiveZilla Database version. Please try to recreate the table structure. If you experience this message during installation process, please try to setup a prefix (for example lz_).";
}
if ($version != VERSION && defined("SERVERSETUP") && SERVERSETUP) {
$upres = initUpdateDatabase($version, $connection, $_prefix);
if ($upres !== true) {
return "Cannot update database structure from [" . $version . "] to [" . VERSION . "]. Please make sure that the user " . $_user . " has the MySQL permission to ALTER tables in " . $_dbname . ".\r\n\r\nError: " . $upres;
}
} else {
if ($version != VERSION && empty($_GET["iv"])) {
return "Invalid database version: " . $version . " (required: " . VERSION . "). Please validate the database in the server administration panel first.\r\n\r\n";
}
}
$DB_CONNECTOR = $connection;
$result = $connection->Query(false, "SELECT * FROM `" . DBManager::RealEscape($_prefix) . DATABASE_OPERATORS . "`");
if (DBManager::GetRowCount($result) == 0) {
setManagement($_prefix, false, true);
}
if ($_intense && empty($_GET["iv"])) {
foreach (get_defined_constants() as $constant => $val) {
if (substr($constant, 0, 9) == "DATABASE_") {
if (!$connection->Query(false, "SELECT * FROM `" . DBManager::RealEscape($_prefix) . $val . "` LIMIT 1;")) {
$code = DBManager::GetErrorCode();
$error = DBManager::GetError();
if ($code == 144 || $code == 145 || $code == 1194) {
$connection->Query(true, "REPAIR TABLE `" . DBManager::RealEscape($_prefix) . $val . "`;");
$error .= " - (trying to repair ...)";
}
return $code . ": " . $error;
}
}
}
}
return null;
}
}
}
示例11: KnowledgebaseEntriesList
function KnowledgebaseEntriesList()
{
$sql_limit = "";
if (!empty($_POST["p_limit"])) {
if (is_int($_POST["p_limit"])) {
$sql_limit = " LIMIT " . intval($_POST["p_limit"]);
} else {
$this->ErrorFilter = "Limit";
return;
}
if (!empty($_POST["p_offset"])) {
if (is_int($_POST["p_offset"])) {
$sql_limit .= " OFFSET " . intval($_POST["p_offset"]);
} else {
$this->ErrorFilter = "Offset";
exit("dsf");
return;
}
}
}
$sql_where = "WHERE `discarded`=0 AND `parentid`<>100";
if (!empty($_POST["p_id"])) {
$sql_where .= " AND `id`='" . DBManager::RealEscape($_POST["p_id"]) . "'";
}
if (empty($_POST["p_show_private"])) {
$sql_where .= " AND `kb_public`=1";
}
$results = array("KnowledgeBaseEntries" => array());
$result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_RESOURCES . "` " . $sql_where . " ORDER BY `title` ASC " . $sql_limit . ";");
while ($row = DBManager::FetchArray($result)) {
$kbe = new KnowledgeBaseEntry($row);
$results["KnowledgeBaseEntries"][] = array("KnowledgeBaseEntry" => ApiV2::ClearObject(ApiV2::GetObjectFields("KnowledgeBaseEntry"), $kbe));
}
$this->JSONOutput = APIV2::Encode($results, $this->JSONParams);
}
示例12: base64_encode
$USER->Browsers[1]->ChatRequest->SetStatus(true, true, false, true);
$USER->Browsers[1]->ForceUpdate();
}
}
}
$tymes = !empty($USER->Browsers[0]->InternalUser) && $USER->Browsers[0]->InternalUser->Typing == $USER->Browsers[0]->SystemId ? "'" . base64_encode(str_replace("<!--operator_name-->", $USER->Browsers[0]->InternalUser->Fullname, $LZLANG["client_representative_is_typing"])) . "'" : "null";
$USER->AddFunctionCall("lz_chat_set_typing(" . $tymes . ",false);", false);
$maxposts = 30;
$spkthtml = speakingToHTML();
$posthtml = "";
$pstrchngreq = $psound = $spkt = false;
$oppostcount = 0;
$LASTPOST = "";
$lppflag = $LASTPOSTER;
$rand = rand();
if (!$USER->Browsers[0]->Declined && ($result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_POSTS . "` WHERE `chat_id`='" . DBManager::RealEscape($USER->Browsers[0]->ChatId) . "' AND `chat_id`!='' AND `chat_id`!='0' AND (`receiver`='" . DBManager::RealEscape($USER->Browsers[0]->SystemId) . "' OR (`sender`='" . DBManager::RealEscape($USER->Browsers[0]->SystemId) . "' AND `repost`=0)) GROUP BY `id` ORDER BY `time` ASC, `micro` ASC;"))) {
$all = DBManager::GetRowCount($result);
$toshow = min($maxposts, $all);
if ($all > 0) {
$count = $maxposts - $all;
while ($row = DBManager::FetchArray($result)) {
if ($count++ >= 0) {
$postobj = new Post($row);
if (empty($INTERNAL[$postobj->Sender])) {
$postobj->Text = htmlentities($postobj->Text, ENT_QUOTES, 'UTF-8');
$postobj->Translation = htmlentities($postobj->Translation, ENT_QUOTES, 'UTF-8');
}
if ($USER->Browsers[0]->AllocatedTime > 0 && $USER->Browsers[0]->AllocatedTime && !$spkt) {
$lppflag = "sys";
$posthtml .= $spkthtml;
$spkt = true;
示例13: TicketsList
function TicketsList()
{
$sql_limit = "";
if (!empty($_POST["p_limit"])) {
if (is_numeric($_POST["p_limit"])) {
$sql_limit = " LIMIT " . $_POST["p_limit"];
} else {
$this->ErrorFilter = "Limit";
return;
}
}
$sql_where = "WHERE `t1`.`id`>0 ";
if (!empty($_POST["p_id"])) {
$sql_where .= " AND `t1`.`id`='" . DBManager::RealEscape($_POST["p_id"]) . "'";
} else {
if (!empty($_POST["p_group"])) {
$sql_where .= " AND `group_id`='" . DBManager::RealEscape($_POST["p_group"]) . "'";
}
if (!empty($_POST["p_operator"])) {
$opsid = Operator::GetSystemId($_POST["p_operator"]);
if ($opsid != null) {
$sql_where .= " AND `internal_id`='" . DBManager::RealEscape($opsid) . "'";
} else {
$this->ErrorFilter = "Operator";
return;
}
}
if (!empty($_POST["p_created_after"])) {
if (is_numeric($_POST["p_created_after"]) && !empty($_POST["p_created_after"])) {
$sql_where .= " AND `time` > " . $_POST["p_created_after"];
} else {
$this->ErrorFilter = "Created After";
return;
}
}
if (!empty($_POST["p_created_before"])) {
if (is_numeric($_POST["p_created_before"]) && !empty($_POST["p_created_before"])) {
$sql_where .= " AND `time` < " . $_POST["p_created_before"];
} else {
$this->ErrorFilter = "Created Before";
return;
}
}
}
$results = array("Tickets" => array());
$result = queryDB(true, $d = "SELECT * FROM `" . DB_PREFIX . DATABASE_TICKETS . "` as `t1` INNER JOIN `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` as `t2` ON `t1`.`id`=`t2`.`id` " . $sql_where . " ORDER BY `t1`.`id` ASC " . $sql_limit . ";");
while ($row = DBManager::FetchArray($result)) {
$ticket = new Ticket($row, true, true);
$results["Tickets"][] = array("Ticket" => ApiV2::ClearObject(ApiV2::GetObjectFields("Ticket"), $ticket));
}
$this->JSONOutput = APIV2::Encode($results, $this->JSONParams);
}
示例14: CleanDatabases
function CleanDatabases($_days)
{
queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `last_active`<" . (time() - $_days * 86400) . ";");
queryDB(true, "DELETE FROM `" . DB_PREFIX . DATABASE_OPERATOR_STATUS . "` WHERE `" . DB_PREFIX . DATABASE_OPERATOR_STATUS . "`.`confirmed`<" . DBManager::RealEscape(time() - $_days * 86400) . ";");
}
示例15: GetQueuePosition
function GetQueuePosition($_targetGroup, $_startTime = 0, $_position = 1)
{
global $USER;
$USER->Browsers[0]->SetStatus(CHAT_STATUS_OPEN);
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` SET `qpenalty`=`qpenalty`+60 WHERE `last_active`>" . (time() - Server::$Configuration->File["timeout_chats"]) . " AND `status`=0 AND `exit`=0 AND `last_active`<" . DBManager::RealEscape(time() - max(20, Server::$Configuration->File["poll_frequency_clients"] * 2)));
$result = DBManager::Execute(true, "SELECT `priority`,`request_operator`,`request_group`,`chat_id`,`first_active`,`qpenalty`+`first_active` as `sfirst` FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `status`='0' AND `exit`='0' AND `chat_id`>0 AND `last_active`>" . (time() - Server::$Configuration->File["timeout_chats"]) . " ORDER BY `priority` DESC,`sfirst` ASC;");
if ($result) {
while ($row = DBManager::FetchArray($result)) {
if ($row["chat_id"] == $USER->Browsers[0]->ChatId) {
$_startTime = $row["sfirst"];
break;
} else {
if ($row["request_group"] == $_targetGroup && $row["request_operator"] == $USER->Browsers[0]->DesiredChatPartner) {
$_position++;
} else {
if ($row["request_group"] == $_targetGroup && ($row["request_operator"] != $USER->Browsers[0]->DesiredChatPartner && empty($row["request_operator"]))) {
$_position++;
} else {
if (!empty($USER->Browsers[0]->DesiredChatPartner) && $USER->Browsers[0]->DesiredChatPartner == $row["request_operator"]) {
$_position++;
}
}
}
}
}
}
define("CHAT_START_TIME", $_startTime);
return $_position;
}