mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/ftp-proxy: use model for easier iteration code
PR: https://github.com/opnsense/plugins/issues/52 Suggested by: @adschellevis
This commit is contained in:
parent
2b62ed430f
commit
f8e86531ed
1 changed files with 4 additions and 12 deletions
|
|
@ -28,22 +28,14 @@
|
|||
|
||||
function ftpproxy_enabled()
|
||||
{
|
||||
global $config;
|
||||
$model = new \OPNsense\FtpProxy\FtpProxy();
|
||||
|
||||
if (isset($config['OPNsense']['ftpproxies']['ftpproxy'][0])) {
|
||||
foreach ($config['OPNsense']['ftpproxies']['ftpproxy'] as $ftpproxy) {
|
||||
if (isset($ftpproxy['enabled']) && $ftpproxy['enabled']) {
|
||||
return true;
|
||||
}
|
||||
foreach ($model->ftpproxy->__items as $server) {
|
||||
if ($server->enabled == '1') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* we should always make arrays for these, too many potential bugs: */
|
||||
if (isset($config['OPNsense']['ftpproxies']['ftpproxy']['enabled']) &&
|
||||
$config['OPNsense']['ftpproxies']['ftpproxy']['enabled']) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue