[1] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * lock.php |
---|
| 4 | * Code by Strangecode :: www.strangecode.com :: This document contains copyrighted information |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | // require_once dirname(__FILE__) . '/_config.inc.php'; |
---|
| 8 | require_once 'codebase/lib/RecordLock.inc.php'; |
---|
| 9 | |
---|
| 10 | $auth->requireLogin(); |
---|
| 11 | App::sslOn(); |
---|
| 12 | |
---|
[20] | 13 | if (getFormData('boomerang', false) && isset($_SERVER['HTTP_REFERER'])) { |
---|
[1] | 14 | // We remember which page we came from so we can go back there. |
---|
| 15 | $boom_url = strpos(getFormData('boomerang'), '/') !== false ? getFormData('boomerang') : $_SERVER['HTTP_REFERER']; |
---|
| 16 | App::setBoomerangURL($boom_url, 'lock'); |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | $lock =& RecordLock::getInstance($GLOBALS['auth']); |
---|
| 20 | $lock->select(getFormData('lock_id')); |
---|
| 21 | |
---|
| 22 | if (!$lock->isLocked()) { |
---|
| 23 | App::logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__); |
---|
| 24 | App::dieBoomerangURL('lock'); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | // What action to take. |
---|
| 28 | if (getFormData('unlock', false)) { |
---|
| 29 | $lock->remove(); |
---|
| 30 | App::raiseMsg(sprintf(_("The record <strong>%s</strong> has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__); |
---|
| 31 | App::dieBoomerangURL('lock'); |
---|
| 32 | } else if (getFormData('cancel', false)) { |
---|
| 33 | App::dieBoomerangURL('lock'); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | // Titles and navigation header. |
---|
| 37 | $nav->addPage(sprintf(_("Locked record: %s"), $lock->getTitle())); |
---|
| 38 | |
---|
| 39 | // Templates. |
---|
| 40 | include 'header.ihtml'; |
---|
| 41 | $lock->printErrorHTML(); |
---|
| 42 | include 'footer.ihtml'; |
---|
| 43 | |
---|
| 44 | ?> |
---|