Fixed bug #9302: Make functions in tslib_eidtools public static
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_eidtools.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2006 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 * Tools for scripts using the eID feature of index.php
29 * Included from index_ts.php
30 * Since scripts using the eID feature does not
31 * have a full FE environment initialized by default
32 * this class seeks to provide functions that can
33 * initialize parts of the FE environment as needed,
34 * eg. Frontend User session, Database connection etc.
35 *
36 * $Id$
37 *
38 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
39 */
40 /**
41 * [CLASS/FUNCTION INDEX of SCRIPT]
42 *
43 *
44 *
45 * 74: class tslib_eidtools
46 * 81: function initFeUser()
47 * 108: function connectDB()
48 *
49 * TOTAL FUNCTIONS: 2
50 * (This index is automatically created/updated by the extension "extdeveval")
51 *
52 */
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 /**
68 * Tools for scripts using the eID feature of index.php
69 *
70 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
71 * @package TYPO3
72 * @subpackage tslib
73 */
74 class tslib_eidtools {
75
76 /**
77 * Load and initialize Frontend User
78 *
79 * @return object Frontend User object (usually known as TSFE->fe_user)
80 */
81 public static function initFeUser() {
82 // Include classes necessary for initializing frontend user:
83 // We will use tslib_fe to do that:
84 require_once(PATH_tslib.'class.tslib_fe.php');
85 require_once(PATH_t3lib.'class.t3lib_cs.php');
86 require_once(PATH_t3lib.'class.t3lib_userauth.php');
87 require_once(PATH_tslib.'class.tslib_feuserauth.php');
88
89 // Make new instance of TSFE object for initializing user:
90 $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
91 $TSFE = new $temp_TSFEclassName($GLOBALS['TYPO3_CONF_VARS'],0,0);
92 $TSFE->connectToDB();
93
94 // Initialize FE user:
95 $TSFE->initFEuser();
96
97 // Return FE user object:
98 return $TSFE->fe_user;
99 }
100
101 /**
102 * Connecting to database
103 *
104 * @return void
105 */
106 public static function connectDB() {
107 /* @var $TYPO3_DB t3lib_db */
108 $GLOBALS['TYPO3_DB']->connectDB();
109 }
110 }
111
112 ?>