Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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" true // share type not upload { return true; } else { return array_key_exists"acceptedterms"
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 6996 to 7018

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 25th April 2024 21:35 Europe/London time based on the source file dated 25th April 2024 16:25 Europe/London time.