当前位置: 首页>>代码示例>>PHP>>正文


PHP CTimeZone::Disable方法代码示例

本文整理汇总了PHP中CTimeZone::Disable方法的典型用法代码示例。如果您正苦于以下问题:PHP CTimeZone::Disable方法的具体用法?PHP CTimeZone::Disable怎么用?PHP CTimeZone::Disable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTimeZone的用法示例。


在下文中一共展示了CTimeZone::Disable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: InstallDB

 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     if (!$DB->Query("SELECT 'x' FROM b_list_rubric WHERE 1=0", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/subscribe/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         RegisterModule("subscribe");
         CModule::IncludeModule("subscribe");
         RegisterModuleDependences("main", "OnBeforeLangDelete", "subscribe", "CRubric", "OnBeforeLangDelete");
         RegisterModuleDependences("main", "OnUserDelete", "subscribe", "CSubscription", "OnUserDelete");
         RegisterModuleDependences("main", "OnUserLogout", "subscribe", "CSubscription", "OnUserLogout");
         RegisterModuleDependences("main", "OnGroupDelete", "subscribe", "CPosting", "OnGroupDelete");
         //agents
         CAgent::RemoveAgent("CSubscription::CleanUp();", "subscribe");
         CTimeZone::Disable();
         CAgent::Add(array("NAME" => "CSubscription::CleanUp();", "MODULE_ID" => "subscribe", "ACTIVE" => "Y", "NEXT_EXEC" => date("d.m.Y H:i:s", mktime(3, 0, 0, date("m"), date("j") + 1, date("Y"))), "AGENT_INTERVAL" => 86400, "IS_PERIOD" => "Y"));
         CTimeZone::Enable();
         return true;
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:26,代码来源:index.php

示例2: sendOnAfterResultStatusChange

 function sendOnAfterResultStatusChange($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID = false, $CHECK_RIGHTS = 'Y')
 {
     $NEW_STATUS_ID = intval($NEW_STATUS_ID);
     $dbRes = CForm::GetByID($WEB_FORM_ID);
     if (!($arForm = $dbRes->Fetch())) {
         return;
     }
     CTimeZone::Disable();
     $dbRes = CFormResult::GetByID($RESULT_ID);
     CTimeZone::Enable();
     if (!($arResult = $dbRes->Fetch()) || !$arResult['USER_ID']) {
         return;
     }
     $dbRes = CUser::GetByID($arResult['USER_ID']);
     if (!($arUser = $dbRes->Fetch())) {
         return;
     }
     if (!$NEW_STATUS_ID) {
         $NEW_STATUS_ID = CFormStatus::GetDefault($WEB_FORM_ID);
     }
     $dbRes = CFormStatus::GetByID($NEW_STATUS_ID);
     if (!($arStatus = $dbRes->Fetch()) || strlen($arStatus['MAIL_EVENT_TYPE']) <= 0) {
         return;
     }
     $arTemplates = CFormStatus::GetMailTemplateArray($NEW_STATUS_ID);
     if (!is_array($arTemplates) || count($arTemplates) <= 0) {
         return;
     }
     $arEventFields = array("EMAIL_TO" => $arUser['EMAIL'], "RS_FORM_ID" => $arForm["ID"], "RS_FORM_NAME" => $arForm["NAME"], "RS_FORM_VARNAME" => $arForm["SID"], "RS_FORM_SID" => $arForm["SID"], "RS_RESULT_ID" => $arResult["ID"], "RS_DATE_CREATE" => $arResult["DATE_CREATE"], "RS_USER_ID" => $arResult['USER_ID'], "RS_USER_EMAIL" => $arUser['EMAIL'], "RS_USER_NAME" => $arUser["NAME"] . " " . $arUser["LAST_NAME"], "RS_STATUS_ID" => $arStatus["ID"], "RS_STATUS_NAME" => $arStatus["TITLE"]);
     $dbRes = CEventMessage::GetList($by = "id", $order = "asc", array('ID' => implode('|', $arTemplates), "ACTIVE" => "Y", "EVENT_NAME" => $arStatus["MAIL_EVENT_TYPE"]));
     while ($arTemplate = $dbRes->Fetch()) {
         CEvent::Send($arTemplate["EVENT_NAME"], $arTemplate["SITE_ID"], $arEventFields, "Y", $arTemplate["ID"]);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:events.php

示例3: Add

 public static function Add($userId, $tag)
 {
     global $DB, $CACHE_MANAGER;
     $userId = intval($userId);
     if ($userId == 0 || strlen($tag) <= 0) {
         return false;
     }
     $arResult = $CACHE_MANAGER->Read(3600, $cache_id = "b_pw_" . $userId, "b_pull_watch");
     if ($arResult) {
         $arResult = $CACHE_MANAGER->Get($cache_id);
     }
     if (!$arResult) {
         CTimeZone::Disable();
         $strSql = "\n\t\t\t\t\tSELECT ID, USER_ID, TAG, " . $DB->DatetimeToTimestampFunction("DATE_CREATE") . " DATE_CREATE\n\t\t\t\t\tFROM b_pull_watch\n\t\t\t\t\tWHERE USER_ID = " . intval($userId) . "\n\t\t\t";
         CTimeZone::Enable();
         $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         while ($arRes = $dbRes->Fetch()) {
             $arResult[$arRes["TAG"]] = $arRes;
         }
         $CACHE_MANAGER->Set($cache_id, $arResult);
     }
     if ($arResult && $arResult[$tag]) {
         if ($arResult[$tag]['DATE_CREATE'] + 1800 > time()) {
             self::$arUpdate[intval($arResult[$tag]['ID'])] = intval($arResult[$tag]['ID']);
             return true;
         } else {
             self::Delete($userId, $tag);
             return self::Add($userId, $tag);
         }
     }
     $CACHE_MANAGER->Clean("b_pw_" . $userId, "b_pull_watch");
     self::$arInsert[trim($tag)] = trim($tag);
     return true;
 }
开发者ID:vim84,项目名称:b-markt,代码行数:34,代码来源:pull_watch.php

示例4: InstallDB

 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     if (!$DB->Query("SELECT 'x' FROM b_sender_contact WHERE 1=0", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sender/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         RegisterModule("sender");
         CModule::IncludeModule("sender");
         // read and click notifications
         RegisterModuleDependences("main", "OnMailEventMailRead", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailRead");
         RegisterModuleDependences("main", "OnMailEventMailClick", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailClick");
         // unsubscription notifications
         RegisterModuleDependences("main", "OnMailEventSubscriptionDisable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionDisable");
         RegisterModuleDependences("main", "OnMailEventSubscriptionEnable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionEnable");
         RegisterModuleDependences("main", "OnMailEventSubscriptionList", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionList");
         // connectors of module sender
         RegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListContact");
         RegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListRecipient");
         // mail templates and blocks
         RegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\Preset\\TemplateBase", "onPresetTemplateList");
         RegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\TemplateTable", "onPresetTemplateList");
         RegisterModuleDependences("sender", "OnPresetMailBlockList", "sender", "Bitrix\\Sender\\Preset\\MailBlockBase", "OnPresetMailBlockList");
         CTimeZone::Disable();
         \Bitrix\Sender\MailingManager::actualizeAgent();
         CAgent::AddAgent(\Bitrix\Sender\MailingManager::getAgentNamePeriod(), "sender", "N", COption::GetOptionString("sender", "reiterate_interval"));
         CTimeZone::Enable();
         return true;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:35,代码来源:index.php

示例5: Get

	public static function Get($userId, $reOpen = false)
	{
		global $DB;
		$nginxStatus = CPullOptions::GetNginxStatus();
		$webSocketStatus = CPullOptions::GetWebSocketStatus();

		CTimeZone::Disable();
		$strSql = "
				SELECT CHANNEL_ID, LAST_ID, ".$DB->DateToCharFunction('DATE_CREATE')." DATE_CREATE
				FROM b_pull_channel
				WHERE USER_ID = ".intval($userId);
		CTimeZone::Enable();

		$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		if ($arRes = $dbRes->Fetch())
		{
			if (MakeTimeStamp($arRes['DATE_CREATE'])+43200 > time())
			{
				if ($nginxStatus && $reOpen)
				{
					$arData = Array(
						'module_id' => 'pull',
						'command' => 'reopen',
						'params' => Array(),
					);
					$channelId = $arRes['CHANNEL_ID'];
					$CHTTP = new CHTTP();
					$CHTTP->http_timeout = 10;
					$CHTTP->HTTPQuery('POST', CPullOptions::GetPublishUrl($channelId), CUtil::PhpToJsObject(Array('MESSAGE' => Array($arData), 'ERROR' => '')));
				}

				return Array(
					'CHANNEL_ID' => $arRes['CHANNEL_ID'],
					'CHANNEL_DT' => MakeTimeStamp($arRes['DATE_CREATE']),
					'LAST_ID' => intval($arRes['LAST_ID']),
					'PATH' => ($nginxStatus? CPullOptions::GetListenUrl($arRes['CHANNEL_ID']): '/bitrix/components/bitrix/pull.request/ajax.php'),
					'PATH_WS' => ($nginxStatus && $webSocketStatus? CPullOptions::GetWebSocketUrl($arRes['CHANNEL_ID']): ''),
					'METHOD' => ($nginxStatus? 'LONG': 'PULL'),
				);
			}
			else
			{
				self::Delete($arRes['CHANNEL_ID']);
			}
		}

		$channelId = self::Add($userId);
		return $channelId? Array(
			'CHANNEL_ID' => $channelId,
			'CHANNEL_DT' => time(),
			'LAST_ID' => 0,
			'PATH' => ($nginxStatus? CPullOptions::GetListenUrl($channelId): '/bitrix/components/bitrix/pull.request/ajax.php'),
			'PATH_WS' => ($nginxStatus && $webSocketStatus? CPullOptions::GetWebSocketUrl($channelId): ''),
			'METHOD' => ($nginxStatus? 'LONG': 'PULL')
		): false;
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:56,代码来源:pull_channel.php

示例6: _AttemptExists

 function _AttemptExists($testID, $attemptID = false)
 {
     $arFields = array("STUDENT_ID" => intval($GLOBALS["USER"]->GetID()), "TEST_ID" => $testID, "STATUS" => array("B", "N"));
     if ($attemptID !== false) {
         $arFields["ID"] = $attemptID;
     }
     CTimeZone::Disable();
     $rsAttempt = CTestAttempt::GetList(array(), $arFields);
     CTimeZone::Enable();
     return $rsAttempt->GetNext();
 }
开发者ID:Satariall,项目名称:izurit,代码行数:11,代码来源:functions.php

示例7: SubscribeOnTime

 public function SubscribeOnTime($workflowId, $eventName, $expiresAt)
 {
     CTimeZone::Disable();
     $workflowId = preg_replace('#[^a-z0-9.]#i', '', $workflowId);
     $eventName = preg_replace('#[^a-z0-9._-]#i', '', $eventName);
     $minExpiresAt = time() + static::getDelayMinLimit(false);
     if ($minExpiresAt > $expiresAt) {
         $expiresAt = $minExpiresAt;
     }
     $result = CAgent::AddAgent("CBPSchedulerService::OnAgent('" . $workflowId . "', '" . $eventName . "', array('SchedulerService' => 'OnAgent'));", "bizproc", "N", 10, "", "Y", date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $expiresAt));
     CTimeZone::Enable();
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:13,代码来源:schedulerservice.php

示例8: IsHistoryUpdate

 public static function IsHistoryUpdate($documentID)
 {
     static $arHistoryFields = array("ID", "DOCUMENT_ID", "MODIFIED", "DOCUMENT");
     $historyService = self::GetHistoryService();
     $result = false;
     if (self::IsGlueEnabled()) {
         $arFilter = array("DOCUMENT_ID" => $documentID, "USER_ID" => CUser::GetID());
         $dbDoc = $historyService->GetHistoryList(array("ID" => "DESC"), $arFilter, false, false, $arHistoryFields);
         CTimeZone::Disable();
         if ($dbDoc && ($arDoc = $dbDoc->Fetch())) {
             CTimeZone::Enable();
             if (CWebdavDocumentHistory::GetHistoryState($documentID, $arDoc['ID'], $arDoc) == 'Y') {
                 $result = $arDoc;
             }
         } else {
             CTimeZone::Enable();
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:20,代码来源:iblockbizprochistory.php

示例9: SubscribeOnTime

 public function SubscribeOnTime($workflowId, $eventName, $expiresAt)
 {
     CTimeZone::Disable();
     $result = CAgent::AddAgent("CBPSchedulerService::OnAgent('" . $workflowId . "', '" . $eventName . "', array('SchedulerService' => 'OnAgent'));", "bizproc", "N", 10, "", "Y", date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $expiresAt));
     CTimeZone::Enable();
     return $result;
 }
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:7,代码来源:schedulerservice.php

示例10: checkDatabaseServerTime

 public function checkDatabaseServerTime($secondsDrift = 600)
 {
     global $DB;
     CTimeZone::Disable();
     $sql = "select " . $DB->DateFormatToDB("YYYY-MM-DD HH:MI:SS", $DB->GetNowFunction()) . " DB_TIME from b_user";
     $query = $DB->Query($DB->TopSql($sql, 1));
     $record = $query->Fetch();
     CTimeZone::Enable();
     $dbTime = $record ? MakeTimeStamp($record["DB_TIME"], "YYYY-MM-DD HH:MI:SS") : 0;
     $webTime = time();
     if ($dbTime) {
         if ($dbTime > $webTime + $secondsDrift) {
             return false;
         } elseif ($dbTime < $webTime - $secondsDrift) {
             return false;
         } else {
             return true;
         }
     }
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:class.php

示例11: Update

 public static function Update($ID, $arFields)
 {
     global $DB;
     $e = GetModuleEvents('timeman', 'OnBeforeTMReportDailyUpdate');
     while ($a = $e->Fetch()) {
         if (false === ExecuteModuleEventEx($a, array(&$arFields))) {
             return false;
         }
     }
     if (!self::CheckFields('UPDATE', $arFields)) {
         return false;
     }
     CTimeZone::Disable();
     $strUpdate = $DB->PrepareUpdate('b_timeman_report_daily', $arFields);
     CTimeZone::Enable();
     $query = 'UPDATE b_timeman_report_daily SET ' . $strUpdate . ' WHERE ID=\'' . intval($ID) . '\'';
     if (($dbRes = $DB->Query($query)) && $dbRes->AffectedRowsCount() > 0) {
         $arBinds = array();
         if (isset($arFields['REPORT'])) {
             $arBinds['REPORT'] = $arFields['REPORT'];
         }
         if (isset($arFields['TASKS'])) {
             $arBinds['TASKS'] = $arFields['TASKS'];
         }
         if (isset($arFields['EVENTS'])) {
             $arBinds['EVENTS'] = $arFields['EVENTS'];
         }
         if (count($arBinds) > 0) {
             $DB->QueryBind($query, $arBinds);
         }
         $e = GetModuleEvents('timeman', 'OnAfterTMReportDailyUpdate');
         while ($a = $e->Fetch()) {
             ExecuteModuleEventEx($a, array($ID, $arFields));
         }
         return $ID;
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:timeman_report_daily.php

示例12: GetUnreadMessage

 public function GetUnreadMessage($arParams = array())
 {
     global $DB;
     $bSpeedCheck = isset($arParams['SPEED_CHECK']) && $arParams['SPEED_CHECK'] == 'N' ? false : true;
     $lastId = !isset($arParams['LAST_ID']) || $arParams['LAST_ID'] == null ? null : IntVal($arParams['LAST_ID']);
     $order = isset($arParams['ORDER']) && $arParams['ORDER'] == 'ASC' ? 'ASC' : 'DESC';
     $loadDepartment = isset($arParams['LOAD_DEPARTMENT']) && $arParams['LOAD_DEPARTMENT'] == 'N' ? false : true;
     $bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N' ? false : true;
     $bGroupByChat = isset($arParams['GROUP_BY_CHAT']) && $arParams['GROUP_BY_CHAT'] == 'Y' ? true : false;
     $bUserLoad = isset($arParams['USER_LOAD']) && $arParams['USER_LOAD'] == 'N' ? false : true;
     $bFileLoad = isset($arParams['FILE_LOAD']) && $arParams['FILE_LOAD'] == 'N' ? false : true;
     $arExistUserData = isset($arParams['EXIST_USER_DATA']) && is_array($arParams['EXIST_USER_DATA']) ? $arParams['EXIST_USER_DATA'] : array();
     $messageType = isset($arParams['MESSAGE_TYPE']) && in_array($arParams['MESSAGE_TYPE'], array(IM_MESSAGE_OPEN, IM_MESSAGE_CHAT)) ? $arParams['MESSAGE_TYPE'] : 'ALL';
     $arMessages = array();
     $arUnreadMessage = array();
     $arUsersMessage = array();
     $arResult = array('message' => array(), 'unreadMessage' => array(), 'usersMessage' => array(), 'users' => array(), 'userInGroup' => array(), 'woUserInGroup' => array(), 'files' => array(), 'countMessage' => 0, 'chat' => array(), 'userChatBlockStatus' => array(), 'userInChat' => array(), 'result' => false);
     $bLoadMessage = $bSpeedCheck ? CIMMessenger::SpeedFileExists($this->user_id, IM_SPEED_GROUP) : false;
     $count = CIMMessenger::SpeedFileGet($this->user_id, IM_SPEED_GROUP);
     if (!$bLoadMessage || $bLoadMessage && intval($count) > 0) {
         $ssqlLastId = "R1.LAST_ID";
         $ssqlStatus = " AND R1.STATUS < " . IM_STATUS_READ;
         if (!is_null($lastId) && intval($lastId) > 0 && !CIMMessenger::CheckXmppStatusOnline()) {
             $ssqlLastId = intval($lastId);
             $ssqlStatus = "";
         }
         $arRelations = array();
         if (strlen($ssqlStatus) > 0) {
             $strSql = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tR1.USER_ID,\n\t\t\t\t\t\tR1.CHAT_ID,\n\t\t\t\t\t\tR1.LAST_ID\n\t\t\t\t\tFROM\n\t\t\t\t\t\tb_im_relation R1\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tR1.USER_ID = " . $this->user_id . "\n\t\t\t\t\t\t" . ($messageType == 'ALL' ? "AND R1.MESSAGE_TYPE IN ('" . IM_MESSAGE_OPEN . "','" . IM_MESSAGE_CHAT . "')" : "AND R1.MESSAGE_TYPE = '" . $messageType . "'") . "\n\t\t\t\t\t\t" . $ssqlStatus . "\n\t\t\t\t";
             $dbSubRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             while ($arRes = $dbSubRes->Fetch()) {
                 $arRelations[] = $arRes;
             }
         }
         $arMessageId = array();
         $arMessageChatId = array();
         $arLastMessage = array();
         $arMark = array();
         $arChat = array();
         $arPrepareResult = array();
         $arFilteredResult = array();
         if (!empty($arRelations)) {
             if (!$bTimeZone) {
                 CTimeZone::Disable();
             }
             $strSql = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tM.ID,\n\t\t\t\t\t\tM.CHAT_ID,\n\t\t\t\t\t\tM.MESSAGE,\n\t\t\t\t\t\t" . $DB->DatetimeToTimestampFunction('M.DATE_CREATE') . " DATE_CREATE,\n\t\t\t\t\t\tM.AUTHOR_ID,\n\t\t\t\t\t\tR1.STATUS R1_STATUS,\n\t\t\t\t\t\tR1.MESSAGE_TYPE MESSAGE_TYPE\n\t\t\t\t\tFROM b_im_message M\n\t\t\t\t\tINNER JOIN b_im_relation R1 ON M.ID > " . $ssqlLastId . " AND M.CHAT_ID = R1.CHAT_ID AND R1.USER_ID != M.AUTHOR_ID\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tR1.USER_ID = " . $this->user_id . "\n\t\t\t\t\t\t" . ($messageType == 'ALL' ? "AND R1.MESSAGE_TYPE IN ('" . IM_MESSAGE_OPEN . "','" . IM_MESSAGE_CHAT . "')" : "AND R1.MESSAGE_TYPE = '" . $messageType . "'") . "\n\t\t\t\t\t\t" . $ssqlStatus . "\n\t\t\t\t";
             if (!$bTimeZone) {
                 CTimeZone::Enable();
             }
             $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
             $CCTP = new CTextParser();
             $CCTP->MaxStringLen = 200;
             $CCTP->allow = array("HTML" => "N", "ANCHOR" => $this->bHideLink ? "N" : "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => $this->bHideLink ? "N" : "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
             while ($arRes = $dbRes->Fetch()) {
                 $arPrepareResult[$arRes['CHAT_ID']][$arRes['ID']] = $arRes;
             }
             foreach ($arPrepareResult as $chatId => $arRes) {
                 if (count($arPrepareResult[$chatId]) > 100) {
                     $arPrepareResult[$chatId] = array_slice($arRes, -100, 100);
                 }
                 $arFilteredResult = array_merge($arFilteredResult, $arPrepareResult[$chatId]);
             }
             unset($arPrepareResult);
         }
         foreach ($arFilteredResult as $arRes) {
             $arUsers[] = $arRes['AUTHOR_ID'];
             $arMessages[$arRes['ID']] = array('id' => $arRes['ID'], 'chatId' => $arRes['CHAT_ID'], 'senderId' => $arRes['AUTHOR_ID'], 'recipientId' => $arRes['CHAT_ID'], 'date' => $arRes['DATE_CREATE'], 'text' => $arRes['MESSAGE'], 'messageType' => $arRes['MESSAGE_TYPE']);
             if ($bGroupByChat) {
                 $arMessages[$arRes['ID']]['conversation'] = $arRes['CHAT_ID'];
                 $arMessages[$arRes['ID']]['unread'] = $this->user_id != $arRes['AUTHOR_ID'] ? 'Y' : 'N';
             } else {
                 $arUsersMessage[$arRes['CHAT_ID']][] = $arRes['ID'];
                 if ($this->user_id != $arRes['AUTHOR_ID']) {
                     $arUnreadMessage[$arRes['CHAT_ID']][] = $arRes['ID'];
                 }
             }
             if ($arRes['R1_STATUS'] == IM_STATUS_UNREAD && (!isset($arMark[$arRes["CHAT_ID"]]) || $arMark[$arRes["CHAT_ID"]] < $arRes["ID"])) {
                 $arMark[$arRes["CHAT_ID"]] = $arRes["ID"];
             }
             if (!isset($arLastMessage[$arRes["CHAT_ID"]]) || $arLastMessage[$arRes["CHAT_ID"]] < $arRes["ID"]) {
                 $arLastMessage[$arRes["CHAT_ID"]] = $arRes["ID"];
             }
             $arChat[$arRes["CHAT_ID"]] = $arRes["CHAT_ID"];
             $arMessageId[] = $arRes['ID'];
             $arMessageChatId[$arRes['CHAT_ID']][$arRes["ID"]] = $arRes["ID"];
         }
         $params = CIMMessageParam::Get($arMessageId);
         if ($bFileLoad) {
             foreach ($arMessageChatId as $chatId => $messages) {
                 $files = array();
                 foreach ($messages as $messageId) {
                     $arMessages[$messageId]['params'] = $params[$messageId];
                     if (isset($params[$messageId]['FILE_ID'])) {
                         foreach ($params[$messageId]['FILE_ID'] as $fileId) {
                             $files[$fileId] = $fileId;
                         }
                     }
                 }
                 $arMessageFiles = CIMDisk::GetFiles($chatId, $files);
                 foreach ($arMessageFiles as $key => $value) {
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:im_chat.php

示例13: GetRecentList

	public static function GetRecentList($arParams = Array())
	{
		global $DB, $USER;

		$bLoadUnreadMessage = isset($arParams['LOAD_UNREAD_MESSAGE']) && $arParams['LOAD_UNREAD_MESSAGE'] == 'Y'? true: false;
		$bTimeZone = isset($arParams['USE_TIME_ZONE']) && $arParams['USE_TIME_ZONE'] == 'N'? false: true;
		$bSmiles = isset($arParams['USE_SMILES']) && $arParams['USE_SMILES'] == 'N'? false: true;

		$nameTemplate = COption::GetOptionString("im", "user_name_template", "#LAST_NAME# #NAME#", SITE_ID);
		$nameTemplateSite = CSite::GetNameFormat(false);
		$nameOfSite = CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser()? "ex": false;
		$bIntranetEnable = IsModuleInstalled('intranet') && CModule::IncludeModule('intranet')? true: false;

		$arRecent = Array();
		$arUsers = Array();

		$cache_ttl = 2592000;
		$cache_id = $GLOBALS['USER']->GetID();
		$cache_dir = '/bx/imc/rec'.CIMMessenger::GetCachePath($cache_id);
		$obCache = new CPHPCache();
		if($obCache->InitCache($cache_ttl, $cache_id, $cache_dir))
		{
			$ar = $obCache->GetVars();
			$arRecent = $ar['recent'];
			$arUsers = $ar['users'];
		}
		else
		{
			if (!$bTimeZone)
				CTimeZone::Disable();
			$strSql = "
				SELECT
					R.ITEM_TYPE, R.ITEM_ID,
					R.ITEM_MID M_ID, M.AUTHOR_ID M_AUTHOR_ID, M.MESSAGE M_MESSAGE, ".$DB->DatetimeToTimestampFunction('M.DATE_CREATE')." M_DATE_CREATE,
					C.TITLE C_TITLE, C.AUTHOR_ID C_OWNER_ID,
					U.LOGIN, U.NAME, U.LAST_NAME, U.PERSONAL_PHOTO, U.SECOND_NAME, U.PERSONAL_BIRTHDAY, U.PERSONAL_GENDER
				FROM
				b_im_recent R
				LEFT JOIN b_user U ON R.ITEM_TYPE = '".IM_MESSAGE_PRIVATE."' AND R.ITEM_ID = U.ID
				LEFT JOIN b_im_chat C ON R.ITEM_TYPE = '".IM_MESSAGE_GROUP."' AND R.ITEM_ID = C.ID
				LEFT JOIN b_im_message M ON R.ITEM_MID = M.ID
				WHERE R.USER_ID = ".$USER->GetId();
			if (!$bTimeZone)
				CTimeZone::Enable();

			$toDelete = Array();
			$CCTP = new CTextParser();
			$CCTP->MaxStringLen = 255;
			$CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => ($bSmiles? "Y": "N"), "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
			$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
			while ($arRes = $dbRes->GetNext(true, false))
			{
				$arRes['ITEM_TYPE'] = trim($arRes['ITEM_TYPE']);
				if ($arRes['M_DATE_CREATE']+2592000 < time())
				{
					$toDelete[$arRes['ITEM_TYPE']][] = $arRes['ITEM_ID'];
					continue;
				}

				$itemId = $arRes['ITEM_ID'];
				$item = Array(
					'TYPE' => $arRes['ITEM_TYPE'],
					'MESSAGE' => Array(
						'id' => $arRes['M_ID'],
						'senderId' => $arRes['M_AUTHOR_ID'],
						'date' => $arRes['M_DATE_CREATE'],
						'text' => $CCTP->convertText(preg_replace("/\[s\].*?\[\/s\]/i", "", $arRes['M_MESSAGE']))
					)
				);
				$item['MESSAGE']['text'] = preg_replace("/------------------------------------------------------(.*)------------------------------------------------------/mi", " [".GetMessage('IM_QUOTE')."] ", strip_tags(str_replace(array("<br>","<br/>","<br />", "#BR#"), Array(" "," ", " ", " "), $item['MESSAGE']['text']), "<img>"));
				if ($arRes['ITEM_TYPE'] == IM_MESSAGE_PRIVATE)
				{
					$arUsers[] = $arRes['ITEM_ID'];
					$arFileTmp = CFile::ResizeImageGet(
						$arRes["PERSONAL_PHOTO"],
						array('width' => 58, 'height' => 58),
						BX_RESIZE_IMAGE_EXACT,
						false
					);

					$item['USER'] = Array(
						'id' => $arRes['ITEM_ID'],
						'name' => CUser::FormatName($nameTemplateSite, $arRes, true, false),
						'nameList' => CUser::FormatName($nameTemplate, $arRes, true, false),
						'avatar' => empty($arFileTmp['src'])? '/bitrix/js/im/images/blank.gif': $arFileTmp['src'],
						'gender' => $arRes['PERSONAL_GENDER'] == 'F'? 'F': 'M',
						'status' => 'offline',
						'birthday' => $arRes['PERSONAL_BIRTHDAY'],
						'profile' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('im', 'path_to_user_profile', "", $nameOfSite), array("user_id" => $arRes["ITEM_ID"]))
					);
				}
				else
				{
					$itemId = 'chat'.$itemId;
					$item['CHAT'] = Array(
						'id' => $arRes['ITEM_ID'],
						'name' => $arRes["C_TITLE"],
						'owner' => $arRes["C_OWNER_ID"],
					);
				}
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:im_contact_list.php

示例14: BuildRSS


//.........这里部分代码省略.........
						$BlogUser = CBlogUser::GetByID($arPost["AUTHOR_ID"], BLOG_BY_USER_ID);
						$authorP = htmlspecialcharsex(CBlogUser::GetUserName($BlogUser["ALIAS"], $arUser["NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["SECOND_NAME"]));
						if(strLen($arPathTemplate["PATH_TO_USER"])>0)
							$authorURLP = htmlspecialcharsbx("http://".$serverName.CComponentEngine::MakePathFromTemplate($arPathTemplate["PATH_TO_USER"], array("user_id"=>$arPost["AUTHOR_ID"])));
						else
							$authorURLP = "http://".$serverName.CBlogUser::PreparePath($arPost["AUTHOR_ID"], $arGroup["SITE_ID"]);

						$rssText .= "  <author>\n";
						$rssText .= "  		<name>".$authorP."</name>\n";
						$rssText .= "  		<uri>".$authorURLP."</uri>\n";
						$rssText .= "  </author>\n";

						$rssText .= "\n";
					}

					$user_id = $GLOBALS["USER"]->GetID();
					if($arPathTemplate["USE_SOCNET"] == "Y")
					{
						$postPerm = CBlogPost::GetSocNetPostPerms($postID);
						if($postPerm > BLOG_PERMS_DENY)
							$postPerm = CBlogComment::GetSocNetUserPerms($postID, $arPost["AUTHOR_ID"]);
					}
					else
						$postPerm = CBlogPost::GetBlogUserCommentPerms($postID, IntVal($user_id));

					if($postPerm >= BLOG_PERMS_READ)
					{
						$parser = new blogTextParser();
						$arParserParams = Array(
							"imageWidth" => $arPathTemplate["IMAGE_MAX_WIDTH"],
							"imageHeight" => $arPathTemplate["IMAGE_MAX_HEIGHT"],
						);

						CTimeZone::Disable();
						$dbComments = CBlogComment::GetList(
							array("DATE_CREATE" => "DESC"),
							array(
								//"BLOG_ID" => $blogID,
								"POST_ID" => $postID,
								"PUBLISH_STATUS" => BLOG_PUBLISH_STATUS_PUBLISH,
							),
							false,
							array("nTopCount" => $numPosts),
							array("ID", "TITLE", "DATE_CREATE", "POST_TEXT", "AUTHOR_EMAIL", "AUTHOR_ID", "AUTHOR_NAME", "USER_LOGIN", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_NAME", "BLOG_USER_ALIAS")
						);
						CTimeZone::Enable();
						$arImages = Array();
						$dbImages = CBlogImage::GetList(Array(), Array("BLOG_ID" => $blogID, "POST_ID" => $postID, "IS_COMMENT" => "Y", "!COMMENT_ID" => false));
						while($arI = $dbImages->Fetch())
							$arImages[$arI["ID"]] = $arI["FILE_ID"];

						while ($arComments = $dbComments->Fetch())
						{
							$arDate = ParseDateTime($arComments["DATE_CREATE"], CSite::GetDateFormat("FULL", $arGroup["SITE_ID"]));
							$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));

							if(strpos($url, "?") !== false)
								$url1 = $url."&amp;";
							else
								$url1 = $url."?";
							$url1 .= "commentId=".$arComments["ID"]."#".$arComments["ID"];

							$authorURL = "";
							if(IntVal($arComments["AUTHOR_ID"]) > 0)
							{
								$author = CBlogUser::GetUserName($arComments["BLOG_USER_ALIAS"], $arComments["USER_NAME"], $arComments["USER_LAST_NAME"], $arComments["USER_LOGIN"], $arComments["USER_SECOND_NAME"]);
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:blog_comment.php

示例15: Sync

 public static function Sync($ldap_server_id)
 {
     global $DB, $USER, $APPLICATION;
     if (!is_object($USER)) {
         $USER = new CUser();
         $bUSERGen = true;
     }
     $dbLdapServers = CLdapServer::GetById($ldap_server_id);
     if (!($oLdapServer = $dbLdapServers->GetNextServer())) {
         return false;
     }
     if (!$oLdapServer->Connect()) {
         return false;
     }
     if (!$oLdapServer->BindAdmin()) {
         $oLdapServer->Disconnect();
         return false;
     }
     $APPLICATION->ResetException();
     $db_events = GetModuleEvents("ldap", "OnLdapBeforeSync");
     while ($arEvent = $db_events->Fetch()) {
         $arParams['oLdapServer'] = $oLdapServer;
         if (ExecuteModuleEventEx($arEvent, array(&$arParams)) === false) {
             if (!($err = $APPLICATION->GetException())) {
                 $APPLICATION->ThrowException("Unknown error");
             }
             return false;
         }
     }
     // select all users from LDAP
     $arLdapUsers = array();
     $ldapLoginAttr = strtolower($oLdapServer->arFields["~USER_ID_ATTR"]);
     $APPLICATION->ResetException();
     $dbLdapUsers = $oLdapServer->GetUserList();
     $ldpEx = $APPLICATION->GetException();
     while ($arLdapUser = $dbLdapUsers->Fetch()) {
         $arLdapUsers[strtolower($arLdapUser[$ldapLoginAttr])] = $arLdapUser;
     }
     unset($dbLdapUsers);
     // select all Bitrix CMS users for this LDAP
     $arUsers = array();
     CTimeZone::Disable();
     $dbUsers = CUser::GetList($o, $b, array("EXTERNAL_AUTH_ID" => "LDAP#" . $ldap_server_id));
     CTimeZone::Enable();
     while ($arUser = $dbUsers->Fetch()) {
         $arUsers[strtolower($arUser["LOGIN"])] = $arUser;
     }
     unset($dbUsers);
     if (!$ldpEx || $ldpEx->msg != 'LDAP_SEARCH_ERROR') {
         $arDelLdapUsers = array_diff(array_keys($arUsers), array_keys($arLdapUsers));
     }
     if (strlen($oLdapServer->arFields["SYNC_LAST"]) > 0) {
         $syncTime = MakeTimeStamp($oLdapServer->arFields["SYNC_LAST"]);
     } else {
         $syncTime = 0;
     }
     $arCache = array();
     // selecting a list of groups, from which users will not be imported
     $noImportGroups = array();
     $dbGroups = CLdapServer::GetGroupBan($ldap_server_id);
     while ($arGroup = $dbGroups->Fetch()) {
         $noImportGroups[md5($arGroup['LDAP_GROUP_ID'])] = $arGroup['LDAP_GROUP_ID'];
     }
     $cnt = 0;
     // have to update $oLdapServer->arFields["FIELD_MAP"] for user fields
     // for each one of them looking for similar in user list
     foreach ($arLdapUsers as $userLogin => $arLdapUserFields) {
         if (!is_array($arUsers[$userLogin])) {
             if ($oLdapServer->arFields["SYNC_USER_ADD"] != "Y") {
                 continue;
             }
             // if user is not found among already existing ones, then import him
             // в $arLdapUserFields - user fields from ldap
             $userActive = $oLdapServer->getLdapValueByBitrixFieldName("ACTIVE", $arLdapUserFields);
             if ($userActive != "Y") {
                 continue;
             }
             $arUserFields = $oLdapServer->GetUserFields($arLdapUserFields, $departmentCache);
             // $arUserFields here contains LDAP user fields for a LDAP user
             // make a check, whether this user belongs to those groups only, from which import will not be made...
             $allUserGroups = $arUserFields['LDAP_GROUPS'];
             $userImportIsBanned = true;
             foreach ($allUserGroups as $groupId) {
                 $groupId = trim($groupId);
                 if (!empty($groupId) && !array_key_exists(md5($groupId), $noImportGroups)) {
                     $userImportIsBanned = false;
                     break;
                 }
             }
             // ...if he does not, then import him
             if (!$userImportIsBanned || empty($allUserGroups)) {
                 $oLdapServer->SetUser($arUserFields);
             }
         } else {
             // if date of update is set, then compare it
             $ldapTime = time();
             if ($syncTime > 0 && strlen($oLdapServer->arFields["SYNC_ATTR"]) > 0 && preg_match("'([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\\.0Z'", $arLdapUserFields[strtolower($oLdapServer->arFields["SYNC_ATTR"])], $arTimeMatch)) {
                 $ldapTime = gmmktime($arTimeMatch[4], $arTimeMatch[5], $arTimeMatch[6], $arTimeMatch[2], $arTimeMatch[3], $arTimeMatch[1]);
                 $userTime = MakeTimeStamp($arUsers[$userLogin]["TIMESTAMP_X"]);
             }
//.........这里部分代码省略.........
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:ldap_server.php


注:本文中的CTimeZone::Disable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。