00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00061 unset($MCONF);
00062 require('conf.php');
00063 require($BACK_PATH.'init.php');
00064 require_once(PATH_t3lib.'class.t3lib_tcemain.php');
00065 require_once(PATH_t3lib.'class.t3lib_loadmodules.php');
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00087 class SC_mod_user_setup_index {
00088
00089
00090 var $MCONF = array();
00091 var $MOD_MENU = array();
00092 var $MOD_SETTINGS = array();
00093
00099 var $doc;
00100
00101 var $content;
00102 var $overrideConf;
00103
00109 var $OLD_BE_USER;
00110 var $languageUpdate;
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00128 function storeIncomingData() {
00129 global $BE_USER;
00130
00131
00132
00133 $d = t3lib_div::_POST('data');
00134 if (is_array($d)) {
00135
00136
00137 $save_before = md5(serialize($BE_USER->uc));
00138
00139
00140
00141
00142 if (isset($d['lang']) && ($d['lang'] != $BE_USER->uc['lang'])) {
00143 $this->languageUpdate = true;
00144 }
00145
00146 $BE_USER->uc['lang'] = $d['lang'];
00147
00148
00149 $BE_USER->uc['condensedMode'] = $d['condensedMode'];
00150 $BE_USER->uc['noMenuMode'] = $d['noMenuMode'];
00151 $BE_USER->uc['startModule'] = $d['startModule'];
00152 $BE_USER->uc['thumbnailsByDefault'] = $d['thumbnailsByDefault'];
00153 $BE_USER->uc['helpText'] = $d['helpText'];
00154 $BE_USER->uc['titleLen'] = intval($d['titleLen']);
00155
00156
00157 $BE_USER->uc['copyLevels'] = t3lib_div::intInRange($d['copyLevels'],0,100);
00158 $BE_USER->uc['recursiveDelete'] = $d['recursiveDelete'];
00159
00160
00161 $BE_USER->uc['edit_wideDocument'] = $d['edit_wideDocument'];
00162 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { $BE_USER->uc['edit_RTE'] = $d['edit_RTE']; }
00163 $BE_USER->uc['edit_docModuleUpload'] = $d['edit_docModuleUpload'];
00164 $BE_USER->uc['edit_showFieldHelp'] = $d['edit_showFieldHelp'];
00165 $BE_USER->uc['disableCMlayers'] = $d['disableCMlayers'];
00166
00167
00168 $BE_USER->uc['emailMeAtLogin'] = $d['emailMeAtLogin'];
00169
00170
00171 if ($d['setValuesToDefault']) {
00172 $BE_USER->resetUC();
00173 }
00174 $BE_USER->overrideUC();
00175
00176 $save_after = md5(serialize($BE_USER->uc));
00177 if ($save_before!=$save_after) {
00178 $BE_USER->writeUC($BE_USER->uc);
00179 $BE_USER->writelog(254,1,0,1,'Personal settings changed',Array());
00180 }
00181
00182
00183
00184
00185 $be_user_data = t3lib_div::_GP('ext_beuser');
00186 $this->PASSWORD_UPDATED = strlen($be_user_data['password1'].$be_user_data['password2'])>0 ? -1 : 0;
00187 if ($be_user_data['email']!=$BE_USER->user['email']
00188 || $be_user_data['realName']!=$BE_USER->user['realName']
00189 || (strlen($be_user_data['password1'])==32
00190 && !strcmp($be_user_data['password1'],$be_user_data['password2']))
00191 ) {
00192 $storeRec = array();
00193 $BE_USER->user['realName'] = $storeRec['be_users'][$BE_USER->user['uid']]['realName'] = substr($be_user_data['realName'],0,80);
00194 $BE_USER->user['email'] = $storeRec['be_users'][$BE_USER->user['uid']]['email'] = substr($be_user_data['email'],0,80);
00195 if (strlen($be_user_data['password1'])==32 && !strcmp($be_user_data['password1'],$be_user_data['password2'])) {
00196 $BE_USER->user['password'] = $storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password1'];
00197 $this->PASSWORD_UPDATED = 1;
00198 }
00199
00200
00201 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00202 $tce->stripslashes_values=0;
00203 $tce->start($storeRec,Array(),$BE_USER);
00204 $tce->admin = 1;
00205 $tce->bypassWorkspaceRestrictions = TRUE;
00206 $tce->process_datamap();
00207 unset($tce);
00208 }
00209 }
00210 }
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00234 function init() {
00235 global $BE_USER,$BACK_PATH;
00236 $this->MCONF = $GLOBALS['MCONF'];
00237
00238
00239 $scriptUser = $this->getRealScriptUserObj();
00240 $scriptUser->modAccess($this->MCONF,1);
00241
00242
00243 $this->overrideConf = $BE_USER->getTSConfigProp('setup.override');
00244
00245
00246 $this->doc = t3lib_div::makeInstance('mediumDoc');
00247 $this->doc->backPath = $BACK_PATH;
00248 $this->doc->docType = 'xhtml_trans';
00249
00250 $this->doc->form = '<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">';
00251 $this->doc->tableLayout = Array (
00252 'defRow' => Array (
00253 '0' => Array('<td align="left" width="300">','</td>'),
00254 'defCol' => Array('<td valign="top">','</td>')
00255 )
00256 );
00257 $this->doc->table_TR = '<tr class="bgColor4">';
00258 $this->doc->table_TABLE = '<table border="0" cellspacing="1" cellpadding="2">';
00259 }
00260
00266 function main() {
00267 global $BE_USER,$LANG,$BACK_PATH,$TBE_MODULES;
00268
00269 if ($this->languageUpdate) {
00270 $this->doc->JScode.= '<script language="javascript" type="text/javascript">
00271 top.refreshMenu();
00272 if(top.shortcutFrame) {
00273 top.shortcutFrame.refreshShortcuts();
00274 }
00275 </script>';
00276 }
00277
00278
00279 $this->doc->JScode.= '<script language="javascript" type="text/javascript" src="'.$BACK_PATH.'md5.js"></script>';
00280 $this->content.= $this->doc->startPage($LANG->getLL('UserSettings'));
00281 $this->content.= $this->doc->header($LANG->getLL('UserSettings').' - ['.$BE_USER->user['username'].']');
00282
00283
00284 $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
00285 $this->loadModules->observeWorkspaces = TRUE;
00286 $this->loadModules->load($TBE_MODULES);
00287
00288
00289 $this->content.= t3lib_BEfunc::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'],'|');
00290
00291
00292 if ($this->PASSWORD_UPDATED) {
00293 if ($this->PASSWORD_UPDATED>0) {
00294 $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_ok'),1,0,1);
00295 } else {
00296 $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_failed'),1,0,2);
00297 }
00298 $this->content.=$this->doc->spacer(25);
00299 }
00300
00301
00302 if ($this->simulateSelector) {
00303 $this->content.=$this->doc->section($LANG->getLL('simulate').':',$this->simulateSelector.t3lib_BEfunc::cshItem('_MOD_user_setup', 'simuser', $GLOBALS['BACK_PATH'],'|'),1,0,($this->simUser?2:0));
00304 }
00305
00306
00307
00308 $opt = array();
00309 $opt['000000000']='
00310 <option value="">'.$LANG->getLL('lang_default',1).'</option>';
00311 $theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
00312
00313
00314 $csConvObj = t3lib_div::makeInstance('t3lib_cs');
00315
00316
00317 foreach($theLanguages as $val) {
00318 if ($val!='default') {
00319 $localLabel = ' - ['.htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_'.$val]).']';
00320 $unavailable = $val!='default' && !@is_dir(PATH_typo3conf.'l10n/'.$val) ? '1' : '';
00321 $opt[$GLOBALS['LOCAL_LANG']['default']['lang_'.$val].'--'.$val]='
00322 <option value="'.$val.'"'.($BE_USER->uc['lang']==$val?' selected="selected"':'').($unavailable ? ' class="c-na"' : '').'>'.$LANG->getLL('lang_'.$val,1).$localLabel.'</option>';
00323 }
00324 }
00325 ksort($opt);
00326 $code='
00327 <select name="data[lang]">'.
00328 implode('',$opt).'
00329 </select>'.
00330 t3lib_BEfunc::cshItem('_MOD_user_setup', 'language', $GLOBALS['BACK_PATH'],'|');
00331 if ($BE_USER->uc['lang'] && !@is_dir(PATH_typo3conf.'l10n/'.$BE_USER->uc['lang'])) {
00332 $code.= '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'.
00333 $this->doc->icons(3).
00334 'The selected language is not available before the language pack is installed.<br />'.
00335 ($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.').
00336 '</td></tr></table>';
00337 }
00338 $this->content.=$this->doc->section($LANG->getLL('language').':',$code,0,1);
00339
00340
00341
00342 $code = Array();
00343
00344 $code[2][1] = $this->setLabel('condensedMode','condensedMode');
00345 $code[2][2] = '<input type="checkbox" name="data[condensedMode]"'.($BE_USER->uc['condensedMode']?' checked="checked"':'').' />';
00346 $code[3][1] = $this->setLabel('noMenuMode','noMenuMode');
00347 $code[3][2] = '<select name="data[noMenuMode]">
00348 <option value=""'.(!$BE_USER->uc['noMenuMode']?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_def').'</option>
00349 <option value="1"'.($BE_USER->uc['noMenuMode'] && (string)$BE_USER->uc['noMenuMode']!="icons"?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_sel').'</option>
00350 <option value="icons"'.((string)$BE_USER->uc['noMenuMode']=='icons'?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_icons').'</option>
00351 </select>';
00352 $code[4][1] = $this->setLabel('startModule','startModule');
00353 $modSelect = '<select name="data[startModule]">';
00354 $modSelect .= '<option value=""></option>';
00355 if (empty($BE_USER->uc['startModule'])) {
00356 $BE_USER->uc['startModule'] = $BE_USER->uc_default['startModule'];
00357 }
00358 foreach ($this->loadModules->modules as $mainMod => $modData) {
00359 if (isset($modData['sub']) && is_array($modData['sub'])) {
00360 $modSelect .= '<option disabled="disabled">'.$LANG->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
00361 foreach ($modData['sub'] as $subKey => $subData) {
00362 $modName = $subData['name'];
00363 $modSelect .= '<option value="'.$modName.'"'.($BE_USER->uc['startModule']==$modName?' selected="selected"':'').'>';
00364 $modSelect .= ' - '.$LANG->moduleLabels['tabs'][$modName.'_tab'].'</option>';
00365 }
00366 }
00367 }
00368 $modSelect .= '</select>';
00369 $code[4][2] = $modSelect;
00370
00371 $code[5][1] = $this->setLabel('showThumbs','thumbnailsByDefault');
00372 $code[5][2] = '<input type="checkbox" name="data[thumbnailsByDefault]"'.($BE_USER->uc['thumbnailsByDefault']?' checked="checked"':'').' />';
00373 $code[6][1] = $this->setLabel('helpText');
00374 $code[6][2] = '<input type="checkbox" name="data[helpText]"'.($BE_USER->uc['helpText']?' checked="checked"':'').' />';
00375 $code[7][1] = $this->setLabel('maxTitleLen','titleLen');
00376 $code[7][2] = '<input type="text" name="data[titleLen]" value="'.$BE_USER->uc['titleLen'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />';
00377
00378 $this->content.=$this->doc->section($LANG->getLL('opening').':',$this->doc->table($code),0,1);
00379
00380
00381
00382 $code = Array();
00383 $code[1][1] = $this->setLabel('copyLevels');
00384 $code[1][2] = '<input type="text" name="data[copyLevels]" value="'.$BE_USER->uc['copyLevels'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" /> '.$this->setLabel('levels','copyLevels');
00385 $code[2][1] = $this->setLabel('recursiveDelete');
00386 $code[2][2] = '<input type="checkbox" name="data[recursiveDelete]"'.($BE_USER->uc['recursiveDelete']?' checked="checked"':'').' />';
00387
00388 $this->content.=$this->doc->section($LANG->getLL('functions').":",$this->doc->table($code),0,1);
00389
00390
00391
00392 $code = Array();
00393 $code[2][1] = $this->setLabel('edit_wideDocument');
00394 $code[2][2] = '<input type="checkbox" name="data[edit_wideDocument]"'.($BE_USER->uc['edit_wideDocument']?' checked="checked"':'').' />';
00395 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
00396 $code[3][1] = $this->setLabel('edit_RTE');
00397 $code[3][2] = '<input type="checkbox" name="data[edit_RTE]"'.($BE_USER->uc['edit_RTE']?' checked="checked"':'').' />';
00398 }
00399 $code[4][1] = $this->setLabel('edit_docModuleUpload');
00400 $code[4][2] = '<input type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />';
00401
00402 $code[6][1] = $this->setLabel('edit_showFieldHelp');
00403 $code[6][2] = '<select name="data[edit_showFieldHelp]">
00404 <option value=""></option>
00405 <option value="icon"'.($BE_USER->uc['edit_showFieldHelp']=='icon'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_icon').'</option>
00406 <option value="text"'.($BE_USER->uc['edit_showFieldHelp']=='text'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_message').'</option>
00407 </select>';
00408
00409 $code[7][1] = $this->setLabel('disableCMlayers');
00410 $code[7][2] = '<input type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />';
00411
00412 $this->content.=$this->doc->section($LANG->getLL('edit_functions').":",$this->doc->table($code),0,1);
00413
00414
00415
00416 $code = Array();
00417 $code[1][1] = $this->setLabel('beUser_realName');
00418 $code[1][2] = '<input type="text" name="ext_beuser[realName]" value="'.htmlspecialchars($BE_USER->user['realName']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00419 $code[2][1] = $this->setLabel('beUser_email');
00420 $code[2][2] = '<input type="text" name="ext_beuser[email]" value="'.htmlspecialchars($BE_USER->user['email']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00421 $code[3][1] = $this->setLabel('emailMeAtLogin').' ('.$GLOBALS['BE_USER']->user['email'].')';
00422 $code[3][2] = '<input type="checkbox" name="data[emailMeAtLogin]"'.($BE_USER->uc['emailMeAtLogin']?' checked="checked"':'').' />';
00423 $code[4][1] = $this->setLabel('newPassword');
00424 $code[4][2] = '<input type="password" name="ext_beuser[password1]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />';
00425 $code[5][1] = $this->setLabel('newPasswordAgain');
00426 $code[5][2] = '<input type="password" name="ext_beuser[password2]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\'" />';
00427
00428 $this->content.=$this->doc->section($LANG->getLL('personal_data').":",$this->doc->table($code),0,1);
00429
00430
00431
00432 $this->content.=$this->doc->spacer(20);
00433 $this->content.=$this->doc->section('','
00434 <input type="submit" name="submit" value="'.$LANG->getLL('save').'" />
00435 <label for="setValuesToDefault"><b>'.$LANG->getLL('setToStandard').':</b></label> <input type="checkbox" name="data[setValuesToDefault]" id="setValuesToDefault" />'.
00436 t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $GLOBALS['BACK_PATH'],'|').'
00437 <input type="hidden" name="simUser" value="'.$this->simUser.'" />');
00438
00439
00440
00441 $this->content.=$this->doc->spacer(5);
00442 $this->content.=$this->doc->section('',$LANG->getLL('activateChanges'));
00443 }
00444
00450 function printContent() {
00451 $this->content.= $this->doc->endPage();
00452 echo $this->content;
00453 exit;
00454 }
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00479 function getRealScriptUserObj() {
00480 return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER'];
00481 }
00482
00489 function simulateUser() {
00490 global $BE_USER,$LANG,$BACK_PATH;
00491
00492
00493
00494
00495 $this->simUser = 0;
00496 $this->simulateSelector = '';
00497 unset($this->OLD_BE_USER);
00498 if ($BE_USER->isAdmin()) {
00499 $this->simUser = t3lib_div::_GP('simUser');
00500
00501
00502 $users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
00503 $opt = array();
00504 reset($users);
00505 $opt[] = '<option></option>';
00506 while(list(,$rr)=each($users)) {
00507 if ($rr['uid']!=$BE_USER->user['uid']) {
00508 $opt[] = '<option value="'.$rr['uid'].'"'.($this->simUser==$rr['uid']?' selected="selected"':'').'>'.htmlspecialchars($rr['username'].' ('.$rr['realName'].')').'</option>';
00509 }
00510 }
00511 $this->simulateSelector = '<select name="simulateUser" onchange="window.location.href=\'index.php?simUser=\'+this.options[this.selectedIndex].value;">'.implode('',$opt).'</select>';
00512 }
00513
00514 if ($this->simUser>0) {
00515 $this->OLD_BE_USER = $BE_USER;
00516 unset($BE_USER);
00517
00518 $BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth');
00519 $BE_USER->OS = TYPO3_OS;
00520 $BE_USER->setBeUserByUid($this->simUser);
00521 $BE_USER->fetchGroupData();
00522 $BE_USER->backendSetUC();
00523 $GLOBALS['BE_USER'] = $BE_USER;
00524 }
00525 }
00526
00535 function setLabel($str,$key='') {
00536 $out = $GLOBALS['LANG']->getLL($str);
00537 if (isset($this->overrideConf[($key?$key:$str)])) {
00538 $out = '<span style="color:#999999">'.$out.'</span>';
00539 }
00540
00541
00542 $csh = t3lib_BEfunc::cshItem('_MOD_user_setup', 'option_'.$str, $GLOBALS['BACK_PATH'],'|',FALSE,'margin-bottom:0px;');
00543 if (strlen($csh)) $csh = ': '.$csh;
00544
00545
00546 return $out.$csh;
00547 }
00548 }
00549
00550
00551 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/setup/mod/index.php']) {
00552 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/setup/mod/index.php']);
00553 }
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567 $SOBE = t3lib_div::makeInstance('SC_mod_user_setup_index');
00568 $SOBE->simulateUser();
00569 $SOBE->storeIncomingData();
00570
00571
00572 require ($BACK_PATH.'template.php');
00573 $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
00574
00575 $SOBE->init();
00576 $SOBE->main();
00577 $SOBE->printContent();
00578 ?>