4 require_once 'Pman.php';
6 class Pman_Core_Lock extends Pman
11 $au = $this->getAuthUser();
13 $this->jerr("Not authenticated", array('authFailure' => true));
15 $this->authUser = $au;
16 // check that it's a supplier!!!!
24 // default action is to attempt to lock..
25 if (empty($_REQUEST['on_id']) || empty($_REQUEST['on_table'])) {
26 $this->jerr("Missing table or id");
28 $action = empty($_REQUEST['unlock']) ? 'lock' : 'unlock';
29 $tab = str_replace('/', '',$_REQUEST['on_table']); // basic protection??
30 $x = DB_DataObject::factory($tab);
31 if (!$x->get($_REQUEST['on_id'])) {
32 $this->jerr("Item does not exist");
34 $curlock = DB_DataObject::factory('Core_locking');
35 $curlock->setFrom(array(
36 'on_id' => $_REQUEST['on_id'],
37 'on_table' => $_REQUEST['on_table'],
38 //'person_id' => $this->authUser->id,
41 if ($curlock->find(true)) {
44 $this->$action($curlock);
48 function unlock($curlock)
51 $this->jok("No lock");