unset($phppos);
}
+// initialise ME's - this must be done BEFORE starting of session!
+initialise_fullme();
+
// init session prevention flag - this is defined on pages that do not want session
if (CLI_SCRIPT) {
// no sessions in CLI scripts possible
$SESSION = &$_SESSION['SESSION'];
$USER = &$_SESSION['USER'];
-// initialise ME's
-// This must presently come AFTER $USER has been set up.
-initialise_fullme();
-
// Late profiling, only happening if early one wasn't started
if (!empty($CFG->profilingenabled)) {
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
* setup.php.
*/
function initialise_fullme() {
- global $CFG, $FULLME, $ME, $SCRIPT, $FULLSCRIPT;
+ global $CFG, $FULLME, $ME, $SCRIPT, $FULLSCRIPT, $USER;
// Detect common config error.
if (substr($CFG->wwwroot, -1) == '/') {
if (!defined('NO_MOODLE_COOKIES')) {
define('NO_MOODLE_COOKIES', true);
}
+ if (!isset($USER->id)) {
+ // MDL-27899 workaround
+ $USER = new stdClass();
+ $USER->id = 0;
+ }
redirect($CFG->wwwroot, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 3);
}
}