aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/resources/private/relative.php
blob: d9156e60c634d1814cfec034b93727f971e26e87 (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
<?php

function getRelativeDetails($source) {
    global $__root;

    $GLOBALS["ORIGINAL_DOCUMENT_ROOT"] = $_SERVER['DOCUMENT_ROOT'];

    if (substr($_SERVER['REQUEST_URI'], 0, strlen($source) + 1) === "/" . $source) {
        $__root = "";
        $GLOBALS["SYSTEM_ROOT"] = "";
        $GLOBALS["SYSTEM_PREFIXED"] = false;
    } else {
        $_SERVER['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'] . "/" . explode("/", $_SERVER["PHP_SELF"])[1];
        $__root = "/" . explode("/", $_SERVER["PHP_SELF"])[1];
        $GLOBALS["SYSTEM_ROOT"] = "/" . explode("/", $_SERVER["PHP_SELF"])[1];
        $GLOBALS["SYSTEM_PREFIXED"] = true;
    }

    if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/oldRenderer") && $GLOBALS["SYSTEM_PREFIXED"]) {
        header("Content-Type: text/plain");
        echo("Error: Neutron Titanium does not support relative URLs! Please delete ./data/webcontent/oldRenderer and try again.");
        require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
    }

    if (isset($__electrode) && $__electrode) {
        $__root = "";
        $GLOBALS["SYSTEM_ROOT"] = "";
        $_SERVER['DOCUMENT_ROOT'] = $GLOBALS["ORIGINAL_DOCUMENT_ROOT"];
        $GLOBALS["SYSTEM_PREFIXED"] = false;
    }
}