1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
agreement.php
См. документацию.
1<?php
3
8
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
getAction(int $id, string $sec, array $replace)
Определения agreement.php:23
addError(Error $error)
Определения controller.php:1070
Определения error.php:15
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
Определения action.php:3