Skip to content

Commit 98f84d5

Browse files
committed
Fix php 8 compatibility warnings, #6698
1 parent c7d28b8 commit 98f84d5

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

install/lib/installer_base.lib.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,21 +2615,23 @@ public function configure_bastille_firewall() {
26152615

26162616
$row = $this->db->queryOneRecord('SELECT * FROM ?? WHERE server_id = ?', $conf["mysql"]["database"] . '.firewall', $conf['server_id']);
26172617

2618-
if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') {
2619-
$tcp_public_services = trim(str_replace(',', ' ', $row['tcp_port']));
2620-
$udp_public_services = trim(str_replace(',', ' ', $row['udp_port']));
2621-
} else {
2622-
$tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000';
2623-
$udp_public_services = '53';
2624-
}
2618+
if (!empty($row)) {
2619+
if(trim($row['tcp_port']) != '' || trim($row['udp_port']) != '') {
2620+
$tcp_public_services = trim(str_replace(',', ' ', $row['tcp_port']));
2621+
$udp_public_services = trim(str_replace(',', ' ', $row['udp_port']));
2622+
} else {
2623+
$tcp_public_services = '21 22 25 53 80 110 143 443 3306 8080 10000';
2624+
$udp_public_services = '53';
2625+
}
26252626

2626-
if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
2627-
$tcp_public_services .= ' '.intval($conf['apache']['vhost_port']);
2628-
if($row['tcp_port'] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ? WHERE server_id = ?", ',' . intval($conf['apache']['vhost_port']), $conf['server_id']);
2629-
}
2627+
if(!stristr($tcp_public_services, $conf['apache']['vhost_port'])) {
2628+
$tcp_public_services .= ' '.intval($conf['apache']['vhost_port']);
2629+
if($row['tcp_port'] != '') $this->db->query("UPDATE firewall SET tcp_port = tcp_port + ? WHERE server_id = ?", ',' . intval($conf['apache']['vhost_port']), $conf['server_id']);
2630+
}
26302631

2631-
$content = str_replace('{TCP_PUBLIC_SERVICES}', $tcp_public_services, $content);
2632-
$content = str_replace('{UDP_PUBLIC_SERVICES}', $udp_public_services, $content);
2632+
$content = str_replace('{TCP_PUBLIC_SERVICES}', $tcp_public_services, $content);
2633+
$content = str_replace('{UDP_PUBLIC_SERVICES}', $udp_public_services, $content);
2634+
}
26332635

26342636
wf('/etc/Bastille/bastille-firewall.cfg', $content);
26352637

install/update.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@
554554
}
555555

556556
if($conf['services']['firewall'] && $inst->reconfigure_app('Firewall', $reconfigure_services_answer)) {
557-
if($conf['ufw']['installed'] == true) {
557+
if(isset($conf['ufw']['installed']) && $conf['ufw']['installed'] == true) {
558558
//* Configure Ubuntu Firewall
559559
$conf['services']['firewall'] = true;
560560
swriteln('Configuring Ubuntu Firewall');

0 commit comments

Comments
 (0)