X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;ds=sidebyside;f=assistants%2Flock.inc.php;fp=assistants%2Flock.inc.php;h=c042ee9bbcdea8f4cde356f5c7393e155fb8ceb0;hb=37595945b02d6e45cfe1d524245a983615383944;hp=0000000000000000000000000000000000000000;hpb=2aa69d71f2e8f1055d0e40af3f917eba75e84906;p=mirrors%2FSokoMan.git diff --git a/assistants/lock.inc.php b/assistants/lock.inc.php new file mode 100644 index 0000000..c042ee9 --- /dev/null +++ b/assistants/lock.inc.php @@ -0,0 +1,33 @@ +db->safe_query_fetch("SELECT * FROM `lock`;"); + if(empty($result)) { + echo 'Not locked...'; + $user=$this->db->auth->get_user_id(); + $username=$this->db->auth->get_username_by_id($user); + echo $this->html->form("$URL/2", 'POST', array( + array('reason',$username,'textarea',false,'autofocus','reason:'), + array('lock','lock','submit') + )); + } else { + echo $this->html->render_item_table($result); + echo $this->html->form("$URL/2", 'POST', array( + array('unlock','unlock','submit') + )); + } + + break; + case 2: + if(isset($_POST['lock'])) { + $lock = $this->db->quote($_POST['reason']); + $this->db->safe_query("INSERT INTO `lock` (lock_name) VALUES ($lock);"); + $this->post_redirect_get("$URL_INTERNAL/1", T('Lock set')); + } + if(isset($_POST['unlock'])) { + $this->db->safe_query("TRUNCATE TABLE `lock`;"); + $this->post_redirect_get("$URL_INTERNAL/1", T('Lock unset')); + } + $this->post_redirect_get("$URL_INTERNAL/1","Lock: No value passed!", true); + break; +}