summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2016-03-07 11:47:57 -0500
committerjim-p <jimp@pfsense.org>2016-03-07 11:47:57 -0500
commitb35edfe772b8b17c007b8facdc7bf0430c8bea0e (patch)
tree85b502e74d811142270428e5f7f9ddb708377c31 /src
parent4af2649f7f03fe0c38ca213ff370ea57d683bcb4 (diff)
downloadpfsense-b35edfe772b8b17c007b8facdc7bf0430c8bea0e.zip
pfsense-b35edfe772b8b17c007b8facdc7bf0430c8bea0e.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/widgets/widgets/wake_on_lan.widget.php55
1 files 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 56d1250..ee5cc96 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'])) {
</thead>
<tbody>
<?php
-if (count($wolcomputers) > 0) {
- foreach ($wolcomputers as $wolent) {
- echo '<tr><td>' . $wolent['descr'] . '<br />' . $wolent['mac'] . '</td>' . "\n";
- echo '<td>' . convert_friendly_interface_to_friendly_descr($wolent['interface']) . '</td>' . "\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 '<i class="fa fa-arrow-right" data-toggle="tooltip" title="' . gettext("Online") . '"></i>';
- } else if ($status == 'permanent') {
- echo '<td class="text-center">' . "\n";
- echo '<i class="fa fa-arrow-right" data-toggle="tooltip" title="' . gettext("Static ARP") . '"></i>';
- } else {
- echo '<td class="text-center">' . "\n";
- echo '<i class="fa fa-ban" data-toggle="tooltip" title="' . gettext("Offline") . '"></i>';
- }
-
- echo "</td>\n<td>";
- echo "<a href='services_wol.php?mac={$wolent['mac']}&amp;if={$wolent['interface']}'> ";
- echo '<i class="fa fa-bed" data-toggle="tooltip" title="' . gettext("Wake up!") . '"></i></a>' . "\n";
- echo "</td></tr>\n";
- }
-} else {
- echo "<tr><td colspan=\"4\" class=\"text-center\">" . gettext("No saved WoL addresses") . ".</td></tr>\n";
-}
+ ?>
+ <tr>
+ <td>
+ <?= $wolent['descr'] ?><br />
+ <?= $wolent['mac'] ?>
+ </td>
+ <td>
+ <?= convert_friendly_interface_to_friendly_descr($wolent['interface']) ?>
+ </td>
+ <td class="text-center">
+ <?php if ($status == 'expires'): ?>
+ <i class="fa fa-arrow-right" data-toggle="tooltip" title="<?= gettext("Online") ?>"></i>
+ <?php elseif ($status == 'permanent'): ?>
+ <i class="fa fa-arrow-right" data-toggle="tooltip" title="<?= gettext("Static ARP") ?>"></i>
+ <?php else: ?>
+ <i class="fa fa-ban" data-toggle="tooltip" title="<?= gettext("Offline") ?>"></i>
+ <?php endif; ?>
+ </td>
+ <td>
+ <a href="services_wol.php?mac=<?= $wolent['mac'] ?>&amp;if=<?= $wolent['interface']?>">
+ <i class="fa fa-bed" data-toggle="tooltip" title="<?= gettext("Wake up!") ?>"></i>
+ </a>
+ </td>
+ </tr>
+<?php endforeach;
+else: ?>
+ <tr><td colspan="4" class="text-center"><?= gettext("No saved WoL addresses") ?></td></tr>
+<?php
+endif;
?>
</tbody>
</table>
OpenPOWER on IntegriCloud