Exemplo n.º 1
0
 public function edit()
 {
     $this->view_override = FALSE;
     if ($this->input->post()) {
         //表单验证
         $this->load->library('form_validation');
         if ($this->form_validation->run('tools/setup/edit') === FALSE) {
             error_redirct("tools/setup/edit/?dwz=" . $_POST['dwz']);
         } else {
             $this->tools_setup_model->update_data($this->input->post(), $this->fid);
             success_redirct("tools/setup/pannel/?dwz=" . $_POST['dwz']);
         }
     } else {
         if ($_GET['dwz']) {
             $data = $this->tools_setup_model->get_info($this->fid);
             $this->load->view("tools/setup/edit", $data);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * 修改面板
  */
 public function edit()
 {
     $this->view_override = FALSE;
     if (!empty($_POST)) {
         //表单验证
         $this->load->library('form_validation');
         if ($this->form_validation->run('tools/tasks/edit') === FALSE) {
             error_redirct("tools/tasks/edit/?dwz=" . $_POST['dwz']);
         } else {
             $this->tools_task_model->update_data($this->fid, $_POST['borad'], $_POST['task']);
             success_redirct("tools/tasks/pannel/?dwz=" . $_POST['dwz']);
         }
     } else {
         if ($_GET['dwz']) {
             $data = $this->tools_task_model->get_info($this->fid);
             $this->load->view("tools/tasks/edit", $data);
         }
     }
 }
Exemplo n.º 3
0
 public function logout()
 {
     session_destroy();
     success_redirct($this->config->item('rbac_auth_gateway'), "登出成功!", 2);
 }
Exemplo n.º 4
0
 /**
  * 人员删除
  * @param number $id
  */
 public function delete($id)
 {
     $query = $this->db->query("SELECT * FROM rbac_user WHERE id = " . $id);
     $data = $query->row_array();
     if ($data) {
         if ($this->input->post()) {
             $verfiy = $this->input->post("verfiy");
             if ($verfiy) {
                 $sql = "DELETE FROM rbac_user WHERE id = " . $id . " ";
                 $this->db->query($sql);
                 success_redirct("manage/member/index", "用户删除成功");
             } else {
                 error_redirct("manage/member/index", "操作失败");
             }
         }
         $this->load->view("manage/member/delete", array("data" => $data));
     } else {
         error_redirct("manage/member/index", "未找到此用户");
     }
 }
Exemplo n.º 5
0
 /**
  * 修改节点
  * @param unknown $id
  */
 public function edit($id)
 {
     $query = $this->db->query("SELECT * FROM rbac_node WHERE id = " . $id);
     $data = $query->row_array();
     if ($data) {
         if ($this->input->post()) {
             $memo = $this->input->post("memo");
             $status = $this->input->post("status") == 1 ? 1 : 0;
             if ($memo) {
                 $sql = "UPDATE rbac_node set `memo`='{$memo}',`status` = '{$status}' WHERE id = {$id}";
                 $this->db->query($sql);
                 success_redirct("manage/node/index", "节点修改成功");
             } else {
                 error_redirct('', "信息填写不全!");
             }
         }
         $this->load->view("manage/node/edit", array('data' => $data));
     } else {
         error_redirct("manage/node/index", "未找到此节点");
     }
 }
Exemplo n.º 6
0
 /**
  * 菜单修改
  */
 public function edit($id, $level, $p_id = "NULL")
 {
     if ($this->input->post()) {
         $id = $this->input->post("id");
         $title = $this->input->post("title");
         $sort = $this->input->post("sort");
         $node = $this->input->post("node");
         $level = $this->input->post("level");
         if ($id && $level) {
             if ($title) {
                 $p_id = $this->input->post("p_id") == "NULL" ? "p_id = NULL" : "p_id='{$p_id}'";
                 $status = $this->input->post("status") == "" ? "status='0'" : "status='1'";
                 $sql = "UPDATE rbac_menu SET {$status},title='{$title}',sort='{$sort}',node_id='{$node}',{$p_id} WHERE id = '{$id}'";
                 $this->db->query($sql);
                 success_redirct("manage/menu/index", "菜单修改成功!");
             } else {
                 error_redirct("", "标题不能为空!");
             }
         } else {
             error_redirct("", "参数不正确!");
         }
     }
     $query = $this->db->query("SELECT rm.id,rm.title,rm.node_id,rm.p_id,rm.sort,rm.status,rn.memo FROM rbac_menu rm left join rbac_node rn on rm.node_id = rn.id WHERE rm.id =" . $id);
     $data = $query->row_array();
     if ($data) {
         $rbac_where = "";
         $node_hidden_array = $this->config->item('rbac_manage_node_hidden');
         if (!empty($node_hidden_array)) {
             foreach ($node_hidden_array as $node_hidden) {
                 $rbac_where .= "AND dirc != '{$node_hidden}' ";
             }
         }
         $node_query = $this->db->query("SELECT * FROM rbac_node WHERE status = 1 {$rbac_where} ORDER BY dirc,cont");
         $node_data = $node_query->result();
         $this->load->view("manage/menu/edit", array("data" => $data, "node" => $node_data, "level" => $level, "p_id" => $p_id));
     } else {
         error_redirct("manage/menu/index", "未找到此菜单");
     }
 }
Exemplo n.º 7
0
 /**
  * 角色赋权
  * @param number $id
  */
 public function action($id, $node_id = NULL)
 {
     if (!$id) {
         error_redirct("manage/role/index", "未找到此角色");
     }
     if ($node_id != NULL) {
         $query = $this->db->query("SELECT node_id FROM rbac_auth WHERE node_id= {$node_id} AND role_id={$id}");
         $data = $query->row_array();
         if ($data) {
             $sql = "DELETE FROM rbac_auth WHERE node_id= {$node_id} AND role_id={$id}";
         } else {
             $sql = "INSERT INTO rbac_auth (`node_id`,`role_id`) values('{$node_id}','{$id}')";
         }
         $this->db->query($sql);
         success_redirct("", "节点操作成功", 1);
     }
     $rbac_where = "";
     $node_hidden_array = $this->config->item('rbac_manage_node_hidden');
     if (!empty($node_hidden_array)) {
         $rbac_where = "WHERE ";
         foreach ($node_hidden_array as $node_hidden) {
             $rbac_where .= "dirc != '{$node_hidden}' AND ";
         }
         $rbac_where = substr($rbac_where, 0, -4);
     }
     $query = $this->db->query("SELECT * FROM rbac_node {$rbac_where} ORDER BY dirc,cont,func");
     $data = $query->result();
     foreach ($data as $vo) {
         $node_list[$vo->dirc][$vo->cont][$vo->func] = $vo;
     }
     $query = $this->db->query("SELECT id,dirc,cont,func FROM `rbac_node` WHERE id in (SELECT node_id FROM `rbac_auth` WHERE role_id = " . $id . ")");
     $role_data = $query->result();
     foreach ($role_data as $vo) {
         $role_node_list[$vo->dirc][$vo->cont][$vo->func] = TRUE;
     }
     if (!isset($role_node_list)) {
         $role_node_list = NULL;
     }
     $this->load->view('manage/role/action', array('role_id' => $id, 'node' => $node_list, 'rnl' => $role_node_list));
 }