• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/rest.php
  • Класс: BitrixImOpenLinesRest
  • Вызов: Rest::widgetVoteSend
static function widgetVoteSend($params, $n, CRestServer $server)
{
	if ($server->getAuthType() != WidgetAuth::AUTH_TYPE)
	{
		throw new RestException('Access for this method allowed only by livechat authorization.', 'WRONG_AUTH_TYPE', CRestServer::STATUS_FORBIDDEN);
	}

	$params = array_change_key_case($params, CASE_UPPER);

	$params['SESSION_ID'] = (int)$params['SESSION_ID'];
	if ($params['SESSION_ID'] <= 0)
	{
		throw new RestException('Session id is not specified.', 'SESSION_ID_EMPTY', CRestServer::STATUS_WRONG_REQUEST);
	}

	$action = mb_strtolower($params['ACTION']);

	Session::voteAsUser($params['SESSION_ID'], $action);

	return true;
}