From 0f28dc9bea5570dd698df273489da2fdd1447aff Mon Sep 17 00:00:00 2001 From: "leon.hedding" Date: Thu, 11 Feb 2021 13:23:05 +0000 Subject: [PATCH 1/6] fixes for PHP 7.3. Tested on running system. --- Endpointman.class.php | 4 ++-- Endpointman_Config.class.php | 4 ++-- includes/functions.inc | 24 ++++++++++++------------ page.endpointman.php | 2 +- page.epm_advanced.php | 2 +- page.epm_config.php | 2 +- page.epm_devices.php | 2 +- page.epm_oss.php | 2 +- page.epm_placeholders.php | 2 +- page.epm_templates.php | 2 +- templates/freepbx/devices_manager.html | 12 ++++++------ views/rnav.php | 12 ++++++------ 12 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Endpointman.class.php b/Endpointman.class.php index 19cb9ad3..d0377acf 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -2059,9 +2059,9 @@ function save_template($id, $custom, $variables) { while ($i < count($config_files)) { $config_files[$i] = str_replace(".", "_", $config_files[$i]); - if (isset($variables[config_files][$i])) { + if (isset($variables['config_files'][$i])) { - $variables[$config_files[$i]] = explode("_", $variables[config_files][$i], 2); + $variables[$config_files[$i]] = explode("_", $variables['config_files'][$i], 2); $variables[$config_files[$i]] = $variables[$config_files[$i]][0]; if ($variables[$config_files[$i]] > 0) { diff --git a/Endpointman_Config.class.php b/Endpointman_Config.class.php index 62facc9b..7ce7d438 100644 --- a/Endpointman_Config.class.php +++ b/Endpointman_Config.class.php @@ -406,7 +406,7 @@ public function epm_config_manager_hardware_get_list_all_hide_show() $row_out[$i]['installed'] = $row['installed']; $row_out[$i]['hidden'] = $row['hidden']; $row_out[$i]['count'] = $i; - $row_out[$i]['products'] = ""; + $row_out[$i]['products'] = array(); if ($row['hidden'] == 1) { $i++; @@ -423,7 +423,7 @@ public function epm_config_manager_hardware_get_list_all_hide_show() $row_out[$i]['products'][$j]['short_name'] = $row2['short_name']; $row_out[$i]['products'][$j]['hidden'] = $row2['hidden']; $row_out[$i]['products'][$j]['count'] = $j; - $row_out[$i]['products'][$j]['models'] = ""; + $row_out[$i]['products'][$j]['models'] = array(); if ($row2['hidden'] == 1) { $j++; diff --git a/includes/functions.inc b/includes/functions.inc index c0dfb2ec..2ec5f97b 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -309,7 +309,7 @@ class endpointmanager { $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); $res = $this->eda->sql($oui_sql); - $brand_count = count($res); + $brand_count = count(array($res)); if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. @@ -660,7 +660,7 @@ class endpointmanager { $sql = "SELECT * FROM sip"; $res = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { if (!$res) { @@ -694,7 +694,7 @@ class endpointmanager { $sql = "SELECT * FROM sipsettings"; $res = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { if (!$res) { @@ -738,7 +738,7 @@ class endpointmanager { $sql = "SELECT * FROM kvstore_Sipsettings"; $res = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { if (!$res) { @@ -773,7 +773,7 @@ class endpointmanager { $res = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { $featurecodes = $res; @@ -844,7 +844,7 @@ class endpointmanager { $sql = "SELECT * FROM sysadmin_options"; $res = $this->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { if (!$res) { @@ -896,7 +896,7 @@ class endpointmanager { $sql = "SELECT id FROM endpointman_mac_list WHERE model > 0 AND id =" . $mac_id; $res = $this->eda->sql($sql); - if (count($res)) { + if (count(array($res))) { //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, $sql = "SELECT endpointman_mac_list.specific_settings, endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, endpointman_mac_list.global_settings_override FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = " . $mac_id; @@ -1907,7 +1907,7 @@ class endpointmanager { foreach ($temp as $list) { $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; $res = $this->eda->sql($sql); - if (count($res)) { + if (count(array($res))) { $data = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; } @@ -1921,7 +1921,7 @@ class endpointmanager { foreach ($temp as $list) { $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; $res = $this->eda->sql($sql); - if (count($res)) { + if (count(array($res))) { $data = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; } @@ -2318,7 +2318,7 @@ class endpointmanager { $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='" . $id . "'"; $res = $this->eda->sql($sql); - if (count($res)) { + if (count(array($res))) { $row = $this->eda->sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id =" . $row['brand']; @@ -3588,7 +3588,7 @@ class endpointmanager { $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); $res = $this->eda->sql($oui_sql); - $brand_count = count($res); + $brand_count = count(array($res)); if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. @@ -3602,7 +3602,7 @@ class endpointmanager { $res = $this->eda->sql($epm_sql); - $epm = count($res) ? TRUE : FALSE; + $epm = count(array($res)) ? TRUE : FALSE; //Add into a final array $final[$z] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); diff --git a/page.endpointman.php b/page.endpointman.php index 18bc4370..6b3f6088 100644 --- a/page.endpointman.php +++ b/page.endpointman.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/page.epm_advanced.php b/page.epm_advanced.php index 71724ac5..850a8399 100644 --- a/page.epm_advanced.php +++ b/page.epm_advanced.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/page.epm_config.php b/page.epm_config.php index acc0fac5..512484ff 100644 --- a/page.epm_config.php +++ b/page.epm_config.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/page.epm_devices.php b/page.epm_devices.php index ce4f9afb..28f53c31 100644 --- a/page.epm_devices.php +++ b/page.epm_devices.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/page.epm_oss.php b/page.epm_oss.php index 7a313f07..c6215fc8 100644 --- a/page.epm_oss.php +++ b/page.epm_oss.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/page.epm_placeholders.php b/page.epm_placeholders.php index 3ee2eb15..bd2b6f97 100644 --- a/page.epm_placeholders.php +++ b/page.epm_placeholders.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/page.epm_templates.php b/page.epm_templates.php index 9a13f6f4..6b37345b 100644 --- a/page.epm_templates.php +++ b/page.epm_templates.php @@ -1,7 +1,7 @@ configmod->get("disable_endpoint_warning") !== "1") { include('page.epm_warning.php'); } diff --git a/templates/freepbx/devices_manager.html b/templates/freepbx/devices_manager.html index fbe154a3..c573586f 100644 --- a/templates/freepbx/devices_manager.html +++ b/templates/freepbx/devices_manager.html @@ -463,14 +463,14 @@

?> - alt=":"> - - - - + alt=":"> + + + + {$value.line} {$value.ext} - {$value.description} - +
' title="Edit phone">
{/loop} diff --git a/views/rnav.php b/views/rnav.php index 353c0f97..9bf45b8d 100644 --- a/views/rnav.php +++ b/views/rnav.php @@ -27,7 +27,7 @@ if (array_key_exists('epm_oss', $li)){ echo '

' . _("Open Source Information") . '

'; -echo '' . $li[epm_oss] . ''; +echo '' . $li['epm_oss'] . ''; } @@ -40,14 +40,14 @@ } if (array_key_exists('epm_advanced', $li)){ -echo '' . $li[epm_advanced] . ''; +echo '' . $li['epm_advanced'] . ''; } if (array_key_exists('epm_devices', $li)){ -echo '' . $li[epm_devices] . ''; +echo '' . $li['epm_devices'] . ''; } if (array_key_exists('epm_config', $li)){ echo '

' . _("Brands") . '

'; -echo '' . $li[epm_config] . ''; +echo '' . $li['epm_config'] . ''; } if ( array_key_exists('epm_templates', $li) or @@ -57,10 +57,10 @@ echo '

' . _("Advanced") . '

'; } if (array_key_exists('epm_templates', $li)){ -echo '' . $li[epm_templates] . ''; +echo '' . $li['epm_templates'] . ''; } if (array_key_exists('epm_placeholders', $li)){ -echo '' . $li[epm_placeholders] . ''; +echo '' . $li['epm_placeholders'] . ''; } echo ''; ?> From 647196d690b5593c8a05f9f27e3921a34639aa7c Mon Sep 17 00:00:00 2001 From: "leon.hedding" Date: Thu, 11 Feb 2021 13:52:59 +0000 Subject: [PATCH 2/6] additional fixes for count() without a defined array cast --- Endpointman.class.php | 12 ++++++------ Endpointman_Advanced.class.php | 6 +++--- Endpointman_Config.class.php | 2 +- Endpointman_Templates.class.php | 2 +- ari/modules/phonesettings.module | 2 +- includes/popup.inc | 2 +- install/phonesettings.module | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Endpointman.class.php b/Endpointman.class.php index d0377acf..26c96d76 100644 --- a/Endpointman.class.php +++ b/Endpointman.class.php @@ -1030,7 +1030,7 @@ function get_phone_info($mac_id=NULL) { //$res = sql($sql); $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { //Returns Brand Name, Brand Directory, Model Name, Mac Address, Extension (FreePBX), Custom Configuration Template, Custom Configuration Data, Product Name, Product ID, Product Configuration Directory, Product Configuration Version, Product XML name, $sql = "SELECT endpointman_mac_list.specific_settings, endpointman_mac_list.config_files_override, endpointman_mac_list.global_user_cfg_data, endpointman_model_list.id as model_id, endpointman_brand_list.id as brand_id, endpointman_brand_list.name, endpointman_brand_list.directory, endpointman_model_list.model, endpointman_mac_list.mac, endpointman_mac_list.template_id, endpointman_mac_list.global_custom_cfg_data, endpointman_product_list.long_name, endpointman_product_list.id as product_id, endpointman_product_list.cfg_dir, endpointman_product_list.cfg_ver, endpointman_model_list.template_data, endpointman_model_list.enabled, endpointman_mac_list.global_settings_override FROM endpointman_line_list, endpointman_mac_list, endpointman_model_list, endpointman_brand_list, endpointman_product_list WHERE endpointman_mac_list.model = endpointman_model_list.id AND endpointman_brand_list.id = endpointman_model_list.brand AND endpointman_product_list.id = endpointman_model_list.product_id AND endpointman_mac_list.id = endpointman_line_list.mac_id AND endpointman_mac_list.id = " . $mac_id; $phone_info = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); @@ -1100,7 +1100,7 @@ function get_brand_from_mac($mac) { $brand = sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); $res = sql($oui_sql); - $brand_count = count($res); + $brand_count = count(array($res)); if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. @@ -1207,7 +1207,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; //$res = sql($sql); $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; } @@ -1222,7 +1222,7 @@ function prepare_configs($phone_info, $reboot=TRUE, $write=TRUE) $sql = "SELECT original_name,data FROM endpointman_custom_configs WHERE id = " . $list; //$res = sql($sql); $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res)) { + if (count(array($res))) { $data = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $provisioner_lib->config_files_override[$data['original_name']] = $data['data']; } @@ -1773,7 +1773,7 @@ function discover_new($netmask, $use_nmap=TRUE) { $brand = $this->eda->sql($oui_sql, 'getRow', DB_FETCHMODE_ASSOC); $res = $this->eda->sql($oui_sql); - $brand_count = count($res); + $brand_count = count(array($res)); if (!$brand_count) { //oui doesn't have a matching mysql reference, probably a PC/router/wap/printer of some sort. @@ -1787,7 +1787,7 @@ function discover_new($netmask, $use_nmap=TRUE) { $res = $this->eda->sql($epm_sql); - $epm = count($res) ? TRUE : FALSE; + $epm = count(array($res)) ? TRUE : FALSE; //Add into a final array $final[$z] = array("ip" => $ip, "mac" => $mac, "mac_strip" => $mac_strip, "oui" => $oui, "brand" => $brand['name'], "brand_id" => $brand['id'], "endpoint_managed" => $epm); diff --git a/Endpointman_Advanced.class.php b/Endpointman_Advanced.class.php index f8dae74e..5c4edf59 100644 --- a/Endpointman_Advanced.class.php +++ b/Endpointman_Advanced.class.php @@ -1171,7 +1171,7 @@ public function epm_advanced_iedl_import() //$res = sql($sql); $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res) > 0) { + if (count(array($res)) > 0) { $brand_id = sql($sql, 'getOne'); // $brand_id = $brand_id[0]; @@ -1181,12 +1181,12 @@ public function epm_advanced_iedl_import() $line_id = isset($device[4]) ? $device[4] : 1; $res_model = sql($sql_model); - if (count($res_model)) { + if (count(array($res_model))) { $model_id = sql($sql_model, 'getRow', DB_FETCHMODE_ASSOC); $model_id = $model_id['id']; $res_ext = sql($sql_ext); - if (count($res_ext)) { + if (count(array($res_ext))) { $ext = sql($sql_ext, 'getRow', DB_FETCHMODE_ASSOC); $description = $ext['name']; $ext = $ext['extension']; diff --git a/Endpointman_Config.class.php b/Endpointman_Config.class.php index 7ce7d438..2eca6ca1 100644 --- a/Endpointman_Config.class.php +++ b/Endpointman_Config.class.php @@ -1528,7 +1528,7 @@ function firmware_local_check($id=NULL) { $sql = "SELECT * FROM endpointman_product_list WHERE hidden = 0 AND id ='" . $id . "'"; $res = sql($sql, 'getAll', DB_FETCHMODE_ASSOC); - if (count($res) > 0) { + if (count(array($res)) > 0) { $row = sql($sql, 'getRow', DB_FETCHMODE_ASSOC); $sql = "SELECT directory FROM endpointman_brand_list WHERE hidden = 0 AND id ='" . $row['brand'] . "'"; diff --git a/Endpointman_Templates.class.php b/Endpointman_Templates.class.php index 4fc55a28..c6f1dced 100644 --- a/Endpointman_Templates.class.php +++ b/Endpointman_Templates.class.php @@ -511,7 +511,7 @@ function edit_template_display_files($id, $custom, $namefile = "") $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; $alt_configs_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC ); - if ( count($alt_configs_list) > 0) + if ( count(array($alt_configs_list) > 0) { $files = str_replace(".", "_", $files); foreach ($alt_configs_list as $ccf) diff --git a/ari/modules/phonesettings.module b/ari/modules/phonesettings.module index b13ee8a9..90664979 100644 --- a/ari/modules/phonesettings.module +++ b/ari/modules/phonesettings.module @@ -158,7 +158,7 @@ class phonesettings { $sql = "SELECT mac_id, line FROM endpointman_line_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; $res = $endpoint->eda->sql($sql); - if(count($res)) { + if(count(array($res))) { $mac_row = $endpoint->eda->sql($sql, 'getrow', DB_FETCHMODE_ASSOC); diff --git a/includes/popup.inc b/includes/popup.inc index 3209c20a..c4fc8cde 100644 --- a/includes/popup.inc +++ b/includes/popup.inc @@ -402,7 +402,7 @@ if($_REQUEST['pop_type'] == "alt_cfg_edit") { $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '". $_REQUEST['product_select'] . "'"; $res = $endpoint->eda->sql($sql); $i = 0; - if(count($res)) { + if(count(array($res))) { $data = $endpoint->eda->sql($sql, 'getAll', DB_FETCHMODE_ASSOC); foreach($data as $row2) { $sql_file_list[$i]['value'] = $row2['id']; diff --git a/install/phonesettings.module b/install/phonesettings.module index 1a18edaa..d4201f59 100644 --- a/install/phonesettings.module +++ b/install/phonesettings.module @@ -157,7 +157,7 @@ class phonesettings { $sql = "SELECT mac_id, line FROM endpointman_line_list WHERE ext = '".$_SESSION['ari_user']['extension']."' "; $res = $endpoint->db->query($sql); - if(count($res)) { + if(count(array($res))) { $mac_row = $endpoint->db->getRow($sql, array(), DB_FETCHMODE_ASSOC); From b76b057dcb2a5e9a08fdcf02c40b5f7a7298e885 Mon Sep 17 00:00:00 2001 From: "leon.hedding" Date: Thu, 11 Feb 2021 14:09:19 +0000 Subject: [PATCH 3/6] fixed a typo in code and added the english language for the assets. --- assets/js/default.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 assets/js/default.js diff --git a/assets/js/default.js b/assets/js/default.js new file mode 100644 index 00000000..376bfed7 --- /dev/null +++ b/assets/js/default.js @@ -0,0 +1,41 @@ +/*! + * Bootstrap-select v1.11.2 (http://silviomoreto.github.io/bootstrap-select) + * + * Copyright 2013-2016 bootstrap-select + * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) + */ + +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define(["jquery"], function (a0) { + return (factory(a0)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else { + factory(jQuery); + } + }(this, function (jQuery) { + + (function ($) { + $.fn.selectpicker.defaults = { + noneSelectedText: 'No selection', + noneResultsText: 'No results {0}', + countSelectedText: function (numSelected, numTotal) { + return (numSelected == 1) ? "{0} selected item" : "{0} selected items"; + }, + maxOptionsText: function (numAll, numGroup) { + return [ + (numAll == 1) ? 'Límit reached ({n} max item)' : 'Límit reached ({n} max items)', + (numGroup == 1) ? 'Group limit reached ({n} max item)' : 'Group limit reached ({n} max items)' + ]; + }, + selectAllText: 'Select All', + deselectAllText: 'Deselect All', + multipleSeparator: ', ' + }; + })(jQuery); \ No newline at end of file From 29d498e8008b3dfca2643de191ce150498be3b7b Mon Sep 17 00:00:00 2001 From: "leon.hedding" Date: Thu, 11 Feb 2021 16:00:03 +0000 Subject: [PATCH 4/6] found more places that needed single quotes --- Endpointman_Templates.class.php | 2 +- includes/functions.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Endpointman_Templates.class.php b/Endpointman_Templates.class.php index c6f1dced..48e41e64 100644 --- a/Endpointman_Templates.class.php +++ b/Endpointman_Templates.class.php @@ -511,7 +511,7 @@ function edit_template_display_files($id, $custom, $namefile = "") $sql = "SELECT * FROM endpointman_custom_configs WHERE product_id = '" . $row['product_id'] . "' AND original_name = '" . $files . "'"; $alt_configs_list = sql($sql, 'getAll', DB_FETCHMODE_ASSOC ); - if ( count(array($alt_configs_list) > 0) + if ( count(array($alt_configs_list)) > 0) { $files = str_replace(".", "_", $files); foreach ($alt_configs_list as $ccf) diff --git a/includes/functions.inc b/includes/functions.inc index 2ec5f97b..98ea5ebd 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -838,7 +838,7 @@ class endpointmanager { public function getSysadminSettings(){ //SYSADMIN IS A COMERCIAL MODULE - CHECK IF IT IS INSTALLED, ELSE THIS FEATURE WILL BE SKIPPED. global $active_modules; - if (!empty($active_modules[sysadmin][rawname])) { + if (!empty($active_modules['sysadmin']['rawname'])) { $ret = array(); $sql = "SELECT * FROM sysadmin_options"; From f58a17494746fb1ced78e7e6ab1df6ea7986c427 Mon Sep 17 00:00:00 2001 From: "leon.hedding" Date: Thu, 11 Feb 2021 16:01:58 +0000 Subject: [PATCH 5/6] not all changes commited last time --- includes/functions.inc | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index 98ea5ebd..d6a66b85 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -933,95 +933,95 @@ class endpointmanager { $phone_info['line'][$line['line']]['description'] = $line['epm_description']; $phone_info['line'][$line['line']]['extension'] = $line['ext']; $phone_info['line'][$line['line']]['user_extension'] = $line['user']; - $phone_info['line'][$line['line']]['allowedcodec']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'allow'][data]; - $phone_info['line'][$line['line']]['forcerport']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'force_rport'][data]; - $phone_info['line'][$line['line']]['media_encryption']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'media_encryption'][data]; - $phone_info['line'][$line['line']]['sipdriver']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'sipdriver'][data]; - $phone_info['line'][$line['line']]['transport']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'transport'][data]; - $phone_info['line'][$line['line']]['trustrpid']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'trustrpid'][data]; - $phone_info['line'][$line['line']]['callerid']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'callerid'][data]; - $phone_info['line'][$line['line']]['encryption']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'encryption'][data]; + $phone_info['line'][$line['line']]['allowedcodec']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'allow']['data']; + $phone_info['line'][$line['line']]['forcerport']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'force_rport']['data']; + $phone_info['line'][$line['line']]['media_encryption']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'media_encryption']['data']; + $phone_info['line'][$line['line']]['sipdriver']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'sipdriver']['data']; + $phone_info['line'][$line['line']]['transport']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'transport']['data']; + $phone_info['line'][$line['line']]['trustrpid']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'trustrpid']['data']; + $phone_info['line'][$line['line']]['callerid']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'callerid']['data']; + $phone_info['line'][$line['line']]['encryption']=$sipextensions[$phone_info['line'][$line['line']]['extension'] . '-' . 'encryption']['data']; $phone_info['line'][$line['line']]['timestamp']=time(); //Calculate the right SIP PORT (SIP/PJSIP/TLS/TCP) //TLS if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '0.0.0.0-tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tlsport-0.0.0.0'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tlsport-0.0.0.0']['val']; $phone_info['line'][$line['line']]['proto'] = 'tls'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '127.0.0.1-tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tlsport-127.0.0.1'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tlsport-127.0.0.1']['val']; $phone_info['line'][$line['line']]['proto'] = 'tls'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tls,udp,tcp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tls'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tls,udp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tls'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tls,tcp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tls'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['tlsbindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tls'; } //TCP if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '0.0.0.0-tcp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tcpport-0.0.0.0'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tcpport-0.0.0.0']['val']; $phone_info['line'][$line['line']]['proto'] = 'tcp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '127.0.0.1-tcp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tcpport-127.0.0.1'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['tcpport-127.0.0.1']['val']; $phone_info['line'][$line['line']]['proto'] = 'tcp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tcp,udp,tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tcp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tcp,udp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tcp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tcp,tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tcp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'tcp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'tcp'; } //UDP if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['udpport-0.0.0.0'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['udpport-0.0.0.0']['val']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '0.0.0.0-udp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['udpport-0.0.0.0'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['udpport-0.0.0.0']['val']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_pjsip" and $phone_info['line'][$line['line']]['transport'] == '127.0.0.1-udp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['udpport-127.0.0.1'][val]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings2['udpport-127.0.0.1']['val']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'udp,tcp,tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'udp,tcp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'udp,tls') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } if ($phone_info['line'][$line['line']]['sipdriver'] == "chan_sip" and $phone_info['line'][$line['line']]['transport'] == 'udp') { - $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport'][data]; + $phone_info['line'][$line['line']]['server_port'] = $SipSettings1['bindport']['data']; $phone_info['line'][$line['line']]['proto'] = 'udp'; } @@ -3896,4 +3896,4 @@ function endpointmanager_read_body($ch, $string) { //ob_flush(); endpointman_flush_buffers(); return $length; -} \ No newline at end of file +} From 9e091f0cf25a39b409e12c45a3c16001d4d03108 Mon Sep 17 00:00:00 2001 From: leonhedding Date: Tue, 23 Mar 2021 13:17:13 +0000 Subject: [PATCH 6/6] Update functions.inc found some additional variables that needed to be fixed for voicemail that were missed before. --- includes/functions.inc | 102 ++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/includes/functions.inc b/includes/functions.inc index d6a66b85..96bf07aa 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -2013,32 +2013,32 @@ class endpointmanager { //Calculate Voicemail Number - if (!$featurecodes[myvoicemail][customcode]) { - $provisioner_lib->settings['myvoicemail'] = $featurecodes[myvoicemail][defaultcode]; + if (!$featurecodes['myvoicemail']['customcode']) { + $provisioner_lib->settings['myvoicemail'] = $featurecodes['myvoicemail']['defaultcode']; } else { - $provisioner_lib->settings['myvoicemail'] = $featurecodes[myvoicemail][customcode]; + $provisioner_lib->settings['myvoicemail'] = $featurecodes['myvoicemail']['customcode']; } //Calculate DND_ON_NUMBER - if (!$featurecodes[dnd_on][customcode]) { - $provisioner_lib->settings['dnd_on'] = $featurecodes[dnd_on][defaultcode]; + if (!$featurecodes['dnd_on']['customcode']) { + $provisioner_lib->settings['dnd_on'] = $featurecodes['dnd_on']['defaultcode']; } else { - $provisioner_lib->settings['dnd_on'] = $featurecodes[dnd_on][customcode]; + $provisioner_lib->settings['dnd_on'] = $featurecodes['dnd_on']['customcode']; } //Calculate DND_OFF_NUMBER - if (!$featurecodes[dnd_off][customcode]) { - $provisioner_lib->settings['dnd_off'] = $featurecodes[dnd_off][defaultcode]; + if (!$featurecodes['dnd_off']['customcode']) { + $provisioner_lib->settings['dnd_off'] = $featurecodes['dnd_off']['defaultcode']; } else { - $provisioner_lib->settings['dnd_off'] = $featurecodes[dnd_off][customcode]; + $provisioner_lib->settings['dnd_off'] = $featurecodes['dnd_off']['customcode']; } //Calculate DND_TOGGLE_NUMBER - if (!$featurecodes[dnd_toggle][customcode]) { - $provisioner_lib->settings['dnd_toggle'] = $featurecodes[dnd_toggle][defaultcode]; + if (!$featurecodes['dnd_toggle']['customcode']) { + $provisioner_lib->settings['dnd_toggle'] = $featurecodes['dnd_toggle']['defaultcode']; } else { - $provisioner_lib->settings['dnd_toggle'] = $featurecodes[dnd_toggle][customcode]; + $provisioner_lib->settings['dnd_toggle'] = $featurecodes['dnd_toggle']['customcode']; } @@ -2077,10 +2077,10 @@ class endpointmanager { 'primtimeserver' => $this->global_cfg['ntp'], 'globaladminpassword' => $this->global_cfg['adminpass'], 'globaluserpassword' => $this->global_cfg['userpass'], - 'provisuser' => $getSysadminSettings[provisuser][value], - 'provispass' => $getSysadminSettings[provispass][value], - 'sslhpro' => $getSysadminSettings[sslhpro][value], - 'hpro' => $getSysadminSettings[hpro][value] + 'provisuser' => $getSysadminSettings['provisuser']['value'], + 'provispass' => $getSysadminSettings['provispass']['value'], + 'sslhpro' => $getSysadminSettings['sslhpro']['value'], + 'hpro' => $getSysadminSettings['hpro']['value'] ); @@ -2088,30 +2088,30 @@ class endpointmanager { //STATIC LINE SETTINGS WITHOUT LOOP (accXSetting) - $provisioner_lib->settings['acc' . $line[line] . 'secret'] = $line['secret']; - $provisioner_lib->settings['acc' . $line[line] . 'displayname'] = $line['description']; - $provisioner_lib->settings['acc' . $line[line] . 'user_extension'] = $line['user_extension']; - $provisioner_lib->settings['acc' . $line[line] . 'username'] = $line['ext']; - $provisioner_lib->settings['acc' . $line[line] . 'authname'] = $line['ext']; - $provisioner_lib->settings['acc' . $line[line] . 'extension'] = $line['extension']; - $provisioner_lib->settings['acc' . $line[line] . 'allowedcodec'] = $line['allowedcodec']; - $provisioner_lib->settings['acc' . $line[line] . 'forcerport'] = $line['forcerport']; - $provisioner_lib->settings['acc' . $line[line] . 'media_encryption'] = $line['media_encryption']; - $provisioner_lib->settings['acc' . $line[line] . 'sipdriver'] = $line['sipdriver']; - $provisioner_lib->settings['acc' . $line[line] . 'transport'] = $line['transport']; - $provisioner_lib->settings['acc' . $line[line] . 'trustrpid'] = $line['trustrpid']; - $provisioner_lib->settings['acc' . $line[line] . 'callerid'] = $line['callerid']; - $provisioner_lib->settings['acc' . $line[line] . 'encryption'] = $line['encryption']; - $provisioner_lib->settings['acc' . $line[line] . 'server_port'] = $line['server_port']; - $provisioner_lib->settings['acc' . $line[line] . 'ipei'] = $line['ipei']; + $provisioner_lib->settings['acc' . $line['line'] . 'secret'] = $line['secret']; + $provisioner_lib->settings['acc' . $line['line'] . 'displayname'] = $line['description']; + $provisioner_lib->settings['acc' . $line['line'] . 'user_extension'] = $line['user_extension']; + $provisioner_lib->settings['acc' . $line['line'] . 'username'] = $line['ext']; + $provisioner_lib->settings['acc' . $line['line'] . 'authname'] = $line['ext']; + $provisioner_lib->settings['acc' . $line['line'] . 'extension'] = $line['extension']; + $provisioner_lib->settings['acc' . $line['line'] . 'allowedcodec'] = $line['allowedcodec']; + $provisioner_lib->settings['acc' . $line['line'] . 'forcerport'] = $line['forcerport']; + $provisioner_lib->settings['acc' . $line['line'] . 'media_encryption'] = $line['media_encryption']; + $provisioner_lib->settings['acc' . $line['line'] . 'sipdriver'] = $line['sipdriver']; + $provisioner_lib->settings['acc' . $line['line'] . 'transport'] = $line['transport']; + $provisioner_lib->settings['acc' . $line['line'] . 'trustrpid'] = $line['trustrpid']; + $provisioner_lib->settings['acc' . $line['line'] . 'callerid'] = $line['callerid']; + $provisioner_lib->settings['acc' . $line['line'] . 'encryption'] = $line['encryption']; + $provisioner_lib->settings['acc' . $line['line'] . 'server_port'] = $line['server_port']; + $provisioner_lib->settings['acc' . $line['line'] . 'ipei'] = $line['ipei']; $provisioner_lib->settings['server_host'] = $this->global_cfg['srvip']; $provisioner_lib->settings['primtimeserver'] = $this->global_cfg['ntp']; $provisioner_lib->settings['globaladminpassword'] = $this->global_cfg['adminpass']; $provisioner_lib->settings['globaluserpassword'] = $this->global_cfg['userpass']; - $provisioner_lib->settings['provisuser'] = $getSysadminSettings[provisuser][value]; - $provisioner_lib->settings['provispass'] = $getSysadminSettings[provispass][value]; - $provisioner_lib->settings['sslhpro'] = $getSysadminSettings[sslhpro][value]; - $provisioner_lib->settings['hpro'] = $getSysadminSettings[hpro][value]; + $provisioner_lib->settings['provisuser'] = $getSysadminSettings['provisuser']['value']; + $provisioner_lib->settings['provispass'] = $getSysadminSettings['provispass']['value']; + $provisioner_lib->settings['sslhpro'] = $getSysadminSettings['sslhpro']['value']; + $provisioner_lib->settings['hpro'] = $getSysadminSettings['hpro']['value']; $provisioner_lib->settings['timestamp'] = time(); @@ -2123,30 +2123,30 @@ class endpointmanager { //PROTO UPD/TCP/TLS if ($line['proto'] == "tcp") { - $line_statics[gsproto] = '1'; + $line_statics['gsproto'] = '1'; } if ($line['proto'] == "udp") { - $line_statics[gsproto] = '0'; + $line_statics['gsproto'] = '0'; } if ($line['proto'] == "tls") { - $line_statics[gsproto] = '2'; + $line_statics['gsproto'] = '2'; } //GRANDSTREAM SRTP YES/NO if ($line['encryption'] == "yes" || $line['media_encryption'] == "sdes" ) { - $line_statics[gsSRTP] = '1'; + $line_statics['gsSRTP'] = '1'; } if ($line['encryption'] == "no" || $line['media_encryption'] == "no" ) { - $line_statics[gsSRTP] = '0'; + $line_statics['gsSRTP'] = '0'; } //Add static Values for Grandstream (Tested with Analog HT8XX Adapter) - $provisioner_lib->settings['acc' . $line[line] . 'gsproto'] = $line_statics[gsproto]; - $provisioner_lib->settings['acc' . $line[line] . 'gsSRTP'] = $line_statics[gsSRTP]; + $provisioner_lib->settings['acc' . $line['line'] . 'gsproto'] = $line_statics['gsproto']; + $provisioner_lib->settings['acc' . $line['line'] . 'gsSRTP'] = $line_statics['gsSRTP']; //THIS ARE EXTRA VALUES FOR YEALINK @@ -2154,30 +2154,30 @@ class endpointmanager { //PROTO UPD/TCP/TLS if ($line['proto'] == "tcp") { - $line_statics[yealinktransport] = '1'; + $line_statics['yealinktransport'] = '1'; } if ($line['proto'] == "udp") { - $line_statics[yealinktransport] = '0'; + $line_statics['yealinktransport'] = '0'; } if ($line['proto'] == "tls") { - $line_statics[yealinktransport] = '2'; + $line_statics['yealinktransport'] = '2'; } //Yealink SRTP YES/NO if ($line['encryption'] == "yes" || $line['media_encryption'] == "sdes" ) { - $line_statics[yealinksrtp] = '2'; + $line_statics['yealinksrtp'] = '2'; } if ($line['encryption'] == "no" || $line['media_encryption'] == "no" ) { - $line_statics[yealinksrtp] = '0'; + $line_statics['yealinksrtp'] = '0'; } //Add static Values for Grandstream (Tested with Analog HT8XX Adapter) - $provisioner_lib->settings['acc' . $line[line] . 'yealinktransport'] = $line_statics[gsproto]; - $provisioner_lib->settings['acc' . $line[line] . 'yealinksrtp'] = $line_statics[gsSRTP]; + $provisioner_lib->settings['acc' . $line['line'] . 'yealinktransport'] = $line_statics['gsproto']; + $provisioner_lib->settings['acc' . $line['line'] . 'yealinksrtp'] = $line_statics['gsSRTP']; @@ -3881,7 +3881,7 @@ function endpointmanager_read_header($ch, $string) { function endpointmanager_read_body($ch, $string) { global $fout, $file_size, $downloaded, $lastseen, $progress_bar; - $length = strlen($string); + $length = strlen($string) $downloaded += intval($length); $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); $downloadProgress = 100 - $downloadProgress;