Limit dlouhejch vypisu v kase
[mirrors/SokoMan.git] / assistants / lock.inc.php
1 <?php
2 switch($SUBPATH[0]) {
3 default: case 1:
4 $result = $this->db->safe_query_fetch("SELECT * FROM `lock`;");
5 if(empty($result)) {
6 echo T('Not locked...');
7 echo $this->html->form("$URL/2", 'POST', array(
8 array('reason','','textarea',false,'autofocus','reason:'),
9 array('lock','lock','submit')
10 ));
11 echo(T('By locking you will disable all other users from manipulating records.'));
12 } else {
13 echo $this->html->render_item_table($result, 'lock');
14 echo $this->html->form("$URL/2", 'POST', array(
15 array('unlock','unlock','submit')
16 ));
17 }
18
19 break;
20 case 2:
21 if(isset($_POST['lock'])) {
22 $user=$this->db->auth->get_user_id();
23 $username=$this->db->auth->get_username_by_id($user);
24 $lock = $this->db->quote($username.': '.$_POST['reason']);
25 $author = $this->db->quote($user);
26 $this->db->safe_query("INSERT INTO `lock` (lock_name,lock_author) VALUES ($lock,$author);");
27 $this->post_redirect_get("$URL_INTERNAL/1", T('Lock set'));
28 }
29 if(isset($_POST['unlock'])) {
30 $this->db->safe_query("TRUNCATE TABLE `lock`;");
31 $this->post_redirect_get("$URL_INTERNAL/1", T('Lock unset'));
32 }
33 $this->post_redirect_get("$URL_INTERNAL/1","Lock: No value passed!", true);
34 break;
35 }
This page took 0.339455 seconds and 4 git commands to generate.