Commit | Line | Data |
---|---|---|
37595945 TM |
1 | <?php |
2 | switch($SUBPATH[0]) { | |
3 | default: case 1: | |
4 | $result = $this->db->safe_query_fetch("SELECT * FROM `lock`;"); | |
5 | if(empty($result)) { | |
c1d9cefa | 6 | echo T('Not locked...'); |
37595945 | 7 | echo $this->html->form("$URL/2", 'POST', array( |
180fef5a | 8 | array('reason','','textarea',false,'autofocus','reason:'), |
37595945 TM |
9 | array('lock','lock','submit') |
10 | )); | |
c1d9cefa | 11 | echo(T('By locking you will disable all other users from manipulating records.')); |
37595945 | 12 | } else { |
a5a2984d | 13 | echo $this->html->render_item_table($result, 'lock'); |
37595945 TM |
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'])) { | |
180fef5a TM |
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']); | |
c1d9cefa TM |
25 | $author = $this->db->quote($user); |
26 | $this->db->safe_query("INSERT INTO `lock` (lock_name,lock_author) VALUES ($lock,$author);"); | |
37595945 TM |
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 | } |