Subversion Repositories ALCASAR

Rev

Rev 2808 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2808 rexy 1
<?php
2
/**
3
 * generate the xml
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_XML
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: xml.php 614 2012-07-28 09:02:59Z jacky672 $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 
3037 rexy 16
header('Access-Control-Allow-Origin: *');
17
 
2808 rexy 18
 /**
19
 * application root path
20
 *
21
 * @var string
22
 */
23
define('PSI_APP_ROOT', dirname(__FILE__));
24
 
25
require_once PSI_APP_ROOT.'/includes/autoloader.inc.php';
26
 
27
if ((isset($_GET['json']) || isset($_GET['jsonp'])) && !extension_loaded("json")) {
28
    echo '<Error Message="The json extension to php required!" Function="ERROR"/>';
29
} else {
30
    // check what xml part should be generated
31
    if (isset($_GET['plugin'])) {
3037 rexy 32
        $output = new WebpageXML($_GET['plugin']);
2808 rexy 33
    } else {
34
        $output = new WebpageXML();
35
    }
3037 rexy 36
    // generate output in proper type
37
    if (isset($_GET['json']) || isset($_GET['jsonp'])) {
38
        header('Cache-Control: no-cache, must-revalidate');
39
        $json = $output->getJsonString();
40
        if (isset($_GET['jsonp'])) {
41
            header('Content-Type: application/javascript');
42
            echo(!preg_match('/[^\w\?]/', $_GET['callback'])?$_GET['callback']:'') . '('.$json.')';
2808 rexy 43
        } else {
3037 rexy 44
            header('Content-Type: application/json');
45
            echo $json;
2808 rexy 46
        }
3037 rexy 47
    } else {
48
        $output->run();
2808 rexy 49
    }
50
}