function index()
 {
     import('@.Rover.Tree');
     $tree = new Tree();
     $map['user_id'] = $this->uid;
     $list = $this->categories->where($map)->order('listorder')->select();
     $tree->init($list);
     $_linkAddType = pdm_ux('add?parent=');
     $_linkEditType = pdm_ux('edit?id=');
     $_linkDeleteType = pdm_ux('delete?id=');
     $lanmu = "<span><i class='glyphicon glyphicon-leaf'></i> \$title (\$sum)</span> <a href='{$_linkAddType}\$id'>添加子类</a> | <a href='{$_linkEditType}\$id'>修改</a> | <a href='{$_linkDeleteType}\$id'>删除</a>";
     $moji = "<span><i class='glyphicon glyphicon-minus-sign'></i> \$title (\$sum)</span> <a href='{$_linkAddType}\$id'>添加子类</a> | <a href='{$_linkEditType}\$id'>修改</a> | <a href='{$_linkDeleteType}\$id'>删除</a>";
     $html = $tree->get_treeview(0, 'myTree', $lanmu, $moji);
     $this->assign('html', $html);
     $this->display();
 }
Exemple #2
0
 function add()
 {
     if (IS_POST) {
         $post = I('post.');
         $this->_check_form($post);
         $data['uname'] = pdm_encode($post['uname'], $this->auth_code);
         $data['pwd'] = pdm_encode($post['pwd'], $this->auth_code);
         $data['category_id'] = $post['category_id'];
         $data['user_id'] = $this->uid;
         $data['add_time'] = NOW_TIME;
         $data['add_ip'] = get_client_ip(1);
         $data['note'] = $post['note'];
         $data['title'] = $post['title'];
         if ($this->password->add($data) !== false) {
             $map_categories['id'] = $post['category_id'];
             $map_categories['user_id'] = $this->uid;
             $data_categories['sum'] = array('exp', 'sum+1');
             $this->categories->where($map_categories)->save($data_categories);
             $this->success('密码添加成功!', pdm_ux('index'));
         } else {
             $this->error('密码添加失败!');
         }
     } else {
         $get = I('get.');
         if ($get['sign'] != '') {
             $map_history['id'] = pdm_code($get['sign'], 'DECODE');
             $map_history['user_id'] = $this->uid;
             $data_history = $this->history->where($map_history)->field('uname,pwd')->find();
             if ($data_history == null) {
                 $this->error('参数不正确!');
             }
             $data['uname'] = pdm_decode($data_history['uname'], $this->auth_code);
             $data['pwd'] = pdm_decode($data_history['pwd'], $this->auth_code);
         }
         $map['user_id'] = $this->uid;
         $list = $this->categories->where($map)->order('listorder')->select();
         import('@.Rover.Tree');
         $tree = new Tree();
         $tree->init($list);
         $str = "<option \$css value=\$id \$selected>\$spacer\$title</option>";
         $selected = $tree->get_tree(0, $str, $get['typeid']);
         $this->assign('selected', $selected);
         $this->assign('data', $data);
         $this->display('mod');
     }
 }
Exemple #3
0
 /**
  * 重置密码
  */
 function resetpassword()
 {
     if (IS_POST) {
         $post = I('post.');
         if ($post['password'] == '') {
             $this->error('密码不能为空!');
         }
         $id = pdm_code($post['id'], 'DECODE');
         if ($id == null) {
             $this->error(PDM_ERROR);
         }
         $map['id'] = $id;
         $data['password'] = pdm_encode($post['password']);
         if ($this->user->where($map)->save($data) !== false) {
             $this->success('密码重置成功!', pdm_ux('login'));
         } else {
             $this->error('密码重置失败!');
         }
     } else {
         $sign = I('sign');
         $map['email'] = pdm_code($sign, 'DECODE');
         $map['email_auth'] = 1;
         $data = $this->user->where($map)->field('id,email')->find();
         if ($data == null) {
             $this->error('链接失效了!', pdm_ux('login'));
         }
         $this->assign('data', $data);
         $this->display();
     }
 }
Exemple #4
0
 /**
  * 注销
  */
 function logout()
 {
     session('user', null);
     redirect(pdm_ux('Home/Account/login'));
 }