Project

General

Profile

Bug #20385 » 11019.diff

Administrator Admin, 2009-05-04 10:06

View differences:

typo3/sysext/setup/ext_tables.php (working copy)
t3lib_extMgm::addModule('user','setup','after:task',t3lib_extMgm::extPath($_EXTKEY).'mod/');
t3lib_extMgm::addLLrefForTCAdescr('_MOD_user_setup','EXT:setup/locallang_csh_mod.xml');
}
$GLOBALS['TUS'] = array(
'ctrl' => array (
'hideFields' => array()
),
'columns' => array (
'realName' => array(
'type' => 'text',
'label' => 'LANG:beUser_realName',
'table' => 'be_users',
'csh' => 'beUser_realName',
),
'email' => array(
'type' => 'text',
'label' => 'LANG:beUser_email',
'table' => 'be_users',
'csh' => 'beUser_email',
),
'emailMeAtLogin' => array(
'type' => 'check',
'label' => 'LANG:emailMeAtLogin',
),
'password' => array(
'type' => 'password',
'label' => 'LANG:newPassword',
'table' => 'be_users',
'csh' => 'newPassword',
'eval' => 'md5',
),
'password2' => array(
'type' => 'password',
'label' => 'LANG:newPasswordAgain',
'table' => 'be_users',
'csh' => 'newPasswordAgain',
'eval' => 'md5',
),
'language' => array(
'type' => 'select',
'itemProcFunc' => 'SC_mod_user_setup_index->languageOptions',
'label' => 'LANG:language',
),
'condensedMode' => array(
'type' => 'check',
'label' => 'LANG:condensedMode'
),
'noMenuMode' => array(
'type' => 'select',
'items' => array(
'0' => 'LANG:noMenuMode_def',
'1' => 'LANG:noMenuMode_sel',
'icons' => 'LANG:noMenuMode_icons',
),
'label' => 'LANG:noMenuMode'
),
'startModule' => array(
'type' => 'select',
'itemProcFunc' => 'SC_mod_user_setup_index->startModuleOptions',
'label' => 'LANG:startModule'
),
'showThumbs' => array(
'type' => 'check',
'label' => 'LANG:showThumbs',
),
'helpText' => array(
'type' => 'check',
'label' => 'LANG:helpText',
),
'edit_showFieldHelp' => array(
'type' => 'select',
'items' => array (
'0' => 'LANG:edit_showFieldHelp_none',
'icon' => 'LANG:edit_showFieldHelp_icon',
'text' => 'LANG:edit_showFieldHelp_message',
),
'label' => 'LANG:edit_showFieldHelp',
),
'maxTitleLen' => array(
'type' => 'text',
'label' => 'LANG:maxTitleLen',
),
'edit_RTE' => array(
'type' => 'check',
'label' => 'LANG:edit_RTE',
),
'edit_docModuleUpload' => array(
'type' => 'check',
'label' => 'LANG:edit_docModuleUpload',
),
'disableCMlayers' => array(
'type' => 'check',
'label' => 'LANG:disableCMlayers',
),
'copyLevels' => array(
'type' => 'text',
'label' => 'LANG:copyLevels',
),
'recursiveDelete' => array(
'type' => 'check',
'label' => 'LANG:recursiveDelete',
),
'simulate' => array(
'type' => 'select',
'itemProcFunc' => 'SC_mod_user_setup_index->simulateUserOptions',
'access' => 'admin',
'label' => 'LANG:simulate',
'csh' => 'simuser'
),
),
'groups' => array (
'personal_data' => array (
'label' => 'LANG:personal_data',
'fields' => 'realName,email,emailMeAtLogin,password,password2,language'
),
'opening' => array (
'label' => 'LANG:opening',
'fields' => 'condensedMode,noMenuMode,startModule,showThumbs,helpText,edit_showFieldHelp,maxTitleLen'
),
'edit' => array (
'label' => 'LANG:editFunctionsTab',
'fields' => 'edit_RTE,edit_docModuleUpload,disableCMlayers,copyLevels,recursiveDelete'
),
'adminFunctions' => array (
'label' => 'LANG:adminFunctions',
'fields' => 'simulate',
'access' => 'admin',
),
)
);
?>
typo3/sysext/setup/mod/index.php (working copy)
* @return void
*/
function storeIncomingData() {
global $BE_USER;
// First check if something is submittet in the data-array from POST vars
......
if (is_array($d)) {
// UC hashed before applying changes
$save_before = md5(serialize($BE_USER->uc));
$save_before = md5(serialize($GLOBALS['BE_USER']->uc));
// PUT SETTINGS into the ->uc array:
// reload left frame when switching BE language
if (isset($d['lang']) && ($d['lang'] != $BE_USER->uc['lang'])) {
if (isset($d['lang']) && ($d['lang'] != $GLOBALS['BE_USER']->uc['lang'])) {
$this->languageUpdate = true;
}
// Language
$BE_USER->uc['lang'] = $d['lang'];
// save all submitted values if they are no array (arrays are with table=be_users)
foreach($d as $key => $value) {
if (!is_array($value)) {
$GLOBALS['BE_USER']->uc[$key] = $value;
}
}
// Startup
$BE_USER->uc['condensedMode'] = $d['condensedMode'];
$BE_USER->uc['noMenuMode'] = $d['noMenuMode'];
$BE_USER->uc['startModule'] = $d['startModule'];
$BE_USER->uc['thumbnailsByDefault'] = $d['thumbnailsByDefault'];
$BE_USER->uc['helpText'] = $d['helpText'];
$BE_USER->uc['titleLen'] = intval($d['titleLen']);
// Advanced functions:
$BE_USER->uc['copyLevels'] = t3lib_div::intInRange($d['copyLevels'],0,100);
$BE_USER->uc['recursiveDelete'] = $d['recursiveDelete'];
// Edit
$BE_USER->uc['edit_wideDocument'] = $d['edit_wideDocument'];
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { $BE_USER->uc['edit_RTE'] = $d['edit_RTE']; }
$BE_USER->uc['edit_docModuleUpload'] = $d['edit_docModuleUpload'];
$BE_USER->uc['edit_showFieldHelp'] = $d['edit_showFieldHelp'];
$BE_USER->uc['disableCMlayers'] = $d['disableCMlayers'];
// Personal:
$BE_USER->uc['emailMeAtLogin'] = $d['emailMeAtLogin'];
if ($d['setValuesToDefault']) { // If every value should be default
$BE_USER->resetUC();
$GLOBALS['BE_USER']->resetUC();
}
$BE_USER->overrideUC(); // Inserts the overriding values.
$GLOBALS['BE_USER']->overrideUC(); // Inserts the overriding values.
$save_after = md5(serialize($BE_USER->uc));
$save_after = md5(serialize($GLOBALS['BE_USER']->uc));
if ($save_before!=$save_after) { // If something in the uc-array of the user has changed, we save the array...
$BE_USER->writeUC($BE_USER->uc);
$BE_USER->writelog(254,1,0,1,'Personal settings changed',Array());
$GLOBALS['BE_USER']->writeUC($GLOBALS['BE_USER']->uc);
$GLOBALS['BE_USER']->writelog(254,1,0,1,'Personal settings changed',Array());
}
// Personal data for the users be_user-record (email, name, password...)
// If email and name is changed, set it in the users record:
$be_user_data = t3lib_div::_GP('ext_beuser');
$this->PASSWORD_UPDATED = strlen($be_user_data['password1'].$be_user_data['password2'])>0 ? -1 : 0;
if ($be_user_data['email']!=$BE_USER->user['email']
|| $be_user_data['realName']!=$BE_USER->user['realName']
|| (strlen($be_user_data['password1'])==32
&& !strcmp($be_user_data['password1'],$be_user_data['password2']))
$BE_USER_data = $d['be_users'];
$this->PASSWORD_UPDATED = strlen($BE_USER_data['password'].$BE_USER_data['password2'])>0 ? -1 : 0;
if ($BE_USER_data['email']!=$GLOBALS['BE_USER']->user['email']
|| $BE_USER_data['realName']!=$GLOBALS['BE_USER']->user['realName']
|| (strlen($BE_USER_data['password'])==32
&& !strcmp($BE_USER_data['password'],$BE_USER_data['password2']))
) {
$storeRec = array();
$BE_USER->user['realName'] = $storeRec['be_users'][$BE_USER->user['uid']]['realName'] = substr($be_user_data['realName'],0,80);
$BE_USER->user['email'] = $storeRec['be_users'][$BE_USER->user['uid']]['email'] = substr($be_user_data['email'],0,80);
if (strlen($be_user_data['password1'])==32 && !strcmp($be_user_data['password1'],$be_user_data['password2'])) {
$BE_USER->user['password'] = $storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password1'];
$GLOBALS['BE_USER']->user['realName'] = $storeRec['be_users'][$GLOBALS['BE_USER']->user['uid']]['realName'] = substr($BE_USER_data['realName'],0,80);
$GLOBALS['BE_USER']->user['email'] = $storeRec['be_users'][$GLOBALS['BE_USER']->user['uid']]['email'] = substr($BE_USER_data['email'],0,80);
if (strlen($BE_USER_data['password'])==32 && !strcmp($BE_USER_data['password'],$BE_USER_data['password2'])) {
$GLOBALS['BE_USER']->user['password'] = $storeRec['be_users'][$GLOBALS['BE_USER']->user['uid']]['password'] = $BE_USER_data['password2'];
$this->PASSWORD_UPDATED = 1;
}
// Make instance of TCE for storing the changes.
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values=0;
$tce->start($storeRec,Array(),$BE_USER);
$tce->start($storeRec,Array(),$GLOBALS['BE_USER']);
$tce->admin = 1; // This is so the user can actually update his user record.
$tce->bypassWorkspaceRestrictions = TRUE; // This is to make sure that the users record can be updated even if in another workspace. This is tolerated.
$tce->process_datamap();
......
* @return void
*/
function main() {
global $BE_USER,$LANG,$BACK_PATH,$TBE_MODULES;
global $BACK_PATH,$TBE_MODULES;
if ($this->languageUpdate) {
$this->doc->JScodeArray['languageUpdate'] .= '
......
$this->loadModules->observeWorkspaces = true;
$this->loadModules->load($TBE_MODULES);
$this->content .= $this->doc->header($LANG->getLL('UserSettings').' - '.$BE_USER->user['realName'].' ['.$BE_USER->user['username'].']');
$this->content .= $this->doc->header($GLOBALS['LANG']->getLL('UserSettings').' - '.$GLOBALS['BE_USER']->user['realName'].' ['.$GLOBALS['BE_USER']->user['username'].']');
// If password is updated, output whether it failed or was OK.
if ($this->PASSWORD_UPDATED) {
if ($this->PASSWORD_UPDATED > 0) {
$this->content .= $this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_ok'),1,0,1);
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('newPassword').':',$GLOBALS['LANG']->getLL('newPassword_ok'),1,0,1);
} else {
$this->content .= $this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_failed'),1,0,2);
$this->content .= $this->doc->section($GLOBALS['LANG']->getLL('newPassword').':',$GLOBALS['LANG']->getLL('newPassword_failed'),1,0,2);
}
}
// compile the menu item data
$data = $this->compileUserSetupData();
// render the menu items
$menuItems = $this->renderUserSetupTabs($data);
$menuItems = $this->renderUserSetup();
$this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', false, false, 100);
......
$this->content .= $this->doc->section('',
t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $BACK_PATH) . '
<input type="hidden" name="simUser" value="'.$this->simUser.'" />
<input type="submit" name="submit" value="'.$LANG->getLL('save').'" />
<input type="submit" name="data[setValuesToDefault]" value="'.$LANG->getLL('setToStandard').'" onclick="return confirm(\''.$LANG->getLL('setToStandardQuestion').'\');" />'
<input type="submit" name="submit" value="'.$GLOBALS['LANG']->getLL('save').'" />
<input type="submit" name="data[setValuesToDefault]" value="'.$GLOBALS['LANG']->getLL('setToStandard').'" onclick="return confirm(\''.$GLOBALS['LANG']->getLL('setToStandardQuestion').'\');" />'
);
// Notice
$this->content .= $this->doc->spacer(30);
$this->content .= $this->doc->section('', $LANG->getLL('activateChanges'));
$this->content .= $this->doc->section('', $GLOBALS['LANG']->getLL('activateChanges'));
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
......
$markers['CONTENT'] = $this->content;
// Build the <body> for the module
$this->content = $this->doc->startPage($LANG->getLL('UserSettings'));
$this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('UserSettings'));
$this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
......
return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER'];
}
/**
* adds every field and every tab that will be used in a multi-dimensional array to be
* displayed in this module
*
* @return array the full data array that is used for rendering the tabs
*/
function compileUserSetupData() {
global $BE_USER, $LANG;
$data = array();
// Tab: Personal data
/**
* Return a select with available languages
*/
function languageOptions() {
// compile the languages dropdown
$languageOptions = array(
'000000000' => chr(10) . '<option value="">' . $LANG->getLL('lang_default', 1) . '</option>'
'000000000' => chr(10) . '<option value="">' . $GLOBALS['LANG']->getLL('lang_default', 1) . '</option>'
);
// traverse the number of languages
$theLanguages = t3lib_div::trimExplode('|', TYPO3_languages);
......
$unavailable = (is_dir(PATH_typo3conf . 'l10n/' . $language) ? false : true);
if (!$unavailable) {
$languageOptions[$languageValue . '--' . $language] = '
<option value="'.$language.'"'.($BE_USER->uc['lang'] == $language ? ' selected="selected"' : '') . ($unavailable ? ' class="c-na"' : '').'>'.$LANG->getLL('lang_' . $language, 1) . $localLabel . '</option>';
<option value="'.$language.'"'.($GLOBALS['BE_USER']->uc['lang'] == $language ? ' selected="selected"' : '') . ($unavailable ? ' class="c-na"' : '').'>'.$GLOBALS['LANG']->getLL('lang_' . $language, 1) . $localLabel . '</option>';
}
}
}
ksort($languageOptions);
$languageCode = '
<select id="field_language" name="data[lang]">' .
<select id="field_language" name="data[lang]" class="select">' .
implode('', $languageOptions) . '
</select>';
if ($BE_USER->uc['lang'] && !@is_dir(PATH_typo3conf . 'l10n/' . $BE_USER->uc['lang'])) {
if ($GLOBALS['BE_USER']->uc['lang'] && !@is_dir(PATH_typo3conf . 'l10n/' . $GLOBALS['BE_USER']->uc['lang'])) {
$languageCode .= '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'.
$this->doc->icons(3) .
'The selected language is not available before the language pack is installed.<br />'.
($BE_USER->isAdmin() ? 'You can use the Extension Manager to easily download and install new language packs.':'Please ask your system administrator to do this.') .
($GLOBALS['BE_USER']->isAdmin() ? 'You can use the Extension Manager to easily download and install new language packs.':'Please ask your system administrator to do this.') .
'</td></tr></table>';
}
// the data for the user configuration (uc),
$data['personal_data'] = array(
'ctrl' => array(
'label' => $LANG->getLL('personal_data'),
),
'columns' => array(
'beUser_realName' => array(
'type' => 'text',
'form' => '<input id="field_beUser_realName" type="text" name="ext_beuser[realName]" value="'.htmlspecialchars($BE_USER->user['realName']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />',
),
'beUser_email' => array(
'type' => 'text',
'form' => '<input id="field_beUser_email" type="text" name="ext_beuser[email]" value="'.htmlspecialchars($BE_USER->user['email']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />',
),
'emailMeAtLogin' => array(
'type' => 'check',
'form' => '<input id="field_emailMeAtLogin" type="checkbox" name="data[emailMeAtLogin]"'.($BE_USER->uc['emailMeAtLogin']?' checked="checked"':'').' />',
),
'newPassword' => array(
'type' => 'password',
'form' => '<input id="field_newPassword" type="password" name="ext_beuser[password1]" value="" '.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />',
),
'newPasswordAgain' => array(
'type' => 'password',
'form' => '<input id="field_newPasswordAgain" type="password" name="ext_beuser[password2]" value="" '.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\'" />',
),
'language' => array(
'type' => 'select',
'form' => $languageCode,
),
)
);
// Tab: compiling the 'Startup' section
// start module select
if (empty($BE_USER->uc['startModule'])) {
$BE_USER->uc['startModule'] = $BE_USER->uc_default['startModule'];
return $languageCode;
}
/**
* Returns a select with all modules for startup
*/
function startModuleOptions() {
// start module select
if (empty($GLOBALS['BE_USER']->uc['startModule'])) {
$GLOBALS['BE_USER']->uc['startModule'] = $GLOBALS['BE_USER']->uc_default['startModule'];
}
$startModuleSelect .= '<option value=""></option>';
foreach ($this->loadModules->modules as $mainMod => $modData) {
if (isset($modData['sub']) && is_array($modData['sub'])) {
$startModuleSelect .= '<option disabled="disabled">'.$LANG->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
$startModuleSelect .= '<option disabled="disabled">'.$GLOBALS['LANG']->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
foreach ($modData['sub'] as $subKey => $subData) {
$modName = $subData['name'];
$startModuleSelect .= '<option value="'.$modName.'"'.($BE_USER->uc['startModule']==$modName?' selected="selected"':'').'>';
$startModuleSelect .= ' - '.$LANG->moduleLabels['tabs'][$modName.'_tab'].'</option>';
$startModuleSelect .= '<option value="' . $modName . '"' . ($GLOBALS['BE_USER']->uc['startModule'] == $modName ? ' selected="selected"' : '') . '>';
$startModuleSelect .= ' - ' . $GLOBALS['LANG']->moduleLabels['tabs'][$modName.'_tab'] . '</option>';
}
}
}
$startModuleSelect = '<select id="field_startModule" name="data[startModule]">' . $startModuleSelect . '</select>';
$data['startup'] = array(
'ctrl' => array(
'label' => $LANG->getLL('opening'),
),
'columns' => array(
'condensedMode' => array(
'type' => 'checkbox',
'form' => '<input id="field_condensedMode" type="checkbox" name="data[condensedMode]"'.($BE_USER->uc['condensedMode']?' checked="checked"':'').' />',
'label' => 'condensedMode'
),
'noMenuMode' => array(
'type' => 'select',
'form' => '<select id="field_noMenuMode" name="data[noMenuMode]">
<option value=""'.(!$BE_USER->uc['noMenuMode']?' selected="selected"':'').'>'.$LANG->getLL('noMenuMode_def').'</option>
<option value="1"'.($BE_USER->uc['noMenuMode'] && (string)$BE_USER->uc['noMenuMode']!="icons"?' selected="selected"':'').'>'.$LANG->getLL('noMenuMode_sel').'</option>
<option value="icons"'.((string)$BE_USER->uc['noMenuMode']=='icons'?' selected="selected"':'').'>'.$LANG->getLL('noMenuMode_icons').'</option>
</select>',
'labelkey' => 'noMenuMode'
),
'startModule' => array(
'type' => 'select',
'form' => $startModuleSelect,
'labelkey' => 'startModule'
),
'showThumbs' => array(
'type' => 'check',
'form' => '<input id="field_showThumbs" type="checkbox" name="data[thumbnailsByDefault]"'.($BE_USER->uc['thumbnailsByDefault']?' checked="checked"':'').' />',
'labelkey' => 'thumbnailsByDefault',
),
'helpText' => array(
'type' => 'check',
'form' => '<input id="field_helpText" type="checkbox" name="data[helpText]"'.($BE_USER->uc['helpText']?' checked="checked"':'').' />',
),
'edit_showFieldHelp' => array(
'type' => 'select',
'form' => '<select id="field_edit_showFieldHelp" name="data[edit_showFieldHelp]">
<option value="">'.$LANG->getLL('edit_showFieldHelp_none').'</option>
<option value="icon"'.($BE_USER->uc['edit_showFieldHelp']=='icon'?' selected="selected"':'').'>'.$LANG->getLL('edit_showFieldHelp_icon').'</option>
<option value="text"'.($BE_USER->uc['edit_showFieldHelp']=='text'?' selected="selected"':'').'>'.$LANG->getLL('edit_showFieldHelp_message').'</option>
</select>',
),
'maxTitleLen' => array(
'type' => 'text',
'form' => '<input id="field_maxTitleLen" type="text" name="data[titleLen]" value="'.$BE_USER->uc['titleLen'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />',
'labelkey' => 'titleLen',
),
)
);
if ($GLOBALS['BE_USER']->uc['interfaceSetup'] != 'backend_old') {
unset($data['startup']['columns']['noMenuMode']);
}
// Tab: Edit section & advanced options
$data['edit'] = array(
'ctrl' => array(
'label' => $LANG->getLL('edit_functions') . ' & ' . $LANG->getLL('functions'),
),
'columns' => array(
'edit_RTE' => array(
'type' => 'check',
'form' => '<input id="field_edit_RTE" type="checkbox" name="data[edit_RTE]"'.($BE_USER->uc['edit_RTE']?' checked="checked"':'').' />',
),
'edit_docModuleUpload' => array(
'type' => 'check',
'form' => '<input id="field_edit_docModuleUpload" type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />'
),
'disableCMlayers' => array(
'type' => 'check',
'form' => '<input id="field_disableCMlayers" type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />'
),
'copyLevels' => array(
'type' => 'text',
'form' => '<input id="field_copyLevels" type="text" name="data[copyLevels]" value="'.$BE_USER->uc['copyLevels'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />&nbsp;'.$LANG->getLL('levels')
),
'recursiveDelete' => array(
'type' => 'check',
'form' => '<input id="field_recursiveDelete" type="checkbox" name="data[recursiveDelete]"'.($BE_USER->uc['recursiveDelete']?' checked="checked"':'').' />',
),
)
);
if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
unset($data['edit']['columns']['edit_RTE']);
}
// Tab: Admin functions
if ($BE_USER->isAdmin()) {
$data['admin'] = array(
'ctrl' => array(
'label' => $LANG->getLL('adminFunctions')
),
'columns' => array()
);
// Simulate selector box:
if ($this->simulateSelector) {
$data['admin']['columns']['simulate'] = array(
'type' => 'select',
'form' => $this->simulateSelector,
'csh' => 'simuser'
);
}
}
return $data;
return '<select id="field_startModule" name="data[startModule]" class="select">' . $startModuleSelect . '</select>';;
}
/**
* renders the data for one tab in the user setup and returns
* everything that is needed to have a complete tab
......
* @param $tabLabel the label that is put on top of the tab array
* @return ready to use for the dyntabmenu itemarray
*/
function renderUserSetupTabs($data) {
function renderUserSetup() {
$result = array();
foreach ($data as $k => $tabData) {
// disable fields depended on settings
if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
$GLOBALS['TUS']['ctrl']['hideFields'][] = 'edit_RTE';
}
if ($GLOBALS['BE_USER']->uc['interfaceSetup'] != 'backend_old') {
$GLOBALS['TUS']['ctrl']['hideFields'][] = 'noMenuMode';
}
// "display full help" is active?
$displayFullText = ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] == 'text');
if ($displayFullText) {
$this->doc->tableLayout['defRowEven'] = array('defCol' => array ('<td valign="top" colspan="3">','</td>'));
}
foreach ($GLOBALS['TUS']['groups'] as $group => $params) {
$code = array();
$i = 0;
$more = '';
$fields = t3lib_div::trimExplode(',', $params['fields'], true);
// "display full help" is active?
$displayFullText = ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] == 'text');
if ($displayFullText) {
$this->doc->tableLayout['defRowEven'] = array('defCol' => array ('<td valign="top" colspan="3">','</td>'));
}
foreach ($tabData['columns'] as $fieldname => $data) {
$csh = $this->getCSH($data['csh'] ? $data['csh'] : $fieldname);
foreach ($fields as $fieldname) {
if (in_array($field, $GLOBALS['TUS']['ctrl']['hideFields'])) {
continue;
}
if (isset($GLOBALS['TUS']['columns'][$fieldname]['access']) and !$this->checkAccess($GLOBALS['TUS']['columns'][$fieldname]['access'])) {
continue;
}
$label = $this->getLabel($GLOBALS['TUS']['columns'][$fieldname]['label'], $fieldname);
$csh = $this->getCSH($GLOBALS['TUS']['columns'][$fieldname]['csh'] ? $GLOBALS['TUS']['columns'][$fieldname]['csh'] : $fieldname);
$type = htmlspecialchars($GLOBALS['TUS']['columns'][$fieldname]['type']);
$eval = $GLOBALS['TUS']['columns'][$fieldname]['eval'];
$class = htmlspecialchars($GLOBALS['TUS']['columns'][$fieldname]['class']);
$style = htmlspecialchars($GLOBALS['TUS']['columns'][$fieldname]['style']);
if ($class) {
$more .= ' class="' . $class . '"';
}
if ($style) {
$more .= ' style="' . $style . '"';
}
switch ($type) {
case 'text':
case 'password':
$dataAdd = '';
if ($GLOBALS['TUS']['columns'][$fieldname]['table'] == 'be_users') {
$dataAdd = '[be_users]';
$value = $GLOBALS['BE_USER']->user[$fieldname];
} else {
$value = $GLOBALS['BE_USER']->uc[$fieldname];
}
if ($eval == 'md5') {
$more .= ' onchange="this.value=this.value?MD5(this.value):\'\';"';
}
if ($type == 'password') {
$value = '';
}
$html = '<input id="field_' . htmlspecialchars($fieldname) . '"
type="' . $type . '"
name="data' . $dataAdd . '[' . htmlspecialchars($fieldname) . ']"
value="' . htmlspecialchars($value) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . $more . ' />';
break;
case 'check':
if (!$class) {
$more .= ' class="check"';
}
$html = '<input id="field_' . htmlspecialchars($fieldname) . '"
type="checkbox"
name="data[' . htmlspecialchars($fieldname) . ']"' .
($GLOBALS['BE_USER']->uc[$fieldname] ? ' checked="checked"' : '') . $more . ' />';
break;
case 'select':
if (!$class) {
$more .= ' class="select"';
}
if ($GLOBALS['TUS']['columns'][$fieldname]['itemProcFunc']) {
$parts = explode('->', $GLOBALS['TUS']['columns'][$fieldname]['itemProcFunc']);
$html = call_user_func(array($parts[0], $parts[1]));
} else {
$html = '<select id=field_"' . htmlspecialchars($fieldname) . '" name="data[' . htmlspecialchars($fieldname) . ']"' . $more . '>' . chr(10);;
foreach ($GLOBALS['TUS']['columns'][$fieldname]['items'] as $key => $value) {
$html .= '<option value="' . htmlspecialchars($key) . '"' .
($GLOBALS['BE_USER']->uc[$fieldname] == $key ? ' selected="selected"' : '') .
'>' . htmlspecialchars($this->getLabel($value, $value, false)) . '</option>' . chr(10);
}
$html .= '</select>';
}
break;
default:
$html = '';
}
// add another table row with the full text help if needed
if ($displayFullText) {
$code[$i++][1] = $csh;
$csh = '';
}
if ($displayFullText) {
$code[$i][1] = $this->setLabel($fieldname, ($data['labelkey'] ? $data['labelkey'] : ''));
} else {
$code[$i][1] = $csh . $this->setLabel($fieldname, ($data['labelkey'] ? $data['labelkey'] : ''));
}
$code[$i++][2] = $data['form'];
$code[$i][1] = $csh . $label;
$code[$i++][2] = $html;
}
if (count($code)) {
$result[] = array(
'label' => $tabData['ctrl']['label'],
'label' => $this->getLabel($params['label'], $group, false),
'content' => $this->doc->spacer(20) . $this->doc->table($code)
);
}
......
* @return void
*/
function simulateUser() {
global $BE_USER,$LANG,$BACK_PATH;
global $BACK_PATH;
// *******************************************************************************
// If admin, allow simulation of another user
......
$this->simUser = 0;
$this->simulateSelector = '';
unset($this->OLD_BE_USER);
if ($BE_USER->isAdmin()) {
if ($GLOBALS['BE_USER']->isAdmin()) {
$this->simUser = t3lib_div::_GP('simUser');
// Make user-selector:
$users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName', t3lib_BEfunc::BEenableFields('be_users'));
$opt = array();
foreach ($users as $rr) {
if ($rr['uid'] != $BE_USER->user['uid']) {
if ($rr['uid'] != $GLOBALS['BE_USER']->user['uid']) {
$opt[] = '<option value="'.$rr['uid'].'"'.($this->simUser==$rr['uid']?' selected="selected"':'').'>'.htmlspecialchars($rr['username'].' ('.$rr['realName'].')').'</option>';
}
}
......
}
if ($this->simUser>0) { // This can only be set if the previous code was executed.
$this->OLD_BE_USER = $BE_USER; // Save old user...
unset($BE_USER); // Unset current
$this->OLD_BE_USER = $GLOBALS['BE_USER']; // Save old user...
unset($GLOBALS['BE_USER']); // Unset current
$BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth'); // New backend user object
$BE_USER->OS = TYPO3_OS;
$BE_USER->setBeUserByUid($this->simUser);
$BE_USER->fetchGroupData();
$BE_USER->backendSetUC();
$GLOBALS['BE_USER'] = $BE_USER; // Must do this, because unsetting $BE_USER before apparently unsets the reference to the global variable by this name!
$GLOBALS['BE_USER'] = t3lib_div::makeInstance('t3lib_beUserAuth'); // New backend user object
$GLOBALS['BE_USER']->OS = TYPO3_OS;
$GLOBALS['BE_USER']->setBeUserByUid($this->simUser);
$GLOBALS['BE_USER']->fetchGroupData();
$GLOBALS['BE_USER']->backendSetUC();
$GLOBALS['BE_USER'] = $GLOBALS['BE_USER']; // Must do this, because unsetting $GLOBALS['BE_USER'] before apparently unsets the reference to the global variable by this name!
}
}
/**
* @desc
*/
function simulateUserOptions() {
return $this->simulateSelector;
}
function checkAccess($level) {
if ($level = 'admin') {
return $GLOBALS['BE_USER']->isAdmin();
}
}
/**
* Returns the label $str from getLL() and grays out the value if the $str/$key is found in $this->overrideConf array
*
* @param string Locallang key
......
* @param string Alternative id for use in "for" attribute of <label> tag. By default the $str key is used prepended with "field_".
* @return string HTML output.
*/
function setLabel($str, $key='', $addLabelTag=true, $altLabelTagId='') {
$out = $GLOBALS['LANG']->getLL($str) . ': ';
if (isset($this->overrideConf[($key?$key:$str)])) {
$out = '<span style="color:#999999">'.$out.'</span>';
function getLabel($str, $key='', $addLabelTag=true, $altLabelTagId='') {
if (substr($str, 0 , 5) == 'LANG:') {
$out = $GLOBALS['LANG']->getLL(substr($str, 5));
} elseif (substr($str, 0, 4) == 'LLL:') {
$out = $GLOBALS['LANG']->sL($str);
} else {
$out = htmlspecialchars($str);
}
if (isset($this->overrideConf[($key ? $key : $str)])) {
$out = '<span style="color:#999999">' . $out . '</span>';
}
if($addLabelTag) {
$out = '<label for="'.($altLabelTagId?$altLabelTagId:'field_'.$str).'">'.$out.'</label>';
$out = '<label for="' . ($altLabelTagId ? $altLabelTagId : 'field_' . $str) . '">' . $out . '</label>';
}
return $out;
}
......
* @return string HTML output.
*/
function getCSH($str) {
if (!t3lib_div::inList('language', $str)) {
if (!t3lib_div::inList('language,simuser', $str)) {
$str = 'option_' . $str;
}
return t3lib_BEfunc::cshItem('_MOD_user_setup', $str, $GLOBALS['BACK_PATH'], '|', false, 'margin-bottom:0px;');
......
// These includes MUST be afterwards the settings are saved...!
require ($BACK_PATH.'template.php');
$LANG->includeLLFile('EXT:setup/mod/locallang.xml');
$GLOBALS['LANG']->includeLLFile('EXT:setup/mod/locallang.xml');
$SOBE->init();
$SOBE->main();
typo3/sysext/setup/mod/locallang.xml (working copy)
<label index="edit_wideDocument">Wide document background</label>
<label index="edit_RTE">Enable Rich Text Editor (if available)</label>
<label index="edit_docModuleUpload">File upload directly in Doc-module</label>
<label index="editFunctionsTab">Edit &amp; Advanced functions</label>
<label index="edit_functions">Edit</label>
<label index="disableCMlayers">Disable Popup Context Menus</label>
<label index="setToStandard">Reset all Values to default</label>
(1-1/2)