Added feature #11798: Remove "Login-error or session timed out" screen (thanks to...
[Packages/TYPO3.CMS.git] / typo3 / index.php
index 923cf09..422203f 100644 (file)
@@ -257,7 +257,7 @@ class SC_index {
                        $content = t3lib_parsehtml::substituteSubpart($content, '###INTERFACE_SELECTOR###', '');
                } else {
                        $markers['LABEL_INTERFACE'] = $GLOBALS['LANG']->getLL('labels.interface', true);
-                       $markers['VALUE_INTERFACE'] = $this->interfaceSelector_jump;
+                       $markers['VALUE_INTERFACE'] = $this->interfaceSelector;
                }
 
                return t3lib_parsehtml::substituteMarkerArray($content, $markers, '###|###');
@@ -316,12 +316,16 @@ class SC_index {
                                // 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),
+                       'INFO_ABOUT'       => $GLOBALS['LANG']->getLL('info.about', true),
+                       'INFO_RELOAD'      => $GLOBALS['LANG']->getLL('info.reset', true),
                        'ERROR_JAVASCRIPT' => $GLOBALS['LANG']->getLL('error.javascript', true),
                        'ERROR_COOKIES'    => $GLOBALS['LANG']->getLL('error.cookies', true),
+                       'ERROR_CAPSLOCK'   => $GLOBALS['LANG']->getLL('error.capslock', 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),
+                       'CLEAR'            => $GLOBALS['LANG']->getLL('clear', true),
+                       'SITELINK'         => '<a href="/">###SITENAME###</a>',
 
                                // global variables will now be replaced (at last)
                        'SITENAME'         => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
@@ -434,10 +438,10 @@ class SC_index {
                                                        <option value="'.htmlspecialchars($jumpScript[$valueStr]).'">'.htmlspecialchars($labels[$valueStr]).'</option>';
                                }
                                $this->interfaceSelector='
-                                               <select id="interfaceselector" name="interface" class="c-interfaceselector">'.$this->interfaceSelector.'
+                                               <select id="t3-interfaceselector" name="interface" class="c-interfaceselector" tabindex="3">'.$this->interfaceSelector.'
                                                </select>';
                                $this->interfaceSelector_jump='
-                                               <select id="interfaceselector" name="interface" class="c-interfaceselector" onchange="window.location.href=this.options[this.selectedIndex].value;">'.$this->interfaceSelector_jump.'
+                                               <select id="t3-interfaceselector" name="interface" class="c-interfaceselector" tabindex="3" onchange="window.location.href=this.options[this.selectedIndex].value;">'.$this->interfaceSelector_jump.'
                                                </select>';
 
                        } else {        // If there is only ONE interface value set:
@@ -466,21 +470,21 @@ class SC_index {
 
                        // 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($GLOBALS['LANG']->getLL('warranty.by'), htmlspecialchars($loginCopyrightWarrantyProvider), '<a href="' . htmlspecialchars($loginCopyrightWarrantyURL) . '" target="_blank">', '</a>');
                } else {
-                       $warrantyNote='TYPO3 comes with ABSOLUTELY NO WARRANTY; <a href="http://typo3.com/1316.0.html" target="_blank">click for details.</a>';
+                       $warrantyNote = sprintf($GLOBALS['LANG']->getLL('no.warranty'), '<a href="http://typo3.com/1316.0.html" target="_blank">', '</a>');
                }
 
                        // Compile full copyright notice:
                $copyrightNotice = '<a href="http://typo3.com/" target="_blank">'.
-                                       '<img src="'.$loginImageSmall.'" alt="TYPO3 logo" align="left" />'.
-                                       'TYPO3 CMS'.($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightShowVersion']?' ver. '.htmlspecialchars($GLOBALS['TYPO_VERSION']):'').
-                                       '</a>. '.
-                                       'Copyright &copy; '.TYPO3_copyright_year.' Kasper Sk&#229;rh&#248;j. Extensions are copyright of their respective owners. '.
-                                       'Go to <a href="http://typo3.com/" target="_blank">http://typo3.com/</a> for details. '.
-                                       $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.';
+                                       '<img src="' . $loginImageSmall . '" alt="' . $GLOBALS['LANG']->getLL('typo3.logo') . '" align="left" />' .
+                                       $GLOBALS['LANG']->getLL('typo3.cms') . ($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightShowVersion']?' ' . $GLOBALS['LANG']->getLL('version.short') . ' ' . htmlspecialchars($GLOBALS['TYPO_VERSION']):'') .
+                                       '</a>. ' .
+                                       $GLOBALS['LANG']->getLL('copyright') . ' &copy; ' . TYPO3_copyright_year . ' Kasper Sk&#229;rh&#248;j. ' . $GLOBALS['LANG']->getLL('extension.copyright') . ' ' .
+                                       sprintf($GLOBALS['LANG']->getLL('details.link'), '<a href="http://typo3.com/" target="_blank">http://typo3.com/</a>') . '<br /> ' .
+                                       $warrantyNote . ' ' .
+                                       sprintf($GLOBALS['LANG']->getLL('free.software'), '<a href="http://typo3.com/1316.0.html" target="_blank">', '</a> ') .
+                                       $GLOBALS['LANG']->getLL('keep.notice');
 
                        // Return notice:
                return $copyrightNotice;
@@ -533,38 +537,38 @@ class SC_index {
        }
 
        /**
-        * Make login news - renders the HTML content for a list of news shown under the login form. News data is added through $TYPO3_CONF_VARS
+        * Make login news - renders the HTML content for a list of news shown under
+        * the login form. News data is added through $TYPO3_CONF_VARS
         *
         * @return      string          HTML content
         * @credits                     Idea by Jan-Hendrik Heuing
         */
-       function makeLoginNews()        {
-
-                       // Reset output variable:
-               $newsContent= '';
+       function makeLoginNews() {
+               $newsContent = '';
 
                        // Traverse news array IF there are records in it:
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']))  {
-                       foreach($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem)    {
-                               $newsContent .= '<dt>'.htmlspecialchars($newsItem['header']).' <span>'.htmlspecialchars($newsItem['date']).'</span></dt>';
-                               $newsContent .= '<dd>'.trim($newsItem['content']).'</dd>';
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
+
+                               // get the main news template, and replace the subpart after looped through 
+                       $newsContent      = t3lib_parsehtml::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_NEWS###');
+                       $newsItemTemplate = t3lib_parsehtml::getSubpart($newsContent, '###NEWS_ITEM###');
+
+                       $newsItemContent = '';
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem) {
+                               $newsItemMarker = array(
+                                       '###HEADER###'  => htmlspecialchars($newsItem['header']),
+                                       '###DATE###'    => htmlspecialchars($newsItem['date']),
+                                       '###CONTENT###' => trim($newsItem['content'])
+                               );
+                               $newsItemContent .= t3lib_parsehtml::substituteMarkerArray($newsItemTemplate, $newsItemMarker);
                        }
 
-                       $title = ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle']) : $GLOBALS['LANG']->getLL('newsheadline', true));
-                               // Wrap
-                       $newsContent = '
-
-                                       <!--
-                                               Login screen news:
-                                       -->
-                                       <h2 id="loginNewsTitle">'.$title.'</h2>
-                                       <dl id="loginNews">
-                                               '.$newsContent.'
-                                       </dl>
-                       ';
+                       $title = ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] : $GLOBALS['LANG']->getLL('newsheadline'));
+
+                       $newsContent = t3lib_parsehtml::substituteMarker($newsContent,  '###NEWS_HEADLINE###', htmlspecialchars($title));
+                       $newsContent = t3lib_parsehtml::substituteSubpart($newsContent, '###NEWS_ITEM###', $newsItemContent);
                }
 
-                       // Return content:
                return $newsContent;
        }
 
@@ -654,6 +658,49 @@ class SC_index {
                                        document.loginform.p_field.focus();
                                }
                        }
