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 5567 to 5618

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",
        );

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

This article was last updated 28th February 2021 15:35 Europe/London time based on the source file dated 26th February 2021 11:40 Europe/London time.