Nyni nejde udelat anonymni lock skladu
[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 '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 } 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'])) {
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']);
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 }
This page took 0.259814 seconds and 4 git commands to generate.