本文整理汇总了PHP中DBManager::FetchArray方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::FetchArray方法的具体用法?PHP DBManager::FetchArray怎么用?PHP DBManager::FetchArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::FetchArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataUpdateTimes
function getDataUpdateTimes()
{
global $DUT, $CM;
if (!empty($CM) && $CM->GetData(118, $DUT)) {
return;
}
$DUT = array(DATA_UPDATE_KEY_TICKETS => 0, DATA_UPDATE_KEY_EMAILS => 0, DATA_UPDATE_KEY_EVENTS => 0, DATA_UPDATE_KEY_CHATS => 0);
if (DB_CONNECTION) {
$result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_DATA_UPDATES . "`;");
if ($result && ($row = DBManager::FetchArray($result))) {
$DUT = array(DATA_UPDATE_KEY_TICKETS => $row[DATA_UPDATE_KEY_TICKETS], DATA_UPDATE_KEY_EMAILS => $row[DATA_UPDATE_KEY_EMAILS], DATA_UPDATE_KEY_EVENTS => $row[DATA_UPDATE_KEY_EVENTS], DATA_UPDATE_KEY_CHATS => $row[DATA_UPDATE_KEY_CHATS]);
}
}
if (!empty($CM)) {
$CM->SetData(118, $DUT);
}
}
示例2: buildExtern
function buildExtern()
{
Server::$Response->Tracking = "";
$result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "` WHERE `auto`=0 AND `closed`=0 AND `received`=0 ORDER BY `created` ASC;");
while ($row = DBManager::FetchArray($result)) {
$forward = new Forward($row);
Server::$Response->Forwards .= $forward->GetXml();
if (!empty(Server::$Visitors[$forward->ReceiverUserId]) && Server::$Visitors[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId) != null) {
if (!$forward->Invite) {
Server::$Visitors[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId)->Forward = $forward;
} else {
if (CALLER_SYSTEM_ID == $forward->TargetSessId) {
$forward->Save(true, true);
}
}
}
}
$isex = !empty(Server::$Operators[CALLER_SYSTEM_ID]->Groups) && Server::$Groups[Server::$Operators[CALLER_SYSTEM_ID]->Groups[0]]->IsExternal;
$builder = new ExternalXMLBuilder(Server::$Operators[CALLER_SYSTEM_ID], Server::$Visitors, NO_CLIPPING || isset($_POST[POST_INTERN_RESYNC]), $isex);
$builder->SessionFileSizes = Server::$Operators[CALLER_SYSTEM_ID]->VisitorFileSizes;
$builder->StaticReload = Server::$Operators[CALLER_SYSTEM_ID]->VisitorStaticReload;
$base = array();
$builder->SetDiscardedObject($base);
$builder->Generate();
Server::$Response->Tracking = $builder->XMLCurrent;
foreach ($builder->DiscardedObjects as $uid => $list) {
Server::$Response->Tracking .= "<cd id=\"" . base64_encode($uid) . "\">\r\n";
if ($list != null) {
foreach ($list as $bid) {
Server::$Response->Tracking .= " <bd id=\"" . base64_encode($bid) . "\" />\r\n";
}
}
Server::$Response->Tracking .= "</cd>\r\n";
}
Server::$Response->Typing .= $builder->XMLTyping;
Server::$Operators[CALLER_SYSTEM_ID]->VisitorFileSizes = $builder->SessionFileSizes;
Server::$Operators[CALLER_SYSTEM_ID]->VisitorStaticReload = $builder->StaticReload;
if ($builder->GetAll && !LOGIN) {
Server::$Response->Tracking .= "<resync />\r\n";
}
if (count(Server::$Visitors) == 0) {
Server::$Operators[CALLER_SYSTEM_ID]->VisitorFileSizes = array();
}
}
示例3: Update
function Update($_optional = true)
{
global $INTERNAL;
if ($INTERNAL[CALLER_SYSTEM_ID]->GetPermission(PERMISSION_REPORTS) == PERMISSION_FULL) {
if (!$_optional) {
$result = queryDB(true, "SELECT `time` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE `year`='" . DBManager::RealEscape($this->Year) . "' AND `month`='" . DBManager::RealEscape($this->Month) . "' AND `day`='" . DBManager::RealEscape($this->Day) . "' AND `aggregated`=0 LIMIT 1;");
} else {
if (is_numeric(StatisticProvider::$UpdateInterval)) {
$result = queryDB(true, "SELECT `time` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE `year`='" . DBManager::RealEscape($this->Year) . "' AND `month`='" . DBManager::RealEscape($this->Month) . "' AND `day`='" . DBManager::RealEscape($this->Day) . "' AND `aggregated`=0 AND `time`<" . (time() - StatisticProvider::$UpdateInterval) . " LIMIT 1;");
}
}
if ($result) {
if ($row = DBManager::FetchArray($result)) {
if ($this->Type == STATISTIC_PERIOD_TYPE_DAY) {
$this->SaveVisitorListToFile();
}
$this->SaveReportToFile();
} else {
if (@file_exists($this->GetFilename(true, false))) {
$result = queryDB(true, "SELECT `time`,`mtime` FROM `" . DB_PREFIX . DATABASE_STATS_AGGS . "` WHERE `year`='" . DBManager::RealEscape($this->Year) . "' AND `month`='" . DBManager::RealEscape($this->Month) . "' AND `day`='" . DBManager::RealEscape($this->Day) . "' LIMIT 1;");
if ($result) {
if ($row = DBManager::FetchArray($result)) {
$parts = explode("_", $_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME]);
if ($parts[0] > $row["time"]) {
$_POST[POST_INTERN_XMLCLIP_REPORTS_END_TIME] = $row["time"] . "_" . ($row["mtime"] - 1);
}
}
}
}
}
}
}
}
示例4: getFileById
function getFileById($_id, $_online, $_type)
{
$result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_IMAGES . "` WHERE `id`='" . DBManager::RealEscape($_id) . "' AND `button_type`='" . DBManager::RealEscape($_type) . "' AND `online`='" . DBManager::RealEscape($_online ? "1" : "0") . "' LIMIT 1;");
if ($row = DBManager::FetchArray($result)) {
header("Content-Type: image/" . $row["image_type"] . ";");
return base64_decode($row["data"]);
} else {
header("Content-Type: image/gif;");
return file_get_contents(PATH_IMAGES . "chat_blank.gif");
}
}
示例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: Maintain
//.........这里部分代码省略.........
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_PROFILE_PICTURES . "` WHERE `webcam`=1 AND `time` < " . DBManager::RealEscape(time() - $_timeouts[0]));
$clr = "";
if (!empty(Server::$Configuration->File["gl_colt"])) {
$clr = "`create` < " . intval(time() - Server::$Configuration->File["gl_colt"] * 86400) . " AND ";
}
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_USER_DATA . "` WHERE " . $clr . "NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE `data_id` = `" . DB_PREFIX . DATABASE_USER_DATA . "`.`id`) AND NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_FEEDBACKS . "` WHERE `data_id` = `" . DB_PREFIX . DATABASE_USER_DATA . "`.`id`);");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_FEEDBACKS . "` WHERE `resource_id` != '' AND NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_RESOURCES . "` WHERE `id` = `" . DB_PREFIX . DATABASE_FEEDBACKS . "`.`resource_id`);");
} else {
if ($_randStandard == 2) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_ALERTS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_ALERTS . "`.`receiver_user_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_FILES . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_CHAT_FILES . "`.`visitor_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_id` = `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "`.`chat_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_REQUESTS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_CHAT_REQUESTS . "`.`receiver_browser_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_STATS_AGGS_GOALS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_GOALS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_STATS_AGGS_GOALS . "`.`goal`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_STATS_AGGS_PAGES . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_DATA_PAGES . "` WHERE `id` = `" . DB_PREFIX . DATABASE_STATS_AGGS_PAGES . "`.`url`)");
DBManager::Execute(true, "DELETE `" . DB_PREFIX . DATABASE_TICKETS . "` FROM `" . DB_PREFIX . DATABASE_TICKETS . "` INNER JOIN `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "`.`ticket_id` WHERE `deleted`=1 AND `time` < " . DBManager::RealEscape(time() - $_timeouts[3]) . ";");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_CUSTOMS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKETS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_TICKET_CUSTOMS . "`.`ticket_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_EDITORS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKETS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_TICKET_EDITORS . "`.`ticket_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_LOGS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKETS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_TICKET_LOGS . "`.`ticket_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_COMMENTS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKETS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_TICKET_COMMENTS . "`.`ticket_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKETS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "`.`ticket_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKETS . "` WHERE `last_update` < " . DBManager::RealEscape(time() - $_timeouts[1]) . " AND NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` WHERE `ticket_id` = `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_ATTACHMENTS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` WHERE `id` = `" . DB_PREFIX . DATABASE_TICKET_ATTACHMENTS . "`.`parent_id`) AND NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_TICKET_EMAILS . "` WHERE `email_id` = `" . DB_PREFIX . DATABASE_TICKET_ATTACHMENTS . "`.`parent_id`)");
} else {
if ($_randStandard == 3) {
if (empty(Server::$Configuration->File["gl_vmac"]) && !Is::Defined("STATS_ACTIVE")) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `last_active`<" . (time() - Server::$Configuration->File["timeout_track"]) . " LIMIT 250;");
}
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "`.`visitor_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSER_URLS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_VISITOR_BROWSER_URLS . "`.`browser_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "`.`visitor_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITOR_CHAT_OPERATORS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_CHATS . "` WHERE `chat_id` = `" . DB_PREFIX . DATABASE_VISITOR_CHAT_OPERATORS . "`.`chat_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITOR_GOALS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITORS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_VISITOR_GOALS . "`.`visitor_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_WEBSITE_PUSHS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_WEBSITE_PUSHS . "`.`receiver_browser_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_OVERLAY_BOXES . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_VISITOR_BROWSERS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_OVERLAY_BOXES . "`.`receiver_browser_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_GROUP_MEMBERS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_GROUPS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_GROUP_MEMBERS . "`.`group_id`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_LOCALIZATIONS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` WHERE `id` = `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_LOCALIZATIONS . "`.`tid`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_VOUCHERS . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_TYPES . "` WHERE `id` = `" . DB_PREFIX . DATABASE_COMMERCIAL_CHAT_VOUCHERS . "`.`tid`)");
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_TICKET_EMAILS . "` WHERE `deleted`=1 AND `edited` < " . DBManager::RealEscape(time() - $_timeouts[3]));
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_VISITOR_COMMENTS . "` WHERE `created` < " . DBManager::RealEscape(time() - max(1, Server::$Configuration->File["gl_colt"]) * 86400));
} else {
if ($_randStandard == 4) {
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_RESOURCES . "` SET `discarded`=1,`edited`=UNIX_TIMESTAMP() WHERE NOT EXISTS(SELECT * FROM `" . DB_PREFIX . DATABASE_TICKET_ATTACHMENTS . "` WHERE `res_id` = `" . DB_PREFIX . DATABASE_RESOURCES . "`.`id`) AND `created` < " . intval(time() - 7 * 86400) . " AND `discarded`=0 AND `type`=3 AND `parentid`=100 LIMIT 10;");
if (Server::$Configuration->File["gl_adct"] != 1) {
if (!empty(Server::$Configuration->File["gl_rm_chats"])) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `time` < " . intval(time() - Server::$Configuration->File["gl_rm_chats_time"]));
}
if (!empty(Server::$Configuration->File["gl_rm_oc"])) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=0 AND `time` < " . intval(time() - Server::$Configuration->File["gl_rm_oc_time"]));
}
if (!empty(Server::$Configuration->File["gl_rm_gc"])) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=2 AND `time` < " . intval(time() - Server::$Configuration->File["gl_rm_gc_time"]));
}
if (!empty(Server::$Configuration->File["gl_rm_rt"])) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_FEEDBACKS . "` WHERE `created` < " . intval(time() - Server::$Configuration->File["gl_rm_rt_time"]));
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_FEEDBACK_CRITERIA . "` WHERE NOT EXISTS (SELECT * FROM `" . DB_PREFIX . DATABASE_FEEDBACKS . "` WHERE `id` = `" . DB_PREFIX . DATABASE_FEEDBACK_CRITERIA . "`.`fid`)");
}
if (!empty(Server::$Configuration->File["gl_rm_cf"])) {
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_RESOURCES . "` SET `discarded`=1,`edited`=UNIX_TIMESTAMP() WHERE `discarded`=0 AND `type`=4 AND `created` < " . intval(time() - Server::$Configuration->File["gl_rm_cf_time"]) . " ORDER BY `created` ASC LIMIT 5;");
if (!empty(Server::$Operators)) {
foreach (Server::$Operators as $sid => $operator) {
if (!$operator->IsBot) {
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_RESOURCES . "` SET `discarded`=1,`edited`=UNIX_TIMESTAMP() WHERE `discarded`=0 AND `type`=3 AND `parentid`='" . DBManager::RealEscape($sid) . "' AND `created` < " . intval(time() - Server::$Configuration->File["gl_rm_cf_time"]) . " ORDER BY `created` ASC LIMIT 5;");
}
}
}
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_RESOURCES . "` SET `discarded`=1,`edited`=UNIX_TIMESTAMP() WHERE `discarded`=0 AND `type`=0 AND `parentid`=5 AND `created` < " . intval(time() - Server::$Configuration->File["gl_rm_cf_time"]) . " ORDER BY `created` ASC LIMIT 5;");
}
if (!empty(Server::$Configuration->File["gl_rm_tf"])) {
DBManager::Execute(true, "UPDATE `" . DB_PREFIX . DATABASE_RESOURCES . "` SET `discarded`=1,`edited`=UNIX_TIMESTAMP() WHERE `discarded`=0 AND `type`=3 AND `created` < " . intval(time() - Server::$Configuration->File["gl_rm_tf_time"]) . " ORDER BY `created` ASC LIMIT 5;");
}
if (!empty(Server::$Configuration->File["gl_rm_om"])) {
DBManager::Execute(true, "DELETE `" . DB_PREFIX . DATABASE_TICKETS . "` FROM `" . DB_PREFIX . DATABASE_TICKETS . "` INNER JOIN `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "`.`ticket_id` WHERE `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "`.`time` < " . DBManager::RealEscape(time() - Server::$Configuration->File["gl_rm_om_time"]));
}
if (!empty(Server::$Configuration->File["gl_rm_tid"])) {
DBManager::Execute(true, "DELETE `" . DB_PREFIX . DATABASE_TICKETS . "` FROM `" . DB_PREFIX . DATABASE_TICKETS . "` INNER JOIN `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "`.`ticket_id` INNER JOIN `" . DB_PREFIX . DATABASE_TICKET_EDITORS . "` ON `" . DB_PREFIX . DATABASE_TICKETS . "`.`id`=`" . DB_PREFIX . DATABASE_TICKET_EDITORS . "`.`ticket_id` WHERE `" . DB_PREFIX . DATABASE_TICKET_EDITORS . "`.`status`=3 AND `" . DB_PREFIX . DATABASE_TICKET_MESSAGES . "`.`time` < " . DBManager::RealEscape(time() - Server::$Configuration->File["gl_rm_tid_time"]));
}
if (!empty(Server::$Operators) && !empty(Server::$Configuration->File["gl_rm_bc"])) {
foreach (Server::$Operators as $sid => $operator) {
if ($operator->IsBot) {
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` WHERE `chat_type`=1 AND `internal_id`='" . DBManager::RealEscape($sid) . "' AND `time` < " . DBManager::RealEscape(time() - Server::$Configuration->File["gl_rm_bc_time"]));
}
}
}
}
if ($result = DBManager::Execute(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_RESOURCES . "` WHERE `discarded`=1 AND `type` > 2")) {
while ($result && ($row = DBManager::FetchArray($result))) {
$resultb = DBManager::Execute(true, "SELECT count(value) as `linked` FROM `" . DB_PREFIX . DATABASE_RESOURCES . "` WHERE `value`='" . DBManager::RealEscape($row["value"]) . "';");
$rowb = DBManager::FetchArray($resultb);
if ($rowb["linked"] == 1) {
@unlink(PATH_UPLOADS . $row["value"]);
}
}
}
DBManager::Execute(true, "DELETE FROM `" . DB_PREFIX . DATABASE_RESOURCES . "` WHERE `discarded`='1' AND `edited` < " . DBManager::RealEscape(time() - $_timeouts[3]));
}
}
}
}
}
示例7: up_5402_6000
function up_5402_6000($_prefix, $_link, $_engine)
{
$commands[] = array(1060, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "resources` ADD `languages` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',ADD `kb_public` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0',ADD `kb_bot` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0',ADD `kb_ft_search` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0',ADD INDEX ( `languages` , `kb_public` ) ");
$commands[] = array(1060, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "resources` ADD `shortcut_word` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';");
$commands[] = array(1060, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_browsers` ADD `data_id` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' AFTER `visit_id`;");
$commands[] = array(1054, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "data_updates` CHANGE `update_ratings` `update_feedbacks` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0';");
$commands[] = array(1060, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "administration_log` ADD `trace` TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `value`;");
$commands[] = array(1060, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "events` ADD `exclude_mobile` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';");
$commands[] = array(1060, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "events` ADD `exclude_countries` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';");
$commands[] = array(1050, "CREATE TABLE IF NOT EXISTS `" . DBManager::RealEscape($_prefix) . "user_data` (`id` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',`create` int(10) unsigned NOT NULL DEFAULT '0',`h_fullname` varchar(254) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',`h_email` varchar(254) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',`h_company` varchar(254) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',`h_phone` varchar(254) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',`h_customs` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,`h_text` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,PRIMARY KEY (`id`)) ENGINE=" . $_engine . " DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
$commands[] = array(1050, "CREATE TABLE IF NOT EXISTS `" . DBManager::RealEscape($_prefix) . "feedbacks` (`id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`created` int(10) unsigned NOT NULL DEFAULT '0',`chat_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`ticket_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`resource_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`user_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`operator_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`group_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`data_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`ip_hash` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',PRIMARY KEY (`id`)) ENGINE=" . $_engine . " DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
$commands[] = array(1050, "CREATE TABLE IF NOT EXISTS `" . DBManager::RealEscape($_prefix) . "feedback_criteria` (`fid` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`cid` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`value` varchar(512) COLLATE utf8_bin NOT NULL DEFAULT '',PRIMARY KEY (`fid`,`cid`)) ENGINE=" . $_engine . " DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
$commands[] = array(1050, "CREATE TABLE IF NOT EXISTS `" . DBManager::RealEscape($_prefix) . "feedback_criteria_config` (`id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`type` tinyint(1) unsigned NOT NULL DEFAULT '0',`name` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`title` varchar(128) COLLATE utf8_bin NOT NULL DEFAULT '',PRIMARY KEY (`id`)) ENGINE=" . $_engine . " DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
$commands[] = array(1050, "CREATE TABLE IF NOT EXISTS `" . DBManager::RealEscape($_prefix) . "stats_aggs_feedbacks` (`year` smallint(5) unsigned NOT NULL DEFAULT '0',`month` tinyint(3) unsigned NOT NULL DEFAULT '0',`day` tinyint(3) unsigned NOT NULL DEFAULT '0',`operator_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`group_id` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '',`amount` int(10) unsigned NOT NULL DEFAULT '0',`ca` double unsigned NOT NULL DEFAULT '0',`cb` double unsigned NOT NULL DEFAULT '0',`cc` double unsigned NOT NULL DEFAULT '0',`cd` double unsigned NOT NULL DEFAULT '0',PRIMARY KEY (`year`,`month`,`day`,`operator_id`,`group_id`)) ENGINE=" . $_engine . " DEFAULT CHARSET=utf8 COLLATE=utf8_bin;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "resources` DROP `rank`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_chats` DROP `fullname`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_chats` DROP `email`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_chats` DROP `company`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_chats` DROP `phone`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_chats` DROP `customs`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_chats` DROP `question`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_browsers` DROP `fullname`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_browsers` DROP `email`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_browsers` DROP `company`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_browsers` DROP `phone`;");
$commands[] = array(1091, "ALTER TABLE `" . DBManager::RealEscape($_prefix) . "visitor_browsers` DROP `customs`;");
$res = processCommandList($commands, $_link);
// import ratings
$_link->Query(true, "INSERT INTO `" . DBManager::RealEscape($_prefix) . "feedback_criteria_config` (`id`, `type`, `name`, `title`) VALUES ('d0', 0, 'Knowledge', '<!--lang_client_feedback_knowledge-->'),('d1', 0, 'Friendlyness', '<!--lang_client_feedback_friendliness-->'),('d2', 0, 'Responsivenness', '<!--lang_client_feedback_responsiveness-->'),('d3', 0, 'Overall', '<!--lang_client_feedback_overall-->'),('d4', 1, 'Comment', '<!--lang_client_feedback_comment-->');");
$sttime = time();
$max_fb_time = null;
if ($result = $_link->Query(true, "SELECT * FROM `" . DB_PREFIX . "ratings` ORDER BY `time` DESC;")) {
while ($sttime > time() - 15 && ($row = DBManager::FetchArray($result))) {
$userData = new UserData($row["fullname"], $row["email"], $row["company"], "");
$hash = $userData->Hash();
$_link->Query(true, "INSERT IGNORE INTO `" . DBManager::RealEscape($_prefix) . "user_data` (`id`,`create`,`h_fullname`,`h_email`,`h_company`,`h_customs`) VALUES ('" . DBManager::RealEscape($hash) . "'," . intval(time()) . ",'" . DBManager::RealEscape($row["fullname"]) . "','" . DBManager::RealEscape($row["email"]) . "','" . DBManager::RealEscape($row["company"]) . "','');");
$_link->Query(true, "INSERT INTO `" . DBManager::RealEscape($_prefix) . "feedbacks` (`id`, `created`, `chat_id`, `user_id`, `operator_id`, `data_id`, `ip_hash`) VALUES ('" . DBManager::RealEscape($id = getId(32)) . "', " . intval($row["time"]) . ", '" . DBManager::RealEscape($row["chat_id"]) . "', '" . DBManager::RealEscape($row["user_id"]) . "', '" . DBManager::RealEscape($row["internal_id"]) . "','" . DBManager::RealEscape($hash) . "','" . DBManager::RealEscape(md5($row["ip"])) . "');");
$_link->Query(true, "INSERT INTO `" . DBManager::RealEscape($_prefix) . "feedback_criteria` (`fid`, `cid`, `value`) VALUES ('" . DBManager::RealEscape($id) . "', 'd0', '" . DBManager::RealEscape($row["qualification"]) . "');");
$_link->Query(true, "INSERT INTO `" . DBManager::RealEscape($_prefix) . "feedback_criteria` (`fid`, `cid`, `value`) VALUES ('" . DBManager::RealEscape($id) . "', 'd1', '" . DBManager::RealEscape($row["politeness"]) . "');");
if ($max_fb_time == null) {
$max_fb_time = $row["time"];
}
}
}
if ($max_fb_time == null) {
$max_fb_time = time();
}
CacheManager::WriteDataUpdateTime(DATA_UPDATE_KEY_FEEDBACKS, false, $_link, $_prefix, intval($max_fb_time) * 1000);
CacheManager::WriteDataUpdateTime(DATA_UPDATE_KEY_FILTERS, false, $_link, $_prefix, intval(time()) * 1000);
return $res;
}
示例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: GetQueueWaitingTime
function GetQueueWaitingTime($_position, $min = 1)
{
if ($this->OperatorsBusy == 0) {
$this->OperatorsBusy++;
}
$result = DBManager::Execute(true, "SELECT AVG(`endtime`-`time`) AS `waitingtime` FROM `" . DB_PREFIX . DATABASE_CHAT_ARCHIVE . "` AS `db1` INNER JOIN `" . DB_PREFIX . DATABASE_OPERATORS . "` as `db2` ON `db1`.`internal_id`=`db2`.`system_id` WHERE `chat_type`=1 AND `bot`=0 AND `endtime`>0 AND `endtime`>`time` AND `endtime`-`time` < 3600;");
if ($result) {
$row = DBManager::FetchArray($result);
if (!empty($row["waitingtime"])) {
$min = $row["waitingtime"] / 60 / $this->OperatorsBusy;
} else {
$min = $min / $this->OperatorsBusy;
}
$minb = $min;
for ($i = 1; $i < $_position; $i++) {
$minb *= 0.9;
$min += $minb;
}
$min /= Server::$Configuration->File["gl_sim_ch"];
$min -= abs((time() - CHAT_START_TIME) / 60);
if ($min <= 0) {
$min = 1;
}
}
return min(10, ceil($min));
}
示例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: UpdateUserManagement
static function UpdateUserManagement($_prefix)
{
if (OperatorRequest::IsValidated() && Is::Defined("VALIDATED_FULL_LOGIN") && OperatorRequest::IsAdministrator(true)) {
Logging::SecurityLog("ServerManager::UpdateUserManagement", "", CALLER_SYSTEM_ID);
$count = 0;
while (isset($_POST["p_operators_" . $count . "_id"])) {
if (!empty($_POST["p_operators_" . $count . "_delete"])) {
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_OPERATORS . "` WHERE `id`='" . DBManager::RealEscape($_POST["p_operators_" . $count . "_id"]) . "' LIMIT 1;");
} else {
$did = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->AppDeviceId : "";
$abm = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->AppBackgroundMode : false;
$aos = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->AppOS : "";
$lac = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->LastActive : 0;
$fac = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->FirstActive : 0;
$wcl = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->ClientWeb : 0;
$acl = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->AppClient : 0;
$sta = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->Status : 2;
$tok = !empty(Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]) ? Server::$Operators[$_POST["p_operators_" . $count . "_system_id"]]->Token : "";
DBManager::Execute(true, "REPLACE INTO `" . $_prefix . DATABASE_OPERATORS . "` (`id`, `system_id`, `token`, `fullname`, `description`, `email`, `permissions`, `webspace`, `password`, `status`, `level`, `visitor_file_sizes`, `groups`, `groups_status`, `groups_hidden`,`reposts`, `languages`, `auto_accept_chats`, `login_ip_range`, `websites_users`, `websites_config`, `bot`, `wm`, `wmohca`,`first_active`,`last_active`,`sign_off`,`lweb`,`lapp`,`mobile_os`,`mobile_device_id`,`mobile_background`,`mobile_ex`,`max_chats`) VALUES ('" . DBManager::RealEscape($_POST["p_operators_" . $count . "_id"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_system_id"]) . "','" . DBManager::RealEscape($tok) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_fullname"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_description"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_email"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_permissions"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_webspace"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_password"]) . "','" . $sta . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_level"]) . "','','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_groups"]) . "','','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_groups_hidden"]) . "','','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_languages"]) . "',0,'" . DBManager::RealEscape($_POST["p_operators_" . $count . "_lipr"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_websites_users"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_websites_config"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_bot"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_wm"]) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_wmohca"]) . "'," . $fac . "," . $lac . "," . intval(empty($_POST["p_operators_" . $count . "_deac"]) ? 0 : 2) . "," . intval($wcl ? 1 : 0) . "," . intval($acl ? 1 : 0) . ",'" . DBManager::RealEscape($aos) . "','" . DBManager::RealEscape($did) . "'," . intval($abm ? 1 : 0) . ",'" . DBManager::RealEscape(@$_POST["p_operators_" . $count . "_mobile_ex"]) . "'," . intval(@$_POST["p_operators_" . $count . "_max_chats"]) . ");");
}
if (!empty($_POST["p_operators_" . $count . "_pp"])) {
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_PROFILE_PICTURES . "` WHERE `webcam`='0' AND `internal_id`='" . DBManager::RealEscape($_POST["p_operators_" . $count . "_system_id"]) . "';");
if ($_POST["p_operators_" . $count . "_pp"] != "DEFAULT") {
DBManager::Execute(true, "INSERT INTO `" . $_prefix . DATABASE_PROFILE_PICTURES . "` (`id` ,`internal_id`,`time` ,`webcam` ,`data`) VALUES ('" . DBManager::RealEscape(getId(32)) . "','" . DBManager::RealEscape($_POST["p_operators_" . $count . "_system_id"]) . "','" . DBManager::RealEscape(time()) . "',0,'" . DBManager::RealEscape($_POST["p_operators_" . $count . "_pp"]) . "');");
}
}
$count++;
}
$count = 0;
while (isset($_POST["p_groups_" . $count . "_id"])) {
if (!empty($_POST["p_groups_" . $count . "_delete"])) {
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_GROUPS . "` WHERE `id`='" . DBManager::RealEscape($_POST["p_groups_" . $count . "_id"]) . "' LIMIT 1;");
} else {
$f_functions = "000000";
$result = DBManager::Execute(true, "SELECT * FROM `" . $_prefix . DATABASE_GROUPS . "` WHERE `id`='" . DBManager::RealEscape($_POST["p_groups_" . $count . "_id"]) . "' LIMIT 1;");
if ($row = DBManager::FetchArray($result)) {
$f_functions = $row["functions"];
}
$f_functions = !empty($_POST["p_groups_" . $count . "_functions"]) ? $_POST["p_groups_" . $count . "_functions"] : $f_functions;
DBManager::Execute(true, "REPLACE INTO `" . $_prefix . DATABASE_GROUPS . "` (`id`, `dynamic`, `description`, `external`, `internal`, `created`, `email`, `standard`, `opening_hours`, `functions`, `chat_inputs_hidden`, `ticket_inputs_hidden`, `chat_inputs_required`, `ticket_inputs_required`, `chat_inputs_masked`, `ticket_inputs_masked`, `chat_inputs_cap`, `ticket_inputs_cap`, `max_chats`, `visitor_filters`, `chat_vouchers_required`, `pre_chat_js`, `post_chat_js`, `ticket_email_out`, `ticket_email_in`, `ticket_handle_unknown`, `chat_email_out`,`ticket_assignment`,`priorities`,`priority_sleep`) VALUES ('" . DBManager::RealEscape($_POST["p_groups_" . $count . "_id"]) . "',0,'" . DBManager::RealEscape($_POST["p_groups_" . $count . "_description"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_external"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_internal"]) . "'," . time() . ",'" . DBManager::RealEscape($_POST["p_groups_" . $count . "_email"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_standard"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_opening_hours"]) . "','" . DBManager::RealEscape($f_functions) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_chat_inputs_hidden"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_inputs_hidden"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_chat_inputs_required"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_inputs_required"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_chat_inputs_masked"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_inputs_masked"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_chat_inputs_cap"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_inputs_cap"]) . "'," . intval($_POST["p_groups_" . $count . "_max_chats"]) . ",'" . DBManager::RealEscape($_POST["p_groups_" . $count . "_visitor_filters"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_chat_vouchers_required"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_pre_js"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_post_js"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_email_out"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_email_in"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_email_handling"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_chat_email_out"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_ticket_assign"]) . "','" . DBManager::RealEscape($_POST["p_groups_" . $count . "_priorities"]) . "'," . intval($_POST["p_groups_" . $count . "_ps"]) . ");");
}
SocialMediaChannel::DeleteByGroup($_prefix, $_POST["p_groups_" . $count . "_id"]);
$count++;
}
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_OPERATOR_LOGINS . "`;");
Server::$Operators = Server::$Groups = Server::$Visitors = null;
Server::InitDataBlock(array("INTERNAL", "GROUPS", "VISITOR"));
ServerManager::UpdatePredefinedMessages($_prefix);
ServerManager::UpdateSignatures($_prefix);
ServerManager::UpdateSocialMedia($_prefix);
if (!empty($_POST["p_operators_0_id"])) {
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_AUTO_REPLIES . "` WHERE NOT EXISTS (SELECT * FROM `" . $_prefix . DATABASE_OPERATORS . "` WHERE `system_id` = `" . $_prefix . DATABASE_AUTO_REPLIES . "`.`owner_id`) AND NOT EXISTS (SELECT * FROM `" . $_prefix . DATABASE_GROUPS . "` WHERE `id` = `" . $_prefix . DATABASE_AUTO_REPLIES . "`.`owner_id`)");
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_PROFILE_PICTURES . "` WHERE NOT EXISTS (SELECT * FROM `" . $_prefix . DATABASE_OPERATORS . "` WHERE `system_id` = `" . $_prefix . DATABASE_PROFILE_PICTURES . "`.`internal_id`);");
DBManager::Execute(true, "DELETE FROM `" . $_prefix . DATABASE_PROFILES . "` WHERE NOT EXISTS (SELECT * FROM `" . $_prefix . DATABASE_OPERATORS . "` WHERE `system_id` = `" . $_prefix . DATABASE_PROFILES . "`.`id`);");
if (isset($_POST[POST_INTERN_EDIT_USER])) {
$combos = explode(";", $_POST[POST_INTERN_EDIT_USER]);
for ($i = 0; $i < count($combos); $i++) {
if (strpos($combos[$i], ",") !== false) {
$vals = explode(",", $combos[$i]);
if (strlen($vals[1]) > 0) {
Server::$Operators[$vals[0]]->ChangePassword($vals[1]);
}
if ($vals[2] == 1) {
Server::$Operators[$vals[0]]->SetPasswordChangeNeeded();
}
}
}
}
}
CacheManager::Flush();
Server::$Response->SetStandardResponse(1, "");
}
}
示例12: Read
function Read()
{
$loadedKeys = array();
foreach ($this->Fields as $key => $name) {
$data = "";
if (CacheManager::$Engine == "PSHM") {
$Shmid = @shmop_open($this->BaseMemId . $key, "a", 0666, 0);
if ($Shmid) {
$shm_size = @shmop_size($Shmid);
$data = @shmop_read($Shmid, 0, $shm_size);
}
@shmop_close($Shmid);
} else {
if (CacheManager::$Engine == "APC") {
$data = apc_fetch($this->BaseMemId . $key);
} else {
if (CacheManager::$Engine == "MEMCACHED" || CacheManager::$Engine == "MEMCACHE") {
$data = $this->Provider->get($this->BaseMemId . $key);
} else {
if (CacheManager::$Engine == "MYSQL") {
if (empty($loadedKeys) && ($result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_DATA_CACHE . "`;"))) {
while ($row = DBManager::FetchArray($result)) {
$loadedKeys[$row["key"]] = $row["data"];
}
}
if (isset($loadedKeys[$key])) {
$data = $loadedKeys[$key];
}
}
}
}
}
if (!empty($data)) {
if ($this->Encryption) {
$upos = strpos($data, "_");
if ($upos !== false) {
$data = base64_decode(substr($data, $upos + 1, strlen($data) - ($upos + 1)));
$data = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->BaseId, $data, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND));
} else {
continue;
}
}
$arra = @unserialize($data);
if (!empty($arra) && is_array($arra)) {
if (!(!empty($arra[3]) && getIdent() != "" && $arra[3] == getIdent())) {
if ($arra[0] > time() - $this->TTL || isset($this->Fields[$key][2]) && $arra[0] > time() - $this->Fields[$key][2]) {
$this->Data[$key] = $arra;
$this->Data[$key][2] = false;
}
}
}
}
}
}
示例13: 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);
}
示例14: 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);
}
示例15: buildExtern
function buildExtern()
{
global $VISITOR, $INTERNAL, $GROUPS, $RESPONSE;
$RESPONSE->Tracking = "";
$result = queryDB(true, "SELECT * FROM `" . DB_PREFIX . DATABASE_CHAT_FORWARDS . "` WHERE `auto`=0 AND `closed`=0 AND `received`=0 ORDER BY `created` ASC;");
while ($row = DBManager::FetchArray($result)) {
$forward = new Forward($row);
$RESPONSE->Forwards .= $forward->GetXml();
if (!empty($VISITOR[$forward->ReceiverUserId]) && $VISITOR[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId) != null) {
if (!$forward->Invite) {
$VISITOR[$forward->ReceiverUserId]->GetBrowser($forward->ReceiverBrowserId)->Forward = $forward;
} else {
if (CALLER_SYSTEM_ID == $forward->TargetSessId) {
$forward->Save(true, false);
}
}
}
}
$isex = !empty($INTERNAL[CALLER_SYSTEM_ID]->Groups) && $GROUPS[$INTERNAL[CALLER_SYSTEM_ID]->Groups[0]]->IsExternal;
$builder = new ExternalXMLBuilder($INTERNAL[CALLER_SYSTEM_ID], $VISITOR, NO_CLIPPING || isset($_POST[POST_INTERN_RESYNC]), $isex);
$builder->SessionFileSizes = $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes;
$builder->StaticReload = $INTERNAL[CALLER_SYSTEM_ID]->VisitorStaticReload;
//$base = (!empty($INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes["discarded"])) ? $INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes["discarded"] : array();
$base = array();
$builder->SetDiscardedObject($base);
$builder->Generate();
$RESPONSE->Tracking = $builder->XMLCurrent;
foreach ($builder->DiscardedObjects as $uid => $list) {
$RESPONSE->Tracking .= "<cd id=\"" . base64_encode($uid) . "\">\r\n";
if ($list != null) {
foreach ($list as $bid) {
$RESPONSE->Tracking .= " <bd id=\"" . base64_encode($bid) . "\" />\r\n";
}
}
$RESPONSE->Tracking .= "</cd>\r\n";
}
$RESPONSE->Typing .= $builder->XMLTyping;
$INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes = $builder->SessionFileSizes;
$INTERNAL[CALLER_SYSTEM_ID]->VisitorStaticReload = $builder->StaticReload;
if ($builder->GetAll && !LOGIN) {
$RESPONSE->Tracking .= "<resync />\r\n";
}
if (count($VISITOR) == 0) {
$INTERNAL[CALLER_SYSTEM_ID]->VisitorFileSizes = array();
}
}