1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
agreement.php
См. документацию.
1
<?php
2
namespace
Bitrix\Main\Controller
;
3
4
use
Bitrix\Main\Engine
;
5
use
Bitrix\Main\Engine\ActionFilter\Authentication
;
6
use
Bitrix\Main\Error
;
7
use
Bitrix\Main\UserConsent
;
8
9
class
Agreement
extends
Engine\Controller
10
{
11
public
function
configureActions
()
12
{
13
return
[
14
'get'
=> [
15
'-prefilters'
=> [
16
Authentication::class,
17
Engine\ActionFilter\Csrf::class,
18
],
19
],
20
];
21
}
22
23
public
function
getAction
(
int
$id,
string
$sec,
array
$replace):
array
24
{
25
$agreement = $this->getAgreement($id, $sec);
26
if
(!$agreement)
27
{
28
return
[];
29
}
30
31
$agreement->setReplace($replace);
32
33
$result
= [
34
'id'
=> $agreement->getId(),
35
'title'
=> $agreement->getTitle(),
36
'label'
=> $agreement->getLabel(),
37
'url'
=> $agreement->getUrl(),
38
'content'
=> [
39
'text'
=> $agreement->getText(),
40
'html'
=> $agreement->getHtml(),
41
],
42
];
43
44
return
$result
;
45
}
46
47
private
function
getAgreement(
int
$id,
string
$sec): ?
UserConsent
\
Agreement
48
{
49
$agreement =
new
UserConsent\Agreement
($id);
50
if
(!$agreement->isExist() || !$agreement->isActive())
51
{
52
$this->
addError
(
new
Error
(
'Agreement not found'
));
53
return
null
;
54
}
55
56
$secStored = $agreement->getData()[
'SECURITY_CODE'
] ??
''
;
57
if
($secStored && $sec !== $secStored)
58
{
59
$this->
addError
(
new
Error
(
'Wrong security code'
));
60
return
null
;
61
}
62
63
return
$agreement;
64
}
65
}
66
Bitrix\Main\Controller\Agreement
Определения
agreement.php:10
Bitrix\Main\Controller\Agreement\configureActions
configureActions()
Определения
agreement.php:11
Bitrix\Main\Controller\Agreement\getAction
getAction(int $id, string $sec, array $replace)
Определения
agreement.php:23
Bitrix\Main\Engine\Controller\addError
addError(Error $error)
Определения
controller.php:1070
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\UserConsent\Agreement
Определения
agreement.php:25
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Main\Authentication
Определения
application.php:9
Bitrix\Main\Controller
Определения
agreement.php:2
Bitrix\Main\Engine
Определения
action.php:3
Bitrix\Main\UserConsent
Определения
agreement.php:8
bitrix
modules
main
lib
controller
agreement.php
Создано системой
1.14.0