Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

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 5705 to 5757

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;

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

    
emulate_user($user$usergroup);
    
$upload_share_active upload_share_active();
    
$rs_session get_rs_session_id(true);
    
$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($baseurl,0,5)=="https"true);
        
rs_setcookie("upload_share_active",$collection1""""substr($baseurl,0,5)=="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_plupload",
        
"edit",
        
"category_tree_lazy_load",
        
"suggest_keywords",
        
"add_keyword",
        
"download"// Required to see newly created thumbnails if $hide_real_filepath=true;
        
);

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

This article was last updated 15th May 2021 00:05 Europe/London time based on the source file dated 10th May 2021 09:15 Europe/London time.