Esempio n. 1
0
 /**
  * 用户权限修改
  */
 public function permission()
 {
     $req = req()->_plain();
     if ($req->is_post()) {
         lib()->load("UserControl");
         $uc = new UserControl();
         $uid = $req->post("id");
         $permission = $req->post("permission");
         try {
             switch ($req->post('operate')) {
                 case "add":
                     $uc->PermissionAdd($uid, $permission);
                     $this->rt_msg['status'] = true;
                     break;
                 case "set":
                     $uc->PermissionSet($uid, $permission);
                     $this->rt_msg['status'] = true;
                     break;
             }
         } catch (\Exception $ex) {
             $this->rt_msg['msg'] = $ex->getMessage();
         }
     } else {
         $this->rt_msg['msg'] = "必须以POST提交";
     }
 }
Esempio n. 2
0
 public function reset_password($user = NULL, $code = NULL)
 {
     lib()->load('UserControl');
     $uc = new UserControl();
     $this->theme->setTitle("密码重置");
     $this->__view("Home/header.php");
     $this->__view("Home/reset_password.php", ['user' => $user, 'code' => $code, 'status' => $uc->reset_password_check($user, $code)]);
     $this->__view("Home/footer.php");
 }
Esempio n. 3
0
 public function user_avatar_upload()
 {
     try {
         $this->throwMsgCheck('is_post', 'is_login');
         lib()->load("UserControl");
         $uc = new UserControl();
         $uc->upload_avatar(login_user());
         $this->rt_msg['content'] = Avatar::upload_avatar(login_user());
         if (!req()->is_ajax()) {
             header("Location: " . $_SERVER['HTTP_REFERER']);
         }
         $this->rt_msg['status'] = true;
     } catch (\Exception $ex) {
         $this->rt_msg['msg'] = $ex->getMessage();
         $this->rt_msg['code'] = $ex->getCode();
     }
 }