Added feature #7526: Making loginNews look nicer
[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 * 120: function init()
43 * 159: function main()
44 * 268: function printContent()
45 *
46 * SECTION: Various functions
47 * 292: function makeLoginForm()
48 * 337: function makeLogoutForm()
49 * 379: function wrapLoginForm($content)
50 * 438: function checkRedirect()
51 * 495: function makeInterfaceSelectorBox()
52 * 549: function makeCopyrightNotice()
53 * 582: function makeLoginBoxImage()
54 * 622: 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 "backend.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
127 if(t3lib_div::getIndpEnv('TYPO3_SSL')) { // For security reasons this feature only works if SSL is used
128 $this->u = t3lib_div::_GP('u'); // preset username
129 $this->p = t3lib_div::_GP('p'); // preset password
130 }
131 $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
132 $this->loginRefresh = t3lib_div::_GP('loginRefresh'); // Login
133 $this->commandLI = t3lib_div::_GP('commandLI'); // Value of "Login" button. If set, the login button was pressed.
134
135 // sets the level of security from conf vars
136 if ($TYPO3_CONF_VARS['BE']['loginSecurityLevel']) {
137 $this->loginSecurityLevel = $TYPO3_CONF_VARS['BE']['loginSecurityLevel'];
138 }
139
140 // Getting login labels:
141 $this->L_vars = explode('|',$TYPO3_CONF_VARS['BE']['loginLabels']);
142
143 // Setting the redirect URL to "backend.php" if no alternative input is given:
144 $this->redirectToURL = $this->redirect_url ? $this->redirect_url : 'backend.php';
145
146 // Logout?
147 if ($this->L=='OUT' && is_object($BE_USER)) {
148 $BE_USER->logoff();
149 if ($this->redirect_url) header('Location: '.t3lib_div::locationHeaderUrl($this->redirect_url));
150 exit;
151 }
152 }
153
154 /**
155 * Main function - creating the login/logout form
156 *
157 * @return void
158 */
159 function main() {
160 global $TBE_TEMPLATE, $TYPO3_CONF_VARS, $BE_USER;
161
162 // Initialize template object:
163 $TBE_TEMPLATE->docType='xhtml_trans';
164
165 // Set JavaScript for creating a MD5 hash of the password:
166 $TBE_TEMPLATE->JScode.='
167 <script type="text/javascript" src="md5.js"></script>
168 '.$TBE_TEMPLATE->wrapScriptTags('
169 function doChallengeResponse(superchallenged) { //
170 password = document.loginform.p_field.value;
171 if (password) {
172 if (superchallenged) {
173 password = MD5(password); // this makes it superchallenged!!
174 }
175 str = document.loginform.username.value+":"+password+":"+document.loginform.challenge.value;
176 document.loginform.userident.value = MD5(str);
177 document.loginform.p_field.value = "";
178 return true;
179 }
180 }
181 ');
182
183
184 // Checking, if we should make a redirect.
185 // Might set JavaScript in the header to close window.
186 $this->checkRedirect();
187
188 // Initialize interface selectors:
189 $this->makeInterfaceSelectorBox();
190
191 // Replace an optional marker in the "Administration Login" label
192 $this->L_vars[6] = str_replace("###SITENAME###",$TYPO3_CONF_VARS['SYS']['sitename'],$this->L_vars[6]);
193
194 // Creating form based on whether there is a login or not:
195 if (!$BE_USER->user['uid']) {
196
197 if ($this->loginSecurityLevel == 'challenged') {
198 $TBE_TEMPLATE->form = '
199 <form action="index.php" method="post" name="loginform" onsubmit="doChallengeResponse(0);">
200 ';
201 } elseif ($this->loginSecurityLevel == 'normal') {
202 $TBE_TEMPLATE->form = '
203 <form action="index.php" method="post" name="loginform" onsubmit="document.loginform.userident.value=document.loginform.p_field.value;document.loginform.p_field.value=\'\';return true;">
204 ';
205 } else { // if ($this->loginSecurityLevel == 'superchallenged') {
206 $TBE_TEMPLATE->form = '
207 <form action="index.php" method="post" name="loginform" onsubmit="doChallengeResponse(1);">
208 ';
209 }
210
211 $TBE_TEMPLATE->form.= '
212 <input type="hidden" name="login_status" value="login" />
213 ';
214 $loginForm = $this->makeLoginForm();
215 } else {
216 $TBE_TEMPLATE->form = '
217 <form action="index.php" method="post" name="loginform">
218 <input type="hidden" name="login_status" value="logout" />
219 ';
220 $loginForm = $this->makeLogoutForm();
221 }
222
223
224 // Starting page:
225 $this->content.=$TBE_TEMPLATE->startPage('TYPO3 Login: '.$TYPO3_CONF_VARS['SYS']['sitename']);
226
227 // Add login form:
228 $this->content.=$this->wrapLoginForm($loginForm);
229
230 // Ending form:
231 $this->content.= '
232 <input type="hidden" name="userident" value="" />
233 <input type="hidden" name="challenge" value="'.($challenge = md5(uniqid('').getmypid())).'" />
234 <input type="hidden" name="redirect_url" value="'.htmlspecialchars($this->redirectToURL).'" />
235 <input type="hidden" name="loginRefresh" value="'.htmlspecialchars($this->loginRefresh).'" />
236 '.$this->interfaceSelector_hidden.'
237 ';
238
239 // Save challenge value in session data (thanks to Bernhard Kraft for providing code):
240 session_start();
241 $_SESSION['login_challenge'] = $challenge;
242
243 // This moves focus to the right input field:
244 $this->content.=$TBE_TEMPLATE->wrapScriptTags('
245
246 // 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:
247 if (parent.opener && parent.opener.TS && parent.opener.TS.username && document.loginform && document.loginform.username) {
248 document.loginform.username.value = parent.opener.TS.username;
249 }
250
251 // If for some reason there already is a username in the username for field, move focus to the password field:
252 if (document.loginform.username && document.loginform.username.value == "") {
253 document.loginform.username.focus();
254 } else if (document.loginform.p_field && document.loginform.p_field.type!="hidden") {
255 document.loginform.p_field.focus();
256 }
257 ');
258
259 // End page:
260 $this->content.=$TBE_TEMPLATE->endPage();
261 }
262
263 /**
264 * Outputting the accumulated content to screen
265 *
266 * @return void
267 */
268 function printContent() {
269
270 echo $this->content;
271 }
272
273
274
275
276
277
278
279
280 /*****************************
281 *
282 * Various functions
283 *
284 ******************************/
285
286 /**
287 * Creates the login form
288 * This is drawn when NO login exists.
289 *
290 * @return string HTML output
291 */
292 function makeLoginForm() {
293
294 // There must be no white-spaces outside of the tags (needed for buggy IE)
295 $content.= '<!--
296 Login form:
297 --><table cellspacing="0" cellpadding="0" border="0" id="logintable">
298 <tr>
299 <td colspan="2"><h2>'.htmlspecialchars($this->L_vars[6]).'</h2></td>
300 </tr>'.($this->commandLI ? '
301 <tr class="c-wrong">
302 <td colspan="2"><p class="c-wrong">'.htmlspecialchars($this->L_vars[9]).'</p></td>
303 </tr>' : '').'
304 <tr class="c-username">
305 <td><p class="c-username">'.htmlspecialchars($this->L_vars[0]).':</p></td>
306 <td><input type="text" name="username" value="'.htmlspecialchars($this->u).'" class="c-username" /></td>
307 </tr>
308 <tr class="c-password">
309 <td><p class="c-password">'.htmlspecialchars($this->L_vars[1]).':</p></td>
310 <td><input type="password" name="p_field" value="'.htmlspecialchars($this->p).'" class="c-password" /></td>
311 </tr>'.($this->interfaceSelector && !$this->loginRefresh ? '
312 <tr class="c-interfaceselector">
313 <td><p class="c-interfaceselector">'.htmlspecialchars($this->L_vars[2]).':</p></td>
314 <td>'.$this->interfaceSelector.'</td>
315 </tr>' : '' ).'
316 <tr class="c-submit">
317 <td></td>
318 <td><input type="submit" name="commandLI" value="'.htmlspecialchars($this->L_vars[3]).'" class="c-submit" /></td>
319 </tr>
320 <tr class="c-info">
321 <td colspan="2"><p class="c-info">'.htmlspecialchars($this->L_vars[7]).'</p></td>
322 </tr>
323 </table>';
324
325 // Return content:
326 return $content;
327 }
328
329 /**
330 * Creates the logout form
331 * This is drawn if a user login already exists.
332 *
333 * @return string HTML output
334 */
335 function makeLogoutForm() {
336 global $BE_USER;
337
338
339 $content.='
340
341 <!--
342 Login form:
343 -->
344 <table cellspacing="0" cellpadding="0" border="0" id="logintable">
345 <tr>
346 <td></td>
347 <td><h2>'.htmlspecialchars($this->L_vars[6]).'</h2></td>
348 </tr>
349 <tr class="c-username">
350 <td><p class="c-username">'.htmlspecialchars($this->L_vars[0]).':</p></td>
351 <td><p class="c-username-current">'.htmlspecialchars($BE_USER->user['username']).'</p></td>
352 </tr>'.($this->interfaceSelector_jump ? '
353 <tr class="c-interfaceselector">
354 <td><p class="c-interfaceselector">'.htmlspecialchars($this->L_vars[2]).':</p></td>
355 <td>'.$this->interfaceSelector_jump.'</td>
356 </tr>' : '' ).'
357 <tr class="c-submit">
358 <td><input type="hidden" name="p_field" value="" /></td>
359 <td><input type="submit" name="commandLO" value="'.htmlspecialchars($this->L_vars[4]).'" class="c-submit" /></td>
360 </tr>
361 <tr class="c-info">
362 <td></td>
363 <td><p class="c-info">'.htmlspecialchars($this->L_vars[7]).'</p></td>
364 </tr>
365 </table>';
366
367 // Return content:
368 return $content;
369 }
370
371 /**
372 * Wrapping the login form table in another set of tables etc:
373 *
374 * @param string HTML content for the login form
375 * @return string The HTML for the page.
376 */
377 function wrapLoginForm($content) {
378
379 // Logo:
380 $logo = $GLOBALS['TBE_STYLES']['logo_login'] ?
381 '<img src="'.htmlspecialchars($GLOBALS['BACK_PATH'].$GLOBALS['TBE_STYLES']['logo_login']).'" alt="" />' :
382 '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/typo3logo.gif','width="123" height="34"').' alt="" />';
383
384 // Login box image:
385 $loginboxImage = $this->makeLoginBoxImage();
386
387 // Compile the page content:
388 $content='
389
390 <!--
391 Wrapper table for the login form:
392 -->
393 <table cellspacing="0" cellpadding="0" border="0" id="wrapper">
394 <tr>
395 <td class="c-wrappercell" align="center">
396
397 <!--
398 Login form image:
399 -->
400 <div id="loginimage">
401 '.$logo.'
402 </div>
403
404 <!--
405 Login form wrapper:
406 -->
407 <table cellspacing="0" cellpadding="0" border="0" id="loginwrapper">
408 <tr>
409 <td'.($this->commandLI ? ' class="error"' : '').'>'.$loginboxImage.
410 $content.'
411 </td>
412 </tr>
413 </table>
414
415 '.$this->makeLoginNews().'
416 <!--
417 Copyright notice:
418 -->
419 <div id="copyrightnotice">
420 '.$this->makeCopyrightNotice().'
421 </div>
422
423
424 </td>
425 </tr>
426 </table>';
427
428 // Return content:
429 return $content;
430 }
431
432 /**
433 * Checking, if we should perform some sort of redirection OR closing of windows.
434 *
435 * @return void
436 */
437 function checkRedirect() {
438 global $BE_USER,$TBE_TEMPLATE;
439
440 // Do redirect:
441 // 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...)
442 if ($BE_USER->user['uid'] && ($this->commandLI || $this->loginRefresh || !$this->interfaceSelector)) {
443
444 // 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.
445 if (!$_COOKIE[$BE_USER->name]) {
446 if ($this->commandLI=='setCookie') {
447 // we tried it a second time but still no cookie
448 // 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.
449 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);
450 exit;
451 } else {
452 // try it once again - that might be needed for auto login
453 $this->redirectToURL = 'index.php?commandLI=setCookie';
454 }
455 }
456
457 if($redirectToURL = (string)$BE_USER->getTSConfigVal('auth.BE.redirectToURL')) {
458 $this->redirectToURL = $redirectToURL;
459 $this->GPinterface = '';
460 }
461
462 // store interface
463 $BE_USER->uc['interfaceSetup'] = $this->GPinterface;
464 $BE_USER->writeUC();
465
466 // Based on specific setting of interface we set the redirect script:
467 switch ($this->GPinterface) {
468 case 'backend':
469 $this->redirectToURL = 'backend.php';
470 break;
471 case 'backend_old':
472 $this->redirectToURL = 'alt_main.php';
473 break;
474 case 'frontend':
475 $this->redirectToURL = '../';
476 break;
477 }
478
479 // If there is a redirect URL AND if loginRefresh is not set...
480 if (!$this->loginRefresh) {
481 header('Location: '.t3lib_div::locationHeaderUrl($this->redirectToURL));
482 exit;
483 } else {
484 $TBE_TEMPLATE->JScode.=$TBE_TEMPLATE->wrapScriptTags('
485 if (parent.opener && parent.opener.busy) {
486 parent.opener.busy.loginRefreshed();
487 parent.close();
488 }
489 ');
490 }
491 } elseif(!$BE_USER->user['uid'] && $this->commandLI) {
492 sleep(5);
493 }
494 }
495
496 /**
497 * Making interface selector:
498 *
499 * @return void
500 */
501 function makeInterfaceSelectorBox() {
502 global $TYPO3_CONF_VARS;
503
504 // Reset variables:
505 $this->interfaceSelector = '';
506 $this->interfaceSelector_hidden='';
507 $this->interfaceSelector_jump = '';
508
509 // If interfaces are defined AND no input redirect URL in GET vars:
510 if ($TYPO3_CONF_VARS['BE']['interfaces'] && ($this->commandLI || !$this->redirect_url)) {
511 $parts = t3lib_div::trimExplode(',',$TYPO3_CONF_VARS['BE']['interfaces']);
512 if (count($parts)>1) { // Only if more than one interface is defined will we show the selector:
513
514 // Initialize:
515 $tempLabels=explode(',', $this->L_vars[5]);
516 $labels=array();
517
518 $labels['backend'] = $tempLabels[0];
519 $labels['backend_old'] = $tempLabels[2];
520 $labels['frontend'] = $tempLabels[1];
521
522 $jumpScript=array();
523 $jumpScript['backend'] = 'backend.php';
524 $jumpScript['backend_old'] = 'alt_main.php';
525 $jumpScript['frontend'] = '../';
526
527 // Traverse the interface keys:
528 foreach($parts as $valueStr) {
529 $this->interfaceSelector.='
530 <option value="'.htmlspecialchars($valueStr).'"'.(t3lib_div::_GP('interface')==htmlspecialchars($valueStr) ? ' selected="selected"' : '').'>'.htmlspecialchars($labels[$valueStr]).'</option>';
531 $this->interfaceSelector_jump.='
532 <option value="'.htmlspecialchars($jumpScript[$valueStr]).'">'.htmlspecialchars($labels[$valueStr]).'</option>';
533 }
534 $this->interfaceSelector='
535 <select name="interface" class="c-interfaceselector">'.$this->interfaceSelector.'
536 </select>';
537 $this->interfaceSelector_jump='
538 <select name="interface" class="c-interfaceselector" onchange="window.location.href=this.options[this.selectedIndex].value;">'.$this->interfaceSelector_jump.'
539 </select>';
540
541 } else { // If there is only ONE interface value set:
542
543 $this->interfaceSelector_hidden='<input type="hidden" name="interface" value="'.trim($TYPO3_CONF_VARS['BE']['interfaces']).'" />';
544 }
545 }
546 }
547
548 /**
549 * COPYRIGHT notice
550 *
551 * Warning:
552 * DO NOT prevent this notice from being shown in ANY WAY.
553 * 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)
554 * 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.
555 *
556 * @return string Text/Image (HTML) for copyright notice.
557 */
558 function makeCopyrightNotice() {
559
560 // Get values from TYPO3_CONF_VARS:
561 $loginCopyrightWarrantyProvider = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyProvider']));
562 $loginCopyrightWarrantyURL = strip_tags(trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightWarrantyURL']));
563
564 // Make warranty note:
565 if (strlen($loginCopyrightWarrantyProvider)>=2 && strlen($loginCopyrightWarrantyURL)>=10) {
566 $warrantyNote='Warranty is supplied by '.htmlspecialchars($loginCopyrightWarrantyProvider).'; <a href="'.htmlspecialchars($loginCopyrightWarrantyURL).'" target="_blank">click for details.</a>';
567 } else {
568 $warrantyNote='TYPO3 comes with ABSOLUTELY NO WARRANTY; <a href="http://typo3.com/1316.0.html" target="_blank">click for details.</a>';
569 }
570
571 // Compile full copyright notice:
572 $copyrightNotice = '<a href="http://typo3.com/" target="_blank">'.
573 '<img src="gfx/loginlogo_transp.gif" width="75" height="19" alt="TYPO3 logo" align="left" />'.
574 'TYPO3 CMS'.($GLOBALS['TYPO3_CONF_VARS']['SYS']['loginCopyrightShowVersion']?' ver. '.htmlspecialchars($GLOBALS['TYPO_VERSION']):'').
575 '</a>. '.
576 'Copyright &copy; '.TYPO3_copyright_year.' Kasper Sk&#229;rh&#248;j. Extensions are copyright of their respective owners. '.
577 'Go to <a href="http://typo3.com/" target="_blank">http://typo3.com/</a> for details. '.
578 $warrantyNote.' '.
579 '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>. '.
580 'Obstructing the appearance of this notice is prohibited by law.';
581
582 // Return notice:
583 return $copyrightNotice;
584 }
585
586 /**
587 * Returns the login box image, whether the default or an image from the rotation folder.
588 *
589 * @return string HTML image tag.
590 */
591 function makeLoginBoxImage() {
592 $loginboxImage = '';
593 if ($GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder']) { // Look for rotation image folder:
594 $absPath = t3lib_div::resolveBackPath(PATH_typo3.$GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder']);
595
596 // Get rotation folder:
597 $dir = t3lib_div::getFileAbsFileName($absPath);
598 if ($dir && @is_dir($dir)) {
599
600 // Get files for rotation into array:
601 $files = t3lib_div::getFilesInDir($dir,'png,jpg,gif');
602
603 // Pick random file:
604 srand((float) microtime() * 10000000);
605 $randImg = array_rand($files, 1);
606
607 // Get size of random file:
608 $imgSize = @getimagesize($dir.$files[$randImg]);
609
610 $imgAuthor = is_array($GLOBALS['TBE_STYLES']['loginBoxImage_author'])&&$GLOBALS['TBE_STYLES']['loginBoxImage_author'][$files[$randImg]] ? htmlspecialchars($GLOBALS['TBE_STYLES']['loginBoxImage_author'][$files[$randImg]]) : '';
611
612 // Create image tag:
613 if (is_array($imgSize)) {
614 $loginboxImage = '<img src="'.htmlspecialchars($GLOBALS['TBE_STYLES']['loginBoxImage_rotationFolder'].$files[$randImg]).'" '.$imgSize[3].' id="loginbox-image" alt="'.$imgAuthor.'" title="'.$imgAuthor.'" />';
615 }
616 }
617 } else { // If no rotation folder configured, print default image:
618
619 if (strstr(TYPO3_version,'-dev')) { // development version
620 $loginImage = 'loginbox_image_dev.png';
621 $imagecopy = 'You are running a development version of TYPO3 '.TYPO3_branch;
622 } else {
623 $loginImage = 'loginbox_image.jpg';
624 $imagecopy = 'Photo by Ture Andersen (www.tureandersen.dk)';
625 }
626 $loginboxImage = '<img'.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'],'gfx/'.$loginImage,'width="200" height="133"').' id="loginbox-image" alt="'.$imagecopy.'" title="'.$imagecopy.'" />';
627 }
628
629 // Return image tag:
630 return $loginboxImage;
631 }
632
633 /**
634 * 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
635 *
636 * @return string HTML content
637 * @credits Idea by Jan-Hendrik Heuing
638 */
639 function makeLoginNews() {
640
641 // Reset output variable:
642 $newsContent= '';
643
644 // Traverse news array IF there are records in it:
645 if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
646 foreach($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem) {
647 $newsContent .= '<dt>'.htmlspecialchars($newsItem['header']).' <span>'.htmlspecialchars($newsItem['date']).'</span></dt>';
648 $newsContent .= '<dd>'.trim($newsItem['content']).'</dd>';
649 }
650
651 $title = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle']) : htmlspecialchars($this->L_vars[8]);
652 // Wrap
653 $newsContent = '
654
655 <!--
656 Login screen news:
657 -->
658 <h2 id="loginNewsTitle">'.$title.'</h2>
659 <dl id="loginNews">
660 '.$newsContent.'
661 </dl>
662 ';
663 }
664
665 // Return content:
666 return $newsContent;
667 }
668 }
669
670 // Include extension?
671 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/index.php']) {
672 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/index.php']);
673 }
674
675
676
677
678
679
680
681
682
683
684 // Make instance:
685 $SOBE = t3lib_div::makeInstance('SC_index');
686 $SOBE->init();
687 $SOBE->main();
688 $SOBE->printContent();
689 ?>