Exemple #1
0
 /**
  * Save the user from request from AJAX form
  * @return JavaScript code
  */
 function saveUser()
 {
     if ($this->request('hash') == $this->hash()) {
         $u_id = (int) $this->request('u_id');
         if ($u_id) {
             $user = new struct_core_users($this->getAllRequest());
             $user->u_id = $u_id;
             if ($user->u_access < $this->getCurrentUser()->u_access) {
                 echo 'alert("can\'t edit user with rules more then yours");';
                 die;
             }
             $user->addFieldToIgnoresList('u_pass');
             $rows = rad_instances::get('model_core_users')->updateItem($user);
             if ($rows) {
                 echo 'RADUsers.message("' . addslashes($this->lang('updatedrows.sustem.message')) . ': ' . $rows . '");';
                 echo 'RADUsersTree.listUsers(RADUsersTree.getSID());';
             } else {
                 $this->badRequest();
             }
             echo 'RADUsers.cancelClick();';
         } else {
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }