📄 index.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)* All rights reserved** This script is part of the TYPO3 project. The TYPO3 project is* free software; you can redistribute it and/or modify* it under the terms of the GNU General Public License as published by* the Free Software Foundation; either version 2 of the License, or* (at your option) any later version.** The GNU General Public License can be found at* http://www.gnu.org/copyleft/gpl.html.* A copy is found in the textfile GPL.txt and important notices to the license* from the author is found in LICENSE.txt distributed with these scripts.*** This script is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.** This copyright notice MUST APPEAR in all copies of the script!***************************************************************//** * Module: User configuration * * This module lets users viev and change their individual settings * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * Revised for TYPO3 3.7 6/2004 by Kasper Skaarhoj * XHTML compatible. *//** * [CLASS/FUNCTION INDEX of SCRIPT] * * * * 86: class SC_mod_user_setup_index * * SECTION: Saving data * 114: function storeIncomingData() * * SECTION: Rendering module * 216: function init() * 248: function main() * 403: function printContent() * * SECTION: Helper functions * 432: function getRealScriptUserObj() * 442: function simulateUser() * 488: function setLabel($str,$key='') * * TOTAL FUNCTIONS: 7 * (This index is automatically created/updated by the extension "extdeveval") * */unset($MCONF);require('conf.php');require($BACK_PATH.'init.php');require_once(PATH_t3lib.'class.t3lib_tcemain.php');/** * Script class for the Setup module * * @author Kasper Skaarhoj <kasperYYYY@typo3.com> * @package TYPO3 * @subpackage tx_setup */class SC_mod_user_setup_index { // Internal variables: var $MCONF = array(); var $MOD_MENU = array(); var $MOD_SETTINGS = array(); var $doc; var $content; var $overrideConf; var $OLD_BE_USER; /****************************** * * Saving data * ******************************/ /** * If settings are submitted to _POST[DATA], store them * NOTICE: This method is called before the template.php is included. See buttom of document * * @return void */ function storeIncomingData() { global $BE_USER; // First check if something is submittet in the data-array from POST vars $d = t3lib_div::_POST('data'); if (is_array($d)) { // UC hashed before applying changes $save_before = md5(serialize($BE_USER->uc)); // PUT SETTINGS into the ->uc array: // Language $BE_USER->uc['lang'] = $d['lang']; // Startup $BE_USER->uc['condensedMode'] = $d['condensedMode']; $BE_USER->uc['noMenuMode'] = $d['noMenuMode']; if (t3lib_extMgm::isLoaded('taskcenter')) $BE_USER->uc['startInTaskCenter'] = $d['startInTaskCenter']; $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(); } $BE_USER->overrideUC(); // Inserts the overriding values. $save_after = md5(serialize($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()); } // 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'])) ) { $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']; $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->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(); unset($tce); } } } /****************************** * * Rendering module * ******************************/ /** * Initializes the module for display of the settings form. * * @return void */ function init() { global $BE_USER,$BACK_PATH; $this->MCONF = $GLOBALS['MCONF']; // Returns the script user - that is the REAL logged in user! ($GLOBALS[BE_USER] might be another user due to simulation!) $scriptUser = $this->getRealScriptUserObj(); $scriptUser->modAccess($this->MCONF,1); // ... and checking module access for the logged in user. // Getting the 'override' values as set might be set in User TSconfig $this->overrideConf = $BE_USER->getTSConfigProp('setup.override'); // Create instance of object for output of data $this->doc = t3lib_div::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->doc->docType = 'xhtml_trans'; $this->doc->form = '<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">'; $this->doc->tableLayout = Array ( 'defRow' => Array ( '0' => Array('<td align="left" width="300">','</td>'), 'defCol' => Array('<td valign="top">','</td>') ) ); $this->doc->table_TR = '<tr class="bgColor4">'; $this->doc->table_TABLE = '<table border="0" cellspacing="1" cellpadding="2">'; } /** * Generate the main settings formular: * * @return void */ function main() { global $BE_USER,$LANG,$BACK_PATH; // Start page: $this->doc->JScode.= '<script language="javascript" type="text/javascript" src="'.$BACK_PATH.'md5.js"></script>'; $this->content.= $this->doc->startPage($LANG->getLL('UserSettings')); $this->content.= $this->doc->header($LANG->getLL('UserSettings').' - ['.$BE_USER->user['username'].']'); // CSH general: $this->content.= t3lib_BEfunc::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'],'|'); // 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); } else { $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_failed'),1,0,2); } $this->content.=$this->doc->spacer(25);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -