* Merging all changes from TYPO3_4-0 branch back into HEAD
[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 function initFeUser() {
82 global $TYPO3_CONF_VARS;
83
84 // Include classes necessary for initializing frontend user:
85 // We will use tslib_fe to do that:
86 require_once(PATH_tslib.'class.tslib_fe.php');
87 require_once(PATH_t3lib.'class.t3lib_cs.php');
88 require_once(PATH_t3lib.'class.t3lib_userauth.php');
89 require_once(PATH_tslib.'class.tslib_feuserauth.php');
90
91 // Make new instance of TSFE object for initializing user:
92 $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
93 $TSFE = new $temp_TSFEclassName($TYPO3_CONF_VARS,0,0);
94 $TSFE->connectToDB();
95
96 // Initialize FE user:
97 $TSFE->initFEuser();
98
99 // Return FE user object:
100 return $TSFE->fe_user;
101 }
102
103 /**
104 * Connecting to database
105 *
106 * @return void
107 */
108 function connectDB() {
109 global $TYPO3_DB;
110
111 $TYPO3_DB->connectDB();
112 }
113 }
114 ?>