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

isPathWhitelisted()

Description

Checks if a path is part of a whitelisted list of paths. This applies to both folders and files.

Note: the function is not supposed to check/ validate the syntax of the path (ie. UNIX/ Windows)

Parameters

ColumnTypeDefaultDescription
$path string Path which is going to be checked against whitelisted paths
$whitelisted_paths array List of whitelisted paths

Return

boolean

Location

include/file_functions.php lines 71 to 82

Definition

 
function isPathWhitelisted($path, array $whitelisted_paths)
    {
    foreach(
$whitelisted_paths as $whitelisted_path)
        {
        if(
substr_compare($whitelisted_path$path0strlen($path)) === 0)
            {
            return 
true;
            }
        }

    return 
false;
    }

This article was last updated 9th November 2024 17:05 Europe/London time based on the source file dated 22nd August 2024 16:45 Europe/London time.