1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
componentcontroller.php
См. документацию.
1
<?php
8
namespace
Bitrix\Main\UserConsent\Internals;
9
10
use Bitrix\Main\Context;
11
use Bitrix\Main\HttpRequest;
12
use Bitrix\Main\Web\Json;
13
use Bitrix\Main\Localization\Loc;
14
15
Loc::loadMessages(__FILE__);
16
17
abstract
class
ComponentController
18
{
19
protected
$errors
=
array
();
20
protected
$action
=
null
;
21
protected
$responseData
=
array
();
22
protected
$requestData
=
array
();
23
25
protected
$request
=
array
();
26
27
abstract
protected
function
getActions
();
28
abstract
protected
function
checkPermissions
();
29
30
protected
function
prepareRequestData
()
31
{
32
33
}
34
35
protected
function
giveResponse
()
36
{
37
global
$APPLICATION
;
38
$APPLICATION
->restartBuffer();
39
40
header(
'Content-Type:application/json; charset=UTF-8'
);
41
echo Json::encode(
42
$this->responseData +
array
(
43
'error'
=> $this->
hasErrors
(),
44
'text'
=> implode(
'<br>'
, $this->errors),
45
)
46
);
47
48
\CMain::finalActions();
49
exit;
50
}
51
52
protected
function
getActionCall
()
53
{
54
return
array
($this, $this->action);
55
}
56
57
protected
function
hasErrors
()
58
{
59
return
!empty($this->errors);
60
}
61
62
protected
function
check
()
63
{
64
if
(!$this->
checkPermissions
())
65
{
66
$this->errors[] = Loc::getMessage(
'MAIN_PERMISSION_DENIED'
);
67
}
68
if
(!in_array($this->action, $this->
getActions
()))
69
{
70
$this->errors[] =
'Action "'
. $this->action .
'" not found.'
;
71
}
72
elseif
(!
check_bitrix_sessid
() || !$this->request->isPost())
73
{
74
$this->errors[] =
'Security error.'
;
75
}
76
elseif
(!is_callable($this->
getActionCall
()))
77
{
78
$this->errors[] =
'Action method "'
. $this->action .
'" not found.'
;
79
}
80
81
return
!$this->
hasErrors
();
82
}
83
89
public
function
exec
()
90
{
91
$this->request = Context::getCurrent()->getRequest();
92
$this->action = $this->request->get(
'action'
);
93
94
$this->
prepareRequestData
();
95
96
if
($this->
check
())
97
{
98
call_user_func_array($this->
getActionCall
(),
array
($this->requestData));
99
}
100
$this->
giveResponse
();
101
}
102
}
$APPLICATION
global $APPLICATION
Определения
include.php:80
Bitrix\Main\UserConsent\Internals\ComponentController
Определения
componentcontroller.php:18
Bitrix\Main\UserConsent\Internals\ComponentController\checkPermissions
checkPermissions()
Bitrix\Main\UserConsent\Internals\ComponentController\getActionCall
getActionCall()
Определения
componentcontroller.php:52
Bitrix\Main\UserConsent\Internals\ComponentController\$requestData
$requestData
Определения
componentcontroller.php:22
Bitrix\Main\UserConsent\Internals\ComponentController\prepareRequestData
prepareRequestData()
Определения
componentcontroller.php:30
Bitrix\Main\UserConsent\Internals\ComponentController\check
check()
Определения
componentcontroller.php:62
Bitrix\Main\UserConsent\Internals\ComponentController\$action
$action
Определения
componentcontroller.php:20
Bitrix\Main\UserConsent\Internals\ComponentController\hasErrors
hasErrors()
Определения
componentcontroller.php:57
Bitrix\Main\UserConsent\Internals\ComponentController\$responseData
$responseData
Определения
componentcontroller.php:21
Bitrix\Main\UserConsent\Internals\ComponentController\$errors
$errors
Определения
componentcontroller.php:19
Bitrix\Main\UserConsent\Internals\ComponentController\$request
$request
Определения
componentcontroller.php:25
Bitrix\Main\UserConsent\Internals\ComponentController\exec
exec()
Определения
componentcontroller.php:89
Bitrix\Main\UserConsent\Internals\ComponentController\getActions
getActions()
Bitrix\Main\UserConsent\Internals\ComponentController\giveResponse
giveResponse()
Определения
componentcontroller.php:35
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
check_bitrix_sessid
check_bitrix_sessid($varname='sessid')
Определения
tools.php:4686
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
main
lib
userconsent
internals
componentcontroller.php
Создано системой
1.14.0