aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/api/engine-cyclic/wrapper.php
blob: 196060d80f8366df45149c5cd3bea1ad7529da2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

function render(string $page) {
    global $MPCMSRendererPageNameValue;

    if ($page == "index") {
        $MPCMSRendererPageNameValue = "index";
        rlgps("Processing website homepage");
        if (!cacheCheck("index")) {
            require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/homepage.php";

            $content = ob_get_contents();
            file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-index", $content);
            require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump();
        } else {
            rlgps("Received page from cache");
        }
    } else {
        $MPCMSRendererPageNameValue = $page;
        rlgps("Processing /{$page}");
        if (!cacheCheck($page)) {
            require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/pages.php";

            $content = ob_get_contents();
            file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/cache/page-" . $page, $content);
            require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump();
        } else {
            rlgps("Received page from cache");
        }
    }
}

function renderSpecial(string $markup, string $displayName = "Page") {
    global $MPCMSRendererPageMarkup;
    global $MPCMSRendererPageMarkupDN;

    $MPCMSRendererPageMarkup = $markup;
    $MPCMSRendererPageMarkupDN = $displayName;
    rlgps("Processing special page");
    require_once $_SERVER['DOCUMENT_ROOT'] . "/api/engine-cyclic/special.php";
    require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/debug.php";debugDump();
}