Commit 13188b75 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Bug4965: insert path to QFQ cookie/session, to make multiple installation...

Bug4965: insert path to QFQ cookie/session, to make multiple installation possible. Only T3 index.php and QFQ API calls are supported to access the QFQ cookie/session.
parent cb3f2918
......@@ -109,7 +109,6 @@ const ERROR_SIP_INVALID = 1006;
const ERROR_MISSING_RECORD_ID = 1007;
const ERROR_IN_SQL_STATEMENT = 1008;
const ERROR_MISSING_REQUIRED_PARAMETER = 1009;
const ERROR_MISSING_SESSIONNAME = 1010;
const ERROR_BROKEN_PARAMETER = 1011;
const ERROR_FE_USER_UID_CHANGED = 1012;
const ERROR_SIP_NOT_FOUND = 1013;
......@@ -143,7 +142,6 @@ const ERROR_LOG_NOT_WRITABLE = 1045;
const ERROR_UNNOWN_STORE = 1046;
const ERROR_GET_STORE_ZERO = 1047;
const ERROR_SET_STORE_ZERO = 1048;
const ERROR_QFQ_SESSION_MISSING = 1049;
const ERROR_INVALID_OR_MISSING_PARAMETER = 1050;
const ERROR_UNKNOWN_SQL_LOG_MODE = 1051;
const ERROR_FORM_NOT_FOUND = 1052;
......@@ -265,6 +263,10 @@ const ERROR_DIRTY_RECORD_MODIFIED = 2205;
// Language
const ERROR_LANGUAGE_NOT_CONFIGURED_IN_QFQ = 2300;
// Session
const ERROR_MISSING_SESSIONNAME = 2400;
const ERROR_QFQ_SESSION_MISSING = 2401;
const ERROR_SESSION_BROKEN_SCRIPT_PATH = 2402;
//
// Store Names: Identifier
......
......@@ -33,8 +33,13 @@ class Session {
} else {
ini_set('session.cookie_httponly', 1);
$path = $this->getSitePath();
session_set_cookie_params(0, $path);
session_name(SESSION_NAME);
session_start();
self::$sessionId = session_id();
}
......@@ -44,6 +49,38 @@ class Session {
}
/**
* Extract the SitePath of the current T3 installation.
*
* return: <path> with a trailing '/'
*/
private static function getSitePath() {
if (empty($_SERVER['SCRIPT_NAME'])) {
throw new CodeException('Missing _SERVER[SCRIPT_NAME]', ERROR_SESSION_BROKEN_SCRIPT_PATH);
}
$path = $_SERVER['SCRIPT_NAME'];
$pos = strrpos($path, '/');
if ($pos === false) {
throw new CodeException("Broken _SERVER[SCRIPT_NAME]: $path", ERROR_SESSION_BROKEN_SCRIPT_PATH);
}
// Remove PHP script
$path = substr($path, 0, $pos + 1);
// QFQ might be called by API - justify to the SitePath
$pos = strpos($path, 'typo3conf/ext/qfq/api');
if ($pos !== false) {
$path = substr($path, 0, $pos);
}
if (empty($path)) {
throw new CodeException("Broken _SERVER[SCRIPT_NAME]: $path", ERROR_SESSION_BROKEN_SCRIPT_PATH);
}
return $path;
}
/**
* Free a lock on the current session
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment