Do some isset() checkings with $CFG->sessioncookie.
Previously when debug turned on, login was impossible due to some notices sent before writing http headers.
This commit is contained in:
+10
-3
@@ -500,8 +500,11 @@ function ismoving($courseid) {
|
||||
function set_moodle_cookie($thing) {
|
||||
/// Sets a moodle cookie with an encrypted string
|
||||
global $CFG;
|
||||
|
||||
$cookiename = 'MOODLEID_'.$CFG->sessioncookie;
|
||||
if (isset($CFG->sessioncookie)) {
|
||||
$cookiename = 'MOODLEID_'.$CFG->sessioncookie;
|
||||
} else {
|
||||
$cookiename = 'MOODLEID_';
|
||||
}
|
||||
|
||||
$days = 60;
|
||||
$seconds = 60*60*24*$days;
|
||||
@@ -515,7 +518,11 @@ function get_moodle_cookie() {
|
||||
/// Gets a moodle cookie with an encrypted string
|
||||
global $CFG;
|
||||
|
||||
$cookiename = 'MOODLEID_'.$CFG->sessioncookie;
|
||||
if (isset($CFG->sessioncookie)) {
|
||||
$cookiename = 'MOODLEID_'.$CFG->sessioncookie;
|
||||
} else {
|
||||
$cookiename = 'MOODLEID_';
|
||||
}
|
||||
|
||||
if (empty($_COOKIE[$cookiename])) {
|
||||
return "";
|
||||
|
||||
+5
-1
@@ -171,7 +171,11 @@
|
||||
class object {};
|
||||
|
||||
if (!isset($nomoodlecookie)) {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
if (isset($CFG->sessioncookie)) {
|
||||
session_name('MoodleSession'.$CFG->sessioncookie);
|
||||
} else {
|
||||
session_name('MoodleSession');
|
||||
}
|
||||
@session_start();
|
||||
if (! isset($_SESSION['SESSION'])) {
|
||||
$_SESSION['SESSION'] = new object;
|
||||
|
||||
Reference in New Issue
Block a user