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

api_validate_upload_url()

Description

Validate URL supplied in APIs create resource or upload by URL. Requires the URL hostname to be added in config $api_upload_urls

Parameters

ColumnTypeDefaultDescription
$url string The full URL.

Return

bool Returns true if a valid URL is found.

Location

include/api_functions.php lines 232 to 259

Definition

 
function api_validate_upload_url($url)
    {
    
$url filter_var($urlFILTER_VALIDATE_URLFILTER_FLAG_PATH_REQUIRED);
    if (
$url === false)
        {
        return 
false;
        }

    
$url_parts parse_url($url);

    if (
in_array($url_parts['scheme'], BLOCKED_STREAM_WRAPPERS))
        {
        return 
false;
        }

    global 
$api_upload_urls;
    if (!isset(
$api_upload_urls))
        {
        return 
true// For systems prior to this config.
        
}

    if (
in_array($url_parts['host'], $api_upload_urls))
        {
        return 
true;
        }

    return 
false;
    }

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 25th April 2024 17:25 Europe/London time.