From c627b0b7bf742efb81853a644978be18ce79142f Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 30 Oct 2013 18:41:43 +0000 Subject: [PATCH] Update faxing dialplan entry to fix php_bin and use double quotes. --- app/fax/fax_edit.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index e9410a7f6d..435f0f45e6 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -202,9 +202,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { return; } - //set the PHP_BIN - if (file_exists(PHP_BINDIR."/php")) { define(PHP_BIN, 'php'); } - if (file_exists(PHP_BINDIR."/php.exe")) { define(PHP_BIN, 'php.exe'); } + //set the $php_bin + //if (file_exists(PHP_BINDIR."/php")) { $php_bin = 'php'; } + if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") { + $php_bin = 'php.exe'; + } + else { + $php_bin = 'php'; + } //add or update the database if ($_POST["persistformvar"] != "true") { @@ -321,13 +326,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { // $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; - $dialplan_detail_data = "api_hangup_hook=system ".PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php "; + $dialplan_detail_data = "api_hangup_hook=system \"".PHP_BINDIR."/".$php_bin."\" \"".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php\" "; $dialplan_detail_data .= "email=".$fax_email." "; $dialplan_detail_data .= "extension=".$fax_extension." "; $dialplan_detail_data .= "name=".$fax_prefix."\\\\\\\${last_fax} "; - $dialplan_detail_data .= "messages='result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}' "; + $dialplan_detail_data .= "messages=\"result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}\" "; $dialplan_detail_data .= "domain=".$_SESSION['domain_name']." "; - $dialplan_detail_data .= "caller_id_name='\\\\\\\${caller_id_name}' "; + $dialplan_detail_data .= "caller_id_name=\"\\\\\\\${caller_id_name}\" "; $dialplan_detail_data .= "caller_id_number=\\\\\\\${caller_id_number} "; $dialplan_detail_data .= "fax_relay=true "; @@ -431,13 +436,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //update dialplan detail action $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; - $dialplan_detail_data = "api_hangup_hook=system ".PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php "; + $dialplan_detail_data = "api_hangup_hook=system \"".PHP_BINDIR."/".$php_bin."\" \"".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/fax_to_email.php\" "; $dialplan_detail_data .= "email=".$fax_email." "; $dialplan_detail_data .= "extension=".$fax_extension." "; $dialplan_detail_data .= "name=".$fax_prefix."\\\\\\\${last_fax} "; - $dialplan_detail_data .= "messages='result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}' "; + $dialplan_detail_data .= "messages=\"result: \\\\\\\${fax_result_text} sender:\\\\\\\${fax_remote_station_id} pages:\\\\\\\${fax_document_total_pages}\" "; $dialplan_detail_data .= "domain=".$_SESSION['domain_name']." "; - $dialplan_detail_data .= "caller_id_name='\\\\\\\${caller_id_name}' "; + $dialplan_detail_data .= "caller_id_name=\"\\\\\\\${caller_id_name}\" "; $dialplan_detail_data .= "caller_id_number=\\\\\\\${caller_id_number} "; $dialplan_detail_data .= "fax_relay=true "; $sql = "update v_dialplan_details set ";