source: trunk/services/lock.php @ 247

Last change on this file since 247 was 247, checked in by quinn, 17 years ago

Converted all string functions to multi-byte (mb_*) functions

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/Lock.inc.php';
9
10$auth->requireLogin();
11$app->sslOn();
12
13if (getFormData('boomerang', false)) {
14    // We remember which page we came from so we can go back there.
15    $boom_url = mb_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, 'Lock')) {
23    $lock =& Lock::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 <em>%s</em> 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->add(sprintf(_("Locked record: <em>%s</em>"), $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.