function system_init
Search API
6.x system.module | system_init() |
4.x system.module | system_init() |
5.x system.module | system_init() |
Called on every page load.
File
- modules/
system/ system.module, line 1796
Code
function system_init() {
// Let's see if the $user object (for the logged-in user) has been set up.
global $user;
$user = new stdClass();
if ($_SESSION ["fp_logged_in"] == TRUE) {
// Make sure it doesn't have the anonymous user role (rid == 1).
if ($_SESSION ["fp_user_object"]->roles[1] == "anonymous user") {
unset($_SESSION ["fp_user_object"]->roles[1]);
}
$user = $_SESSION ["fp_user_object"];
// To make sure we pick up the user's newest permissions, re-load
// the user here.
$user = fp_load_user($user->id);
}
else {
// User is anonymous, so set it up as such.
$user = fp_load_user(0);
}
// Are we in maintenance mode? If so, display a message.
if (variable_get("maintenance_mode", FALSE)) {
fp_add_message(t("FlightPath is currently undergoing routine maintenance.
During this time, some data may appear incomplete.
We apologize for the inconvenience and appreciate your patience."), "status", TRUE);
}
// Is there an urgent message to display?
$urgent_msg = variable_get("urgent_msg", "");
if ($urgent_msg) {
fp_add_message("<b>" . t("Important Message:") . "</b> " . $urgent_msg, "status", TRUE);
}
// Add in our custom JS settings.
fp_add_js(array("themeLocation" => fp_theme_location(), "currentStudentId" => $_REQUEST ["current_student_id"], "basePath" => base_path()), "setting");
fp_add_js(fp_get_module_path("system") . "/js/system.js");
}