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_use_watermark()

Parameters

ColumnTypeDefaultDescription
$download_key ""
$resource ""

Location

include/resource_functions.php lines 6052 to 6099

Definition

 
function check_use_watermark($download_key ""$resource="")
    {
    
debug_function_call("check_use_watermark"func_get_args());
    
# This function checks whether or not to use watermarks
    # Note that access status must be available prior to calls to this function

    
global $access,$k,$watermark,$watermark_open,$pagename,$watermark_open_search$terms_download;

    
# Cannot watermark without a watermark
    
if($watermark === '')
        {
        return 
false;
        }

    
$blockwatermark hook("blockwatermark");
    if(
$blockwatermark)
    {
        return 
false;
        }

    
# Cannot watermark unless permission "w" is present
    
if(!checkperm('w'))
        {
        return 
false;
        }

    
# Watermark is present and permission "w" is present

    # Watermark if access is restricted
    
if($access == 1)
        {
        return 
true;
        }

    
# Watermark if open override is present
    
if(    $watermark_open
        
&& (    ($pagename == "preview")
             || (
$pagename == "view")
             || (
$pagename == "search" && $watermark_open_search)
             || (
$pagename == "download" && $terms_download && !download_link_check_key($download_key$resource))
           ) )
        {
        return 
true;
        }

    
# Watermark not necessary
    
return false;
}

This article was last updated 13th December 2024 08:35 Europe/London time based on the source file dated 12th December 2024 10:55 Europe/London time.