Fix the dialplan/default.xml for the debian package install

This commit is contained in:
Mark Crane 2014-04-15 06:22:17 +00:00
parent 207c063473
commit 9d790de024
1 changed files with 7 additions and 9 deletions

View File

@ -54,25 +54,23 @@
$path = "/usr/share/fusionpbx/resources/templates/conf"; $path = "/usr/share/fusionpbx/resources/templates/conf";
} }
else { else {
$path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH; $path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/templates/conf';
} }
//get the contents of the dialplan/default.xml //get the contents of the dialplan/default.xml
$file_default_path = $path.'/resources/templates/conf/dialplan/default.xml'; $file_default_path = $path.'/dialplan/default.xml';
$file_default_contents = file_get_contents($file_default_path); $file_default_contents = file_get_contents($file_default_path);
//prepare the file contents and the path //prepare the file contents and the path
//replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number //replace the variables in the template in the future loop through all the line numbers to do a replace for each possible line number
$file_default_contents = str_replace("{v_domain}", $context, $file_default_contents); $file_default_contents = str_replace("{v_domain}", $_SESSION['context'], $file_default_contents);
//set the file path //set the file path
$file_path = $_SESSION['switch']['conf']['dir'].'/dialplan/'.$context.'.xml'; $file_path = $_SESSION['switch']['conf']['dir'].'/dialplan/'.$_SESSION['context'].'.xml';
//write the default dialplan //write the default dialplan
if (!file_exists($file_path)) { $fh = fopen($file_path,'w') or die('Unable to write to '.$file_path.'. Make sure the path exists and permissions are set correctly.');
$fh = fopen($file_path,'w') or die('Unable to write to '.$file_path.'. Make sure the path exists and permissons are set correctly.'); fwrite($fh, $file_default_contents);
fwrite($fh, $file_default_contents); fclose($fh);
fclose($fh);
}
} }
//get the $apps array from the installed apps from the core and mod directories //get the $apps array from the installed apps from the core and mod directories