From 60b1fbe6af66e1ae493e862d632c356b016ce0e6 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 23 Jul 2013 21:31:41 -0300 Subject: Remove format piece of doCmdT and move them to showCmdT --- config/openbgpd/openbgpd_status.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'config/openbgpd') diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php index 1cbcc842..dabcd605 100644 --- a/config/openbgpd/openbgpd_status.php +++ b/config/openbgpd/openbgpd_status.php @@ -37,23 +37,29 @@ else include("head.inc"); -function doCmdT($title, $command) { - echo "

\n"; - echo " \n"; - echo "\n"; - echo "\n"; - echo "
" . $title . "
";		/* no newline after pre */
-
+function doCmdT($command) {
 	$fd = popen("{$command} 2>&1", "r");
 	$ct = 0;
+	$result = "";
 	while (($line = fgets($fd)) !== FALSE) {
-		echo htmlspecialchars($line, ENT_NOQUOTES);
+		$result .= htmlspecialchars($line, ENT_NOQUOTES);
 		if ($ct++ > 1000) {
 			ob_flush();
 			$ct = 0;
 		}
 	}
 	pclose($fd);
+
+	return $result;
+}
+
+function showCmdT($title, $command) {
+	echo "

\n"; + echo " \n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "
" . $title . "
";		/* no newline after pre */
+	echo doCmdT($command);
 	echo "
\n"; } @@ -79,7 +85,7 @@ function listCmds() { function execCmds() { global $commands; foreach ($commands as $command) - doCmdT($command[0], $command[1]); + showCmdT($command[0], $command[1]); } ?> -- cgit v1.2.3