Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

check_use_watermark()

Parameters

ColumnTypeDefaultDescription
$download_key ""
$resource ""

Location

include/resource_functions.php lines 5912 to 5959

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