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)) { | |
6 | echo '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 | )); | |
11 | } else { | |
12 | echo $this->html->render_item_table($result); | |
13 | echo $this->html->form("$URL/2", 'POST', array( | |
14 | array('unlock','unlock','submit') | |
15 | )); | |
16 | } | |
17 | ||
18 | break; | |
19 | case 2: | |
20 | if(isset($_POST['lock'])) { | |
180fef5a TM |
21 | $user=$this->db->auth->get_user_id(); |
22 | $username=$this->db->auth->get_username_by_id($user); | |
23 | $lock = $this->db->quote($username.': '.$_POST['reason']); | |
37595945 TM |
24 | $this->db->safe_query("INSERT INTO `lock` (lock_name) VALUES ($lock);"); |
25 | $this->post_redirect_get("$URL_INTERNAL/1", T('Lock set')); | |
26 | } | |
27 | if(isset($_POST['unlock'])) { | |
28 | $this->db->safe_query("TRUNCATE TABLE `lock`;"); | |
29 | $this->post_redirect_get("$URL_INTERNAL/1", T('Lock unset')); | |
30 | } | |
31 | $this->post_redirect_get("$URL_INTERNAL/1","Lock: No value passed!", true); | |
32 | break; | |
33 | } |