function GetLock($table, $id) { global $user; # check locked $row = TTable::GetFetchedRow("select locked_till, locked_by from " . $table . " where id=" . $id); if ($row['locked_till'] > time() && $user['id'] != $row['locked_by']) { $locked_name = TTable::GetFetchedValue("select if(length(name)>0,name,login) from users where id=" . $row['locked_by']); return sprintf(str('locked'), date('Y-m-d H:i', $row['locked_till']), $locked_name); } }