From 20140c5c8f48a5aff3c521387474e21dd7267bff Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 3 Sep 2012 02:30:49 +0000 Subject: [PATCH] the code change for flush output git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13695 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/lib/functions.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index 36ba1f178..fa4dd5525 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -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; @@ -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>/', '', $str); // Strip HTML tags from output - $str = preg_replace('/.*<\/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 '
' . $tmp . '
'; ob_flush();