if (strpos($_SERVER['HTTP_REFERER'], 'google') !== false) { $USER = guest_user(); } else { if (strpos($_SERVER['HTTP_REFERER'], 'altavista') !== false) { $USER = guest_user(); } } } } } /// Populates an empty $USER if is empty if (empty($USER) || !isset($USER->ident)) { $USER = guest_user(); } /// backwards compatibility fill_legacy_user_session($USER); ////// ////// Load some core libraries ////// require_once $CFG->dirroot . "lib/templates.php"; require_once $CFG->dirroot . "lib/displaylib.php"; ////// ////// Init templating basics ////// if (!isset($CFG->templatestore)) { $CFG->templatestore = 'db'; } if (!isset($CFG->templatesroot)) { $CFG->templatesroot = $CFG->dirroot . "mod/template/templates/"; } if (!isset($PAGE->menu)) {
/** * Fills user information */ function init_user_var($user) { global $CFG; $user->loggedin = true; $user->site = $CFG->wwwroot; // for added security, store the site in the session $user->sesskey = random_string(10); $user->sessionIP = md5(getremoteaddr()); // Store the current IP in the session // backwards compatibility (TODO this will have to go eventually) fill_legacy_user_session($user); return $user; }