From 55e506ff996aaeeefa99dc05a903b6e89381bb3b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 26 May 2023 09:03:26 -0600 Subject: [PATCH] Update save_setting_xml --- resources/switch.php | 45 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/resources/switch.php b/resources/switch.php index b78cc1c819..1f70b52e8a 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -127,26 +127,10 @@ function save_setting_xml() { $sql = "select * from v_settings "; $database = new database; $row = $database->select($sql, null, 'row'); - if (!empty($row)) { - $fout = fopen($_SESSION['switch']['conf']['dir']."/directory/default/default.xml","w"); - $xml = "\n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= "\n"; - fwrite($fout, $xml); - unset($xml); - fclose($fout); - + if (!empty($row) && !empty($_SESSION['switch']['conf']['dir'])) { + //event_socket.conf.xml $event_socket_ip_address = $row['event_socket_ip_address']; if (empty($event_socket_ip_address)) { $event_socket_ip_address = '127.0.0.1'; } - $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/event_socket.conf.xml","w"); $xml = "\n"; $xml .= " \n"; @@ -162,6 +146,7 @@ function save_setting_xml() { unset($xml, $event_socket_password); fclose($fout); + //xml_rpc.conf.xml $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/xml_rpc.conf.xml","w"); $xml = "\n"; $xml .= " \n"; @@ -178,18 +163,18 @@ function save_setting_xml() { fclose($fout); //shout.conf.xml - $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/shout.conf.xml","w"); - $xml = "\n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= " \n"; - $xml .= ""; - fwrite($fout, $xml); - unset($xml); - fclose($fout); + $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/shout.conf.xml","w"); + $xml = "\n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= ""; + fwrite($fout, $xml); + unset($xml); + fclose($fout); } unset($sql, $row);