mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07: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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user