Esempio n. 1
0
    action();
} catch (Exception $e) {
    $_SESSION["state"] = "error";
    message_set_error($e->getMessage());
    debug(sprint_r($e->getTrace()));
}
if (!in_array($_SESSION["state"], $g_states)) {
    message_set_error("Undeclared state: " . $_SESSION["state"] . ".");
    $_SESSION["state"] = "error";
}
debug("SESSION['state']=" . $_SESSION["state"]);
debug("g_page=" . $g_page);
if ($_SESSION["state"] == "not_allowed") {
    $g_page = "error";
}
if (!is_null_or_empty($g_page)) {
    $g_state = $g_page;
    $g_page = SKIN_DIR . "/" . $g_page . ".php";
} else {
    $g_state = $_SESSION["state"];
    $g_page = SKIN_DIR . "/" . $_SESSION["state"] . ".php";
}
if (!file_exists($g_page)) {
    $g_page = SKIN_DIR . "/error.php";
    message_set_error(_t("Page not existing."));
}
debug("Session after: " . $_SESSION["state"]);
//message_set_info("This is an info message.");
//message_set_error("This is an error message.");
message_process();
layout_i18n(SKIN_DIR . "/layout.php");
Esempio n. 2
0
 public static function create()
 {
     debug(sprint_r($_GET));
     try {
         $record = Record::new_instance($_GET["type"]);
         $record->check_form();
         $record->id = create_id();
         $record->hydrate_from_form();
         $record->store();
         message_set_info(_t("Record successfully created."));
     } catch (Exception $e) {
         message_set_error($e->getMessage());
     }
 }