Ejemplo n.º 1
0
Session::checkLoginUser();
$ret = 0;
if (isset($_GET['unlock']) && isset($_GET["id"])) {
    // then we may have something to unlock
    $ol = new ObjectLock();
    if ($ol->getFromDB($_GET["id"]) && $ol->deleteFromDB(1)) {
        if (isset($_GET['force'])) {
            Log::history($ol->fields['items_id'], $ol->fields['itemtype'], array(0, '', ''), 0, Log::HISTORY_UNLOCK_ITEM);
        }
        $ret = 1;
    }
} else {
    if (isset($_GET['requestunlock']) && isset($_GET["id"])) {
        // the we must ask for unlock
        $ol = new ObjectLock();
        if ($ol->getFromDB($_GET["id"])) {
            NotificationEvent::raiseEvent('unlock', $ol);
            $ret = 1;
        }
    } else {
        if (isset($_GET['lockstatus']) && isset($_GET["id"])) {
            $ol = new ObjectLock();
            if ($ol->getFromDB($_GET["id"])) {
                $ret = 1;
                // found = still locked
            }
            // else will return 0 = not found
        }
    }
}
echo $ret;