Пример #1
0
if (version_compare("5.2", PHP_VERSION, ">")) {
    die("PHP 5.2 or greater is required!!!");
}
require_once APP_ROOT . '/includes/autoloader.inc.php';
// Load configuration
require_once APP_ROOT . '/config.php';
if (!defined('PSI_CONFIG_FILE') || !defined('PSI_DEBUG')) {
    $tpl = new Template("/templates/html/error_config.html");
    echo $tpl->fetch();
    die;
}
// redirect to page with and without javascript
$display = isset($_GET['disp']) ? $_GET['disp'] : strtolower(PSI_DEFAULT_DISPLAY_MODE);
switch ($display) {
    case "static":
        $webpage = new WebpageXSLT();
        $webpage->run();
        break;
    case "dynamic":
        $webpage = new Webpage();
        $webpage->run();
        break;
    case "xml":
        $webpage = new WebpageXML(true, null);
        $webpage->run();
        break;
    default:
        $tpl = new Template("/templates/html/index_all.html");
        echo $tpl->fetch();
        break;
}
Пример #2
0
define('PSI_INTERNAL_XML', true);
require_once APP_ROOT . '/includes/autoloader.inc.php';
// check what xml part should be generated
if (isset($_GET['plugin'])) {
    $plugin = basename(htmlspecialchars($_GET['plugin']));
    if ($plugin == "complete") {
        $output = new WebpageXML(true, null);
        if (isset($_GET['json'])) {
            $sxml = simplexml_load_string($output->getXMLString());
            echo json_encode($sxml);
        } else {
            $output->run();
        }
    } elseif ($plugin != "") {
        $output = new WebpageXML(false, $plugin);
        if (isset($_GET['json'])) {
            $sxml = simplexml_load_string($output->getXMLString());
            echo json_encode($sxml);
        } else {
            $output->run();
        }
    }
} else {
    $output = new WebpageXML(false, null);
    if (isset($_GET['json'])) {
        $sxml = simplexml_load_string($output->getXMLString());
        echo json_encode($sxml);
    } else {
        $output->run();
    }
}