Exemplo n.º 1
0
 public function doUpdateAction()
 {
     if (!array_key_exists($this->input('idtype'), $this->model('user')->getIdTypes())) {
         $this->flash(0, '证件类型错误');
     }
     $this->checkActionTarget($user = $this->loadUsableUser($uid = $this->input('uid', 'numeric')));
     $account = array();
     $account['u_permit'] = 0;
     $account['u_phone'] = $this->input('mobile');
     $account['u_idtype'] = $this->input('idtype');
     $account['u_idno'] = $this->input('idno');
     $account['u_rolename'] = $this->input('rolename');
     $permit = $this->input('permit', 'array');
     if (!empty($permit)) {
         foreach ($permit as $key => $val) {
             if (!isset($key[1]) || $key[0] !== 'b' || !Zyon_Util::isBin($bin = substr($key, 1)) || ($dec = bindec($bin)) > PERMIT_MASTER || $dec < 1) {
                 $this->flash(0, '权限分配错误');
             }
             if ($val > 0) {
                 $account['u_permit'] = $account['u_permit'] | $dec;
             }
         }
     }
     if ($this->model('user')->modUser($uid, $account)) {
         $this->flash(1, '更新帐号信息成功');
     }
     $this->flash(0);
 }