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
8f09dd01
Commit
8f09dd01
authored
Jan 17, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shortcuts: merge remainder into fbegin.inc
parent
7743289a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
88 deletions
+32
-88
fbegin.inc
src/www/fbegin.inc
+32
-11
shortcuts.inc
src/www/shortcuts.inc
+0
-77
No files found.
src/www/fbegin.inc
View file @
8f09dd01
<?php
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2008 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2012 Jim Pingle
Copyright (C) 2007-2008 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2005-2006 Colin Smith <ethethlay@gmail.com>
All rights reserved.
...
...
@@ -28,13 +29,33 @@
POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
"shortcuts.inc"
);
function
find_service_by_shortcut
(
$name
)
{
$shortcuts
=
array
();
$shortcuts
[
'dhcp'
]
=
'dhcpd'
;
$shortcuts
[
'forwarder'
]
=
'dnsmasq'
;
$shortcuts
[
'gateways'
]
=
'apinger'
;
$shortcuts
[
'ipsec'
]
=
'ipsec'
;
$shortcuts
[
'ntp'
]
=
'ntpd'
;
$shortcuts
[
'openvpn'
]
=
'openvpn'
;
$shortcuts
[
'relayd'
]
=
'relayd'
;
$shortcuts
[
'resolver'
]
=
'unbound'
;
$shortcuts
[
'snmp'
]
=
'bsnmpd'
;
$shortcuts
[
'squid'
]
=
'squid'
;
$shortcuts
[
'upnp'
]
=
'miniupnpd'
;
function
find_service_by_name
(
$name
)
{
$services
=
get_services
();
foreach
(
$services
as
$service
)
if
(
$service
[
"name"
]
==
$name
)
return
$service
;
foreach
(
$shortcuts
as
$shortcut
=>
$realname
)
{
if
(
$shortcut
==
$name
)
{
foreach
(
$services
as
$service
)
if
(
$service
[
'name'
]
==
$realname
)
{
return
$service
;
}
}
}
return
array
();
}
...
...
@@ -194,15 +215,15 @@ if($need_alert_display == true) {
<?php
if
(
isset
(
$shortcut_section
)
&&
!
empty
(
$shortcuts
[
$shortcut_section
][
'service'
])
)
{
if
(
isset
(
$shortcut_section
))
{
$ssvc
=
array
();
switch
(
$shortcut_section
)
{
case
"openvpn"
:
case
'openvpn'
:
$ssvc
=
find_service_by_openvpn_vpnid
(
$vpnid
);
break
;
default
:
$ssvc
=
find_service_by_
name
(
$shortcuts
[
$shortcut_section
][
'service'
]
);
$ssvc
=
find_service_by_
shortcut
(
$shortcut_section
);
break
;
}
if
(
!
empty
(
$ssvc
))
{
echo
get_service_status_icon
(
$ssvc
,
false
);
...
...
src/www/shortcuts.inc
deleted
100644 → 0
View file @
7743289a
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2012 Jim Pingle
Copyright (C) 2007, 2008 Scott Ullrich <sullrich@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
$shortcuts
=
array
();
function
get_shortcut_by_service_name
(
$servicename
)
{
global
$shortcuts
;
foreach
(
$shortcuts
as
$name
=>
$shortcut
)
{
if
(
!
empty
(
$shortcut
[
'service'
])
&&
(
$shortcut
[
'service'
]
==
$servicename
))
{
return
$name
;
}
}
return
null
;
}
$shortcuts
[
'upnp'
]
=
array
();
$shortcuts
[
'upnp'
][
'service'
]
=
"miniupnpd"
;
$shortcuts
[
'relayd'
]
=
array
();
$shortcuts
[
'relayd'
][
'service'
]
=
"relayd"
;
$shortcuts
[
'dhcp'
]
=
array
();
$shortcuts
[
'dhcp'
][
'service'
]
=
"dhcpd"
;
$shortcuts
[
'ipsec'
]
=
array
();
$shortcuts
[
'ipsec'
][
'service'
]
=
"ipsec"
;
$shortcuts
[
'openvpn'
]
=
array
();
$shortcuts
[
'openvpn'
][
'service'
]
=
"openvpn"
;
$shortcuts
[
'forwarder'
]
=
array
();
$shortcuts
[
'forwarder'
][
'service'
]
=
'dnsmasq'
;
$shortcuts
[
'resolver'
]
=
array
();
$shortcuts
[
'resolver'
][
'service'
]
=
'unbound'
;
$shortcuts
[
'ntp'
]
=
array
();
$shortcuts
[
'ntp'
][
'service'
]
=
'ntpd'
;
$shortcuts
[
'gateways'
]
=
array
();
$shortcuts
[
'gateways'
][
'service'
]
=
"apinger"
;
$shortcuts
[
'snmp'
]
=
array
();
$shortcuts
[
'snmp'
][
'service'
]
=
"bsnmpd"
;
$shortcuts
[
'squid'
]
=
array
();
$shortcuts
[
'squid'
][
'service'
]
=
"squid"
;
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