public function execute(HTTPRequestCustom $request) { $this->init(); $user_id = $request->get_getint('user_id', AppContext::get_current_user()->get_id()); try { $this->user = UserService::get_user($user_id); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_element(); DispatchManager::redirect($error_controller); } try { $this->internal_auth_infos = PHPBoostAuthenticationMethod::get_auth_infos($user_id); } catch (RowNotFoundException $e) { } $this->user_auth_types = AuthenticationService::get_user_types_authentication($user_id); if (!$this->check_authorizations($user_id)) { $error_controller = PHPBoostErrors::user_not_authorized(); DispatchManager::redirect($error_controller); } $associate_type = $request->get_getvalue('associate', false); if ($associate_type) { if (!in_array($associate_type, $this->user_auth_types)) { $authentication_method = AuthenticationService::get_authentication_method($associate_type); AuthenticationService::associate($authentication_method, $user_id); AppContext::get_response()->redirect(UserUrlBuilder::edit_profile($user_id)); } } $dissociate_type = $request->get_getvalue('dissociate', false); if ($dissociate_type) { if (in_array($dissociate_type, $this->user_auth_types) && count($this->user_auth_types) > 1) { $authentication_method = AuthenticationService::get_authentication_method($dissociate_type); AuthenticationService::dissociate($authentication_method, $user_id); AppContext::get_response()->redirect(UserUrlBuilder::edit_profile($user_id)); } } $this->build_form(); if ($this->submit_button->has_been_submited() && $this->form->validate()) { $this->save($request); } $this->tpl->put('FORM', $this->form->display()); return $this->build_response(); }