bb76bd6c0f92b567671b5ea232eac6daeee26553
[Packages/TYPO3.CMS.git] / typo3 / index.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Login-screen of TYPO3.
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 December/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 87: class SC_index
42 * 119: function init()
43 * 150: function main()
44 * 243: function printContent()
45 *
46 * SECTION: Various functions
47 * 267: function makeLoginForm()
48 * 312: function makeLogoutForm()
49 * 354: function wrapLoginForm($content)
50 * 414: function checkRedirect()
51 * 459: function makeInterfaceSelectorBox()
52 * 513: function makeCopyrightNotice()
53 * 546: function makeLoginBoxImage()
54 * 586: function makeLoginNews()
55 *
56 * TOTAL FUNCTIONS: 11
57 * (This index is automatically created/updated by the extension "extdeveval")
58 *
59 */
60
61
62 define('TYPO3_PROCEED_IF_NO_USER', 1);
63 require ('init.php');
64 require ('template.php');
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 /**
81 * Script Class for rendering the login form
82 *
83 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
84 * @package TYPO3
85 * @subpackage core
86 */
87 class SC_index {
88
89 // Internal, GPvars:
90 var $redirect_url; // GPvar: redirect_url; The URL to redirect to after login.
91 var $GPinterface; // GPvar: Defines which interface to load (from interface selector)
92 var $u; // GPvar: preset username
93 var $p; // GPvar: preset password
94 var $L; // GPvar: If "L" is "OUT", then any logged in used is logged out. If redirect_url is given, we redirect to it
95 var $loginRefresh; // Login-refresh boolean; The backend will call this script with this value set when the login is close to being expired and the form needs to be redrawn.
96 var $commandLI; // Value of forms submit button for login.
97
98 // Internal, static:
99 var $redirectToURL; // Set to the redirect URL of the form (may be redirect_url or "alt_main.php")
100 var $L_vars; // Set to the labels used for the login screen.
101
102 // Internal, dynamic:
103 var $content; // Content accumulation
104
105 var $interfaceSelector; // A selector box for selecting value for "interface" may be rendered into this variable
106 var $interfaceSelector_jump; // A selector box for selecting value for "interface" may be rendered into this variable - this will have an onchange action which will redirect the user to the selected interface right away
107 var $interfaceSelector_hidden; // A hidden field, if the interface is not set.
108
109 // sets the level of security. *'normal' = clear-text. 'challenged' = hashed password/username from form in $formfield_uident. 'superchallenged' = hashed password hashed again with username.
110 var $loginSecurityLevel = 'superchallenged';
111
112
113
114
115 /**
116 * Initialize the login box. Will also react on a &L=OUT flag and exit.
117 *
118 * @return void
119 */
120 function init() {
121 global $BE_USER,$TYPO3_CONF_VARS;
122
123 // GPvars:
124 $this->redirect_url = t3lib_div::_GP('redirect_url');
125 $this->GPinterface = t3lib_div::_GP('interface');
126 $this->u = t3lib_div::_GP('u'); // preset username
127 $this->p = t3lib_div::_GP('p'); // preset password
128 $this->L = t3lib_div::_GP('L'); // If "L" is "OUT", then any logged in used is logged out. If redirect_url is given, we redirect to it
129 $this->loginRefresh = t3lib_div::_GP('loginRefresh'); // Login
130 $this->commandLI = t3lib_div::_GP('commandLI'); // Value of "Login" button. If set, the login button was pressed.
131
132 // sets the level of security from conf vars
133 if ($TYPO3_CONF_VARS['BE']['loginSecurityLevel']) {
134 $this->loginSecurityLevel = $TYPO3_CONF_VARS['BE']['loginSecurityLevel'];
135 }
136
137 // Getting login labels:
138 $this->L_vars = explode('|',$TYPO3_CONF_VARS['BE']['loginLabels']);
139
140 // Setting the redirect URL to "alt_main.php" if no alternative input is given:
141 $this->redirectToURL = $this->redirect_url ? $this->redirect_url : 'alt_main.php';
142
143 // Logout?
144 if ($this->L=='OUT' && is_object($BE_USER)) {
145 $BE_USER->logoff();
146 if ($this->redirect_url) header('Location: '.t3lib_div::locationHeaderUrl($this->redirect_url));
147 exit;
148 }
149 }
150
151 /**
152 * Main function - creating the login/logout form
153 *
154 * @return void
155 */
156 function main() {
157 global $TBE_TEMPLATE, $TYPO3_CONF_VARS, $BE_USER;
158
159 // Initialize template object:
160 $TBE_TEMPLATE->docType='xhtml_trans';
161
162 // Set JavaScript for creating a MD5 hash of the password:
163 $TBE_TEMPLATE->JScode.='
164 <script type="text/javascript" src="md5.js"></script>
165 '.$TBE_TEMPLATE->wrapScriptTags('
166 function doChallengeResponse(superchallenged) { //
167 password = document.loginform.p_field.value;
168 if (password) {
169 if (superchallenged) {
170 password = MD5(password); // this makes it superchallenged!!
171 }
172 str = document.loginform.username.value+":"+password+":"+document.loginform.challenge.value;
173 document.loginform.userident.value = MD5(str);
174 document.loginform.p_field.value = "";
175 return true;
176 }
177 }
178 ');
179
180
181 // Checking, if we should make a redirect.
182 // Might set JavaScript in the header to close window.
183 $this->checkRedirect();
184
185 // Initialize interface selectors:
186 $this->makeInterfaceSelectorBox();
187
188 // Replace an optional marker in the "Administration Login" label
189 $this->L_vars[6] = str_replace("###SITENAME###",$TYPO3_CONF_VARS['SYS']['sitename'],$this->L_vars[6]);
190
191 // Creating form based on whether there is a login or not:
192 if (!$BE_USER->user['uid']) {
193
194 if ($this->loginSecurityLevel == 'challenged') {
195 $TBE_TEMPLATE->form = '
196 <form action="index.php" method="post" name="loginform" onsubmit="doChallengeResponse(0);">
197 ';
198 } elseif ($this->loginSecurityLevel == 'normal') {
199 $TBE_TEMPLATE->form = '
200 <form action="index.php" method="post" name="loginform" onsubmit="document.loginform.userident.value=document.loginform.p_field.value;document.loginform.p_field.value=\'\';document.loginform.challenge.value=\'\';return true;">
201 ';
202 } else { // if ($this->loginSecurityLevel == 'superchallenged') {
203 $TBE_TEMPLATE->form = '
204 <form action="index.php" method="post" name="loginform" onsubmit="doChallengeResponse(1);">
205 ';
206 }
207
208 $TBE_TEMPLATE->form.= '
209 <input type="hidden" name="login_status" value="login" />
210 ';
211 $loginForm = $this->makeLoginForm();
212 } else {
213 $TBE_TEMPLATE->form = '
214 <form action="index.php" method="post" name="loginform">
215 <input type="hidden" name="login_status" value="logout" />
216 ';
217 $loginForm = $this->makeLogoutForm();
218 }
219
220
221 // Starting page:
222 $this->content.=$TBE_TEMPLATE->startPage('TYPO3 Login: '.$TYPO3_CONF_VARS['SYS']['sitename']);
223
224 // Add login form:
225 $this->content.=$this->wrapLoginForm($loginForm);
226
227 // Ending form:
228 $this->content.= '
229 <input type="hidden" name="userident" value="" />
230 <input type="hidden" name="challenge" value="'.($challenge = md5(uniqid('').getmypid())).'" />
231 <input type="hidden" name="redirect_url" value="'.htmlspecialchars($this->redirectToURL).'" />
232 <input type="hidden" name="loginRefresh" value="'.htmlspecialchars($this->loginRefresh).'" />
233 '.$this->interfaceSelector_hidden.'
234 ';
235
236 // Save challenge value in session data (thanks to Bernhard Kraft for providing code):
237 session_start();
238 $_SESSION['login_challenge'] = $challenge;
239
240 // This moves focus to the right input field:
241 $this->content.=$TBE_TEMPLATE->wrapScriptTags('
242
243 // If the login screen is shown in the login_frameset window for re-login, then try to get the username of the current/former login from opening windows main frame:
244 if (parent.opener && parent.opener.TS && parent.opener.TS.username && document.loginform && document.loginform.username) {
245 document.loginform.username.value = parent.opener.TS.username;
246 }
247
248 // If for some reason there already is a username in the username for field, move focus to the password field:
249 if (document.loginform.username && document.loginform.username.value == "") {
250 document.loginform.username.focus();
251 } else if (document.loginform.p_field && document.loginform.p_field.type!="hidden") {
252 document.loginform.p_field.focus();
253 }
254 ');
255
256 // End page:
257 $this->content.=$TBE_TEMPLATE->endPage();
258 }
259
260 /**
261 * Outputting the accumulated content to screen
262 *
263 * @return void
264 */
265 function printContent() {
266
267 echo $this->content;
268 }
269
270
271
272
273
274
275
276
277 /*****************************
278 *
279 * Various functions
280 *
281 ******************************/
282
283 /**
284 * Creates the login form
285 * This is drawn when NO login exists.
286 *
287 * @return string HTML output
288 */
289 function makeLoginForm() {
290
291 $content.='
292
293 <!--
294 Login form:
295 -->
296 <table cellspacing="0" cellpadding="0" border="0" id="logintable">
297 <tr>
298 <td colspan="2"><h2>'.htmlspecialchars($this->L_vars[6]).'</h2></td>
299 </tr>'.($this->commandLI ? '
300 <tr class="c-wrong">
301 <td colspan="2"><p class="c-wrong">'.htmlspecialchars($this->L_vars[9]).'</p></td>
302 </tr>' : '').'
303 <tr class="c-username">
304 <td><p class="c-username">'.htmlspecialchars($this->L_vars[0]).':</p></td>
305 <td><input type="text" name="username" value="'.htmlspecialchars($this->u).'" class="c-username" /></td>
306 </tr>
307 <tr class="c-password">
308 <td><p class="c-password">'.htmlspecialchars($this->L_vars[1]).':</p></td>
309 <td><input type="password" name="p_field" value="'.htmlspecialchars($this->p).'" class="c-password" /></td>
310 </tr>'.($this->interfaceSelector && !$this->loginRefresh ? '
311 <tr class="c-interfaceselector">
312 <td><p class="c-interfaceselector">'.htmlspecialchars($this->L_vars[2]).':</p></td>
313 <td>'.$this->interfaceSelector.'</td>
314 </tr>' : '' ).'
315 <tr class="c-submit">
316 <td></td>
317 <td><input type="submit" name="commandLI" value="'.htmlspecialchars($this->L_vars[3]).'" class="c-submit" /></td>
318 </tr>
319 <tr class="c-info">
320 <td colspan="2"><p class="c-info">'.htmlspecialchars($this->L_vars[7]).'</p></td>
321 </tr>
322 </table>';
323
324 // Return content:
325 return $content;
326 }
327
328 /**
329 * Creates the logout form
330 * This is drawn if a user login already exists.
331 *
332 * @return string HTML output
333 */
334 function makeLogoutForm() {
335 global $BE_USER;
336
337
338 $content.='
339
340 <!--
341 Login form:
342 -->
343 <table cellspacing="0" cellpadding="0" border="0" id="logintable">
344 <tr>
345 <td></td>
346 <td><h2>'.htmlspecialchars($this->L_vars[6]).'</h2></td>
347 </tr>
348 <tr class="c-username">
349 <td><p class="c-username">'.htmlspecialchars($this->L_vars[0]).':</p></td>
350 <td><p class="c-username-current">'.htmlspecialchars($BE_USER->user['username']).'</p></td>
351 </tr>'.($this->interfaceSelector_jump ? '
352 <tr class="c-interfaceselector">
353 <td><p class="c-interfaceselector">'.htmlspecialchars($this->L_vars[2]).':</p></td>
354 <td>'.$this->interfaceSelector_jump.'</td>
355 </tr>' : '' ).'
356 <tr class="c-submit">
357 <td><input type="hidden" name="p_field" value="" /></td>
358 <td><input type="submit" name="commandLO" value="'.htmlspecialchars($this->L_vars[4]).'" class="c-submit" /></td>
359 </tr>
360 <tr class="c-info">
361 <td></td>
362 <td><p class="c-info">'.htmlspecialchars($this->L_vars[7]).'</p></td>
363 </tr>
364 </table>';
365
366 // Return content:
367 return $content;
368 }
369
370 /**
371 * Wrapping the login form table in another set of tables etc:
372 *
373 * @param string HTML content for the login form
374 * @return string The HTML for the page.
375 */
376 function wrapLoginForm($content) {
377
378 // Logo:
379 $logo = $GLOBALS['TBE_STYLES']['logo_login'] ?
380 '<img src="'.htmlspecialchars($GLOBALS['BACK_PATH'].$GLOBALS['TBE_STYLES']['logo_login']).'" alt="" />' :
381 '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/typo3logo.gif','width="333" height="43"').' alt="" />';
382
383 // Login box image:
384 $loginboxImage = $this->makeLoginBoxImage();
385
386 // Compile the page content:
387 $content='
388
389 <!--
390 Wrapper table for the login form:
391 -->
392 <table cellspacing="0" cellpadding="0" border="0" id="wrapper">
393 <tr>
394 <td class="c-wrappercell" align="center">
395
396 <!--
397 Login form image:
398 -->
399 <div id="loginimage">
400 '.$logo.'
401 </div>
402
403 <!--
404 Login form wrapper:
405 -->
406 <table cellspacing="0" cellpadding="0" border="0" id="loginwrapper">
407 <tr>
408 <td>'.$loginboxImage.'</td>
409 <td>
410 '.$content.'
411 </td>
412 </tr>
413 </table>
414
415 <!--
416 Copy right notice:
417 -->
418 <div id="copyrightnotice">
419 '.$this->makeCopyrightNotice().'
420 </div>
421
422 '.$this->makeLoginNews().'
423 </td>
424 </tr>
425 </table>';
426
427 // Return content:
428 return $content;
429 }
430
431 /**
432 * Checking, if we should perform some sort of redirection OR closing of windows.
433 *
434 * @return void
435 */
436 function checkRedirect() {
437 global $BE_USER,$TBE_TEMPLATE;
438
439 // Do redirect:
440 // If a user is logged in AND a) if either the login is just done (commandLI) or b) a loginRefresh is done or c) the interface-selector is NOT enabled (If it is on the other hand, it should not just load an interface, because people has to choose then...)
441 if ($BE_USER->user['uid'] && ($this->commandLI || $this->loginRefresh || !$this->interfaceSelector)) {
442
443 // If no cookie has been set previously we tell people that this is a problem. This assumes that a cookie-setting script (like this one) has been hit at least once prior to this instance.
444 if (!$_COOKIE[$BE_USER->name]) {
445 if ($this->commandLI=='setCookie') {
446 // we tried it a second time but still no cookie
447 // 26/4 2005: This does not work anymore, because the saving of challenge values in $_SESSION means the system will act as if the password was wrong.
448 t3lib_BEfunc::typo3PrintError ('Login-error',"Yeah, that's a classic. No cookies, no TYPO3.<br /><br />Please accept cookies from TYPO3 - otherwise you'll not be able to use the system.",0);
449 exit;
450 } else {
451 // try it once again - that might be needed for auto login
452 $this->redirectToURL = 'index.php?commandLI=setCookie';
453 }
454 }
455
456 if($redirectToURL = (string)$BE_USER->getTSConfigVal('auth.BE.redirectToURL')) {
457 $this->redirectToURL = $redirectToURL;
458 $this->GPinterface = '';
459 }
460
461 // Based on specific setting of interface we set the redirect script:
462 switch ($this->GPinterface) {
463 case 'backend':
464 $this->redirectToURL = 'alt_main.php';
465 break;
466 case 'frontend':
467 $this->redirectToURL = '../';
468 break;
469 }
470
471 // If there is a redirect URL AND if loginRefresh is not set...
472 if (!$this->loginRefresh) {
473 header('Location: '.t3lib_div::locationHeaderUrl($this->redirectToURL));
474 exit;
475 } else {
476 $TBE_TEMPLATE->JScode.=$TBE_TEMPLATE->wrapScriptTags('
477 if (parent.opener && parent.opener.busy) {
478 parent.opener.busy.loginRefreshed();
479 parent.close();
480 }
481 ');
482 }
483 } elseif(!$BE_USER->user['uid'] && $this->commandLI) {
484 sleep(5);
485 }
486 }
487
488 /**
489 * Making interface selector:
490 *
491 * @return void
492 */
493 function makeInterfaceSelectorBox() {
494 global $TYPO3_CONF_VARS;
495
496 // Reset variables:
497 $this->interfaceSelector = '';
498 $this->interfaceSelector_hidden='';
499 $this->interfaceSelector_jump = '';
500 #debug($this->redirect_url);
501 // If interfaces are defined AND no input redirect URL in GET vars:
502 if ($TYPO3_CONF_VARS['BE']['interfaces'] && !$this->redirect_url) {
503 $parts = t3lib_div::trimExplode(',',$TYPO3_CONF_VARS['BE']['interfaces']);
504 if (count($parts)>1) { // Only if more than one interface is defined will we show the selector:
505
506 // Initialize:
507 $tempLabels=explode(',',$this->L_vars[5]);
508 $labels=array();
509 $labels['backend']=$tempLabels[0];
510 $labels['frontend']=$tempLabels[1];
511
512 $jumpScript=array();
513 $jumpScript['backend']='alt_main.php';
514 $jumpScript['frontend']='../';
515
516 // Traverse the interface keys:
517 foreach($parts as $valueStr) {
518 $this->interfaceSelector.='
519 <option value="'.htmlspecialchars($valueStr).'">'.htmlspecialchars($labels[$valueStr]).'</option>';
520 $this->interfaceSelector_jump.='
521 <option value="'.htmlspecialchars($jumpScript[$valueStr]).'">'.htmlspecialchars($labels[$valueStr]).'</option>';
522 }
523 $this->interfaceSelector='
524 <select name="interface" class="c-interfaceselector">'.$this->interfaceSelector.'
525 </select>';
526 $this->interfaceSelector_jump='
527 <select name="interface" class="c-interfaceselector" onchange="document.location=this.options[this.selectedIndex].value;">'.$this->interfaceSelector_jump.'
528 </select>';
529
530 } else { // If there is only ONE interface value set:
531
532 $this->interfaceSelector_hidden='<input type="hidden" name="interface" value="'.trim($TYPO3_CONF_VARS['BE']['interfaces']).'" />';
533 }
534 }
535 }
536
537 /**
538 * COPYRIGHT notice
539 *
540 * Warning:
541 * DO NOT prevent this notice from being shown in ANY WAY.
542 * According to the GPL license an interactive application must show such a notice on start-up ('If the program is interactive, make it output a short notice... ' - see GPL.txt)
543 * Therefore preventing this notice from being properly shown is a violation of the license, regardless of whether you remove it or use a stylesheet to obstruct the display.
544 *
545 * @return string Text/Image (HTML) for copyright notice.
546 */
547 function makeCopyrightNotice() {
548
549 // Get values from TYPO3_CONF_VARS:
550 $loginCopyrightWarrantyProvider = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyProvider']));
551 $loginCopyrightWarrantyURL = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyURL']));
552
553 // Make warranty note:
554 if (strlen($loginCopyrightWarrantyProvider)>=2 && strlen($loginCopyrightWarrantyURL)>=10) {
555 $warrantyNote='Warranty is supplied by '.htmlspecialchars($loginCopyrightWarrantyProvider).'; <a href="'.htmlspecialchars($loginCopyrightWarrantyURL).'" target="_blank">click for details.</a>';
556 } else {
557 $warrantyNote='TYPO3 comes with ABSOLUTELY NO WARRANTY; <a href="http://typo3.com/1316.0.html" target="_blank">click for details.</a>';
558 }
559
560 // Compile full copyright notice:
561 $copyrightNotice = '<a href="http://typo3.com/" target="_blank">'.
562 '<img src="gfx/loginlogo_transp.gif" width="75" height="19" alt="TYPO3 logo" align="left" />'.
563 'TYPO3 CMS'.($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightShowVersion']?' ver. '.htmlspecialchars($GLOBALS['TYPO_VERSION']):'').
564 '</a>. '.
565 'Copyright &copy; 1998-2005 Kasper Sk&#229;rh&#248;j. Extensions are copyright of their respective owners. '.
566 'Go to <a href="http://typo3.com/" target="_blank">http://typo3.com/</a> for details. '.
567 $warrantyNote.' '.
568 '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>. '.
569 'Obstructing the appearance of this notice is prohibited by law.';
570
571 // Return notice:
572 return $copyrightNotice;
573 }
574
575 /**
576 * Returns the login box image, whether the default or an image from the rotation folder.
577 *
578 * @return string HTML image tag.
579 */
580 function makeLoginBoxImage() {
581 $loginboxImage = '';
582 if ($GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder']) { // Look for rotation image folder:
583 $absPath = t3lib_div::resolveBackPath(PATH_typo3.$GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder']);
584
585 // Get rotation folder:
586 $dir = t3lib_div::getFileAbsFileName($absPath);
587 if ($dir && @is_dir($dir)) {
588
589 // Get files for rotation into array:
590 $files = t3lib_div::getFilesInDir($dir,'png,jpg,gif');
591
592 // Pick random file:
593 srand((float) microtime() * 10000000);
594 $randImg = array_rand($files, 1);
595
596 // Get size of random file:
597 $imgSize = @getimagesize($dir.$files[$randImg]);
598
599 // Create image tag:
600 if (is_array($imgSize)) {
601 $loginboxImage = '<img src="'.htmlspecialchars($GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder'].$files[$randImg]).'" '.$imgSize[3].' id="loginbox-image" alt="" />';
602 }
603 }
604 } else { // If no rotation folder configured, print default image:
605 $loginImage = 'loginbox_image_dev.png';
606 $imagecopy = $loginImage=='loginbox_image_dev.png' ? 'You are running the CVS version of TYPO3 '.$GLOBALS['TYPO_VERSION'] : 'Photo: &copy; 2004-2005 Kasper Sk&#229;rh&#248;j'; // Directly outputted in image attributes...
607 $loginboxImage = '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/'.$loginImage,'width="200" height="133"').' id="loginbox-image" alt="'.$imagecopy.'" title="'.$imagecopy.'" />';
608 }
609
610 // Return image tag:
611 return $loginboxImage;
612 }
613
614 /**
615 * 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
616 *
617 * @return string HTML content
618 * @credits Idea by Jan-Hendrik Heuing
619 */
620 function makeLoginNews() {
621
622 // Reset output variable:
623 $newsContent= '';
624
625 // Traverse news array IF there are records in it:
626 if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
627 foreach($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem) {
628 $newsContent.='
629 <tr>
630 <td class="c-date">'.htmlspecialchars($newsItem['date']).'</td>
631 <td class="c-header">'.htmlspecialchars($newsItem['header']).'</td>
632 </tr>
633 <tr>
634 <td></td>
635 <td class="c-content">'.trim($newsItem['content']).'</td>
636 </tr>
637 <tr class="c-spacer">
638 <td colspan="2"></td>
639 </tr>
640 ';
641 }
642
643 // Wrap in a table:
644 $newsContent= '
645
646 <!--
647 Login screen news:
648 -->
649 <div id="loginNews">
650 <h2>'.htmlspecialchars($this->L_vars[8]).'</h2>
651 <table border="0" cellpadding="0" cellspacing="0">
652 '.$newsContent.'
653 </table>
654 </div>
655 ';
656 }
657
658 // Return content:
659 return $newsContent;
660 }
661 }
662
663 // Include extension?
664 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/index.php']) {
665 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/index.php']);
666 }
667
668
669
670
671
672
673
674
675
676
677 // Make instance:
678 $SOBE = t3lib_div::makeInstance('SC_index');
679 $SOBE->init();
680 $SOBE->main();
681 $SOBE->printContent();
682 ?>