70 $this->typo3tempPath = PATH_site .
'typo3temp/';
74 session_set_save_handler(array($this,
'open'), array($this,
'close'), array($this,
'read'), array($this,
'write'), array($this,
'destroy'), array($this,
'gc'));
75 session_save_path($sessionSavePath);
76 session_name($this->cookieName);
79 ini_set(
'session.gc_probability', 100);
80 ini_set(
'session.gc_divisor', 100);
81 ini_set(
'session.gc_maxlifetime', $this->expireTimeInMinutes * 2 * 60);
82 if (\
TYPO3\CMS\Core\Utility\PhpOptionsUtility::isSessionAutoStartEnabled()) {
83 $sessionCreationError =
'Error: session.auto-start is enabled.<br />';
84 $sessionCreationError .=
'The PHP option session.auto-start is enabled. Disable this option in php.ini or .htaccess:<br />';
85 $sessionCreationError .=
'<pre>php_value session.auto_start Off</pre>';
86 throw new \TYPO3\CMS\Install\Exception($sessionCreationError, 1294587485);
87 } elseif (defined(
'SID')) {
88 $sessionCreationError =
'Session already started by session_start().<br />';
89 $sessionCreationError .=
'Make sure no installed extension is starting a session in its ext_localconf.php or ext_tables.php.';
90 throw new \TYPO3\CMS\Install\Exception($sessionCreationError, 1294587486);
102 if (empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'])) {
103 throw new \TYPO3\CMS\Install\Exception(
104 'No encryption key set to secure session',
108 $sessionSavePath = sprintf(
109 $this->typo3tempPath . $this->sessionPath,
113 return $sessionSavePath;
124 if (!is_dir($sessionSavePath)) {
127 }
catch (\RuntimeException $exception) {
128 throw new \TYPO3\CMS\Install\Exception(
129 'Could not create session folder in typo3temp/. Make sure it is writeable!',
135 <IfModule !mod_authz_core.c> 142 <IfModule mod_authz_core.c> 147 $indexContent =
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">';
148 $indexContent .=
'<HTML><HEAD<TITLE></TITLE><META http-equiv=Refresh Content="0; Url=../../">';
149 $indexContent .=
'</HEAD></HTML>';
160 $_SESSION[
'active'] = TRUE;
177 $_SESSION[
'active'] = FALSE;
186 session_regenerate_id();
196 return ($_SESSION[
'active'] === TRUE);
217 if (empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'])) {
218 throw new \TYPO3\CMS\Install\Exception(
219 'No encryption key set to secure session',
226 return md5(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'] .
'|' . $sessionId);
238 $_SESSION[
'authorized'] = TRUE;
239 $_SESSION[
'lastSessionId'] = time();
240 $_SESSION[
'tstamp'] = time();
241 $_SESSION[
'expires'] = time() + $this->expireTimeInMinutes * 60;
252 if (!$_SESSION[
'authorized']) {
255 if ($_SESSION[
'expires'] < time()) {
270 if (!$_SESSION[
'authorized']) {
274 if ($_SESSION[
'expires'] < time()) {
289 $_SESSION[
'tstamp'] = time();
290 $_SESSION[
'expires'] = time() + $this->expireTimeInMinutes * 60;
291 if (time() > $_SESSION[
'lastSessionId'] + $this->regenerateSessionIdTime * 60) {
293 $_SESSION[
'lastSessionId'] = time();
305 if (!is_array($_SESSION[
'messages'])) {
306 $_SESSION[
'messages'] = array();
308 $_SESSION[
'messages'][] = $message;
318 if (is_array($_SESSION[
'messages'])) {
319 $messages = $_SESSION[
'messages'];
321 $_SESSION[
'messages'] = array();
349 public function open($savePath, $sessionName) {
370 $content = (string)(@file_get_contents($sessionFile));
374 $this->
write($id, $content);
386 public function write($id, $sessionData) {
391 'Session file not writable. Please check permission on typo3temp/InstallToolSessions and its subdirectories.',
406 return @unlink($sessionFile);
415 public function gc($maxLifeTime) {
417 $files = glob($sessionSavePath .
'/hash_*');
418 if (!is_array($files)) {
421 foreach ($files as $filename) {
422 if (filemtime($filename) + $this->expireTimeInMinutes * 60 < time()) {
443 session_write_close();
getSessionHash($sessionId='')
static mkdir_deep($directory, $deepDirectory='')
ensureSessionSavePathExists($sessionSavePath)
static writeFile($file, $content, $changePermissions=FALSE)
open($savePath, $sessionName)
static getIndpEnv($getEnvName)
static hmac($input, $additionalSecret='')
addMessage(\TYPO3\CMS\Install\Status\StatusInterface $message)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]