139 $columns =
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'columns'];
140 $beUserId =
$GLOBALS[
'BE_USER']->user[
'uid'];
143 if (is_array($d) && $this->formProtection->validateToken((
string)
GeneralUtility::_POST(
'formToken'),
'BE user setup',
'edit')) {
145 $save_before = md5(serialize(
$GLOBALS[
'BE_USER']->uc));
148 if (isset($d[
'lang']) && $d[
'lang'] !=
$GLOBALS[
'BE_USER']->uc[
'lang']) {
149 $this->languageUpdate = TRUE;
152 if (isset($d[
'titleLen']) && $d[
'titleLen'] !==
$GLOBALS[
'BE_USER']->uc[
'titleLen']) {
153 $this->pagetreeNeedsRefresh = TRUE;
155 if ($d[
'setValuesToDefault']) {
158 $this->settingsAreResetToDefault = TRUE;
159 } elseif ($d[
'clearSessionVars']) {
160 foreach (
$GLOBALS[
'BE_USER']->uc as $key => $value) {
161 if (!isset($columns[$key])) {
162 unset(
$GLOBALS[
'BE_USER']->uc[$key]);
165 $this->tempDataIsCleared = TRUE;
166 } elseif ($d[
'save']) {
168 foreach ($columns as $field => $config) {
169 if (!in_array($field, $fieldList)) {
172 if ($config[
'table']) {
173 if ($config[
'table'] ==
'be_users' && !in_array($field, array(
'password',
'password2',
'email',
'realName',
'admin'))) {
174 if (!isset($config[
'access']) || $this->
checkAccess($config) &&
$GLOBALS[
'BE_USER']->user[$field] !== $d[
'be_users'][$field]) {
175 if ($config[
'type'] ===
'check') {
176 $fieldValue = isset($d[
'be_users'][$field]) ? 1 : 0;
178 $fieldValue = $d[
'be_users'][$field];
180 $storeRec[
'be_users'][$beUserId][$field] = $fieldValue;
181 $GLOBALS[
'BE_USER']->user[$field] = $fieldValue;
185 if ($config[
'type'] ==
'check') {
186 $GLOBALS[
'BE_USER']->uc[$field] = isset($d[$field]) ? 1 : 0;
188 $GLOBALS[
'BE_USER']->uc[$field] = htmlspecialchars($d[$field]);
193 $be_user_data = $d[
'be_users'];
195 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/setup/mod/index.php'][
'modifyUserDataBeforeSave'])) {
196 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/setup/mod/index.php'][
'modifyUserDataBeforeSave'] as $function) {
197 $params = array(
'be_user_data' => &$be_user_data);
201 $this->passwordIsSubmitted = strlen($be_user_data[
'password']) > 0;
202 $passwordIsConfirmed = $this->passwordIsSubmitted && $be_user_data[
'password'] === $be_user_data[
'password2'];
204 if ($be_user_data[
'realName'] !==
$GLOBALS[
'BE_USER']->user[
'realName']) {
205 $GLOBALS[
'BE_USER']->user[
'realName'] = ($storeRec[
'be_users'][$beUserId][
'realName'] = substr($be_user_data[
'realName'], 0, 80));
208 if ($be_user_data[
'email'] !==
$GLOBALS[
'BE_USER']->user[
'email']) {
209 $GLOBALS[
'BE_USER']->user[
'email'] = ($storeRec[
'be_users'][$beUserId][
'email'] = substr($be_user_data[
'email'], 0, 80));
212 if ($passwordIsConfirmed) {
213 $storeRec[
'be_users'][$beUserId][
'password'] = $be_user_data[
'password2'];
214 $this->passwordIsUpdated = TRUE;
216 $this->saveData = TRUE;
220 $save_after = md5(serialize(
$GLOBALS[
'BE_USER']->uc));
222 if ($save_before != $save_after) {
224 $GLOBALS[
'BE_USER']->writelog(254, 1, 0, 1,
'Personal settings changed', array());
225 $this->setupIsUpdated = TRUE;
228 if ($this->tempDataIsCleared) {
229 $GLOBALS[
'BE_USER']->writelog(254, 1, 0, 1,
$GLOBALS[
'LANG']->getLL(
'tempDataClearedLog'), array());
232 if (count($storeRec) && $this->saveData) {
235 $tce->stripslashes_values = FALSE;
239 $beUser->user[
'admin'] = 1;
240 $tce->start($storeRec, array(), $beUser);
242 $tce->bypassWorkspaceRestrictions = TRUE;
243 $tce->process_datamap();
245 if (!$this->passwordIsUpdated || count($storeRec[
'be_users'][$beUserId]) > 1) {
246 $this->setupIsUpdated = TRUE;
266 $GLOBALS[
'LANG']->includeLLFile(
'EXT:setup/mod/locallang.xlf');
271 $scriptUser->modAccess($this->MCONF, 1);
272 $this->isAdmin = $scriptUser->isAdmin();
274 $this->overrideConf =
$GLOBALS[
'BE_USER']->getTSConfigProp(
'setup.override');
276 $this->tsFieldConf =
$GLOBALS[
'BE_USER']->getTSConfigProp(
'setup.fields');
278 if (isset($this->tsFieldConf[
'password.']) && $this->tsFieldConf[
'password.'][
'disabled']) {
279 $this->tsFieldConf[
'password2.'][
'disabled'] = 1;
283 $this->doc->backPath =
$GLOBALS[
'BACK_PATH'];
284 $this->doc->setModuleTemplate(
'EXT:setup/Resources/Private/Templates/setup.html');
285 $this->doc->form =
'<form action="' .
BackendUtility::getModuleUrl(
'user_setup') .
'" method="post" name="usersetup" enctype="application/x-www-form-urlencoded">';
286 $this->doc->tableLayout = array(
288 '0' => array(
'<td class="td-label">',
'</td>'),
289 'defCol' => array(
'<td valign="top">',
'</td>')
292 $this->doc->table_TR =
'<tr>';
293 $this->doc->table_TABLE =
'<table border="0" cellspacing="1" cellpadding="2" class="typo3-usersettings">';
304 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/setup/mod/index.php'][
'setupScriptHook'])) {
305 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/setup/mod/index.php'][
'setupScriptHook'] as $function) {
321 if ($this->languageUpdate) {
322 $this->doc->JScodeArray[
'languageUpdate'] .=
' 323 if (top.refreshMenu) { 326 top.TYPO3ModuleMenu.refreshMenu(); 330 if ($this->pagetreeNeedsRefresh) {
334 $this->doc->loadJavascriptLib(
'sysext/backend/Resources/Public/JavaScript/md5.js');
336 $this->content .=
'<div id="user-setup-wrapper">';
339 $this->loadModules->observeWorkspaces = TRUE;
340 $this->loadModules->load(
$GLOBALS[
'TBE_MODULES']);
341 $this->content .= $this->doc->header($LANG->getLL(
'UserSettings'));
343 if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) {
344 $flashMessage =
GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL(
'setupWasUpdated'), $LANG->getLL(
'UserSettings'));
345 $this->content .= $flashMessage->render();
348 if ($this->tempDataIsCleared) {
349 $flashMessage =
GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL(
'tempDataClearedFlashMessage'), $LANG->getLL(
'tempDataCleared'));
350 $this->content .= $flashMessage->render();
353 if ($this->settingsAreResetToDefault) {
354 $flashMessage =
GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL(
'settingsAreReset'), $LANG->getLL(
'resetConfiguration'));
355 $this->content .= $flashMessage->render();
358 if ($this->setupIsUpdated || $this->settingsAreResetToDefault) {
360 $this->content .= $flashMessage->render();
363 if ($this->passwordIsSubmitted) {
364 if ($this->passwordIsUpdated) {
365 $flashMessage =
GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL(
'newPassword_ok'), $LANG->getLL(
'newPassword'));
369 $this->content .= $flashMessage->render();
373 $this->content .= $this->doc->getDynTabMenu($menuItems,
'user-setup', FALSE, FALSE, 1, FALSE, 1, $this->dividers2tabs);
374 $formToken = $this->formProtection->generateToken(
'BE user setup',
'edit');
375 $this->content .= $this->doc->section(
'',
'<input type="hidden" name="simUser" value="' . $this->simUser .
'" /> 376 <input type="hidden" name="formToken" value="' . $formToken .
'" /> 377 <input type="hidden" value="1" name="data[save]" /> 378 <input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" /> 379 <input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />');
381 $this->content .=
'</div>';
384 $markers[
'CSH'] = $docHeaderButtons[
'csh'];
387 $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
389 $this->content = $this->doc->render($LANG->getLL(
'UserSettings'),
$this->content);
415 if (
$GLOBALS[
'BE_USER']->mayMakeShortcut()) {
416 $buttons[
'shortcut'] = $this->doc->makeShortcutIcon(
'',
'', $this->MCONF[
'name']);
438 $this->dividers2tabs = isset(
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'ctrl'][
'dividers2tabs']) ? (int)
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'ctrl'][
'dividers2tabs'] : 0;
440 foreach ($fieldArray as $fieldName) {
442 if (substr($fieldName, 0, 8) ==
'--div--;') {
443 if ($firstTabLabel ==
'') {
445 $tabLabel = $this->
getLabel(substr($fieldName, 8),
'', FALSE);
446 $firstTabLabel = $tabLabel;
448 if ($this->dividers2tabs) {
450 'label' => $tabLabel,
451 'content' => count($code) ? $this->doc->table($code) :
'' 453 $tabLabel = $this->
getLabel(substr($fieldName, 8),
'', FALSE);
460 $config =
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'columns'][$fieldName];
462 if (isset($this->tsFieldConf[$fieldName .
'.'][
'disabled']) && $this->tsFieldConf[$fieldName .
'.'][
'disabled'] == 1) {
465 if (isset($config[
'access']) && !$this->
checkAccess($config)) {
468 $label = $this->
getLabel($config[
'label'], $fieldName);
469 $label = $this->
getCSH($config[
'csh'] ?: $fieldName, $label);
470 $type = $config[
'type'];
471 $eval = $config[
'eval'];
472 $class = $config[
'class'];
473 $style = $config[
'style'];
475 $more .=
' class="' . $class .
'"';
478 $more .=
' style="' . $style .
'"';
480 if (isset($this->overrideConf[$fieldName])) {
481 $more .=
' disabled="disabled"';
483 $value = $config[
'table'] ==
'be_users' ?
$GLOBALS[
'BE_USER']->user[$fieldName] :
$GLOBALS[
'BE_USER']->uc[$fieldName];
484 if (!$value && isset($config[
'default'])) {
485 $value = $config[
'default'];
488 if ($config[
'table'] ==
'be_users') {
489 $dataAdd =
'[be_users]';
494 $noAutocomplete =
'';
495 if ($type ===
'password') {
497 $noAutocomplete =
'autocomplete="off" ';
499 $html =
'<input id="field_' . $fieldName .
'" 501 name="data' . $dataAdd .
'[' . $fieldName .
']" ' . $noAutocomplete .
'value="' . htmlspecialchars($value) .
'" ' .
$GLOBALS[
'TBE_TEMPLATE']->formWidth(20) . $more .
' />';
505 $more .=
' class="check"';
507 $html =
'<input id="field_' . $fieldName .
'" 509 name="data' . $dataAdd .
'[' . $fieldName .
']"' . ($value ?
' checked="checked"' :
'') . $more .
' />';
513 $more .=
' class="select"';
515 if ($config[
'itemsProcFunc']) {
518 $html =
'<select ' .
$GLOBALS[
'TBE_TEMPLATE']->formWidth(20) .
' id="field_' . $fieldName .
'" name="data' . $dataAdd .
'[' . $fieldName .
']"' . $more .
'>' . LF;
519 foreach ($config[
'items'] as $key => $optionLabel) {
520 $html .=
'<option value="' . $key .
'"' . ($value == $key ?
' selected="selected"' :
'') .
'>' . $this->
getLabel($optionLabel,
'', FALSE) .
'</option>' . LF;
522 $html .=
'</select>';
530 if ($config[
'onClick']) {
531 $onClick = $config[
'onClick'];
532 if ($config[
'onClickLabels']) {
533 foreach ($config[
'onClickLabels'] as $key => $labelclick) {
534 $config[
'onClickLabels'][$key] = $this->
getLabel($labelclick,
'', FALSE);
536 $onClick = vsprintf($onClick, $config[
'onClickLabels']);
538 $html =
'<input ' .
$GLOBALS[
'TBE_TEMPLATE']->formWidth(20) .
' type="button" value="' . $this->
getLabel($config[
'buttonlabel'],
'', FALSE) .
'" onclick="' . $onClick .
'" />';
545 $code[$i][1] = $label;
546 $code[$i++][2] = $html;
549 if ($this->dividers2tabs == 0) {
550 $tabLabel = $firstTabLabel;
553 'label' => $tabLabel,
554 'content' => count($code) ? $this->doc->table($code) :
'' 571 return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER :
$GLOBALS[
'BE_USER'];
579 public function renderLanguageSelect($params, $pObj) {
580 $languageOptions = array();
582 $langDefault =
$GLOBALS[
'LANG']->getLL(
'lang_default', TRUE);
583 $languageOptions[$langDefault] =
'<option value=""' . (
$GLOBALS[
'BE_USER']->uc[
'lang'] ===
'' ?
' selected="selected"' :
'') .
'>' . $langDefault .
'</option>';
587 $languages =
$locales->getLanguages();
588 foreach ($languages as $locale => $name) {
589 if ($locale !==
'default') {
590 $defaultName = isset(
$GLOBALS[
'LOCAL_LANG'][
'default'][
'lang_' . $locale]) ?
$GLOBALS[
'LOCAL_LANG'][
'default'][
'lang_' . $locale][0][
'source'] : $name;
591 $localizedName =
$GLOBALS[
'LANG']->getLL(
'lang_' . $locale, TRUE);
592 if ($localizedName ===
'') {
593 $localizedName = htmlspecialchars($name);
595 $localLabel =
' - [' . htmlspecialchars($defaultName) .
']';
596 $available = is_dir(PATH_typo3conf .
'l10n/' . $locale) ? TRUE : FALSE;
598 $languageOptions[$defaultName] =
'<option value="' . $locale .
'"' . (
$GLOBALS[
'BE_USER']->uc[
'lang'] === $locale ?
' selected="selected"' :
'') .
'>' . $localizedName . $localLabel .
'</option>';
602 ksort($languageOptions);
604 <select ' .
$GLOBALS[
'TBE_TEMPLATE']->formWidth(20) .
' id="field_lang" name="data[lang]" class="select">' . implode(
'', $languageOptions) .
' 606 if (
$GLOBALS[
'BE_USER']->uc[
'lang'] && !@is_dir((PATH_typo3conf .
'l10n/' .
$GLOBALS[
'BE_USER']->uc[
'lang']))) {
607 $languageUnavailableWarning =
'The selected language "' .
$GLOBALS[
'LANG']->getLL((
'lang_' .
$GLOBALS[
'BE_USER']->uc[
'lang']), TRUE) .
'" is not available before the language files are installed.<br />' . (
$GLOBALS[
'BE_USER']->isAdmin() ?
'You can use the Language module to easily download new language files.' :
'Please ask your system administrator to do this.');
608 $languageUnavailableMessage =
GeneralUtility::makeInstance(
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $languageUnavailableWarning,
'', \
TYPO3\CMS\Core\Messaging\FlashMessage::WARNING);
609 $languageCode = $languageUnavailableMessage->render() . $languageCode;
611 return $languageCode;
621 if (empty(
$GLOBALS[
'BE_USER']->uc[
'startModule'])) {
622 $GLOBALS[
'BE_USER']->uc[
'startModule'] =
$GLOBALS[
'BE_USER']->uc_default[
'startModule'];
624 $startModuleSelect =
'<option value=""></option>';
625 foreach ($pObj->loadModules->modules as $mainMod => $modData) {
626 if (isset($modData[
'sub']) && is_array($modData[
'sub'])) {
627 $startModuleSelect .=
'<option disabled="disabled">' .
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][($mainMod .
'_tab')] .
'</option>';
628 foreach ($modData[
'sub'] as $subKey => $subData) {
629 $modName = $subData[
'name'];
630 $startModuleSelect .=
'<option value="' . $modName .
'"' . (
$GLOBALS[
'BE_USER']->uc[
'startModule'] == $modName ?
' selected="selected"' :
'') .
'>';
631 $startModuleSelect .=
' - ' .
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][($modName .
'_tab')] .
'</option>';
635 return '<select ' .
$GLOBALS[
'TBE_TEMPLATE']->formWidth(20) .
'id="field_startModule" name="data[startModule]" class="select">' . $startModuleSelect .
'</select>';
647 $this->simulateSelector =
'';
648 unset($this->OLD_BE_USER);
649 if (
$GLOBALS[
'BE_USER']->isAdmin()) {
654 foreach ($users as $rr) {
655 if ($rr[
'uid'] !=
$GLOBALS[
'BE_USER']->user[
'uid']) {
656 $opt[] =
'<option value="' . $rr[
'uid'] .
'"' . ($this->simUser == $rr[
'uid'] ?
' selected="selected"' :
'') .
'>' . htmlspecialchars(($rr[
'username'] .
' (' . $rr[
'realName'] .
')')) .
'</option>';
660 $this->simulateSelector =
'<select ' .
$GLOBALS[
'TBE_TEMPLATE']->formWidth(20) .
' id="field_simulate" name="simulateUser" onchange="' . htmlspecialchars(
'window.location.href=\'' .
BackendUtility::getModuleUrl(
'user_setup') .
'&simUser=\'+this.options[this.selectedIndex].value;') .
'"><option></option>' . implode(
'', $opt) .
'</select>';
664 if ($this->simUser > 0) {
666 $this->OLD_BE_USER =
$GLOBALS[
'BE_USER'];
672 $BE_USER->setBeUserByUid($this->simUser);
686 return $pObj->simulateSelector;
696 $access = $config[
'access'];
699 if (is_object($accessObject) && method_exists($accessObject,
'accessLevelCheck')) {
701 return $accessObject->accessLevelCheck($config);
702 } elseif ($access ==
'admin') {
716 protected function getLabel($str, $key =
'', $addLabelTag = TRUE, $altLabelTagId =
'') {
717 if (substr($str, 0, 4) ==
'LLL:') {
720 $out = htmlspecialchars($str);
722 if (isset($this->overrideConf[$key ?: $str])) {
723 $out =
'<span style="color:#999999">' . $out .
'</span>';
726 $out =
'<label for="' . ($altLabelTagId ?:
'field_' . $key) .
'">' . $out .
'</label>';
738 protected function getCSH($str, $label) {
739 $context =
'_MOD_user_setup';
741 $strParts = explode(
':', $str);
742 if (count($strParts) > 1) {
744 $context = $strParts[0];
745 $field = $strParts[1];
747 $field =
'option_' . $str;
758 $fieldList =
$GLOBALS[
'TYPO3_USER_SETTINGS'][
'showitem'];
760 if (!
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'RTEenabled']) {
renderStartModuleSelect($params, $pObj)
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
static rmFromList($element, $list)
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static wrapInHelp($table, $field, $text='', array $overloadHelpText=array())
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
$settingsAreResetToDefault
static getUserNames($fields='username, usergroup, usergroup_cached_list, uid', $where='')
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static setUpdateSignal($set='', $params='')
getLabel($str, $key='', $addLabelTag=TRUE, $altLabelTagId='')
renderSimulateUserSelect($params, $pObj)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static inList($list, $item)
static BEenableFields($table, $inv=0)
checkAccess(array $config)