uawdijnntqw1x1x1
IP : 3.145.0.146
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
yar.axolotls.ru
/
bitrix
/
modules
/
blog
/
..
/
pull
/
lib
/
mobilecounter.php
/
/
<?php namespace Bitrix\Pull; class MobileCounter { const MOBILE_APP = 'Bitrix24'; public static function getTypes() { $types = Array(); $event = new \Bitrix\Main\Event("pull", "onGetMobileCounterTypes"); $event->send(); foreach ($event->getResults() as $eventResult) { if ($eventResult->getType() != \Bitrix\Main\EventResult::SUCCESS) { continue; } $result = $eventResult->getParameters(); if (!is_array($types)) { continue; } foreach ($result as $type => $config) { $config['TYPE'] = $eventResult->getModuleId().'_'.$type; $types[$eventResult->getModuleId().'_'.$type] = $config; } } return $types; } public static function get($userId = null) { if (is_null($userId) && is_object($GLOBALS['USER'])) { $userId = $GLOBALS['USER']->getId(); } $userId = intval($userId); if (!$userId) { return false; } $counter = 0; if (IsModuleInstalled('intranet')) { if (\Bitrix\Main\Loader::includeModule('im')) // TODO remove IM include! { $siteId = \Bitrix\Im\User::getInstance($userId)->isExtranet()? 'ex': 's1'; } else { $siteId = 's1'; } } else { $siteId = \Bitrix\Main\Context::getCurrent()->getSite(); if (!$siteId) { $siteId = 's1'; } } $event = new \Bitrix\Main\Event("pull", "onGetMobileCounter", array( 'USER_ID' => $userId, 'SITE_ID' => $siteId )); $event->send(); $typeStatus = self::getConfig($userId); foreach ($event->getResults() as $eventResult) { if ($eventResult->getType() != \Bitrix\Main\EventResult::SUCCESS) { continue; } $result = $eventResult->getParameters(); $type = $eventResult->getModuleId().'_'.$result['TYPE']; if ($typeStatus[$type] === false) { continue; } if (intval($result['COUNTER']) > 0) { $counter += $result['COUNTER']; } } return $counter; } public static function getConfig($userId = null) { if (is_null($userId) && is_object($GLOBALS['USER'])) { $userId = $GLOBALS['USER']->getId(); } $userId = intval($userId); if ($userId <= 0) { return false; } $types = Array(); foreach (self::getTypes() as $type => $config) { $types[$type] = $config['DEFAULT']; } $options = \CUserOptions::GetOption('pull', 'mobileCounterType', Array(), $userId); foreach ($options as $type => $default) { $types[$type] = $default; } return $types; } public static function setConfigType($type, $status, $userId = null) { return self::setConfig(Array($type => $status), $userId); } public static function setConfig($config, $userId = null) { if (!is_array($config)) { return false; } if (is_null($userId) && is_object($GLOBALS['USER'])) { $userId = $GLOBALS['USER']->getId(); } $userId = intval($userId); if ($userId <= 0) { return false; } $needUpdate = false; $types = self::getConfig($userId); foreach ($config as $type => $status) { if (!isset($types[$type])) { continue; } $types[$type] = (bool)$status; $needUpdate = true; } if ($needUpdate) { \CUserOptions::SetOption('pull', 'mobileCounterType', $types, false, $userId); } return true; } public static function send($userId = null, $appId = self::MOBILE_APP) { if (is_null($userId) && is_object($GLOBALS['USER'])) { $userId = $GLOBALS['USER']->getId(); } $userId = intval($userId); if ($userId <= 0) { return false; } \Bitrix\Pull\Push::add($userId, Array( 'module_id' => 'pull', 'push' => Array('badge' => 'Y') )); return true; } public static function onSonetLogCounterClear($counterType = '', $timestamp = 0) { $userId = is_object($GLOBALS['USER'])? intval($GLOBALS['USER']->getId()): 0; if ( $userId <= 0 || $counterType != '**' ) { return false; } self::send($userId); return true; } }
/var/www/axolotl/data/www/yar.axolotls.ru/bitrix/modules/blog/../pull/lib/mobilecounter.php