+
+                               // This function shows a warning, if user has capslock enabled
+                               // parameter showWarning: shows warning if true and capslock active, otherwise only hides warning, if capslock gets inactive
+                       function checkCapslock(e, showWarning) {
+                               if (!isCapslock(e)) {
+                                       document.getElementById(\'t3-capslock\').style.display = \'none\';
+                               } else if (showWarning) {
+                                       document.getElementById(\'t3-capslock\').style.display = \'block\';
+                               }
+                       }
+
+                               // Checks weather capslock is enabled (returns true if enabled, false otherwise)
+                               // thanks to http://24ways.org/2007/capturing-caps-lock
+                               
+                       function isCapslock(e) {
+                               var ev = e ? e : window.event;
+                               if (!ev) {
+                                       return;
+                               }
+                               var targ = ev.target ? ev.target : ev.srcElement;
+                               // get key pressed
+                               var which = -1;
+                               if (ev.which) {
+                                       which = ev.which;
+                               } else if (ev.keyCode) {
+                                       which = ev.keyCode;
+                               }
+                               // get shift status
+                               var shift_status = false;
+                               if (ev.shiftKey) {
+                                       shift_status = ev.shiftKey;
+                               } else if (ev.modifiers) {
+                                       shift_status = !!(ev.modifiers & 4);
+                               }
+                               return (((which >= 65 && which <= 90) && !shift_status) || 
+                                       ((which >= 97 && which <= 122) && shift_status));
+                       }
+
+                               // prevent opening the login form in the backend frameset
+                       if (top.location.href != self.location.href) {
+                               top.location.href = self.location.href;
+                       }
+
                        ');
 
                return $JSCode;