本文整理汇总了PHP中CUser::SetLastActivityDate方法的典型用法代码示例。如果您正苦于以下问题:PHP CUser::SetLastActivityDate方法的具体用法?PHP CUser::SetLastActivityDate怎么用?PHP CUser::SetLastActivityDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::SetLastActivityDate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnBeforeProlog
public static function OnBeforeProlog()
{
if (!$GLOBALS["USER"]->IsAuthorized()) {
return;
}
CUser::SetLastActivityDate($GLOBALS["USER"]->GetID());
}
示例2: SetOnline
public static function SetOnline($userId = null, $cache = false)
{
global $USER;
if (is_null($userId))
$userId = $USER->GetId();
$userId = intval($userId);
if ($userId <= 0)
return false;
if ($cache && $userId == $USER->GetId())
{
if (isset($_SESSION['USER_LAST_ONLINE_'.$userId]) && intval($_SESSION['USER_LAST_ONLINE_'.$userId])+60 > time())
return false;
$_SESSION['USER_LAST_ONLINE_'.$userId] = time();
}
CUser::SetLastActivityDate($userId);
return true;
}
示例3: CustomSetLastActivityDate
function CustomSetLastActivityDate()
{
global $USER;
CUser::SetLastActivityDate($USER->GetID());
}
示例4: __ReportKernel
private function __ReportKernel()
{
foreach ($this->arClientsIndex as $clientDomain => $arDomainClientsIndex) {
if (!CXMPPUtility::SelectDatabase($clientDomain)) {
continue;
}
if (count($arDomainClientsIndex) <= 0) {
continue;
}
foreach ($arDomainClientsIndex as $jid => $arId) {
foreach ($arId as $id) {
if (array_key_exists($id, $this->arClients)) {
if ($this->arClients[$id]->IsConnected() && $this->arClients[$id]->IsAuthenticated()) {
$idTmp = $this->arClients[$id]->GetId();
CUser::SetLastActivityDate($idTmp);
CXMPPClient::SetLastActivityDate($idTmp);
}
}
}
}
$arOnlineOnSiteTmp = array();
$dbUsers = CUser::GetList($b = "LOGIN", $o = "DESC", array("ACTIVE" => "Y", "LAST_ACTIVITY" => 600, "!UF_DEPARTMENT" => false), array('FIELDS' => array('ID', 'LOGIN')));
while ($arUser = $dbUsers->Fetch()) {
$arOnlineOnSiteTmp[] = CXMPPUtility::GetJId($arUser, $clientDomain);
}
if (!is_array($this->arOnlineOnSite[$clientDomain])) {
$this->arOnlineOnSite[$clientDomain] = array();
}
$arOffline = array_diff($this->arOnlineOnSite[$clientDomain], $arOnlineOnSiteTmp);
foreach ($arOffline as $jid) {
if (!array_key_exists($jid, $this->arClientsIndex[$clientDomain]) || array_key_exists($jid, $this->arClientsIndex[$clientDomain]) && count($this->arClientsIndex[$clientDomain][$jid]) <= 0) {
$this->SendAll(array("presence" => array("." => array("type" => "unavailable", "from" => $jid))));
}
}
$arOnline = array_diff($arOnlineOnSiteTmp, $this->arOnlineOnSite[$clientDomain]);
foreach ($arOnline as $jid) {
if (!array_key_exists($jid, $this->arClientsIndex[$clientDomain]) || array_key_exists($jid, $this->arClientsIndex[$clientDomain]) && count($this->arClientsIndex[$clientDomain][$jid]) <= 0) {
$this->SendAll(array("presence" => array("." => array("from" => $jid))));
}
}
$this->arOnlineOnSite[$clientDomain] = $arOnlineOnSiteTmp;
}
}
示例5: CustomSetLastActivityDate
function CustomSetLastActivityDate()
{
if ($GLOBALS['USER']->IsAuthorized()) {
CUser::SetLastActivityDate($GLOBALS['USER']->GetID());
}
}
示例6: time
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!defined('PUBLIC_AJAX_MODE') && !IsModuleInstalled("im") && $GLOBALS["USER"]->IsAuthorized() && (!isset($_SESSION["USER_LAST_ONLINE"]) || intval($_SESSION["USER_LAST_ONLINE"]) + 60 <= time())) {
$_SESSION["USER_LAST_ONLINE"] = time();
CUser::SetLastActivityDate($GLOBALS["USER"]->GetID());
}
示例7: ReceiveMessage
public function ReceiveMessage($senderJId, array $arMessage, CXMPPClient $senderClient)
{
if (!$senderClient->IsAuthenticated()) {
return false;
}
if (strlen($senderJId) <= 0) {
return false;
}
if (!array_key_exists("presence", $arMessage) || !array_key_exists(".", $arMessage["presence"])) {
return false;
}
$type = "available";
if (array_key_exists("type", $arMessage["presence"]["."])) {
$type = $arMessage["presence"]["."]["type"];
}
if ($type == "error") {
return false;
}
// available (empty) - Signals that the sender is online and available for communication.
// unavailable - Signals that the sender is no longer available for communication.
// subscribe - The sender wishes to subscribe to the recipient's presence.
// subscribed - The sender has allowed the recipient to receive their presence.
// unsubscribe - The sender is unsubscribing from another entity's presence.
// unsubscribed - The subscription request has been denied or a previously-granted subscription has been cancelled.
// probe - A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user.
// error - An error has occurred regarding processing or delivery of a previously-sent presence stanza.
if (!in_array($type, array("available", "unavailable", "subscribe", "subscribed", "unsubscribe", "unsubscribed", "probe"))) {
return CXMPPUtility::GetErrorArray($senderJId, "presence", "modify", "bad-request", "", "", "", $senderClient->GetClientDomain());
}
$to = "";
if (array_key_exists("to", $arMessage["presence"]["."])) {
$to = $arMessage["presence"]["."]["to"];
}
$server = CXMPPServer::GetServer();
if (strlen($to) <= 0) {
$server->SendAll($arMessage, $senderClient->GetClientDomain());
} else {
$server->Send($to, $arMessage, $senderClient->GetClientDomain());
}
if (!in_array($type, array("available"))) {
return true;
}
$userJId = $senderJId;
$show = "online";
if (array_key_exists("show", $arMessage["presence"])) {
$show = $arMessage["presence"]["show"]["#"];
}
$status = "";
if (array_key_exists("status", $arMessage["presence"])) {
$status = $arMessage["presence"]["status"]["#"];
}
$priority = 0;
if (array_key_exists("priority", $arMessage["presence"])) {
$priority = intval($arMessage["presence"]["priority"]["#"]);
}
$arUser = CXMPPUtility::GetUserByJId($userJId);
if (!$arUser) {
return CXMPPUtility::GetErrorArray($senderJId, "presence", "auth", "forbidden", "", "", "", $senderClient->GetClientDomain());
}
CUser::SetLastActivityDate($arUser["ID"]);
CXMPPFactory::SendUnreadMessages($senderJId, $senderClient->GetClientDomain());
$senderClient->ChangeWorkPresence("Status", $show);
return true;
}