Beispiel #1
0
function menu()
{
    $site_path_array = explode("/", LINK_FILE);
    if (Session::is_developer()) {
        $menu = array(array("url" => LINK_ABS . $site_path_array[0] . "/index.php", "text" => "System Status", "icon" => "home"), array("url" => LINK_ABS . $site_path_array[0] . "/fault.php", "text" => "My Fault Reports", "icon" => "list"), array("url" => LINK_ABS . $site_path_array[0] . "/assigned.php", "text" => "My Assigned Faults", "icon" => "inbox"), array("url" => LINK_ABS . $site_path_array[0] . "/report", "text" => "Report a Fault", "icon" => "flash"), array("url" => LINK_ABS . $site_path_array[0] . "/manage", "text" => "View Faults", "icon" => "list-alt"));
        $faults = Faults::get_open_faults();
        if ($faults > 0) {
            $menu[4]["badge"] = $faults;
        }
        $faults = Faults::get_open_faults_user(Session::get_id());
        if ($faults > 0) {
            $menu[2]["badge"] = $faults;
        }
    } else {
        $menu = array(array("url" => LINK_ABS . $site_path_array[0] . "/index.php", "text" => "System Status", "icon" => "home"), array("url" => LINK_ABS . $site_path_array[0] . "/fault.php", "text" => "My Fault Reports", "icon" => "list"), array("url" => LINK_ABS . $site_path_array[0] . "/report", "text" => "Report a Fault", "icon" => "flash"));
    }
    foreach ($menu as &$item) {
        if ($site_path_array[1] == array_pop(explode("/", $item["url"]))) {
            $item["active"] = true;
        }
    }
    return Bootstrap::list_group($menu);
}
Beispiel #2
0
        header(':', true, $code);
    }
}
if (!Session::is_user() && (substr(LINK_FILE, 0, 4) == "ajax" && LINK_FILE != "ajax/login.php")) {
    http_response_code(403);
    exit(json_encode(array("error" => "Your session has timed out, or you have logged out in another tab. Please log in again.")));
}
if (substr(LINK_FILE, 0, 6) == "studio") {
    MainTemplate::set_barebones(true);
    if (isset($_REQUEST["key"])) {
        if (is_null(Locations::get_by_key($_REQUEST["key"]))) {
            exit("Sorry, you provided an invalid security key.");
        }
    } else {
        Output::require_user();
    }
}
if (LINK_FILE != "index.php" && LINK_FILE != "ajax/login.php" && substr(LINK_FILE, 0, 6) != "studio" && substr(LINK_FILE, 0, 5) != "audio") {
    Output::require_user();
}
if (Session::is_developer()) {
    ini_set("display_errors", "1");
    ini_set("display_startup_errors", "1");
    ini_set("html_errors", "1");
    ini_set("docref_root", "http://www.php.net/");
    ini_set("error_prepend_string", "<div class=\"alert alert-error\">");
    ini_set("error_append_string", "</div>");
}
if (substr(LINK_FILE, 0, 4) != "ajax") {
    Output::set_template("MainTemplate");
}
Beispiel #3
0
 public static function require_developer()
 {
     self::require_user();
     if (!Session::is_developer()) {
         self::http_error(401);
     }
 }
Beispiel #4
0
 public function __toString()
 {
     return Bootstrap::alert_message_basic("danger", (Session::is_developer() ? "Error on line " . $this->line . " in file " . $this->file . ":\n" : "Error: Please contact a developer!\n ") . $this->string, $this->error_type() . ":");
 }