17 use Psr\Http\Message\ResponseInterface;
18 use Psr\Http\Message\ServerRequestInterface;
80 'OLD_BE_USER' =>
'Using $OLD_BE_USER of class SetupModuleController from the outside is discouraged, the variable will be removed.',
81 'MOD_MENU' =>
'Using $MOD_MENU of class SetupModuleController from the outside is discouraged, the variable will be removed.',
82 'MOD_SETTINGS' =>
'Using $MOD_SETTINGS of class SetupModuleController from the outside is discouraged, the variable will be removed.',
83 'content' =>
'Using $content of class SetupModuleController from the outside is discouraged, as this variable is only used for internal storage.',
84 'overrideConf' =>
'Using $overrideConf of class SetupModuleController from the outside is discouraged, as this variable is only used for internal storage.',
85 'languageUpdate' =>
'Using $languageUpdate of class SetupModuleController from the outside is discouraged, as this variable is only used for internal storage.',
92 'storeIncomingData' =>
'Using SetupModuleController::storeIncomingData() is deprecated and will not be possible anymore in TYPO3 v10.0.',
93 'main' =>
'Using SetupModuleController::main() is deprecated and will not be possible anymore in TYPO3 v10.0.',
94 'init' =>
'Using SetupModuleController::init() is deprecated and will not be possible anymore in TYPO3 v10.0.',
203 $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
205 $pageRenderer = $this->moduleTemplate->getPageRenderer();
206 $pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/Modal');
207 $pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Backend/FormEngine');
208 $pageRenderer->addInlineSetting(
'FormEngine',
'formName',
'editform');
209 $pageRenderer->addInlineLanguageLabelArray([
210 'FormEngine.remainingCharacters' => $this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.remainingCharacters'),
222 trigger_error(
'SetupModuleController->getFormProtection() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
234 $d = GeneralUtility::_POST(
'data');
235 $columns =
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'columns'];
237 $beUserId = $backendUser->user[
'uid'];
240 if (is_array($d) && $this->formProtection->validateToken((
string)GeneralUtility::_POST(
'formToken'),
'BE user setup',
'edit')) {
242 $save_before = md5(serialize($backendUser->uc));
245 if (isset($d[
'lang']) && $d[
'lang'] != $backendUser->uc[
'lang']) {
246 $this->languageUpdate =
true;
249 if (isset($d[
'titleLen']) && $d[
'titleLen'] !== $backendUser->uc[
'titleLen']) {
250 $this->pagetreeNeedsRefresh =
true;
252 if ($d[
'setValuesToDefault']) {
254 $backendUser->resetUC();
255 $this->settingsAreResetToDefault =
true;
256 } elseif ($d[
'save']) {
258 foreach ($columns as $field => $config) {
259 if (!in_array($field, $fieldList)) {
262 if ($config[
'table']) {
263 if ($config[
'table'] ===
'be_users' && !in_array($field, [
'password',
'password2',
'passwordCurrent',
'email',
'realName',
'admin',
'avatar'])) {
264 if (!isset($config[
'access']) || $this->
checkAccess($config) && $backendUser->user[$field] !== $d[
'be_users'][$field]) {
265 if ($config[
'type'] ===
'check') {
266 $fieldValue = isset($d[
'be_users'][$field]) ? 1 : 0;
268 $fieldValue = $d[
'be_users'][$field];
270 $storeRec[
'be_users'][$beUserId][$field] = $fieldValue;
271 $backendUser->user[$field] = $fieldValue;
275 if ($config[
'type'] ===
'check') {
276 $backendUser->uc[$field] = isset($d[$field]) ? 1 : 0;
278 $backendUser->uc[$field] = htmlspecialchars($d[$field]);
283 $be_user_data = $d[
'be_users'];
285 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/setup/mod/index.php'][
'modifyUserDataBeforeSave'] ?? [] as $function) {
286 $params = [
'be_user_data' => &$be_user_data];
287 GeneralUtility::callUserFunction($function, $params, $this);
289 $this->passwordIsSubmitted = (string)$be_user_data[
'password'] !==
'';
290 $passwordIsConfirmed = $this->passwordIsSubmitted && $be_user_data[
'password'] === $be_user_data[
'password2'];
292 if ($be_user_data[
'realName'] !== $backendUser->user[
'realName']) {
293 $backendUser->user[
'realName'] = ($storeRec[
'be_users'][$beUserId][
'realName'] = substr($be_user_data[
'realName'], 0, 80));
296 if ($be_user_data[
'email'] !== $backendUser->user[
'email']) {
297 $backendUser->user[
'email'] = ($storeRec[
'be_users'][$beUserId][
'email'] = substr($be_user_data[
'email'], 0, 80));
300 if ($passwordIsConfirmed) {
301 if ($this->isAdmin) {
304 $currentPasswordHashed =
$GLOBALS[
'BE_USER']->user[
'password'];
306 $saltFactory = GeneralUtility::makeInstance(PasswordHashFactory::class);
308 $hashInstance = $saltFactory->get($currentPasswordHashed,
'BE');
309 $passwordOk = $hashInstance->checkPassword($be_user_data[
'passwordCurrent'], $currentPasswordHashed);
310 }
catch (InvalidPasswordHashException $e) {
317 $storeRec[
'be_users'][$beUserId][
'password'] = $be_user_data[
'password'];
327 $this->saveData =
true;
330 $backendUser->overrideUC();
331 $save_after = md5(serialize($backendUser->uc));
333 if ($save_before != $save_after) {
334 $backendUser->writeUC($backendUser->uc);
335 $backendUser->writelog(254, 1, 0, 1,
'Personal settings changed', []);
336 $this->setupIsUpdated =
true;
339 if (!empty($storeRec) && $this->saveData) {
341 $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
342 $dataHandler->start($storeRec, []);
343 $dataHandler->admin =
true;
345 $dataHandler->bypassWorkspaceRestrictions =
true;
346 $dataHandler->process_datamap();
347 if ($this->passwordIsUpdated === self::PASSWORD_NOT_UPDATED || count($storeRec[
'be_users'][$beUserId]) > 1) {
348 $this->setupIsUpdated =
true;
358 protected function init()
360 $this->
getLanguageService()->includeLLFile(
'EXT:setup/Resources/Private/Language/locallang.xlf');
362 $this->isAdmin = $backendUser->isAdmin();
364 $this->overrideConf = $backendUser->getTSConfig()[
'setup.'][
'override.'] ??
null;
366 $this->tsFieldConf = $backendUser->getTSConfig()[
'setup.'][
'fields.'] ??
null;
368 if (isset($this->tsFieldConf[
'password.']) && $this->tsFieldConf[
'password.'][
'disabled']) {
369 $this->tsFieldConf[
'password2.'][
'disabled'] = 1;
370 $this->tsFieldConf[
'passwordCurrent.'][
'disabled'] = 1;
382 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/setup/mod/index.php'][
'setupScriptHook'] ?? [] as $function) {
384 $javaScript .= GeneralUtility::callUserFunction($function, $params, $this);
392 protected function main()
394 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
395 $this->content .=
'<form action="' . (string)$uriBuilder->buildUriFromRoute(
'user_setup') .
'" method="post" id="SetupModuleController" name="usersetup" enctype="multipart/form-data">';
396 if ($this->languageUpdate) {
397 $this->moduleTemplate->addJavaScriptCode(
'languageUpdate',
'
398 if (top && top.TYPO3.ModuleMenu.App) {
399 top.TYPO3.ModuleMenu.App.refreshMenu();
401 if (top && top.TYPO3.Backend.Topbar) {
402 top.TYPO3.Backend.Topbar.refresh();
406 if ($this->pagetreeNeedsRefresh) {
410 $this->moduleTemplate->getPageRenderer()->addJsFile(
'EXT:backend/Resources/Public/JavaScript/md5.js');
412 $this->content .=
'<div id="user-setup-wrapper">';
413 $this->content .= $this->moduleTemplate->header($this->
getLanguageService()->getLL(
'UserSettings'));
418 $this->content .= $this->moduleTemplate->getDynamicTabMenu($menuItems,
'user-setup', 1,
false,
false);
419 $formToken = $this->formProtection->generateToken(
'BE user setup',
'edit');
420 $this->content .=
'<div>';
421 $this->content .=
'<input type="hidden" name="simUser" value="' . (int)$this->simUser .
'" />
422 <input type="hidden" name="formToken" value="' . htmlspecialchars($formToken) .
'" />
423 <input type="hidden" value="1" name="data[save]" />
424 <input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" />';
425 $this->content .=
'</div>';
427 $this->content .=
'</div>';
432 $this->moduleTemplate->setContent($this->content);
433 $this->content .=
'</form>';
443 public function mainAction(ServerRequestInterface $request): ResponseInterface
448 return new HtmlResponse($this->moduleTemplate->renderContent());
456 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
457 $cshButton = $buttonBar->makeHelpButton()
458 ->setModuleName(
'_MOD_user_setup')
460 $buttonBar->addButton($cshButton);
462 $saveButton = $buttonBar->makeInputButton()
463 ->setName(
'data[save]')
464 ->setTitle($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.saveDoc'))
466 ->setForm(
'SetupModuleController')
467 ->setShowLabelText(
true)
468 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-document-save',
Icon::SIZE_SMALL));
470 $buttonBar->addButton($saveButton);
471 $shortcutButton = $buttonBar->makeShortcutButton()
472 ->setModuleName($this->moduleName);
473 $buttonBar->addButton($shortcutButton);
497 foreach ($fieldArray as $fieldName) {
498 $config =
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'columns'][$fieldName];
499 if (isset($config[
'access']) && !$this->
checkAccess($config)) {
503 if (strpos($fieldName,
'--div--;') === 0) {
504 if ($firstTabLabel ===
'') {
506 $tabLabel = $this->
getLabel(substr($fieldName, 8),
'',
false);
507 $firstTabLabel = $tabLabel;
510 'label' => $tabLabel,
511 'content' => count($code) ? implode(LF, $code) :
''
513 $tabLabel = $this->
getLabel(substr($fieldName, 8),
'',
false);
518 $label = $this->
getLabel($config[
'label'], $fieldName);
519 $label = $this->
getCSH($config[
'csh'] ?: $fieldName, $label);
520 $type = $config[
'type'];
521 $class = $config[
'class'];
522 if ($type !==
'check') {
523 $class .=
' form-control';
527 $more .=
' class="' . htmlspecialchars($class) .
'"';
529 $style = $config[
'style'];
531 $more .=
' style="' . htmlspecialchars($style) .
'"';
533 if (isset($this->overrideConf[$fieldName])) {
534 $more .=
' disabled="disabled"';
536 $value = $config[
'table'] ===
'be_users' ? $backendUser->user[$fieldName] : $backendUser->uc[$fieldName];
537 if (!$value && isset($config[
'default'])) {
538 $value = $config[
'default'];
541 if ($config[
'table'] ===
'be_users') {
542 $dataAdd =
'[be_users]';
550 $noAutocomplete =
'';
552 $maxLength = $config[
'max'] ?? 0;
553 if ((
int)$maxLength > 0) {
554 $more .=
' maxlength="' . (int)$maxLength .
'"';
557 if ($type ===
'password') {
559 $noAutocomplete =
'autocomplete="new-password" ';
560 $more .=
' data-rsa-encryption=""';
562 $html =
'<input id="field_' . htmlspecialchars($fieldName) .
'"
563 type="' . htmlspecialchars($type) .
'"
564 name="data' . $dataAdd .
'[' . htmlspecialchars($fieldName) .
']" ' .
566 'value="' . htmlspecialchars($value) .
'" ' .
571 $html = $label .
'<div class="checkbox"><label><input id="field_' . htmlspecialchars($fieldName) .
'"
573 name="data' . $dataAdd .
'[' . htmlspecialchars($fieldName) .
']"' .
574 ($value ?
' checked="checked"' :
'') .
580 if ($config[
'itemsProcFunc']) {
581 $html = GeneralUtility::callUserFunction($config[
'itemsProcFunc'], $config, $this);
583 $html =
'<select id="field_' . htmlspecialchars($fieldName) .
'"
584 name="data' . $dataAdd .
'[' . htmlspecialchars($fieldName) .
']"' .
586 foreach ($config[
'items'] as $key => $optionLabel) {
587 $html .=
'<option value="' . htmlspecialchars($key) .
'"' . ($value == $key ?
' selected="selected"' :
'') .
'>' . $this->
getLabel($optionLabel,
'',
false) .
'</option>' . LF;
589 $html .=
'</select>';
593 $html = GeneralUtility::callUserFunction($config[
'userFunc'], $config, $this);
596 if ($config[
'onClick']) {
597 $onClick = $config[
'onClick'];
598 if ($config[
'onClickLabels']) {
599 foreach ($config[
'onClickLabels'] as $key => $labelclick) {
600 $config[
'onClickLabels'][$key] = $this->
getLabel($labelclick,
'',
false);
602 $onClick = vsprintf($onClick, $config[
'onClickLabels']);
604 $html =
'<br><input class="btn btn-default" type="button"
605 value="' . $this->
getLabel($config[
'buttonlabel'],
'',
false) .
'"
606 onclick="' . $onClick .
'" />';
608 if (!empty($config[
'confirm'])) {
609 $confirmData = $config[
'confirmData'];
610 $html =
'<br><input class="btn btn-default t3js-modal-trigger" type="button"'
611 .
' value="' . $this->
getLabel($config[
'buttonlabel'],
'',
false) .
'"'
612 .
' data-href="javascript:' . htmlspecialchars($confirmData[
'jsCodeAfterOk']) .
'"'
613 .
' data-severity="warning"'
614 .
' data-title="' . $this->
getLabel($config[
'label'],
'',
false) .
'"'
615 .
' data-content="' . $this->
getLabel($confirmData[
'message'],
'',
false) .
'" />';
623 if ($avatarFileUid) {
624 $defaultAvatarProvider = GeneralUtility::makeInstance(DefaultAvatarProvider::class);
625 $avatarImage = $defaultAvatarProvider->getImage($backendUser->user, 32);
627 $icon =
'<span class="avatar"><span class="avatar-image">' .
628 '<img src="' . htmlspecialchars($avatarImage->getUrl(
true)) .
'"' .
629 ' width="' . (int)$avatarImage->getWidth() .
'" ' .
630 'height="' . (int)$avatarImage->getHeight() .
'" />' .
632 $html .=
'<span class="pull-left" style="padding-right: 10px" id="image_' . htmlspecialchars($fieldName) .
'">' . $icon .
' </span>';
635 $html .=
'<input id="field_' . htmlspecialchars($fieldName) .
'" type="hidden" ' .
636 'name="data' . $dataAdd .
'[' . htmlspecialchars($fieldName) .
']"' . $more .
637 ' value="' . (int)$avatarFileUid .
'" />';
639 $html .=
'<div class="btn-group">';
640 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
641 if ($avatarFileUid) {
643 '<button type="button" id="clear_button_' . htmlspecialchars($fieldName) .
'" aria-label="' . htmlspecialchars($this->
getLanguageService()->getLL(
'avatar.clear')) .
'" '
644 .
'onclick="clearExistingImage(); return false;" class="btn btn-default">'
649 '<button type="button" id="add_button_' . htmlspecialchars($fieldName) .
'" class="btn btn-default btn-add-avatar"'
650 .
' aria-label="' . htmlspecialchars($this->
getLanguageService()->getLL(
'avatar.openFileBrowser')) .
'"'
651 .
' onclick="openFileBrowser();return false;">'
661 $code[] =
'<div class="form-section"><div class="row"><div class="form-group t3js-formengine-field-item col-md-12">' .
664 '</div></div></div>';
668 'label' => $tabLabel,
669 'content' => count($code) ? implode(LF, $code) :
''
684 $languageOptions = [];
686 $langDefault = htmlspecialchars($language->getLL(
'lang_default'));
687 $languageOptions[$langDefault] =
'<option value=""' . ($backendUser->uc[
'lang'] ===
'' ?
' selected="selected"' :
'') .
'>' . $langDefault .
'</option>';
688 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'lang'][
'availableLanguages'])) {
690 $locales = GeneralUtility::makeInstance(Locales::class);
693 foreach ($languages as $locale => $name) {
694 if ($locale !==
'default') {
695 $defaultName = isset(
$GLOBALS[
'LOCAL_LANG'][
'default'][
'lang_' . $locale]) ?
$GLOBALS[
'LOCAL_LANG'][
'default'][
'lang_' . $locale][0][
'source'] : $name;
696 $localizedName = htmlspecialchars($language->getLL(
'lang_' . $locale));
697 if ($localizedName ===
'') {
698 $localizedName = htmlspecialchars($name);
700 $localLabel =
' - [' . htmlspecialchars($defaultName) .
']';
703 $languageOptions[$defaultName] =
'<option value="' . $locale .
'"' . ($backendUser->uc[
'lang'] === $locale ?
' selected="selected"' :
'') .
'>' . $localizedName . $localLabel .
'</option>';
708 ksort($languageOptions);
710 <select id="field_lang" name="data[lang]" class="form-control">' . implode(
'', $languageOptions) .
'
714 $languageUnavailableWarning =
'The selected language "' . htmlspecialchars($language->getLL(
'lang_' . $backendUser->uc[
'lang'])) .
'" is not available before the language files are installed. <br /> ' . ($backendUser->isAdmin() ?
'You can use the Language module to easily download new language files.' :
'Please ask your system administrator to do this.');
715 $languageCode =
'<br /><span class="label label-danger">' . $languageUnavailableWarning .
'</span><br /><br />' . $languageCode;
717 return $languageCode;
731 $loadModules = GeneralUtility::makeInstance(ModuleLoader::class);
732 $loadModules->observeWorkspaces =
true;
733 $loadModules->load(
$GLOBALS[
'TBE_MODULES']);
734 $startModuleSelect =
'<option value="">' . htmlspecialchars($language->getLL(
'startModule.firstInMenu')) .
'</option>';
735 foreach ($loadModules->modules as $mainMod => $modData) {
736 if (!empty($modData[
'sub']) && is_array($modData[
'sub'])) {
738 foreach ($modData[
'sub'] as $subData) {
739 $modName = $subData[
'name'];
740 $modules .=
'<option value="' . htmlspecialchars($modName) .
'"';
741 $modules .= $backendUser->uc[
'startModule'] === $modName ?
' selected="selected"' :
'';
742 $modules .=
'>' . htmlspecialchars($language->sL($loadModules->getLabelsForModule($modName)[
'title'])) .
'</option>';
744 $groupLabel = htmlspecialchars($language->sL($loadModules->getLabelsForModule($mainMod)[
'title']));
745 $startModuleSelect .=
'<optgroup label="' . htmlspecialchars($groupLabel) .
'">' . $modules .
'</optgroup>';
748 return '<select id="field_startModule" name="data[startModule]" class="form-control">' . $startModuleSelect .
'</select>';
759 trigger_error(
'SetupModuleController->simulateUser() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
762 $this->simulateSelector =
'';
763 unset($this->OLD_BE_USER);
765 if ($currentBeUser->isAdmin()) {
766 $this->simUser = (int)GeneralUtility::_GP(
'simUser');
767 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'be_users');
768 $users = $queryBuilder
772 $queryBuilder->expr()->neq(
774 $queryBuilder->createNamedParameter($currentBeUser->user[
'uid'], \PDO::PARAM_INT)
776 $queryBuilder->expr()->notLike(
778 $queryBuilder->createNamedParameter(
779 $queryBuilder->escapeLikeWildcards(
'_cli_') .
'%',
784 ->orderBy(
'username')
788 foreach ($users as $rr) {
789 $label = $rr[
'username'] . ($rr[
'realName'] ?
' (' . $rr[
'realName'] .
')' :
'');
790 $opt[] =
'<option value="' . (int)$rr[
'uid'] .
'"' . ($this->simUser === (
int)$rr[
'uid'] ?
' selected="selected"' :
'') .
'>' . htmlspecialchars($label) .
'</option>';
793 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
794 $this->simulateSelector =
'<select id="field_simulate" class="form-control" name="simulateUser" onchange="window.location.href=' . GeneralUtility::quoteJSvalue((
string)$uriBuilder->buildUriFromRoute(
'user_setup') .
'&simUser=') .
'+this.options[this.selectedIndex].value;"><option></option>' . implode(
'', $opt) .
'</select>';
798 if ($this->simUser > 0) {
800 $this->OLD_BE_USER = $currentBeUser;
803 $currentBeUser = GeneralUtility::makeInstance(BackendUserAuthentication::class);
804 $currentBeUser->setBeUserByUid($this->simUser);
805 $currentBeUser->fetchGroupData();
806 $currentBeUser->backendSetUC();
818 $access = $config[
'access'];
820 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'setup'][
'accessLevelCheck'][$access])) {
821 if (class_exists($access)) {
822 $accessObject = GeneralUtility::makeInstance($access);
823 if (method_exists($accessObject,
'accessLevelCheck')) {
825 return $accessObject->accessLevelCheck($config);
828 } elseif ($access ===
'admin') {
843 protected function getLabel($str, $key =
'', $addLabelTag =
true)
845 if (strpos($str,
'LLL:') === 0) {
848 $out = htmlspecialchars($str);
850 if (isset($this->overrideConf[$key ?: $str])) {
851 $out =
'<span style="color:#999999">' . $out .
'</span>';
854 $out =
'<label>' . $out .
'</label>';
866 protected function getCSH($str, $label)
868 $context =
'_MOD_user_setup';
870 $strParts = explode(
':', $str);
871 if (count($strParts) > 1) {
873 $context = $strParts[0];
874 $field = $strParts[1];
875 } elseif ($str !==
'language' && $str !==
'simuser' && $str !==
'reset') {
876 $field =
'option_' . $str;
889 $allowedFields = GeneralUtility::trimExplode(
',',
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'showitem'],
true);
890 if ($this->isAdmin) {
892 $key = array_search(
'passwordCurrent', $allowedFields);
893 if ($key !==
false) {
894 unset($allowedFields[$key]);
899 $systemMaintainers = array_map(
'intval',
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'systemMaintainers'] ?? []);
900 $isCurrentUserInSystemMaintainerList = in_array((
int)$backendUser->user[
'uid'], $systemMaintainers,
true);
901 $isInSimulateUserMode = (int)$backendUser->user[
'ses_backuserid'] !== 0;
902 if ($isInSimulateUserMode && $isCurrentUserInSystemMaintainerList) {
905 $key = array_search(
'password', $allowedFields);
906 if ($key !==
false) {
907 unset($allowedFields[$key]);
909 $key = array_search(
'password2', $allowedFields);
910 if ($key !==
false) {
911 unset($allowedFields[$key]);
915 if (!is_array($this->tsFieldConf)) {
916 return $allowedFields;
918 foreach ($this->tsFieldConf as $fieldName => $userTsFieldConfig) {
919 if (!empty($userTsFieldConfig[
'disabled'])) {
920 $fieldName = rtrim($fieldName,
'.');
921 $key = array_search($fieldName, $allowedFields);
922 if ($key !==
false) {
923 unset($allowedFields[$key]);
927 return $allowedFields;
938 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_file_reference');
939 $file = $queryBuilder
940 ->select(
'uid_local')
941 ->from(
'sys_file_reference')
943 $queryBuilder->expr()->eq(
945 $queryBuilder->createNamedParameter(
'be_users', \PDO::PARAM_STR)
947 $queryBuilder->expr()->eq(
949 $queryBuilder->createNamedParameter(
'avatar', \PDO::PARAM_STR)
951 $queryBuilder->expr()->eq(
953 $queryBuilder->createNamedParameter(
'sys_file', \PDO::PARAM_STR)
955 $queryBuilder->expr()->eq(
957 $queryBuilder->createNamedParameter($beUserId, \PDO::PARAM_INT)
981 if (empty($fileUid)) {
985 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_file_reference');
986 $queryBuilder->getRestrictions()->removeAll();
988 ->delete(
'sys_file_reference')
990 $queryBuilder->expr()->eq(
992 $queryBuilder->createNamedParameter(
'be_users', \PDO::PARAM_STR)
994 $queryBuilder->expr()->eq(
996 $queryBuilder->createNamedParameter(
'avatar', \PDO::PARAM_STR)
998 $queryBuilder->expr()->eq(
1000 $queryBuilder->createNamedParameter(
'sys_file', \PDO::PARAM_STR)
1002 $queryBuilder->expr()->eq(
1004 $queryBuilder->createNamedParameter($beUserId, \PDO::PARAM_INT)
1010 if ($fileUid ===
'delete') {
1020 }
catch (FileDoesNotExistException $e) {
1025 if ($file && $this->simUser === 0 && !$file->getStorage()->checkFileActionPermission(
'read', $file)) {
1030 if ($file && GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'], $file->getExtension())) {
1033 $storeRec[
'sys_file_reference'][
'NEW1234'] = [
1034 'uid_local' => (int)$fileUid,
1035 'uid_foreign' => (
int)$beUserId,
1036 'tablenames' =>
'be_users',
1037 'fieldname' =>
'avatar',
1039 'table_local' =>
'sys_file',
1041 $storeRec[
'be_users'][(int)$beUserId][
'avatar'] =
'NEW1234';
1053 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
1054 $this->moduleTemplate->addJavaScriptCode(
'avatar-button',
'
1057 function openFileBrowser() {
1058 var url = ' . GeneralUtility::quoteJSvalue((
string)$uriBuilder->buildUriFromRoute(
'wizard_element_browser', [
'mode' =>
'file',
'bparams' =>
'||||dummy|setFileUid'])) .
';
1059 browserWin = window.open(url,"Typo3WinBrowser","height=650,width=800,status=0,menubar=0,resizable=1,scrollbars=1");
1063 function clearExistingImage() {
1064 $(' . GeneralUtility::quoteJSvalue(
'#image_' . htmlspecialchars($fieldName)) .
').hide();
1065 $(' . GeneralUtility::quoteJSvalue(
'#clear_button_' . htmlspecialchars($fieldName)) .
').hide();
1066 $(' . GeneralUtility::quoteJSvalue(
'#field_' . htmlspecialchars($fieldName)) .
').val(\'delete\');
1069 function setFileUid(field, value, fileUid) {
1070 clearExistingImage();
1071 $(' . GeneralUtility::quoteJSvalue(
'#field_' . htmlspecialchars($fieldName)) .
').val(fileUid);
1072 $(' . GeneralUtility::quoteJSvalue(
'#add_button_' . htmlspecialchars($fieldName)) .
').removeClass(\'btn-default\').addClass(\'btn-info\');
1104 $flashMessages = [];
1107 if ($this->setupIsUpdated && !$this->settingsAreResetToDefault) {
1108 $flashMessages[] = $this->
getFlashMessage(
'setupWasUpdated',
'UserSettings');
1112 if ($this->settingsAreResetToDefault) {
1113 $flashMessages[] = $this->
getFlashMessage(
'settingsAreReset',
'resetConfiguration');
1117 if ($this->setupIsUpdated || $this->settingsAreResetToDefault) {
1122 if ($this->passwordIsSubmitted) {
1123 switch ($this->passwordIsUpdated) {
1131 $flashMessages[] = $this->
getFlashMessage(
'newPassword_ok',
'newPassword');
1135 if (!empty($flashMessages)) {
1146 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
1147 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
1148 foreach ($flashMessages as $flashMessage) {
1149 $defaultFlashMessageQueue->enqueue($flashMessage);
1162 return GeneralUtility::makeInstance(
1163 FlashMessage::class,