From 077059eeb1828fe7ea82108cffede176bf969d82 Mon Sep 17 00:00:00 2001 From: "Harry G. Coin" Date: Mon, 25 Apr 2016 20:52:21 -0500 Subject: [PATCH] Fix so fusionpbx doesn't fail on servers with php versions later than 5. (e.g. php7). Also a few warning causes fixed. Also, one step along the way to allow freeswitch to be u freeswitch g freeswitch and fusionpbx to run www-data:www-data. --- app/fax/fax_edit.php | 4 ++-- app/scripts/resources/classes/scripts.php | 9 +++++---- resources/classes/fax.php | 2 +- resources/switch.php | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 13a8b5d992..de9656064e 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -221,7 +221,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $php_bin = 'php.exe'; } else { - $php_bin = 'php'; + $php_bin = 'php5'; } //add or update the database @@ -658,7 +658,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } $sql = "SELECT * FROM v_users "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - foreach($assigned_user_uuids as $assigned_user_uuid) { + if (isset($assigned_user_id)) foreach($assigned_user_uuids as $assigned_user_uuid) { $sql .= "and user_uuid <> '".$assigned_user_uuid."' "; } unset($assigned_user_uuids); diff --git a/app/scripts/resources/classes/scripts.php b/app/scripts/resources/classes/scripts.php index 53936fc59f..304c30e363 100644 --- a/app/scripts/resources/classes/scripts.php +++ b/app/scripts/resources/classes/scripts.php @@ -107,12 +107,13 @@ if (!class_exists('scripts')) { $src_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/resources/install/scripts'; } if (is_readable($dst_dir)) { - recursive_copy($src_dir, $dst_dir); - unset($src_dir, $dst_dir); + recursive_copy($src_dir,$dst_dir); + unset($src_dir); }else{ throw new Exception("Cannot read from '$src_dir' to get the scripts"); } - chmod($dst_dir, 0774); + chmod($dst_dir, 0775); + unset($dst_dir); } else { throw new Exception("Scripts directory doesn't exist"); } @@ -203,7 +204,7 @@ if (!class_exists('scripts')) { $tmp .= " php_bin = \"php.exe\";\n"; } else { - $tmp .= " php_bin = \"php\";\n"; + $tmp .= " php_bin = \"php5\";\n"; } $tmp .= $this->correct_path(" document_root = [[".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."]];\n"); $tmp .= "\n"; diff --git a/resources/classes/fax.php b/resources/classes/fax.php index 05dae4cbf4..805c400c04 100644 --- a/resources/classes/fax.php +++ b/resources/classes/fax.php @@ -115,7 +115,7 @@ include "root.php"; $database->fields['dialplan_detail_order'] = '005'; $database->add(); - if (file_exists(PHP_BINDIR."/php")) { define(PHP_BIN, 'php'); } + if (file_exists(PHP_BINDIR."/php5")) { define(PHP_BIN, 'php5'); } if (file_exists(PHP_BINDIR."/php.exe")) { define(PHP_BIN, 'php.exe'); } $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=".$this->fax_email." "; diff --git a/resources/switch.php b/resources/switch.php index 50e3a770ff..3b1013858a 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -30,7 +30,7 @@ require_once "resources/require.php"; //get the event socket information if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) { - if (strlen($_SESSION['event_socket_ip_address']) == 0) { + if ((! isset($_SESSION['event_socket_ip_address'])) or strlen($_SESSION['event_socket_ip_address']) == 0) { $sql = "select * from v_settings "; $prep_statement = $db->prepare(check_sql($sql)); if ($prep_statement) { @@ -56,7 +56,7 @@ function load_extensions() { $db = $database->db; if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extensions/app_config.php")) { - if ($db && strlen($_SESSION["domain_uuid"]) > 0 && strlen($_SESSION["user_uuid"]) > 0 && count($_SESSION['user']['extension']) == 0) { + if (isset($_SESSION["user"]) && isset($_SESSION["user_uuid"]) && $db && strlen($_SESSION["domain_uuid"]) > 0 && strlen($_SESSION["user_uuid"]) > 0 && count($_SESSION['user']['extension']) == 0) { //get the user extension list unset($_SESSION['user']['extension']); $sql = "select "; @@ -1356,7 +1356,7 @@ if (!function_exists('switch_conf_xml')) { $v_mail_bat = path_join($secure_path, 'mailto.bat'); $v_mail_cmd = '@' . - '"' . str_replace('/', '\\', path_join($bindir, 'php.exe')) . '" ' . + '"' . str_replace('/', '\\', path_join($bindir, 'php5.exe')) . '" ' . '"' . str_replace('/', '\\', path_join($secure_path, 'v_mailto.php')) . '" '; $fout = fopen($v_mail_bat, "w+");