• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/security/currentuser.php
  • Класс: BitrixMainSecurityCurrentUser
  • Вызов: CurrentUser::loadUser
protected function loadUser()
{
	if (!$this->isAuthenticated || !isset($this->userId))
		throw new MainSystemException("Can not load non-authenticated user");

	$connection = MainApplication::getDbConnection();

	$sql =
		"SELECT U.LOGIN, U.EMAIL, U.NAME, U.SECOND_NAME, U.LAST_NAME, U.AUTO_TIME_ZONE, U.TIME_ZONE ".
		"FROM b_user U  ".
		"WHERE U.ID = '".intval($this->userId)."' ";
	$recordset = $connection->query($sql);

	$record = $recordset->fetch();
	if (!$record)
		throw new SecurityException(sprintf("User '%s' is not found", $this->userId));

	$this->login = $record["LOGIN"];
	$this->email = $record["EMAIL"];
	$this->firstName = $record["NAME"];
	$this->secondName = $record["SECOND_NAME"];
	$this->lastName = $record["LAST_NAME"];
	$this->isAutoTimezone = trim($record["AUTO_TIME_ZONE"]);
	$this->timezone = $record["TIME_ZONE"];

	$this->checked = true;
}