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
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00086 class SC_mod_user_setup_index {
00087
00088
00089 var $MCONF = array();
00090 var $MOD_MENU = array();
00091 var $MOD_SETTINGS = array();
00092 var $doc;
00093
00094 var $content;
00095 var $overrideConf;
00096 var $OLD_BE_USER;
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00114 function storeIncomingData() {
00115 global $BE_USER;
00116
00117
00118
00119 $d = t3lib_div::_POST('data');
00120 if (is_array($d)) {
00121
00122
00123 $save_before = md5(serialize($BE_USER->uc));
00124
00125
00126
00127
00128 $BE_USER->uc['lang'] = $d['lang'];
00129
00130
00131 $BE_USER->uc['condensedMode'] = $d['condensedMode'];
00132 $BE_USER->uc['noMenuMode'] = $d['noMenuMode'];
00133 if (t3lib_extMgm::isLoaded('taskcenter')) $BE_USER->uc['startInTaskCenter'] = $d['startInTaskCenter'];
00134 $BE_USER->uc['thumbnailsByDefault'] = $d['thumbnailsByDefault'];
00135 $BE_USER->uc['helpText'] = $d['helpText'];
00136 $BE_USER->uc['titleLen'] = intval($d['titleLen']);
00137
00138
00139 $BE_USER->uc['copyLevels'] = t3lib_div::intInRange($d['copyLevels'],0,100);
00140 $BE_USER->uc['recursiveDelete'] = $d['recursiveDelete'];
00141
00142
00143 $BE_USER->uc['edit_wideDocument'] = $d['edit_wideDocument'];
00144 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { $BE_USER->uc['edit_RTE'] = $d['edit_RTE']; }
00145 $BE_USER->uc['edit_docModuleUpload'] = $d['edit_docModuleUpload'];
00146 $BE_USER->uc['edit_showFieldHelp'] = $d['edit_showFieldHelp'];
00147 $BE_USER->uc['disableCMlayers'] = $d['disableCMlayers'];
00148
00149
00150 $BE_USER->uc['emailMeAtLogin'] = $d['emailMeAtLogin'];
00151
00152
00153 if ($d['setValuesToDefault']) {
00154 $BE_USER->resetUC();
00155 }
00156 $BE_USER->overrideUC();
00157
00158 $save_after = md5(serialize($BE_USER->uc));
00159 if ($save_before!=$save_after) {
00160 $BE_USER->writeUC($BE_USER->uc);
00161 $BE_USER->writelog(254,1,0,1,'Personal settings changed',Array());
00162 }
00163
00164
00165
00166
00167 $be_user_data = t3lib_div::_GP('ext_beuser');
00168 $this->PASSWORD_UPDATED = strlen($be_user_data['password1'].$be_user_data['password2'])>0 ? -1 : 0;
00169 if ($be_user_data['email']!=$BE_USER->user['email']
00170 || $be_user_data['realName']!=$BE_USER->user['realName']
00171 || (strlen($be_user_data['password1'])==32
00172 && !strcmp($be_user_data['password1'],$be_user_data['password2']))
00173 ) {
00174 $storeRec = array();
00175 $BE_USER->user['realName'] = $storeRec['be_users'][$BE_USER->user['uid']]['realName'] = substr($be_user_data['realName'],0,80);
00176 $BE_USER->user['email'] = $storeRec['be_users'][$BE_USER->user['uid']]['email'] = substr($be_user_data['email'],0,80);
00177 if (strlen($be_user_data['password1'])==32 && !strcmp($be_user_data['password1'],$be_user_data['password2'])) {
00178 $BE_USER->user['password'] = $storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password1'];
00179 $this->PASSWORD_UPDATED = 1;
00180 }
00181
00182
00183 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00184 $tce->stripslashes_values=0;
00185 $tce->start($storeRec,Array(),$BE_USER);
00186 $tce->admin = 1;
00187 $tce->bypassWorkspaceRestrictions = TRUE;
00188 $tce->process_datamap();
00189 unset($tce);
00190 }
00191 }
00192 }
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00216 function init() {
00217 global $BE_USER,$BACK_PATH;
00218 $this->MCONF = $GLOBALS['MCONF'];
00219
00220
00221 $scriptUser = $this->getRealScriptUserObj();
00222 $scriptUser->modAccess($this->MCONF,1);
00223
00224
00225 $this->overrideConf = $BE_USER->getTSConfigProp('setup.override');
00226
00227
00228 $this->doc = t3lib_div::makeInstance('mediumDoc');
00229 $this->doc->backPath = $BACK_PATH;
00230 $this->doc->docType = 'xhtml_trans';
00231
00232 $this->doc->form = '<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">';
00233 $this->doc->tableLayout = Array (
00234 'defRow' => Array (
00235 '0' => Array('<td align="left" width="300">','</td>'),
00236 'defCol' => Array('<td valign="top">','</td>')
00237 )
00238 );
00239 $this->doc->table_TR = '<tr class="bgColor4">';
00240 $this->doc->table_TABLE = '<table border="0" cellspacing="1" cellpadding="2">';
00241 }
00242
00248 function main() {
00249 global $BE_USER,$LANG,$BACK_PATH;
00250
00251
00252 $this->doc->JScode.= '<script language="javascript" type="text/javascript" src="'.$BACK_PATH.'md5.js"></script>';
00253 $this->content.= $this->doc->startPage($LANG->getLL('UserSettings'));
00254 $this->content.= $this->doc->header($LANG->getLL('UserSettings').' - ['.$BE_USER->user['username'].']');
00255
00256
00257 $this->content.= t3lib_BEfunc::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'],'|');
00258
00259
00260 if ($this->PASSWORD_UPDATED) {
00261 if ($this->PASSWORD_UPDATED>0) {
00262 $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_ok'),1,0,1);
00263 } else {
00264 $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_failed'),1,0,2);
00265 }
00266 $this->content.=$this->doc->spacer(25);
00267 }
00268
00269
00270 if ($this->simulateSelector) {
00271 $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));
00272 }
00273
00274
00275
00276 $opt = array();
00277 $opt['000000000']='
00278 <option value="">'.$LANG->getLL('lang_default',1).'</option>';
00279 $theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
00280
00281
00282 $csConvObj = t3lib_div::makeInstance('t3lib_cs');
00283
00284
00285 foreach($theLanguages as $val) {
00286 if ($val!='default') {
00287 $localLabel = ' - ['.htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_'.$val]).']';
00288 $unavailable = $val!='default' && !@is_dir(PATH_typo3conf.'l10n/'.$val) ? '1' : '';
00289 $opt[$GLOBALS['LOCAL_LANG']['default']['lang_'.$val].'--'.$val]='
00290 <option value="'.$val.'"'.($BE_USER->uc['lang']==$val?' selected="selected"':'').($unavailable ? ' class="c-na"' : '').'>'.$LANG->getLL('lang_'.$val,1).$localLabel.'</option>';
00291 }
00292 }
00293 ksort($opt);
00294 $code='
00295 <select name="data[lang]">'.
00296 implode('',$opt).'
00297 </select>'.
00298 t3lib_BEfunc::cshItem('_MOD_user_setup', 'language', $GLOBALS['BACK_PATH'],'|');
00299 if ($BE_USER->uc['lang'] && !@is_dir(PATH_typo3conf.'l10n/'.$BE_USER->uc['lang'])) {
00300 $code.= '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'.
00301 $this->doc->icons(3).
00302 'The selected language is not available before the language pack is installed.<br />'.
00303 ($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.').
00304 '</td></tr></table>';
00305 }
00306 $this->content.=$this->doc->section($LANG->getLL('language').':',$code,0,1);
00307
00308
00309
00310 $code = Array();
00311
00312 $code[2][1] = $this->setLabel('condensedMode','condensedMode');
00313 $code[2][2] = '<input type="checkbox" name="data[condensedMode]"'.($BE_USER->uc['condensedMode']?' checked="checked"':'').' />';
00314 $code[3][1] = $this->setLabel('noMenuMode','noMenuMode');
00315 $code[3][2] = '<select name="data[noMenuMode]">
00316 <option value=""'.(!$BE_USER->uc['noMenuMode']?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_def').'</option>
00317 <option value="1"'.($BE_USER->uc['noMenuMode'] && (string)$BE_USER->uc['noMenuMode']!="icons"?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_sel').'</option>
00318 <option value="icons"'.((string)$BE_USER->uc['noMenuMode']=='icons'?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_icons').'</option>
00319 </select>';
00320 if (t3lib_extMgm::isLoaded('taskcenter')) {
00321 $code[4][1] = $this->setLabel('startInTaskCenter','startInTaskCenter');
00322 $code[4][2] = '<input type="checkbox" name="data[startInTaskCenter]"'.($BE_USER->uc['startInTaskCenter']?' checked="checked"':'').' />';
00323 }
00324 $code[5][1] = $this->setLabel('showThumbs','thumbnailsByDefault');
00325 $code[5][2] = '<input type="checkbox" name="data[thumbnailsByDefault]"'.($BE_USER->uc['thumbnailsByDefault']?' checked="checked"':'').' />';
00326 $code[6][1] = $this->setLabel('helpText');
00327 $code[6][2] = '<input type="checkbox" name="data[helpText]"'.($BE_USER->uc['helpText']?' checked="checked"':'').' />';
00328 $code[7][1] = $this->setLabel('maxTitleLen','titleLen');
00329 $code[7][2] = '<input type="text" name="data[titleLen]" value="'.$BE_USER->uc['titleLen'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />';
00330
00331 $this->content.=$this->doc->section($LANG->getLL('opening').':',$this->doc->table($code),0,1);
00332
00333
00334
00335 $code = Array();
00336 $code[1][1] = $this->setLabel('copyLevels');
00337 $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');
00338 $code[2][1] = $this->setLabel('recursiveDelete');
00339 $code[2][2] = '<input type="checkbox" name="data[recursiveDelete]"'.($BE_USER->uc['recursiveDelete']?' checked="checked"':'').' />';
00340
00341 $this->content.=$this->doc->section($LANG->getLL('functions').":",$this->doc->table($code),0,1);
00342
00343
00344
00345 $code = Array();
00346 $code[2][1] = $this->setLabel('edit_wideDocument');
00347 $code[2][2] = '<input type="checkbox" name="data[edit_wideDocument]"'.($BE_USER->uc['edit_wideDocument']?' checked="checked"':'').' />';
00348 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
00349 $code[3][1] = $this->setLabel('edit_RTE');
00350 $code[3][2] = '<input type="checkbox" name="data[edit_RTE]"'.($BE_USER->uc['edit_RTE']?' checked="checked"':'').' />';
00351 }
00352 $code[4][1] = $this->setLabel('edit_docModuleUpload');
00353 $code[4][2] = '<input type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />';
00354
00355 $code[6][1] = $this->setLabel('edit_showFieldHelp');
00356 $code[6][2] = '<select name="data[edit_showFieldHelp]">
00357 <option value=""></option>
00358 <option value="icon"'.($BE_USER->uc['edit_showFieldHelp']=='icon'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_icon').'</option>
00359 <option value="text"'.($BE_USER->uc['edit_showFieldHelp']=='text'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_message').'</option>
00360 </select>';
00361
00362 $code[7][1] = $this->setLabel('disableCMlayers');
00363 $code[7][2] = '<input type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />';
00364
00365 $this->content.=$this->doc->section($LANG->getLL('edit_functions').":",$this->doc->table($code),0,1);
00366
00367
00368
00369 $code = Array();
00370 $code[1][1] = $this->setLabel('beUser_realName');
00371 $code[1][2] = '<input type="text" name="ext_beuser[realName]" value="'.htmlspecialchars($BE_USER->user['realName']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00372 $code[2][1] = $this->setLabel('beUser_email');
00373 $code[2][2] = '<input type="text" name="ext_beuser[email]" value="'.htmlspecialchars($BE_USER->user['email']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00374 $code[3][1] = $this->setLabel('emailMeAtLogin').' ('.$GLOBALS['BE_USER']->user['email'].')';
00375 $code[3][2] = '<input type="checkbox" name="data[emailMeAtLogin]"'.($BE_USER->uc['emailMeAtLogin']?' checked="checked"':'').' />';
00376 $code[4][1] = $this->setLabel('newPassword');
00377 $code[4][2] = '<input type="password" name="ext_beuser[password1]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />';
00378 $code[5][1] = $this->setLabel('newPasswordAgain');
00379 $code[5][2] = '<input type="password" name="ext_beuser[password2]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\'" />';
00380
00381 $this->content.=$this->doc->section($LANG->getLL('personal_data').":",$this->doc->table($code),0,1);
00382
00383
00384
00385 $this->content.=$this->doc->spacer(20);
00386 $this->content.=$this->doc->section('','
00387 <input type="submit" name="submit" value="'.$LANG->getLL('save').'" />
00388 <label for="setValuesToDefault"><b>'.$LANG->getLL('setToStandard').':</b></label> <input type="checkbox" name="data[setValuesToDefault]" id="setValuesToDefault" />'.
00389 t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $GLOBALS['BACK_PATH'],'|').'
00390 <input type="hidden" name="simUser" value="'.$this->simUser.'" />');
00391
00392
00393
00394 $this->content.=$this->doc->spacer(5);
00395 $this->content.=$this->doc->section('',$LANG->getLL('activateChanges'));
00396 }
00397
00403 function printContent() {
00404 $this->content.= $this->doc->endPage();
00405 echo $this->content;
00406 exit;
00407 }
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00432 function getRealScriptUserObj() {
00433 return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER'];
00434 }
00435
00442 function simulateUser() {
00443 global $BE_USER,$LANG,$BACK_PATH;
00444
00445
00446
00447
00448 $this->simUser = 0;
00449 $this->simulateSelector = '';
00450 unset($this->OLD_BE_USER);
00451 if ($BE_USER->isAdmin()) {
00452 $this->simUser = t3lib_div::_GP('simUser');
00453
00454
00455 $users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
00456 $opt = array();
00457 reset($users);
00458 $opt[] = '<option></option>';
00459 while(list(,$rr)=each($users)) {
00460 if ($rr['uid']!=$BE_USER->user['uid']) {
00461 $opt[] = '<option value="'.$rr['uid'].'"'.($this->simUser==$rr['uid']?' selected="selected"':'').'>'.htmlspecialchars($rr['username'].' ('.$rr['realName'].')').'</option>';
00462 }
00463 }
00464 $this->simulateSelector = '<select name="simulateUser" onchange="window.location.href=\'index.php?simUser=\'+this.options[this.selectedIndex].value;">'.implode('',$opt).'</select>';
00465 }
00466
00467 if ($this->simUser>0) {
00468 $this->OLD_BE_USER = $BE_USER;
00469 unset($BE_USER);
00470
00471 $BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth');
00472 $BE_USER->OS = TYPO3_OS;
00473 $BE_USER->setBeUserByUid($this->simUser);
00474 $BE_USER->fetchGroupData();
00475 $BE_USER->backendSetUC();
00476 $GLOBALS['BE_USER'] = $BE_USER;
00477 }
00478 }
00479
00488 function setLabel($str,$key='') {
00489 $out = $GLOBALS['LANG']->getLL($str);
00490 if (isset($this->overrideConf[($key?$key:$str)])) {
00491 $out = '<span style="color:#999999">'.$out.'</span>';
00492 }
00493
00494
00495 $csh = t3lib_BEfunc::cshItem('_MOD_user_setup', 'option_'.$str, $GLOBALS['BACK_PATH'],'|',FALSE,'margin-bottom:0px;');
00496 if (strlen($csh)) $csh = ': '.$csh;
00497
00498
00499 return $out.$csh;
00500 }
00501 }
00502
00503
00504 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/setup/mod/index.php']) {
00505 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/setup/mod/index.php']);
00506 }
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520 $SOBE = t3lib_div::makeInstance('SC_mod_user_setup_index');
00521 $SOBE->simulateUser();
00522 $SOBE->storeIncomingData();
00523
00524
00525 require ($BACK_PATH.'template.php');
00526 $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
00527
00528 $SOBE->init();
00529 $SOBE->main();
00530 $SOBE->printContent();
00531 ?>