source: trunk/services/lock.php @ 72

Last change on this file since 72 was 53, checked in by scdev, 18 years ago

${1}

File size: 1.7 KB
Line 
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';
8require_once 'codebase/lib/RecordLock.inc.php';
9
10$auth->requireLogin();
11App::sslOn();
12
13if (getFormData('boomerang', false)) {
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    if (isset($_SERVER['HTTP_REFERER'])) {
18        App::setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');
19    }
20}
21
22if (!isset($lock) || !is_a($lock, 'RecordLock')) {
23    $lock =& RecordLock::getInstance($auth);
24}
25$lock->select(getFormData('lock_id'));
26
27if (!$lock->isLocked()) {
28    App::logMsg('Lock not found with lock_id: ' . getFormData('lock_id') . ', from referrer: ' . $_SERVER['HTTP_REFERER'], LOG_WARNING, __FILE__, __LINE__);
29    App::dieBoomerangURL('lock');
30}
31
32// What action to take.
33if (getFormData('unlock', false)) {
34    $lock->remove();
35    App::raiseMsg(sprintf(_("The record <strong>%s</strong> has been unlocked, and can now be modified."), $lock->getTitle('title')), MSG_NOTICE, __FILE__, __LINE__);
36    App::dieBoomerangURL('lock');
37} else if (getFormData('cancel', false)) {
38    // 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.
39    App::deleteBoomerangURL('lock');
40    App::dieBoomerangURL('cancel-lock');
41}
42
43// Titles and navigation header.
44$nav->addPage(sprintf(_("Locked record: %s"), $lock->getTitle()));
45
46// Templates.
47include 'header.ihtml';
48$lock->printErrorHTML();
49include 'footer.ihtml';
50
51?>
Note: See TracBrowser for help on using the repository browser.