1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
agreement.php
См. документацию.
1<?php
2
3namespace Bitrix\Sender\Security;
4
5use Bitrix\Main\Context;
6use Bitrix\Main\Localization\Loc;
7use Bitrix\Sender\Internals\Model\AgreementTable;
8
9
15{
22 public static function isAcceptedByUser($userId)
23 {
24 $agreement = AgreementTable::getRow(array(
25 'select' => array('ID'),
26 'filter' => array('=USER_ID' => $userId),
27 'limit' => 1,
28 'cache' => array('ttl' => 3600)
29 ));
30
31 return !empty($agreement);
32 }
33
39 public static function requestFromCurrentUser()
40 {
41 if (User::current()->isAgreementAccepted())
42 {
43 return;
44 }
45
46 \CJSCore::init(array('sender_agreement'));
47 }
48
54 public static function acceptByCurrentUser()
55 {
56 if (User::current()->isAgreementAccepted())
57 {
58 return true;
59 }
60
61 $result = AgreementTable::add(array(
62 'USER_ID' => User::current()->getId(),
63 'NAME' => User::current()->getObject()->GetFullName(),
64 'EMAIL' => User::current()->getObject()->GetEmail(),
65 'IP_ADDRESS' => Context::getCurrent()->getRequest()->getRemoteAddress(),
66 ));
67
68 return $result->isSuccess();
69 }
70
77 public static function getText($asRichHtml = false)
78 {
79 Loc::loadMessages(__FILE__);
80
81 if ($asRichHtml)
82 {
83 $msg = Loc::getMessage("SENDER_SECURITY_AGREEMENT_HTML_RICH");
84 }
85 else
86 {
87 $msg = Loc::getMessage("SENDER_SECURITY_AGREEMENT_HTML_RICH");
88 }
89
90 return $msg;
91 }
92
98 public static function getErrorText()
99 {
100 Loc::loadMessages(__FILE__);
101
102 return Loc::getMessage("SENDER_SECURITY_AGREEMENT_ERROR");
103 }
104}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getText($asRichHtml=false)
Определения agreement.php:77
static isAcceptedByUser($userId)
Определения agreement.php:22
static getErrorText()
Определения agreement.php:98
static requestFromCurrentUser()
Определения agreement.php:39
static acceptByCurrentUser()
Определения agreement.php:54
static current()
Определения user.php:47
</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