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

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
restricts which
*/ function `false`.

Return

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

Location

include/collections_functions.php lines 7064 to 7086

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 14th December 2024 20:35 Europe/London time based on the source file dated 12th December 2024 10:55 Europe/London time.