f5e92c18cf7cc1a9715d360accc4a0df41dcec1f
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Authentication / FrontendUserAuthentication.php
1 <?php
2 namespace TYPO3\CMS\Frontend\Authentication;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 /**
31 * Extension class for Front End User Authentication.
32 *
33 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
34 * @author René Fritz <r.fritz@colorcube.de>
35 */
36 class FrontendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication {
37
38 // formfield with 0 or 1 // 1 = permanent login enabled // 0 = session is valid for a browser session only
39 /**
40 * @todo Define visibility
41 */
42 public $formfield_permanent = 'permalogin';
43
44 // Lifetime of session data in seconds.
45 protected $sessionDataLifetime = 86400;
46
47 /**
48 * @todo Define visibility
49 */
50 public $usergroup_column = 'usergroup';
51
52 /**
53 * @todo Define visibility
54 */
55 public $usergroup_table = 'fe_groups';
56
57 /**
58 * @todo Define visibility
59 */
60 public $groupData = array(
61 'title' => array(),
62 'uid' => array(),
63 'pid' => array()
64 );
65
66 // Used to accumulate the TSconfig data of the user
67 /**
68 * @todo Define visibility
69 */
70 public $TSdataArray = array();
71
72 /**
73 * @todo Define visibility
74 */
75 public $userTS = array();
76
77 /**
78 * @todo Define visibility
79 */
80 public $userTSUpdated = 0;
81
82 /**
83 * @todo Define visibility
84 */
85 public $showHiddenRecords = 0;
86
87 // Session and user data:
88 /*
89 There are two types of data that can be stored: UserData and Session-Data. Userdata is for the login-user, and session-data for anyone viewing the pages.
90 'Keys' are keys in the internal dataarray of the data. When you get or set a key in one of the data-spaces (user or session) you decide the type of the variable (not object though)
91 'Reserved' keys are:
92 - 'recs': Array: Used to 'register' records, eg in a shopping basket. Structure: [recs][tablename][record_uid]=number
93 - sys: Reserved for TypoScript standard code.
94 */
95 /**
96 * @todo Define visibility
97 */
98 public $sesData = array();
99
100 /**
101 * @todo Define visibility
102 */
103 public $sesData_change = 0;
104
105 /**
106 * @todo Define visibility
107 */
108 public $userData_change = 0;
109
110 protected $sessionDataTimestamp = NULL;
111
112 /**
113 * Default constructor.
114 */
115 public function __construct() {
116 // Disable cookie by default, will be activated if saveSessionData() is called,
117 // a user is logging-in or an existing session is found
118 $this->dontSetCookie = TRUE;
119
120 $this->session_table = 'fe_sessions';
121 $this->name = self::getCookieName();
122 $this->get_name = 'ftu';
123 $this->loginType = 'FE';
124 $this->user_table = 'fe_users';
125 $this->username_column = 'username';
126 $this->userident_column = 'password';
127 $this->userid_column = 'uid';
128 $this->lastLogin_column = 'lastlogin';
129 $this->enablecolumns = array(
130 'deleted' => 'deleted',
131 'disabled' => 'disable',
132 'starttime' => 'starttime',
133 'endtime' => 'endtime'
134 );
135 $this->formfield_uname = 'user';
136 $this->formfield_uident = 'pass';
137 $this->formfield_chalvalue = 'challenge';
138 $this->formfield_status = 'logintype';
139 $this->security_level = '';
140 $this->auth_timeout_field = 6000;
141 $this->sendNoCacheHeaders = FALSE;
142 $this->getFallBack = TRUE;
143 $this->getMethodEnabled = TRUE;
144 }
145
146 /**
147 * Returns the configured cookie name
148 *
149 * @return string
150 */
151 static public function getCookieName() {
152 $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['FE']['cookieName']);
153 if (empty($configuredCookieName)) {
154 $configuredCookieName = 'fe_typo_user';
155 }
156 return $configuredCookieName;
157 }
158
159 /**
160 * Starts a user session
161 *
162 * @return void
163 * @see \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::start()
164 * @todo Define visibility
165 */
166 public function start() {
167 if ((int)$this->auth_timeout_field > 0 && (int)$this->auth_timeout_field < $this->lifetime) {
168 // If server session timeout is non-zero but less than client session timeout: Copy this value instead.
169 $this->auth_timeout_field = $this->lifetime;
170 }
171 $this->sessionDataLifetime = (int)$GLOBALS['TYPO3_CONF_VARS']['FE']['sessionDataLifetime'];
172 if ($this->sessionDataLifetime <= 0) {
173 $this->sessionDataLifetime = 86400;
174 }
175 parent::start();
176 }
177
178 /**
179 * Returns a new session record for the current user for insertion into the DB.
180 *
181 * @return array User session record
182 * @todo Define visibility
183 */
184 public function getNewSessionRecord($tempuser) {
185 $insertFields = parent::getNewSessionRecord($tempuser);
186 $insertFields['ses_permanent'] = $this->is_permanent;
187 return $insertFields;
188 }
189
190 /**
191 * Determine whether a session cookie needs to be set (lifetime=0)
192 *
193 * @return boolean
194 * @internal
195 * @todo Define visibility
196 */
197 public function isSetSessionCookie() {
198 $retVal = ($this->newSessionID || $this->forceSetCookie) && ($this->lifetime == 0 || !$this->user['ses_permanent']);
199 return $retVal;
200 }
201
202 /**
203 * Determine whether a non-session cookie needs to be set (lifetime>0)
204 *
205 * @return boolean
206 * @internal
207 * @todo Define visibility
208 */
209 public function isRefreshTimeBasedCookie() {
210 return $this->lifetime > 0 && $this->user['ses_permanent'];
211 }
212
213 /**
214 * Returns an info array with Login/Logout data submitted by a form or params
215 *
216 * @return array
217 * @see \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::getLoginFormData()
218 * @todo Define visibility
219 */
220 public function getLoginFormData() {
221 $loginData = parent::getLoginFormData();
222 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 0 || $GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 1) {
223 if ($this->getMethodEnabled) {
224 $isPermanent = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP($this->formfield_permanent);
225 } else {
226 $isPermanent = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST($this->formfield_permanent);
227 }
228 if (strlen($isPermanent) != 1) {
229 $isPermanent = $GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'];
230 } elseif (!$isPermanent) {
231 // To make sure the user gets a session cookie and doesn't keep a possibly existing time based cookie,
232 // we need to force seeting the session cookie here
233 $this->forceSetCookie = TRUE;
234 }
235 $isPermanent = $isPermanent ? 1 : 0;
236 } elseif ($GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 2) {
237 $isPermanent = 1;
238 } else {
239 $isPermanent = 0;
240 }
241 $loginData['permanent'] = $isPermanent;
242 $this->is_permanent = $isPermanent;
243 return $loginData;
244 }
245
246 /**
247 * Creates a user session record and returns its values.
248 * However, as the FE user cookie is normally not set, this has to be done
249 * before the parent class is doing the rest.
250 *
251 * @param array $tempuser User data array
252 * @return array The session data for the newly created session.
253 */
254 public function createUserSession($tempuser) {
255 $this->setSessionCookie();
256 return parent::createUserSession($tempuser);
257 }
258
259 /**
260 * Will select all fe_groups records that the current fe_user is member of - and which groups are also allowed in the current domain.
261 * It also accumulates the TSconfig for the fe_user/fe_groups in ->TSdataArray
262 *
263 * @return integer Returns the number of usergroups for the frontend users (if the internal user record exists and the usergroup field contains a value)
264 * @todo Define visibility
265 */
266 public function fetchGroupData() {
267 $this->TSdataArray = array();
268 $this->userTS = array();
269 $this->userTSUpdated = 0;
270 $this->groupData = array(
271 'title' => array(),
272 'uid' => array(),
273 'pid' => array()
274 );
275 // Setting default configuration:
276 $this->TSdataArray[] = $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultUserTSconfig'];
277 // Get the info data for auth services
278 $authInfo = $this->getAuthInfoArray();
279 if ($this->writeDevLog) {
280 if (is_array($this->user)) {
281 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Get usergroups for user: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($this->user, array($this->userid_column, $this->username_column)), 'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
282 } else {
283 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Get usergroups for "anonymous" user', 'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
284 }
285 }
286 $groupDataArr = array();
287 // Use 'auth' service to find the groups for the user
288 $serviceChain = '';
289 $subType = 'getGroups' . $this->loginType;
290 while (is_object($serviceObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('auth', $subType, $serviceChain))) {
291 $serviceChain .= ',' . $serviceObj->getServiceKey();
292 $serviceObj->initAuth($subType, array(), $authInfo, $this);
293 $groupData = $serviceObj->getGroups($this->user, $groupDataArr);
294 if (is_array($groupData) && count($groupData)) {
295 // Keys in $groupData should be unique ids of the groups (like "uid") so this function will override groups.
296 $groupDataArr = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($groupDataArr, $groupData);
297 }
298 unset($serviceObj);
299 }
300 if ($this->writeDevLog && $serviceChain) {
301 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($subType . ' auth services called: ' . $serviceChain, 'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
302 }
303 if ($this->writeDevLog && !count($groupDataArr)) {
304 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('No usergroups found by services', 'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
305 }
306 if ($this->writeDevLog && count($groupDataArr)) {
307 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(count($groupDataArr) . ' usergroup records found by services', 'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
308 }
309 // Use 'auth' service to check the usergroups if they are really valid
310 foreach ($groupDataArr as $groupData) {
311 // By default a group is valid
312 $validGroup = TRUE;
313 $serviceChain = '';
314 $subType = 'authGroups' . $this->loginType;
315 while (is_object($serviceObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('auth', $subType, $serviceChain))) {
316 $serviceChain .= ',' . $serviceObj->getServiceKey();
317 $serviceObj->initAuth($subType, array(), $authInfo, $this);
318 if (!$serviceObj->authGroup($this->user, $groupData)) {
319 $validGroup = FALSE;
320 if ($this->writeDevLog) {
321 \TYPO3\CMS\Core\Utility\GeneralUtility::devLog($subType . ' auth service did not auth group: ' . \TYPO3\CMS\Core\Utility\GeneralUtility::arrayToLogString($groupData, 'uid,title'), 'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication', 2);
322 }
323 break;
324 }
325 unset($serviceObj);
326 }
327 unset($serviceObj);
328 if ($validGroup) {
329 $this->groupData['title'][$groupData['uid']] = $groupData['title'];
330 $this->groupData['uid'][$groupData['uid']] = $groupData['uid'];
331 $this->groupData['pid'][$groupData['uid']] = $groupData['pid'];
332 $this->groupData['TSconfig'][$groupData['uid']] = $groupData['TSconfig'];
333 }
334 }
335 if (count($this->groupData) && count($this->groupData['TSconfig'])) {
336 // TSconfig: collect it in the order it was collected
337 foreach ($this->groupData['TSconfig'] as $TSdata) {
338 $this->TSdataArray[] = $TSdata;
339 }
340 $this->TSdataArray[] = $this->user['TSconfig'];
341 // Sort information
342 ksort($this->groupData['title']);
343 ksort($this->groupData['uid']);
344 ksort($this->groupData['pid']);
345 }
346 return count($this->groupData['uid']) ?: 0;
347 }
348
349 /**
350 * Returns the parsed TSconfig for the fe_user
351 * First time this function is called it will parse the TSconfig and store it in $this->userTS. Subsequent requests will not re-parse the TSconfig but simply return what is already in $this->userTS
352 *
353 * @return array TSconfig array for the fe_user
354 * @todo Define visibility
355 */
356 public function getUserTSconf() {
357 if (!$this->userTSUpdated) {
358 // Parsing the user TS (or getting from cache)
359 $this->TSdataArray = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines_array($this->TSdataArray);
360 $userTS = implode(LF . '[GLOBAL]' . LF, $this->TSdataArray);
361 $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
362 $parseObj->parse($userTS);
363 $this->userTS = $parseObj->setup;
364 $this->userTSUpdated = 1;
365 }
366 return $this->userTS;
367 }
368
369 /*****************************************
370 *
371 * Session data management functions
372 *
373 ****************************************/
374 /**
375 * Fetches the session data for the user (from the fe_session_data table) based on the ->id of the current user-session.
376 * The session data is restored to $this->sesData
377 * 1/100 calls will also do a garbage collection.
378 *
379 * @return void
380 * @access private
381 * @see storeSessionData()
382 * @todo Define visibility
383 */
384 public function fetchSessionData() {
385 // Gets SesData if any AND if not already selected by session fixation check in ->isExistingSessionRecord()
386 if ($this->id && !count($this->sesData)) {
387 $statement = $GLOBALS['TYPO3_DB']->prepare_SELECTquery('*', 'fe_session_data', 'hash = :hash');
388 $statement->execute(array(':hash' => $this->id));
389 if (($sesDataRow = $statement->fetch()) !== FALSE) {
390 $this->sesData = unserialize($sesDataRow['content']);
391 $this->sessionDataTimestamp = $sesDataRow['tstamp'];
392 }
393 $statement->free();
394 }
395 }
396
397 /**
398 * Will write UC and session data.
399 * If the flag $this->userData_change has been set, the function ->writeUC is called (which will save persistent user session data)
400 * If the flag $this->sesData_change has been set, the fe_session_data table is updated with the content of $this->sesData
401 * If the $this->sessionDataTimestamp is NULL there was no session record yet, so we need to insert it into the database
402 *
403 * @return void
404 * @see fetchSessionData(), getKey(), setKey()
405 * @todo Define visibility
406 */
407 public function storeSessionData() {
408 // Saves UC and SesData if changed.
409 if ($this->userData_change) {
410 $this->writeUC('');
411 }
412 if ($this->sesData_change && $this->id) {
413 if (empty($this->sesData)) {
414 // Remove session-data
415 $this->removeSessionData();
416 // Remove cookie if not logged in as the session data is removed as well
417 if (empty($this->user['uid'])) {
418 $this->removeCookie($this->name);
419 }
420 } elseif ($this->sessionDataTimestamp === NULL) {
421 // Write new session-data
422 $insertFields = array(
423 'hash' => $this->id,
424 'content' => serialize($this->sesData),
425 'tstamp' => $GLOBALS['EXEC_TIME']
426 );
427 $this->sessionDataTimestamp = $GLOBALS['EXEC_TIME'];
428 $GLOBALS['TYPO3_DB']->exec_INSERTquery('fe_session_data', $insertFields);
429 // Now set the cookie (= fix the session)
430 $this->setSessionCookie();
431 } else {
432 // Update session data
433 $updateFields = array(
434 'content' => serialize($this->sesData),
435 'tstamp' => $GLOBALS['EXEC_TIME']
436 );
437 $this->sessionDataTimestamp = $GLOBALS['EXEC_TIME'];
438 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_session_data', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->id, 'fe_session_data'), $updateFields);
439 }
440 }
441 }
442
443 /**
444 * Removes data of the current session.
445 *
446 * @return void
447 */
448 public function removeSessionData() {
449 $GLOBALS['TYPO3_DB']->exec_DELETEquery('fe_session_data', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->id, 'fe_session_data'));
450 }
451
452 /**
453 * Log out current user!
454 * Removes the current session record, sets the internal ->user array to a blank string
455 * Thereby the current user (if any) is effectively logged out!
456 * Additionally the cookie is removed
457 *
458 * @return void
459 */
460 public function logoff() {
461 parent::logoff();
462 // Remove the cookie on log-off
463 $this->removeCookie($this->name);
464 }
465
466 /**
467 * Executes the garbage collection of session data and session.
468 * The lifetime of session data is defined by $TYPO3_CONF_VARS['FE']['sessionDataLifetime'].
469 *
470 * @return void
471 */
472 public function gc() {
473 $timeoutTimeStamp = (int)$GLOBALS['EXEC_TIME'] - $this->sessionDataLifetime;
474 $GLOBALS['TYPO3_DB']->exec_DELETEquery('fe_session_data', 'tstamp < ' . $timeoutTimeStamp);
475 parent::gc();
476 }
477
478 /**
479 * Returns session data for the fe_user; Either persistent data following the fe_users uid/profile (requires login) or current-session based (not available when browse is closed, but does not require login)
480 *
481 * @param string $type Session data type; Either "user" (persistent, bound to fe_users profile) or "ses" (temporary, bound to current session cookie)
482 * @param string $key Key from the data array to return; The session data (in either case) is an array ($this->uc / $this->sesData) and this value determines which key to return the value for.
483 * @return mixed Returns whatever value there was in the array for the key, $key
484 * @see setKey()
485 * @todo Define visibility
486 */
487 public function getKey($type, $key) {
488 if ($key) {
489 switch ($type) {
490 case 'user':
491 return $this->uc[$key];
492 break;
493 case 'ses':
494 return $this->sesData[$key];
495 break;
496 }
497 }
498 }
499
500 /**
501 * Saves session data, either persistent or bound to current session cookie. Please see getKey() for more details.
502 * When a value is set the flags $this->userData_change or $this->sesData_change will be set so that the final call to ->storeSessionData() will know if a change has occurred and needs to be saved to the database.
503 * Notice: The key "recs" is already used by the function record_registration() which stores table/uid=value pairs in that key. This is used for the shopping basket among other things.
504 * Notice: Simply calling this function will not save the data to the database! The actual saving is done in storeSessionData() which is called as some of the last things in index_ts.php. So if you exit before this point, nothing gets saved of course! And the solution is to call $GLOBALS['TSFE']->storeSessionData(); before you exit.
505 *
506 * @param string $type Session data type; Either "user" (persistent, bound to fe_users profile) or "ses" (temporary, bound to current session cookie)
507 * @param string $key Key from the data array to store incoming data in; The session data (in either case) is an array ($this->uc / $this->sesData) and this value determines in which key the $data value will be stored.
508 * @param mixed $data The data value to store in $key
509 * @return void
510 * @see setKey(), storeSessionData(), record_registration()
511 * @todo Define visibility
512 */
513 public function setKey($type, $key, $data) {
514 if ($key) {
515 switch ($type) {
516 case 'user':
517 if ($this->user['uid']) {
518 if ($data === NULL) {
519 unset($this->uc[$key]);
520 } else {
521 $this->uc[$key] = $data;
522 }
523 $this->userData_change = 1;
524 }
525 break;
526 case 'ses':
527 if ($data === NULL) {
528 unset($this->sesData[$key]);
529 } else {
530 $this->sesData[$key] = $data;
531 }
532 $this->sesData_change = 1;
533 break;
534 }
535 }
536 }
537
538 /**
539 * Returns the session data stored for $key.
540 * The data will last only for this login session since it is stored in the session table.
541 *
542 * @param string $key
543 * @return mixed
544 */
545 public function getSessionData($key) {
546 return $this->getKey('ses', $key);
547 }
548
549 /**
550 * Saves the tokens so that they can be used by a later incarnation of this class.
551 *
552 * @param string $key
553 * @param mixed $data
554 * @return void
555 */
556 public function setAndSaveSessionData($key, $data) {
557 $this->setKey('ses', $key, $data);
558 $this->storeSessionData();
559 }
560
561 /**
562 * Registration of records/"shopping basket" in session data
563 * This will take the input array, $recs, and merge into the current "recs" array found in the session data.
564 * If a change in the recs storage happens (which it probably does) the function setKey() is called in order to store the array again.
565 *
566 * @param array $recs The data array to merge into/override the current recs values. The $recs array is constructed as [table]][uid] = scalar-value (eg. string/integer).
567 * @param integer $maxSizeOfSessionData The maximum size of stored session data. If zero, no limit is applied and even confirmation of cookie session is discarded.
568 * @return void
569 * @todo Define visibility
570 */
571 public function record_registration($recs, $maxSizeOfSessionData = 0) {
572 // Storing value ONLY if there is a confirmed cookie set,
573 // otherwise a shellscript could easily be spamming the fe_sessions table
574 // with bogus content and thus bloat the database
575 if (!$maxSizeOfSessionData || $this->isCookieSet()) {
576 if ($recs['clear_all']) {
577 $this->setKey('ses', 'recs', array());
578 }
579 $change = 0;
580 $recs_array = $this->getKey('ses', 'recs');
581 foreach ($recs as $table => $data) {
582 if (is_array($data)) {
583 foreach ($data as $rec_id => $value) {
584 if ($value != $recs_array[$table][$rec_id]) {
585 $recs_array[$table][$rec_id] = $value;
586 $change = 1;
587 }
588 }
589 }
590 }
591 if ($change && (!$maxSizeOfSessionData || strlen(serialize($recs_array)) < $maxSizeOfSessionData)) {
592 $this->setKey('ses', 'recs', $recs_array);
593 }
594 }
595 }
596
597 /**
598 * Determine whether there's an according session record to a given session_id
599 * in the database. Don't care if session record is still valid or not.
600 *
601 * This calls the parent function but additionally tries to look up the session ID in the "fe_session_data" table.
602 *
603 * @param integer $id Claimed Session ID
604 * @return boolean Returns TRUE if a corresponding session was found in the database
605 * @todo Define visibility
606 */
607 public function isExistingSessionRecord($id) {
608 // Perform check in parent function
609 $count = parent::isExistingSessionRecord($id);
610 // Check if there are any fe_session_data records for the session ID the client claims to have
611 if ($count == FALSE) {
612 $statement = $GLOBALS['TYPO3_DB']->prepare_SELECTquery('content,tstamp', 'fe_session_data', 'hash = :hash');
613 $res = $statement->execute(array(':hash' => $id));
614 if ($res !== FALSE) {
615 if ($sesDataRow = $statement->fetch()) {
616 $count = TRUE;
617 $this->sesData = unserialize($sesDataRow['content']);
618 $this->sessionDataTimestamp = $sesDataRow['tstamp'];
619 }
620 $statement->free();
621 }
622 }
623 return $count;
624 }
625
626 }