Feature #17565 » 6228.diff
t3lib/class.t3lib_befunc.php (Revision 110) | ||
---|---|---|
return $sysLanguages;
|
||
}
|
||
|
||
/**
|
||
*
|
||
* Note: doesn't respect the q=-rating by now. Should perhaps be implemented
|
||
*
|
||
* @param boolean Include lang-variants as en-us or de-de?
|
||
* @return array All languages accepted by the user's browser, in order in which they appear in _SERVER[HTTP_ACCEPT_LANGUAGES]
|
||
*/
|
||
function getBrowserAcceptLanguages($includeSubLanguages = false) {
|
||
$langs_tmp = t3lib_div::getIndpEnv('HTTP_ACCEPT_LANGUAGE');
|
||
$tmp_arr = t3lib_div::trimExplode(',', $langs_tmp, true);
|
||
|
||
$langs = array();
|
||
foreach ($tmp_arr as $langstring) {
|
||
if (strpos($langstring, ';') > 0) {
|
||
$lang = substr($langstring, 0, strpos($langstring, ';'));
|
||
} else {
|
||
$lang = $langstring;
|
||
}
|
||
|
||
if (strlen($lang) > 0) {
|
||
if (!$includeSubLanguages && substr_count($lang, '-') > 0) {
|
||
$lang = substr($lang, 0, 2);
|
||
}
|
||
if (!in_array($lang, $langs)) {
|
||
$langs[] = $lang;
|
||
}
|
||
}
|
||
}
|
||
|
||
return $langs;
|
||
}
|
||
|
||
/**
|
||
* Returns the available backend-languages (checks for the language-keys in typo3conf/l10n/
|
||
*
|
||
* @return array The available languages
|
||
*/
|
||
function getAvailableBELanguages() {
|
||
global $LANG;
|
||
|
||
$lang = array();
|
||
|
||
$theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
|
||
foreach($theLanguages as $val) {
|
||
if ($val != 'default' && !@is_dir(PATH_typo3conf.'l10n/'.$val)) {
|
||
continue;
|
||
}
|
||
|
||
$lang[$val] = $LANG->sL('LLL:EXT:setup/mod/locallang.xml:lang_'.$val);
|
||
}
|
||
return $lang;
|
||
}
|
||
/**
|
||
* Returns a page record (of page with $id) with an extra field "_thePath" set to the record path IF the WHERE clause, $perms_clause, selects the record. Thus is works as an access check that returns a page record if access was granted, otherwise not.
|
t3lib/class.t3lib_div.php (Revision 110) | ||
---|---|---|
function uniqueArray($valueArray) {
|
||
return array_unique($valueArray);
|
||
}
|
||
|
||
/**
|
||
* Returns the key of a value in a given array.
|
||
*
|
||
* @param array Array containing the values
|
||
* @param string Value to search for and if found return its key.
|
||
* @return string/int The key of the value in the array
|
||
*/
|
||
function getArrayKeyForValue($array,$cmpValue) {
|
||
foreach ($array as $k=>$v) {
|
||
if ($v == $cmpValue) {
|
||
return $k;
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* Removes the value $cmpValue from the $array if found there. Returns the modified array
|
typo3/index.php (Revision 110) | ||
---|---|---|
// Internal, static:
|
||
var $redirectToURL; // Set to the redirect URL of the form (may be redirect_url or "alt_main.php")
|
||
var $L_vars; // Set to the labels used for the login screen.
|
||
// Internal, dynamic:
|
||
var $content; // Content accumulation
|
||
... | ... | |
$this->loginSecurityLevel = $TYPO3_CONF_VARS['BE']['loginSecurityLevel'];
|
||
}
|
||
// Getting login labels:
|
||
$this->L_vars = explode('|',$TYPO3_CONF_VARS['BE']['loginLabels']);
|
||
// Setting the redirect URL to "alt_main.php" if no alternative input is given:
|
||
$this->redirectToURL = $this->redirect_url ? $this->redirect_url : 'alt_main.php';
|
||
... | ... | |
// 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']) {
|
||
... | ... | |
* @return string HTML output
|
||
*/
|
||
function makeLoginForm() {
|
||
global $LANG, $LOCAL_LANG, $TYPO3_CONF_VARS;
|
||
// output the language-selector-menu
|
||
$lang = t3lib_BEfunc::getAvailableBELanguages();
|
||
asort($lang);
|
||
|
||
$content .= '<div class="langselect" style="text-align:right;"><select name="lang" style="margin-top:10px;" onChange="document.location.href = \''.t3lib_div::getIndpEnv('SCRIPT_NAME').'?lang=\'+this.options[this.options.selectedIndex].value">'.chr(10);
|
||
foreach ($lang as $k=>$l) {
|
||
$content .= '<option value="'.$k.'"'.($LANG->lang==$k ? ' selected="selected"' : '').'>'.$l.'</option>'.chr(10);
|
||
}
|
||
$content.='</select></div>';
|
||
// There must be no white-spaces outside of the tags (needed for buggy IE)
|
||
$content.= '<!--
|
||
Login form:
|
||
--><table cellspacing="0" cellpadding="0" border="0" id="logintable">
|
||
<tr>
|
||
<td colspan="2"><h2>'.htmlspecialchars($this->L_vars[6]).'</h2></td>
|
||
<td colspan="2"><h2>'.htmlspecialchars(sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:loginscreen.headline'), $TYPO3_CONF_VARS['SYS']['sitename'])).'</h2></td>
|
||
</tr>'.($this->commandLI ? '
|
||
<tr class="c-wrong">
|
||
<td colspan="2"><p class="c-wrong">'.htmlspecialchars($this->L_vars[9]).'</p></td>
|
||
<td colspan="2"><p class="c-wrong">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:loginscreen.noteLoginUnsuccessful')).'</p></td>
|
||
</tr>' : '').'
|
||
<tr class="c-username">
|
||
<td><p class="c-username">'.htmlspecialchars($this->L_vars[0]).':</p></td>
|
||
<td><p class="c-username">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:labels.username')).':</p></td>
|
||
<td><input type="text" name="username" value="'.htmlspecialchars($this->u).'" class="c-username" /></td>
|
||
</tr>
|
||
<tr class="c-password">
|
||
<td><p class="c-password">'.htmlspecialchars($this->L_vars[1]).':</p></td>
|
||
<td><p class="c-password">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:labels.password')).':</p></td>
|
||
<td><input type="password" name="p_field" value="'.htmlspecialchars($this->p).'" class="c-password" /></td>
|
||
</tr>'.($this->interfaceSelector && !$this->loginRefresh ? '
|
||
<tr class="c-interfaceselector">
|
||
<td><p class="c-interfaceselector">'.htmlspecialchars($this->L_vars[2]).':</p></td>
|
||
<td><p class="c-interfaceselector">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:labels.interface')).':</p></td>
|
||
<td>'.$this->interfaceSelector.'</td>
|
||
</tr>' : '' ).'
|
||
<tr class="c-submit">
|
||
<td></td>
|
||
<td><input type="submit" name="commandLI" value="'.htmlspecialchars($this->L_vars[3]).'" class="c-submit" /></td>
|
||
<td><input type="submit" name="commandLI" value="'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.login')).'" class="c-submit" /></td>
|
||
</tr>
|
||
<tr class="c-info">
|
||
<td colspan="2"><p class="c-info">'.htmlspecialchars($this->L_vars[7]).'</p></td>
|
||
<td colspan="2"><p class="c-info">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:loginscreen.noteCookies')).'</p></td>
|
||
</tr>
|
||
</table>';
|
||
... | ... | |
* @return string HTML output
|
||
*/
|
||
function makeLogoutForm() {
|
||
global $BE_USER;
|
||
global $BE_USER, $TYPO3_CONF_VARS, $LANG;
|
||
$content.='
|
||
... | ... | |
<table cellspacing="0" cellpadding="0" border="0" id="logintable">
|
||
<tr>
|
||
<td></td>
|
||
<td><h2>'.htmlspecialchars($this->L_vars[6]).'</h2></td>
|
||
<td><h2>'.htmlspecialchars(sprintf($LANG->sL('LLL:EXT:lang/locallang_core.php:loginscreen.headline'), $TYPO3_CONF_VARS['SYS']['sitename'])).'</h2></td>
|
||
</tr>
|
||
<tr class="c-username">
|
||
<td><p class="c-username">'.htmlspecialchars($this->L_vars[0]).':</p></td>
|
||
<td><p class="c-username">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.username')).':</p></td>
|
||
<td><p class="c-username-current">'.htmlspecialchars($BE_USER->user['username']).'</p></td>
|
||
</tr>'.($this->interfaceSelector_jump ? '
|
||
<tr class="c-interfaceselector">
|
||
<td><p class="c-interfaceselector">'.htmlspecialchars($this->L_vars[2]).':</p></td>
|
||
<td><p class="c-interfaceselector">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:labels.interface')).':</p></td>
|
||
<td>'.$this->interfaceSelector_jump.'</td>
|
||
</tr>' : '' ).'
|
||
<tr class="c-submit">
|
||
<td><input type="hidden" name="p_field" value="" /></td>
|
||
<td><input type="submit" name="commandLO" value="'.htmlspecialchars($this->L_vars[4]).'" class="c-submit" /></td>
|
||
<td><input type="submit" name="commandLO" value="'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout')).'" class="c-submit" /></td>
|
||
</tr>
|
||
<tr class="c-info">
|
||
<td></td>
|
||
<td><p class="c-info">'.htmlspecialchars($this->L_vars[7]).'</p></td>
|
||
<td><p class="c-info">'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.php:loginscreen.noteCookies')).'</p></td>
|
||
</tr>
|
||
</table>';
|
||
... | ... | |
* @return void
|
||
*/
|
||
function makeInterfaceSelectorBox() {
|
||
global $TYPO3_CONF_VARS;
|
||
global $TYPO3_CONF_VARS,$LANG;
|
||
// Reset variables:
|
||
$this->interfaceSelector = '';
|
||
... | ... | |
if (count($parts)>1) { // Only if more than one interface is defined will we show the selector:
|
||
// Initialize:
|
||
$tempLabels=explode(',',$this->L_vars[5]);
|
||
$labels=array();
|
||
$labels['backend']=$tempLabels[0];
|
||
$labels['frontend']=$tempLabels[1];
|
||
$labels['backend']=$LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.interfaces.backend');
|
||
$labels['frontend']=$LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.interfaces.frontend');
|
||
$jumpScript=array();
|
||
$jumpScript['backend']='alt_main.php';
|
||
... | ... | |
* @return string Text/Image (HTML) for copyright notice.
|
||
*/
|
||
function makeCopyrightNotice() {
|
||
global $LANG;
|
||
// Get values from TYPO3_CONF_VARS:
|
||
$loginCopyrightWarrantyProvider = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyProvider']));
|
||
... | ... | |
// Make warranty note:
|
||
if (strlen($loginCopyrightWarrantyProvider)>=2 && strlen($loginCopyrightWarrantyURL)>=10) {
|
||
$warrantyNote='Warranty is supplied by '.htmlspecialchars($loginCopyrightWarrantyProvider).'; <a href="'.htmlspecialchars($loginCopyrightWarrantyURL).'" target="_blank">click for details.</a>';
|
||
$warrantyNote=sprintf($LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.warrantyProvidedBy'), htmlspecialchars($loginCopyrightWarrantyProvider)).'; <a href="'.htmlspecialchars($loginCopyrightWarrantyURL).'" target="_blank">'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.clickfordetails').'</a>.';
|
||
} else {
|
||
$warrantyNote='TYPO3 comes with ABSOLUTELY NO WARRANTY; <a href="http://typo3.com/1316.0.html" target="_blank">click for details.</a>';
|
||
$warrantyNote=$LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.warranty').'; <a href="http://typo3.com/1316.0.html" target="_blank">'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.clickfordetails').'</a>.';
|
||
}
|
||
// Compile full copyright notice:
|
||
// Compile full copyright notice:
|
||
$copyrightNotice = '<a href="http://typo3.com/" target="_blank">'.
|
||
'<img src="gfx/loginlogo_transp.gif" width="75" height="19" alt="TYPO3 logo" align="left" />'.
|
||
'TYPO3 CMS'.($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightShowVersion']?' ver. '.htmlspecialchars($GLOBALS['TYPO_VERSION']):'').
|
||
'</a>. '.
|
||
'Copyright © '.TYPO3_copyright_year.' Kasper Skårhøj. Extensions are copyright of their respective owners. '.
|
||
'Go to <a href="http://typo3.com/" target="_blank">http://typo3.com/</a> for details. '.
|
||
'TYPO3 CMS'.($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightShowVersion']?' ver. '.htmlspecialchars($GLOBALS['TYPO_VERSION']):'').'</a>. Copyright © '.TYPO3_copyright_year.' Kasper Skårhøj. '.
|
||
sprintf($LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.copyrightExtensions'), '<a href="http://typo3.com/" target="_blank">http://typo3.com/</a>').' '.
|
||
$warrantyNote.' '.
|
||
'This is free software, and you are welcome to redistribute it under certain conditions; <a href="http://typo3.com/1316.0.html" target="_blank">click for details</a>. '.
|
||
'Obstructing the appearance of this notice is prohibited by law.';
|
||
$LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.freeSoftware').'; '.
|
||
'<a href="http://typo3.com/1316.0.html" target="_blank">'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.clickfordetails').'</a>. '.
|
||
$LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.obstructingNotice').'.';
|
||
// Return notice:
|
||
return $copyrightNotice;
|
||
... | ... | |
* @credits Idea by Jan-Hendrik Heuing
|
||
*/
|
||
function makeLoginNews() {
|
||
global $LANG;
|
||
// Reset output variable:
|
||
$newsContent= '';
|
||
... | ... | |
Login screen news:
|
||
-->
|
||
<div id="loginNews">
|
||
<h2>'.htmlspecialchars($this->L_vars[8]).'</h2>
|
||
<h2>'.htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_core.xml:loginscreen.newsHeadline')).':</h2>
|
||
<table border="0" cellpadding="0" cellspacing="0">
|
||
'.$newsContent.'
|
||
</table>
|
typo3/template.php (Revision 110) | ||
---|---|---|
// ******************************************************
|
||
require_once(PATH_typo3.'sysext/lang/lang.php');
|
||
$LANG = t3lib_div::makeInstance('language');
|
||
$LANG->init($BE_USER->uc['lang']);
|
||
if ($BE_USER->uid) {
|
||
$LANG->init($BE_USER->uc['lang']);
|
||
} elseif (t3lib_div::_GP('lang') != '' && strpos(TYPO3_languages, t3lib_div::_GP('lang')) !== false) {
|
||
$LANG->init(t3lib_div::_GP('lang'));
|
||
} else {
|
||
$langs = t3lib_BEfunc::getBrowserAcceptLanguages();
|
||
$LANG->init($langs);
|
||
}
|
||
typo3/sysext/lang/locallang_core.xml (Revision 110) | ||
---|---|---|
<label index="labels.setAllCheckboxes">Select All Checkboxes</label>
|
||
<label index="labels.changeInOrig">Changed in original translation</label>
|
||
<label index="labels.expandAll">Expand all</label>
|
||
<label index="labels.username">Username</label>
|
||
<label index="labels.password">Password</label>
|
||
<label index="labels.interface">Interface</label>
|
||
<label index="labels.clickfordetails">click for details</label>
|
||
<label index="ver.online">ONLINE</label>
|
||
<label index="ver.mgm">Version Management</label>
|
||
<label index="ver.selVer">Select version:</label>
|
||
... | ... | |
<label index="rm.edit">Edit</label>
|
||
<label index="rm.export">Export</label>
|
||
<label index="rm.delete">Delete</label>
|
||
<label index="buttons.logout">Logout</label>
|
||
<label index="buttons.login">Log In</label>
|
||
<label index="buttons.logout">Log Out</label>
|
||
<label index="buttons.exit">Exit</label>
|
||
<label index="buttons.selMenu_modules">MODULES</label>
|
||
<label index="buttons.clear">Clear</label>
|
||
... | ... | |
<label index="cm.copyFolder_into">Copy folder into</label>
|
||
<label index="cm.moveFolder_into">Move folder into</label>
|
||
<label index="cm.createNewRelation">Create new relation</label>
|
||
<label index="loginscreen.headline">Administration Login on %s</label>
|
||
<label index="loginscreen.noteCookies">(Note: Cookies and JavaScript must be enabled!)</label>
|
||
<label index="loginscreen.noteLoginUnsuccessful">Your login attempt did not succeed. Make sure to spell your username and password correctly, including upper/lowercase characters.</label>
|
||
<label index="loginscreen.interfaces.backend">Backend</label>
|
||
<label index="loginscreen.interfaces.frontend">Frontend</label>
|
||
<label index="loginscreen.copyrightExtensions">Extensions are copyright of their respective owners. Go to %s for details.</label>
|
||
<label index="loginscreen.warranty">TYPO3 comes with ABSOLUTELY NO WARRANTY</label>
|
||
<label index="loginscreen.warrantyProvidedBy">Warranty is supplied by %s</label>
|
||
<label index="loginscreen.freeSoftware">This is free software, and you are welcome to redistribute it under certain conditions</label>
|
||
<label index="loginscreen.obstructingNotice">Obstructing the appearance of this notice is prohibited by law</label>
|
||
<label index="loginscreen.newsHeadline">Important Messages</label>
|
||
</languageKey>
|
||
</data>
|
||
</T3locallang>
|
||
<orig_hash type="array">
|
||
</orig_hash>
|
||
<orig_text type="array">
|
||
</orig_text>
|
||
</T3locallang>
|
typo3/sysext/lang/lang.php (Revision 110) | ||
---|---|---|
* @return void
|
||
*/
|
||
function init($lang,$altPath='') {
|
||
|
||
if (!is_array($lang)) {
|
||
$lang = array($lang);
|
||
}
|
||
// Initialize the conversion object:
|
||
$this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
|
||
... | ... | |
// Finding the requested language in this list based on the $lang key being inputted to this function.
|
||
$ls = explode('|',$this->langSplit);
|
||
while(list($i,$v)=each($ls)) {
|
||
if ($v==$lang) { // Language is found. Configure it:
|
||
$this->langSplitIndex=$i; // The index of the language as found in the TYPO3_languages list
|
||
$this->lang = $lang; // The current language key
|
||
foreach ($lang as $l) {
|
||
if ($l == 'en') {
|
||
$l = 'default';
|
||
}
|
||
// if this language is not available, proceed with the next
|
||
if ($l != 'default' && !@is_dir(PATH_typo3conf.'l10n/'.$l)) {
|
||
continue;
|
||
}
|
||
|
||
if (in_array($l, $ls)) { // Language is found. Configure it:
|
||
$this->langSplitIndex=t3lib_div::getArrayKeyForValue($ls, $l); // The index of the language as found in the TYPO3_languages list
|
||
$this->lang = $l; // The current language key
|
||
if ($this->helpUrlArray[$this->lang]) $this->typo3_help_url=$this->helpUrlArray[$this->lang]; // The help URL if different from the default.
|
||
if ($this->charSetArray[$this->lang]) $this->charSet=$this->charSetArray[$this->lang]; // The charset if different from the default.
|
||
break;
|
||
}
|
||
}
|
||