Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

is_banned_extension()

Description

Is the given extension in the list of blocked extensions?
Also ensures extension is no longer than 10 characters due to resource.file_extension database column limit

Parameters

ColumnTypeDefaultDescription
$extension: string
10}$/'
$extension string - file extension to check
array_map'mb_strtolower'
$GLOBALS['banned_extensions'] ""

Location

include/file_functions.php lines 249 to 255

Definition

 
function is_banned_extension(string $extension): bool
{
    return !(
        
preg_match('/^[a-zA-Z0-9_-]{1,10}$/'$extension) === 1
        
&& !in_array(mb_strtolower($extension), array_map('mb_strtolower'$GLOBALS['banned_extensions']))
    );
}

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 22nd August 2024 16:45 Europe/London time.