From b35edfe772b8b17c007b8facdc7bf0430c8bea0e Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 7 Mar 2016 11:47:57 -0500 Subject: [PATCH] Fix up the formatting of the Wake on LAN widget and change the code style so it isn't a bunch of echos. Fixes #5960 --- .../widgets/widgets/wake_on_lan.widget.php | 55 +++++++++++-------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php index 56d125005c..ee5cc96094 100644 --- a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php +++ b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php @@ -78,32 +78,39 @@ if (is_array($config['wol']['wolentry'])) { 0) { - foreach ($wolcomputers as $wolent) { - echo '' . $wolent['descr'] . '
' . $wolent['mac'] . '' . "\n"; - echo '' . convert_friendly_interface_to_friendly_descr($wolent['interface']) . '' . "\n"; - +if (count($wolcomputers) > 0): + foreach ($wolcomputers as $wolent): $is_active = exec("/usr/sbin/arp -an |/usr/bin/grep {$wolent['mac']}| /usr/bin/wc -l|/usr/bin/awk '{print $1;}'"); $status = exec("/usr/sbin/arp -an | /usr/bin/awk '$4 == \"{$wolent['mac']}\" { print $7 }'"); - - if ($status == 'expires') { - echo ''; - } else if ($status == 'permanent') { - echo '' . "\n"; - echo ''; - } else { - echo '' . "\n"; - echo ''; - } - - echo "\n"; - echo " "; - echo '' . "\n"; - echo "\n"; - } -} else { - echo "" . gettext("No saved WoL addresses") . ".\n"; -} + ?> + + +
+ + + + + + + + "> + + "> + + "> + + + + + "> + + + + + +