Subversion Repositories ALCASAR

Rev

Rev 2770 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2770 rexy 1
<?php
2
/**
3
 * start page for webaccess
4
 * redirect the user to the supported page type by the users webbrowser (js available or not)
5
 *
6
 * PHP version 5
7
 *
8
 * @category  PHP
9
 * @package   PSI
10
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
11
 * @copyright 2009 phpSysInfo
12
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
13
 * @version   SVN: $Id: index.php 687 2012-09-06 20:54:49Z namiltd $
14
 * @link      http://phpsysinfo.sourceforge.net
15
 */
16
/**
17
 * define the application root path on the webserver
18
 * @var string
19
 */
20
define('PSI_APP_ROOT', dirname(__FILE__));
324 richard 21
 
2770 rexy 22
if (version_compare("5.1.3", PHP_VERSION, ">")) {
23
    die("PHP 5.1.3 or greater is required!!!");
324 richard 24
}
2770 rexy 25
if (!extension_loaded("pcre")) {
26
    die("phpSysInfo requires the pcre extension to php in order to work properly.");
324 richard 27
}
28
 
2770 rexy 29
require_once PSI_APP_ROOT.'/includes/autoloader.inc.php';
324 richard 30
 
2770 rexy 31
// Load configuration
32
require_once PSI_APP_ROOT.'/read_config.php';
324 richard 33
 
2770 rexy 34
if (!defined('PSI_CONFIG_FILE') || !defined('PSI_DEBUG')) {
35
    $tpl = new Template("/templates/html/error_config.html");
36
    echo $tpl->fetch();
37
    die();
324 richard 38
}
39
 
2770 rexy 40
// redirect to page with and without javascript
41
$display = strtolower(isset($_GET['disp']) ? $_GET['disp'] : PSI_DEFAULT_DISPLAY_MODE);
42
switch ($display) {
43
case "static":
44
    $webpage = new WebpageXSLT();
45
    $webpage->run();
46
    break;
47
case "dynamic":
48
    $webpage = new Webpage();
49
    $webpage->run();
50
    break;
51
case "xml":
52
    $webpage = new WebpageXML("complete");
53
    $webpage->run();
54
    break;
55
case "json":
56
    $webpage = new WebpageXML("complete");
57
    $json = $webpage->getJsonString();
3037 rexy 58
    header('Cache-Control: no-cache, must-revalidate');
59
    header('Content-Type: application/json');
2770 rexy 60
    echo $json;
61
    break;
62
case "bootstrap":
63
/*
64
    $tpl = new Template("/templates/html/index_bootstrap.html");
65
    echo $tpl->fetch();
66
*/
67
    $webpage = new Webpage("bootstrap");
68
    $webpage->run();
69
    break;
70
case "auto":
71
    $tpl = new Template("/templates/html/index_all.html");
72
    echo $tpl->fetch();
73
    break;
74
default:
75
    $defaultdisplay = strtolower(PSI_DEFAULT_DISPLAY_MODE);
76
    switch ($defaultdisplay) {
77
    case "static":
78
        $webpage = new WebpageXSLT();
79
        $webpage->run();
80
        break;
81
    case "dynamic":
82
        $webpage = new Webpage();
83
        $webpage->run();
84
        break;
85
    case "bootstrap":
86
        $webpage = new Webpage("bootstrap");
87
        $webpage->run();
88
        break;
89
    default:
90
        $tpl = new Template("/templates/html/index_all.html");
91
        echo $tpl->fetch();
324 richard 92
    }
93
}