Exemplo n.º 1
0
// Searching controllers in Modules directory.
// Directory Scan function - script will include all .php files in the modules
// directory.
if (!is_dir(MODULE_PATH)) {
    die(_("ERROR: Modules directory not found!"));
}
$CurDir = dir(MODULE_PATH);
while (false !== ($entry = $CurDir->read())) {
    if ($entry != "." && $entry != "..") {
        if (substr($entry, strrpos($entry, '.')) == ".php") {
            require_once $CurDir->path . "/" . $entry;
        }
    }
}
try {
    // Validate and set the template of the site.
    gui::set_template_name(config::get("template_name", "gui"));
    // Looking for extra functions file in the template directory.
    if (is_file(TEMPLATE_PATH . config::get("template_name", "gui") . "/functions.php")) {
        include_once TEMPLATE_PATH . config::get("template_name", "gui") . "/functions.php";
    }
    // Find Controller name run it.
    gui::add_body(controller::set(uriparser::current()));
    // Validate and set the template filename with language settings.
    gui::set_template_file(config::get("controller"), config::get("lang"));
} catch (Exception $exc) {
    gui::add_body(gui::render_404($exc->getMessage()));
    //die(gui::render_404 ( _("Error. Page not found.")));
}
// Connecting of previosly finded template file.
include_once TEMPLATE_PATH . config::get("template_name", "gui") . "/" . config::get("template_file", "gui") . ".php";