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

update_resource_lock()

Parameters

ColumnTypeDefaultDescription
$ref
$lockaction
$newlockuser null
$accesschecked false

Location

include/resource_functions.php lines 8942 to 8978

Definition

 
function update_resource_lock($ref,$lockaction,$newlockuser=null,$accesschecked false)
    {
    global 
$userref;

    if(((string)(int)
$ref != (string)$ref)
     || 
$ref <= 0
     
|| !in_array($lockaction,array(0,1))
        )
        {
        return 
false;
        }

    if(
is_null($newlockuser) || ((string)(int)$newlockuser != (string)$newlockuser))
        {
        
$newlockuser $userref;
        }

    if(!
$accesschecked)
        {
        
$resource_data  get_resource_data($ref);
        
$lockeduser     =  $resource_data["lock_user"];
        
$edit_access    get_edit_access($ref,$resource_data["archive"],$resource_data);
        if(!
checkperm("a")
            &&
            
$lockeduser != $userref
            
&&
            !(
$edit_access && $lockeduser == && !checkperm("nolock"))
            )
            {
            return 
false;
            }
        }

    
ps_query("UPDATE resource SET lock_user=? WHERE ref=?",array("i",($lockaction $newlockuser "0"),"i",(int)$ref));
    
resource_log($ref,($lockaction LOG_CODE_LOCKED LOG_CODE_UNLOCKED),0);
    return 
true;
    }

This article was last updated 17th November 2024 15:35 Europe/London time based on the source file dated 15th November 2024 18:30 Europe/London time.