Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
disk.php
1
<?php
2
namespace
Bitrix\Im\Controller\Call
;
3
4
use Bitrix\Disk\Controller\File,
5
Bitrix\Main\Engine\Controller
,
6
Bitrix\Disk\Controller\Content,
7
Bitrix\Main\Engine\ActionFilter
,
8
Bitrix\Im\Controller\Call\Filter
;
9
use
Bitrix\Main\Engine\Action
;
10
use
Bitrix\Main\Loader
;
11
18
class
Disk
extends
Controller
19
{
20
protected
function
getDefaultPreFilters
(): array
21
{
22
return
[
23
new
ActionFilter\HttpMethod
([
'POST'
]),
24
new
Filter\Authorization(),
25
new
Filter\DiskFolderAccessCheck(),
26
];
27
}
28
29
public
function
configureActions
(): array
30
{
31
return
[
32
'upload'
=> [
33
'-prefilters'
=> [
34
ActionFilter\Csrf::class,
35
ActionFilter\Authentication::class
36
],
37
],
38
'commit'
=> [
39
'-prefilters'
=> [
40
ActionFilter\Csrf::class,
41
ActionFilter\Authentication::class
42
],
43
],
44
];
45
}
46
47
protected
function
processBeforeAction
(
Action
$action): bool
48
{
49
if
(!Loader::includeModule(
'disk'
))
50
{
51
return
false
;
52
}
53
54
return
parent::processBeforeAction($action);
55
}
56
57
public
function
uploadAction
($filename, $token =
null
)
58
{
59
$params = [
60
'filename'
=> $filename,
61
'token'
=> $token,
62
];
63
$this->
setScope
(
Controller::SCOPE_REST
);
64
65
return
$this->
forward
(
new
Content(),
'upload'
, $params);
66
}
67
68
public
function
commitAction
($folderId, $filename, $contentId, $generateUniqueName =
false
)
69
{
70
$params = [
71
'folderId'
=> $folderId,
72
'filename'
=> $filename,
73
'contentId'
=> $contentId,
74
'generateUniqueName'
=> $generateUniqueName,
75
];
76
77
$this->
setScope
(
Controller::SCOPE_REST
);
78
79
return
$this->
forward
(
new
File
(),
'createByContent'
, $params);
80
}
81
}
Bitrix\Im\Controller\Call\Disk
Definition
disk.php:19
Bitrix\Im\Controller\Call\Disk\getDefaultPreFilters
getDefaultPreFilters()
Definition
disk.php:20
Bitrix\Im\Controller\Call\Disk\commitAction
commitAction($folderId, $filename, $contentId, $generateUniqueName=false)
Definition
disk.php:68
Bitrix\Im\Controller\Call\Disk\uploadAction
uploadAction($filename, $token=null)
Definition
disk.php:57
Bitrix\Im\Controller\Call\Disk\processBeforeAction
processBeforeAction(Action $action)
Definition
disk.php:47
Bitrix\Im\Controller\Call\Disk\configureActions
configureActions()
Definition
disk.php:29
Bitrix\Main\Engine\ActionFilter\HttpMethod
Definition
httpmethod.php:13
Bitrix\Main\Engine\Action
Definition
action.php:17
Bitrix\Main\Engine\Controller
Definition
controller.php:32
Bitrix\Main\Engine\Controller\setScope
setScope($scope)
Definition
controller.php:369
Bitrix\Main\Engine\Controller\forward
forward($controller, string $actionName, array $parameters=null)
Definition
controller.php:103
Bitrix\Main\Engine\Controller\SCOPE_REST
const SCOPE_REST
Definition
controller.php:33
Bitrix\Main\IO\File
Definition
file.php:7
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Im\Controller\Call\Filter
Definition
authorization.php:3
Bitrix\Im\Controller\Call
Definition
beta.php:4
Bitrix\Main\Engine\ActionFilter
Definition
authentication.php:4
Bitrix\Sender\Internals\QueryController
Definition
action.php:8
modules
im
lib
controller
call
disk.php
Создано системой
1.10.0