upload_share_setup()

Description

Set up external upload share

"collection" - (int) collection ID
"user" - (int) user ID of share creator
"usergroup" - (int) usergroup ID used for share

Parameters

ColumnTypeDefaultDescription
$key string access key
$shareopts array array Array of share options

Return

void

Location

include/collections_functions.php lines 6067 to 6115

Definition

 
function upload_share_setup(string $key$shareopts = array())
{
    
debug_function_call("upload_share_setup"func_get_args());
    global 
$baseurl$pagename$upload_share_active$upload_then_edit;
    global 
$upload_link_workflow_state$override_status_default,$usergroup;

    
$rqdopts = array("collection""usergroup""user");
    foreach (
$rqdopts as $rqdopt) {
        if (!isset(
$shareopts[$rqdopt])) {
            return 
false;
        }
    }
    
$collection = (int) $shareopts['collection'];
    
$usergroup = (int) $shareopts['usergroup'];

    
emulate_user((int) $shareopts['user'], $usergroup);
    
$upload_share_active upload_share_active();
    
$upload_then_edit true;

    if (!
$upload_share_active || $upload_share_active != $collection) {
        
// Create a new session even if one exists to ensure a new temporary collection is created for this share
        
rs_setcookie("rs_session"''7""""substr($baseurl05) == "https"true);
        
rs_setcookie("upload_share_active"$collection1""""substr($baseurl05) == "https"true);
        
$upload_share_active true;
    }

    
// Set default archive state
    
if (in_array($upload_link_workflow_stateget_workflow_states())) {
        
$override_status_default $upload_link_workflow_state;
    }

    
// Upload link key can only work on these pages
    
$validpages = array(
        
"upload_batch",
        
"edit",
        
"category_tree_lazy_load",
        
"suggest_keywords",
        
"add_keyword",
        
"download"// Required to see newly created thumbnails if $hide_real_filepath=true;
        
"terms",
        );

    if (!
in_array($pagename$validpages)) {
        
$uploadurl get_upload_url($collection$key);
        
redirect($uploadurl);
        exit();
    }
    return 
true;
}

This article was last updated 7th April 2025 14:05 Europe/London time based on the source file dated 3rd April 2025 16:40 Europe/London time.