Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
8a6f8559
Commit
8a6f8559
authored
May 04, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(dashboard, widgets) refactor wake_on_lan.widget.php
parent
686378d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
58 deletions
+58
-58
wake_on_lan.widget.php
src/www/widgets/widgets/wake_on_lan.widget.php
+58
-58
No files found.
src/www/widgets/widgets/wake_on_lan.widget.php
View file @
8a6f8559
<?php
/*
Copyright (C) 2014
Deciso B.V.
Copyright (C) 2014-2016
Deciso B.V.
Copyright (C) 2010 Yehuda Katz
Redistribution and use in source and binary forms, with or without
...
...
@@ -26,8 +26,6 @@
POSSIBILITY OF SUCH DAMAGE.
*/
$nocsrf
=
true
;
require_once
(
"guiconfig.inc"
);
require_once
(
"widgets/include/wake_on_lan.inc"
);
require_once
(
"interfaces.inc"
);
...
...
@@ -39,42 +37,44 @@ if (isset($config['wol']['wolentry'])) {
}
?>
<table
width=
"100%"
border=
"0"
cellpadding=
"0"
cellspacing=
"0"
summary=
"wol status"
>
<table
class=
"table table-striped table-condensed"
>
<thead>
<tr>
<?php
echo
'<td class="widgetsubheader" align="center">'
.
gettext
(
"Computer / Device"
)
.
'</td>'
;
echo
'<td class="widgetsubheader" align="center">'
.
gettext
(
"Interface"
)
.
'</td>'
;
echo
'<td class="widgetsubheader" align="center">'
.
gettext
(
"Status"
)
.
'</td>'
;
?>
<td
class=
"widgetsubheader"
>
</td>
<th>
<?=
gettext
(
"Computer / Device"
);
?>
</th>
<th>
<?=
gettext
(
"Interface"
);
?>
</th>
<th>
<?=
gettext
(
"Status"
);
?>
</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if
(
count
(
$wolcomputers
)
>
0
)
{
foreach
(
$wolcomputers
as
$wolent
)
{
echo
'<tr><td class="listlr">'
.
$wolent
[
'descr'
]
.
'<br />'
.
$wolent
[
'mac'
]
.
'</td>'
.
"
\n
"
;
echo
'<td class="listr">'
.
convert_friendly_interface_to_friendly_descr
(
$wolent
[
'interface'
])
.
'</td>'
.
"
\n
"
;
$is_active
=
exec
(
"/usr/sbin/arp -an |/usr/bin/grep
{
$wolent
[
'mac'
]
}
| /usr/bin/wc -l|/usr/bin/awk '{print $1;}'"
);
if
(
$is_active
==
1
)
{
echo
'<td class="listr" align="center">'
.
"
\n
"
;
echo
"<span class=
\"
glyphicon glyphicon-play text-success
\"
alt=
\"
pass
\"
></span> "
.
gettext
(
"Online"
)
.
"</td>
\n
"
;
}
else
{
echo
'<td class="listbg" align="center">'
.
"
\n
"
;
echo
"<span class=
\"
glyphicon glyphicon-remove text-danger
\"
alt=
\"
block
\"
></span> "
.
gettext
(
"Offline"
)
.
"</td>
\n
"
;
}
echo
'<td valign="middle" class="list nowrap">'
;
/*if($is_active) { */
/* Will always show wake-up button even if the code thinks it is awake */
/* } else { */
echo
"<a href='services_wol.php?mac=
{
$wolent
[
'mac'
]
}
&if=
{
$wolent
[
'interface'
]
}
'> "
;
echo
"<span class='glyphicon glyphicon-flash' title='"
.
gettext
(
"Wake Up"
)
.
"' border='0' alt='wol' ></span></a>
\n
"
;
/* } */
echo
"</td></tr>
\n
"
;
}
}
else
{
echo
"<tr><td colspan=
\"
4
\"
align=
\"
center
\"
>"
.
gettext
(
"No saved WoL addresses"
)
.
".</td></tr>
\n
"
;
}
?>
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;}'"
);
?>
<tr>
<td>
<?=
$wolent
[
'descr'
];
?>
<br/>
<?=
$wolent
[
'mac'
];
?>
</td>
<td>
<?=
htmlspecialchars
(
convert_friendly_interface_to_friendly_descr
(
$wolent
[
'interface'
]));
?>
</td>
<td>
<span
class=
"glyphicon glyphicon-
<?=
$is_active
==
1
?
"play"
:
"remove"
;
?>
text-
<?=
$is_active
==
1
?
"success"
:
"danger"
;
?>
"
></span>
<?=
$is_active
==
1
?
gettext
(
"Online"
)
:
gettext
(
"Offline"
);
?>
</td>
<td>
<a
href=
"services_wol.php?mac=
<?=
$wolent
[
'mac'
];
?>
&if=
<?=
$wolent
[
'interface'
];
?>
"
>
<span
class=
"glyphicon glyphicon-flash"
title=
"
<?=
gettext
(
"Wake Up"
);
?>
"
></span>
</a>
</td>
</tr>
<?php
endforeach
;
if
(
count
(
$wolcomputers
)
==
0
)
:?>
<
tr
>
<
td
colspan
=
"4"
><?=
gettext
(
"No saved WoL addresses"
);
?>
</td>
</tr>
<?php
endif
;
?>
</tbody>
<tfoot>
<tr>
<td
colspan=
"4"
><a
href=
"status_dhcp_leases.php"
class=
"navlink"
>
<?=
gettext
(
'DHCP Leases Status'
)
?>
</a></td>
</tr>
</tfoot>
</table>
<center><a
href=
"status_dhcp_leases.php"
class=
"navlink"
>
<?=
gettext
(
'DHCP Leases Status'
)
?>
</a></center>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment