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->process_datamap();
00188 unset($tce);
00189 }
00190 }
00191 }
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00215 function init() {
00216 global $BE_USER,$BACK_PATH;
00217 $this->MCONF = $GLOBALS['MCONF'];
00218
00219
00220 $scriptUser = $this->getRealScriptUserObj();
00221 $scriptUser->modAccess($this->MCONF,1);
00222
00223
00224 $this->overrideConf = $BE_USER->getTSConfigProp('setup.override');
00225
00226
00227 $this->doc = t3lib_div::makeInstance('mediumDoc');
00228 $this->doc->backPath = $BACK_PATH;
00229 $this->doc->docType = 'xhtml_trans';
00230
00231 $this->doc->form = '<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">';
00232 $this->doc->tableLayout = Array (
00233 'defRow' => Array (
00234 '0' => Array('<td align="left" width="300">','</td>'),
00235 'defCol' => Array('<td valign="top">','</td>')
00236 )
00237 );
00238 $this->doc->table_TR = '<tr class="bgColor4">';
00239 $this->doc->table_TABLE = '<table border="0" cellspacing="1" cellpadding="2">';
00240 }
00241
00247 function main() {
00248 global $BE_USER,$LANG,$BACK_PATH;
00249
00250
00251 $this->doc->JScode.= '<script language="javascript" type="text/javascript" src="'.$BACK_PATH.'md5.js"></script>';
00252 $this->content.= $this->doc->startPage($LANG->getLL('UserSettings'));
00253 $this->content.= $this->doc->header($LANG->getLL('UserSettings').' - ['.$BE_USER->user['username'].']');
00254
00255
00256 $this->content.= t3lib_BEfunc::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'],'|');
00257
00258
00259 if ($this->PASSWORD_UPDATED) {
00260 if ($this->PASSWORD_UPDATED>0) {
00261 $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_ok'),1,0,1);
00262 } else {
00263 $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_failed'),1,0,2);
00264 }
00265 $this->content.=$this->doc->spacer(25);
00266 }
00267
00268
00269 if ($this->simulateSelector) {
00270 $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));
00271 }
00272
00273
00274
00275 $opt = array();
00276 $opt['000000000']='
00277 <option value="">'.$LANG->getLL('lang_default',1).'</option>';
00278 $theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
00279
00280
00281 $csConvObj = t3lib_div::makeInstance('t3lib_cs');
00282
00283
00284 foreach($theLanguages as $val) {
00285 if ($val!='default') {
00286 if ($BE_USER->uc['lang']!='default') {
00287 $localLabel = ' - ['.htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_'.$val]).']';
00288 } else $localLabel='';
00289
00290 $opt[$GLOBALS['LOCAL_LANG']['default']['lang_'.$val].'--'.$val]='
00291 <option value="'.$val.'"'.($BE_USER->uc['lang']==$val?' selected="selected"':'').'>'.$LANG->getLL('lang_'.$val,1).$localLabel.'</option>';
00292 }
00293 }
00294 ksort($opt);
00295 $code='
00296 <select name="data[lang]">'.
00297 implode('',$opt).'
00298 </select>'.
00299 t3lib_BEfunc::cshItem('_MOD_user_setup', 'language', $GLOBALS['BACK_PATH'],'|');
00300 $this->content.=$this->doc->section($LANG->getLL('language').':',$code,0,1);
00301
00302
00303
00304 $code = Array();
00305
00306 $code[2][1] = $this->setLabel('condensedMode','condensedMode').':';
00307 $code[2][2] = '<input type="checkbox" name="data[condensedMode]"'.($BE_USER->uc['condensedMode']?' checked="checked"':'').' />';
00308 $code[3][1] = $this->setLabel('noMenuMode','noMenuMode').':';
00309 $code[3][2] = '<select name="data[noMenuMode]">
00310 <option value=""'.(!$BE_USER->uc['noMenuMode']?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_def').'</option>
00311 <option value="1"'.($BE_USER->uc['noMenuMode'] && (string)$BE_USER->uc['noMenuMode']!="icons"?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_sel').'</option>
00312 <option value="icons"'.((string)$BE_USER->uc['noMenuMode']=='icons'?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_icons').'</option>
00313 </select>';
00314 if (t3lib_extMgm::isLoaded('taskcenter')) {
00315 $code[4][1] = $this->setLabel('startInTaskCenter','startInTaskCenter').':';
00316 $code[4][2] = '<input type="checkbox" name="data[startInTaskCenter]"'.($BE_USER->uc['startInTaskCenter']?' checked="checked"':'').' />';
00317 }
00318 $code[5][1] = $this->setLabel('showThumbs','thumbnailsByDefault').':';
00319 $code[5][2] = '<input type="checkbox" name="data[thumbnailsByDefault]"'.($BE_USER->uc['thumbnailsByDefault']?' checked="checked"':'').' />';
00320 $code[6][1] = $this->setLabel('helpText').':';
00321 $code[6][2] = '<input type="checkbox" name="data[helpText]"'.($BE_USER->uc['helpText']?' checked="checked"':'').' />';
00322 $code[7][1] = $this->setLabel('maxTitleLen','titleLen').':';
00323 $code[7][2] = '<input type="text" name="data[titleLen]" value="'.$BE_USER->uc['titleLen'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />';
00324
00325 $this->content.=$this->doc->section($LANG->getLL('opening').':',$this->doc->table($code),0,1);
00326
00327
00328
00329 $code = Array();
00330 $code[1][1] = $this->setLabel('copyLevels').':';
00331 $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');
00332 $code[2][1] = $this->setLabel('recursiveDelete').':';
00333 $code[2][2] = '<input type="checkbox" name="data[recursiveDelete]"'.($BE_USER->uc['recursiveDelete']?' checked="checked"':'').' />';
00334
00335 $this->content.=$this->doc->section($LANG->getLL('functions').":",$this->doc->table($code),0,1);
00336
00337
00338
00339 $code = Array();
00340 $code[2][1] = $this->setLabel('edit_wideDocument').':';
00341 $code[2][2] = '<input type="checkbox" name="data[edit_wideDocument]"'.($BE_USER->uc['edit_wideDocument']?' checked="checked"':'').' />';
00342 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) {
00343 $code[3][1] = $this->setLabel('edit_RTE').':';
00344 $code[3][2] = '<input type="checkbox" name="data[edit_RTE]"'.($BE_USER->uc['edit_RTE']?' checked="checked"':'').' />';
00345 }
00346 $code[4][1] = $this->setLabel('edit_docModuleUpload').':';
00347 $code[4][2] = '<input type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />';
00348
00349 $code[6][1] = $this->setLabel('edit_showFieldHelp').':';
00350 $code[6][2] = '<select name="data[edit_showFieldHelp]">
00351 <option value=""></option>
00352 <option value="icon"'.($BE_USER->uc['edit_showFieldHelp']=='icon'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_icon').'</option>
00353 <option value="text"'.($BE_USER->uc['edit_showFieldHelp']=='text'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_message').'</option>
00354 </select>';
00355
00356 $code[7][1] = $this->setLabel('disableCMlayers').':';
00357 $code[7][2] = '<input type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />';
00358
00359 $this->content.=$this->doc->section($LANG->getLL('edit_functions').":",$this->doc->table($code),0,1);
00360
00361
00362
00363 $code = Array();
00364 $code[1][1] = $this->setLabel('beUser_realName').':';
00365 $code[1][2] = '<input type="text" name="ext_beuser[realName]" value="'.htmlspecialchars($BE_USER->user['realName']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00366 $code[2][1] = $this->setLabel('beUser_email').':';
00367 $code[2][2] = '<input type="text" name="ext_beuser[email]" value="'.htmlspecialchars($BE_USER->user['email']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00368 $code[3][1] = $this->setLabel('emailMeAtLogin').' ('.$GLOBALS['BE_USER']->user['email'].'):';
00369 $code[3][2] = '<input type="checkbox" name="data[emailMeAtLogin]"'.($BE_USER->uc['emailMeAtLogin']?' checked="checked"':'').' />';
00370 $code[4][1] = $this->setLabel('newPassword').':';
00371 $code[4][2] = '<input type="password" name="ext_beuser[password1]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />';
00372 $code[5][1] = $this->setLabel('newPasswordAgain').':';
00373 $code[5][2] = '<input type="password" name="ext_beuser[password2]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\'" />';
00374
00375 $this->content.=$this->doc->section($LANG->getLL('personal_data').":",$this->doc->table($code),0,1);
00376
00377
00378
00379 $this->content.=$this->doc->spacer(20);
00380 $this->content.=$this->doc->section('','
00381 <input type="submit" name="submit" value="'.$LANG->getLL('save').'" />
00382 <b>'.$LANG->getLL('setToStandard').': </b><input type="checkbox" name="data[setValuesToDefault]" />'.
00383 t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $GLOBALS['BACK_PATH'],'|').'
00384 <input type="hidden" name="simUser" value="'.$this->simUser.'" />');
00385
00386
00387
00388 $this->content.=$this->doc->spacer(5);
00389 $this->content.=$this->doc->section('',$LANG->getLL('activateChanges'));
00390 }
00391
00397 function printContent() {
00398 $this->content.= $this->doc->endPage();
00399 echo $this->content;
00400 exit;
00401 }
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00426 function getRealScriptUserObj() {
00427 return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER'];
00428 }
00429
00436 function simulateUser() {
00437 global $BE_USER,$LANG,$BACK_PATH;
00438
00439
00440
00441
00442 $this->simUser = 0;
00443 $this->simulateSelector = '';
00444 unset($this->OLD_BE_USER);
00445 if ($BE_USER->isAdmin()) {
00446 $this->simUser = t3lib_div::_GP('simUser');
00447
00448
00449 $users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
00450 $opt = array();
00451 reset($users);
00452 $opt[] = '<option></option>';
00453 while(list(,$rr)=each($users)) {
00454 if ($rr['uid']!=$BE_USER->user['uid']) {
00455 $opt[] = '<option value="'.$rr['uid'].'"'.($this->simUser==$rr['uid']?' selected="selected"':'').'>'.htmlspecialchars($rr['username'].' ('.$rr['realName'].')').'</option>';
00456 }
00457 }
00458 $this->simulateSelector = '<select name="simulateUser" onchange="document.location=\'index.php?simUser=\'+this.options[this.selectedIndex].value;">'.implode('',$opt).'</select>';
00459 }
00460
00461 if ($this->simUser>0) {
00462 $this->OLD_BE_USER = $BE_USER;
00463 unset($BE_USER);
00464
00465 $BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth');
00466 $BE_USER->OS = TYPO3_OS;
00467 $BE_USER->setBeUserByUid($this->simUser);
00468 $BE_USER->fetchGroupData();
00469 $BE_USER->backendSetUC();
00470 $GLOBALS['BE_USER'] = $BE_USER;
00471 }
00472 }
00473
00482 function setLabel($str,$key='') {
00483 $out = $GLOBALS['LANG']->getLL($str);
00484 if (isset($this->overrideConf[($key?$key:$str)])) {
00485 $out = '<span style="color:#999999">'.$out.'</span>';
00486 }
00487
00488
00489 $out.= t3lib_BEfunc::cshItem('_MOD_user_setup', 'option_'.$str, $GLOBALS['BACK_PATH'],'|',FALSE,'margin-bottom:0px;');
00490
00491
00492 return $out;
00493 }
00494 }
00495
00496
00497 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/setup/mod/index.php']) {
00498 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/setup/mod/index.php']);
00499 }
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513 $SOBE = t3lib_div::makeInstance('SC_mod_user_setup_index');
00514 $SOBE->simulateUser();
00515 $SOBE->storeIncomingData();
00516
00517
00518 require ($BACK_PATH.'template.php');
00519 $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
00520
00521 $SOBE->init();
00522 $SOBE->main();
00523 $SOBE->printContent();
00524 ?>