mirror of
https://github.com/unraid/webgui.git
synced 2026-01-14 13:39:58 -06:00
35 lines
1.2 KiB
PHP
Executable File
35 lines
1.2 KiB
PHP
Executable File
#!/usr/bin/php -q
|
|
<?PHP
|
|
/* Copyright 2015-2016, Bergware International.
|
|
* Copyright 2015-2016, Lime Technology
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?
|
|
require_once '/usr/local/emhttp/webGui/include/ColorCoding.php';
|
|
|
|
array_shift($argv);
|
|
$colorize = ($argv[0] == 'logs');
|
|
|
|
if ($colorize) echo "<p style='text-align:center'><span class='error label'>Error</span><span class='warn label'>Warning</span><span class='system label'>System</span><span class='array label'>Array</span><span class='login label'>Login</span></p>\n";
|
|
$handle = popen('/usr/bin/docker '.implode(' ',$argv),'r');
|
|
while (!feof($handle)) {
|
|
$line = fgets($handle);
|
|
if ($colorize) {
|
|
$span = "span";
|
|
foreach ($match as $type) foreach ($type['text'] as $text) if (preg_match("/$text/i",$line)) {$span = "span class='{$type['class']}'"; break 2;}
|
|
echo "<$span>".htmlentities($line)."</span>";
|
|
} else {
|
|
echo $line;
|
|
}
|
|
flush();
|
|
}
|
|
pclose($handle);
|
|
?>
|