// Mark Huang // // Copyright (C) 2006 The Trustees of Princeton University // // $Id$ // // Get admin API handle require_once 'plc_api.php'; global $adm; function writeXMLHeader() { print( "\n\n" ); } define("ENT_UNPARSED", 0); // i.e., CDATA define("ENT_PARSED", 1); // i.e., PCDATA (attributes) function xmlspecialchars_decode($string, $parsed = ENT_UNPARSED) { if ($parsed == ENT_PARSED) { // & to & // ' to ' // < to < // > to > // " to " return str_replace('&', '&', str_replace(array(''', '<', '>', '"'), array("'", '<', '>', '"'), $string)); } else { // & to & // ' to ' // < to < // > to > // \" to " // \\ to \ return str_replace('&', '&', str_replace(array(''', '<', '>', '\"', '\\'), array("'", '<', '>', '"', "\\"), $string)); } } function xmlspecialchars($string, $parsed = ENT_UNPARSED) { if ($parsed == ENT_PARSED) { // & to & // ' to ' // < to < // > to > // " to " $string = str_replace(array("'", '<', '>', '"'), array(''', '<', '>', '"'), str_replace('&', '&', $string)); } else { // & to & // ' to ' // < to < // > to > // " to \" // \ to \\ $string = str_replace(array("'", '<', '>', '"'), array(''', '<', '>', '\"'), str_replace(array('&', "\\"), array('&', '\\'), $string)); } return utf8_encode($string); } // Look up the node if (!empty($_REQUEST['node_id'])) { $node = $adm->GetSlivers(intval($_REQUEST['node_id'])); } else { $nodenetworks = $adm->GetNodeNetworks(array('ip' => $_SERVER['REMOTE_ADDR'])); if (!empty($nodenetworks)) { $node = $adm->GetSlivers($nodenetworks[0]['node_id']); } } if (empty($node)) { exit(); } $node_id = $node['node_id']; writeXMLHeader(); $curtime= time(); print( "\n" ); print( "\n" ); foreach( $node['conf_files'] as $conf_file ) { $source = xmlspecialchars($conf_file["source"]); $dest = xmlspecialchars($conf_file["dest"]); $file_permissions = xmlspecialchars($conf_file["file_permissions"]); $file_owner = xmlspecialchars($conf_file["file_owner"]); $file_group = xmlspecialchars($conf_file["file_group"]); $preinstall_cmd = xmlspecialchars($conf_file["preinstall_cmd"]); $postinstall_cmd = xmlspecialchars($conf_file["postinstall_cmd"]); $error_cmd = xmlspecialchars($conf_file["error_cmd"]); $ignore_cmd_errors = $conf_file["ignore_cmd_errors"]; $always_update = $conf_file["always_update"]; if( $ignore_cmd_errors == 1 ) $ignore_cmd_errors= "y"; else $ignore_cmd_errors= "n"; if( $always_update == 1 ) $always_update= "y"; else $always_update= "n"; print( "\n" ); print( "$source\n" ); print( "$dest\n" ); print( "$file_permissions\n" ); print( "$file_owner\n" ); print( "$file_group\n" ); print( "$preinstall_cmd\n" ); print( "$postinstall_cmd\n" ); print( "$error_cmd\n" ); print( "\n" ); } print( "\n" ); print( "\n" ); ?>