ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
WhitelistFileHeaderPreProcessor.php
Go to the documentation of this file.
1 <?php
2 
4 
10 
21 {
23 
27  private $fileHeader;
32 
33 
39  public function __construct($fileHeader)
40  {
41  $this->stringTypeCheck($fileHeader, 'fileHeader');
42 
43  $this->fileHeaderLength = strlen($fileHeader);
44  $this->fileHeader = $fileHeader;
45  }
46 
47 
52  {
53  $header = $stream->read($this->fileHeaderLength);
54  if (strcmp($this->fileHeader, $header) === 0) {
55  return new ProcessingStatus(ProcessingStatus::OK, 'File header complies with whitelist.');
56  }
57 
58  return new ProcessingStatus(ProcessingStatus::REJECTED, 'File header don\'t complies with whitelist.');
59  }
60 }
const REJECTED
Upload got rejected by a processor.
read($length)
Read data from the stream.
__construct($fileHeader)
WhitelistFileHeaderPreProcessor constructor.
$metadata['__DYNAMIC:1__']
$stream
PHP stream implementation.
Interface FileStream.
Definition: FileStream.php:20