diff --git a/includes/lib_switch.php b/includes/lib_switch.php index 5e4ffdc030..e8b16afc00 100644 --- a/includes/lib_switch.php +++ b/includes/lib_switch.php @@ -1535,93 +1535,93 @@ function save_setting_xml() { $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as &$row) { $fout = fopen($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/v_config_cli.php","w"); - $tmp_xml = ""; - fwrite($fout, $tmp_xml); - unset($tmp_xml); + $xml .= " \$v_smtp_auth = \"".$row["smtp_auth"]."\";\n"; + $xml .= " \$v_smtp_username = \"".$row["smtp_username"]."\";\n"; + $xml .= " \$v_smtp_password = \"".$row["smtp_password"]."\";\n"; + $xml .= " \$v_smtp_from = \"".$row["smtp_from"]."\";\n"; + $xml .= " \$v_smtp_from_name = \"".$row["smtp_from_name"]."\";\n"; + $xml .= "\n"; + $xml .= "//set system dir variables\n"; + $xml .= " \$switch_storage_dir = \"".$_SESSION['switch']['storage']['dir']."\";\n"; + $xml .= " \$tmp_dir = \"".$tmp_dir."\";\n"; + $xml .= " \$v_secure = \"".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure"."\";\n"; + $xml .= "\n"; + $xml .= "?>"; + fwrite($fout, $xml); + unset($xml); fclose($fout); $fout = fopen($_SESSION['switch']['conf']['dir']."/directory/default/default.xml","w"); - $tmp_xml = "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - fwrite($fout, $tmp_xml); - unset($tmp_xml); + $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); $event_socket_ip_address = $row['event_socket_ip_address']; if (strlen($event_socket_ip_address) == 0) { $event_socket_ip_address = '127.0.0.1'; } $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/event_socket.conf.xml","w"); - $tmp_xml = "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= ""; - fwrite($fout, $tmp_xml); - unset($tmp_xml, $event_socket_password); + $xml = "\n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= ""; + fwrite($fout, $xml); + unset($xml, $event_socket_password); fclose($fout); $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/xml_rpc.conf.xml","w"); - $tmp_xml = "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - fwrite($fout, $tmp_xml); - unset($tmp_xml); + $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); //shout.conf.xml $fout = fopen($_SESSION['switch']['conf']['dir']."/autoload_configs/shout.conf.xml","w"); - $tmp_xml = "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= ""; - fwrite($fout, $tmp_xml); - unset($tmp_xml); + $xml = "\n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= ""; + fwrite($fout, $xml); + unset($xml); fclose($fout); break; //limit to 1 row @@ -1638,304 +1638,306 @@ function save_setting_xml() { } function save_extension_xml() { - //declare global variables - global $config, $db, $domain_uuid; + if (isset($_SESSION['switch']['extensions']['dir'])) { + //declare global variables + global $config, $db, $domain_uuid; - //get the context based from the domain_uuid - if (count($_SESSION['domains']) == 1) { - $user_context = "default"; - } - else { - $user_context = $_SESSION['domains'][$domain_uuid]['domain_name']; - } + //get the context based from the domain_uuid + if (count($_SESSION['domains']) == 1) { + $user_context = "default"; + } + else { + $user_context = $_SESSION['domains'][$domain_uuid]['domain_name']; + } - //delete all old extensions to prepare for new ones - $dialplan_list = glob($_SESSION['switch']['extensions']['dir']."/".$user_context."/v_*.xml"); - foreach($dialplan_list as $name => $value) { - unlink($value); - } + //delete all old extensions to prepare for new ones + $dialplan_list = glob($_SESSION['switch']['extensions']['dir']."/".$user_context."/v_*.xml"); + foreach($dialplan_list as $name => $value) { + unlink($value); + } - //write the xml files - $sql = "select * from v_extensions "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "order by call_group asc "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $i = 0; - $extension_xml_condensed = false; + //write the xml files + $sql = "select * from v_extensions "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "order by call_group asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $i = 0; + $extension_xml_condensed = false; - while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) { - $call_group = $row['call_group']; - $call_group = str_replace(";", ",", $call_group); - $tmp_array = explode(",", $call_group); - foreach ($tmp_array as &$tmp_call_group) { - $tmp_call_group = trim($tmp_call_group); - if (strlen($tmp_call_group) > 0) { - if (strlen($call_group_array[$tmp_call_group]) == 0) { - $call_group_array[$tmp_call_group] = $row['extension']; + while($row = $prep_statement->fetch(PDO::FETCH_ASSOC)) { + $call_group = $row['call_group']; + $call_group = str_replace(";", ",", $call_group); + $tmp_array = explode(",", $call_group); + foreach ($tmp_array as &$tmp_call_group) { + $tmp_call_group = trim($tmp_call_group); + if (strlen($tmp_call_group) > 0) { + if (strlen($call_group_array[$tmp_call_group]) == 0) { + $call_group_array[$tmp_call_group] = $row['extension']; + } + else { + $call_group_array[$tmp_call_group] = $call_group_array[$tmp_call_group].','.$row['extension']; + } + } + $i++; + } + $user_context = $row['user_context']; + $vm_password = $row['vm_password']; + $vm_password = str_replace("#", "", $vm_password); //preserves leading zeros + + //echo "enabled: ".$row['enabled']; + if ($row['enabled'] != "false") { + //remove invalid characters from the file names + $extension = $row['extension']; + $extension = str_replace(" ", "_", $extension); + $extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension); + $dial_string = $row['dial_string']; + if (strlen($dial_string) == 0) { + $dial_string = "{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${dialed_domain}}\${sofia_contact(\${dialed_user}@\${dialed_domain})}"; + } + + $xml .= "\n"; + $cidr = ''; + if (strlen($row['cidr']) > 0) { + $cidr = " cidr=\"" . $row['cidr'] . "\""; + } + $number_alias = ''; + if (strlen($row['number_alias']) > 0) { + $number_alias = " number-alias=\"".$row['number_alias']."\""; + } + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + switch ($row['vm_enabled']) { + case "true": + $xml .= " \n"; + break; + case "false": + $xml .= " \n"; + break; + default: + $xml .= " \n"; + } + if (strlen($row['vm_mailto']) > 0) { + $xml .= " \n"; + + switch ($row['vm_attach_file']) { + case "true": + $xml .= " \n"; + break; + case "false": + $xml .= " \n"; + break; + default: + $xml .= " \n"; + } + switch ($row['vm_keep_local_after_email']) { + case "true": + $xml .= " \n"; + break; + case "false": + $xml .= " \n"; + break; + default: + $xml .= " \n"; + } + $xml .= " \n"; + } + if (strlen($row['mwi_account']) > 0) { + $xml .= " \n"; + } + if (strlen($row['auth_acl']) > 0) { + $xml .= " \n"; + } + if (strlen($row['directory_exten_visible']) > 0) { + $xml .= " \n"; + } + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + if (strlen($row['call_group']) > 0) { + $xml .= " \n"; + } + if (strlen($row['hold_music']) > 0) { + $xml .= " \n"; + } + $xml .= " \n"; + if (strlen($switch_account_code) > 0) { + $xml .= " \n"; } else { - $call_group_array[$tmp_call_group] = $call_group_array[$tmp_call_group].','.$row['extension']; + $xml .= " \n"; } + $xml .= " \n"; + if (strlen($row['effective_caller_id_name']) > 0) { + $xml .= " \n"; + } + if (strlen($row['effective_caller_id_number']) > 0) { + $xml .= " \n"; + } + if (strlen($row['outbound_caller_id_name']) > 0) { + $xml .= " \n"; + } + if (strlen($row['outbound_caller_id_number']) > 0) { + $xml .= " \n"; + } + if (strlen($row['emergency_caller_id_number']) > 0) { + $xml .= " \n"; + } + if (strlen($row['directory_full_name']) > 0) { + $xml .= " \n"; + } + if (strlen($row['directory_visible']) > 0) { + $xml .= " \n"; + } + if (strlen($row['limit_max']) > 0) { + $xml .= " \n"; + } + else { + $xml .= " \n"; + } + if (strlen($row['limit_destination']) > 0) { + $xml .= " \n"; + } + if (strlen($row['sip_force_contact']) > 0) { + $xml .= " \n"; + } + if (strlen($row['sip_force_expires']) > 0) { + $xml .= " \n"; + } + if (strlen($row['nibble_account']) > 0) { + $xml .= " \n"; + } + switch ($row['sip_bypass_media']) { + case "bypass-media": + $xml .= " \n"; + break; + case "bypass-media-after-bridge": + $xml .= " \n"; + break; + case "proxy-media": + $xml .= " \n"; + break; + } + + $xml .= " \n"; + $xml .= " \n"; + + if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) { + mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'],0755,true); + } + if (strlen($extension) > 0) { + $fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w"); + } + $xml .= "\n"; + fwrite($fout, $xml); + unset($xml); + fclose($fout); } - $i++; } - $user_context = $row['user_context']; - $vm_password = $row['vm_password']; - $vm_password = str_replace("#", "", $vm_password); //preserves leading zeros + unset ($prep_statement); - //echo "enabled: ".$row['enabled']; - if ($row['enabled'] != "false") { - //remove invalid characters from the file names - $extension = $row['extension']; - $extension = str_replace(" ", "_", $extension); - $extension = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $extension); - $dial_string = $row['dial_string']; - if (strlen($dial_string) == 0) { - $dial_string = "{sip_invite_domain=\${domain_name},presence_id=\${dialed_user}@\${dialed_domain}}\${sofia_contact(\${dialed_user}@\${dialed_domain})}"; - } + //prepare extension + $extension_dir_path = realpath($_SESSION['switch']['extensions']['dir']); + $user_context = str_replace(" ", "_", $user_context); + $user_context = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $user_context); - $tmp_xml .= "\n"; - $cidr = ''; - if (strlen($row['cidr']) > 0) { - $cidr = " cidr=\"" . $row['cidr'] . "\""; - } - $number_alias = ''; - if (strlen($row['number_alias']) > 0) { - $number_alias = " number-alias=\"".$row['number_alias']."\""; - } - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - switch ($row['vm_enabled']) { - case "true": - $tmp_xml .= " \n"; - break; - case "false": - $tmp_xml .= " \n"; - break; - default: - $tmp_xml .= " \n"; - } - if (strlen($row['vm_mailto']) > 0) { - $tmp_xml .= " \n"; - - switch ($row['vm_attach_file']) { - case "true": - $tmp_xml .= " \n"; - break; - case "false": - $tmp_xml .= " \n"; - break; - default: - $tmp_xml .= " \n"; + //define the group members + $xml = "\n"; + $xml .= "\n"; + $xml .= "\n"; + $xml .= " \n"; + if ($user_context == "default") { + $xml .= " \n"; + } + else { + $xml .= " \n"; + } + $xml .= " \n"; + //$xml .= " \n"; + $xml .= " \n"; + $xml .= "\n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= "\n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $xml .= "\n"; + $previous_call_group = ""; + foreach ($call_group_array as $key => $value) { + $call_group = trim($key); + $extension_list = trim($value); + if (strlen($call_group) > 0) { + if ($previous_call_group != $call_group) { + $xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; + $extension_array = explode(",", $extension_list); + foreach ($extension_array as &$tmp_extension) { + $xml .= " \n"; + } + $xml .= " \n"; + $xml .= " \n"; + $xml .= "\n"; } - switch ($row['vm_keep_local_after_email']) { - case "true": - $tmp_xml .= " \n"; - break; - case "false": - $tmp_xml .= " \n"; - break; - default: - $tmp_xml .= " \n"; - } - $tmp_xml .= " \n"; - } - if (strlen($row['mwi_account']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['auth_acl']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['directory_exten_visible']) > 0) { - $tmp_xml .= " \n"; - } - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - if (strlen($row['call_group']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['hold_music']) > 0) { - $tmp_xml .= " \n"; - } - $tmp_xml .= " \n"; - if (strlen($switch_account_code) > 0) { - $tmp_xml .= " \n"; - } - else { - $tmp_xml .= " \n"; - } - $tmp_xml .= " \n"; - if (strlen($row['effective_caller_id_name']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['effective_caller_id_number']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['outbound_caller_id_name']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['outbound_caller_id_number']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['emergency_caller_id_number']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['directory_full_name']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['directory_visible']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['limit_max']) > 0) { - $tmp_xml .= " \n"; - } - else { - $tmp_xml .= " \n"; - } - if (strlen($row['limit_destination']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['sip_force_contact']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['sip_force_expires']) > 0) { - $tmp_xml .= " \n"; - } - if (strlen($row['nibble_account']) > 0) { - $tmp_xml .= " \n"; - } - switch ($row['sip_bypass_media']) { - case "bypass-media": - $tmp_xml .= " \n"; - break; - case "bypass-media-after-bridge": - $tmp_xml .= " \n"; - break; - case "proxy-media": - $tmp_xml .= " \n"; - break; + $previous_call_group = $call_group; } + unset($call_group); + } + $xml .= " \n"; + $xml .= "\n"; + $xml .= " \n"; + $xml .= ""; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - - if (!is_readable($_SESSION['switch']['extensions']['dir']."/".$row['user_context'])) { - mkdir($_SESSION['switch']['extensions']['dir']."/".$row['user_context'],0755,true); - } - if (strlen($extension) > 0) { - $fout = fopen($_SESSION['switch']['extensions']['dir']."/".$row['user_context']."/v_".$extension.".xml","w"); - } - $tmp_xml .= "\n"; - fwrite($fout, $tmp_xml); - unset($tmp_xml); + //write the xml file + if (is_readable($extension_dir_path) && strlen($extension_dir_path) > 0) { + $fout = fopen($extension_dir_path."/".$user_context.".xml","w"); + fwrite($fout, $xml); + unset($xml); fclose($fout); } - } - unset ($prep_statement); - //prepare extension - $extension_dir_path = realpath($_SESSION['switch']['extensions']['dir']); - $user_context = str_replace(" ", "_", $user_context); - $user_context = preg_replace("/[\*\:\\/\<\>\|\'\"\?]/", "", $user_context); + //syncrhonize the phone directory + sync_directory(); - //define the group members - $tmp_xml = "\n"; - $tmp_xml .= "\n"; - $tmp_xml .= "\n"; - $tmp_xml .= " \n"; - if ($user_context == "default") { - $tmp_xml .= " \n"; - } - else { - $tmp_xml .= " \n"; - } - $tmp_xml .= " \n"; - //$tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - $previous_call_group = ""; - foreach ($call_group_array as $key => $value) { - $call_group = trim($key); - $extension_list = trim($value); - if (strlen($call_group) > 0) { - if ($previous_call_group != $call_group) { - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $extension_array = explode(",", $extension_list); - foreach ($extension_array as &$tmp_extension) { - $tmp_xml .= " \n"; - } - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - } - $previous_call_group = $call_group; - } - unset($call_group); - } - $tmp_xml .= " \n"; - $tmp_xml .= "\n"; - $tmp_xml .= " \n"; - $tmp_xml .= ""; + //apply settings reminder + $_SESSION["reload_xml"] = true; - //write the xml file - if (is_readable($extension_dir_path) && strlen($extension_dir_path) > 0) { - $fout = fopen($extension_dir_path."/".$user_context.".xml","w"); - fwrite($fout, $tmp_xml); - unset($tmp_xml); - fclose($fout); - } - - //syncrhonize the phone directory - sync_directory(); - - //apply settings reminder - $_SESSION["reload_xml"] = true; - - //$cmd = "api reloadxml"; - //event_socket_request_cmd($cmd); - //unset($cmd); + //$cmd = "api reloadxml"; + //event_socket_request_cmd($cmd); + //unset($cmd); + } } function filename_safe($filename) { @@ -1993,104 +1995,104 @@ function save_gateway_xml() { } if (count($_SESSION["domains"]) > 1) { $fout = fopen($_SESSION['switch']['gateways']['dir']."/".$profile."/v_".$_SESSION['domain_name'].'-'.$gateway.".xml","w"); - $tmp_xml .= "\n"; - $tmp_xml .= " \n"; + $xml .= "\n"; + $xml .= " \n"; } else { $fout = fopen($_SESSION['switch']['gateways']['dir']."/".$profile."/v_".$gateway.".xml","w"); - $tmp_xml .= "\n"; - $tmp_xml .= " \n"; + $xml .= "\n"; + $xml .= " \n"; } if (strlen($row['username']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } else { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['distinct_to']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['auth_username']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['password']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } else { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['realm']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['from_user']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['from_domain']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['proxy']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['register_proxy']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['outbound_proxy']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['expire_seconds']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['register']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['register_transport']) > 0) { switch ($row['register_transport']) { case "udp": - $tmp_xml .= " \n"; + $xml .= " \n"; break; case "tcp": - $tmp_xml .= " \n"; + $xml .= " \n"; break; case "tls": - $tmp_xml .= " \n"; - $tmp_xml .= " \n"; + $xml .= " \n"; + $xml .= " \n"; break; default: - $tmp_xml .= " \n"; + $xml .= " \n"; } } if (strlen($row['retry_seconds']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['extension']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['ping']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['context']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['caller_id_in_from']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['supress_cng']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['sip_cid_type']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } if (strlen($row['extension_in_contact']) > 0) { - $tmp_xml .= " \n"; + $xml .= " \n"; } - $tmp_xml .= " \n"; - $tmp_xml .= ""; + $xml .= " \n"; + $xml .= ""; - fwrite($fout, $tmp_xml); - unset($tmp_xml); + fwrite($fout, $xml); + unset($xml); fclose($fout); }