MDL-11927 setting proper cookie path - backported from MOODLE_19_STABLE
This commit is contained in:
+6
-2
@@ -376,10 +376,13 @@ global $HTTPSPAGEREQUIRED;
|
||||
require_once($CFG->libdir. '/adodb/session/adodb-session2.php');
|
||||
}
|
||||
}
|
||||
/// Set sessioncookie variable if it isn't already
|
||||
/// Set sessioncookie and sessioncookiepath variable if it isn't already
|
||||
if (!isset($CFG->sessioncookie)) {
|
||||
$CFG->sessioncookie = '';
|
||||
}
|
||||
if (!isset($CFG->sessioncookiepath)) {
|
||||
$CFG->sessioncookiepath = '/';
|
||||
}
|
||||
|
||||
/// Configure ampersands in URLs
|
||||
|
||||
@@ -489,6 +492,7 @@ global $HTTPSPAGEREQUIRED;
|
||||
|
||||
if (empty($nomoodlecookie)) {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
session_set_cookie_params(0, $CFG->sessioncookiepath);
|
||||
@session_start();
|
||||
if (! isset($_SESSION['SESSION'])) {
|
||||
$_SESSION['SESSION'] = new object;
|
||||
@@ -496,7 +500,7 @@ global $HTTPSPAGEREQUIRED;
|
||||
if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) {
|
||||
$_SESSION['SESSION']->has_timed_out = true;
|
||||
}
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/');
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, $CFG->sessioncookiepath);
|
||||
$_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test;
|
||||
}
|
||||
if (! isset($_SESSION['USER'])) {
|
||||
|
||||
Reference in New Issue
Block a user