source: branches/2.0singleton/services/lock.php @ 599

Last change on this file since 599 was 129, checked in by scdev, 18 years ago

finished updating to 2.0singleton

File size: 1.7 KB
RevLine 
[1]1<?php
2/**
[42]3 * lock.php
[1]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();
[129]11$app->sslOn();
[1]12
[22]13if (getFormData('boomerang', false)) {
[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'];
[129]16    $app->setBoomerangURL($boom_url, 'lock');
[53]17    if (isset($_SERVER['HTTP_REFERER'])) {
[129]18        $app->setBoomerangURL($_SERVER['HTTP_REFERER'], 'cancel-lock');
[53]19    }
[1]20}
21
[22]22if (!isset($lock) || !is_a($lock, 'RecordLock')) {
23    $lock =& RecordLock::getInstance($auth);
24}
[1]25$lock->select(getFormData('lock_id'));
26
27if (!$lock->isLocked()) {
[129]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');
[1]30}
31
32// What action to take.
33if (getFormData('unlock', false)) {
34    $lock->remove();
[129]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');
[1]37} else if (getFormData('cancel', false)) {
[22]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.
[129]39    $app->deleteBoomerangURL('lock');
40    $app->dieBoomerangURL('cancel-lock');
[1]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.