diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 9610d717a8..3e4965bef5 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -769,35 +769,39 @@ } //get the device line settings - $row = $device_lines[0]; + $row = $device_lines[0] ?? null; - //set the outbound proxy settings - if (empty($row['outbound_proxy_primary'])) { - $outbound_proxy_primary = $row['server_address']; - } - else { - $outbound_proxy_primary = $row['outbound_proxy_primary']; - } - $outbound_proxy_secondary = $row['outbound_proxy_secondary']; + if (!empty($row)) { + + //set the outbound proxy settings + if (empty($row['outbound_proxy_primary'])) { + $outbound_proxy_primary = $row['server_address']; + } + else { + $outbound_proxy_primary = $row['outbound_proxy_primary']; + } + $outbound_proxy_secondary = $row['outbound_proxy_secondary']; + + //build content for grandstream wave + if ($device_template == "grandstream/wave") { + $content = ""; + $content .= ""; + $content .= ""; + $content .= "".$row['server_address'].""; + $content .= "".$outbound_proxy_primary.":".$row['sip_port'].""; + $content .= "".$outbound_proxy_secondary.":".$row['sip_port'].""; + $content .= "".$row['user_id'].""; + $content .= "".$row['auth_id'].""; + $content .= "".$row['password'].""; + $content .= "".$row['user_id'].""; + $content .= "".$row['display_name'].""; + $content .= "{x+|*x+|*++}"; + $content .= "0"; + $content .= "*97"; + $content .= ""; + $content .= ""; + } - //build content for grandstream wave - if ($device_template == "grandstream/wave") { - $content = ""; - $content .= ""; - $content .= ""; - $content .= "".$row['server_address'].""; - $content .= "".$outbound_proxy_primary.":".$row['sip_port'].""; - $content .= "".$outbound_proxy_secondary.":".$row['sip_port'].""; - $content .= "".$row['user_id'].""; - $content .= "".$row['auth_id'].""; - $content .= "".$row['password'].""; - $content .= "".$row['user_id'].""; - $content .= "".$row['display_name'].""; - $content .= "{x+|*x+|*++}"; - $content .= "0"; - $content .= "*97"; - $content .= ""; - $content .= ""; } //build content for linphone @@ -808,7 +812,7 @@ //stream the file if (!empty($content)) { - $xml = html_entity_decode($xml, ENT_QUOTES, 'UTF-8'); + $content = html_entity_decode($content, ENT_QUOTES, 'UTF-8'); require_once 'resources/qr_code/QRErrorCorrectLevel.php'; require_once 'resources/qr_code/QRCode.php'; @@ -830,7 +834,7 @@ } //html image - if (!empty($content)) { + if (!empty($content) && !empty($image)) { echo "