uawdijnntqw1x1x1
IP : 216.73.216.163
Hostname : yjpwxulqtt
Kernel : Linux yjpwxulqtt 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,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,exec,system,passthru,shell_exec,proc_open,popen
OS : Linux
PATH:
/
home
/
user
/
web
/
pansionat-v-yaroslavle.ru
/
public_html
/
bitrix
/
modules
/
vote
/
lib
/
base
/
baseobject.php
/
/
<?php namespace Bitrix\Vote\Base; use Bitrix\Main\Error; use Bitrix\Main\ErrorCollection; use Bitrix\Main\Localization\Loc; Loc::loadMessages(__FILE__); class BaseObject { /** @var int */ protected $id; /** @var ErrorCollection */ protected $errorCollection; protected static $userGroups = array(); public function __construct($id) { if (!($id > 0)) throw new \Bitrix\Main\ArgumentNullException("id"); $this->id = $id; $this->errorCollection = new ErrorCollection; $this->init(); } /** * exists only for child class * @return void */ public function init() { } /** * @return int */ public function getId() { return $this->id; } /** * @return Error[] */ public function getErrors() { return $this->errorCollection->toArray(); } /** * @inheritdoc * Returns an error with the necessary code. * @param string|int $code The code of the error. * @return Error|null */ public function getErrorByCode($code) { return $this->errorCollection->getErrorByCode($code); } /** * @param int $userId User ID. * @return bool */ public function canRead($userId) { $groups = self::loadUserGroups($userId); $right = \CMain::getUserRight("vote", $groups); return ($right >= "R"); } /** * @param int $userId User ID. * @return bool */ public function canEdit($userId) { $groups = self::loadUserGroups($userId); $right = \CMain::getUserRight("vote", $groups); return ($right >= "W"); } /** * @return \CUser */ public function getUser() { global $USER; return $USER; } /** * @return \CMain */ public function getApplication() { global $APPLICATION; return $APPLICATION; } /** * @param integer $userId User ID. * @return array */ public static function loadUserGroups($userId) { /* @global \CUser $USER */ global $USER; if (!array_key_exists($userId, self::$userGroups)) { if ($USER->getId() == $userId) { $groups = $USER->getUserGroupArray(); } else { $groups = \Bitrix\Main\UserTable::getUserGroupIds($userId); if (empty($groups)) $groups = array(2); } self::$userGroups[$userId] = $groups; } return self::$userGroups[$userId]; } /** * @param integer $id Entity ID. * @return mixed */ public static function loadFromId($id) { $c = get_called_class(); return new $c($id); } }
/home/user/web/pansionat-v-yaroslavle.ru/public_html/bitrix/modules/vote/lib/base/baseobject.php