From edea99291d09a7c82d56254e29eb67410ab5624b Mon Sep 17 00:00:00 2001
From: Eduardo Mozart de Oliveira
<2974895+eduardomozart@users.noreply.github.com>
Date: Wed, 10 Jul 2024 18:45:55 -0300
Subject: [PATCH] Only test ping on reservation creation if it's enabled on
config
---
inc/reserveip.class.php | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/inc/reserveip.class.php b/inc/reserveip.class.php
index 3e52368..1954e59 100644
--- a/inc/reserveip.class.php
+++ b/inc/reserveip.class.php
@@ -184,18 +184,21 @@ function showReservationForm($ip, $id_addressing, $rand) {
" . _n("IP address", "IP addresses", 1) . " |
" . $ip . " |
";
- $config = new PluginAddressingConfig();
- $config->getFromDB('1');
- $system = $config->fields["used_system"];
-
- $ping_equip = new PluginAddressingPing_Equipment();
- list($message, $error) = $ping_equip->ping($system, $ip);
- if ($error) {
- echo " ";
- echo __('Ping: no response - free IP', 'addressing');
- } else {
- echo " ";
- echo __('Ping: got a response - used IP', 'addressing');
+ $ping = $addressing->fields["use_ping"];
+ if ($ping == 1) {
+ $config = new PluginAddressingConfig();
+ $config->getFromDB('1');
+ $system = $config->fields["used_system"];
+
+ $ping_equip = new PluginAddressingPing_Equipment();
+ list($message, $error) = $ping_equip->ping($system, $ip);
+ if ($error) {
+ echo " ";
+ echo __('Ping: no response - free IP', 'addressing');
+ } else {
+ echo " ";
+ echo __('Ping: got a response - used IP', 'addressing');
+ }
}
echo "";
echo " | ";