Collections functions
General functions
Render functions
Theme permission functions
Resource functions

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 Share key
"collection"
array"s"
array_column$keyinfo
&& $_COOKIE

Return

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

Location

include/collections_functions.php lines 7045 to 7068

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);
        return 
$return;
        }
    }

This article was last updated 9th June 2023 19:05 Europe/London time based on the source file dated 8th June 2023 10:25 Europe/London time.