Subversion Repositories ALCASAR

Rev

Rev 2808 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2808 Rev 3037
Line 1... Line 1...
1
<?php
1
<?php
2
header('Access-Control-Allow-Origin: *');
-
 
3
/**
2
/**
4
 * generate the xml
3
 * generate the xml
5
 *
4
 *
6
 * PHP version 5
5
 * PHP version 5
7
 *
6
 *
Line 12... Line 11...
12
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
11
 * @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: xml.php 614 2012-07-28 09:02:59Z jacky672 $
12
 * @version   SVN: $Id: xml.php 614 2012-07-28 09:02:59Z jacky672 $
14
 * @link      http://phpsysinfo.sourceforge.net
13
 * @link      http://phpsysinfo.sourceforge.net
15
 */
14
 */
16
 
15
 
-
 
16
header('Access-Control-Allow-Origin: *');
-
 
17
 
17
 /**
18
 /**
18
 * application root path
19
 * application root path
19
 *
20
 *
20
 * @var string
21
 * @var string
21
 */
22
 */
Line 26... Line 27...
26
if ((isset($_GET['json']) || isset($_GET['jsonp'])) && !extension_loaded("json")) {
27
if ((isset($_GET['json']) || isset($_GET['jsonp'])) && !extension_loaded("json")) {
27
    echo '<Error Message="The json extension to php required!" Function="ERROR"/>';
28
    echo '<Error Message="The json extension to php required!" Function="ERROR"/>';
28
} else {
29
} else {
29
    // check what xml part should be generated
30
    // check what xml part should be generated
30
    if (isset($_GET['plugin'])) {
31
    if (isset($_GET['plugin'])) {
31
        if (($_GET['plugin'] !== "") && !preg_match('/[^A-Za-z]/', $_GET['plugin'])) {
-
 
32
            $output = new WebpageXML($_GET['plugin']);
32
        $output = new WebpageXML($_GET['plugin']);
33
        } else {
-
 
34
            unset($output);
-
 
35
        }
-
 
36
    } else {
33
    } else {
37
        $output = new WebpageXML();
34
        $output = new WebpageXML();
38
    }
35
    }
39
    // if $output is correct generate output in proper type
36
    // generate output in proper type
40
    if (isset($output) && is_object($output)) {
-
 
41
        if (isset($_GET['json']) || isset($_GET['jsonp'])) {
37
    if (isset($_GET['json']) || isset($_GET['jsonp'])) {
42
            header("Cache-Control: no-cache, must-revalidate\n");
38
        header('Cache-Control: no-cache, must-revalidate');
43
            $json = $output->getJsonString();
39
        $json = $output->getJsonString();
44
            if (isset($_GET['jsonp'])) {
40
        if (isset($_GET['jsonp'])) {
45
                header("Content-Type: application/javascript\n\n");
41
            header('Content-Type: application/javascript');
46
                echo (!preg_match('/[^\w\?]/', $_GET['callback'])?$_GET['callback']:'') . '('.$json.')';
42
            echo(!preg_match('/[^\w\?]/', $_GET['callback'])?$_GET['callback']:'') . '('.$json.')';
47
            } else {
-
 
48
                header("Content-Type: application/json\n\n");
-
 
49
                echo $json;
-
 
50
            }
-
 
51
        } else {
43
        } else {
-
 
44
            header('Content-Type: application/json');
52
            $output->run();
45
            echo $json;
53
        }
46
        }
-
 
47
    } else {
-
 
48
        $output->run();
54
    }
49
    }
55
}
50
}