diff options
Diffstat (limited to 'src/usr/local/www')
-rw-r--r-- | src/usr/local/www/widgets/widgets/wake_on_lan.widget.php | 55 |
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']}&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'] ?>&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> |