requireLogin(); App::sslOn(); if (getFormData('boomerang', false)) { // We remember which page we came from so we can go back there. $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER']; App::setBoomerangURL($boom_url, 'lock'); App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock'); } if (!isset($lock) || !is_a($lock, 'RecordLock')) { $lock =& RecordLock::getInstance($auth); } $lock->select(getFormData('lock_id')); if (!$lock->isLocked()) { App::logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__); App::dieBoomerangURL('lock'); } // What action to take. if (getFormData('unlock', false)) { $lock->remove(); App::raiseMsg(sprintf(_("The record %s has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__); App::dieBoomerangURL('lock'); } else if (getFormData('cancel', false)) { // Since the boomerang URL will go back to the locked record, and the record was not unlocked, we must delete the boomerang URL otherwise we'll come back here. App::deleteBoomerangURL('lock'); App::dieBoomerangURL('cancel-lock'); } // Titles and navigation header. $nav->addPage(sprintf(_("Locked record: %s"), $lock->getTitle())); // Templates. include 'header.ihtml'; $lock->printErrorHTML(); include 'footer.ihtml'; ?>