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

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 6644 to 6697

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($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_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 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.