function system_init
Search API
7.x system.module | system_init() |
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 2917
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 (!isset($_SESSION ["fp_user_object"]->roles[1])) {
$_SESSION ["fp_user_object"]->roles[1] = "";
}
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.", array("@FlightPath" => variable_get("system_name", "FlightPath"))), "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);
}
// Since current_student_id is coming from the REQUEST, sanitize it.
$current_student_id = @$_REQUEST ['current_student_id'];
$current_student_id = str_replace("'", "", $current_student_id); // remove single quotes
$current_student_id = str_replace('"', "", $current_student_id); // remove back quotes
$current_student_id = str_replace(';', "", $current_student_id); // remove semicolons
// Add in our custom JS settings.
$settings = array(
"themeLocation" => fp_theme_location(),
"currentStudentId" => $current_student_id,
"basePath" => base_path(),
// Add in the popup window options....
"popupAdminWinOptions" => variable_get("popup_admin_win_options", "toolbar=no,status=2,scrollbars=yes,resizable=yes,width=600,height=400"), // used by admin groups, edit definitions, degrees, and popup contact form.
"popupAdviseWinOptions" => variable_get("popup_advise_win_options", "toolbar=no,status=2,scrollbars=yes,resizable=yes,width=460,height=375"), // the work-horse of most of the advising popups. course desc, subs, etc.
"popupPrintWinOptions" => variable_get("popup_print_win_options", "toolbar=no,status=2,scrollbars=yes,resizable=yes,width=750,height=600"), // any printable screen is displayed in this.
);
fp_add_js($settings, "setting");
fp_add_js(fp_get_module_path("system") . "/js/system.js");
}