Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezfileextensionblacklistvalidator.php
Go to the documentation of this file.
1 <?php
16 class eZFileExtensionBlackListValidator extends eZInputValidator
17 {
21 function __construct()
22 {
23 $fileIni = eZINI::instance('file.ini');
24 $this->constraints['extensionsBlackList'] = $fileIni->variable('FileSettings','FileExtensionBlackList');
25 }
26
32 function validate( $filename )
33 {
34 if (
35 pathinfo($filename, PATHINFO_BASENAME) !== $filename ||
36 in_array(strtolower(pathinfo($filename, PATHINFO_EXTENSION)), $this->constraints['extensionsBlackList'], true)
37 ) {
38 return eZInputValidator::STATE_INVALID;
39 }
40
41 return eZInputValidator::STATE_ACCEPTED;
42 }
43
47 function extensionsBlackList()
48 {
49 return $this->constraints['extensionsBlackList'];
50 }
51
53 protected $constraints = array(
54 'extensionsBlackList' => array(),
55 );
56 }
eZFileExtensionBlackListValidator
The class eZFileExtensionBlackListValidator validates file extensions based on a blacklist.
Definition: ezfileextensionblacklistvalidator.php:17
eZFileExtensionBlackListValidator\extensionsBlackList
extensionsBlackList()
Definition: ezfileextensionblacklistvalidator.php:47
eZFileExtensionBlackListValidator\$constraints
$constraints
Definition: ezfileextensionblacklistvalidator.php:53
eZFileExtensionBlackListValidator\__construct
__construct()
Definition: ezfileextensionblacklistvalidator.php:21
eZFileExtensionBlackListValidator\validate
validate( $filename)
Definition: ezfileextensionblacklistvalidator.php:32
eZInputValidator
Input text validation and correction.
Definition: ezinputvalidator.php:78
eZInputValidator\STATE_ACCEPTED
const STATE_ACCEPTED
Definition: ezinputvalidator.php:79
eZInputValidator\STATE_INVALID
const STATE_INVALID
Definition: ezinputvalidator.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.