From 462da0a3e2f66f50d532970e8ce34df7dd25534c Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 25 Sep 2020 18:00:50 -0600 Subject: [PATCH] Voicemail: Better check on Default Setting switch > phrases > dir value. --- app/voicemails/app_defaults.php | 112 ++++++++++++++++---------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/app/voicemails/app_defaults.php b/app/voicemails/app_defaults.php index 5351cf3a28..fb39d834a5 100644 --- a/app/voicemails/app_defaults.php +++ b/app/voicemails/app_defaults.php @@ -1,57 +1,57 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2016 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -//process this only one time -if ($domains_processed == 1) { - - // process change from using macros to phrases - $languages_path = $_SESSION['switch']['phrases']['dir']; - if ($languages_path && file_exists($languages_path)) { - $folder_contents = scandir($languages_path); - if (is_array($folder_contents) && @sizeof($folder_contents) != 0) { - foreach ($folder_contents as $language_abbreviation) { - if ($language_abbreviation == '.' || $language_abbreviation == '..') { continue; } - // adjust language xml to include all xml phrase files in the vm folder - $language_xml_path = $languages_path.'/'.$language_abbreviation.'/'.$language_abbreviation.'.xml'; - if (file_exists($language_xml_path)) { - $language_xml_content = file_get_contents($language_xml_path); - $language_xml_content = str_replace('data="vm/sounds.xml"', 'data="vm/*.xml"', $language_xml_content); - @file_put_contents($language_xml_path, $language_xml_content); - } - // copy voicemail.xml to language/xx/vm folders - $voicemail_xml_source = $_SERVER['PROJECT_ROOT'].'/app/voicemails/resources/switch/languages/'.$language_abbreviation.'/vm/voicemail.xml'; - $voicemail_xml_target = $languages_path.'/'.$language_abbreviation.'/vm/voicemail.xml'; - if (!file_exists($voicemail_xml_target)) { - copy($voicemail_xml_source, $voicemail_xml_target); - } - } - } - } - unset($languages_path, $folder_contents, $language_abbreviation, $language_xml_path, $language_xml_content, $voicemail_xml_source, $voicemail_xml_target); - -} - + + Portions created by the Initial Developer are Copyright (C) 2008-2016 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//process this only one time +if ($domains_processed == 1) { + + // process change from using macros to phrases + $languages_path = $_SESSION['switch']['phrases']['dir']; + if ($languages_path != '' && file_exists($languages_path)) { + $folder_contents = scandir($languages_path); + if (is_array($folder_contents) && @sizeof($folder_contents) != 0) { + foreach ($folder_contents as $language_abbreviation) { + if ($language_abbreviation == '.' || $language_abbreviation == '..') { continue; } + // adjust language xml to include all xml phrase files in the vm folder + $language_xml_path = $languages_path.'/'.$language_abbreviation.'/'.$language_abbreviation.'.xml'; + if (file_exists($language_xml_path)) { + $language_xml_content = file_get_contents($language_xml_path); + $language_xml_content = str_replace('data="vm/sounds.xml"', 'data="vm/*.xml"', $language_xml_content); + @file_put_contents($language_xml_path, $language_xml_content); + } + // copy voicemail.xml to language/xx/vm folders + $voicemail_xml_source = $_SERVER['PROJECT_ROOT'].'/app/voicemails/resources/switch/languages/'.$language_abbreviation.'/vm/voicemail.xml'; + $voicemail_xml_target = $languages_path.'/'.$language_abbreviation.'/vm/voicemail.xml'; + if (!file_exists($voicemail_xml_target)) { + copy($voicemail_xml_source, $voicemail_xml_target); + } + } + } + } + unset($languages_path, $folder_contents, $language_abbreviation, $language_xml_path, $language_xml_content, $voicemail_xml_source, $voicemail_xml_target); + +} + ?> \ No newline at end of file