Пример #1
0
include FOLDER_WEBAPP . "services" . DS . "service_minify.php";
// service SITEMAP
include FOLDER_WEBAPP . "services" . DS . "service_sitemap.php";
// service THUMBS
include FOLDER_WEBAPP . "services" . DS . "service_thumbs.php";
URL::route("/", function () {
    TPL::render("pages/page_home");
});
if (CONTENT::is_page()) {
    TPL::thing("head", "title", CONTENT::$current['content_title']);
    EVENTS::add_action("view_page_page_text", function () {
        TPL::assign("content", CONTENT::get());
        TPL::render("pages/page_text");
    });
    EVENTS::add_action("before_render", function () {
        EVENTS::do_action("view_page_" . CONTENT::get("content_type"));
    });
    URL::routed(true);
}
if (!URL::routed()) {
    $request = URL::get_request();
    if (substr($request, -1) == '/') {
        $request = substr($request, 0, -1);
    }
    $not_allowed = array("home", "text", "404", "maintenance");
    if (TPL::check_template("page_" . $request) && !in_array($request, $not_allowed)) {
        TPL::render("page_" . $request);
        URL::routed(true);
    }
}
//LOGS::export("html", true);
Пример #2
0
function show_404()
{
    // do programmed events
    EVENTS::do_action("on_error_404");
    // change header status
    header("HTTP/1.0 404 Not Found");
    // change title if isn't setted
    if (TPL::thing("head", "title") == '') {
        TPL::thing("head", "title", "Error 404 | Page not found");
    }
    // set render and draw
    if (TPL::check_template("page_404")) {
        TPL::render("page_404");
        TPL::draw(true);
    } else {
        echo "<h1>Error 404! Not found</h1>";
    }
}
Пример #3
0
}
// general assign
TPL::assign("admin_url", ADMIN_URL);
TPL::assign("base_url", BASE_URL);
// run plugins
foreach (DRAWLINE::plugins_list(true) as $plugin) {
    if (file_exists(FOLDER_PLUGINS . $plugin . DS . "index.php")) {
        include_once FOLDER_PLUGINS . $plugin . DS . "index.php";
        EVENTS::do_action("run_plugin_" . $plugin);
    } else {
        LOGS::write("Not found plugin " . $plugin . " on the server.");
    }
}
EVENTS::do_action("before_render");
// start render
if (OPTIONS::website("maintenance_mode") == '1' && !on_admin() && !PERMISSIONS::check("access_admin")) {
    if (TPL::check_template("page_maintenance")) {
        TPL::render("page_maintenance");
        TPL::draw(true);
    } else {
        echo '<h1>This website is in maintenance!</h1>';
    }
} elseif (TPL::render() != "") {
    TPL::draw(true);
} else {
    if (!URL::routed()) {
        show_404();
    }
}
EVENTS::do_action("after_render");
//print_array(LOGS::export("html"));