From: <abe...@us...> - 2015-12-07 18:36:59
|
Revision: 7381 http://sourceforge.net/p/astlinux/code/7381 Author: abelbeck Date: 2015-12-07 18:36:57 +0000 (Mon, 07 Dec 2015) Log Message: ----------- web interface, Status tab, allow empty lines within a Custom Asterisk Command output Modified Paths: -------------- branches/1.0/package/webinterface/altweb/common/status.inc Modified: branches/1.0/package/webinterface/altweb/common/status.inc =================================================================== --- branches/1.0/package/webinterface/altweb/common/status.inc 2015-12-07 17:29:04 UTC (rev 7380) +++ branches/1.0/package/webinterface/altweb/common/status.inc 2015-12-07 18:36:57 UTC (rev 7381) @@ -1066,10 +1066,22 @@ $tmpfile = tempnam("/tmp", "PHP_"); asteriskCMD($cmd, $tmpfile); $ph = @fopen($tmpfile, "r"); + $valid_line = FALSE; + $empty_lines = 0; while (! feof($ph)) { - if (($line = trim(fgets($ph, 1024))) !== '') { - if (strncasecmp($line, 'verbosity ', 10)) { + $line = trim(fgets($ph, 1024)); + if (strncasecmp($line, 'verbosity ', 10)) { + if ($line !== '') { + if ($valid_line) { + while ($empty_lines > 0) { + putText(''); + $empty_lines--; + } + } putText($line); + $valid_line = TRUE; + } else { + $empty_lines++; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |