Bug #20589 ยป 11293_login_translatable.patch
t3lib/config_default.php (Arbeitskopie) | ||
---|---|---|
'fileDenyPattern' => FILE_DENY_PATTERN_DEFAULT , // A perl-compatible regular expression (without delimiters!) that - if it matches a filename - will deny the file upload/rename or whatever in the webspace. For security reasons, files with multiple extensions have to be denied on an Apache environment with mod_alias, if the filename contains a valid php handler in an arbitary position. Also, ".htaccess" files have to be denied. Matching is done case-insensitive. Default value is stored in constant FILE_DENY_PATTERN_DEFAULT
|
||
'interfaces' => 'backend', // This determines which interface options is available in the login prompt and in which order (All options: ",backend,backend_old,frontend")
|
||
'useOnContextMenuHandler' => 1, // Boolean. If set, the context menus (clickmenus) in the backend are activated on right-click - although this is not a XHTML attribute!
|
||
'loginLabels' => 'Username|Password|Interface|Log In|Log Out|Backend,Front End,Traditional Backend|Administration Login on ###SITENAME###|(Note: Cookies and JavaScript must be enabled!)|Important Messages:|Your login attempt did not succeed. Make sure to spell your username and password correctly, including upper/lowercase characters.', // Language labels of the login prompt.
|
||
'loginLabels' => 'Username|Password|Interface|Log In|Log Out|Backend,Front End,Traditional Backend|Administration Login on ###SITENAME###|(Note: Cookies and JavaScript must be enabled!)|Important Messages:|Your login attempt did not succeed. Make sure to spell your username and password correctly, including upper/lowercase characters.', // Language labels of the login prompt., not used properly anymore, as the login screen is translateable now, see EXT:lang/locallang_login.xml for the used labels
|
||
'loginNews' => array(), // In this array you can define news-items for the login screen. To this array, add arrays with assoc keys 'date', 'header', 'content' (HTML content) and for those appropriate value pairs
|
||
'loginNewsTitle' => '', // Define alternative header message for the LoginNews. If this var is empty, the default header "Important messages:" is displayed.
|
||
'XLLfile' => Array(), // For extension/overriding of the arrays in 'locallang' files in the backend. See 'Inside TYPO3' for more information.
|
typo3/index.php (Arbeitskopie) | ||
---|---|---|
define('TYPO3_PROCEED_IF_NO_USER', 1);
|
||
require ('init.php');
|
||
require ('template.php');
|
||
require('init.php');
|
||
require('template.php');
|
||
... | ... | |
// Internal, static:
|
||
var $redirectToURL; // Set to the redirect URL of the form (may be redirect_url or "backend.php")
|
||
var $L_vars; // Set to the labels used for the login screen.
|
||
var $L_vars; // Set to the labels used for the login screen. Deprecated, as the login labels are now translatable via $LANG and EXT:lang/locallang_login.xml
|
||
// Internal, dynamic:
|
||
var $content; // Content accumulation
|
||
... | ... | |
* @return void
|
||
*/
|
||
function init() {
|
||
// We need a PHP session session for most login levels
|
||
// We need a PHP session session for most login levels
|
||
session_start();
|
||
$this->redirect_url = t3lib_div::_GP('redirect_url');
|
||
... | ... | |
$this->loginSecurityLevel = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'];
|
||
}
|
||
// Getting login labels
|
||
$this->L_vars = explode('|', $GLOBALS['TYPO3_CONF_VARS']['BE']['loginLabels']);
|
||
// getting the login labels from the lang object, if there is a different available,
|
||
// we need to set the language object first as well
|
||
list($preferredBrowserLanguage) = explode(',', t3lib_div::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
|
||
$preferredBrowserLanguage = substr($preferredBrowserLanguage, 0, 2);
|
||
if (!$BE_USER->user['uid'] && $GLOBALS['LANG']->lang == 'default' && strlen($preferredBrowserLanguage) > 0 && $preferredBrowserLanguage != 'en') {
|
||
$GLOBALS['LANG']->init($preferredBrowserLanguage);
|
||
}
|
||
$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_login.xml');
|
||
// for backwards-compatibility, see if there is a change in the old labels (and then we need to merge them)
|
||
$this->mergeOldLoginLabels();
|
||
// Setting the redirect URL to "backend.php" if no alternative input is given
|
||
$this->redirectToURL = $this->redirect_url ? $this->redirect_url : 'backend.php';
|
||
$this->redirectToURL = ($this->redirect_url ? $this->redirect_url : 'backend.php');
|
||
// Do a logout if the command is set
|
||
if ($this->L == 'OUT' && is_object($GLOBALS['BE_USER'])) {
|
||
$GLOBALS['BE_USER']->logoff();
|
||
if ($this->redirect_url) {
|
||
header('Location: '.t3lib_div::locationHeaderUrl($this->redirect_url));
|
||
t3lib_div::redirect($this->redirect_url);
|
||
}
|
||
exit;
|
||
}
|
||
... | ... | |
// Initialize interface selectors:
|
||
$this->makeInterfaceSelectorBox();
|
||
// Replace an optional marker in the "Administration Login" label
|
||
$this->L_vars[6] = str_replace("###SITENAME###", $TYPO3_CONF_VARS['SYS']['sitename'], $this->L_vars[6]);
|
||
// Creating form based on whether there is a login or not:
|
||
if (!$BE_USER->user['uid']) {
|
||
$TBE_TEMPLATE->form = $this->startForm();
|
||
... | ... | |
function makeLoginForm() {
|
||
$content = t3lib_parsehtml::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_FORM###');
|
||
$markers = array(
|
||
'HEADLINE' => $this->L_vars[6],
|
||
'LABEL_USERNAME' => $this->L_vars[0],
|
||
'LABEL_PASSWORD' => $this->L_vars[1],
|
||
'VALUE_USERNAME' => $this->u,
|
||
'VALUE_PASSWORD' => $this->p,
|
||
'VALUE_SUBMIT' => $this->L_vars[3],
|
||
'INFO' => $this->L_vars[7],
|
||
'VALUE_USERNAME' => htmlspecialchars($this->u),
|
||
'VALUE_PASSWORD' => htmlspecialchars($this->p),
|
||
'VALUE_SUBMIT' => $GLOBALS['LANG']->getLL('labels.submitLogin', true),
|
||
);
|
||
// show an error message if the login command was successful already
|
||
// show an error message if the login command was successful already, otherwise remove the subpart
|
||
if (!$this->commandLI) {
|
||
$content = t3lib_parsehtml::substituteSubpart($content, '###LOGIN_ERROR###', '');
|
||
} else {
|
||
$markers['ERROR_MESSAGE'] = $this->L_vars[9];
|
||
$markers['ERROR_MESSAGE'] = $GLOBALS['LANG']->getLL('error.login', true);
|
||
}
|
||
// HSC all output
|
||
foreach ($markers as &$marker) {
|
||
$marker = htmlspecialchars($marker);
|
||
}
|
||
// remove the interface selector markers if it's not available
|
||
if (!($this->interfaceSelector && !$this->loginRefresh)) {
|
||
$content = t3lib_parsehtml::substituteSubpart($content, '###INTERFACE_SELECTOR###', '');
|
||
} else {
|
||
$markers['LABEL_INTERFACE'] = htmlspecialchars($this->L_vars[2]);
|
||
$markers['LABEL_INTERFACE'] = $GLOBALS['LANG']->getLL('labels.interface', true);
|
||
$markers['VALUE_INTERFACE'] = $this->interfaceSelector_jump;
|
||
}
|
||
... | ... | |
function makeLogoutForm() {
|
||
$content = t3lib_parsehtml::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGOUT_FORM###');
|
||
$markers = array(
|
||
'HEADLINE' => $this->L_vars[6],
|
||
'LABEL_USERNAME' => $this->L_vars[0],
|
||
'VALUE_USERNAME' => $GLOBALS['BE_USER']->user['username'],
|
||
'VALUE_SUBMIT' => $this->L_vars[4],
|
||
'INFO' => $this->L_vars[7],
|
||
'LABEL_USERNAME' => $GLOBALS['LANG']->getLL('labels.username', true),
|
||
'VALUE_USERNAME' => htmlspecialchars($GLOBALS['BE_USER']->user['username']),
|
||
'VALUE_SUBMIT' => $GLOBALS['LANG']->getLL('labels.submitLogout', true),
|
||
);
|
||
// HSC all output
|
||
foreach ($markers as &$marker) {
|
||
$marker = htmlspecialchars($marker);
|
||
}
|
||
// remove the interface selector markers if it's not available
|
||
if (!$this->interfaceSelector_jump) {
|
||
$content = t3lib_parsehtml::substituteSubpart($content, '###INTERFACE_SELECTOR###', '');
|
||
} else {
|
||
$markers['LABEL_INTERFACE'] = htmlspecialchars($this->L_vars[2]);
|
||
$markers['LABEL_INTERFACE'] = $GLOBALS['LANG']->getLL('labels.interface', true);
|
||
$markers['VALUE_INTERFACE'] = $this->interfaceSelector_jump;
|
||
}
|
||
... | ... | |
}
|
||
$markers = array(
|
||
'LOGO' => $logo,
|
||
'LOGINBOX_IMAGE' => $this->makeLoginBoxImage(),
|
||
'FORM' => $content,
|
||
'NEWS' => $this->makeLoginNews(),
|
||
'COPYRIGHT' => $this->makeCopyrightNotice(),
|
||
'CSS_ERRORCLASS' => ($this->commandLI ? ' class="error"' : ''),
|
||
'LOGO' => $logo,
|
||
'LOGINBOX_IMAGE' => $this->makeLoginBoxImage(),
|
||
'FORM' => $content,
|
||
'NEWS' => $this->makeLoginNews(),
|
||
'COPYRIGHT' => $this->makeCopyrightNotice(),
|
||
'CSS_ERRORCLASS' => ($this->commandLI ? ' class="error"' : ''),
|
||
// the labels will be replaced later on, thus the other parts above
|
||
// can use these markers as well and it will be replaced
|
||
'HEADLINE' => $GLOBALS['LANG']->getLL('headline', true),
|
||
'INFO' => $GLOBALS['LANG']->getLL('info.jscookies', true),
|
||
'ERROR_JAVASCRIPT' => $GLOBALS['LANG']->getLL('error.javascript', true),
|
||
'ERROR_COOKIES' => $GLOBALS['LANG']->getLL('error.cookies', true),
|
||
'LABEL_DONATELINK' => $GLOBALS['LANG']->getLL('labels.donate', true),
|
||
'LABEL_USERNAME' => $GLOBALS['LANG']->getLL('labels.username', true),
|
||
'LABEL_PASSWORD' => $GLOBALS['LANG']->getLL('labels.password', true),
|
||
// global variables will now be replaced (at last)
|
||
'SITENAME' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
|
||
);
|
||
return t3lib_parsehtml::substituteMarkerArray($mainContent, $markers, '###|###');
|
||
}
|
||
... | ... | |
if (count($parts)>1) { // Only if more than one interface is defined will we show the selector:
|
||
// Initialize:
|
||
$tempLabels=explode(',', $this->L_vars[5]);
|
||
$tempLabels = t3lib_div::trimExplode(',', $GLOBALS['LANG']->getLL('availableInterfaces'));
|
||
$labels=array();
|
||
$labels['backend'] = $tempLabels[0];
|
||
... | ... | |
$newsContent .= '<dd>'.trim($newsItem['content']).'</dd>';
|
||
}
|
||
$title = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle']) : htmlspecialchars($this->L_vars[8]);
|
||
$title = ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle']) : $GLOBALS['LANG']->getLL('newsheadline', true));
|
||
// Wrap
|
||
$newsContent = '
|
||
... | ... | |
return $JSCode;
|
||
}
|
||
/**
|
||
* Checks if the value in $GLOBALS['TYPO3_CONF_VARS']['BE']['loginLabels'] is different
|
||
* than the default login labels (which are now deprecated)
|
||
* If so, this means that the installation has custom labels. Thus, we want to keep this
|
||
* and override the labels in $LOCAL_LANG with the
|
||
*
|
||
* This method keeps backwards compatibility, if you modified your
|
||
* labels with the TYPO3_CONF_VARS variable before, we recommend that you use
|
||
* the override of the LLfile itself to modify the labels
|
||
*
|
||
* @return void
|
||
*/
|
||
protected function mergeOldLoginLabels() {
|
||
// Getting login labels
|
||
$oldLoginLabels = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['loginLabels']);
|
||
// not used anymore
|
||
$this->L_vars = explode('|', $oldLoginLabels);
|
||
// this list is taken from t3lib/config_default.php so it can be checked against
|
||
// the one in the localconf.php to see if there were any custom modifications made
|
||
// for this installation. If so, we need to merge the changes
|
||
$defaultOldLabels = 'Username|Password|Interface|Log In|Log Out|Backend,Front End,Traditional Backend|Administration Login on ###SITENAME###|(Note: Cookies and JavaScript must be enabled!)|Important Messages:|Your login attempt did not succeed. Make sure to spell your username and password correctly, including upper/lowercase characters.';
|
||
if (strlen($oldLoginLabels) > 0 && $oldLoginLabels != $defaultOldLoginLabels) {
|
||
$oldLoginLabelArray = $this->L_vars;
|
||
$overrideLabelKeys = array(
|
||
'labels.username' => $oldLoginLabelArray[0],
|
||
'labels.password' => $oldLoginLabelArray[1],
|
||
'labels.interface' => $oldLoginLabelArray[2],
|
||
'labels.submitLogin' => $oldLoginLabelArray[3],
|
||
'labels.submitLogout' => $oldLoginLabelArray[4],
|
||
'availableInterfaces' => $oldLoginLabelArray[5],
|
||
'headline' => $oldLoginLabelArray[6],
|
||
'info.jscookies' => $oldLoginLabelArray[7],
|
||
'newsheadline' => $oldLoginLabelArray[8],
|
||
'error.login' => $oldLoginLabelArray[9],
|
||
);
|
||
if (!is_array($GLOBALS['LOCAL_LANG'][$GLOBALS['LANG']->lang])) {
|
||
$GLOBALS['LOCAL_LANG'][$GLOBALS['LANG']->lang] = array();
|
||
}
|
||
// now override the labels from the LOCAL_LANG with the TYPO3_CONF_VARS
|
||
foreach ($overrideLabelKeys as $labelKey => $label) {
|
||
$GLOBALS['LOCAL_LANG'][$GLOBALS['LANG']->lang][$labelKey] = $GLOBALS['LOCAL_LANG']['default'][$labelKey] = $label;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
typo3/sysext/lang/locallang_login.xml (Revision 0) | ||
---|---|---|
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||
<T3locallang>
|
||
<meta type="array">
|
||
<description>Labels for the Login screen</description>
|
||
<type>module</type>
|
||
</meta>
|
||
<data type="array">
|
||
<languageKey index="default" type="array">
|
||
<label index="labels.username">Username</label>
|
||
<label index="labels.password">Password</label>
|
||
<label index="labels.interface">Interface</label>
|
||
<label index="labels.submitLogin">Log In</label>
|
||
<label index="labels.submitLogout">Log Out</label>
|
||
<label index="labels.donate">Donate</label>
|
||
<label index="availableInterfaces">Backend,Front End,Traditional Backend</label>
|
||
<label index="headline">Administration Login on ###SITENAME###</label>
|
||
<label index="info.jscookies">(Note: Cookies and JavaScript must be enabled!)</label>
|
||
<label index="newsheadline">Important Messages:</label>
|
||
<label index="error.login">Your login attempt did not succeed. Make sure to spell your username and password correctly, including upper/lowercase characters.</label>
|
||
<label index="error.javascript">Activate JavaScript, please!</label>
|
||
</languageKey>
|
||
</data>
|
||
</T3locallang>
|