ILIAS
release_8 Revision v8.19
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
j
l
m
p
s
t
u
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
g
h
i
m
n
p
r
s
t
u
v
x
+
Variables
$
a
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
WhitelistFileHeaderPreProcessor.php
Go to the documentation of this file.
1
<?php
2
3
namespace
ILIAS\FileUpload\Processor
;
4
5
use
ILIAS\Filesystem\Stream\FileStream
;
6
use
ILIAS\FileUpload\DTO\Metadata
;
7
use
ILIAS\FileUpload\DTO\ProcessingStatus
;
8
use
ILIAS\FileUpload\ScalarTypeCheckAware
;
9
use
Psr\Http\Message\StreamInterface
;
10
11
/******************************************************************************
12
*
13
* This file is part of ILIAS, a powerful learning management system.
14
*
15
* ILIAS is licensed with the GPL-3.0, you should have received a copy
16
* of said license along with the source code.
17
*
18
* If this is not the case or you just want to try ILIAS, you'll find
19
* us at:
20
* https://www.ilias.de
21
* https://github.com/ILIAS-eLearning
22
*
23
*****************************************************************************/
33
final
class
WhitelistFileHeaderPreProcessor
implements
PreProcessor
34
{
35
use
ScalarTypeCheckAware
;
36
37
private
string
$fileHeader
;
38
private
int
$fileHeaderLength
;
39
40
44
public
function
__construct
(
string
$fileHeader)
45
{
46
$this->stringTypeCheck($fileHeader,
'fileHeader'
);
47
48
$this->fileHeaderLength = strlen($fileHeader);
49
$this->fileHeader =
$fileHeader
;
50
}
51
52
56
public
function
process
(
FileStream
$stream,
Metadata
$metadata):
ProcessingStatus
57
{
58
$header = $stream->read($this->fileHeaderLength);
59
if
(strcmp($this->fileHeader, $header) === 0) {
60
return
new
ProcessingStatus
(
ProcessingStatus::OK
,
'File header complies with whitelist.'
);
61
}
62
63
return
new
ProcessingStatus
(
ProcessingStatus::REJECTED
,
'File header don\'t complies with whitelist.'
);
64
}
65
}
ILIAS\FileUpload\Processor\PreProcessor
Class PreProcessor.
Definition:
PreProcessor.php:35
ILIAS\FileUpload\DTO\ProcessingStatus
Class ProcessingStatus.
Definition:
ProcessingStatus.php:36
ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED
const REJECTED
Upload got rejected by a processor.
Definition:
ProcessingStatus.php:46
ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessor\$fileHeader
string $fileHeader
Definition:
WhitelistFileHeaderPreProcessor.php:37
ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessor\process
process(FileStream $stream, Metadata $metadata)
Definition:
WhitelistFileHeaderPreProcessor.php:56
ProcessingStatus
ScalarTypeCheckAware
ILIAS\FileUpload\Processor
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition:
AbstractRecursiveZipPreProcessor.php:19
ILIAS\FileUpload\DTO\Metadata
Class Metadata.
Definition:
Metadata.php:21
StreamInterface
ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessor
Class WhitelistFileHeaderPreProcessor.
Definition:
WhitelistFileHeaderPreProcessor.php:33
Metadata
ScalarTypeCheckAware
ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessor\__construct
__construct(string $fileHeader)
WhitelistFileHeaderPreProcessor constructor.
Definition:
WhitelistFileHeaderPreProcessor.php:44
FileStream
ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessor\$fileHeaderLength
int $fileHeaderLength
Definition:
WhitelistFileHeaderPreProcessor.php:38
ILIAS\Filesystem\Stream\FileStream
Interface FileStream.
Definition:
FileStream.php:33
ILIAS\FileUpload\DTO\ProcessingStatus\OK
const OK
Upload is ok.
Definition:
ProcessingStatus.php:42
src
FileUpload
Processor
WhitelistFileHeaderPreProcessor.php
Generated on Tue Apr 1 2025 22:02:44 for ILIAS by
1.8.13 (using
Doxyfile
)