the code change for flush output

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13694 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
xq2005 2012-09-03 02:29:29 +00:00
parent fa3822b7b3
commit 65d1ad39bc

View File

@ -64,6 +64,7 @@ function submit_request($req, $skipVerify, $opts_array){
$rsp = FALSE;
$response = '';
$cleanexit = 0;
$flushtail = '';
// Determine whether to flush output or not
$flush = false;
@ -97,7 +98,7 @@ function submit_request($req, $skipVerify, $opts_array){
// Turn on output buffering
ob_start();
if ($flush) {
if ($flush){
echo str_pad('',1024)."\n";
}
@ -110,14 +111,22 @@ function submit_request($req, $skipVerify, $opts_array){
// Flush output to browser
if ($flush) {
$str = $flushtail . $str;
if (preg_match('/[^>]+$/', $str, $matches)){
$flushtail = $matches[0];
$str = preg_replace('/[^>]+$/', '', $str);
}
else{
$flushtail = '';
}
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
// Strip HTML tags from output
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
if ($tmp = trim(strip_tags($str))) {
// Format the output based on what was given for $flush_format
if ($flush_format == "TDB") {
format_TBD($tmp);
} else {
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
// Print out output by default
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
ob_flush();