check_upload_terms()

Description

Check if the terms have been accepted for the given upload
Terms only need to be accepted when uploading through an upload share link
If uploading through an upload share link then the accepted terms have been stored in $_COOKIE["acceptedterms"]


OR if not an external upload
False if external upload share and terms have NOT been accepted

Parameters

ColumnTypeDefaultDescription
$collection int Collection ref
$k: string ps_query "SELECT collection
"collection"
array"s"
array_column$keyinfo
$k string Share key

Return

boolean True if external upload share and terms have also been accepted

Location

include/collections_functions.php lines 6454 to 6475

Definition

 
function check_upload_terms(int $collectionstring $k): bool
{
    
$keyinfo ps_query(
        
"SELECT collection,upload
            FROM external_access_keys
        WHERE access_key = ?
            AND (expires IS NULL OR expires > now())"
,
        array(
"s"$k)
    );

    
$collection get_collection($collection);

    if (
        !
is_array($collection)                                                  // not uploading to collection
        
|| !in_array($collection["ref"], array_column($keyinfo"collection"))    // share is not for this collection
        
|| (bool) $keyinfo[0]["upload"] !== true
    
) {                                 // share type not upload
        
return true;
    } else {
        return 
array_key_exists("acceptedterms"$_COOKIE) && $_COOKIE["acceptedterms"] == 1;
    }
}

This article was last updated 10th July 2025 21:35 Europe/London time based on the source file dated 7th July 2025 14:35 Europe/London time.