2010-06-16 18:21:58 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Main xCAT page
|
|
|
|
*/
|
|
|
|
require_once "lib/functions.php";
|
|
|
|
require_once "lib/ui.php";
|
|
|
|
require_once "lib/jsonwrapper.php";
|
|
|
|
|
|
|
|
/* Load page */
|
|
|
|
loadPage();
|
|
|
|
|
|
|
|
/* Login user */
|
|
|
|
if (!isAuthenticated()) {
|
|
|
|
login();
|
|
|
|
} else {
|
|
|
|
loadContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test lib/cmd.php
|
|
|
|
*/
|
|
|
|
function testCmdPhp() {
|
2010-07-29 20:22:09 +00:00
|
|
|
$xml = docmd('rinv', 'gpok6', array('all'));
|
2010-06-16 18:21:58 +00:00
|
|
|
$rsp = array();
|
2010-07-22 21:26:17 +00:00
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
foreach ($xml->children() as $child) {
|
2010-07-22 21:26:17 +00:00
|
|
|
foreach ($child->children() as $data) {
|
|
|
|
if($data->name) {
|
|
|
|
$node = $data->name;
|
|
|
|
$cont = $data->data->contents;
|
2010-07-29 20:22:09 +00:00
|
|
|
$cont = str_replace(":|:", "\n", $cont);
|
2010-07-22 21:26:17 +00:00
|
|
|
array_push($rsp, "$node: $cont");
|
|
|
|
} else if(strlen("$data") > 2) {
|
2010-07-29 20:22:09 +00:00
|
|
|
$data = str_replace(":|:", "\n", $data);
|
2010-07-22 21:26:17 +00:00
|
|
|
array_push($rsp, "$data");
|
2010-07-22 19:56:09 +00:00
|
|
|
}
|
2010-07-22 21:26:17 +00:00
|
|
|
}
|
2010-06-16 18:21:58 +00:00
|
|
|
}
|
2010-07-22 19:56:09 +00:00
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
$rtn = array("rsp" => $rsp, "msg" => '');
|
|
|
|
echo json_encode($rtn);
|
|
|
|
}
|
|
|
|
?>
|