uawdijnntqw1x1x1
IP : 216.73.216.207
Hostname : xhost1.intravision.ru
Kernel : Linux xhost1.intravision.ru 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) 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
/
tiskom
/
data
/
www
/
tiskom.xhost.intravision.ru
/
bitrix
/
modules
/
main
/
lib
/
userconsent
/
.
/
rest.php
/
/
<?php /** * Bitrix Framework * @package bitrix * @subpackage main * @copyright 2001-2016 Bitrix */ namespace Bitrix\Main\UserConsent; use Bitrix\Main\Error; use Bitrix\Rest\RestException; /** * Class Rest * @package Bitrix\Main\UserConsent */ class Rest { /** * Get agreement list. * * @param array $query Query parameters. * @param int $nav Navigation. * @param \CRestServer $server Rest server. * @return array */ public static function getAgreementList($query, $nav = 0, \CRestServer $server) { return Internals\AgreementTable::getList(array( 'select' => array('ID', 'NAME', 'ACTIVE', 'LANGUAGE_ID'), 'order' => array('ID' => 'DESC') ))->fetchAll(); } /** * Get agreement text. * * @param array $query Query parameters. * @param int $nav Navigation. * @param \CRestServer $server Rest server. * @return array * @throws RestException */ public static function getAgreementText($query, $nav = 0, \CRestServer $server) { $query = array_change_key_case($query, CASE_LOWER); $id = empty($query['id']) ? null : $query['id']; $replace = empty($query['replace']) ? [] : $query['replace']; $replace = is_array($replace) ? $replace : []; $agreement = self::getAgreementById($id); $agreement->setReplace($replace); return [ 'LABEL' => $agreement->getLabelText(), 'TEXT' => $agreement->getText(), ]; } /** * Add consent. * * @param array $query Query parameters. * @param int $nav Navigation. * @param \CRestServer $server Rest server. * @return int * @throws RestException */ public static function addConsent($query, $nav = 0, \CRestServer $server) { $query = array_change_key_case($query, CASE_UPPER); $agreementId = isset($query['AGREEMENT_ID']) ? $query['AGREEMENT_ID'] : null; self::getAgreementById($agreementId); $result = Internals\ConsentTable::add([ 'AGREEMENT_ID' => $agreementId, 'USER_ID' => isset($query['USER_ID']) ? $query['USER_ID'] : null, 'IP' => isset($query['IP']) ? $query['IP'] : null, 'URL' => isset($query['URL']) ? $query['URL'] : null, 'ORIGIN_ID' => isset($query['ORIGIN_ID']) ? $query['ORIGIN_ID'] : null, 'ORIGINATOR_ID' => isset($query['ORIGINATOR_ID']) ? $query['ORIGINATOR_ID'] : null, ]); if (!$result->isSuccess()) { self::printErrors($result->getErrors()); } return $result->getId(); } /** * Get agreement instance by ID. * * @param int|null $id ID. * @return Agreement * @throws RestException */ protected static function getAgreementById($id) { $agreement = new Agreement($id); if ($agreement->hasErrors()) { self::printErrors($agreement->getErrors()); } return $agreement; } /** * Print rest errors. * * @param Error[] $errors Errors. * @throws RestException */ protected static function printErrors(array $errors) { foreach ($errors as $error) { throw new RestException( $error->getMessage(), RestException::ERROR_ARGUMENT, \CRestServer::STATUS_WRONG_REQUEST ); } } }
/var/www/tiskom/data/www/tiskom.xhost.intravision.ru/bitrix/modules/main/lib/userconsent/./rest.php